@xploreu/components 0.4.25 → 0.4.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2URFXFQC.js +2 -0
- package/dist/chunk-2URFXFQC.js.map +1 -0
- package/dist/{chunk-RJ2SAHLO.js → chunk-6OC5NZB6.js} +2 -2
- package/dist/{chunk-RJ2SAHLO.js.map → chunk-6OC5NZB6.js.map} +1 -1
- package/dist/{chunk-3SPYZO2Y.js → chunk-BTH76ISM.js} +2 -2
- package/dist/{chunk-3SPYZO2Y.js.map → chunk-BTH76ISM.js.map} +1 -1
- package/dist/chunk-CDHMNEJ5.js +2 -0
- package/dist/chunk-CDHMNEJ5.js.map +1 -0
- package/dist/{chunk-QUSWZDB5.js → chunk-GRQYQEGS.js} +2 -2
- package/dist/{chunk-QUSWZDB5.js.map → chunk-GRQYQEGS.js.map} +1 -1
- package/dist/chunk-HHG7BSWN.js +2 -0
- package/dist/chunk-HHG7BSWN.js.map +1 -0
- package/dist/{chunk-W6CEQOB6.js → chunk-IT4LPPTN.js} +2 -2
- package/dist/{chunk-W6CEQOB6.js.map → chunk-IT4LPPTN.js.map} +1 -1
- package/dist/chunk-IZQFTYJD.js +2 -0
- package/dist/chunk-IZQFTYJD.js.map +1 -0
- package/dist/{chunk-VNU37GJC.js → chunk-JYFVQ5NY.js} +2 -2
- package/dist/{chunk-VNU37GJC.js.map → chunk-JYFVQ5NY.js.map} +1 -1
- package/dist/{chunk-TZ44HGOL.js → chunk-LNL3VCSF.js} +2 -2
- package/dist/{chunk-TZ44HGOL.js.map → chunk-LNL3VCSF.js.map} +1 -1
- package/dist/{chunk-V2D72N26.js → chunk-VODPMAOM.js} +2 -2
- package/dist/{chunk-V2D72N26.js.map → chunk-VODPMAOM.js.map} +1 -1
- package/dist/{chunk-O2V2JJ2V.js → chunk-WV5OCKQK.js} +2 -2
- package/dist/{chunk-O2V2JJ2V.js.map → chunk-WV5OCKQK.js.map} +1 -1
- package/dist/{chunk-H2BHLGW2.js → chunk-YB74L6RO.js} +2 -2
- package/dist/{chunk-H2BHLGW2.js.map → chunk-YB74L6RO.js.map} +1 -1
- package/dist/composites/combobox-chip-outside.js +1 -1
- package/dist/composites/combobox-chip.js +1 -1
- package/dist/composites/combobox-simple.js +1 -1
- package/dist/composites/filter-combobox.d.ts +3 -15
- package/dist/composites/filter-combobox.js +1 -1
- package/dist/composites/index.d.ts +33 -3
- package/dist/composites/index.js +1 -1
- package/dist/composites/index.js.map +1 -1
- package/dist/composites/phone-input.js +1 -1
- package/dist/composites/profile-avatar.d.ts +1 -1
- package/dist/effects/highlight.d.ts +13 -13
- package/dist/effects/highlight.js +1 -1
- package/dist/effects/index.js +1 -1
- package/dist/primitives/combobox.d.ts +3 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/ui/avatar.d.ts +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/combobox.d.ts +4 -2
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/input.d.ts +1 -1
- package/dist/ui/menu.js +1 -1
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/tabs.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2XZRLJCN.js +0 -2
- package/dist/chunk-2XZRLJCN.js.map +0 -1
- package/dist/chunk-DFAATW5A.js +0 -2
- package/dist/chunk-DFAATW5A.js.map +0 -1
- package/dist/chunk-EO656DPM.js +0 -2
- package/dist/chunk-EO656DPM.js.map +0 -1
- package/dist/chunk-PHP3T7ZS.js +0 -2
- package/dist/chunk-PHP3T7ZS.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/combobox.tsx"],"names":["Combobox","props","jsx","ComboboxTrigger","className","rest","cn","ComboboxLabel","ComboboxInputGroup","ComboboxInput","wrapperClassName","Input","SearchIcon","ComboboxInputFilter","displayValueKey","placeholder","inputProps","inputValue","setInputValue","useCombobox","inputClassName","startContent","restInputProps","jsxs","ComboboxChips","e","XIcon","event","ComboboxValue","value","item","ComboboxChip","ComboboxChipRemove","ComboboxIcon","ComboboxClear","Badge","BadgeButton","ComboboxPopup","align","sideOffset","container","initialFocus","finalFocus","style","children","ComboboxPortal","ComboboxPositioner","ComboboxHighlight","ComboboxBackdrop","ComboboxStatus","status","trimmedInputValue","text","Fragment","Loader2Icon","ComboboxEmpty","ComboboxList","items","useFilteredItems","ScrollArea","index","ComboboxHighlightItem","ComboboxRow","ComboboxItem","indicator","disabled","ComboboxItemIndicator","state","CheckCircle2Icon","Checkbox","ComboboxItemTitle","ComboboxItemDescription","ComboboxItemIcon","ComboboxItemAvatar","src","imageSrc","avatarClassName","imageAlt","fallbackText","finalSrc","Avatar","AvatarImage","AvatarFallback","ComboboxSeparator","ComboboxGroup","ComboboxGroupLabel","ComboboxCollection","ComboboxArrow","ComboboxInfiniteScroll","hasMore","threshold","InfiniteScroll"],"mappings":"8hBAgFA,SAASA,EAAAA,CAA8DC,CAAAA,CAAuC,CAC5G,OACEC,GAAAA,CAACF,CAAAA,CAAA,CAAmB,GAAGC,CAAAA,CAAO,CAElC,CAIA,SAASE,EAAAA,CAAgBF,CAAAA,CAA6B,CACpD,GAAM,CAAE,SAAA,CAAAG,CAAAA,CAAW,GAAGC,CAAK,CAAA,CAAIJ,CAAAA,CAE/B,OAAOC,GAAAA,CAACC,EAAA,CACN,SAAA,CAAWG,EAAAA,CACT,gDAAA,CACAF,CACF,CAAA,CACC,GAAGC,CAAAA,CACN,CACF,CAIA,SAASE,EAAAA,CAAcN,CAAAA,CAA2B,CAChD,GAAM,CAAE,SAAA,CAAAG,EAAW,GAAGC,CAAK,CAAA,CAAIJ,CAAAA,CAE/B,OAAOC,GAAAA,CAACK,CAAAA,CAAA,CACN,UAAWD,EAAA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AA,CAASF,CAAAA,CACT,SAAA,CAAWC,CAAAA,CACV,GAAGzF,CAAAA,CAEH,QAAA,CAAAwF,CAAAA,EACClE,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,4EAAA,CACb,QAAA,CAAA,CAAArB,IAACoD,WAAAA,CAAA,CAAY,SAAA,CAAU,qBAAA,CAAsB,EAC7CpD,GAAAA,CAAC,MAAA,CAAA,CAAK,QAAA,CAAA,iBAAA,CAEN,CAAA,CAAA,CACF,EAEJ,CAEJ","file":"chunk-IZQFTYJD.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport {\r\n CheckCircle2Icon,\r\n Loader2Icon,\r\n SearchIcon,\r\n XIcon\r\n} from \"lucide-react\"\r\n\r\nimport {\r\n Combobox as ComboboxPrimitive,\r\n ComboboxArrow as ComboboxArrowPrimitive,\r\n type ComboboxArrowProps as ComboboxArrowPrimitiveProps,\r\n ComboboxBackdrop as ComboboxBackdropPrimitive,\r\n type ComboboxBackdropProps as ComboboxBackdropPrimitiveProps,\r\n ComboboxChip as ComboboxChipPrimitive,\r\n type ComboboxChipProps as ComboboxChipPrimitiveProps,\r\n ComboboxChipRemove as ComboboxChipRemovePrimitive,\r\n type ComboboxChipRemoveProps as ComboboxChipRemovePrimitiveProps,\r\n ComboboxChips as ComboboxChipsPrimitive,\r\n type ComboboxChipsProps as ComboboxChipsPrimitiveProps,\r\n ComboboxClear as ComboboxClearPrimitive,\r\n type ComboboxClearProps as ComboboxClearPrimitiveProps,\r\n ComboboxCollection as ComboboxCollectionPrimitive,\r\n type ComboboxCollectionProps as ComboboxCollectionPrimitiveProps,\r\n ComboboxEmpty as ComboboxEmptyPrimitive,\r\n type ComboboxEmptyProps as ComboboxEmptyPrimitiveProps,\r\n ComboboxGroup as ComboboxGroupPrimitive,\r\n ComboboxGroupLabel as ComboboxGroupLabelPrimitive,\r\n type ComboboxGroupLabelProps as ComboboxGroupLabelPrimitiveProps,\r\n type ComboboxGroupProps as ComboboxGroupPrimitiveProps,\r\n ComboboxHighlight as ComboboxHighlightPrimitive,\r\n ComboboxHighlightItem as ComboboxHighlightItemPrimitive,\r\n type ComboboxHighlightItemProps as ComboboxHighlightItemPrimitiveProps,\r\n type ComboboxHighlightProps as ComboboxHighlightPrimitiveProps,\r\n ComboboxIcon as ComboboxIconPrimitive,\r\n type ComboboxIconProps as ComboboxIconPrimitiveProps,\r\n ComboboxInput as ComboboxInputPrimitive,\r\n ComboboxInputGroup as ComboboxInputGroupPrimitive,\r\n type ComboboxInputGroupProps as ComboboxInputGroupPrimitiveProps,\r\n type ComboboxInputProps as ComboboxInputPrimitiveProps,\r\n ComboboxItem as ComboboxItemPrimitive,\r\n ComboboxItemIndicator as ComboboxItemIndicatorPrimitive,\r\n type ComboboxItemIndicatorProps as ComboboxItemIndicatorPrimitiveProps,\r\n type ComboboxItemProps as ComboboxItemPrimitiveProps,\r\n ComboboxLabel as ComboboxLabelPrimitive,\r\n type ComboboxLabelProps as ComboboxLabelPrimitiveProps,\r\n ComboboxList as ComboboxListPrimitive,\r\n type ComboboxListProps as ComboboxListPrimitiveProps,\r\n ComboboxPopup as ComboboxPopupPrimitive,\r\n type ComboboxPopupProps as ComboboxPopupPrimitiveProps,\r\n ComboboxPortal as ComboboxPortalPrimitive,\r\n type ComboboxPortalProps as ComboboxPortalPrimitiveProps,\r\n ComboboxPositioner as ComboboxPositionerPrimitive,\r\n type ComboboxPositionerProps as ComboboxPositionerPrimitiveProps,\r\n type ComboboxProps as ComboboxPrimitiveProps,\r\n ComboboxRow as ComboboxRowPrimitive,\r\n type ComboboxRowProps as ComboboxRowPrimitiveProps,\r\n ComboboxSeparator as ComboboxSeparatorPrimitive,\r\n type ComboboxSeparatorProps as ComboboxSeparatorPrimitiveProps,\r\n ComboboxStatus as ComboboxStatusPrimitive,\r\n type ComboboxStatusProps as ComboboxStatusPrimitiveProps,\r\n ComboboxTrigger as ComboboxTriggerPrimitive,\r\n type ComboboxTriggerProps as ComboboxTriggerPrimitiveProps,\r\n ComboboxValue as ComboboxValuePrimitive,\r\n type ComboboxValueProps as ComboboxValuePrimitiveProps,\r\n useCombobox,\r\n useFilteredItems,\r\n} from \"../primitives/combobox\"\r\nimport { cn } from \"@xploreu/lib/cn\"\r\n\r\nimport { ScrollArea } from \"./scroll-area\"\r\nimport { Badge, BadgeButton } from \"./badge\"\r\nimport { InfiniteScroll } from \"./infinite-scroll\"\r\nimport { Input } from \"./input\"\r\nimport { Checkbox } from \"./checkbox\"\r\nimport { Avatar, AvatarFallback, AvatarImage } from \"./avatar\"\r\n\r\ntype ComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxPrimitiveProps<Value, Multiple>\r\n\r\nfunction Combobox<Value, Multiple extends boolean | undefined = false>(props: ComboboxProps<Value, Multiple>) {\r\n return (\r\n <ComboboxPrimitive {...props} />\r\n )\r\n}\r\n\r\ntype ComboboxTriggerProps = ComboboxTriggerPrimitiveProps\r\n\r\nfunction ComboboxTrigger(props: ComboboxTriggerProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxTriggerPrimitive\r\n className={cn(\r\n \"group/combobox-trigger flex items-center gap-2\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxLabelProps = ComboboxLabelPrimitiveProps\r\n\r\nfunction ComboboxLabel(props: ComboboxLabelProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxLabelPrimitive\r\n className={cn(\r\n \"text-label-semibold-2 text-text-secondary\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxInputGroupProps = ComboboxInputGroupPrimitiveProps\r\n\r\nfunction ComboboxInputGroup(props: ComboboxInputGroupProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxInputGroupPrimitive\r\n className={cn(\r\n \"flex w-full items-center gap-2\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxInputProps = ComboboxInputPrimitiveProps & {\r\n wrapperClassName?: string\r\n}\r\n\r\nfunction ComboboxInput({\r\n className,\r\n wrapperClassName,\r\n ...props\r\n}: ComboboxInputProps) {\r\n\r\n return (\r\n <div className={cn(\"p-3 border-b border-border-primary\", wrapperClassName)}>\r\n <ComboboxInputPrimitive\r\n className={className}\r\n render={<Input size=\"sm\" startContent={<SearchIcon />} />}\r\n {...props}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nfunction ComboboxInputFilter({\r\n className,\r\n displayValueKey = { label: \"label\", value: \"value\" },\r\n placeholder = \"Search and Select Company\",\r\n inputProps,\r\n ...props\r\n}: ComboboxInputProps & {\r\n displayValueKey?: {\r\n label: string\r\n value: string\r\n }\r\n placeholder?: string\r\n inputProps?: React.ComponentProps<typeof Input>\r\n}) {\r\n const { inputValue, setInputValue } = useCombobox()\r\n const { className: inputClassName, startContent, ...restInputProps } = inputProps || {}\r\n\r\n return (\r\n <div className={cn(\"flex flex-col gap-2\", className)}>\r\n <ComboboxChips\r\n onMouseDown={(e) => e.preventBaseUIHandler()}\r\n className=\"flex-col\"\r\n >\r\n <ComboboxInputPrimitive\r\n render={\r\n <Input\r\n className={cn(\"h-9 text-body-regular-3 pl-9 pr-7\", inputClassName)}\r\n endContent={\r\n <ComboboxTrigger\r\n nativeButton={false}\r\n render={(\r\n <XIcon\r\n className=\"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer\"\r\n data-hidden={!inputValue}\r\n data-slot=\"combobox-clear-input\"\r\n onClick={(event) => {\r\n setInputValue(\"\", {\r\n reason: \"none\",\r\n event: event.nativeEvent,\r\n cancel: () => { },\r\n allowPropagation: () => { },\r\n isCanceled: false,\r\n isPropagationAllowed: true,\r\n trigger: undefined,\r\n })\r\n }}\r\n />\r\n )}\r\n />\r\n }\r\n placeholder={placeholder}\r\n startContent={startContent ?? <SearchIcon className=\"!size-4 !text-fg-tertiary-hover\" />}\r\n {...restInputProps}\r\n />\r\n }\r\n {...props}\r\n />\r\n <ComboboxValue>\r\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\r\n {(value) => value?.map((item: any) => (\r\n <ComboboxChip key={item?.[displayValueKey.value] || \"\"}>\r\n {item?.[displayValueKey.label] || \"\"}\r\n <ComboboxChipRemove />\r\n </ComboboxChip>\r\n ))}\r\n </ComboboxValue>\r\n </ComboboxChips>\r\n </div>\r\n )\r\n}\r\n\r\ntype ComboboxIconProps = ComboboxIconPrimitiveProps\r\n\r\nfunction ComboboxIcon(props: ComboboxIconProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxIconPrimitive\r\n className={cn(\"text-text-secondary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxClearProps = ComboboxClearPrimitiveProps\r\n\r\nfunction ComboboxClear(props: ComboboxClearProps) {\r\n\r\n return (\r\n <ComboboxClearPrimitive\r\n render={<XIcon />}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxValueProps = ComboboxValuePrimitiveProps\r\n\r\nfunction ComboboxValue(props: ComboboxValueProps) {\r\n return <ComboboxValuePrimitive {...props} />\r\n}\r\n\r\ntype ComboboxChipsProps = ComboboxChipsPrimitiveProps\r\n\r\nfunction ComboboxChips({\r\n className,\r\n ...props\r\n}: ComboboxChipsProps) {\r\n return <ComboboxChipsPrimitive\r\n className={cn(\"flex flex-wrap gap-2\", className)}\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxChipProps = ComboboxChipPrimitiveProps\r\n\r\nfunction ComboboxChip({\r\n className,\r\n ...props\r\n}: ComboboxChipProps) {\r\n return (\r\n <Badge\r\n className={cn(\"ring-1 ring-border-brand text-body-medium-3\", className)}\r\n color=\"brand\"\r\n render={(\r\n <ComboboxChipPrimitive\r\n {...props}\r\n />\r\n )}\r\n size=\"lg\"\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxChipRemoveProps = ComboboxChipRemovePrimitiveProps\r\n\r\nfunction ComboboxChipRemove({\r\n className,\r\n ...props\r\n}: ComboboxChipRemoveProps) {\r\n return (\r\n <BadgeButton\r\n className={cn(\"text-fg-quaternary\", className)}\r\n render={(\r\n <ComboboxChipRemovePrimitive\r\n {...props}\r\n />\r\n )}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxPopupProps = ComboboxPositionerPrimitiveProps &\r\n ComboboxPopupPrimitiveProps & {\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n }\r\n\r\nfunction ComboboxPopup({\r\n className,\r\n align = \"start\",\r\n sideOffset = 4,\r\n container,\r\n initialFocus,\r\n finalFocus,\r\n style,\r\n children,\r\n ...props\r\n}: ComboboxPopupProps) {\r\n return (\r\n <ComboboxPortalPrimitive container={container}>\r\n <ComboboxPositionerPrimitive\r\n align={align}\r\n className=\"isolate z-50\"\r\n sideOffset={sideOffset}\r\n {...props}\r\n >\r\n <ComboboxPopupPrimitive\r\n className={cn(\r\n \"group/combobox-popup bg-bg-primary text-text-primary max-h-(--available-height) w-72 max-w-(--available-width) origin-(--transform-origin) rounded-md border border-border-primary shadow-md outline-hidden\",\r\n className,\r\n )}\r\n finalFocus={finalFocus}\r\n initialFocus={initialFocus}\r\n style={style}\r\n >\r\n <ComboboxHighlight>\r\n {children}\r\n </ComboboxHighlight>\r\n </ComboboxPopupPrimitive>\r\n </ComboboxPositionerPrimitive>\r\n </ComboboxPortalPrimitive>\r\n )\r\n}\r\n\r\ntype ComboboxPortalProps = ComboboxPortalPrimitiveProps\r\n\r\nfunction ComboboxPortal(props: ComboboxPortalProps) {\r\n return <ComboboxPortalPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxPositionerProps = ComboboxPositionerPrimitiveProps\r\n\r\nfunction ComboboxPositioner(props: ComboboxPositionerProps) {\r\n return <ComboboxPositionerPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxBackdropProps = ComboboxBackdropPrimitiveProps\r\n\r\nfunction ComboboxBackdrop(props: ComboboxBackdropProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxBackdropPrimitive\r\n className={cn(\"bg-black/30\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxStatusProps = ComboboxStatusPrimitiveProps\r\n\r\nfunction ComboboxStatus({\r\n className,\r\n status,\r\n ...props\r\n}: Omit<ComboboxStatusProps, \"children\"> & {\r\n status?: \"empty\" | \"pending\" | null\r\n}) {\r\n const { inputValue } = useCombobox()\r\n\r\n const trimmedInputValue = inputValue?.toString().trim()\r\n\r\n const getText = () => {\r\n if (status === \"empty\" && trimmedInputValue)\r\n return `No matches for \"${trimmedInputValue}\".`\r\n\r\n if (status === \"empty\" && !trimmedInputValue)\r\n return \"No results.\"\r\n\r\n if (status === \"pending\")\r\n return (\r\n <>\r\n <Loader2Icon className=\"animate-spin size-4\" />\r\n <span>\r\n Searching...\r\n </span>\r\n </>\r\n )\r\n\r\n return null\r\n }\r\n\r\n const text = getText()\r\n\r\n return (\r\n <ComboboxStatusPrimitive\r\n className={cn(\r\n \"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2\",\r\n !text && \"hidden\",\r\n className\r\n )}\r\n {...props}\r\n >\r\n {text}\r\n </ComboboxStatusPrimitive>\r\n )\r\n}\r\n\r\ntype ComboboxLoadingProps = React.ComponentProps<\"div\">\r\n\r\ntype ComboboxEmptyProps = ComboboxEmptyPrimitiveProps\r\n\r\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\r\n return <ComboboxEmptyPrimitive\r\n className={cn(\"px-3 py-2 text-body-regular-2 text-text-secondary\", className)}\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxListProps = Omit<ComboboxListPrimitiveProps, \"children\"> & {\r\n children: React.ReactNode | ((item: any, index: number, itemsLength: number) => React.ReactNode)\r\n}\r\n\r\nfunction ComboboxList({\r\n className,\r\n children,\r\n ...props\r\n}: ComboboxListProps) {\r\n const items = useFilteredItems()\r\n\r\n return (\r\n <ScrollArea\r\n size=\"sm\"\r\n viewportRender={(\r\n <ComboboxListPrimitive\r\n className={cn(\"max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] flex flex-col p-1 focus-visible:outline-none data-[empty]:hidden\", className)}\r\n {...props}\r\n >\r\n {\r\n typeof children === \"function\"\r\n ? (item, index) => (\r\n children(item, index, items.length)\r\n )\r\n : children\r\n }\r\n </ComboboxListPrimitive>\r\n )}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxHighlightProps = ComboboxHighlightPrimitiveProps\r\n\r\nfunction ComboboxHighlight(props: ComboboxHighlightProps) {\r\n const { className, ...rest } = props\r\n\r\n return (\r\n <ComboboxHighlightPrimitive\r\n className={cn(\"absolute inset-0 bg-bg-primary-hover\", className)}\r\n {...rest}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxHighlightItemProps = ComboboxHighlightItemPrimitiveProps\r\n\r\nfunction ComboboxHighlightItem(props: ComboboxHighlightItemProps) {\r\n return <ComboboxHighlightItemPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxRowProps = ComboboxRowPrimitiveProps\r\n\r\nfunction ComboboxRow(props: ComboboxRowProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxRowPrimitive\r\n className={cn(\"group/combobox-row\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxItemProps = ComboboxItemPrimitiveProps & {\r\n indicator?: \"check-circle\" | \"checkbox\"\r\n}\r\n\r\nfunction ComboboxItem({\r\n className,\r\n children,\r\n indicator = \"check-circle\",\r\n ...props\r\n}: ComboboxItemProps) {\r\n const { disabled } = props\r\n\r\n return (\r\n <ComboboxHighlightItem\r\n activeClassName=\"bg-bg-primary-hover rounded-md\"\r\n disabled={disabled}\r\n >\r\n <ComboboxItemPrimitive\r\n data-indicator={indicator}\r\n className={cn(\r\n \"group/combobox-item relative grid grid-cols-[auto_1fr] items-center gap-x-2 my-px p-xp-md cursor-default outline-none select-none [[data-indicator=check-circle][data-selected]]:pr-8 data-[indicator=checkbox]:pl-8\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ComboboxItemIndicator\r\n className=\"absolute group-data-[indicator=check-circle]/combobox-item:right-2 group-data-[indicator=checkbox]/combobox-item:left-2\"\r\n keepMounted={indicator === \"checkbox\"}\r\n render={(props, state) => (\r\n <span {...props}>\r\n {indicator === \"check-circle\" && (\r\n <CheckCircle2Icon className=\"size-4 text-fg-brand-primary shrink-0\" />\r\n )}\r\n\r\n {indicator === \"checkbox\" && (\r\n <Checkbox checked={state.selected} />\r\n )}\r\n </span>\r\n )}\r\n />\r\n </ComboboxItemPrimitive>\r\n </ComboboxHighlightItem>\r\n )\r\n}\r\n\r\ntype ComboboxItemTitleProps = React.ComponentProps<\"span\">\r\n\r\nfunction ComboboxItemTitle({\r\n className,\r\n ...props\r\n}: ComboboxItemTitleProps) {\r\n return (\r\n <span\r\n data-slot=\"combobox-item-title\"\r\n className={cn(\r\n \"col-start-2 text-body-medium-3 text-text-primary truncate row-span-2 group-has-[[data-slot=combobox-item-description]]/combobox-item:row-span-1\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxItemDescriptionProps = React.ComponentProps<\"span\">\r\n\r\nfunction ComboboxItemDescription({\r\n className,\r\n ...props\r\n}: ComboboxItemDescriptionProps) {\r\n return (\r\n <span\r\n data-slot=\"combobox-item-description\"\r\n className={cn(\r\n \"col-start-2 text-body-regular-3 text-text-secondary truncate\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction ComboboxItemIcon({ className, ...props }: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot=\"combobox-item-icon\"\r\n className={cn(\r\n \"row-span-2 col-start-1 flex items-center justify-center size-6 rounded-md bg-bg-brand-solid text-fg-white shrink-0 [&_svg]:size-3.5\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxItemAvatarProps = React.ComponentProps<typeof Avatar> & {\r\n src?: string\r\n imageSrc?: string\r\n imageAlt?: string\r\n avatarClassName?: string\r\n fallbackText?: string\r\n}\r\n\r\nfunction ComboboxItemAvatar({\r\n src,\r\n imageSrc,\r\n className,\r\n avatarClassName,\r\n imageAlt,\r\n fallbackText,\r\n children,\r\n ...props\r\n}: ComboboxItemAvatarProps) {\r\n const finalSrc = src ?? imageSrc\r\n\r\n return (\r\n <div\r\n data-slot=\"combobox-item-avatar\"\r\n className={cn(\r\n \"row-span-2 col-start-1 size-6 rounded-full overflow-hidden shrink-0\",\r\n className\r\n )}\r\n >\r\n <Avatar\r\n className={cn(\"size-full shrink-0\", avatarClassName)}\r\n {...props}\r\n >\r\n <AvatarImage alt={imageAlt} src={finalSrc} />\r\n <AvatarFallback className=\"flex aspect-square size-full items-center justify-center bg-bg-tertiary text-label-semibold-2 text-text-quaternary\">\r\n {fallbackText ?? children}\r\n </AvatarFallback>\r\n </Avatar>\r\n </div>\r\n )\r\n}\r\n\r\ntype ComboboxItemIndicatorProps = ComboboxItemIndicatorPrimitiveProps\r\n\r\nfunction ComboboxItemIndicator(props: ComboboxItemIndicatorProps) {\r\n return (\r\n <ComboboxItemIndicatorPrimitive {...props} />\r\n )\r\n}\r\n\r\ntype ComboboxSeparatorProps = ComboboxSeparatorPrimitiveProps\r\n\r\nfunction ComboboxSeparator(props: ComboboxSeparatorProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxSeparatorPrimitive\r\n className={cn(\"my-1 h-px bg-border-primary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxGroupProps = ComboboxGroupPrimitiveProps\r\n\r\nfunction ComboboxGroup(props: ComboboxGroupProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxGroupPrimitive\r\n className={cn(\"py-1\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxGroupLabelProps = ComboboxGroupLabelPrimitiveProps\r\n\r\nfunction ComboboxGroupLabel(props: ComboboxGroupLabelProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxGroupLabelPrimitive\r\n className={cn(\"px-3 py-1 text-body-semibold-sm text-text-secondary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxCollectionProps = ComboboxCollectionPrimitiveProps\r\n\r\nfunction ComboboxCollection(props: ComboboxCollectionProps) {\r\n return <ComboboxCollectionPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxArrowProps = ComboboxArrowPrimitiveProps\r\n\r\nfunction ComboboxArrow(props: ComboboxArrowProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxArrowPrimitive\r\n className={cn(\"fill-bg-primary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\nfunction ComboboxInfiniteScroll({\r\n hasMore,\r\n threshold = 0.5,\r\n ...props\r\n}: Omit<React.ComponentProps<typeof InfiniteScroll>, \"children\">) {\r\n return (\r\n <InfiniteScroll\r\n hasMore={hasMore}\r\n threshold={threshold}\r\n {...props}\r\n >\r\n {hasMore && (\r\n <div className=\"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2\">\r\n <Loader2Icon className=\"animate-spin size-4\" />\r\n <span>\r\n Loading more...\r\n </span>\r\n </div>\r\n )}\r\n </InfiniteScroll>\r\n )\r\n}\r\n\r\nexport {\r\n Combobox,\r\n ComboboxArrow,\r\n type ComboboxArrowProps,\r\n ComboboxBackdrop,\r\n type ComboboxBackdropProps,\r\n ComboboxChip,\r\n type ComboboxChipProps,\r\n ComboboxChipRemove,\r\n type ComboboxChipRemoveProps,\r\n ComboboxChips,\r\n type ComboboxChipsProps,\r\n ComboboxClear,\r\n type ComboboxClearProps,\r\n ComboboxCollection,\r\n type ComboboxCollectionProps,\r\n ComboboxPopup,\r\n type ComboboxPopupProps,\r\n ComboboxEmpty,\r\n type ComboboxEmptyProps,\r\n ComboboxGroup,\r\n ComboboxGroupLabel,\r\n type ComboboxGroupLabelProps,\r\n type ComboboxGroupProps,\r\n ComboboxHighlight,\r\n ComboboxHighlightItem,\r\n type ComboboxHighlightItemProps,\r\n type ComboboxHighlightProps,\r\n ComboboxIcon,\r\n type ComboboxIconProps,\r\n ComboboxInfiniteScroll,\r\n ComboboxInput,\r\n ComboboxInputFilter,\r\n ComboboxInputGroup,\r\n type ComboboxInputGroupProps,\r\n type ComboboxInputProps,\r\n ComboboxItem,\r\n ComboboxItemTitle,\r\n type ComboboxItemTitleProps,\r\n ComboboxItemDescription,\r\n type ComboboxItemDescriptionProps,\r\n ComboboxItemIcon,\r\n ComboboxItemAvatar,\r\n type ComboboxItemAvatarProps,\r\n ComboboxItemIndicator,\r\n type ComboboxItemIndicatorProps,\r\n type ComboboxItemProps,\r\n ComboboxLabel,\r\n type ComboboxLabelProps,\r\n ComboboxList,\r\n type ComboboxListProps,\r\n type ComboboxLoadingProps,\r\n ComboboxPortal,\r\n type ComboboxPortalProps,\r\n ComboboxPositioner,\r\n type ComboboxPositionerProps,\r\n type ComboboxProps,\r\n ComboboxRow,\r\n type ComboboxRowProps,\r\n ComboboxSeparator,\r\n type ComboboxSeparatorProps,\r\n ComboboxStatus,\r\n type ComboboxStatusProps,\r\n ComboboxTrigger,\r\n type ComboboxTriggerProps,\r\n ComboboxValue,\r\n type ComboboxValueProps\r\n}"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b,c as c$1}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {b,c as c$1}from'./chunk-2URFXFQC.js';import*as C from'react';import {Menu}from'@base-ui/react/menu';import {AnimatePresence,motion}from'motion/react';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {useDataState}from'@xploreu/hooks/use-data-state';import {getStrictContext}from'@xploreu/lib/get-strict-context';import {jsx}from'react/jsx-runtime';var [T,c]=getStrictContext("MenuActiveValueContext"),[R,k]=getStrictContext("MenuContext");function A(e){let[n,o]=useControlledState({value:e?.open,defaultValue:e?.defaultOpen,onChange:e?.onOpenChange}),[i,u]=C.useState(null);return jsx(T,{value:{highlightedValue:i,setHighlightedValue:u},children:jsx(R,{value:{isOpen:n,setIsOpen:o},children:jsx(Menu.Root,{"data-slot":"menu",...e,onOpenChange:o})})})}function w(e){return jsx(Menu.Trigger,{"data-slot":"menu-trigger",...e})}function D(e){let{isOpen:n}=k();return jsx(AnimatePresence,{children:n&&jsx(Menu.Portal,{"data-slot":"menu-portal",keepMounted:true,...e})})}function B(e){return jsx(Menu.Positioner,{"data-slot":"menu-positioner",...e})}function E({finalFocus:e,id:n,transition:o={duration:.2},style:i,...u}){return jsx(Menu.Popup,{finalFocus:e,id:n,render:jsx(motion.div,{animate:{opacity:1,scale:1},"data-slot":"menu-popup",exit:{opacity:0,scale:.95},initial:{opacity:0,scale:.95},style:{willChange:"opacity, transform",...i},transition:o,...u},"menu-popup")})}function F(e){return jsx(Menu.Group,{"data-slot":"menu-group",...e})}function q(e){return jsx(Menu.GroupLabel,{"data-slot":"menu-group-label",...e})}function z(e){return jsx(Menu.Separator,{"data-slot":"menu-separator",...e})}function J(e){return jsx("span",{"data-slot":"menu-shortcut",...e})}function K(e){return jsx(Menu.Arrow,{"data-slot":"menu-arrow",...e})}function N({transition:e={type:"spring",stiffness:350,damping:35},...n}){let{highlightedValue:o}=c();return jsx(b,{click:false,controlledItems:true,"data-slot":"menu-highlight",transition:e,value:o,...n})}function Q(e){return jsx(c$1,{"data-slot":"menu-highlight-item",...e})}function U({disabled:e,label:n,closeOnClick:o,nativeButton:i,id:u,...s}){let{setHighlightedValue:m}=c(),[,p]=useDataState("highlighted",void 0,a=>{if(a===true){let d=p.current,l=d?.dataset.value||d?.id||null;l&&m(l);}});return jsx(Menu.Item,{ref:p,closeOnClick:o,"data-slot":"menu-item",disabled:e,id:u,label:n,nativeButton:i,...s})}function W({label:e,defaultChecked:n,checked:o,onCheckedChange:i,disabled:u,closeOnClick:s,nativeButton:m,id:p,...a}){let{setHighlightedValue:d}=c(),[,l]=useDataState("highlighted",void 0,M=>{if(M===true){let h=l.current,y=h?.dataset.value||h?.id||null;y&&d(y);}});return jsx(Menu.CheckboxItem,{ref:l,checked:o,closeOnClick:s,"data-slot":"menu-checkbox-item",defaultChecked:n,disabled:u,id:p,label:e,nativeButton:m,onCheckedChange:i,...a})}function X({keepMounted:e,...n}){return jsx(Menu.CheckboxItemIndicator,{"data-slot":"menu-checkbox-item-indicator",keepMounted:e,render:jsx(motion.div,{"data-slot":"menu-checkbox-item-indicator",...n})})}function Y(e){return jsx(Menu.RadioGroup,{"data-slot":"menu-radio-group",...e})}function Z({value:e,disabled:n,label:o,closeOnClick:i,nativeButton:u,id:s,...m}){let{setHighlightedValue:p}=c(),[,a]=useDataState("highlighted",void 0,d=>{if(d===true){let l=a.current,M=l?.dataset.value||l?.id||null;M&&p(M);}});return jsx(Menu.RadioItem,{ref:a,closeOnClick:i,"data-slot":"menu-radio-item",disabled:n,id:s,label:o,nativeButton:u,value:e,...m})}function _({keepMounted:e,...n}){return jsx(Menu.RadioItemIndicator,{"data-slot":"menu-radio-item-indicator",keepMounted:e,render:jsx(motion.div,{"data-slot":"menu-radio-item-indicator",...n})})}function $(e){let[n,o]=useControlledState({value:e?.open,defaultValue:e?.defaultOpen,onChange:e?.onOpenChange});return jsx(R,{value:{isOpen:n,setIsOpen:o},children:jsx(Menu.SubmenuRoot,{"data-slot":"menu-submenu",...e,onOpenChange:o})})}function j({label:e,id:n,nativeButton:o,...i}){let{setHighlightedValue:u}=c(),[,s]=useDataState("highlighted",void 0,m=>{if(m===true){let p=s.current,a=p?.dataset.value||p?.id||null;a&&u(a);}});return jsx(Menu.SubmenuTrigger,{ref:s,"data-slot":"menu-submenu-trigger",id:n,label:e,nativeButton:o,...i})}export{c as a,k as b,A as c,w as d,D as e,B as f,E as g,F as h,q as i,z as j,J as k,K as l,N as m,Q as n,U as o,W as p,X as q,Y as r,Z as s,_ as t,$ as u,j as v};//# sourceMappingURL=chunk-JYFVQ5NY.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-JYFVQ5NY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/menu.tsx"],"names":["MenuActiveValueProvider","useMenuActiveValue","getStrictContext","MenuProvider","useMenu","Menu","props","isOpen","setIsOpen","useControlledState","highlightedValue","setHighlightedValue","jsx","MenuPrimitive","MenuTrigger","MenuPortal","AnimatePresence","MenuPositioner","MenuPopup","finalFocus","id","transition","style","motion","MenuGroup","MenuGroupLabel","MenuSeparator","MenuShortcut","MenuArrow","MenuHighlight","Highlight","MenuHighlightItem","HighlightItem","MenuItem","disabled","label","closeOnClick","nativeButton","highlightedRef","useDataState","value","el","v","MenuCheckboxItem","defaultChecked","checked","onCheckedChange","MenuCheckboxItemIndicator","keepMounted","MenuRadioGroup","MenuRadioItem","MenuRadioItemIndicator","MenuSubmenu","MenuSubmenuTrigger"],"mappings":"+XAgCA,IAAM,CAACA,EAAyBC,CAAkB,CAAA,CAChDC,iBAA6C,wBAAwB,CAAA,CAEjE,CAACC,CAAAA,CAAcC,CAAO,EAC1BF,gBAAAA,CAAkC,aAAa,EAIjD,SAASG,CAAAA,CAAKC,CAAAA,CAAkB,CAC9B,GAAM,CAACC,EAAQC,CAAS,CAAA,CAAIC,mBAAmB,CAC7C,KAAA,CAAOH,GAAO,IAAA,CACd,YAAA,CAAcA,GAAO,WAAA,CACrB,QAAA,CAAUA,GAAO,YACnB,CAAC,EACK,CAACI,CAAAA,CAAkBC,CAAmB,CAAA,CAAU,CAAA,CAAA,QAAA,CACpD,IACF,CAAA,CAEA,OACEC,GAAAA,CAACZ,EAAA,CAAwB,KAAA,CAAO,CAAE,gBAAA,CAAAU,CAAAA,CAAkB,oBAAAC,CAAoB,CAAA,CACtE,QAAA,CAAAC,GAAAA,CAACT,CAAAA,CAAA,CAAa,MAAO,CAAE,MAAA,CAAAI,EAAQ,SAAA,CAAAC,CAAU,EACvC,QAAA,CAAAI,GAAAA,CAACC,IAAAA,CAAc,IAAA,CAAd,CACC,WAAA,CAAU,OACT,GAAGP,CAAAA,CACJ,aAAcE,CAAAA,CAChB,CAAA,CACF,EACF,CAEJ,CAIA,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,mBAAA,CAAAK,CAAoB,CAAA,CAAIV,CAAAA,GAC1B,EAAGqC,CAAc,CAAA,CAAIC,YAAAA,CACzB,cACA,MAAA,CACCC,CAAAA,EAAU,CACT,GAAIA,CAAAA,GAAU,KAAM,CAClB,IAAMC,EAAKH,CAAAA,CAAe,OAAA,CACpBI,EAAID,CAAAA,EAAI,OAAA,CAAQ,KAAA,EAASA,CAAAA,EAAI,EAAA,EAAM,IAAA,CACrCC,GAAG/B,CAAAA,CAAoB+B,CAAC,EAC9B,CACF,CACF,EAEA,OACE9B,GAAAA,CAACC,IAAAA,CAAc,cAAA,CAAd,CACC,GAAA,CAAKyB,EACL,WAAA,CAAU,sBAAA,CACV,GAAIlB,CAAAA,CACJ,KAAA,CAAOe,EACP,YAAA,CAAcE,CAAAA,CACb,GAAG/B,CAAAA,CACN,CAEJ","file":"chunk-VNU37GJC.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\n\r\nimport { Menu as MenuPrimitive } from \"@base-ui/react/menu\"\r\nimport {\r\n AnimatePresence,\r\n type HTMLMotionProps,\r\n motion\r\n} from \"motion/react\"\r\n\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { useDataState } from \"@xploreu/hooks/use-data-state\"\r\nimport { getStrictContext } from \"@xploreu/lib/get-strict-context\"\r\n\r\nimport {\r\n Highlight,\r\n HighlightItem,\r\n type HighlightItemProps,\r\n type HighlightProps\r\n} from \"../effects/highlight\"\r\n\r\ntype MenuActiveValueContextType = {\r\n highlightedValue: string | null;\r\n setHighlightedValue: (value: string | null) => void;\r\n}\r\n\r\ntype MenuContextType = {\r\n isOpen: boolean;\r\n setIsOpen: MenuProps[\"onOpenChange\"];\r\n}\r\n\r\nconst [MenuActiveValueProvider, useMenuActiveValue] =\r\n getStrictContext<MenuActiveValueContextType>(\"MenuActiveValueContext\")\r\n\r\nconst [MenuProvider, useMenu] =\r\n getStrictContext<MenuContextType>(\"MenuContext\")\r\n\r\ntype MenuProps = React.ComponentProps<typeof MenuPrimitive.Root>\r\n\r\nfunction Menu(props: MenuProps) {\r\n const [isOpen, setIsOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n })\r\n const [highlightedValue, setHighlightedValue] = React.useState<string | null>(\r\n null,\r\n )\r\n\r\n return (\r\n <MenuActiveValueProvider value={{ highlightedValue, setHighlightedValue }}>\r\n <MenuProvider value={{ isOpen, setIsOpen }}>\r\n <MenuPrimitive.Root\r\n data-slot=\"menu\"\r\n {...props}\r\n onOpenChange={setIsOpen}\r\n />\r\n </MenuProvider>\r\n </MenuActiveValueProvider>\r\n )\r\n}\r\n\r\ntype MenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger>\r\n\r\nfunction MenuTrigger(props: MenuTriggerProps) {\r\n return <MenuPrimitive.Trigger data-slot=\"menu-trigger\" {...props} />\r\n}\r\n\r\ntype MenuPortalProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.Portal>,\r\n \"keepMounted\"\r\n>\r\n\r\nfunction MenuPortal(props: MenuPortalProps) {\r\n const { isOpen } = useMenu()\r\n\r\n return (\r\n <AnimatePresence>\r\n {isOpen && (\r\n <MenuPrimitive.Portal\r\n data-slot=\"menu-portal\"\r\n keepMounted\r\n {...props}\r\n />\r\n )}\r\n </AnimatePresence>\r\n )\r\n}\r\n\r\ntype MenuPositionerProps = React.ComponentProps<\r\n typeof MenuPrimitive.Positioner\r\n>\r\n\r\nfunction MenuPositioner(props: MenuPositionerProps) {\r\n return (\r\n <MenuPrimitive.Positioner\r\n data-slot=\"menu-positioner\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuPopupProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.Popup>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuPopup({\r\n finalFocus,\r\n id,\r\n transition = { duration: 0.2 },\r\n style,\r\n ...props\r\n}: MenuPopupProps) {\r\n return (\r\n <MenuPrimitive.Popup\r\n finalFocus={finalFocus}\r\n id={id}\r\n render={\r\n <motion.div\r\n key=\"menu-popup\"\r\n animate={{ opacity: 1, scale: 1 }}\r\n data-slot=\"menu-popup\"\r\n exit={{ opacity: 0, scale: 0.95 }}\r\n initial={{ opacity: 0, scale: 0.95 }}\r\n style={{ willChange: \"opacity, transform\", ...style }}\r\n transition={transition}\r\n {...props}\r\n />\r\n }\r\n />\r\n )\r\n}\r\n\r\ntype MenuGroupProps = React.ComponentProps<typeof MenuPrimitive.Group>\r\n\r\nfunction MenuGroup(props: MenuGroupProps) {\r\n return <MenuPrimitive.Group data-slot=\"menu-group\" {...props} />\r\n}\r\n\r\ntype MenuGroupLabelProps = React.ComponentProps<\r\n typeof MenuPrimitive.GroupLabel\r\n>\r\n\r\nfunction MenuGroupLabel(props: MenuGroupLabelProps) {\r\n return (\r\n <MenuPrimitive.GroupLabel\r\n data-slot=\"menu-group-label\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuSeparatorProps = React.ComponentProps<typeof MenuPrimitive.Separator>\r\n\r\nfunction MenuSeparator(props: MenuSeparatorProps) {\r\n return <MenuPrimitive.Separator data-slot=\"menu-separator\" {...props} />\r\n}\r\n\r\ntype MenuShortcutProps = React.ComponentProps<\"span\">\r\n\r\nfunction MenuShortcut(props: MenuShortcutProps) {\r\n return <span data-slot=\"menu-shortcut\" {...props} />\r\n}\r\n\r\ntype MenuArrowProps = React.ComponentProps<typeof MenuPrimitive.Arrow>\r\n\r\nfunction MenuArrow(props: MenuArrowProps) {\r\n return <MenuPrimitive.Arrow data-slot=\"menu-arrow\" {...props} />\r\n}\r\n\r\ntype MenuHighlightProps = Omit<\r\n HighlightProps,\r\n \"controlledItems\" | \"enabled\" | \"hover\"\r\n> & {\r\n animateOnHover?: boolean;\r\n}\r\n\r\nfunction MenuHighlight({\r\n transition = { type: \"spring\", stiffness: 350, damping: 35 },\r\n ...props\r\n}: MenuHighlightProps) {\r\n const { highlightedValue } = useMenuActiveValue()\r\n\r\n return (\r\n <Highlight\r\n click={false}\r\n controlledItems\r\n data-slot=\"menu-highlight\"\r\n transition={transition}\r\n value={highlightedValue}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuHighlightItemProps = HighlightItemProps\r\n\r\nfunction MenuHighlightItem(props: MenuHighlightItemProps) {\r\n return <HighlightItem data-slot=\"menu-highlight-item\" {...props} />\r\n}\r\n\r\ntype MenuItemProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.Item>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuItem({\r\n disabled,\r\n label,\r\n closeOnClick,\r\n nativeButton,\r\n id,\r\n ...props\r\n}: MenuItemProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.Item\r\n ref={highlightedRef}\r\n closeOnClick={closeOnClick}\r\n data-slot=\"menu-item\"\r\n disabled={disabled}\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuCheckboxItemProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.CheckboxItem>,\r\n \"render\"\r\n>\r\n\r\nfunction MenuCheckboxItem({\r\n label,\r\n defaultChecked,\r\n checked,\r\n onCheckedChange,\r\n disabled,\r\n closeOnClick,\r\n nativeButton,\r\n id,\r\n ...props\r\n}: MenuCheckboxItemProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.CheckboxItem\r\n ref={highlightedRef}\r\n checked={checked}\r\n closeOnClick={closeOnClick}\r\n data-slot=\"menu-checkbox-item\"\r\n defaultChecked={defaultChecked}\r\n disabled={disabled}\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n onCheckedChange={onCheckedChange}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuCheckboxItemIndicatorProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.CheckboxItemIndicator>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuCheckboxItemIndicator({\r\n keepMounted,\r\n ...props\r\n}: MenuCheckboxItemIndicatorProps) {\r\n return (\r\n <MenuPrimitive.CheckboxItemIndicator\r\n data-slot=\"menu-checkbox-item-indicator\"\r\n keepMounted={keepMounted}\r\n render={\r\n <motion.div data-slot=\"menu-checkbox-item-indicator\" {...props} />\r\n }\r\n />\r\n )\r\n}\r\n\r\ntype MenuRadioGroupProps = React.ComponentProps<\r\n typeof MenuPrimitive.RadioGroup\r\n>\r\n\r\nfunction MenuRadioGroup(props: MenuRadioGroupProps) {\r\n return <MenuPrimitive.RadioGroup data-slot=\"menu-radio-group\" {...props} />\r\n}\r\n\r\ntype MenuRadioItemProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.RadioItem>,\r\n \"render\"\r\n>\r\n\r\nfunction MenuRadioItem({\r\n value,\r\n disabled,\r\n label,\r\n closeOnClick,\r\n nativeButton,\r\n id,\r\n ...props\r\n}: MenuRadioItemProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.RadioItem\r\n ref={highlightedRef}\r\n closeOnClick={closeOnClick}\r\n data-slot=\"menu-radio-item\"\r\n disabled={disabled}\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n value={value}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuRadioItemIndicatorProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.RadioItemIndicator>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuRadioItemIndicator({\r\n keepMounted,\r\n ...props\r\n}: MenuRadioItemIndicatorProps) {\r\n return (\r\n <MenuPrimitive.RadioItemIndicator\r\n data-slot=\"menu-radio-item-indicator\"\r\n keepMounted={keepMounted}\r\n render={\r\n <motion.div data-slot=\"menu-radio-item-indicator\" {...props} />\r\n }\r\n />\r\n )\r\n}\r\n\r\ntype MenuSubmenuProps = React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>\r\n\r\nfunction MenuSubmenu(props: MenuSubmenuProps) {\r\n const [isOpen, setIsOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n })\r\n\r\n return (\r\n <MenuProvider value={{ isOpen, setIsOpen }}>\r\n <MenuPrimitive.SubmenuRoot\r\n data-slot=\"menu-submenu\"\r\n {...props}\r\n onOpenChange={setIsOpen}\r\n />\r\n </MenuProvider>\r\n )\r\n}\r\n\r\ntype MenuSubmenuTriggerProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\"> & {\r\n disabled?: boolean;\r\n }\r\n\r\nfunction MenuSubmenuTrigger({\r\n label,\r\n id,\r\n nativeButton,\r\n ...props\r\n}: MenuSubmenuTriggerProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.SubmenuTrigger\r\n ref={highlightedRef}\r\n data-slot=\"menu-submenu-trigger\"\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport {\r\n Menu,\r\n MenuTrigger,\r\n MenuPortal,\r\n MenuPositioner,\r\n MenuPopup,\r\n MenuArrow,\r\n MenuItem,\r\n MenuCheckboxItem,\r\n MenuCheckboxItemIndicator,\r\n MenuRadioGroup,\r\n MenuRadioItem,\r\n MenuRadioItemIndicator,\r\n MenuGroup,\r\n MenuGroupLabel,\r\n MenuSeparator,\r\n MenuShortcut,\r\n MenuHighlight,\r\n MenuHighlightItem,\r\n MenuSubmenu,\r\n MenuSubmenuTrigger,\r\n useMenuActiveValue,\r\n useMenu,\r\n type MenuProps,\r\n type MenuTriggerProps,\r\n type MenuPortalProps,\r\n type MenuPositionerProps,\r\n type MenuPopupProps,\r\n type MenuArrowProps,\r\n type MenuItemProps,\r\n type MenuCheckboxItemProps,\r\n type MenuCheckboxItemIndicatorProps,\r\n type MenuRadioItemProps,\r\n type MenuRadioItemIndicatorProps,\r\n type MenuRadioGroupProps,\r\n type MenuGroupProps,\r\n type MenuGroupLabelProps,\r\n type MenuSeparatorProps,\r\n type MenuShortcutProps,\r\n type MenuHighlightProps,\r\n type MenuHighlightItemProps,\r\n type MenuSubmenuProps,\r\n type MenuSubmenuTriggerProps,\r\n type MenuActiveValueContextType,\r\n type MenuContextType,\r\n}"]}
|
|
1
|
+
{"version":3,"sources":["../src/primitives/menu.tsx"],"names":["MenuActiveValueProvider","useMenuActiveValue","getStrictContext","MenuProvider","useMenu","Menu","props","isOpen","setIsOpen","useControlledState","highlightedValue","setHighlightedValue","jsx","MenuPrimitive","MenuTrigger","MenuPortal","AnimatePresence","MenuPositioner","MenuPopup","finalFocus","id","transition","style","motion","MenuGroup","MenuGroupLabel","MenuSeparator","MenuShortcut","MenuArrow","MenuHighlight","Highlight","MenuHighlightItem","HighlightItem","MenuItem","disabled","label","closeOnClick","nativeButton","highlightedRef","useDataState","value","el","v","MenuCheckboxItem","defaultChecked","checked","onCheckedChange","MenuCheckboxItemIndicator","keepMounted","MenuRadioGroup","MenuRadioItem","MenuRadioItemIndicator","MenuSubmenu","MenuSubmenuTrigger"],"mappings":"+XAgCA,IAAM,CAACA,EAAyBC,CAAkB,CAAA,CAChDC,iBAA6C,wBAAwB,CAAA,CAEjE,CAACC,CAAAA,CAAcC,CAAO,EAC1BF,gBAAAA,CAAkC,aAAa,EAIjD,SAASG,CAAAA,CAAKC,CAAAA,CAAkB,CAC9B,GAAM,CAACC,EAAQC,CAAS,CAAA,CAAIC,mBAAmB,CAC7C,KAAA,CAAOH,GAAO,IAAA,CACd,YAAA,CAAcA,GAAO,WAAA,CACrB,QAAA,CAAUA,GAAO,YACnB,CAAC,EACK,CAACI,CAAAA,CAAkBC,CAAmB,CAAA,CAAU,CAAA,CAAA,QAAA,CACpD,IACF,CAAA,CAEA,OACEC,GAAAA,CAACZ,EAAA,CAAwB,KAAA,CAAO,CAAE,gBAAA,CAAAU,CAAAA,CAAkB,oBAAAC,CAAoB,CAAA,CACtE,QAAA,CAAAC,GAAAA,CAACT,CAAAA,CAAA,CAAa,MAAO,CAAE,MAAA,CAAAI,EAAQ,SAAA,CAAAC,CAAU,EACvC,QAAA,CAAAI,GAAAA,CAACC,IAAAA,CAAc,IAAA,CAAd,CACC,WAAA,CAAU,OACT,GAAGP,CAAAA,CACJ,aAAcE,CAAAA,CAChB,CAAA,CACF,EACF,CAEJ,CAIA,SAASM,CAAAA,CAAYR,CAAAA,CAAyB,CAC5C,OAAOM,GAAAA,CAACC,KAAc,OAAA,CAAd,CAAsB,YAAU,cAAA,CAAgB,GAAGP,CAAAA,CAAO,CACpE,CAOA,SAASS,EAAWT,CAAAA,CA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MC,EAAKH,CAAAA,CAAe,OAAA,CACpBI,EAAID,CAAAA,EAAI,OAAA,CAAQ,KAAA,EAASA,CAAAA,EAAI,EAAA,EAAM,IAAA,CACrCC,GAAG/B,CAAAA,CAAoB+B,CAAC,EAC9B,CACF,CACF,EAEA,OACE9B,GAAAA,CAACC,IAAAA,CAAc,cAAA,CAAd,CACC,GAAA,CAAKyB,EACL,WAAA,CAAU,sBAAA,CACV,GAAIlB,CAAAA,CACJ,KAAA,CAAOe,EACP,YAAA,CAAcE,CAAAA,CACb,GAAG/B,CAAAA,CACN,CAEJ","file":"chunk-JYFVQ5NY.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\n\r\nimport { Menu as MenuPrimitive } from \"@base-ui/react/menu\"\r\nimport {\r\n AnimatePresence,\r\n type HTMLMotionProps,\r\n motion\r\n} from \"motion/react\"\r\n\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { useDataState } from \"@xploreu/hooks/use-data-state\"\r\nimport { getStrictContext } from \"@xploreu/lib/get-strict-context\"\r\n\r\nimport {\r\n Highlight,\r\n HighlightItem,\r\n type HighlightItemProps,\r\n type HighlightProps\r\n} from \"../effects/highlight\"\r\n\r\ntype MenuActiveValueContextType = {\r\n highlightedValue: string | null;\r\n setHighlightedValue: (value: string | null) => void;\r\n}\r\n\r\ntype MenuContextType = {\r\n isOpen: boolean;\r\n setIsOpen: MenuProps[\"onOpenChange\"];\r\n}\r\n\r\nconst [MenuActiveValueProvider, useMenuActiveValue] =\r\n getStrictContext<MenuActiveValueContextType>(\"MenuActiveValueContext\")\r\n\r\nconst [MenuProvider, useMenu] =\r\n getStrictContext<MenuContextType>(\"MenuContext\")\r\n\r\ntype MenuProps = React.ComponentProps<typeof MenuPrimitive.Root>\r\n\r\nfunction Menu(props: MenuProps) {\r\n const [isOpen, setIsOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n })\r\n const [highlightedValue, setHighlightedValue] = React.useState<string | null>(\r\n null,\r\n )\r\n\r\n return (\r\n <MenuActiveValueProvider value={{ highlightedValue, setHighlightedValue }}>\r\n <MenuProvider value={{ isOpen, setIsOpen }}>\r\n <MenuPrimitive.Root\r\n data-slot=\"menu\"\r\n {...props}\r\n onOpenChange={setIsOpen}\r\n />\r\n </MenuProvider>\r\n </MenuActiveValueProvider>\r\n )\r\n}\r\n\r\ntype MenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger>\r\n\r\nfunction MenuTrigger(props: MenuTriggerProps) {\r\n return <MenuPrimitive.Trigger data-slot=\"menu-trigger\" {...props} />\r\n}\r\n\r\ntype MenuPortalProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.Portal>,\r\n \"keepMounted\"\r\n>\r\n\r\nfunction MenuPortal(props: MenuPortalProps) {\r\n const { isOpen } = useMenu()\r\n\r\n return (\r\n <AnimatePresence>\r\n {isOpen && (\r\n <MenuPrimitive.Portal\r\n data-slot=\"menu-portal\"\r\n keepMounted\r\n {...props}\r\n />\r\n )}\r\n </AnimatePresence>\r\n )\r\n}\r\n\r\ntype MenuPositionerProps = React.ComponentProps<\r\n typeof MenuPrimitive.Positioner\r\n>\r\n\r\nfunction MenuPositioner(props: MenuPositionerProps) {\r\n return (\r\n <MenuPrimitive.Positioner\r\n data-slot=\"menu-positioner\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuPopupProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.Popup>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuPopup({\r\n finalFocus,\r\n id,\r\n transition = { duration: 0.2 },\r\n style,\r\n ...props\r\n}: MenuPopupProps) {\r\n return (\r\n <MenuPrimitive.Popup\r\n finalFocus={finalFocus}\r\n id={id}\r\n render={\r\n <motion.div\r\n key=\"menu-popup\"\r\n animate={{ opacity: 1, scale: 1 }}\r\n data-slot=\"menu-popup\"\r\n exit={{ opacity: 0, scale: 0.95 }}\r\n initial={{ opacity: 0, scale: 0.95 }}\r\n style={{ willChange: \"opacity, transform\", ...style }}\r\n transition={transition}\r\n {...props}\r\n />\r\n }\r\n />\r\n )\r\n}\r\n\r\ntype MenuGroupProps = React.ComponentProps<typeof MenuPrimitive.Group>\r\n\r\nfunction MenuGroup(props: MenuGroupProps) {\r\n return <MenuPrimitive.Group data-slot=\"menu-group\" {...props} />\r\n}\r\n\r\ntype MenuGroupLabelProps = React.ComponentProps<\r\n typeof MenuPrimitive.GroupLabel\r\n>\r\n\r\nfunction MenuGroupLabel(props: MenuGroupLabelProps) {\r\n return (\r\n <MenuPrimitive.GroupLabel\r\n data-slot=\"menu-group-label\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuSeparatorProps = React.ComponentProps<typeof MenuPrimitive.Separator>\r\n\r\nfunction MenuSeparator(props: MenuSeparatorProps) {\r\n return <MenuPrimitive.Separator data-slot=\"menu-separator\" {...props} />\r\n}\r\n\r\ntype MenuShortcutProps = React.ComponentProps<\"span\">\r\n\r\nfunction MenuShortcut(props: MenuShortcutProps) {\r\n return <span data-slot=\"menu-shortcut\" {...props} />\r\n}\r\n\r\ntype MenuArrowProps = React.ComponentProps<typeof MenuPrimitive.Arrow>\r\n\r\nfunction MenuArrow(props: MenuArrowProps) {\r\n return <MenuPrimitive.Arrow data-slot=\"menu-arrow\" {...props} />\r\n}\r\n\r\ntype MenuHighlightProps = Omit<\r\n HighlightProps,\r\n \"controlledItems\" | \"enabled\" | \"hover\"\r\n> & {\r\n animateOnHover?: boolean;\r\n}\r\n\r\nfunction MenuHighlight({\r\n transition = { type: \"spring\", stiffness: 350, damping: 35 },\r\n ...props\r\n}: MenuHighlightProps) {\r\n const { highlightedValue } = useMenuActiveValue()\r\n\r\n return (\r\n <Highlight\r\n click={false}\r\n controlledItems\r\n data-slot=\"menu-highlight\"\r\n transition={transition}\r\n value={highlightedValue}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuHighlightItemProps = HighlightItemProps\r\n\r\nfunction MenuHighlightItem(props: MenuHighlightItemProps) {\r\n return <HighlightItem data-slot=\"menu-highlight-item\" {...props} />\r\n}\r\n\r\ntype MenuItemProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.Item>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuItem({\r\n disabled,\r\n label,\r\n closeOnClick,\r\n nativeButton,\r\n id,\r\n ...props\r\n}: MenuItemProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.Item\r\n ref={highlightedRef}\r\n closeOnClick={closeOnClick}\r\n data-slot=\"menu-item\"\r\n disabled={disabled}\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuCheckboxItemProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.CheckboxItem>,\r\n \"render\"\r\n>\r\n\r\nfunction MenuCheckboxItem({\r\n label,\r\n defaultChecked,\r\n checked,\r\n onCheckedChange,\r\n disabled,\r\n closeOnClick,\r\n nativeButton,\r\n id,\r\n ...props\r\n}: MenuCheckboxItemProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.CheckboxItem\r\n ref={highlightedRef}\r\n checked={checked}\r\n closeOnClick={closeOnClick}\r\n data-slot=\"menu-checkbox-item\"\r\n defaultChecked={defaultChecked}\r\n disabled={disabled}\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n onCheckedChange={onCheckedChange}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuCheckboxItemIndicatorProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.CheckboxItemIndicator>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuCheckboxItemIndicator({\r\n keepMounted,\r\n ...props\r\n}: MenuCheckboxItemIndicatorProps) {\r\n return (\r\n <MenuPrimitive.CheckboxItemIndicator\r\n data-slot=\"menu-checkbox-item-indicator\"\r\n keepMounted={keepMounted}\r\n render={\r\n <motion.div data-slot=\"menu-checkbox-item-indicator\" {...props} />\r\n }\r\n />\r\n )\r\n}\r\n\r\ntype MenuRadioGroupProps = React.ComponentProps<\r\n typeof MenuPrimitive.RadioGroup\r\n>\r\n\r\nfunction MenuRadioGroup(props: MenuRadioGroupProps) {\r\n return <MenuPrimitive.RadioGroup data-slot=\"menu-radio-group\" {...props} />\r\n}\r\n\r\ntype MenuRadioItemProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.RadioItem>,\r\n \"render\"\r\n>\r\n\r\nfunction MenuRadioItem({\r\n value,\r\n disabled,\r\n label,\r\n closeOnClick,\r\n nativeButton,\r\n id,\r\n ...props\r\n}: MenuRadioItemProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.RadioItem\r\n ref={highlightedRef}\r\n closeOnClick={closeOnClick}\r\n data-slot=\"menu-radio-item\"\r\n disabled={disabled}\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n value={value}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuRadioItemIndicatorProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.RadioItemIndicator>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction MenuRadioItemIndicator({\r\n keepMounted,\r\n ...props\r\n}: MenuRadioItemIndicatorProps) {\r\n return (\r\n <MenuPrimitive.RadioItemIndicator\r\n data-slot=\"menu-radio-item-indicator\"\r\n keepMounted={keepMounted}\r\n render={\r\n <motion.div data-slot=\"menu-radio-item-indicator\" {...props} />\r\n }\r\n />\r\n )\r\n}\r\n\r\ntype MenuSubmenuProps = React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>\r\n\r\nfunction MenuSubmenu(props: MenuSubmenuProps) {\r\n const [isOpen, setIsOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n })\r\n\r\n return (\r\n <MenuProvider value={{ isOpen, setIsOpen }}>\r\n <MenuPrimitive.SubmenuRoot\r\n data-slot=\"menu-submenu\"\r\n {...props}\r\n onOpenChange={setIsOpen}\r\n />\r\n </MenuProvider>\r\n )\r\n}\r\n\r\ntype MenuSubmenuTriggerProps = Omit<\r\n React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger>,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\"> & {\r\n disabled?: boolean;\r\n }\r\n\r\nfunction MenuSubmenuTrigger({\r\n label,\r\n id,\r\n nativeButton,\r\n ...props\r\n}: MenuSubmenuTriggerProps) {\r\n const { setHighlightedValue } = useMenuActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value) => {\r\n if (value === true) {\r\n const el = highlightedRef.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return (\r\n <MenuPrimitive.SubmenuTrigger\r\n ref={highlightedRef}\r\n data-slot=\"menu-submenu-trigger\"\r\n id={id}\r\n label={label}\r\n nativeButton={nativeButton}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport {\r\n Menu,\r\n MenuTrigger,\r\n MenuPortal,\r\n MenuPositioner,\r\n MenuPopup,\r\n MenuArrow,\r\n MenuItem,\r\n MenuCheckboxItem,\r\n MenuCheckboxItemIndicator,\r\n MenuRadioGroup,\r\n MenuRadioItem,\r\n MenuRadioItemIndicator,\r\n MenuGroup,\r\n MenuGroupLabel,\r\n MenuSeparator,\r\n MenuShortcut,\r\n MenuHighlight,\r\n MenuHighlightItem,\r\n MenuSubmenu,\r\n MenuSubmenuTrigger,\r\n useMenuActiveValue,\r\n useMenu,\r\n type MenuProps,\r\n type MenuTriggerProps,\r\n type MenuPortalProps,\r\n type MenuPositionerProps,\r\n type MenuPopupProps,\r\n type MenuArrowProps,\r\n type MenuItemProps,\r\n type MenuCheckboxItemProps,\r\n type MenuCheckboxItemIndicatorProps,\r\n type MenuRadioItemProps,\r\n type MenuRadioItemIndicatorProps,\r\n type MenuRadioGroupProps,\r\n type MenuGroupProps,\r\n type MenuGroupLabelProps,\r\n type MenuSeparatorProps,\r\n type MenuShortcutProps,\r\n type MenuHighlightProps,\r\n type MenuHighlightItemProps,\r\n type MenuSubmenuProps,\r\n type MenuSubmenuTriggerProps,\r\n type MenuActiveValueContextType,\r\n type MenuContextType,\r\n}"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b as b$1,j as j$1,i,k,l,m,q,s,w,H}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,b as b$1,j as j$1,i,k,l,m,q,s,w,H}from'./chunk-IZQFTYJD.js';import {g}from'./chunk-HHG7BSWN.js';import {b}from'./chunk-JH6RZ3QH.js';import*as r from'react';import {cn}from'@xploreu/lib/cn';import {SearchIcon,XIcon}from'lucide-react';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function j({multiple:z=true,inputPlaceholder:B="Search...",container:q$1,items:u,infiniteScroll:A,isPending:H$1,taggable:c=false,maxVisible:i$1,...m$1}){let[h,g$1]=useControlledState({value:m$1?.inputValue?.toString(),defaultValue:m$1?.defaultInputValue?.toString(),onChange:m$1?.onInputValueChange}),[b$2,x]=useControlledState({value:m$1?.value??[],defaultValue:m$1?.defaultValue??[],onChange:m$1?.onValueChange}),[v,I]=r.useState([]),d=r.useRef(new Set);r.useEffect(()=>{let e=new Set(b$2.map(t=>t.value));I(t=>{let l=t.filter(a=>e.has(a.value));return l.length===t.length?t:(d.current=new Set(l.map(a=>a.value)),l)});},[b$2]);let n=h?.toString().trim()??"",U=r.useMemo(()=>n?b$2.some(e=>e.value.toLowerCase()===n.toLowerCase()):false,[n,b$2]),p=r.useMemo(()=>!c||!n?false:!u?.some(e=>e.label.toLowerCase()===n.toLowerCase()),[c,n,u]),X=r.useMemo(()=>{let e=[...u??[],...v];if(p){let t={label:n,value:n,tag:true};return [...e,t]}return e},[u,v,p,n]);return jsxs(a,{...m$1,behavior:"chip-outside",multiple:true,items:c?X:u,isItemEqualToValue:(e,t)=>e.value===t.value,onValueChange:(e,t)=>{if(c){let l=e.filter(a=>a?.tag===true&&!d.current.has(a.value));if(l.length>0){for(let a of l)d.current.add(a.value);I(a=>[...a,...l]);}}x(z?e:[e[e.length-1]],t);},onInputValueChange:g$1,children:[jsxs("div",{className:"flex flex-col gap-2",children:[jsx(g,{render:jsx(b,{className:"h-9 text-body-regular-3 pl-9 pr-7",endContent:jsx(b$1,{nativeButton:false,render:jsx(XIcon,{className:"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer","data-hidden":!h,"data-slot":"combobox-clear-input",onClick:e=>{g$1("",{reason:"none",event:e.nativeEvent,cancel:()=>{},allowPropagation:()=>{},isCanceled:false,isPropagationAllowed:true,trigger:void 0});}})}),placeholder:B,startContent:jsx(SearchIcon,{className:"!size-4 !text-fg-tertiary-hover"}),wrapperClassName:"w-full"})}),jsx(j$1,{className:cn(i$1!==void 0&&"flex-nowrap overflow-hidden"),onMouseDown:e=>e.preventBaseUIHandler(),children:jsx(i,{children:e=>{let t=i$1!==void 0?e.slice(0,i$1):e,l$1=i$1!==void 0?e.length-i$1:0;return jsxs(Fragment,{children:[t?.map(a=>jsxs(k,{className:cn(i$1!==void 0&&"min-w-0 shrink"),children:[i$1!==void 0?jsx("span",{className:"truncate",children:a?.label||""}):a?.label||"",jsx(l,{})]},a?.value||"")),l$1>0&&jsxs(k,{className:"shrink-0",children:["+",l$1]})]})}})})]}),jsxs(m,{container:q$1,children:[jsx(q,{status:H$1||u===void 0?"pending":u?.length===0&&!p?"empty":null}),jsxs(s,{children:[u?.map(e=>jsx(w,{value:{label:e.label,value:e.value},children:jsx("div",{className:"flex items-center gap-2 w-full min-w-0",children:jsx("span",{className:"truncate",children:e.label})})},e.value)),p&&jsx(w,{value:{label:n,value:n,tag:true},children:jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[!U&&jsx("span",{className:"text-text-secondary",children:"Create:"}),jsx("span",{className:"font-medium text-text-primary truncate",children:n})]})}),jsx(H,{...A})]})]})]})}export{j as a};//# sourceMappingURL=chunk-LNL3VCSF.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-LNL3VCSF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composites/combobox-chip-outside.tsx"],"names":["ComboboxChipOutside","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","createItem","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInput","Input","ComboboxTrigger","XIcon","event","SearchIcon","ComboboxChips","cn","ComboboxValue","visible","overflow","Fragment","ComboboxChip","ComboboxChipRemove","ComboboxPop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MAAA,CAAA,CAAK,UAAU,qBAAA,CAAsB,QAAA,CAAA,SAAA,CAAO,CAAA,CAE/CA,GAAAA,CAAC,QAAK,SAAA,CAAU,wCAAA,CACb,QAAA,CAAAb,CAAAA,CACH,GACF,CAAA,CACF,CAAA,CAEFa,GAAAA,CAACmB,CAAAA,CAAA,CAAwB,GAAGlD,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-TZ44HGOL.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { ComboboxInput as ComboboxInputPrimitive } from \"../primitives/combobox\"\r\nimport { Input } from \"../ui\"\r\nimport {\r\n Combobox,\r\n ComboboxChip,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n type ComboboxProps\r\n} from \"../ui/combobox\"\r\nimport { SearchIcon, XIcon } from \"lucide-react\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\n\r\ntype ComboboxChipOutsideProps<Value> = Omit<ComboboxProps<Value, true>, \"multiple\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items: ({ label: string; value: string }[]) | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChipOutside<Value extends { label: string; value: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipOutsideProps<Value>) {\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n const [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n // Determine if the current input has no exact match in existing items\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n const createItem = {\r\n label: trimmedInput,\r\n value: trimmedInput,\r\n tag: true,\r\n }\r\n return [...base, createItem]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n // Capture newly created taggable items internally\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true\r\n && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n // if multiple is false, we need to replace the value with the new value instead of adding to it\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n <div className=\"flex flex-col gap-2\">\r\n <ComboboxInputPrimitive\r\n render={\r\n <Input\r\n className=\"h-9 text-body-regular-3 pl-9 pr-7\"\r\n endContent={\r\n <ComboboxTrigger\r\n nativeButton={false}\r\n render={(\r\n <XIcon\r\n className=\"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer\"\r\n data-hidden={!inputValue}\r\n data-slot=\"combobox-clear-input\"\r\n onClick={(event) => {\r\n setInputValue(\"\", {\r\n reason: \"none\",\r\n event: event.nativeEvent,\r\n cancel: () => { },\r\n allowPropagation: () => { },\r\n isCanceled: false,\r\n isPropagationAllowed: true,\r\n trigger: undefined,\r\n })\r\n }}\r\n />\r\n )}\r\n />\r\n }\r\n placeholder={inputPlaceholder}\r\n startContent={<SearchIcon className=\"!size-4 !text-fg-tertiary-hover\" />}\r\n wrapperClassName=\"w-full\"\r\n />\r\n }\r\n />\r\n <ComboboxChips\r\n className={cn(maxVisible !== undefined && \"flex-nowrap overflow-hidden\")}\r\n onMouseDown={(e) => e.preventBaseUIHandler()}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChip\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChip>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChip className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChip>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n </ComboboxChips>\r\n </div>\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={{ label: item.label, value: item.value }}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n <span className=\"truncate\">\r\n {item.label}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n <div className=\"flex items-center gap-1.5 w-full min-w-0\">\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary\">Create:</span>\r\n )}\r\n <span className=\"font-medium text-text-primary truncate\">\r\n {trimmedInput}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChipOutside }"]}
|
|
1
|
+
{"version":3,"sources":["../src/composites/combobox-chip-outside.tsx"],"names":["ComboboxChipOutside","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","createItem","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInput","Input","ComboboxTrigger","XIcon","event","SearchIcon","ComboboxChips","cn","ComboboxValue","visible","overflow","Fragment","ComboboxChip","ComboboxChipRemove","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxInfiniteScroll"],"mappings":"0WA4CA,SAASA,CAAAA,CAAgF,CACvF,QAAA,CAAAC,EAAW,IAAA,CACX,gBAAA,CAAAC,CAAAA,CAAmB,WAAA,CACnB,UAAAC,GAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,GAAAA,CACA,QAAA,CAAAC,EAAW,KAAA,CACX,UAAA,CAAAC,GAAAA,CACA,GAAGC,GACL,CAAA,CAAoC,CAClC,GAAM,CAACC,EAAYC,GAAa,CAAA,CAAIC,kBAAAA,CAAmB,CACrD,MAAOH,GAAAA,EAAO,UAAA,EAAY,QAAA,EAAS,CACnC,aAAcA,GAAAA,EAAO,iBAAA,EAAmB,QAAA,EAAS,CACjD,SAAUA,GAAAA,EAAO,kBACnB,CAAC,CAAA,CAEK,CAACI,GAAAA,CAAOC,CAAQ,CAAA,CAAIF,kBAAAA,CAAmB,CAC3C,KAAA,CAAOH,GAAAA,EAAO,KAAA,EAAS,EAAC,CACxB,YAAA,CAAcA,GAAAA,EAAO,YAAA,EAAgB,EAAC,CACtC,QAAA,CAAUA,GAAAA,EAAO,aACnB,CAAC,CAAA,CAIK,CA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AAc,GAAAA,CAAC,OAAI,SAAA,CAAU,wCAAA,CACb,QAAA,CAAAA,GAAAA,CAAC,QAAK,SAAA,CAAU,UAAA,CACb,QAAA,CAAAd,CAAAA,CAAK,MACR,CAAA,CACF,CAAA,CAAA,CAPKA,CAAAA,CAAK,KAQZ,CACD,CAAA,CACAG,CAAAA,EACCW,GAAAA,CAACkB,CAAAA,CAAA,CACC,KAAA,CAAO,CAAE,KAAA,CAAO/B,CAAAA,CAAc,KAAA,CAAOA,CAAAA,CAAc,GAAA,CAAK,IAAK,EAE7D,QAAA,CAAAM,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,2CACZ,QAAA,CAAA,CAAA,CAACL,CAAAA,EACAY,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,qBAAA,CAAsB,QAAA,CAAA,SAAA,CAAO,CAAA,CAE/CA,GAAAA,CAAC,QAAK,SAAA,CAAU,wCAAA,CACb,QAAA,CAAAb,CAAAA,CACH,GACF,CAAA,CACF,CAAA,CAEFa,GAAAA,CAACmB,CAAAA,CAAA,CAAwB,GAAGlD,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-LNL3VCSF.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { ComboboxInput as ComboboxInputPrimitive } from \"../primitives/combobox\"\r\nimport { Input } from \"../ui\"\r\nimport {\r\n Combobox,\r\n ComboboxChip,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n type ComboboxProps\r\n} from \"../ui/combobox\"\r\nimport { SearchIcon, XIcon } from \"lucide-react\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\n\r\ntype ComboboxChipOutsideProps<Value> = Omit<ComboboxProps<Value, true>, \"multiple\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items: ({ label: string; value: string }[]) | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChipOutside<Value extends { label: string; value: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipOutsideProps<Value>) {\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n const [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n // Determine if the current input has no exact match in existing items\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n const createItem = {\r\n label: trimmedInput,\r\n value: trimmedInput,\r\n tag: true,\r\n }\r\n return [...base, createItem]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n // Capture newly created taggable items internally\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true\r\n && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n // if multiple is false, we need to replace the value with the new value instead of adding to it\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n <div className=\"flex flex-col gap-2\">\r\n <ComboboxInputPrimitive\r\n render={\r\n <Input\r\n className=\"h-9 text-body-regular-3 pl-9 pr-7\"\r\n endContent={\r\n <ComboboxTrigger\r\n nativeButton={false}\r\n render={(\r\n <XIcon\r\n className=\"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer\"\r\n data-hidden={!inputValue}\r\n data-slot=\"combobox-clear-input\"\r\n onClick={(event) => {\r\n setInputValue(\"\", {\r\n reason: \"none\",\r\n event: event.nativeEvent,\r\n cancel: () => { },\r\n allowPropagation: () => { },\r\n isCanceled: false,\r\n isPropagationAllowed: true,\r\n trigger: undefined,\r\n })\r\n }}\r\n />\r\n )}\r\n />\r\n }\r\n placeholder={inputPlaceholder}\r\n startContent={<SearchIcon className=\"!size-4 !text-fg-tertiary-hover\" />}\r\n wrapperClassName=\"w-full\"\r\n />\r\n }\r\n />\r\n <ComboboxChips\r\n className={cn(maxVisible !== undefined && \"flex-nowrap overflow-hidden\")}\r\n onMouseDown={(e) => e.preventBaseUIHandler()}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChip\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChip>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChip className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChip>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n </ComboboxChips>\r\n </div>\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={{ label: item.label, value: item.value }}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n <span className=\"truncate\">\r\n {item.label}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n <div className=\"flex items-center gap-1.5 w-full min-w-0\">\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary\">Create:</span>\r\n )}\r\n <span className=\"font-medium text-text-primary truncate\">\r\n {trimmedInput}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChipOutside }"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {c,d,e,f,g,m,h,i,n,o,p,q as q$1,r,s,t,j as j$1,k,l,u,v}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {c,d,e,f,g,m,h,i,n,o,p,q as q$1,r,s,t,j as j$1,k,l,u,v}from'./chunk-JYFVQ5NY.js';import'react';import {cn}from'@xploreu/lib/cn';import {CheckIcon,CircleIcon,ChevronRightIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';function O(e){return jsx(c,{...e})}function j(e){return jsx(d,{...e})}function T(e$1){return jsx(e,{...e$1})}function q({className:e,finalFocus:t,id:i,children:n,sideOffset:o=4,transition:a={duration:.2},...p}){return jsx(T,{children:jsx(f,{className:"z-50",sideOffset:o,...p,children:jsx(g,{finalFocus:t,id:i,transition:a,className:cn("bg-bg-primary text-text-primary max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border-primary p-1 shadow-xp-lg outline-hidden",e),children:jsx(m,{className:"absolute inset-0 z-0 rounded-sm bg-bg-primary-hover",children:n})})})})}function B(e){return jsx(h,{...e})}function D({className:e,inset:t,...i$1}){return jsx(i,{"data-inset":t,className:cn("px-2 py-1.5 text-label-semibold-4 text-text-secondary data-[inset]:pl-8",e),...i$1})}function E({className:e,inset:t,variant:i="default",disabled:n$1,...o$1}){return jsx(n,{activeClassName:i==="destructive"?"bg-bg-error-primary":"",disabled:n$1,children:jsx(o,{disabled:n$1,"data-inset":t,"data-variant":i,className:cn("focus:text-text-primary data-[variant=destructive]:text-text-error-primary data-[variant=destructive]:focus:text-text-error-primary data-[variant=destructive]:*:[svg]:!text-fg-error-primary [&_svg:not([class*='text-'])]:text-fg-secondary relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-body-regular-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o$1})})}function J({className:e,children:t,checked:i,disabled:n$1,...o}){return jsx(n,{disabled:n$1,children:jsxs(p,{disabled:n$1,className:cn("focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-body-regular outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:i,...o,children:[jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:jsx(q$1,{animate:{opacity:1,scale:1},initial:{opacity:0,scale:.5},children:jsx(CheckIcon,{className:"size-4"})})}),t]})})}function K(e){return jsx(r,{...e})}function Q({className:e,children:t$1,disabled:i,...n$1}){return jsx(n,{disabled:i,children:jsxs(s,{disabled:i,className:cn("focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-body-regular outline-hidden select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n$1,children:[jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:jsx(t,{layoutId:"menu-item-indicator-radio",children:jsx(CircleIcon,{className:"size-2 fill-current"})})}),t$1]})})}function U({className:e,...t}){return jsx(j$1,{className:cn("-mx-1 my-1 h-px bg-border-primary",e),...t})}function V({className:e,...t}){return jsx(k,{className:cn("text-text-quaternary ml-auto text-body-regular-xs tracking-widest",e),...t})}function W(e){return jsx(l,{...e})}function X(e){return jsx(u,{...e})}function Y({disabled:e,className:t,inset:i,children:n$1,...o}){return jsx(n,{disabled:e,children:jsxs(v,{disabled:e,"data-inset":i,className:cn("focus:text-text-primary data-[state=open]:text-text-primary flex cursor-default items-center rounded-sm px-2 py-1.5 text-body-regular outline-hidden select-none data-[inset]:pl-8","aria-[expanded=true]:[&_[data-slot=chevron]]:rotate-90 [&_[data-slot=chevron]]:transition-transform [&_[data-slot=chevron]]:duration-300 [&_[data-slot=chevron]]:ease-in-out",t),...o,children:[n$1,jsx(ChevronRightIcon,{"data-slot":"chevron",className:"ml-auto size-4"})]})})}function Z({className:e,finalFocus:t,id:i,children:n,sideOffset:o=4,transition:a={duration:.2},...p}){return jsx(T,{children:jsx(f,{className:"z-50",sideOffset:o,...p,children:jsx(g,{finalFocus:t,id:i,transition:a,className:cn("bg-bg-primary text-text-primary max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border-primary p-1 shadow-xp-lg",e),children:n})})})}export{O as a,j as b,T as c,q as d,B as e,D as f,E as g,J as h,K as i,Q as j,U as k,V as l,W as m,X as n,Y as o,Z as p};//# sourceMappingURL=chunk-VODPMAOM.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-VODPMAOM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/menu.tsx"],"names":["Menu","props","jsx","MenuTrigger","MenuPortal","MenuPanel","className","finalFocus","id","children","sideOffset","transition","MenuPositioner","MenuPopup","cn","MenuHighlight","MenuGroup","MenuGroupLabel","inset","MenuItem","variant","disabled","MenuHighlightItem","MenuCheckboxItem","checked","jsxs","MenuCheckboxItemIndicator","CheckIcon","MenuRadioGroup","MenuRadioItem","MenuRadioItemIndicator","CircleIcon","MenuSeparator","MenuShortcut","MenuArrow","MenuSubmenu","MenuSubmenuTrigger","ChevronRightIcon","MenuSubmenuPanel"],"mappings":"iPAmDA,SAASA,CAAAA,CAAKC,CAAAA,CAAkB,CAC9B,OAAOC,GAAAA,CAACF,CAAAA,CAAA,CAAe,GAAGC,CAAAA,CAAO,CACnC,CAIA,SAASE,CAAAA,CAAYF,CAAAA,CAAyB,CAC5C,OAAOC,GAAAA,CAACC,CAAAA,CAAA,CAAsB,GAAGF,CAAAA,CAAO,CAC1C,CAIA,SAASG,CAAAA,CAAWH,GAAAA,CAAwB,CAC1C,OAAOC,GAAAA,CAACE,CAAAA,CAAA,CAAqB,GAAGH,GAAAA,CAAO,CACzC,CAIA,SAASI,CAAAA,CAAU,CACjB,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,EACA,EAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAA,CACb,UAAA,CAAAC,CAAAA,CAAa,CAAE,QAAA,CAAU,EAAI,CAAA,CAC7B,GAAGV,CACL,CAAA,CAAmB,CACjB,OACEC,GAAAA,CAACE,CAAAA,CAAA,CACC,QAAA,CAAAF,GAAAA,CAACU,CAAAA,CAAA,CACC,SAAA,CAAU,MAAA,CACV,UAAA,CAAYF,CAAAA,CACX,GAAGT,CAAAA,CAEJ,QAAA,CAAAC,IAACW,CAAAA,CAAA,CACC,UAAA,CAAYN,CAAAA,CACZ,EAAA,CAAIC,CAAAA,CACJ,UAAA,CAAYG,CAAAA,CACZ,SAAA,CAAWG,EAAAA,CACT,+MAAA,CACAR,CACF,CAAA,CAEA,QAAA,CAAAJ,GAAAA,CAACa,CAAAA,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AAAA,CAACmC,iBAAA,CACC,WAAA,CAAU,SAAA,CACV,SAAA,CAAU,gBAAA,CACZ,CAAA,CAAA,CACF,CAAA,CACF,CAEJ,CAKA,SAASC,CAAAA,CAAiB,CACxB,SAAA,CAAAhC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,EAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAA,CACb,UAAA,CAAAC,CAAAA,CAAa,CAAE,QAAA,CAAU,EAAI,CAAA,CAC7B,GAAGV,CACL,CAAA,CAA0B,CACxB,OACEC,GAAAA,CAACE,CAAAA,CAAA,CACC,QAAA,CAAAF,GAAAA,CAACU,CAAAA,CAAA,CACC,SAAA,CAAU,MAAA,CACV,UAAA,CAAYF,CAAAA,CACX,GAAGT,CAAAA,CAEJ,QAAA,CAAAC,GAAAA,CAACW,CAAAA,CAAA,CACC,UAAA,CAAYN,CAAAA,CACZ,EAAA,CAAIC,CAAAA,CACJ,UAAA,CAAYG,CAAAA,CACZ,SAAA,CAAWG,EAAAA,CACT,gMAAA,CACAR,CACF,CAAA,CAEC,QAAA,CAAAG,CAAAA,CACH,CAAA,CACF,EACF,CAEJ","file":"chunk-V2D72N26.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\n\r\nimport {\r\n Menu as MenuPrimitive,\r\n MenuArrow as MenuArrowPrimitive,\r\n MenuCheckboxItem as MenuCheckboxItemPrimitive,\r\n MenuCheckboxItemIndicator as MenuCheckboxItemIndicatorPrimitive,\r\n MenuGroup as MenuGroupPrimitive,\r\n MenuGroupLabel as MenuGroupLabelPrimitive,\r\n MenuHighlight as MenuHighlightPrimitive,\r\n MenuHighlightItem as MenuHighlightItemPrimitive,\r\n MenuItem as MenuItemPrimitive,\r\n MenuPortal as MenuPortalPrimitive,\r\n MenuPopup as MenuPopupPrimitive,\r\n MenuPositioner as MenuPositionerPrimitive,\r\n MenuRadioGroup as MenuRadioGroupPrimitive,\r\n MenuRadioItem as MenuRadioItemPrimitive,\r\n MenuRadioItemIndicator as MenuRadioItemIndicatorPrimitive,\r\n MenuSeparator as MenuSeparatorPrimitive,\r\n MenuShortcut as MenuShortcutPrimitive,\r\n MenuSubmenu as MenuSubmenuPrimitive,\r\n MenuSubmenuTrigger as MenuSubmenuTriggerPrimitive,\r\n MenuTrigger as MenuTriggerPrimitive,\r\n type MenuArrowProps as MenuArrowPrimitiveProps,\r\n type MenuCheckboxItemIndicatorProps as MenuCheckboxItemIndicatorPrimitiveProps,\r\n type MenuCheckboxItemProps as MenuCheckboxItemPrimitiveProps,\r\n type MenuGroupLabelProps as MenuGroupLabelPrimitiveProps,\r\n type MenuGroupProps as MenuGroupPrimitiveProps,\r\n type MenuHighlightItemProps as MenuHighlightItemPrimitiveProps,\r\n type MenuHighlightProps as MenuHighlightPrimitiveProps,\r\n type MenuItemProps as MenuItemPrimitiveProps,\r\n type MenuPopupProps as MenuPopupPrimitiveProps,\r\n type MenuPortalProps as MenuPortalPrimitiveProps,\r\n type MenuPositionerProps as MenuPositionerPrimitiveProps,\r\n type MenuProps as MenuPrimitiveProps,\r\n type MenuRadioGroupProps as MenuRadioGroupPrimitiveProps,\r\n type MenuRadioItemProps as MenuRadioItemPrimitiveProps,\r\n type MenuRadioItemIndicatorProps as MenuRadioItemIndicatorPrimitiveProps,\r\n type MenuSeparatorProps as MenuSeparatorPrimitiveProps,\r\n type MenuShortcutProps as MenuShortcutPrimitiveProps,\r\n type MenuSubmenuProps as MenuSubmenuPrimitiveProps,\r\n type MenuSubmenuTriggerProps as MenuSubmenuTriggerPrimitiveProps,\r\n type MenuTriggerProps as MenuTriggerPrimitiveProps,\r\n} from \"../primitives/menu\"\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\"\r\n\r\ntype MenuProps = MenuPrimitiveProps\r\n\r\nfunction Menu(props: MenuProps) {\r\n return <MenuPrimitive {...props} />\r\n}\r\n\r\ntype MenuTriggerProps = MenuTriggerPrimitiveProps\r\n\r\nfunction MenuTrigger(props: MenuTriggerProps) {\r\n return <MenuTriggerPrimitive {...props} />\r\n}\r\n\r\ntype MenuPortalProps = MenuPortalPrimitiveProps\r\n\r\nfunction MenuPortal(props: MenuPortalProps) {\r\n return <MenuPortalPrimitive {...props} />\r\n}\r\n\r\ntype MenuPanelProps = MenuPopupPrimitiveProps & MenuPositionerPrimitiveProps\r\n\r\nfunction MenuPanel({\r\n className,\r\n finalFocus,\r\n id,\r\n children,\r\n sideOffset = 4,\r\n transition = { duration: 0.2 },\r\n ...props\r\n}: MenuPanelProps) {\r\n return (\r\n <MenuPortal>\r\n <MenuPositionerPrimitive\r\n className=\"z-50\"\r\n sideOffset={sideOffset}\r\n {...props}\r\n >\r\n <MenuPopupPrimitive\r\n finalFocus={finalFocus}\r\n id={id}\r\n transition={transition}\r\n className={cn(\r\n \"bg-bg-primary text-text-primary max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border-primary p-1 shadow-xp-lg outline-hidden\",\r\n className,\r\n )}\r\n >\r\n <MenuHighlightPrimitive className=\"absolute inset-0 z-0 rounded-sm bg-bg-primary-hover\">\r\n {children}\r\n </MenuHighlightPrimitive>\r\n </MenuPopupPrimitive>\r\n </MenuPositionerPrimitive>\r\n </MenuPortal>\r\n )\r\n}\r\n\r\ntype MenuGroupProps = MenuGroupPrimitiveProps\r\n\r\nfunction MenuGroup(props: MenuGroupProps) {\r\n return <MenuGroupPrimitive {...props} />\r\n}\r\n\r\ntype MenuGroupLabelProps = MenuGroupLabelPrimitiveProps & {\r\n inset?: boolean;\r\n}\r\n\r\nfunction MenuGroupLabel({ className, inset, ...props }: MenuGroupLabelProps) {\r\n return (\r\n <MenuGroupLabelPrimitive\r\n data-inset={inset}\r\n className={cn(\r\n \"px-2 py-1.5 text-label-semibold-4 text-text-secondary data-[inset]:pl-8\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuItemProps = MenuItemPrimitiveProps & {\r\n inset?: boolean;\r\n variant?: \"default\" | \"destructive\";\r\n}\r\n\r\nfunction MenuItem({\r\n className,\r\n inset,\r\n variant = \"default\",\r\n disabled,\r\n ...props\r\n}: MenuItemProps) {\r\n return (\r\n <MenuHighlightItemPrimitive\r\n activeClassName={\r\n variant === \"destructive\" ? \"bg-bg-error-primary\" : \"\"\r\n }\r\n disabled={disabled}\r\n >\r\n <MenuItemPrimitive\r\n disabled={disabled}\r\n data-inset={inset}\r\n data-variant={variant}\r\n className={cn(\r\n \"focus:text-text-primary data-[variant=destructive]:text-text-error-primary data-[variant=destructive]:focus:text-text-error-primary data-[variant=destructive]:*:[svg]:!text-fg-error-primary [&_svg:not([class*='text-'])]:text-fg-secondary relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-body-regular-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuCheckboxItemProps = MenuCheckboxItemPrimitiveProps\r\n\r\nfunction MenuCheckboxItem({\r\n className,\r\n children,\r\n checked,\r\n disabled,\r\n ...props\r\n}: MenuCheckboxItemProps) {\r\n return (\r\n <MenuHighlightItemPrimitive disabled={disabled}>\r\n <MenuCheckboxItemPrimitive\r\n disabled={disabled}\r\n className={cn(\r\n \"focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-body-regular outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n checked={checked}\r\n {...props}\r\n >\r\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\r\n <MenuCheckboxItemIndicatorPrimitive\r\n animate={{ opacity: 1, scale: 1 }}\r\n initial={{ opacity: 0, scale: 0.5 }}\r\n >\r\n <CheckIcon className=\"size-4\" />\r\n </MenuCheckboxItemIndicatorPrimitive>\r\n </span>\r\n {children}\r\n </MenuCheckboxItemPrimitive>\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuRadioGroupProps = MenuRadioGroupPrimitiveProps\r\n\r\nfunction MenuRadioGroup(props: MenuRadioGroupProps) {\r\n return <MenuRadioGroupPrimitive {...props} />\r\n}\r\n\r\ntype MenuRadioItemProps = MenuRadioItemPrimitiveProps\r\n\r\nfunction MenuRadioItem({\r\n className,\r\n children,\r\n disabled,\r\n ...props\r\n}: MenuRadioItemProps) {\r\n return (\r\n <MenuHighlightItemPrimitive disabled={disabled}>\r\n <MenuRadioItemPrimitive\r\n disabled={disabled}\r\n className={cn(\r\n \"focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-body-regular outline-hidden select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\r\n <MenuRadioItemIndicatorPrimitive layoutId=\"menu-item-indicator-radio\">\r\n <CircleIcon className=\"size-2 fill-current\" />\r\n </MenuRadioItemIndicatorPrimitive>\r\n </span>\r\n {children}\r\n </MenuRadioItemPrimitive>\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuSeparatorProps = MenuSeparatorPrimitiveProps\r\n\r\nfunction MenuSeparator({ className, ...props }: MenuSeparatorProps) {\r\n return (\r\n <MenuSeparatorPrimitive\r\n className={cn(\"-mx-1 my-1 h-px bg-border-primary\", className)}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuShortcutProps = MenuShortcutPrimitiveProps\r\n\r\nfunction MenuShortcut({ className, ...props }: MenuShortcutProps) {\r\n return (\r\n <MenuShortcutPrimitive\r\n className={cn(\r\n \"text-text-quaternary ml-auto text-body-regular-xs tracking-widest\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuArrowProps = MenuArrowPrimitiveProps\r\n\r\nfunction MenuArrow(props: MenuArrowProps) {\r\n return <MenuArrowPrimitive {...props} />\r\n}\r\n\r\ntype MenuSubmenuProps = MenuSubmenuPrimitiveProps\r\n\r\nfunction MenuSubmenu(props: MenuSubmenuProps) {\r\n return <MenuSubmenuPrimitive {...props} />\r\n}\r\n\r\ntype MenuSubmenuTriggerProps = MenuSubmenuTriggerPrimitiveProps & {\r\n inset?: boolean;\r\n children?: React.ReactNode;\r\n}\r\n\r\nfunction MenuSubmenuTrigger({\r\n disabled,\r\n className,\r\n inset,\r\n children,\r\n ...props\r\n}: MenuSubmenuTriggerProps) {\r\n return (\r\n <MenuHighlightItemPrimitive disabled={disabled}>\r\n <MenuSubmenuTriggerPrimitive\r\n disabled={disabled}\r\n data-inset={inset}\r\n className={cn(\r\n \"focus:text-text-primary data-[state=open]:text-text-primary flex cursor-default items-center rounded-sm px-2 py-1.5 text-body-regular outline-hidden select-none data-[inset]:pl-8\",\r\n \"aria-[expanded=true]:[&_[data-slot=chevron]]:rotate-90 [&_[data-slot=chevron]]:transition-transform [&_[data-slot=chevron]]:duration-300 [&_[data-slot=chevron]]:ease-in-out\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ChevronRightIcon\r\n data-slot=\"chevron\"\r\n className=\"ml-auto size-4\"\r\n />\r\n </MenuSubmenuTriggerPrimitive>\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuSubmenuPanelProps = MenuPopupPrimitiveProps &\r\n MenuPositionerPrimitiveProps\r\n\r\nfunction MenuSubmenuPanel({\r\n className,\r\n finalFocus,\r\n id,\r\n children,\r\n sideOffset = 4,\r\n transition = { duration: 0.2 },\r\n ...props\r\n}: MenuSubmenuPanelProps) {\r\n return (\r\n <MenuPortal>\r\n <MenuPositionerPrimitive\r\n className=\"z-50\"\r\n sideOffset={sideOffset}\r\n {...props}\r\n >\r\n <MenuPopupPrimitive\r\n finalFocus={finalFocus}\r\n id={id}\r\n transition={transition}\r\n className={cn(\r\n \"bg-bg-primary text-text-primary max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border-primary p-1 shadow-xp-lg\",\r\n className,\r\n )}\r\n >\r\n {children}\r\n </MenuPopupPrimitive>\r\n </MenuPositionerPrimitive>\r\n </MenuPortal>\r\n )\r\n}\r\n\r\nexport {\r\n Menu,\r\n MenuTrigger,\r\n MenuPortal,\r\n MenuPanel,\r\n MenuGroup,\r\n MenuGroupLabel,\r\n MenuItem,\r\n MenuCheckboxItem,\r\n MenuRadioGroup,\r\n MenuRadioItem,\r\n MenuSeparator,\r\n MenuShortcut,\r\n MenuArrow,\r\n MenuSubmenu,\r\n MenuSubmenuTrigger,\r\n MenuSubmenuPanel,\r\n type MenuProps,\r\n type MenuTriggerProps,\r\n type MenuPortalProps,\r\n type MenuPanelProps,\r\n type MenuGroupProps,\r\n type MenuGroupLabelProps,\r\n type MenuItemProps,\r\n type MenuCheckboxItemProps,\r\n type MenuRadioGroupProps,\r\n type MenuRadioItemProps,\r\n type MenuSeparatorProps,\r\n type MenuShortcutProps,\r\n type MenuArrowProps,\r\n type MenuSubmenuProps,\r\n type MenuSubmenuTriggerProps,\r\n type MenuSubmenuPanelProps,\r\n}"]}
|
|
1
|
+
{"version":3,"sources":["../src/ui/menu.tsx"],"names":["Menu","props","jsx","MenuTrigger","MenuPortal","MenuPanel","className","finalFocus","id","children","sideOffset","transition","MenuPositioner","MenuPopup","cn","MenuHighlight","MenuGroup","MenuGroupLabel","inset","MenuItem","variant","disabled","MenuHighlightItem","MenuCheckboxItem","checked","jsxs","MenuCheckboxItemIndicator","CheckIcon","MenuRadioGroup","MenuRadioItem","MenuRadioItemIndicator","CircleIcon","MenuSeparator","MenuShortcut","MenuArrow","MenuSubmenu","MenuSubmenuTrigger","ChevronRightIcon","MenuSubmenuPanel"],"mappings":"iPAmDA,SAASA,CAAAA,CAAKC,CAAAA,CAAkB,CAC9B,OAAOC,GAAAA,CAACF,CAAAA,CAAA,CAAe,GAAGC,CAAAA,CAAO,CACnC,CAIA,SAASE,CAAAA,CAAYF,CAAAA,CAAyB,CAC5C,OAAOC,GAAAA,CAACC,CAAAA,CAAA,CAAsB,GAAGF,CAAAA,CAAO,CAC1C,CAIA,SAASG,CAAAA,CAAWH,GAAAA,CAAwB,CAC1C,OAAOC,GAAAA,CAACE,CAAAA,CAAA,CAAqB,GAAGH,GAAAA,CAAO,CACzC,CAIA,SAASI,CAAAA,CAAU,CACjB,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,EACA,EAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAA,CACb,UAAA,CAAAC,CAAAA,CAAa,CAAE,QAAA,CAAU,EAAI,CAAA,CAC7B,GAAGV,CACL,CAAA,CAAmB,CACjB,OACEC,GAAAA,CAACE,CAAAA,CAAA,CACC,QAAA,CAAAF,GAAAA,CAACU,CAAAA,CAAA,CACC,SAAA,CAAU,MAAA,CACV,UAAA,CAAYF,CAAAA,CACX,GAAGT,CAAAA,CAEJ,QAAA,CAAAC,IAACW,CAAAA,CAAA,CACC,UAAA,CAAYN,CAAAA,CACZ,EAAA,CAAIC,CAAAA,CACJ,UAAA,CAAYG,CAAAA,CACZ,SAAA,CAAWG,EAAAA,CACT,+MAAA,CACAR,CACF,CAAA,CAEA,QAAA,CAAAJ,GAAAA,CAACa,CAAAA,CAAA,CAAuB,SAAA,CAAU,qDAAA,CAC/B,QAAA,CAAAN,CAAAA,CACH,CAAA,CACF,CAAA,CACF,CAAA,CACF,CAEJ,CAI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CAKA,SAASC,CAAAA,CAAiB,CACxB,SAAA,CAAAhC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,EAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAA,CACb,UAAA,CAAAC,CAAAA,CAAa,CAAE,QAAA,CAAU,EAAI,CAAA,CAC7B,GAAGV,CACL,CAAA,CAA0B,CACxB,OACEC,GAAAA,CAACE,CAAAA,CAAA,CACC,QAAA,CAAAF,GAAAA,CAACU,CAAAA,CAAA,CACC,SAAA,CAAU,MAAA,CACV,UAAA,CAAYF,CAAAA,CACX,GAAGT,CAAAA,CAEJ,QAAA,CAAAC,GAAAA,CAACW,CAAAA,CAAA,CACC,UAAA,CAAYN,CAAAA,CACZ,EAAA,CAAIC,CAAAA,CACJ,UAAA,CAAYG,CAAAA,CACZ,SAAA,CAAWG,EAAAA,CACT,gMAAA,CACAR,CACF,CAAA,CAEC,QAAA,CAAAG,CAAAA,CACH,CAAA,CACF,EACF,CAEJ","file":"chunk-VODPMAOM.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\n\r\nimport {\r\n Menu as MenuPrimitive,\r\n MenuArrow as MenuArrowPrimitive,\r\n MenuCheckboxItem as MenuCheckboxItemPrimitive,\r\n MenuCheckboxItemIndicator as MenuCheckboxItemIndicatorPrimitive,\r\n MenuGroup as MenuGroupPrimitive,\r\n MenuGroupLabel as MenuGroupLabelPrimitive,\r\n MenuHighlight as MenuHighlightPrimitive,\r\n MenuHighlightItem as MenuHighlightItemPrimitive,\r\n MenuItem as MenuItemPrimitive,\r\n MenuPortal as MenuPortalPrimitive,\r\n MenuPopup as MenuPopupPrimitive,\r\n MenuPositioner as MenuPositionerPrimitive,\r\n MenuRadioGroup as MenuRadioGroupPrimitive,\r\n MenuRadioItem as MenuRadioItemPrimitive,\r\n MenuRadioItemIndicator as MenuRadioItemIndicatorPrimitive,\r\n MenuSeparator as MenuSeparatorPrimitive,\r\n MenuShortcut as MenuShortcutPrimitive,\r\n MenuSubmenu as MenuSubmenuPrimitive,\r\n MenuSubmenuTrigger as MenuSubmenuTriggerPrimitive,\r\n MenuTrigger as MenuTriggerPrimitive,\r\n type MenuArrowProps as MenuArrowPrimitiveProps,\r\n type MenuCheckboxItemIndicatorProps as MenuCheckboxItemIndicatorPrimitiveProps,\r\n type MenuCheckboxItemProps as MenuCheckboxItemPrimitiveProps,\r\n type MenuGroupLabelProps as MenuGroupLabelPrimitiveProps,\r\n type MenuGroupProps as MenuGroupPrimitiveProps,\r\n type MenuHighlightItemProps as MenuHighlightItemPrimitiveProps,\r\n type MenuHighlightProps as MenuHighlightPrimitiveProps,\r\n type MenuItemProps as MenuItemPrimitiveProps,\r\n type MenuPopupProps as MenuPopupPrimitiveProps,\r\n type MenuPortalProps as MenuPortalPrimitiveProps,\r\n type MenuPositionerProps as MenuPositionerPrimitiveProps,\r\n type MenuProps as MenuPrimitiveProps,\r\n type MenuRadioGroupProps as MenuRadioGroupPrimitiveProps,\r\n type MenuRadioItemProps as MenuRadioItemPrimitiveProps,\r\n type MenuRadioItemIndicatorProps as MenuRadioItemIndicatorPrimitiveProps,\r\n type MenuSeparatorProps as MenuSeparatorPrimitiveProps,\r\n type MenuShortcutProps as MenuShortcutPrimitiveProps,\r\n type MenuSubmenuProps as MenuSubmenuPrimitiveProps,\r\n type MenuSubmenuTriggerProps as MenuSubmenuTriggerPrimitiveProps,\r\n type MenuTriggerProps as MenuTriggerPrimitiveProps,\r\n} from \"../primitives/menu\"\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\"\r\n\r\ntype MenuProps = MenuPrimitiveProps\r\n\r\nfunction Menu(props: MenuProps) {\r\n return <MenuPrimitive {...props} />\r\n}\r\n\r\ntype MenuTriggerProps = MenuTriggerPrimitiveProps\r\n\r\nfunction MenuTrigger(props: MenuTriggerProps) {\r\n return <MenuTriggerPrimitive {...props} />\r\n}\r\n\r\ntype MenuPortalProps = MenuPortalPrimitiveProps\r\n\r\nfunction MenuPortal(props: MenuPortalProps) {\r\n return <MenuPortalPrimitive {...props} />\r\n}\r\n\r\ntype MenuPanelProps = MenuPopupPrimitiveProps & MenuPositionerPrimitiveProps\r\n\r\nfunction MenuPanel({\r\n className,\r\n finalFocus,\r\n id,\r\n children,\r\n sideOffset = 4,\r\n transition = { duration: 0.2 },\r\n ...props\r\n}: MenuPanelProps) {\r\n return (\r\n <MenuPortal>\r\n <MenuPositionerPrimitive\r\n className=\"z-50\"\r\n sideOffset={sideOffset}\r\n {...props}\r\n >\r\n <MenuPopupPrimitive\r\n finalFocus={finalFocus}\r\n id={id}\r\n transition={transition}\r\n className={cn(\r\n \"bg-bg-primary text-text-primary max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border-primary p-1 shadow-xp-lg outline-hidden\",\r\n className,\r\n )}\r\n >\r\n <MenuHighlightPrimitive className=\"absolute inset-0 z-0 rounded-sm bg-bg-primary-hover\">\r\n {children}\r\n </MenuHighlightPrimitive>\r\n </MenuPopupPrimitive>\r\n </MenuPositionerPrimitive>\r\n </MenuPortal>\r\n )\r\n}\r\n\r\ntype MenuGroupProps = MenuGroupPrimitiveProps\r\n\r\nfunction MenuGroup(props: MenuGroupProps) {\r\n return <MenuGroupPrimitive {...props} />\r\n}\r\n\r\ntype MenuGroupLabelProps = MenuGroupLabelPrimitiveProps & {\r\n inset?: boolean;\r\n}\r\n\r\nfunction MenuGroupLabel({ className, inset, ...props }: MenuGroupLabelProps) {\r\n return (\r\n <MenuGroupLabelPrimitive\r\n data-inset={inset}\r\n className={cn(\r\n \"px-2 py-1.5 text-label-semibold-4 text-text-secondary data-[inset]:pl-8\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuItemProps = MenuItemPrimitiveProps & {\r\n inset?: boolean;\r\n variant?: \"default\" | \"destructive\";\r\n}\r\n\r\nfunction MenuItem({\r\n className,\r\n inset,\r\n variant = \"default\",\r\n disabled,\r\n ...props\r\n}: MenuItemProps) {\r\n return (\r\n <MenuHighlightItemPrimitive\r\n activeClassName={\r\n variant === \"destructive\" ? \"bg-bg-error-primary\" : \"\"\r\n }\r\n disabled={disabled}\r\n >\r\n <MenuItemPrimitive\r\n disabled={disabled}\r\n data-inset={inset}\r\n data-variant={variant}\r\n className={cn(\r\n \"focus:text-text-primary data-[variant=destructive]:text-text-error-primary data-[variant=destructive]:focus:text-text-error-primary data-[variant=destructive]:*:[svg]:!text-fg-error-primary [&_svg:not([class*='text-'])]:text-fg-secondary relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-body-regular-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuCheckboxItemProps = MenuCheckboxItemPrimitiveProps\r\n\r\nfunction MenuCheckboxItem({\r\n className,\r\n children,\r\n checked,\r\n disabled,\r\n ...props\r\n}: MenuCheckboxItemProps) {\r\n return (\r\n <MenuHighlightItemPrimitive disabled={disabled}>\r\n <MenuCheckboxItemPrimitive\r\n disabled={disabled}\r\n className={cn(\r\n \"focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-body-regular outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n checked={checked}\r\n {...props}\r\n >\r\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\r\n <MenuCheckboxItemIndicatorPrimitive\r\n animate={{ opacity: 1, scale: 1 }}\r\n initial={{ opacity: 0, scale: 0.5 }}\r\n >\r\n <CheckIcon className=\"size-4\" />\r\n </MenuCheckboxItemIndicatorPrimitive>\r\n </span>\r\n {children}\r\n </MenuCheckboxItemPrimitive>\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuRadioGroupProps = MenuRadioGroupPrimitiveProps\r\n\r\nfunction MenuRadioGroup(props: MenuRadioGroupProps) {\r\n return <MenuRadioGroupPrimitive {...props} />\r\n}\r\n\r\ntype MenuRadioItemProps = MenuRadioItemPrimitiveProps\r\n\r\nfunction MenuRadioItem({\r\n className,\r\n children,\r\n disabled,\r\n ...props\r\n}: MenuRadioItemProps) {\r\n return (\r\n <MenuHighlightItemPrimitive disabled={disabled}>\r\n <MenuRadioItemPrimitive\r\n disabled={disabled}\r\n className={cn(\r\n \"focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-body-regular outline-hidden select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\r\n <MenuRadioItemIndicatorPrimitive layoutId=\"menu-item-indicator-radio\">\r\n <CircleIcon className=\"size-2 fill-current\" />\r\n </MenuRadioItemIndicatorPrimitive>\r\n </span>\r\n {children}\r\n </MenuRadioItemPrimitive>\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuSeparatorProps = MenuSeparatorPrimitiveProps\r\n\r\nfunction MenuSeparator({ className, ...props }: MenuSeparatorProps) {\r\n return (\r\n <MenuSeparatorPrimitive\r\n className={cn(\"-mx-1 my-1 h-px bg-border-primary\", className)}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuShortcutProps = MenuShortcutPrimitiveProps\r\n\r\nfunction MenuShortcut({ className, ...props }: MenuShortcutProps) {\r\n return (\r\n <MenuShortcutPrimitive\r\n className={cn(\r\n \"text-text-quaternary ml-auto text-body-regular-xs tracking-widest\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype MenuArrowProps = MenuArrowPrimitiveProps\r\n\r\nfunction MenuArrow(props: MenuArrowProps) {\r\n return <MenuArrowPrimitive {...props} />\r\n}\r\n\r\ntype MenuSubmenuProps = MenuSubmenuPrimitiveProps\r\n\r\nfunction MenuSubmenu(props: MenuSubmenuProps) {\r\n return <MenuSubmenuPrimitive {...props} />\r\n}\r\n\r\ntype MenuSubmenuTriggerProps = MenuSubmenuTriggerPrimitiveProps & {\r\n inset?: boolean;\r\n children?: React.ReactNode;\r\n}\r\n\r\nfunction MenuSubmenuTrigger({\r\n disabled,\r\n className,\r\n inset,\r\n children,\r\n ...props\r\n}: MenuSubmenuTriggerProps) {\r\n return (\r\n <MenuHighlightItemPrimitive disabled={disabled}>\r\n <MenuSubmenuTriggerPrimitive\r\n disabled={disabled}\r\n data-inset={inset}\r\n className={cn(\r\n \"focus:text-text-primary data-[state=open]:text-text-primary flex cursor-default items-center rounded-sm px-2 py-1.5 text-body-regular outline-hidden select-none data-[inset]:pl-8\",\r\n \"aria-[expanded=true]:[&_[data-slot=chevron]]:rotate-90 [&_[data-slot=chevron]]:transition-transform [&_[data-slot=chevron]]:duration-300 [&_[data-slot=chevron]]:ease-in-out\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ChevronRightIcon\r\n data-slot=\"chevron\"\r\n className=\"ml-auto size-4\"\r\n />\r\n </MenuSubmenuTriggerPrimitive>\r\n </MenuHighlightItemPrimitive>\r\n )\r\n}\r\n\r\ntype MenuSubmenuPanelProps = MenuPopupPrimitiveProps &\r\n MenuPositionerPrimitiveProps\r\n\r\nfunction MenuSubmenuPanel({\r\n className,\r\n finalFocus,\r\n id,\r\n children,\r\n sideOffset = 4,\r\n transition = { duration: 0.2 },\r\n ...props\r\n}: MenuSubmenuPanelProps) {\r\n return (\r\n <MenuPortal>\r\n <MenuPositionerPrimitive\r\n className=\"z-50\"\r\n sideOffset={sideOffset}\r\n {...props}\r\n >\r\n <MenuPopupPrimitive\r\n finalFocus={finalFocus}\r\n id={id}\r\n transition={transition}\r\n className={cn(\r\n \"bg-bg-primary text-text-primary max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border-primary p-1 shadow-xp-lg\",\r\n className,\r\n )}\r\n >\r\n {children}\r\n </MenuPopupPrimitive>\r\n </MenuPositionerPrimitive>\r\n </MenuPortal>\r\n )\r\n}\r\n\r\nexport {\r\n Menu,\r\n MenuTrigger,\r\n MenuPortal,\r\n MenuPanel,\r\n MenuGroup,\r\n MenuGroupLabel,\r\n MenuItem,\r\n MenuCheckboxItem,\r\n MenuRadioGroup,\r\n MenuRadioItem,\r\n MenuSeparator,\r\n MenuShortcut,\r\n MenuArrow,\r\n MenuSubmenu,\r\n MenuSubmenuTrigger,\r\n MenuSubmenuPanel,\r\n type MenuProps,\r\n type MenuTriggerProps,\r\n type MenuPortalProps,\r\n type MenuPanelProps,\r\n type MenuGroupProps,\r\n type MenuGroupLabelProps,\r\n type MenuItemProps,\r\n type MenuCheckboxItemProps,\r\n type MenuRadioGroupProps,\r\n type MenuRadioItemProps,\r\n type MenuSeparatorProps,\r\n type MenuShortcutProps,\r\n type MenuArrowProps,\r\n type MenuSubmenuProps,\r\n type MenuSubmenuTriggerProps,\r\n type MenuSubmenuPanelProps,\r\n}"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,j,i,k,l,m,q,s,w,A,x,H}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,j,i,k,l,m,q,s,w,A,x,H}from'./chunk-IZQFTYJD.js';import {f,g}from'./chunk-HHG7BSWN.js';import {a as a$1}from'./chunk-JH6RZ3QH.js';import*as r from'react';import {cn}from'@xploreu/lib/cn';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function $({multiple:G=true,inputPlaceholder:j$1="Search...",container:q$1,items:s$1,infiniteScroll:z,isPending:B,taggable:C=false,maxVisible:b,...m$1}){let[O,F]=useControlledState({value:m$1?.inputValue?.toString(),defaultValue:m$1?.defaultInputValue?.toString(),onChange:m$1?.onInputValueChange}),[i$1,h]=useControlledState({value:m$1?.value??[],defaultValue:m$1?.defaultValue??[],onChange:m$1?.onValueChange}),[I,V]=r.useState([]),p=r.useRef(new Set);r.useEffect(()=>{let e=new Set(i$1.map(a=>a.value));V(a=>{let l=a.filter(o=>e.has(o.value));return l.length===a.length?a:(p.current=new Set(l.map(o=>o.value)),l)});},[i$1]);let t=O?.toString().trim()??"",v=r.useMemo(()=>t?i$1.some(e=>e.value.toLowerCase()===t.toLowerCase()):false,[t,i$1]),c=r.useMemo(()=>!C||!t?false:!s$1?.some(e=>e.label.toLowerCase()===t.toLowerCase()),[C,t,s$1]),H$1=r.useMemo(()=>{let e=[...s$1??[],...I];return c?[...e,{label:t,value:t,tag:true}]:e},[s$1,I,c,t]);return jsxs(a,{...m$1,behavior:"chip-outside",multiple:true,items:C?H$1:s$1,isItemEqualToValue:(e,a)=>e.value===a.value,onValueChange:(e,a)=>{if(C){let l=e.filter(o=>o?.tag===true&&!p.current.has(o.value));if(l.length>0){for(let o of l)p.current.add(o.value);V(o=>[...o,...l]);}}h(G?e:[e[e.length-1]],a);},onInputValueChange:F,children:[jsx(f,{className:cn(a$1(),"h-auto min-h-13 flex flex-wrap items-center gap-1.5 px-3 py-1.5 cursor-text"),children:jsxs(j,{className:cn("contents",b!==void 0&&"flex-nowrap overflow-hidden"),children:[jsx(i,{children:e=>{let a=b!==void 0?e.slice(0,b):e,l$1=b!==void 0?e.length-b:0;return jsxs(Fragment,{children:[a?.map(o=>jsxs(k,{className:cn(b!==void 0&&"min-w-0 shrink"),children:[o?.image&&jsx("img",{src:o.image,alt:o?.label||"",className:"size-4 rounded-full object-cover shrink-0 mr-1"}),b!==void 0?jsx("span",{className:"truncate",children:o?.label||""}):o?.label||"",jsx(l,{})]},o?.value||"")),l$1>0&&jsxs(k,{className:"shrink-0",children:["+",l$1]})]})}}),jsx(g,{render:jsx("input",{className:"flex-1 min-w-[80px] bg-transparent outline-none text-body-regular-1 text-text-primary placeholder:text-text-placeholder",placeholder:i$1.length===0?j$1:void 0})})]})}),jsxs(m,{container:q$1,children:[jsx(q,{status:B||s$1===void 0?"pending":s$1?.length===0&&!c?"empty":null}),jsxs(s,{children:[s$1?.map(e=>jsxs(w,{value:e,children:[e.image!==void 0&&jsx(A,{src:e.image,fallbackText:[e.label?.[0],e.label?.split(" ")?.[1]?.[0]].filter(Boolean).join(""),imageAlt:e.label}),jsx(x,{children:e.label})]},e.value)),c&&jsxs(w,{value:{label:t,value:t,tag:true},children:[!v&&jsxs("span",{className:"text-text-secondary text-body-medium-3 col-start-2",children:["Create: ",t]}),v&&jsx(x,{children:t})]}),jsx(H,{...z})]})]})]})}export{$ as a};//# sourceMappingURL=chunk-WV5OCKQK.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-WV5OCKQK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composites/combobox-chip.tsx"],"names":["ComboboxChip","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInputGroup","cn","inputVariants","ComboboxChips","ComboboxValue","visible","overflow","Fragment","ComboboxChipRemove","ComboboxInput","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemAvatar","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"2TA+CA,SAASA,CAAAA,CAAyF,CAChG,QAAA,CAAAC,CAAAA,CAAW,KACX,gBAAA,CAAAC,GAAAA,CAAmB,WAAA,CACnB,SA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AG/C,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-O2V2JJ2V.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n ComboboxInput as ComboboxInputPrimitive,\r\n ComboboxInputGroup,\r\n} from \"../primitives/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxChip as ComboboxChipUI,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxValue,\r\n type ComboboxProps,\r\n ComboboxItemTitle,\r\n ComboboxItemAvatar\r\n} from \"../ui/combobox\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { inputVariants } from \"../ui/input\"\r\n\r\ntype ComboboxChipProps<Value extends { label: string; value: string; image?: string; tag?: true }> = Omit<ComboboxProps<Value, true>, \"multiple\" | \"items\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items?: Value[] | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChip<Value extends { label: string; value: string; image?: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipProps<Value>) {\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n const [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n return [...base, { label: trimmedInput, value: trimmedInput, tag: true } as unknown as Value]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n {/* Input box with chips inside */}\r\n <ComboboxInputGroup\r\n className={cn(\r\n inputVariants(),\r\n \"h-auto min-h-13 flex flex-wrap items-center gap-1.5 px-3 py-1.5 cursor-text\"\r\n )}\r\n >\r\n {/* Chips inside the input box */}\r\n <ComboboxChips\r\n className={cn(\r\n \"contents\",\r\n maxVisible !== undefined && \"flex-nowrap overflow-hidden\"\r\n )}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChipUI\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {item?.image && (\r\n <img\r\n src={item.image}\r\n alt={item?.label || \"\"}\r\n className=\"size-4 rounded-full object-cover shrink-0 mr-1\"\r\n />\r\n )}\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChipUI>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChipUI className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChipUI>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n {/* Text input — shrinks to fit remaining space (inside Chips so backspace works) */}\r\n <ComboboxInputPrimitive\r\n render={\r\n <input\r\n className=\"flex-1 min-w-[80px] bg-transparent outline-none text-body-regular-1 text-text-primary placeholder:text-text-placeholder\"\r\n placeholder={value.length === 0 ? inputPlaceholder : undefined}\r\n />\r\n }\r\n />\r\n </ComboboxChips>\r\n </ComboboxInputGroup>\r\n\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={item as Value}\r\n >\r\n {(item.image !== undefined) && (\r\n <ComboboxItemAvatar\r\n src={item.image}\r\n fallbackText={[item.label?.[0], item.label?.split(\" \")?.[1]?.[0]].filter(Boolean).join(\"\")}\r\n imageAlt={item.label}\r\n />\r\n )}\r\n <ComboboxItemTitle>{item.label}</ComboboxItemTitle>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary text-body-medium-3 col-start-2\">Create: {trimmedInput}</span>\r\n )}\r\n {isInputSelected && (\r\n <ComboboxItemTitle>{trimmedInput}</ComboboxItemTitle>\r\n )}\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChip }\r\nexport type { ComboboxChipProps }\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/composites/combobox-chip.tsx"],"names":["ComboboxChip","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInputGroup","cn","inputVariants","ComboboxChips","ComboboxValue","visible","overflow","Fragment","ComboboxChipRemove","ComboboxInput","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemAvatar","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"2TA+CA,SAASA,CAAAA,CAAyF,CAChG,QAAA,CAAAC,CAAAA,CAAW,KACX,gBAAA,CAAAC,GAAAA,CAAmB,WAAA,CACnB,SAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,GAAAA,CACA,cAAA,CAAAC,EACA,SAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,KAAA,CACX,UAAA,CAAAC,CAAAA,CACA,GAAGC,GACL,CAAA,CAA6B,CAC3B,GAAM,CAACC,CAAAA,CAAYC,CAAa,CAAA,CAAIC,kBAAAA,CAAmB,CACrD,KAAA,CAAOH,GAAAA,EAAO,UAAA,EAAY,QAAA,EAAS,CACnC,YAAA,CAAcA,GAAAA,EAAO,iBAAA,EAAmB,UAAS,CACjD,QAAA,CAAUA,GAAAA,EAAO,kBACnB,CAAC,CAAA,CAEK,CAACI,GAAAA,CAAOC,CAAQ,EAAIF,kBAAAA,CAAmB,CAC3C,KAAA,CAAOH,GAAAA,EAAO,KAAA,EAAS,EAAC,CACxB,YAAA,CAAcA,KAAO,YAAA,EAAgB,EAAC,CACtC,QAAA,CAAUA,GAAAA,EAAO,aACnB,CAAC,CAAA,CAIK,CAACM,CAAAA,CAAcC,CAAe,CAAA,CAAU,CAAA,CAAA,QAAA,CAAkB,EAAE,CAAA,CAC5DC,CAAAA,CAAyB,SAAoB,IAAI,GAAK,CAAA,CAEtD,CAAA,CAAA,SAAA,CAAU,IAAM,CACpB,IAAMC,CAAAA,CAAgB,IAAI,GAAA,CAAIL,GAAAA,CAAM,GAAA,CAAKM,CAAAA,EAAMA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A,CAAO1B,CAAAA,CAAc,KAAA,CAAOA,EAAc,GAAA,CAAK,IAAK,CAAA,CAE5D,QAAA,CAAA,CAAA,CAACC,CAAAA,EACAI,IAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,qDAAqD,QAAA,CAAA,CAAA,UAAA,CAASL,CAAAA,CAAAA,CAAa,CAAA,CAE5FC,CAAAA,EACCW,GAAAA,CAACgB,CAAAA,CAAA,CAAmB,QAAA,CAAA5B,EAAa,CAAA,CAAA,CAErC,CAAA,CAEFY,GAAAA,CAACiB,CAAAA,CAAA,CAAwB,GAAG/C,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-WV5OCKQK.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n ComboboxInput as ComboboxInputPrimitive,\r\n ComboboxInputGroup,\r\n} from \"../primitives/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxChip as ComboboxChipUI,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxValue,\r\n type ComboboxProps,\r\n ComboboxItemTitle,\r\n ComboboxItemAvatar\r\n} from \"../ui/combobox\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { inputVariants } from \"../ui/input\"\r\n\r\ntype ComboboxChipProps<Value extends { label: string; value: string; image?: string; tag?: true }> = Omit<ComboboxProps<Value, true>, \"multiple\" | \"items\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items?: Value[] | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChip<Value extends { label: string; value: string; image?: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipProps<Value>) {\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n const [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n return [...base, { label: trimmedInput, value: trimmedInput, tag: true } as unknown as Value]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n {/* Input box with chips inside */}\r\n <ComboboxInputGroup\r\n className={cn(\r\n inputVariants(),\r\n \"h-auto min-h-13 flex flex-wrap items-center gap-1.5 px-3 py-1.5 cursor-text\"\r\n )}\r\n >\r\n {/* Chips inside the input box */}\r\n <ComboboxChips\r\n className={cn(\r\n \"contents\",\r\n maxVisible !== undefined && \"flex-nowrap overflow-hidden\"\r\n )}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChipUI\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {item?.image && (\r\n <img\r\n src={item.image}\r\n alt={item?.label || \"\"}\r\n className=\"size-4 rounded-full object-cover shrink-0 mr-1\"\r\n />\r\n )}\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChipUI>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChipUI className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChipUI>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n {/* Text input — shrinks to fit remaining space (inside Chips so backspace works) */}\r\n <ComboboxInputPrimitive\r\n render={\r\n <input\r\n className=\"flex-1 min-w-[80px] bg-transparent outline-none text-body-regular-1 text-text-primary placeholder:text-text-placeholder\"\r\n placeholder={value.length === 0 ? inputPlaceholder : undefined}\r\n />\r\n }\r\n />\r\n </ComboboxChips>\r\n </ComboboxInputGroup>\r\n\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={item as Value}\r\n >\r\n {(item.image !== undefined) && (\r\n <ComboboxItemAvatar\r\n src={item.image}\r\n fallbackText={[item.label?.[0], item.label?.split(\" \")?.[1]?.[0]].filter(Boolean).join(\"\")}\r\n imageAlt={item.label}\r\n />\r\n )}\r\n <ComboboxItemTitle>{item.label}</ComboboxItemTitle>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary text-body-medium-3 col-start-2\">Create: {trimmedInput}</span>\r\n )}\r\n {isInputSelected && (\r\n <ComboboxItemTitle>{trimmedInput}</ComboboxItemTitle>\r\n )}\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChip }\r\nexport type { ComboboxChipProps }\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1,b,m,e,q,s,w}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a as a$1,b,m,e,q,s,w}from'./chunk-IZQFTYJD.js';import {a}from'./chunk-JH6RZ3QH.js';import*as t from'react';import*as C from'react-phone-number-input';import Y from'react-phone-number-input/flags';import {cn}from'@xploreu/lib/cn';import'@base-ui/react/combobox';import {ChevronsUpDownIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var R=({country:l,countryName:o})=>{let s=l?Y[l]:void 0;return jsx("span",{className:"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full",children:s&&jsx(s,{title:o})})},d=44,k=288,H=6;function D({disabled:l,value:o,options:s$1,onChange:i}){let[c,r]=t.useState(false),[b$1,g]=t.useState(""),[y,N]=t.useState(0),v=t.useRef(null),m$1=t.useMemo(()=>s$1.filter(e=>!!e.value),[s$1]),u=t.useMemo(()=>{let e=b$1.trim().toLowerCase();return e?m$1.filter(a=>{let f=C.getCountryCallingCode(a.value);return a.label.toLowerCase().includes(e)||a.value.toLowerCase().includes(e)||f.includes(e.replace(/^\+/,""))}):m$1},[b$1,m$1]),_=t.useMemo(()=>m$1.find(e=>e.value===o)??null,[m$1,o]);t.useEffect(()=>{N(0),v.current&&(v.current.scrollTop=0);},[b$1]);let z=Math.min(u.length*d,k),h=t.useMemo(()=>{let e=Math.floor(y/d),a=Math.max(0,e-H),f=Math.ceil(k/d),P=Math.min(u.length,e+f+H);return {startIndex:a,endIndex:P,items:u.slice(a,P)}},[u,y]),F=h.startIndex*d,U=Math.max(0,(u.length-h.endIndex)*d),q$1=t.useCallback(e=>{e?.value&&(i(e.value),g(""),r(false));},[i]);return jsxs(a$1,{behavior:"default",disabled:l,inputValue:b$1,items:u,open:c,value:_,virtualized:true,filter:null,isItemEqualToValue:(e,a)=>e.value===a.value,openOnInputClick:false,onValueChange:q$1,onInputValueChange:g,onOpenChange:e=>{r(e),e||g("");},children:[jsx(b,{render:jsxs("button",{type:"button",className:cn(a(),"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3","hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand","disabled:pointer-events-none disabled:opacity-50"),disabled:l,children:[jsxs("span",{className:"flex items-center gap-1.5 overflow-hidden",children:[jsx(R,{country:o,countryName:o}),o&&jsx("span",{className:"text-body-medium-3 text-text-primary",children:o})]}),jsx(ChevronsUpDownIcon,{className:"size-3.5 shrink-0 text-fg-quaternary"})]})}),jsxs(m,{className:"w-72",children:[jsx(e,{placeholder:"Search country...","aria-label":"Search country"}),jsx(q,{status:u.length===0?"empty":null}),jsx(s,{ref:v,className:"relative gap-0",style:{height:z},onScroll:e=>N(e.currentTarget.scrollTop),children:jsx("div",{className:"flex w-full shrink-0 flex-col",style:{paddingTop:F,paddingBottom:U},children:h.items.map((e,a)=>{let f=h.startIndex+a;return jsx(w,{index:f,value:e,children:jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[jsx(R,{country:e.value,countryName:e.label}),jsx("span",{className:"flex-1 text-sm truncate",children:e.label}),jsxs("span",{className:"text-sm text-text-tertiary shrink-0",children:["+",C.getCountryCallingCode(e.value)]})]})},e.value)})})})]})]})}var L=t.forwardRef(({className:l,onChange:o,...s},i)=>{let c=t.useCallback(r=>{r.currentTarget.value==="+"&&(r.currentTarget.value=""),o?.(r);},[o]);return jsx("input",{className:cn(a(),"h-11 flex-1 rounded-l-none text-body-regular-2",l),ref:i,type:"tel",onChange:c,...s})});L.displayName="InputComponent";var G=t.forwardRef(({className:l,onChange:o,value:s,...i},c)=>jsx(C.default,{ref:c,className:cn("flex w-full min-w-0 items-center",l),flagComponent:R,countrySelectComponent:D,inputComponent:L,smartCaret:false,value:s||void 0,onChange:r=>o?.(r||""),...i}));G.displayName="PhoneInput";export{G as a};//# sourceMappingURL=chunk-YB74L6RO.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-YB74L6RO.js.map
|