@px-ui/ui 0.1.3 → 1.0.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/avatar-BAkmIOVe.d.ts +41 -0
- package/dist/avatar-BAkmIOVe.d.ts.map +1 -0
- package/dist/avatar-DDdL9xDH.js +119 -0
- package/dist/avatar-DDdL9xDH.js.map +1 -0
- package/dist/button-BiiFfKiR.d.ts +19 -0
- package/dist/button-BiiFfKiR.d.ts.map +1 -0
- package/dist/button-hBUFMmsZ.js +47 -0
- package/dist/button-hBUFMmsZ.js.map +1 -0
- package/dist/combobox-CnpyzZ7B.js +334 -0
- package/dist/combobox-CnpyzZ7B.js.map +1 -0
- package/dist/combobox-JXY6PiDq.d.ts +109 -0
- package/dist/combobox-JXY6PiDq.d.ts.map +1 -0
- package/dist/components/accordion.d.ts +25 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +56 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +59 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +99 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +29 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +47 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/aspect-ratio.d.ts +13 -0
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +16 -0
- package/dist/components/aspect-ratio.js.map +1 -0
- package/dist/components/avatar-group.d.ts +30 -0
- package/dist/components/avatar-group.d.ts.map +1 -0
- package/dist/components/avatar-group.js +69 -0
- package/dist/components/avatar-group.js.map +1 -0
- package/dist/components/avatar.d.ts +2 -0
- package/dist/components/avatar.js +5 -0
- package/dist/components/badge.d.ts +18 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +31 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +38 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +75 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button-group.d.ts +29 -0
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button-group.js +44 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.js +4 -0
- package/dist/components/calendar.d.ts +32 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +119 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +38 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +59 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.d.ts +57 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +136 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/chart.d.ts +79 -0
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +148 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +11 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +24 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +25 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +28 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.d.ts +3 -0
- package/dist/components/combobox.js +13 -0
- package/dist/components/command.d.ts +78 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +125 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/context-menu.d.ts +87 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +137 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/currency-select-field.d.ts +105 -0
- package/dist/components/currency-select-field.d.ts.map +1 -0
- package/dist/components/currency-select-field.js +266 -0
- package/dist/components/currency-select-field.js.map +1 -0
- package/dist/components/dialog.d.ts +61 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +5 -0
- package/dist/components/direction.d.ts +2 -0
- package/dist/components/direction.js +3 -0
- package/dist/components/drawer.d.ts +45 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +86 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +2 -0
- package/dist/components/dropdown-menu.js +4 -0
- package/dist/components/empty.d.ts +36 -0
- package/dist/components/empty.d.ts.map +1 -0
- package/dist/components/empty.js +62 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.d.ts +72 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +122 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/file-upload-field.d.ts +58 -0
- package/dist/components/file-upload-field.d.ts.map +1 -0
- package/dist/components/file-upload-field.js +90 -0
- package/dist/components/file-upload-field.js.map +1 -0
- package/dist/components/file-upload.d.ts +4 -0
- package/dist/components/file-upload.js +6 -0
- package/dist/components/hover-card.d.ts +21 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +40 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.d.ts +46 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +9 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.d.ts.map +1 -0
- package/dist/components/input-otp.js +40 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.d.ts +2 -0
- package/dist/components/input.js +4 -0
- package/dist/components/item.d.ts +62 -0
- package/dist/components/item.d.ts.map +1 -0
- package/dist/components/item.js +124 -0
- package/dist/components/item.js.map +1 -0
- package/dist/components/kbd.d.ts +14 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +22 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.d.ts +2 -0
- package/dist/components/label.js +6 -0
- package/dist/components/menubar.d.ts +89 -0
- package/dist/components/menubar.d.ts.map +1 -0
- package/dist/components/menubar.js +140 -0
- package/dist/components/menubar.js.map +1 -0
- package/dist/components/native-select.d.ts +23 -0
- package/dist/components/native-select.d.ts.map +1 -0
- package/dist/components/native-select.js +41 -0
- package/dist/components/native-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +48 -0
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu.js +85 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/pagination.d.ts +46 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +89 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/phone-input.d.ts +28 -0
- package/dist/components/phone-input.d.ts.map +1 -0
- package/dist/components/phone-input.js +60 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/components/popover.d.ts +34 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +4 -0
- package/dist/components/progress.d.ts +29 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +48 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +16 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +29 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/resizable.d.ts +21 -0
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +32 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/scroll-area.d.ts +17 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +39 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.d.ts +56 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +102 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +2 -0
- package/dist/components/separator.js +4 -0
- package/dist/components/sheet.d.ts +43 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +7 -0
- package/dist/components/sidebar.d.ts +162 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +390 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +10 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +4 -0
- package/dist/components/slider.d.ts +15 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +36 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/spinner.d.ts +11 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +4 -0
- package/dist/components/switch.d.ts +14 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +21 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +39 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +71 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +31 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +55 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +11 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +4 -0
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +6 -0
- package/dist/components/toggle-group.d.ts +29 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +55 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +2 -0
- package/dist/components/toggle.js +6 -0
- package/dist/components/tooltip.d.ts +2 -0
- package/dist/components/tooltip.js +4 -0
- package/dist/dialog-CTqRrytc.js +103 -0
- package/dist/dialog-CTqRrytc.js.map +1 -0
- package/dist/direction-BKSh6e6q.js +3 -0
- package/dist/dropdown-menu-BEARLcDj.d.ts +91 -0
- package/dist/dropdown-menu-BEARLcDj.d.ts.map +1 -0
- package/dist/dropdown-menu-CcumvwhM.js +139 -0
- package/dist/dropdown-menu-CcumvwhM.js.map +1 -0
- package/dist/file-upload-D8hgfjvA.d.ts +145 -0
- package/dist/file-upload-D8hgfjvA.d.ts.map +1 -0
- package/dist/file-upload-DeCIv13t.js +434 -0
- package/dist/file-upload-DeCIv13t.js.map +1 -0
- package/dist/hooks/use-async-options.d.ts +2 -0
- package/dist/hooks/use-async-options.js +3 -0
- package/dist/hooks/use-debounce.d.ts +5 -0
- package/dist/hooks/use-debounce.d.ts.map +1 -0
- package/dist/hooks/use-debounce.js +3 -0
- package/dist/hooks/use-file-upload.d.ts +2 -0
- package/dist/hooks/use-file-upload.js +3 -0
- package/dist/hooks/use-infinite-scroll.d.ts +21 -0
- package/dist/hooks/use-infinite-scroll.d.ts.map +1 -0
- package/dist/hooks/use-infinite-scroll.js +4 -0
- package/dist/hooks/use-intersection-observer.d.ts +2 -0
- package/dist/hooks/use-intersection-observer.js +3 -0
- package/dist/hooks/use-mobile.d.ts +5 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +3 -0
- package/dist/input-8jqdnUZl.js +18 -0
- package/dist/input-8jqdnUZl.js.map +1 -0
- package/dist/input-DwxhsFRP.d.ts +12 -0
- package/dist/input-DwxhsFRP.d.ts.map +1 -0
- package/dist/input-group-DqEkmpXW.js +81 -0
- package/dist/input-group-DqEkmpXW.js.map +1 -0
- package/dist/label-AaH9ZYCZ.js +16 -0
- package/dist/label-AaH9ZYCZ.js.map +1 -0
- package/dist/label-D5SCGMZl.d.ts +11 -0
- package/dist/label-D5SCGMZl.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +3 -0
- package/dist/popover-C9D43EuT.js +57 -0
- package/dist/popover-C9D43EuT.js.map +1 -0
- package/dist/providers/px-ui-provider.d.ts +36 -0
- package/dist/providers/px-ui-provider.d.ts.map +1 -0
- package/dist/providers/px-ui-provider.js +26 -0
- package/dist/providers/px-ui-provider.js.map +1 -0
- package/dist/separator-BS3ilczC.js +17 -0
- package/dist/separator-BS3ilczC.js.map +1 -0
- package/dist/separator-ct9ZvuTk.d.ts +12 -0
- package/dist/separator-ct9ZvuTk.d.ts.map +1 -0
- package/dist/sheet-CLjNDrfL.js +91 -0
- package/dist/sheet-CLjNDrfL.js.map +1 -0
- package/dist/skeleton-BcIxI5Wq.js +15 -0
- package/dist/skeleton-BcIxI5Wq.js.map +1 -0
- package/dist/spinner-Bo0sUZEg.js +17 -0
- package/dist/spinner-Bo0sUZEg.js.map +1 -0
- package/dist/styles.css +196 -0
- package/dist/textarea-Cq0o323P.js +16 -0
- package/dist/textarea-Cq0o323P.js.map +1 -0
- package/dist/toast-COWAQbIk.js +211 -0
- package/dist/toast-COWAQbIk.js.map +1 -0
- package/dist/toast-CXkP5Jwp.d.ts +74 -0
- package/dist/toast-CXkP5Jwp.d.ts.map +1 -0
- package/dist/toggle-BXBPgIQh.d.ts +19 -0
- package/dist/toggle-BXBPgIQh.d.ts.map +1 -0
- package/dist/toggle-DhJ_qwgw.js +38 -0
- package/dist/toggle-DhJ_qwgw.js.map +1 -0
- package/dist/tooltip-BWjVzK67.d.ts +26 -0
- package/dist/tooltip-BWjVzK67.d.ts.map +1 -0
- package/dist/tooltip-DkPxCJIL.js +43 -0
- package/dist/tooltip-DkPxCJIL.js.map +1 -0
- package/dist/use-async-options-DHR8q5qX.d.ts +45 -0
- package/dist/use-async-options-DHR8q5qX.d.ts.map +1 -0
- package/dist/use-async-options-wZ9LJ2BJ.js +46 -0
- package/dist/use-async-options-wZ9LJ2BJ.js.map +1 -0
- package/dist/use-debounce-_qaEZqtt.js +24 -0
- package/dist/use-debounce-_qaEZqtt.js.map +1 -0
- package/dist/{index.js → use-file-upload-Dxrej28u.js} +3 -204
- package/dist/use-file-upload-Dxrej28u.js.map +1 -0
- package/dist/use-file-upload-yy-xLBtn.d.ts +133 -0
- package/dist/use-file-upload-yy-xLBtn.d.ts.map +1 -0
- package/dist/use-infinite-scroll-CpbhGGT5.js +38 -0
- package/dist/use-infinite-scroll-CpbhGGT5.js.map +1 -0
- package/dist/use-intersection-observer-C2xDq2SW.d.ts +11 -0
- package/dist/use-intersection-observer-C2xDq2SW.d.ts.map +1 -0
- package/dist/use-intersection-observer-CZfnep4z.js +33 -0
- package/dist/use-intersection-observer-CZfnep4z.js.map +1 -0
- package/dist/use-mobile-l5ebOdQl.js +21 -0
- package/dist/use-mobile-l5ebOdQl.js.map +1 -0
- package/dist/utils-mWJR2N24.js +28 -0
- package/dist/utils-mWJR2N24.js.map +1 -0
- package/package.json +290 -26
- package/dist/index.css +0 -133
- package/dist/index.d.ts +0 -229
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { Avatar } from "@base-ui/react/avatar";
|
|
4
|
+
|
|
5
|
+
//#region src/components/avatar.d.ts
|
|
6
|
+
declare function getInitialsFromName(name: string | null | undefined): string;
|
|
7
|
+
declare function getAvatarColorByName(name: string | null | undefined): React$1.CSSProperties;
|
|
8
|
+
type AvatarSize = "default" | "sm" | "lg";
|
|
9
|
+
type AvatarProps = Avatar.Root.Props & {
|
|
10
|
+
size?: AvatarSize;
|
|
11
|
+
tooltip?: React$1.ReactNode | false;
|
|
12
|
+
};
|
|
13
|
+
declare function getAvatarLabelFromChildren(children: React$1.ReactNode): React$1.ReactNode | undefined;
|
|
14
|
+
declare function Avatar$1({
|
|
15
|
+
className,
|
|
16
|
+
size,
|
|
17
|
+
tooltip,
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}: AvatarProps): react_jsx_runtime5.JSX.Element;
|
|
21
|
+
declare function AvatarImage({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: Avatar.Image.Props): react_jsx_runtime5.JSX.Element;
|
|
25
|
+
type AvatarFallbackProps = Avatar.Fallback.Props & {
|
|
26
|
+
name?: string | null;
|
|
27
|
+
};
|
|
28
|
+
declare function AvatarFallback({
|
|
29
|
+
className,
|
|
30
|
+
name,
|
|
31
|
+
children,
|
|
32
|
+
style,
|
|
33
|
+
...props
|
|
34
|
+
}: AvatarFallbackProps): react_jsx_runtime5.JSX.Element;
|
|
35
|
+
declare function AvatarBadge({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React$1.ComponentProps<"span">): react_jsx_runtime5.JSX.Element;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { AvatarImage as a, getAvatarLabelFromChildren as c, AvatarFallbackProps as i, getInitialsFromName as l, AvatarBadge as n, AvatarProps as o, AvatarFallback as r, getAvatarColorByName as s, Avatar$1 as t };
|
|
41
|
+
//# sourceMappingURL=avatar-BAkmIOVe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-BAkmIOVe.d.ts","names":[],"sources":["../src/components/avatar.tsx"],"sourcesContent":[],"mappings":";;;;;iBAmCS,mBAAA;iBAQA,oBAAA,mCAEN,OAAA,CAAM;KAwBJ,UAAA;AApE4D,KAsE5D,WAAA,GAAc,MAAA,CAAgB,IAAA,CAAK,KApCZ,GAAA;EAQnB,IAAA,CAAA,EA6BA,UA7BA;EA0BJ,OAAA,CAAA,EAIO,OAAA,CAAM,SAJH,GAAA,KAAA;AAAA,CAAA;iBAON,0BAAA,CAL+B,QAAA,EAM5B,OAAA,CAAM,SANsB,CAAA,EAOrC,OAAA,CAAM,SAP+B,GAAA,SAAA;iBAuB/B,QAAA,CAtBA;EAAA,SAAA;EAAA,IAAA;EAAA,OAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EA4BN,WA5BM,CAAA,EA4BK,kBAAA,CAAA,GAAA,CAAA,OA5BL;iBAuDA,WAAA,CAtDS;EAAA,SAAA;EAAA,GAAA;AAAA,CAAA,EAsD4B,MAAA,CAAgB,KAAA,CAAM,KAtDlD,CAAA,EAsDuD,kBAAA,CAAA,GAAA,CAAA,OAtDvD;KAmEb,mBAAA,GAAsB,MAAA,CAAgB,QAAA,CAAS,KAnEzB,GAAA;EAGlB,IAAA,CAAA,EAAA,MAAA,GAAA,IAAA;AAES,CAAA;iBAkET,cAAA,CAjDP;EAAA,SAAA;EAAA,IAAA;EAAA,QAAA;EAAA,KAAA;EAAA,GAAA;AAAA,CAAA,EAuDC,mBAvDD,CAAA,EAuDoB,kBAAA,CAAA,GAAA,CAAA,OAvDpB;iBAgFO,WAAA,CA/EP;EAAA,SAAA;EAAA,GAAA;AAAA,CAAA,EA+E4C,OAAA,CAAM,cA/ElD,CAAA,MAAA,CAAA,CAAA,EA+EwE,kBAAA,CAAA,GAAA,CAAA,OA/ExE"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { t as cn } from "./utils-mWJR2N24.js";
|
|
2
|
+
import { i as TooltipTrigger, n as TooltipContent, t as Tooltip } from "./tooltip-DkPxCJIL.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Avatar } from "@base-ui/react/avatar";
|
|
6
|
+
|
|
7
|
+
//#region src/components/avatar.tsx
|
|
8
|
+
const AVATAR_NAME_PALETTE = [
|
|
9
|
+
"#bdc3c7",
|
|
10
|
+
"#6f7b87",
|
|
11
|
+
"#2c3e50",
|
|
12
|
+
"#2f3193",
|
|
13
|
+
"#662d91",
|
|
14
|
+
"#922790",
|
|
15
|
+
"#ec2176",
|
|
16
|
+
"#ed1c24",
|
|
17
|
+
"#f36622",
|
|
18
|
+
"#f8941e",
|
|
19
|
+
"#fab70f",
|
|
20
|
+
"#fdde00",
|
|
21
|
+
"#d1d219",
|
|
22
|
+
"#8ec73f",
|
|
23
|
+
"#00a650",
|
|
24
|
+
"#00aa9c",
|
|
25
|
+
"#00adef",
|
|
26
|
+
"#0081cd",
|
|
27
|
+
"#005bab",
|
|
28
|
+
"#012a4a",
|
|
29
|
+
"#013a63",
|
|
30
|
+
"#06d6a0",
|
|
31
|
+
"#ef476f",
|
|
32
|
+
"#ff5d8f",
|
|
33
|
+
"#0496ff",
|
|
34
|
+
"#c879ff"
|
|
35
|
+
];
|
|
36
|
+
function getInitialsFromName(name) {
|
|
37
|
+
if (!name) return "";
|
|
38
|
+
const matches = [...name.matchAll(/(\b\w)/g)];
|
|
39
|
+
return ((matches.shift()?.[1] ?? "") + (matches.pop()?.[1] ?? "")).toUpperCase();
|
|
40
|
+
}
|
|
41
|
+
function getAvatarColorByName(name) {
|
|
42
|
+
const seed = name && name.length ? name : "?";
|
|
43
|
+
let index = seed[0].toUpperCase().charCodeAt(0);
|
|
44
|
+
const lastName = seed.split(" ")[1];
|
|
45
|
+
if (lastName) index = Math.floor((index + lastName[0].toUpperCase().charCodeAt(0)) / 2);
|
|
46
|
+
index = Math.abs(index - 65) % AVATAR_NAME_PALETTE.length;
|
|
47
|
+
return {
|
|
48
|
+
backgroundColor: AVATAR_NAME_PALETTE[index],
|
|
49
|
+
color: "#fff"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function getStringFromChildren(children) {
|
|
53
|
+
let out = "";
|
|
54
|
+
React$1.Children.forEach(children, (child) => {
|
|
55
|
+
if (typeof child === "string" || typeof child === "number") out += child;
|
|
56
|
+
});
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
function getAvatarLabelFromChildren(children) {
|
|
60
|
+
let alt;
|
|
61
|
+
let name;
|
|
62
|
+
React$1.Children.forEach(children, (child) => {
|
|
63
|
+
if (!React$1.isValidElement(child)) return;
|
|
64
|
+
if (child.type === AvatarFallback) {
|
|
65
|
+
const props = child.props;
|
|
66
|
+
if (props.name) name = props.name;
|
|
67
|
+
} else if (child.type === AvatarImage) {
|
|
68
|
+
const props = child.props;
|
|
69
|
+
if (props.alt) alt = props.alt;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return name ?? alt;
|
|
73
|
+
}
|
|
74
|
+
function Avatar$1({ className, size = "default", tooltip, children, ...props }) {
|
|
75
|
+
const root = /* @__PURE__ */ jsx(Avatar.Root, {
|
|
76
|
+
"data-slot": "avatar",
|
|
77
|
+
"data-size": size,
|
|
78
|
+
className: cn("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className),
|
|
79
|
+
...props,
|
|
80
|
+
children
|
|
81
|
+
});
|
|
82
|
+
const resolved = tooltip === void 0 ? getAvatarLabelFromChildren(children) : tooltip;
|
|
83
|
+
if (resolved === false || resolved == null || resolved === "") return root;
|
|
84
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: root }), /* @__PURE__ */ jsx(TooltipContent, { children: resolved })] });
|
|
85
|
+
}
|
|
86
|
+
function AvatarImage({ className, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx(Avatar.Image, {
|
|
88
|
+
"data-slot": "avatar-image",
|
|
89
|
+
className: cn("aspect-square size-full rounded-full object-cover", className),
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function AvatarFallback({ className, name, children, style, ...props }) {
|
|
94
|
+
const colorStyle = React$1.useMemo(() => {
|
|
95
|
+
return getAvatarColorByName(name ?? getStringFromChildren(children));
|
|
96
|
+
}, [name, children]);
|
|
97
|
+
const initials = React$1.useMemo(() => name && children == null ? getInitialsFromName(name) : void 0, [name, children]);
|
|
98
|
+
return /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
99
|
+
"data-slot": "avatar-fallback",
|
|
100
|
+
className: cn("flex size-full items-center justify-center rounded-full font-medium text-sm group-data-[size=sm]/avatar:text-xs", className),
|
|
101
|
+
style: {
|
|
102
|
+
...colorStyle,
|
|
103
|
+
...style
|
|
104
|
+
},
|
|
105
|
+
...props,
|
|
106
|
+
children: children ?? initials
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function AvatarBadge({ className, ...props }) {
|
|
110
|
+
return /* @__PURE__ */ jsx("span", {
|
|
111
|
+
"data-slot": "avatar-badge",
|
|
112
|
+
className: cn("absolute end-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className),
|
|
113
|
+
...props
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { getAvatarColorByName as a, AvatarImage as i, AvatarBadge as n, getAvatarLabelFromChildren as o, AvatarFallback as r, getInitialsFromName as s, Avatar$1 as t };
|
|
119
|
+
//# sourceMappingURL=avatar-DDdL9xDH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-DDdL9xDH.js","names":["alt: string | undefined","name: string | undefined","React","Avatar","AvatarPrimitive"],"sources":["../src/components/avatar.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\"\n\nimport { cn } from \"@px-ui/ui/lib/utils\"\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@px-ui/ui/components/tooltip\"\n\nconst AVATAR_NAME_PALETTE = [\n \"#bdc3c7\",\n \"#6f7b87\",\n \"#2c3e50\",\n \"#2f3193\",\n \"#662d91\",\n \"#922790\",\n \"#ec2176\",\n \"#ed1c24\",\n \"#f36622\",\n \"#f8941e\",\n \"#fab70f\",\n \"#fdde00\",\n \"#d1d219\",\n \"#8ec73f\",\n \"#00a650\",\n \"#00aa9c\",\n \"#00adef\",\n \"#0081cd\",\n \"#005bab\",\n \"#012a4a\",\n \"#013a63\",\n \"#06d6a0\",\n \"#ef476f\",\n \"#ff5d8f\",\n \"#0496ff\",\n \"#c879ff\",\n]\n\nfunction getInitialsFromName(name: string | null | undefined): string {\n if (!name) return \"\"\n const matches = [...name.matchAll(/(\\b\\w)/g)]\n return (\n (matches.shift()?.[1] ?? \"\") + (matches.pop()?.[1] ?? \"\")\n ).toUpperCase()\n}\n\nfunction getAvatarColorByName(\n name: string | null | undefined\n): React.CSSProperties {\n const seed = name && name.length ? name : \"?\"\n let index = seed[0].toUpperCase().charCodeAt(0)\n const lastName = seed.split(\" \")[1]\n if (lastName) {\n index = Math.floor((index + lastName[0].toUpperCase().charCodeAt(0)) / 2)\n }\n index = Math.abs(index - 65) % AVATAR_NAME_PALETTE.length\n return {\n backgroundColor: AVATAR_NAME_PALETTE[index],\n color: \"#fff\",\n }\n}\n\nfunction getStringFromChildren(children: React.ReactNode): string {\n let out = \"\"\n React.Children.forEach(children, (child) => {\n if (typeof child === \"string\" || typeof child === \"number\") {\n out += child\n }\n })\n return out\n}\n\ntype AvatarSize = \"default\" | \"sm\" | \"lg\"\n\ntype AvatarProps = AvatarPrimitive.Root.Props & {\n size?: AvatarSize\n tooltip?: React.ReactNode | false\n}\n\nfunction getAvatarLabelFromChildren(\n children: React.ReactNode\n): React.ReactNode | undefined {\n let alt: string | undefined\n let name: string | undefined\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return\n if (child.type === AvatarFallback) {\n const props = child.props as AvatarFallbackProps\n if (props.name) name = props.name\n } else if (child.type === AvatarImage) {\n const props = child.props as AvatarPrimitive.Image.Props\n if (props.alt) alt = props.alt\n }\n })\n return name ?? alt\n}\n\nfunction Avatar({\n className,\n size = \"default\",\n tooltip,\n children,\n ...props\n}: AvatarProps) {\n const root = (\n <AvatarPrimitive.Root\n data-slot=\"avatar\"\n data-size={size}\n className={cn(\n \"group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten\",\n className\n )}\n {...props}\n >\n {children}\n </AvatarPrimitive.Root>\n )\n\n const resolved =\n tooltip === undefined ? getAvatarLabelFromChildren(children) : tooltip\n if (resolved === false || resolved == null || resolved === \"\") return root\n\n return (\n <Tooltip>\n <TooltipTrigger render={root} />\n <TooltipContent>{resolved}</TooltipContent>\n </Tooltip>\n )\n}\n\nfunction AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {\n return (\n <AvatarPrimitive.Image\n data-slot=\"avatar-image\"\n className={cn(\n \"aspect-square size-full rounded-full object-cover\",\n className\n )}\n {...props}\n />\n )\n}\n\ntype AvatarFallbackProps = AvatarPrimitive.Fallback.Props & {\n name?: string | null\n}\n\nfunction AvatarFallback({\n className,\n name,\n children,\n style,\n ...props\n}: AvatarFallbackProps) {\n const colorStyle = React.useMemo(() => {\n const seed = name ?? getStringFromChildren(children)\n return getAvatarColorByName(seed)\n }, [name, children])\n const initials = React.useMemo(\n () => (name && children == null ? getInitialsFromName(name) : undefined),\n [name, children]\n )\n\n return (\n <AvatarPrimitive.Fallback\n data-slot=\"avatar-fallback\"\n className={cn(\n \"flex size-full items-center justify-center rounded-full font-medium text-sm group-data-[size=sm]/avatar:text-xs\",\n className\n )}\n style={{ ...colorStyle, ...style }}\n {...props}\n >\n {children ?? initials}\n </AvatarPrimitive.Fallback>\n )\n}\n\nfunction AvatarBadge({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"avatar-badge\"\n className={cn(\n \"absolute end-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none\",\n \"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden\",\n \"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2\",\n \"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Avatar,\n AvatarImage,\n AvatarFallback,\n AvatarBadge,\n getAvatarLabelFromChildren,\n getInitialsFromName,\n getAvatarColorByName,\n}\nexport type { AvatarProps, AvatarFallbackProps }\n"],"mappings":";;;;;;;AAMA,MAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAS,oBAAoB,MAAyC;AACpE,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,UAAU,CAAC,GAAG,KAAK,SAAS,UAAU,CAAC;AAC7C,UACG,QAAQ,OAAO,GAAG,MAAM,OAAO,QAAQ,KAAK,GAAG,MAAM,KACtD,aAAa;;AAGjB,SAAS,qBACP,MACqB;CACrB,MAAM,OAAO,QAAQ,KAAK,SAAS,OAAO;CAC1C,IAAI,QAAQ,KAAK,GAAG,aAAa,CAAC,WAAW,EAAE;CAC/C,MAAM,WAAW,KAAK,MAAM,IAAI,CAAC;AACjC,KAAI,SACF,SAAQ,KAAK,OAAO,QAAQ,SAAS,GAAG,aAAa,CAAC,WAAW,EAAE,IAAI,EAAE;AAE3E,SAAQ,KAAK,IAAI,QAAQ,GAAG,GAAG,oBAAoB;AACnD,QAAO;EACL,iBAAiB,oBAAoB;EACrC,OAAO;EACR;;AAGH,SAAS,sBAAsB,UAAmC;CAChE,IAAI,MAAM;AACV,SAAM,SAAS,QAAQ,WAAW,UAAU;AAC1C,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,SAChD,QAAO;GAET;AACF,QAAO;;AAUT,SAAS,2BACP,UAC6B;CAC7B,IAAIA;CACJ,IAAIC;AACJ,SAAM,SAAS,QAAQ,WAAW,UAAU;AAC1C,MAAI,CAACC,QAAM,eAAe,MAAM,CAAE;AAClC,MAAI,MAAM,SAAS,gBAAgB;GACjC,MAAM,QAAQ,MAAM;AACpB,OAAI,MAAM,KAAM,QAAO,MAAM;aACpB,MAAM,SAAS,aAAa;GACrC,MAAM,QAAQ,MAAM;AACpB,OAAI,MAAM,IAAK,OAAM,MAAM;;GAE7B;AACF,QAAO,QAAQ;;AAGjB,SAASC,SAAO,EACd,WACA,OAAO,WACP,SACA,UACA,GAAG,SACW;CACd,MAAM,OACJ,oBAACC,OAAgB;EACf,aAAU;EACV,aAAW;EACX,WAAW,GACT,yPACA,UACD;EACD,GAAI;EAEH;GACoB;CAGzB,MAAM,WACJ,YAAY,SAAY,2BAA2B,SAAS,GAAG;AACjE,KAAI,aAAa,SAAS,YAAY,QAAQ,aAAa,GAAI,QAAO;AAEtE,QACE,qBAAC,sBACC,oBAAC,kBAAe,QAAQ,OAAQ,EAChC,oBAAC,4BAAgB,WAA0B,IACnC;;AAId,SAAS,YAAY,EAAE,WAAW,GAAG,SAAsC;AACzE,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GACT,qDACA,UACD;EACD,GAAI;GACJ;;AAQN,SAAS,eAAe,EACtB,WACA,MACA,UACA,OACA,GAAG,SACmB;CACtB,MAAM,aAAaF,QAAM,cAAc;AAErC,SAAO,qBADM,QAAQ,sBAAsB,SAAS,CACnB;IAChC,CAAC,MAAM,SAAS,CAAC;CACpB,MAAM,WAAWA,QAAM,cACd,QAAQ,YAAY,OAAO,oBAAoB,KAAK,GAAG,QAC9D,CAAC,MAAM,SAAS,CACjB;AAED,QACE,oBAACE,OAAgB;EACf,aAAU;EACV,WAAW,GACT,mHACA,UACD;EACD,OAAO;GAAE,GAAG;GAAY,GAAG;GAAO;EAClC,GAAI;YAEH,YAAY;GACY;;AAI/B,SAAS,YAAY,EAAE,WAAW,GAAG,SAAuC;AAC1E,QACE,oBAAC;EACC,aAAU;EACV,WAAW,GACT,0KACA,iFACA,6FACA,iFACA,UACD;EACD,GAAI;GACJ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as react_jsx_runtime19 from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@base-ui/react/button";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as class_variance_authority_types2 from "class-variance-authority/types";
|
|
5
|
+
|
|
6
|
+
//#region src/components/button.d.ts
|
|
7
|
+
declare const buttonVariants: (props?: ({
|
|
8
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
9
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types2.ClassProp) | undefined) => string;
|
|
11
|
+
declare function Button$1({
|
|
12
|
+
className,
|
|
13
|
+
variant,
|
|
14
|
+
size,
|
|
15
|
+
...props
|
|
16
|
+
}: Button.Props & VariantProps<typeof buttonVariants>): react_jsx_runtime19.JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { buttonVariants as n, Button$1 as t };
|
|
19
|
+
//# sourceMappingURL=button-BiiFfKiR.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-BiiFfKiR.d.ts","names":[],"sources":["../src/components/button.tsx"],"sourcesContent":[],"mappings":";;;;;;cAKM;;;IAmCL,+BAAA,CAAA;AAvCgE,iBAyCxD,QAAA,CAFR;EAAA,SAAA;EAAA,OAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAOE,MAAA,CAAgB,KAPlB,GAO0B,YAP1B,CAAA,OAO8C,cAP9C,CAAA,CAAA,EAO6D,mBAAA,CAAA,GAAA,CAAA,OAP7D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { t as cn } from "./utils-mWJR2N24.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@base-ui/react/button";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
|
|
6
|
+
//#region src/components/button.tsx
|
|
7
|
+
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
11
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
13
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
14
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
15
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",
|
|
19
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5",
|
|
21
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",
|
|
22
|
+
icon: "size-9",
|
|
23
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
24
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
25
|
+
"icon-lg": "size-10"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default"
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
function Button$1({ className, variant = "default", size = "default", ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
35
|
+
"data-slot": "button",
|
|
36
|
+
className: cn(buttonVariants({
|
|
37
|
+
variant,
|
|
38
|
+
size,
|
|
39
|
+
className
|
|
40
|
+
})),
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { buttonVariants as n, Button$1 as t };
|
|
47
|
+
//# sourceMappingURL=button-hBUFMmsZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-hBUFMmsZ.js","names":["Button","ButtonPrimitive"],"sources":["../src/components/button.tsx"],"sourcesContent":["import { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@px-ui/ui/lib/utils\"\n\nconst buttonVariants = cva(\n \"group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline:\n \"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost:\n \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n destructive:\n \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default:\n \"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2\",\n xs: \"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5\",\n lg: \"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2\",\n icon: \"size-9\",\n \"icon-xs\":\n \"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\":\n \"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n return (\n <ButtonPrimitive\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;AAKA,MAAM,iBAAiB,IACrB,8lBACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,SACE;GACF,WACE;GACF,OACE;GACF,aACE;GACF,MAAM;GACP;EACD,MAAM;GACJ,SACE;GACF,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,MAAM;GACN,WACE;GACF,WACE;GACF,WAAW;GACZ;EACF;CACD,iBAAiB;EACf,SAAS;EACT,MAAM;EACP;CACF,CACF;AAED,SAASA,SAAO,EACd,WACA,UAAU,WACV,OAAO,WACP,GAAG,SAC2D;AAC9D,QACE,oBAACC;EACC,aAAU;EACV,WAAW,GAAG,eAAe;GAAE;GAAS;GAAM;GAAW,CAAC,CAAC;EAC3D,GAAI;GACJ"}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { t as cn } from "./utils-mWJR2N24.js";
|
|
2
|
+
import { t as Button } from "./button-hBUFMmsZ.js";
|
|
3
|
+
import { i as InputGroupInput, n as InputGroupAddon, r as InputGroupButton, t as InputGroup } from "./input-group-DqEkmpXW.js";
|
|
4
|
+
import { t as Spinner } from "./spinner-Bo0sUZEg.js";
|
|
5
|
+
import { n as useAsyncOptions } from "./use-async-options-wZ9LJ2BJ.js";
|
|
6
|
+
import { t as use_infinite_scroll_default } from "./use-infinite-scroll-CpbhGGT5.js";
|
|
7
|
+
import { t as useDebounce } from "./use-debounce-_qaEZqtt.js";
|
|
8
|
+
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import * as React$1 from "react";
|
|
11
|
+
import { Combobox } from "@base-ui/react";
|
|
12
|
+
|
|
13
|
+
//#region src/components/combobox.tsx
|
|
14
|
+
const ComboboxAsyncContext = React$1.createContext({
|
|
15
|
+
isAsync: false,
|
|
16
|
+
isLoading: false,
|
|
17
|
+
isLoadingMore: false,
|
|
18
|
+
isError: false,
|
|
19
|
+
hasMore: false,
|
|
20
|
+
onLoadMore: () => {}
|
|
21
|
+
});
|
|
22
|
+
function useComboboxAsyncContext() {
|
|
23
|
+
return React$1.useContext(ComboboxAsyncContext);
|
|
24
|
+
}
|
|
25
|
+
const ComboboxListRefContext = React$1.createContext(null);
|
|
26
|
+
const ComboboxAnchorContext = React$1.createContext(null);
|
|
27
|
+
const ComboboxInsidePopupContext = React$1.createContext(false);
|
|
28
|
+
function useAttachComboboxAnchor(userRef) {
|
|
29
|
+
const ctxRef = React$1.useContext(ComboboxAnchorContext);
|
|
30
|
+
const insidePopup = React$1.useContext(ComboboxInsidePopupContext);
|
|
31
|
+
return React$1.useCallback((node) => {
|
|
32
|
+
if (typeof userRef === "function") userRef(node);
|
|
33
|
+
else if (userRef && typeof userRef === "object") userRef.current = node;
|
|
34
|
+
if (ctxRef && !insidePopup) ctxRef.current = node;
|
|
35
|
+
}, [
|
|
36
|
+
ctxRef,
|
|
37
|
+
insidePopup,
|
|
38
|
+
userRef
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
function normalizeInputValue(value) {
|
|
42
|
+
return Array.isArray(value) ? value.join(",") : String(value ?? "");
|
|
43
|
+
}
|
|
44
|
+
function Combobox$1({ loadOptions, debounceMs, isLoading = false, ...props }) {
|
|
45
|
+
const anchorRef = React$1.useRef(null);
|
|
46
|
+
const inner = loadOptions ? /* @__PURE__ */ jsx(ComboboxAsyncRoot, {
|
|
47
|
+
loadOptions,
|
|
48
|
+
debounceMs,
|
|
49
|
+
isLoading,
|
|
50
|
+
...props
|
|
51
|
+
}) : /* @__PURE__ */ jsx(ComboboxAsyncContext.Provider, {
|
|
52
|
+
value: {
|
|
53
|
+
isAsync: false,
|
|
54
|
+
isLoading,
|
|
55
|
+
isLoadingMore: false,
|
|
56
|
+
isError: false,
|
|
57
|
+
hasMore: false,
|
|
58
|
+
onLoadMore: () => {}
|
|
59
|
+
},
|
|
60
|
+
children: /* @__PURE__ */ jsx(Combobox.Root, {
|
|
61
|
+
autoHighlight: true,
|
|
62
|
+
...props
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ jsx(ComboboxAnchorContext.Provider, {
|
|
66
|
+
value: anchorRef,
|
|
67
|
+
children: inner
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function ComboboxAsyncRoot({ loadOptions, debounceMs = 500, open: openProp, inputValue: inputValueProp, defaultInputValue, onOpenChange, onInputValueChange, filter: _ignoredFilter, items: _ignoredItems, autoHighlight = "always", isLoading: isLoadingProp = false, children, ...props }) {
|
|
71
|
+
const [internalOpen, setInternalOpen] = React$1.useState(false);
|
|
72
|
+
const open = openProp ?? internalOpen;
|
|
73
|
+
const handleOpenChange = (next, eventDetails) => {
|
|
74
|
+
if (openProp === void 0) setInternalOpen(next);
|
|
75
|
+
onOpenChange?.(next, eventDetails);
|
|
76
|
+
};
|
|
77
|
+
const initialSearchValue = normalizeInputValue(inputValueProp ?? defaultInputValue);
|
|
78
|
+
const [searchValue, setSearchValue] = React$1.useState(initialSearchValue);
|
|
79
|
+
const [debouncedSearchValue, setDebouncedSearchValue] = React$1.useState(initialSearchValue);
|
|
80
|
+
React$1.useEffect(() => {
|
|
81
|
+
if (inputValueProp !== void 0) setSearchValue(normalizeInputValue(inputValueProp));
|
|
82
|
+
}, [inputValueProp]);
|
|
83
|
+
useDebounce(() => {
|
|
84
|
+
setDebouncedSearchValue(searchValue);
|
|
85
|
+
}, debounceMs, [searchValue]);
|
|
86
|
+
const handleInputValueChange = (val, eventDetails) => {
|
|
87
|
+
if (eventDetails?.reason !== "item-press") setSearchValue(val);
|
|
88
|
+
onInputValueChange?.(val, eventDetails);
|
|
89
|
+
};
|
|
90
|
+
const asyncState = useAsyncOptions(loadOptions, {
|
|
91
|
+
isOpen: open,
|
|
92
|
+
inputValue: debouncedSearchValue
|
|
93
|
+
});
|
|
94
|
+
const contextValue = React$1.useMemo(() => ({
|
|
95
|
+
isAsync: true,
|
|
96
|
+
isLoading: isLoadingProp || asyncState.isLoading,
|
|
97
|
+
isLoadingMore: asyncState.isLoadingMore,
|
|
98
|
+
isError: asyncState.isError,
|
|
99
|
+
hasMore: !!asyncState.hasMore,
|
|
100
|
+
onLoadMore: asyncState.onLoadMore
|
|
101
|
+
}), [
|
|
102
|
+
isLoadingProp,
|
|
103
|
+
asyncState.isLoading,
|
|
104
|
+
asyncState.isLoadingMore,
|
|
105
|
+
asyncState.isError,
|
|
106
|
+
asyncState.hasMore,
|
|
107
|
+
asyncState.onLoadMore
|
|
108
|
+
]);
|
|
109
|
+
return /* @__PURE__ */ jsx(ComboboxAsyncContext.Provider, {
|
|
110
|
+
value: contextValue,
|
|
111
|
+
children: /* @__PURE__ */ jsx(Combobox.Root, {
|
|
112
|
+
...props,
|
|
113
|
+
items: asyncState.items,
|
|
114
|
+
filter: null,
|
|
115
|
+
autoHighlight,
|
|
116
|
+
open,
|
|
117
|
+
inputValue: inputValueProp,
|
|
118
|
+
defaultInputValue,
|
|
119
|
+
onOpenChange: handleOpenChange,
|
|
120
|
+
onInputValueChange: handleInputValueChange,
|
|
121
|
+
children
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function ComboboxValue({ ...props }) {
|
|
126
|
+
return /* @__PURE__ */ jsx(Combobox.Value, {
|
|
127
|
+
"data-slot": "combobox-value",
|
|
128
|
+
...props
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function ComboboxTrigger({ className, children, ref, ...props }) {
|
|
132
|
+
const attachAnchor = useAttachComboboxAnchor(ref);
|
|
133
|
+
return /* @__PURE__ */ jsxs(Combobox.Trigger, {
|
|
134
|
+
ref: attachAnchor,
|
|
135
|
+
"data-slot": "combobox-trigger",
|
|
136
|
+
className: cn("[&_svg:not([class*='size-'])]:size-4", className),
|
|
137
|
+
...props,
|
|
138
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4" })]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function ComboboxClear({ className, ...props }) {
|
|
142
|
+
return /* @__PURE__ */ jsx(Combobox.Clear, {
|
|
143
|
+
"data-slot": "combobox-clear",
|
|
144
|
+
render: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
size: "icon-xs"
|
|
147
|
+
}),
|
|
148
|
+
className: cn(className),
|
|
149
|
+
...props,
|
|
150
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function ComboboxInput({ className, children, disabled, showTrigger = true, showClear = true, ...props }) {
|
|
154
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
155
|
+
ref: useAttachComboboxAnchor(),
|
|
156
|
+
className: cn("w-auto", className),
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ jsx(Combobox.Input, {
|
|
159
|
+
render: /* @__PURE__ */ jsx(InputGroupInput, { ...disabled !== void 0 ? { disabled } : {} }),
|
|
160
|
+
...props
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
163
|
+
align: "inline-end",
|
|
164
|
+
children: [showTrigger && /* @__PURE__ */ jsx(InputGroupButton, {
|
|
165
|
+
size: "icon-xs",
|
|
166
|
+
variant: "ghost",
|
|
167
|
+
render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
|
|
168
|
+
"data-slot": "input-group-button",
|
|
169
|
+
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
|
|
170
|
+
...disabled !== void 0 ? { disabled } : {}
|
|
171
|
+
}), showClear && /* @__PURE__ */ jsx(ComboboxClear, { ...disabled !== void 0 ? { disabled } : {} })]
|
|
172
|
+
}),
|
|
173
|
+
children
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, children, ...props }) {
|
|
178
|
+
const ctxAnchor = React$1.useContext(ComboboxAnchorContext);
|
|
179
|
+
const resolvedAnchor = anchor ?? ctxAnchor ?? void 0;
|
|
180
|
+
return /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, {
|
|
181
|
+
side,
|
|
182
|
+
sideOffset,
|
|
183
|
+
align,
|
|
184
|
+
alignOffset,
|
|
185
|
+
anchor: resolvedAnchor,
|
|
186
|
+
className: "isolate z-50",
|
|
187
|
+
children: /* @__PURE__ */ jsx(Combobox.Popup, {
|
|
188
|
+
"data-slot": "combobox-content",
|
|
189
|
+
className: cn("group/combobox-content max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) bg-popover text-popover-foreground ring-foreground/10 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]:border-input/30 *:data-[slot=input-group]:bg-input/30 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 relative overflow-hidden rounded-md shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none", className),
|
|
190
|
+
...props,
|
|
191
|
+
children: /* @__PURE__ */ jsx(ComboboxInsidePopupContext.Provider, {
|
|
192
|
+
value: true,
|
|
193
|
+
children
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
}) });
|
|
197
|
+
}
|
|
198
|
+
function ComboboxList({ className, children, ref, ...props }) {
|
|
199
|
+
const { isAsync, hasMore } = useComboboxAsyncContext();
|
|
200
|
+
const [listEl, setListEl] = React$1.useState(null);
|
|
201
|
+
const handleListRef = React$1.useCallback((node) => {
|
|
202
|
+
setListEl(node);
|
|
203
|
+
if (typeof ref === "function") ref(node);
|
|
204
|
+
else if (ref) ref.current = node;
|
|
205
|
+
}, [ref]);
|
|
206
|
+
const resolvedChildren = React$1.useMemo(() => {
|
|
207
|
+
if (isAsync && typeof children === "function") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Combobox.Collection, { children }), hasMore ? /* @__PURE__ */ jsx(ComboboxLoadMoreSentinel, {}) : null] });
|
|
208
|
+
return children;
|
|
209
|
+
}, [
|
|
210
|
+
isAsync,
|
|
211
|
+
hasMore,
|
|
212
|
+
children
|
|
213
|
+
]);
|
|
214
|
+
return /* @__PURE__ */ jsx(ComboboxListRefContext.Provider, {
|
|
215
|
+
value: listEl,
|
|
216
|
+
children: /* @__PURE__ */ jsx(Combobox.List, {
|
|
217
|
+
ref: handleListRef,
|
|
218
|
+
"data-slot": "combobox-list",
|
|
219
|
+
className: cn("ppx-scrollbar data-empty:p-0 max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1", className),
|
|
220
|
+
...props,
|
|
221
|
+
children: resolvedChildren
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function ComboboxLoadMoreSentinel() {
|
|
226
|
+
const { isLoadingMore, hasMore, onLoadMore, isError } = useComboboxAsyncContext();
|
|
227
|
+
const [ref] = use_infinite_scroll_default({
|
|
228
|
+
isLoadingMore,
|
|
229
|
+
hasMore,
|
|
230
|
+
onLoadMore,
|
|
231
|
+
disabled: isError,
|
|
232
|
+
root: React$1.useContext(ComboboxListRefContext),
|
|
233
|
+
rootMargin: "0px 0px 80px 0px"
|
|
234
|
+
});
|
|
235
|
+
return /* @__PURE__ */ jsx(Combobox.Status, {
|
|
236
|
+
ref,
|
|
237
|
+
"data-slot": "combobox-load-more",
|
|
238
|
+
"aria-label": isLoadingMore ? "Loading more options" : void 0,
|
|
239
|
+
className: "flex h-10 items-center justify-center",
|
|
240
|
+
children: isLoadingMore && /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground size-4" })
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
244
|
+
return /* @__PURE__ */ jsxs(Combobox.Item, {
|
|
245
|
+
"data-slot": "combobox-item",
|
|
246
|
+
className: cn("outline-hidden 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 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
247
|
+
...props,
|
|
248
|
+
children: [children, /* @__PURE__ */ jsx(Combobox.ItemIndicator, {
|
|
249
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute end-2 flex size-4 items-center justify-center" }),
|
|
250
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" })
|
|
251
|
+
})]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function ComboboxGroup({ className, ...props }) {
|
|
255
|
+
return /* @__PURE__ */ jsx(Combobox.Group, {
|
|
256
|
+
"data-slot": "combobox-group",
|
|
257
|
+
className: cn(className),
|
|
258
|
+
...props
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function ComboboxLabel({ className, ...props }) {
|
|
262
|
+
return /* @__PURE__ */ jsx(Combobox.GroupLabel, {
|
|
263
|
+
"data-slot": "combobox-label",
|
|
264
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
265
|
+
...props
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function ComboboxCollection({ ...props }) {
|
|
269
|
+
return /* @__PURE__ */ jsx(Combobox.Collection, {
|
|
270
|
+
"data-slot": "combobox-collection",
|
|
271
|
+
...props
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function ComboboxStatus({ loading = "Loading…", error = "Failed to load options", empty = "No options found", className, ...props }) {
|
|
275
|
+
const { isAsync, isLoading, isError } = useComboboxAsyncContext();
|
|
276
|
+
if (isLoading || isAsync && isError) return /* @__PURE__ */ jsx(Combobox.Status, {
|
|
277
|
+
"data-slot": "combobox-status",
|
|
278
|
+
className: cn("text-muted-foreground flex w-full items-center justify-center py-2 text-center text-sm", className),
|
|
279
|
+
...props,
|
|
280
|
+
children: isLoading ? loading : error
|
|
281
|
+
});
|
|
282
|
+
return /* @__PURE__ */ jsx(Combobox.Empty, {
|
|
283
|
+
"data-slot": "combobox-empty",
|
|
284
|
+
className: cn("text-muted-foreground group-data-empty/combobox-content:flex hidden w-full justify-center py-2 text-center text-sm", className),
|
|
285
|
+
...props,
|
|
286
|
+
children: empty
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ jsx(Combobox.Separator, {
|
|
291
|
+
"data-slot": "combobox-separator",
|
|
292
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
293
|
+
...props
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function ComboboxChips({ className, ref, ...props }) {
|
|
297
|
+
const attachAnchor = useAttachComboboxAnchor(ref);
|
|
298
|
+
return /* @__PURE__ */ jsx(Combobox.Chips, {
|
|
299
|
+
ref: attachAnchor,
|
|
300
|
+
"data-slot": "combobox-chips",
|
|
301
|
+
className: cn("border-input shadow-xs focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1.5 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40 flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border bg-transparent bg-clip-padding px-2.5 py-1.5 text-sm transition-[color,box-shadow]", className),
|
|
302
|
+
...props
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function ComboboxChip({ className, children, showRemove = true, ...props }) {
|
|
306
|
+
return /* @__PURE__ */ jsxs(Combobox.Chip, {
|
|
307
|
+
"data-slot": "combobox-chip",
|
|
308
|
+
className: cn("bg-muted text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0 flex h-[calc(--spacing(5.5))] w-fit items-center justify-center gap-1 whitespace-nowrap rounded-sm px-1.5 text-xs font-medium", className),
|
|
309
|
+
...props,
|
|
310
|
+
children: [children, showRemove && /* @__PURE__ */ jsx(Combobox.ChipRemove, {
|
|
311
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
312
|
+
variant: "ghost",
|
|
313
|
+
size: "icon-xs"
|
|
314
|
+
}),
|
|
315
|
+
className: "-ms-1 opacity-50 hover:opacity-100",
|
|
316
|
+
"data-slot": "combobox-chip-remove",
|
|
317
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
318
|
+
})]
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function ComboboxChipsInput({ className, ...props }) {
|
|
322
|
+
return /* @__PURE__ */ jsx(Combobox.Input, {
|
|
323
|
+
"data-slot": "combobox-chip-input",
|
|
324
|
+
className: cn("min-w-16 flex-1 outline-none", className),
|
|
325
|
+
...props
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
function useComboboxAnchor() {
|
|
329
|
+
return React$1.useRef(null);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
//#endregion
|
|
333
|
+
export { useComboboxAnchor as _, ComboboxClear as a, ComboboxGroup as c, ComboboxLabel as d, ComboboxList as f, ComboboxValue as g, ComboboxTrigger as h, ComboboxChipsInput as i, ComboboxInput as l, ComboboxStatus as m, ComboboxChip as n, ComboboxCollection as o, ComboboxSeparator as p, ComboboxChips as r, ComboboxContent as s, Combobox$1 as t, ComboboxItem as u };
|
|
334
|
+
//# sourceMappingURL=combobox-CnpyzZ7B.js.map
|