@nswds/ui 5.4.0 → 5.5.0
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/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +80 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/avatar.d.ts +13 -0
- package/dist/components/avatar.js +92 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +94 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button-group.d.ts +15 -0
- package/dist/components/button-group.js +77 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/carousel.d.ts +34 -0
- package/dist/components/carousel.js +186 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/checkbox.d.ts +6 -0
- package/dist/components/checkbox.js +31 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/combobox.d.ts +26 -0
- package/dist/components/combobox.js +242 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/direction.d.ts +1 -0
- package/dist/components/direction.js +4 -0
- package/dist/components/direction.js.map +1 -0
- package/dist/components/input-group.d.ts +23 -0
- package/dist/components/input-group.js +136 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input-otp.d.ts +13 -0
- package/dist/components/input-otp.js +79 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +30 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/native-select.d.ts +10 -0
- package/dist/components/native-select.js +60 -0
- package/dist/components/native-select.js.map +1 -0
- package/dist/components/pagination.d.ts +23 -0
- package/dist/components/pagination.js +112 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +67 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.js +41 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/select.d.ts +17 -0
- package/dist/components/select.js +177 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/slider.d.ts +2 -82
- package/dist/components/slider.js +39 -106
- package/dist/components/slider.js.map +1 -1
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +34 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +87 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +14 -0
- package/dist/components/tabs.js +76 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +73 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +12 -0
- package/dist/components/toggle.js +45 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +22 -0
- package/dist/styles.css +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/carousel.tsx"],"names":["api"],"mappings":";;;;;;;;AA+BA,MAAM,eAAA,GAAkB,KAAA,CAAM,aAAA,CAA2C,IAAI,CAAA;AAE7E,SAAS,WAAA,GAAc;AACrB,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,UAAA,CAAW,eAAe,CAAA;AAEhD,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,gDAAgD,CAAA;AAAA,EAClE;AAEA,EAAA,OAAO,OAAA;AACT;AAEA,SAAS,QAAA,CAAS;AAAA,EAChB,WAAA,GAAc,YAAA;AAAA,EACd,IAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAgD;AAC9C,EAAA,MAAM,CAAC,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KAAgB,eACZ,6BAAA,GACA,kEAAA;AAAA,QACJ;AAAA,OACF;AAAA,MACA,UAAU,CAAC,aAAA;AAAA,MACX,OAAA,EAAS,UAAA;AAAA,MACR,GAAG,KAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,WAAU,gBAAA,EAAiB,CAAA;AAAA,wBAC5C,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA,gBAAA,EAAc;AAAA;AAAA;AAAA,GAC1C;AAEJ;AAEA,SAAS,YAAA,CAAa;AAAA,EACpB,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,IAAA,GAAO,MAAA;AAAA,EACP,GAAG;AACL,CAAA,EAAwC;AACtC,EAAA,MAAM,EAAE,WAAA,EAAa,UAAA,EAAY,aAAA,KAAkB,WAAA,EAAY;AAE/D,EAAA,uBACE,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,OAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,0CAAA;AAAA,QACA,WAAA,KAAgB,eACZ,2BAAA,GACA,qEAAA;AAAA,QACJ;AAAA,OACF;AAAA,MACA,UAAU,CAAC,aAAA;AAAA,MACX,OAAA,EAAS,UAAA;AAAA,MACR,GAAG,KAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,gBAAA,EAAA,EAAiB,WAAU,gBAAA,EAAiB,CAAA;AAAA,wBAC7C,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA,YAAA,EAAU;AAAA;AAAA;AAAA,GACtC;AAEJ","file":"carousel.js","sourcesContent":["'use client'\n\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react'\nimport * as React from 'react'\n\nimport { IconChevronLeft } from '../icons/chevron-left.js'\nimport { IconChevronRight } from '../icons/chevron-right.js'\nimport { cn } from '../lib/utils.js'\nimport { Button } from './button.js'\n\ntype CarouselApi = UseEmblaCarouselType[1]\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>\ntype CarouselOptions = UseCarouselParameters[0]\ntype CarouselPlugin = UseCarouselParameters[1]\n\ntype CarouselProps = {\n opts?: CarouselOptions\n plugins?: CarouselPlugin\n orientation?: 'horizontal' | 'vertical'\n setApi?: (api: CarouselApi) => void\n}\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0]\n api: ReturnType<typeof useEmblaCarousel>[1]\n scrollPrev: () => void\n scrollNext: () => void\n canScrollPrev: boolean\n canScrollNext: boolean\n} & CarouselProps\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null)\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext)\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />')\n }\n\n return context\n}\n\nfunction Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<'div'> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n )\n const [canScrollPrev, setCanScrollPrev] = React.useState(false)\n const [canScrollNext, setCanScrollNext] = React.useState(false)\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return\n setCanScrollPrev(api.canScrollPrev())\n setCanScrollNext(api.canScrollNext())\n }, [])\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev()\n }, [api])\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext()\n }, [api])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault()\n scrollPrev()\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n scrollNext()\n }\n },\n [scrollPrev, scrollNext],\n )\n\n React.useEffect(() => {\n if (!api || !setApi) return\n setApi(api)\n }, [api, setApi])\n\n React.useEffect(() => {\n if (!api) return\n // Seed the button state from Embla on mount: the api only exists after\n // Embla has initialised (so its 'init'/'reInit' event has already fired\n // before we subscribe below), and without this the \"next\" control would\n // stay disabled until the first scroll. The one extra render is intended.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n onSelect(api)\n api.on('reInit', onSelect)\n api.on('select', onSelect)\n\n return () => {\n api?.off('select', onSelect)\n }\n }, [api, onSelect])\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role='region'\n aria-roledescription='carousel'\n data-slot='carousel'\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n )\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {\n const { carouselRef, orientation } = useCarousel()\n\n return (\n <div ref={carouselRef} className='overflow-hidden' data-slot='carousel-content'>\n <div\n className={cn('flex', orientation === 'horizontal' ? '-ms-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n )\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {\n const { orientation } = useCarousel()\n\n return (\n <div\n role='group'\n aria-roledescription='slide'\n data-slot='carousel-item'\n className={cn(\n 'min-w-0 shrink-0 grow-0 basis-full',\n orientation === 'horizontal' ? 'ps-4' : 'pt-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction CarouselPrevious({\n className,\n variant = 'outline',\n size = 'icon',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel()\n\n return (\n <Button\n data-slot='carousel-previous'\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -start-12 my-auto'\n : 'start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <IconChevronLeft className='rtl:rotate-180' />\n <span className='sr-only'>Previous slide</span>\n </Button>\n )\n}\n\nfunction CarouselNext({\n className,\n variant = 'outline',\n size = 'icon',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel()\n\n return (\n <Button\n data-slot='carousel-next'\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -end-12 my-auto'\n : 'start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <IconChevronRight className='rtl:rotate-180' />\n <span className='sr-only'>Next slide</span>\n </Button>\n )\n}\n\nexport {\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselNext,\n CarouselPrevious,\n useCarousel,\n type CarouselApi,\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
4
|
+
import { IconCheck } from '../icons/check.js';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
|
|
7
|
+
function Checkbox({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Checkbox$1.Root,
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "checkbox",
|
|
12
|
+
className: cn(
|
|
13
|
+
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",
|
|
14
|
+
className
|
|
15
|
+
),
|
|
16
|
+
...props,
|
|
17
|
+
children: /* @__PURE__ */ jsx(
|
|
18
|
+
Checkbox$1.Indicator,
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "checkbox-indicator",
|
|
21
|
+
className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
22
|
+
children: /* @__PURE__ */ jsx(IconCheck, {})
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { Checkbox };
|
|
30
|
+
//# sourceMappingURL=checkbox.js.map
|
|
31
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/checkbox.tsx"],"names":["CheckboxPrimitive"],"mappings":";;;;;AAOA,SAAS,QAAA,CAAS,EAAE,SAAA,EAAW,GAAG,OAAM,EAAiC;AACvE,EAAA,uBACE,GAAA;AAAA,IAACA,UAAA,CAAkB,IAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,UAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,y1BAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA;AAAA,QAACA,UAAA,CAAkB,SAAA;AAAA,QAAlB;AAAA,UACC,WAAA,EAAU,oBAAA;AAAA,UACV,SAAA,EAAU,yEAAA;AAAA,UAEV,8BAAC,SAAA,EAAA,EAAU;AAAA;AAAA;AACb;AAAA,GACF;AAEJ","file":"checkbox.js","sourcesContent":["'use client'\n\nimport { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox'\n\nimport { IconCheck } from '../icons/check.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {\n return (\n <CheckboxPrimitive.Root\n data-slot='checkbox'\n className={cn(\n 'peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot='checkbox-indicator'\n className='grid place-content-center text-current transition-none [&>svg]:size-3.5'\n >\n <IconCheck />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n}\n\nexport { Checkbox }\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Combobox as Combobox$1 } from '@base-ui/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const Combobox: typeof Combobox$1.Root;
|
|
5
|
+
declare function ComboboxValue({ ...props }: Combobox$1.Value.Props): React.JSX.Element;
|
|
6
|
+
declare function ComboboxTrigger({ className, children, ...props }: Combobox$1.Trigger.Props): React.JSX.Element;
|
|
7
|
+
declare function ComboboxInput({ className, children, disabled, showTrigger, showClear, ...props }: Combobox$1.Input.Props & {
|
|
8
|
+
showTrigger?: boolean;
|
|
9
|
+
showClear?: boolean;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, ...props }: Combobox$1.Popup.Props & Pick<Combobox$1.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'>): React.JSX.Element;
|
|
12
|
+
declare function ComboboxList({ className, ...props }: Combobox$1.List.Props): React.JSX.Element;
|
|
13
|
+
declare function ComboboxItem({ className, children, ...props }: Combobox$1.Item.Props): React.JSX.Element;
|
|
14
|
+
declare function ComboboxGroup({ className, ...props }: Combobox$1.Group.Props): React.JSX.Element;
|
|
15
|
+
declare function ComboboxLabel({ className, ...props }: Combobox$1.GroupLabel.Props): React.JSX.Element;
|
|
16
|
+
declare function ComboboxCollection({ ...props }: Combobox$1.Collection.Props): React.JSX.Element;
|
|
17
|
+
declare function ComboboxEmpty({ className, ...props }: Combobox$1.Empty.Props): React.JSX.Element;
|
|
18
|
+
declare function ComboboxSeparator({ className, ...props }: Combobox$1.Separator.Props): React.JSX.Element;
|
|
19
|
+
declare function ComboboxChips({ className, ...props }: React.ComponentPropsWithRef<typeof Combobox$1.Chips> & Combobox$1.Chips.Props): React.JSX.Element;
|
|
20
|
+
declare function ComboboxChip({ className, children, showRemove, ...props }: Combobox$1.Chip.Props & {
|
|
21
|
+
showRemove?: boolean;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
declare function ComboboxChipsInput({ className, ...props }: Combobox$1.Input.Props): React.JSX.Element;
|
|
24
|
+
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement | null>;
|
|
25
|
+
|
|
26
|
+
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Combobox as Combobox$1 } from '@base-ui/react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { IconCheck } from '../icons/check.js';
|
|
6
|
+
import { IconClose } from '../icons/close.js';
|
|
7
|
+
import { IconExpandMore } from '../icons/expand-more.js';
|
|
8
|
+
import { cn } from '../lib/utils.js';
|
|
9
|
+
import { Button } from './button.js';
|
|
10
|
+
import { InputGroup, InputGroupInput, InputGroupAddon, InputGroupButton } from './input-group.js';
|
|
11
|
+
|
|
12
|
+
const Combobox = Combobox$1.Root;
|
|
13
|
+
function ComboboxValue({ ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(Combobox$1.Value, { "data-slot": "combobox-value", ...props });
|
|
15
|
+
}
|
|
16
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(
|
|
18
|
+
Combobox$1.Trigger,
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "combobox-trigger",
|
|
21
|
+
"aria-label": "Show suggestions",
|
|
22
|
+
className: cn("[&_svg:not([class*='size-'])]:size-3.5", className),
|
|
23
|
+
...props,
|
|
24
|
+
children: [
|
|
25
|
+
children,
|
|
26
|
+
/* @__PURE__ */ jsx(IconExpandMore, { className: "pointer-events-none size-3.5 text-muted-foreground" })
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function ComboboxClear({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
Combobox$1.Clear,
|
|
34
|
+
{
|
|
35
|
+
"data-slot": "combobox-clear",
|
|
36
|
+
"aria-label": "Clear",
|
|
37
|
+
render: /* @__PURE__ */ jsx(InputGroupButton, { variant: "ghost", size: "icon-xs" }),
|
|
38
|
+
className: cn(className),
|
|
39
|
+
...props,
|
|
40
|
+
children: /* @__PURE__ */ jsx(IconClose, { className: "pointer-events-none" })
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function ComboboxInput({
|
|
45
|
+
className,
|
|
46
|
+
children,
|
|
47
|
+
disabled = false,
|
|
48
|
+
showTrigger = true,
|
|
49
|
+
showClear = false,
|
|
50
|
+
...props
|
|
51
|
+
}) {
|
|
52
|
+
return /* @__PURE__ */ jsxs(InputGroup, { className: cn("w-auto", className), children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Combobox$1.Input, { render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }), ...props }),
|
|
54
|
+
/* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
55
|
+
showTrigger && /* @__PURE__ */ jsx(
|
|
56
|
+
InputGroupButton,
|
|
57
|
+
{
|
|
58
|
+
size: "icon-xs",
|
|
59
|
+
variant: "ghost",
|
|
60
|
+
render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
|
|
61
|
+
"data-slot": "input-group-button",
|
|
62
|
+
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
|
|
63
|
+
disabled
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })
|
|
67
|
+
] }),
|
|
68
|
+
children
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
function ComboboxContent({
|
|
72
|
+
className,
|
|
73
|
+
side = "bottom",
|
|
74
|
+
sideOffset = 6,
|
|
75
|
+
align = "start",
|
|
76
|
+
alignOffset = 0,
|
|
77
|
+
anchor,
|
|
78
|
+
...props
|
|
79
|
+
}) {
|
|
80
|
+
return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
81
|
+
Combobox$1.Positioner,
|
|
82
|
+
{
|
|
83
|
+
side,
|
|
84
|
+
sideOffset,
|
|
85
|
+
align,
|
|
86
|
+
alignOffset,
|
|
87
|
+
anchor,
|
|
88
|
+
className: "isolate z-50",
|
|
89
|
+
children: /* @__PURE__ */ jsx(
|
|
90
|
+
Combobox$1.Popup,
|
|
91
|
+
{
|
|
92
|
+
"data-slot": "combobox-content",
|
|
93
|
+
"data-chips": !!anchor,
|
|
94
|
+
className: cn(
|
|
95
|
+
"group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:bg-input/20 *:data-[slot=input-group]:shadow-none dark:bg-popover data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
96
|
+
className
|
|
97
|
+
),
|
|
98
|
+
...props
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
) });
|
|
103
|
+
}
|
|
104
|
+
function ComboboxList({ className, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
Combobox$1.List,
|
|
107
|
+
{
|
|
108
|
+
"data-slot": "combobox-list",
|
|
109
|
+
className: cn(
|
|
110
|
+
"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",
|
|
111
|
+
className
|
|
112
|
+
),
|
|
113
|
+
...props
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
118
|
+
return /* @__PURE__ */ jsxs(
|
|
119
|
+
Combobox$1.Item,
|
|
120
|
+
{
|
|
121
|
+
"data-slot": "combobox-item",
|
|
122
|
+
className: cn(
|
|
123
|
+
"relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
124
|
+
className
|
|
125
|
+
),
|
|
126
|
+
...props,
|
|
127
|
+
children: [
|
|
128
|
+
children,
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
Combobox$1.ItemIndicator,
|
|
131
|
+
{
|
|
132
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute end-2 flex items-center justify-center" }),
|
|
133
|
+
children: /* @__PURE__ */ jsx(IconCheck, { className: "pointer-events-none" })
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function ComboboxGroup({ className, ...props }) {
|
|
141
|
+
return /* @__PURE__ */ jsx(Combobox$1.Group, { "data-slot": "combobox-group", className: cn(className), ...props });
|
|
142
|
+
}
|
|
143
|
+
function ComboboxLabel({ className, ...props }) {
|
|
144
|
+
return /* @__PURE__ */ jsx(
|
|
145
|
+
Combobox$1.GroupLabel,
|
|
146
|
+
{
|
|
147
|
+
"data-slot": "combobox-label",
|
|
148
|
+
className: cn("px-2 py-1.5 text-xs text-muted-foreground", className),
|
|
149
|
+
...props
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function ComboboxCollection({ ...props }) {
|
|
154
|
+
return /* @__PURE__ */ jsx(Combobox$1.Collection, { "data-slot": "combobox-collection", ...props });
|
|
155
|
+
}
|
|
156
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
157
|
+
return /* @__PURE__ */ jsx(
|
|
158
|
+
Combobox$1.Empty,
|
|
159
|
+
{
|
|
160
|
+
"data-slot": "combobox-empty",
|
|
161
|
+
className: cn(
|
|
162
|
+
"hidden w-full justify-center py-2 text-center text-xs/relaxed text-muted-foreground group-data-empty/combobox-content:flex",
|
|
163
|
+
className
|
|
164
|
+
),
|
|
165
|
+
...props
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
170
|
+
return /* @__PURE__ */ jsx(
|
|
171
|
+
Combobox$1.Separator,
|
|
172
|
+
{
|
|
173
|
+
"data-slot": "combobox-separator",
|
|
174
|
+
className: cn("-mx-1 my-1 h-px bg-border/50", className),
|
|
175
|
+
...props
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function ComboboxChips({
|
|
180
|
+
className,
|
|
181
|
+
...props
|
|
182
|
+
}) {
|
|
183
|
+
return /* @__PURE__ */ jsx(
|
|
184
|
+
Combobox$1.Chips,
|
|
185
|
+
{
|
|
186
|
+
"data-slot": "combobox-chips",
|
|
187
|
+
className: cn(
|
|
188
|
+
"flex min-h-7 flex-wrap items-center gap-1 rounded-md border border-input bg-input/20 bg-clip-padding px-2 py-0.5 text-xs/relaxed transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30 has-aria-invalid:border-destructive has-aria-invalid:ring-2 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40",
|
|
189
|
+
className
|
|
190
|
+
),
|
|
191
|
+
...props
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
function ComboboxChip({
|
|
196
|
+
className,
|
|
197
|
+
children,
|
|
198
|
+
showRemove = true,
|
|
199
|
+
...props
|
|
200
|
+
}) {
|
|
201
|
+
return /* @__PURE__ */ jsxs(
|
|
202
|
+
Combobox$1.Chip,
|
|
203
|
+
{
|
|
204
|
+
"data-slot": "combobox-chip",
|
|
205
|
+
className: cn(
|
|
206
|
+
"flex h-[calc(--spacing(4.75))] w-fit items-center justify-center gap-1 rounded-[calc(var(--radius-sm)-2px)] bg-muted-foreground/10 px-1.5 text-xs/relaxed font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0",
|
|
207
|
+
className
|
|
208
|
+
),
|
|
209
|
+
...props,
|
|
210
|
+
children: [
|
|
211
|
+
children,
|
|
212
|
+
showRemove && /* @__PURE__ */ jsx(
|
|
213
|
+
Combobox$1.ChipRemove,
|
|
214
|
+
{
|
|
215
|
+
render: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon" }),
|
|
216
|
+
"aria-label": "Remove",
|
|
217
|
+
className: "-ms-1 opacity-50 hover:opacity-100",
|
|
218
|
+
"data-slot": "combobox-chip-remove",
|
|
219
|
+
children: /* @__PURE__ */ jsx(IconClose, { className: "pointer-events-none" })
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
function ComboboxChipsInput({ className, ...props }) {
|
|
227
|
+
return /* @__PURE__ */ jsx(
|
|
228
|
+
Combobox$1.Input,
|
|
229
|
+
{
|
|
230
|
+
"data-slot": "combobox-chip-input",
|
|
231
|
+
className: cn("min-w-16 flex-1 outline-none", className),
|
|
232
|
+
...props
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
function useComboboxAnchor() {
|
|
237
|
+
return React.useRef(null);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor };
|
|
241
|
+
//# sourceMappingURL=combobox.js.map
|
|
242
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/combobox.tsx"],"names":["ComboboxPrimitive"],"mappings":";;;;;;;;;;AAYA,MAAM,WAAWA,UAAA,CAAkB;AAEnC,SAAS,aAAA,CAAc,EAAE,GAAG,KAAA,EAAM,EAAkC;AAClE,EAAA,2BAAQA,UAAA,CAAkB,KAAA,EAAlB,EAAwB,WAAA,EAAU,gBAAA,EAAkB,GAAG,KAAA,EAAO,CAAA;AACxE;AAEA,SAAS,gBAAgB,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,OAAM,EAAoC;AAC3F,EAAA,uBACE,IAAA;AAAA,IAACA,UAAA,CAAkB,OAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,kBAAA;AAAA,MACV,YAAA,EAAW,kBAAA;AAAA,MACX,SAAA,EAAW,EAAA,CAAG,wCAAA,EAA0C,SAAS,CAAA;AAAA,MAChE,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBACD,GAAA,CAAC,cAAA,EAAA,EAAe,SAAA,EAAU,oDAAA,EAAqD;AAAA;AAAA;AAAA,GACjF;AAEJ;AAEA,SAAS,aAAA,CAAc,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAC7E,EAAA,uBACE,GAAA;AAAA,IAACA,UAAA,CAAkB,KAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,gBAAA;AAAA,MACV,YAAA,EAAW,OAAA;AAAA,MACX,wBAAQ,GAAA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAQ,OAAA,EAAQ,MAAK,SAAA,EAAU,CAAA;AAAA,MACzD,SAAA,EAAW,GAAG,SAAS,CAAA;AAAA,MACtB,GA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IAAlB;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,8BAAA,EAAgC,SAAS,CAAA;AAAA,MACtD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,iBAAA,GAAoB;AAC3B,EAAA,OAAO,KAAA,CAAM,OAA8B,IAAI,CAAA;AACjD","file":"combobox.js","sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconClose } from '../icons/close.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { cn } from '../lib/utils.js'\nimport { Button } from './button.js'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group.js'\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot='combobox-value' {...props} />\n}\n\nfunction ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot='combobox-trigger'\n aria-label='Show suggestions'\n className={cn(\"[&_svg:not([class*='size-'])]:size-3.5\", className)}\n {...props}\n >\n {children}\n <IconExpandMore className='pointer-events-none size-3.5 text-muted-foreground' />\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {\n return (\n <ComboboxPrimitive.Clear\n data-slot='combobox-clear'\n aria-label='Clear'\n render={<InputGroupButton variant='ghost' size='icon-xs' />}\n className={cn(className)}\n {...props}\n >\n <IconClose className='pointer-events-none' />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n}: ComboboxPrimitive.Input.Props & {\n showTrigger?: boolean\n showClear?: boolean\n}) {\n return (\n <InputGroup className={cn('w-auto', className)}>\n <ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align='inline-end'>\n {showTrigger && (\n <InputGroupButton\n size='icon-xs'\n variant='ghost'\n render={<ComboboxTrigger />}\n data-slot='input-group-button'\n className='group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent'\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'\n >) {\n return (\n <ComboboxPrimitive.Portal>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className='isolate z-50'\n >\n <ComboboxPrimitive.Popup\n data-slot='combobox-content'\n data-chips={!!anchor}\n className={cn(\n 'group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:bg-input/20 *:data-[slot=input-group]:shadow-none dark:bg-popover data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n return (\n <ComboboxPrimitive.List\n data-slot='combobox-list'\n className={cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) {\n return (\n <ComboboxPrimitive.Item\n data-slot='combobox-item'\n className={cn(\n \"relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return <ComboboxPrimitive.Group data-slot='combobox-group' className={cn(className)} {...props} />\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot='combobox-label'\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection data-slot='combobox-collection' {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n data-slot='combobox-empty'\n className={cn(\n 'hidden w-full justify-center py-2 text-center text-xs/relaxed text-muted-foreground group-data-empty/combobox-content:flex',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot='combobox-separator'\n className={cn('-mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({\n className,\n ...props\n}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props) {\n return (\n <ComboboxPrimitive.Chips\n data-slot='combobox-chips'\n className={cn(\n 'flex min-h-7 flex-wrap items-center gap-1 rounded-md border border-input bg-input/20 bg-clip-padding px-2 py-0.5 text-xs/relaxed transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30 has-aria-invalid:border-destructive has-aria-invalid:ring-2 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot='combobox-chip'\n className={cn(\n 'flex h-[calc(--spacing(4.75))] w-fit items-center justify-center gap-1 rounded-[calc(var(--radius-sm)-2px)] bg-muted-foreground/10 px-1.5 text-xs/relaxed font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0',\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant='ghost' size='icon' />}\n aria-label='Remove'\n className='-ms-1 opacity-50 hover:opacity-100'\n data-slot='combobox-chip-remove'\n >\n <IconClose className='pointer-events-none' />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n data-slot='combobox-chip-input'\n className={cn('min-w-16 flex-1 outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DirectionProvider, useDirection } from '@base-ui/react/direction-provider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"direction.js","sourcesContent":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Button } from './button.js';
|
|
5
|
+
import '@base-ui/react/button';
|
|
6
|
+
import './link.js';
|
|
7
|
+
|
|
8
|
+
declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
9
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
10
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
13
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
14
|
+
size?: "sm" | "xs" | "icon-xs" | "icon-sm" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, 'size' | 'type'> & VariantProps<typeof inputGroupButtonVariants> & {
|
|
17
|
+
type?: 'button' | 'submit' | 'reset';
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
declare function InputGroupText({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
20
|
+
declare function InputGroupInput({ className, ...props }: React.ComponentProps<'input'>): React.JSX.Element;
|
|
21
|
+
declare function InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>): React.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../lib/utils.js';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
import { Input } from './input.js';
|
|
7
|
+
import { Textarea } from './textarea.js';
|
|
8
|
+
|
|
9
|
+
function InputGroup({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "input-group",
|
|
14
|
+
role: "group",
|
|
15
|
+
className: cn(
|
|
16
|
+
"group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pe-1.5 has-[>[data-align=inline-start]]:[&>input]:ps-1.5",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
const inputGroupAddonVariants = cva(
|
|
24
|
+
"flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5",
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
align: {
|
|
28
|
+
"inline-start": "order-first ps-2 has-[>button]:ms-[-0.275rem] has-[>kbd]:ms-[-0.275rem]",
|
|
29
|
+
"inline-end": "order-last pe-2 has-[>button]:me-[-0.275rem] has-[>kbd]:me-[-0.275rem]",
|
|
30
|
+
"block-start": "order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
31
|
+
"block-end": "order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
align: "inline-start"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
function InputGroupAddon({
|
|
40
|
+
className,
|
|
41
|
+
align = "inline-start",
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
role: "group",
|
|
48
|
+
"data-slot": "input-group-addon",
|
|
49
|
+
"data-align": align,
|
|
50
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
51
|
+
onClick: (e) => {
|
|
52
|
+
if (e.target.closest("button")) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
56
|
+
},
|
|
57
|
+
...props
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const inputGroupButtonVariants = cva(
|
|
62
|
+
"flex items-center gap-2 rounded-md text-xs/relaxed shadow-none",
|
|
63
|
+
{
|
|
64
|
+
variants: {
|
|
65
|
+
size: {
|
|
66
|
+
xs: "h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",
|
|
67
|
+
sm: "gap-1",
|
|
68
|
+
"icon-xs": "size-6 p-0 has-[>svg]:p-0",
|
|
69
|
+
"icon-sm": "size-7 p-0 has-[>svg]:p-0"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
defaultVariants: {
|
|
73
|
+
size: "xs"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
function InputGroupButton({
|
|
78
|
+
className,
|
|
79
|
+
type = "button",
|
|
80
|
+
variant = "ghost",
|
|
81
|
+
size = "xs",
|
|
82
|
+
...props
|
|
83
|
+
}) {
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
Button,
|
|
86
|
+
{
|
|
87
|
+
type,
|
|
88
|
+
"data-size": size,
|
|
89
|
+
variant,
|
|
90
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
91
|
+
...props
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function InputGroupText({ className, ...props }) {
|
|
96
|
+
return /* @__PURE__ */ jsx(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: cn(
|
|
100
|
+
"flex items-center gap-2 text-xs/relaxed text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
101
|
+
className
|
|
102
|
+
),
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function InputGroupInput({ className, ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
Input,
|
|
110
|
+
{
|
|
111
|
+
"data-slot": "input-group-control",
|
|
112
|
+
className: cn(
|
|
113
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
114
|
+
className
|
|
115
|
+
),
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
Textarea,
|
|
123
|
+
{
|
|
124
|
+
"data-slot": "input-group-control",
|
|
125
|
+
className: cn(
|
|
126
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
127
|
+
className
|
|
128
|
+
),
|
|
129
|
+
...props
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
135
|
+
//# sourceMappingURL=input-group.js.map
|
|
136
|
+
//# sourceMappingURL=input-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/input-group.tsx"],"names":[],"mappings":";;;;;;;AAUA,SAAS,UAAA,C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A,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,8IAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"input-group.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\nimport { Button } from './button.js'\nimport { Input } from './input.js'\nimport { Textarea } from './textarea.js'\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='input-group'\n role='group'\n className={cn(\n 'group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pe-1.5 has-[>[data-align=inline-start]]:[&>input]:ps-1.5',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5\",\n {\n variants: {\n align: {\n 'inline-start': 'order-first ps-2 has-[>button]:ms-[-0.275rem] has-[>kbd]:ms-[-0.275rem]',\n 'inline-end': 'order-last pe-2 has-[>button]:me-[-0.275rem] has-[>kbd]:me-[-0.275rem]',\n 'block-start':\n 'order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',\n 'block-end':\n 'order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',\n },\n },\n defaultVariants: {\n align: 'inline-start',\n },\n },\n)\n\nfunction InputGroupAddon({\n className,\n align = 'inline-start',\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role='group'\n data-slot='input-group-addon'\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest('button')) {\n return\n }\n e.currentTarget.parentElement?.querySelector('input')?.focus()\n }}\n {...props}\n />\n )\n}\n\nconst inputGroupButtonVariants = cva(\n 'flex items-center gap-2 rounded-md text-xs/relaxed shadow-none',\n {\n variants: {\n size: {\n xs: \"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3\",\n sm: 'gap-1',\n 'icon-xs': 'size-6 p-0 has-[>svg]:p-0',\n 'icon-sm': 'size-7 p-0 has-[>svg]:p-0',\n },\n },\n defaultVariants: {\n size: 'xs',\n },\n },\n)\n\nfunction InputGroupButton({\n className,\n type = 'button',\n variant = 'ghost',\n size = 'xs',\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'size' | 'type'> &\n VariantProps<typeof inputGroupButtonVariants> & {\n type?: 'button' | 'submit' | 'reset'\n }) {\n return (\n <Button\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n className={cn(\n \"flex items-center gap-2 text-xs/relaxed text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupInput({ className, ...props }: React.ComponentProps<'input'>) {\n return (\n <Input\n data-slot='input-group-control'\n className={cn(\n 'flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n return (\n <Textarea\n data-slot='input-group-control'\n className={cn(\n 'flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n InputGroupText,\n InputGroupTextarea,\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OTPInput } from 'input-otp';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare function InputOTP({ className, containerClassName, ...props }: React.ComponentProps<typeof OTPInput> & {
|
|
5
|
+
containerClassName?: string;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
declare function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
8
|
+
declare function InputOTPSlot({ index, className, ...props }: React.ComponentProps<'div'> & {
|
|
9
|
+
index: number;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|