@nswds/ui 5.4.0 → 5.5.1
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/badge.d.ts +1 -1
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +91 -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/button.d.ts +2 -2
- 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/header.d.ts +1 -1
- 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/link.d.ts +1 -1
- package/dist/components/masthead.d.ts +1 -1
- 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 +109 -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/skip-link.d.ts +1 -1
- 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,186 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { IconChevronLeft } from '../icons/chevron-left.js';
|
|
6
|
+
import { IconChevronRight } from '../icons/chevron-right.js';
|
|
7
|
+
import { cn } from '../lib/utils.js';
|
|
8
|
+
import { Button } from './button.js';
|
|
9
|
+
|
|
10
|
+
const CarouselContext = React.createContext(null);
|
|
11
|
+
function useCarousel() {
|
|
12
|
+
const context = React.useContext(CarouselContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
function Carousel({
|
|
19
|
+
orientation = "horizontal",
|
|
20
|
+
opts,
|
|
21
|
+
setApi,
|
|
22
|
+
plugins,
|
|
23
|
+
className,
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
28
|
+
{
|
|
29
|
+
...opts,
|
|
30
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
31
|
+
},
|
|
32
|
+
plugins
|
|
33
|
+
);
|
|
34
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
35
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
36
|
+
const onSelect = React.useCallback((api2) => {
|
|
37
|
+
if (!api2) return;
|
|
38
|
+
setCanScrollPrev(api2.canScrollPrev());
|
|
39
|
+
setCanScrollNext(api2.canScrollNext());
|
|
40
|
+
}, []);
|
|
41
|
+
const scrollPrev = React.useCallback(() => {
|
|
42
|
+
api?.scrollPrev();
|
|
43
|
+
}, [api]);
|
|
44
|
+
const scrollNext = React.useCallback(() => {
|
|
45
|
+
api?.scrollNext();
|
|
46
|
+
}, [api]);
|
|
47
|
+
const handleKeyDown = React.useCallback(
|
|
48
|
+
(event) => {
|
|
49
|
+
if (event.key === "ArrowLeft") {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
scrollPrev();
|
|
52
|
+
} else if (event.key === "ArrowRight") {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
scrollNext();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
[scrollPrev, scrollNext]
|
|
58
|
+
);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
if (!api || !setApi) return;
|
|
61
|
+
setApi(api);
|
|
62
|
+
}, [api, setApi]);
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
if (!api) return;
|
|
65
|
+
onSelect(api);
|
|
66
|
+
api.on("reInit", onSelect);
|
|
67
|
+
api.on("select", onSelect);
|
|
68
|
+
return () => {
|
|
69
|
+
api?.off("select", onSelect);
|
|
70
|
+
};
|
|
71
|
+
}, [api, onSelect]);
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
CarouselContext.Provider,
|
|
74
|
+
{
|
|
75
|
+
value: {
|
|
76
|
+
carouselRef,
|
|
77
|
+
api,
|
|
78
|
+
opts,
|
|
79
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
80
|
+
scrollPrev,
|
|
81
|
+
scrollNext,
|
|
82
|
+
canScrollPrev,
|
|
83
|
+
canScrollNext
|
|
84
|
+
},
|
|
85
|
+
children: /* @__PURE__ */ jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
onKeyDownCapture: handleKeyDown,
|
|
89
|
+
className: cn("relative", className),
|
|
90
|
+
role: "region",
|
|
91
|
+
"aria-roledescription": "carousel",
|
|
92
|
+
"data-slot": "carousel",
|
|
93
|
+
...props,
|
|
94
|
+
children
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function CarouselContent({ className, ...props }) {
|
|
101
|
+
const { carouselRef, orientation } = useCarousel();
|
|
102
|
+
return /* @__PURE__ */ jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: /* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: cn("flex", orientation === "horizontal" ? "-ms-4" : "-mt-4 flex-col", className),
|
|
106
|
+
...props
|
|
107
|
+
}
|
|
108
|
+
) });
|
|
109
|
+
}
|
|
110
|
+
function CarouselItem({ className, ...props }) {
|
|
111
|
+
const { orientation } = useCarousel();
|
|
112
|
+
return /* @__PURE__ */ jsx(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
role: "group",
|
|
116
|
+
"aria-roledescription": "slide",
|
|
117
|
+
"data-slot": "carousel-item",
|
|
118
|
+
className: cn(
|
|
119
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
120
|
+
orientation === "horizontal" ? "ps-4" : "pt-4",
|
|
121
|
+
className
|
|
122
|
+
),
|
|
123
|
+
...props
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function CarouselPrevious({
|
|
128
|
+
className,
|
|
129
|
+
variant = "outline",
|
|
130
|
+
size = "icon",
|
|
131
|
+
...props
|
|
132
|
+
}) {
|
|
133
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
134
|
+
return /* @__PURE__ */ jsxs(
|
|
135
|
+
Button,
|
|
136
|
+
{
|
|
137
|
+
"data-slot": "carousel-previous",
|
|
138
|
+
variant,
|
|
139
|
+
size,
|
|
140
|
+
className: cn(
|
|
141
|
+
"absolute touch-manipulation rounded-full",
|
|
142
|
+
orientation === "horizontal" ? "inset-y-0 -start-12 my-auto" : "start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2",
|
|
143
|
+
className
|
|
144
|
+
),
|
|
145
|
+
disabled: !canScrollPrev,
|
|
146
|
+
onClick: scrollPrev,
|
|
147
|
+
...props,
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx(IconChevronLeft, { className: "rtl:rotate-180" }),
|
|
150
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Previous slide" })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
function CarouselNext({
|
|
156
|
+
className,
|
|
157
|
+
variant = "outline",
|
|
158
|
+
size = "icon",
|
|
159
|
+
...props
|
|
160
|
+
}) {
|
|
161
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
162
|
+
return /* @__PURE__ */ jsxs(
|
|
163
|
+
Button,
|
|
164
|
+
{
|
|
165
|
+
"data-slot": "carousel-next",
|
|
166
|
+
variant,
|
|
167
|
+
size,
|
|
168
|
+
className: cn(
|
|
169
|
+
"absolute touch-manipulation rounded-full",
|
|
170
|
+
orientation === "horizontal" ? "inset-y-0 -end-12 my-auto" : "start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2",
|
|
171
|
+
className
|
|
172
|
+
),
|
|
173
|
+
disabled: !canScrollNext,
|
|
174
|
+
onClick: scrollNext,
|
|
175
|
+
...props,
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsx(IconChevronRight, { className: "rtl:rotate-180" }),
|
|
178
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Next slide" })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|
|
185
|
+
//# sourceMappingURL=carousel.js.map
|
|
186
|
+
//# sourceMappingURL=carousel.js.map
|
|
@@ -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,WAAA,EAAa,GAAG,CAAA,GAAI,gBAAA;A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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,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAA,GA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AAA,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":[]}
|
|
@@ -30,7 +30,7 @@ declare const headerColors: {
|
|
|
30
30
|
};
|
|
31
31
|
type HeaderColor = keyof typeof headerColors;
|
|
32
32
|
declare const headerVariants: (props?: ({
|
|
33
|
-
color?: "
|
|
33
|
+
color?: "white" | "grey" | "light" | "dark" | null | undefined;
|
|
34
34
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
35
35
|
declare const headerContainerVariants: (props?: ({
|
|
36
36
|
container?: "fluid" | "contained" | null | undefined;
|
|
@@ -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 };
|