{"version":3,"sources":["../../../src/lib/data-list.tsx"],"sourcesContent":["import classNames from \"clsx\";\nimport * as React from \"react\";\nimport { Text } from \"@radix-ui/themes\";\nimport { Slot } from \"radix-ui\";\nimport { extractProps } from \"@radix-ui/themes/helpers\";\nimport type {\n  ComponentPropsWithout,\n  RemovedProps,\n} from \"@radix-ui/themes/helpers\";\nimport type { GetPropDefTypes, MarginProps } from \"@radix-ui/themes/props\";\nimport {\n  dataListItemPropDefs,\n  dataListLabelPropDefs,\n  dataListRootPropDefs,\n  dataListValuePropDefs,\n} from \"./data-list.props.js\";\n\ntype DataListRootElement = HTMLDListElement;\ntype DataListRootOwnProps = GetPropDefTypes<typeof dataListRootPropDefs>;\ninterface CommonDataListRootProps extends MarginProps, DataListRootOwnProps {}\ntype DataListRootDivProps = { as?: \"div\" } & ComponentPropsWithout<\n  \"div\",\n  RemovedProps\n>;\ntype DataListRootDlProps = { as?: \"dl\" } & ComponentPropsWithout<\n  \"dl\",\n  RemovedProps\n>;\ntype DataListRootProps = CommonDataListRootProps &\n  (DataListRootDivProps | DataListRootDlProps);\n\nconst DataListRoot = React.forwardRef<DataListRootElement, DataListRootProps>(\n  (props, forwardedRef) => {\n    const {\n      children,\n      className,\n      asChild,\n      as: Tag = \"dl\",\n      ...dataListProps\n    } = extractProps(props, dataListRootPropDefs);\n    return (\n      <Text asChild>\n        <Slot.Root\n          {...dataListProps}\n          ref={forwardedRef}\n          className={classNames(\"rt-DataListRoot\", className)}\n        >\n          {asChild ? children : <Tag>{children}</Tag>}\n        </Slot.Root>\n      </Text>\n    );\n  },\n);\nDataListRoot.displayName = \"DataList.Root\";\n\ntype DataListItemElement = HTMLDivElement;\ntype DataListItemOwnProps = GetPropDefTypes<typeof dataListItemPropDefs>;\ninterface DataListItemProps\n  extends ComponentPropsWithout<\"div\", RemovedProps>, DataListItemOwnProps {}\nconst DataListItem = React.forwardRef<DataListItemElement, DataListItemProps>(\n  (props, forwardedRef) => {\n    const { children, className, asChild, ...itemProps } = extractProps(\n      props,\n      dataListItemPropDefs,\n    );\n    return (\n      <Slot.Root\n        {...itemProps}\n        ref={forwardedRef}\n        className={classNames(\"rt-DataListItem\", className)}\n      >\n        {asChild ? children : <div>{children}</div>}\n      </Slot.Root>\n    );\n  },\n);\nDataListItem.displayName = \"DataList.Item\";\n\ntype DataListLabelElement = React.ComponentRef<\"dt\">;\ntype DataListLabelOwnProps = GetPropDefTypes<typeof dataListLabelPropDefs>;\ninterface CommonDataListLabelProps extends MarginProps, DataListLabelOwnProps {}\ntype DataListLabelDtProps = { as?: \"dt\" } & ComponentPropsWithout<\n  \"dt\",\n  RemovedProps\n>;\ntype DataListLabelDivProps = { as?: \"div\" } & ComponentPropsWithout<\n  \"div\",\n  RemovedProps\n>;\ntype DataListLabelProps = CommonDataListLabelProps &\n  (DataListLabelDtProps | DataListLabelDivProps);\n\nconst DataListLabel = React.forwardRef<\n  DataListLabelElement,\n  DataListLabelProps\n>((props, forwardedRef) => {\n  const {\n    asChild,\n    as: Tag = \"dt\",\n    children,\n    className,\n    color,\n    ...labelProps\n  } = extractProps(props, dataListLabelPropDefs);\n  return (\n    <Slot.Root\n      {...labelProps}\n      data-accent-color={color}\n      ref={forwardedRef}\n      className={classNames(\"rt-DataListLabel\", className)}\n    >\n      {asChild ? children : <Tag>{children}</Tag>}\n    </Slot.Root>\n  );\n});\nDataListLabel.displayName = \"DataList.Label\";\n\ntype DataListValueElement = React.ComponentRef<\"dd\">;\ntype DataListValueOwnProps = GetPropDefTypes<typeof dataListValuePropDefs>;\ninterface CommonDataListValueProps extends MarginProps, DataListValueOwnProps {}\ntype DataListValueDdProps = { as?: \"dd\" } & ComponentPropsWithout<\n  \"dd\",\n  RemovedProps\n>;\ntype DataListValueDivProps = { as?: \"div\" } & ComponentPropsWithout<\n  \"div\",\n  RemovedProps\n>;\ntype DataListValueProps = CommonDataListValueProps &\n  (DataListValueDdProps | DataListValueDivProps);\nconst DataListValue = React.forwardRef<\n  DataListValueElement,\n  DataListValueProps\n>((props, forwardedRef) => {\n  const {\n    children,\n    className,\n    asChild,\n    as: Tag = \"dd\",\n    ...valueProps\n  } = extractProps(props, dataListValuePropDefs);\n  return (\n    <Slot.Root\n      {...valueProps}\n      ref={forwardedRef}\n      className={classNames(className, \"rt-DataListValue\")}\n    >\n      {asChild ? children : <Tag>{children}</Tag>}\n    </Slot.Root>\n  );\n});\nDataListValue.displayName = \"DataList.Value\";\n\nexport {\n  DataListRoot as Root,\n  DataListItem as Item,\n  DataListLabel as Label,\n  DataListValue as Value,\n};\nexport type {\n  DataListRootElement as RootElement,\n  DataListRootProps as RootProps,\n  DataListItemElement as ItemElement,\n  DataListItemProps as ItemProps,\n  DataListLabelElement as LabelElement,\n  DataListLabelProps as LabelProps,\n  DataListValueElement as ValueElement,\n  DataListValueProps as ValueProps,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CgC;AA/ChC,kBAAuB;AACvB,YAAuB;AACvB,oBAAqB;AACrB,sBAAqB;AACrB,qBAA6B;AAM7B,6BAKO;AAgBP,MAAM,eAAe,MAAM;AAAA,EACzB,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,IAAI,MAAM;AAAA,MACV,GAAG;AAAA,IACL,QAAI,6BAAa,OAAO,2CAAoB;AAC5C,WACE,4CAAC,sBAAK,SAAO,MACX;AAAA,MAAC,qBAAK;AAAA,MAAL;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,eAAW,YAAAA,SAAW,mBAAmB,SAAS;AAAA,QAEjD,oBAAU,WAAW,4CAAC,OAAK,UAAS;AAAA;AAAA,IACvC,GACF;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;AAM3B,MAAM,eAAe,MAAM;AAAA,EACzB,CAAC,OAAO,iBAAiB;AACvB,UAAM,EAAE,UAAU,WAAW,SAAS,GAAG,UAAU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