@bricks-toolkit/toolkit 0.1.1 → 0.1.2
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/README.md +9 -9
- package/dist/avatar/index.cjs +11 -1
- package/dist/avatar/index.mjs +2 -1
- package/dist/badge/index.cjs +11 -1
- package/dist/badge/index.mjs +2 -1
- package/dist/breadcrumbs/index.cjs +11 -1
- package/dist/breadcrumbs/index.mjs +2 -1
- package/dist/button/index.cjs +13 -2
- package/dist/button/index.mjs +4 -2
- package/dist/card/index.cjs +31 -1
- package/dist/card/index.mjs +2 -1
- package/dist/checkbox/index.cjs +11 -1
- package/dist/checkbox/index.mjs +2 -1
- package/dist/chunk-2POU3NX4.mjs +192 -0
- package/dist/chunk-32SKYPQW.mjs +156 -0
- package/dist/chunk-446OJWC6.mjs +285 -0
- package/dist/chunk-4DA7CRNV.mjs +376 -0
- package/dist/chunk-4DR57X7U.mjs +182 -0
- package/dist/chunk-4QSDPHPI.mjs +285 -0
- package/dist/chunk-56ILK7Y4.cjs +315 -0
- package/dist/chunk-5J3OMAO4.cjs +222 -0
- package/dist/chunk-5RKET2JO.cjs +287 -0
- package/dist/chunk-65UZC3FK.mjs +312 -0
- package/dist/chunk-6CC5KIA5.cjs +148 -0
- package/dist/chunk-6R3OYBQ6.cjs +209 -0
- package/dist/chunk-6UO72EJA.cjs +2 -0
- package/dist/chunk-6ZCY4O5M.mjs +63 -0
- package/dist/chunk-7364SUK6.mjs +359 -0
- package/dist/chunk-7DDDQ3RH.cjs +66 -0
- package/dist/chunk-7PDGAIC3.cjs +189 -0
- package/dist/chunk-7R5JRJ2W.cjs +255 -0
- package/dist/chunk-7WNJ7L4Z.mjs +335 -0
- package/dist/chunk-AJXVELXK.cjs +218 -0
- package/dist/chunk-ARTXRQO6.mjs +1 -0
- package/dist/chunk-B4OV5GRT.cjs +510 -0
- package/dist/chunk-B5MYGYJY.mjs +122 -0
- package/dist/chunk-BBVWG5GH.cjs +75 -0
- package/dist/chunk-BVBCAAES.mjs +35 -0
- package/dist/chunk-CBA54EY4.mjs +508 -0
- package/dist/chunk-CMER5LO3.mjs +330 -0
- package/dist/chunk-DHC5LI2P.cjs +338 -0
- package/dist/chunk-DMLPA65B.mjs +107 -0
- package/dist/chunk-DN2GFJF4.mjs +175 -0
- package/dist/chunk-ECLNLPOR.cjs +70 -0
- package/dist/chunk-EV463QT5.cjs +53 -0
- package/dist/chunk-FOVJHEWH.mjs +51 -0
- package/dist/chunk-G4HVY6FM.mjs +203 -0
- package/dist/chunk-H77YWN3L.mjs +220 -0
- package/dist/chunk-HIWJDLIS.cjs +124 -0
- package/dist/chunk-HQGDSOSN.mjs +274 -0
- package/dist/chunk-JKPNJ4PZ.mjs +313 -0
- package/dist/chunk-JV6AWBN5.mjs +113 -0
- package/dist/chunk-KA35BV7V.mjs +207 -0
- package/dist/chunk-KLBABQEJ.cjs +378 -0
- package/dist/chunk-L5VQZZVR.cjs +3197 -0
- package/dist/chunk-LTG6YP5I.cjs +69 -0
- package/dist/chunk-MVUNJPGH.cjs +184 -0
- package/dist/chunk-NMJ5CVZH.cjs +2 -0
- package/dist/chunk-NRCNRHXL.cjs +109 -0
- package/dist/chunk-NRZIXK35.cjs +276 -0
- package/dist/chunk-OCPFOFJ4.mjs +3195 -0
- package/dist/chunk-OEU5VG3D.cjs +362 -0
- package/dist/chunk-OPOCCRJG.cjs +193 -0
- package/dist/chunk-OQPCL5XX.mjs +187 -0
- package/dist/chunk-PCYGJNEQ.cjs +280 -0
- package/dist/chunk-PJH2KEWK.mjs +200 -0
- package/dist/chunk-PJWELBN2.cjs +115 -0
- package/dist/chunk-Q3IFXFFD.cjs +202 -0
- package/dist/chunk-R72GDCWE.cjs +314 -0
- package/dist/chunk-RAD5VJHR.mjs +146 -0
- package/dist/chunk-RYWDZHKG.mjs +274 -0
- package/dist/chunk-S7VEND5Z.cjs +162 -0
- package/dist/chunk-SBNNV6FE.mjs +1 -0
- package/dist/chunk-SFUOCZJY.mjs +187 -0
- package/dist/chunk-SHQ2MPBE.mjs +73 -0
- package/dist/chunk-TIVSMCXZ.mjs +253 -0
- package/dist/chunk-TNGW5YHA.cjs +37 -0
- package/dist/chunk-VC7MOPU6.cjs +287 -0
- package/dist/chunk-VHVFRWF5.mjs +64 -0
- package/dist/chunk-VKQDW7C2.mjs +336 -0
- package/dist/chunk-VRZFAKSV.cjs +177 -0
- package/dist/chunk-W2ZAPLQH.cjs +337 -0
- package/dist/chunk-XFNRKHHF.cjs +332 -0
- package/dist/chunk-Y3NTKFUE.mjs +66 -0
- package/dist/chunk-Y6AN7AWX.cjs +205 -0
- package/dist/chunk-YMMNWJT6.cjs +134 -0
- package/dist/chunk-YOTCXSXL.mjs +132 -0
- package/dist/combo-box/index.cjs +11 -1
- package/dist/combo-box/index.mjs +2 -1
- package/dist/date-picker/index.cjs +11 -2
- package/dist/date-picker/index.mjs +2 -2
- package/dist/dialog/index.cjs +27 -1
- package/dist/dialog/index.mjs +2 -1
- package/dist/dropdown-menu/index.cjs +27 -1
- package/dist/dropdown-menu/index.mjs +2 -1
- package/dist/email/index.cjs +11 -2
- package/dist/email/index.mjs +2 -2
- package/dist/file-upload/index.cjs +11 -1
- package/dist/file-upload/index.mjs +2 -1
- package/dist/header/index.cjs +14 -2
- package/dist/header/index.mjs +5 -2
- package/dist/icon-button/index.cjs +13 -2
- package/dist/icon-button/index.mjs +4 -2
- package/dist/image/index.cjs +12 -1
- package/dist/image/index.mjs +3 -1
- package/dist/index.cjs +839 -2
- package/dist/index.d.ts +141 -75
- package/dist/index.mjs +601 -2
- package/dist/link/index.cjs +11 -1
- package/dist/link/index.mjs +2 -1
- package/dist/loader/index.cjs +11 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/modal/index.cjs +27 -1
- package/dist/modal/index.mjs +2 -1
- package/dist/multi-select/index.cjs +11 -2
- package/dist/multi-select/index.mjs +2 -2
- package/dist/otp-input/index.cjs +11 -1
- package/dist/otp-input/index.mjs +2 -1
- package/dist/password-input/index.cjs +11 -2
- package/dist/password-input/index.mjs +2 -2
- package/dist/phone/index.cjs +11 -2
- package/dist/phone/index.mjs +2 -2
- package/dist/radio-button/index.cjs +11 -1
- package/dist/radio-button/index.mjs +2 -1
- package/dist/search-input/index.cjs +12 -2
- package/dist/search-input/index.mjs +3 -2
- package/dist/select/index.cjs +11 -2
- package/dist/select/index.mjs +2 -2
- package/dist/sidebar/index.cjs +11 -1
- package/dist/sidebar/index.mjs +2 -1
- package/dist/skeleton/index.cjs +27 -1
- package/dist/skeleton/index.mjs +2 -1
- package/dist/styles.css +5074 -1
- package/dist/table/index.cjs +15 -1
- package/dist/table/index.mjs +2 -1
- package/dist/tabs/index.cjs +14 -2
- package/dist/tabs/index.mjs +5 -2
- package/dist/text-input/index.cjs +11 -2
- package/dist/text-input/index.mjs +2 -2
- package/dist/theme-provider/index.cjs +14 -1
- package/dist/theme-provider/index.mjs +1 -1
- package/dist/time-picker/index.cjs +11 -2
- package/dist/time-picker/index.mjs +2 -2
- package/dist/toaster/index.cjs +11 -1
- package/dist/toaster/index.mjs +2 -1
- package/dist/tooltip/index.cjs +12 -1
- package/dist/tooltip/index.mjs +3 -1
- package/package.json +122 -141
- package/dist/components/Accordion/Accordion.d.ts +0 -5
- package/dist/components/Accordion/Accordion.types.d.ts +0 -32
- package/dist/components/Accordion/index.d.ts +0 -2
- package/dist/components/Avatar/Avatar.d.ts +0 -2
- package/dist/components/Avatar/Avatar.stories.d.ts +0 -11
- package/dist/components/Avatar/Avatar.test.d.ts +0 -1
- package/dist/components/Avatar/Avatar.types.d.ts +0 -24
- package/dist/components/Avatar/index.d.ts +0 -2
- package/dist/components/Badge/Badge.d.ts +0 -11
- package/dist/components/Badge/Badge.stories.d.ts +0 -21
- package/dist/components/Badge/Badge.test.d.ts +0 -1
- package/dist/components/Badge/Badge.types.d.ts +0 -43
- package/dist/components/Badge/index.d.ts +0 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.test.d.ts +0 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +0 -27
- package/dist/components/Breadcrumbs/index.d.ts +0 -2
- package/dist/components/Button/Button.d.ts +0 -2
- package/dist/components/Button/Button.stories.d.ts +0 -20
- package/dist/components/Button/Button.test.d.ts +0 -1
- package/dist/components/Button/Button.types.d.ts +0 -24
- package/dist/components/Button/index.d.ts +0 -2
- package/dist/components/Card/Card.d.ts +0 -25
- package/dist/components/Card/Card.stories.d.ts +0 -8
- package/dist/components/Card/Card.test.d.ts +0 -1
- package/dist/components/Card/Card.types.d.ts +0 -14
- package/dist/components/Card/index.d.ts +0 -2
- package/dist/components/Checkbox/Checkbox.d.ts +0 -2
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -16
- package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.types.d.ts +0 -31
- package/dist/components/Checkbox/index.d.ts +0 -2
- package/dist/components/ComboBox/ComboBox.d.ts +0 -2
- package/dist/components/ComboBox/ComboBox.stories.d.ts +0 -12
- package/dist/components/ComboBox/ComboBox.test.d.ts +0 -1
- package/dist/components/ComboBox/ComboBox.types.d.ts +0 -57
- package/dist/components/ComboBox/index.d.ts +0 -2
- package/dist/components/DatePicker/DatePicker.d.ts +0 -2
- package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -25
- package/dist/components/DatePicker/DatePicker.test.d.ts +0 -1
- package/dist/components/DatePicker/DatePicker.types.d.ts +0 -27
- package/dist/components/DatePicker/index.d.ts +0 -2
- package/dist/components/Dialog/Dialog.d.ts +0 -6
- package/dist/components/Dialog/Dialog.stories.d.ts +0 -9
- package/dist/components/Dialog/Dialog.test.d.ts +0 -1
- package/dist/components/Dialog/Dialog.types.d.ts +0 -52
- package/dist/components/Dialog/index.d.ts +0 -2
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -7
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +0 -9
- package/dist/components/DropdownMenu/DropdownMenu.test.d.ts +0 -1
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +0 -24
- package/dist/components/DropdownMenu/index.d.ts +0 -2
- package/dist/components/Email/Email.d.ts +0 -2
- package/dist/components/Email/Email.stories.d.ts +0 -11
- package/dist/components/Email/Email.test.d.ts +0 -1
- package/dist/components/Email/Email.types.d.ts +0 -33
- package/dist/components/Email/index.d.ts +0 -2
- package/dist/components/FileUpload/FileUpload.d.ts +0 -2
- package/dist/components/FileUpload/FileUpload.stories.d.ts +0 -10
- package/dist/components/FileUpload/FileUpload.test.d.ts +0 -1
- package/dist/components/FileUpload/FileUpload.types.d.ts +0 -22
- package/dist/components/FileUpload/index.d.ts +0 -2
- package/dist/components/Header/Header.d.ts +0 -7
- package/dist/components/Header/Header.stories.d.ts +0 -8
- package/dist/components/Header/Header.test.d.ts +0 -1
- package/dist/components/Header/Header.types.d.ts +0 -19
- package/dist/components/Header/index.d.ts +0 -2
- package/dist/components/IconButton/IconButton.d.ts +0 -2
- package/dist/components/IconButton/IconButton.stories.d.ts +0 -17
- package/dist/components/IconButton/IconButton.types.d.ts +0 -10
- package/dist/components/IconButton/index.d.ts +0 -2
- package/dist/components/Image/Image.d.ts +0 -6
- package/dist/components/Image/Image.stories.d.ts +0 -13
- package/dist/components/Image/Image.test.d.ts +0 -1
- package/dist/components/Image/Image.types.d.ts +0 -40
- package/dist/components/Image/index.d.ts +0 -2
- package/dist/components/Link/Link.d.ts +0 -2
- package/dist/components/Link/Link.stories.d.ts +0 -15
- package/dist/components/Link/Link.test.d.ts +0 -1
- package/dist/components/Link/Link.types.d.ts +0 -20
- package/dist/components/Link/index.d.ts +0 -2
- package/dist/components/Loader/Loader.d.ts +0 -2
- package/dist/components/Loader/Loader.stories.d.ts +0 -12
- package/dist/components/Loader/Loader.test.d.ts +0 -1
- package/dist/components/Loader/Loader.types.d.ts +0 -17
- package/dist/components/Loader/index.d.ts +0 -2
- package/dist/components/Modal/Modal.d.ts +0 -14
- package/dist/components/Modal/Modal.stories.d.ts +0 -14
- package/dist/components/Modal/Modal.test.d.ts +0 -1
- package/dist/components/Modal/Modal.types.d.ts +0 -100
- package/dist/components/Modal/index.d.ts +0 -2
- package/dist/components/MultiSelect/MultiSelect.d.ts +0 -2
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -15
- package/dist/components/MultiSelect/MultiSelect.test.d.ts +0 -1
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +0 -55
- package/dist/components/MultiSelect/index.d.ts +0 -2
- package/dist/components/OtpInput/OtpInput.d.ts +0 -2
- package/dist/components/OtpInput/OtpInput.stories.d.ts +0 -10
- package/dist/components/OtpInput/OtpInput.test.d.ts +0 -1
- package/dist/components/OtpInput/OtpInput.types.d.ts +0 -53
- package/dist/components/OtpInput/index.d.ts +0 -2
- package/dist/components/PasswordInput/PasswordInput.d.ts +0 -2
- package/dist/components/PasswordInput/PasswordInput.stories.d.ts +0 -23
- package/dist/components/PasswordInput/PasswordInput.test.d.ts +0 -1
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +0 -27
- package/dist/components/PasswordInput/index.d.ts +0 -2
- package/dist/components/Phone/Phone.d.ts +0 -2
- package/dist/components/Phone/Phone.stories.d.ts +0 -11
- package/dist/components/Phone/Phone.test.d.ts +0 -1
- package/dist/components/Phone/Phone.types.d.ts +0 -36
- package/dist/components/Phone/countries.d.ts +0 -8
- package/dist/components/Phone/index.d.ts +0 -2
- package/dist/components/RadioButton/RadioButton.d.ts +0 -2
- package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -21
- package/dist/components/RadioButton/RadioButton.test.d.ts +0 -1
- package/dist/components/RadioButton/RadioButton.types.d.ts +0 -51
- package/dist/components/RadioButton/index.d.ts +0 -2
- package/dist/components/SearchInput/SearchInput.d.ts +0 -6
- package/dist/components/SearchInput/SearchInput.stories.d.ts +0 -8
- package/dist/components/SearchInput/SearchInput.test.d.ts +0 -1
- package/dist/components/SearchInput/SearchInput.types.d.ts +0 -12
- package/dist/components/SearchInput/index.d.ts +0 -2
- package/dist/components/Select/Select.d.ts +0 -2
- package/dist/components/Select/Select.stories.d.ts +0 -12
- package/dist/components/Select/Select.test.d.ts +0 -1
- package/dist/components/Select/Select.types.d.ts +0 -31
- package/dist/components/Select/index.d.ts +0 -2
- package/dist/components/Sidebar/Sidebar.d.ts +0 -7
- package/dist/components/Sidebar/Sidebar.stories.d.ts +0 -10
- package/dist/components/Sidebar/Sidebar.test.d.ts +0 -1
- package/dist/components/Sidebar/Sidebar.types.d.ts +0 -87
- package/dist/components/Sidebar/index.d.ts +0 -2
- package/dist/components/Skeleton/Skeleton.d.ts +0 -26
- package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -13
- package/dist/components/Skeleton/Skeleton.types.d.ts +0 -47
- package/dist/components/Skeleton/index.d.ts +0 -2
- package/dist/components/Stepper/Stepper.d.ts +0 -2
- package/dist/components/Stepper/Stepper.stories.d.ts +0 -23
- package/dist/components/Stepper/Stepper.test.d.ts +0 -1
- package/dist/components/Stepper/Stepper.types.d.ts +0 -47
- package/dist/components/Stepper/index.d.ts +0 -2
- package/dist/components/Table/Pagination.d.ts +0 -3
- package/dist/components/Table/Table.d.ts +0 -3
- package/dist/components/Table/Table.stories.d.ts +0 -13
- package/dist/components/Table/Table.test.d.ts +0 -1
- package/dist/components/Table/Table.types.d.ts +0 -85
- package/dist/components/Table/index.d.ts +0 -3
- package/dist/components/Tabs/Tabs.d.ts +0 -2
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -17
- package/dist/components/Tabs/Tabs.test.d.ts +0 -1
- package/dist/components/Tabs/Tabs.types.d.ts +0 -21
- package/dist/components/Tabs/index.d.ts +0 -2
- package/dist/components/TextInput/TextInput.d.ts +0 -2
- package/dist/components/TextInput/TextInput.stories.d.ts +0 -25
- package/dist/components/TextInput/TextInput.test.d.ts +0 -1
- package/dist/components/TextInput/TextInput.types.d.ts +0 -29
- package/dist/components/TextInput/index.d.ts +0 -2
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +0 -8
- package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +0 -16
- package/dist/components/ThemeProvider/ThemeProvider.test.d.ts +0 -1
- package/dist/components/ThemeProvider/ThemeProvider.types.d.ts +0 -112
- package/dist/components/ThemeProvider/index.d.ts +0 -2
- package/dist/components/TimePicker/TimePicker.d.ts +0 -2
- package/dist/components/TimePicker/TimePicker.stories.d.ts +0 -23
- package/dist/components/TimePicker/TimePicker.test.d.ts +0 -1
- package/dist/components/TimePicker/TimePicker.types.d.ts +0 -27
- package/dist/components/TimePicker/index.d.ts +0 -2
- package/dist/components/Toaster/Toaster.d.ts +0 -2
- package/dist/components/Toaster/Toaster.stories.d.ts +0 -13
- package/dist/components/Toaster/Toaster.test.d.ts +0 -1
- package/dist/components/Toaster/Toaster.types.d.ts +0 -23
- package/dist/components/Toaster/index.d.ts +0 -2
- package/dist/components/Toggle/Toggle.d.ts +0 -2
- package/dist/components/Toggle/Toggle.stories.d.ts +0 -11
- package/dist/components/Toggle/Toggle.types.d.ts +0 -10
- package/dist/components/Toggle/index.d.ts +0 -2
- package/dist/components/Tooltip/Tooltip.d.ts +0 -2
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -13
- package/dist/components/Tooltip/Tooltip.test.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +0 -33
- package/dist/components/Tooltip/index.d.ts +0 -2
- package/dist/utils/cn.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var cardVariantClasses = {
|
|
6
|
+
default: "bg-surface text-text border border-border shadow-sm",
|
|
7
|
+
outlined: "bg-surface text-text border border-border",
|
|
8
|
+
elevated: "bg-surface text-text border-transparent shadow-md",
|
|
9
|
+
filled: "bg-surface-secondary border-transparent text-text-secondary"
|
|
10
|
+
};
|
|
11
|
+
var cardPaddingClasses = {
|
|
12
|
+
none: "p-0",
|
|
13
|
+
sm: "p-2",
|
|
14
|
+
md: "p-4",
|
|
15
|
+
lg: "p-6",
|
|
16
|
+
xl: "p-8"
|
|
17
|
+
};
|
|
18
|
+
var Card = forwardRef(function Card2({ className, variant = "default", padding = "none", ...props }, ref) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
ref,
|
|
23
|
+
className: cn(
|
|
24
|
+
"rounded-lg flex flex-col transition-all duration-normal",
|
|
25
|
+
cardVariantClasses[variant],
|
|
26
|
+
cardPaddingClasses[padding],
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
Card.displayName = "Card";
|
|
34
|
+
var CardHeader = forwardRef(function CardHeader2({ className, ...props }, ref) {
|
|
35
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col space-y-1 p-4", className), ...props });
|
|
36
|
+
});
|
|
37
|
+
CardHeader.displayName = "CardHeader";
|
|
38
|
+
var CardTitle = forwardRef(function CardTitle2({ className, children, ...props }, ref) {
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
"h3",
|
|
41
|
+
{
|
|
42
|
+
ref,
|
|
43
|
+
className: cn("font-bold leading-none tracking-tight text-lg text-text", className),
|
|
44
|
+
...props,
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
CardTitle.displayName = "CardTitle";
|
|
50
|
+
var CardDescription = forwardRef(function CardDescription2({ className, ...props }, ref) {
|
|
51
|
+
return /* @__PURE__ */ jsx("p", { ref, className: cn("text-sm text-text-secondary", className), ...props });
|
|
52
|
+
});
|
|
53
|
+
CardDescription.displayName = "CardDescription";
|
|
54
|
+
var CardContent = forwardRef(function CardContent2({ className, ...props }, ref) {
|
|
55
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("p-4 pt-0", className), ...props });
|
|
56
|
+
});
|
|
57
|
+
CardContent.displayName = "CardContent";
|
|
58
|
+
var CardFooter = forwardRef(function CardFooter2({ className, ...props }, ref) {
|
|
59
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center p-4 pt-0", className), ...props });
|
|
60
|
+
});
|
|
61
|
+
CardFooter.displayName = "CardFooter";
|
|
62
|
+
|
|
63
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
2
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
3
|
+
import { ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/20/solid';
|
|
4
|
+
import { ChevronDoubleLeftIcon, ChevronLeftIcon, ChevronRightIcon, ChevronDoubleRightIcon } from '@heroicons/react/24/outline';
|
|
5
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var DEFAULT_PAGE_SIZES = [10, 20, 50];
|
|
8
|
+
function Pagination({
|
|
9
|
+
total,
|
|
10
|
+
page,
|
|
11
|
+
pageSize,
|
|
12
|
+
totalPages: propTotalPages,
|
|
13
|
+
hasNextPage: propHasNextPage,
|
|
14
|
+
hasPrevPage: propHasPrevPage,
|
|
15
|
+
onPageChange,
|
|
16
|
+
onPageSizeChange,
|
|
17
|
+
pageSizeOptions = DEFAULT_PAGE_SIZES,
|
|
18
|
+
showSizeChanger,
|
|
19
|
+
className
|
|
20
|
+
}) {
|
|
21
|
+
const totalPages = propTotalPages ?? Math.max(1, Math.ceil(total / pageSize));
|
|
22
|
+
const canPrev = propHasPrevPage ?? page > 1;
|
|
23
|
+
const canNext = propHasNextPage ?? page < totalPages;
|
|
24
|
+
const pageNumbers = buildPageNumbers(page, totalPages);
|
|
25
|
+
const from = Math.min((page - 1) * pageSize + 1, total);
|
|
26
|
+
const to = Math.min(page * pageSize, total);
|
|
27
|
+
const showPicker = showSizeChanger ?? onPageSizeChange != null;
|
|
28
|
+
return /* @__PURE__ */ jsxs(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: cn(
|
|
32
|
+
"flex flex-col sm:flex-row items-center justify-between gap-3 py-3 px-4 border-t border-border bg-surface-secondary/50 rounded-b-xl text-sm",
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx("p", { className: "text-text-secondary shrink-0", children: total === 0 ? "No items" : `${String(from)}\u2013${String(to)} of ${String(total)} items` }),
|
|
37
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap justify-center", children: [
|
|
38
|
+
showPicker && onPageSizeChange != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
39
|
+
/* @__PURE__ */ jsx("span", { className: "text-text-muted", children: "Rows:" }),
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
"select",
|
|
42
|
+
{
|
|
43
|
+
value: pageSize,
|
|
44
|
+
"aria-label": "Rows per page",
|
|
45
|
+
onChange: (e) => {
|
|
46
|
+
onPageSizeChange(Number(e.target.value));
|
|
47
|
+
},
|
|
48
|
+
className: "border border-border rounded-sm py-1 pl-2 pr-6 text-sm text-text bg-surface focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary cursor-pointer transition-all duration-normal",
|
|
49
|
+
children: pageSizeOptions.map((s) => /* @__PURE__ */ jsx("option", { value: s, children: s }, s))
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsxs("nav", { "aria-label": "Pagination", className: "flex items-center gap-1", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
PageButton,
|
|
56
|
+
{
|
|
57
|
+
onClick: () => {
|
|
58
|
+
onPageChange(1);
|
|
59
|
+
},
|
|
60
|
+
disabled: !canPrev,
|
|
61
|
+
"aria-label": "First page",
|
|
62
|
+
children: /* @__PURE__ */ jsx(ChevronDoubleLeftIcon, { className: "w-3.5 h-3.5" })
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
PageButton,
|
|
67
|
+
{
|
|
68
|
+
onClick: () => {
|
|
69
|
+
onPageChange(page - 1);
|
|
70
|
+
},
|
|
71
|
+
disabled: !canPrev,
|
|
72
|
+
"aria-label": "Previous page",
|
|
73
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "w-3.5 h-3.5" })
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
pageNumbers.map(
|
|
77
|
+
(num, idx) => num === "\u2026" ? /* @__PURE__ */ jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
className: "w-8 text-center text-text-muted/60 select-none",
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
children: "\u2026"
|
|
83
|
+
},
|
|
84
|
+
`ellipsis-${String(idx)}`
|
|
85
|
+
) : /* @__PURE__ */ jsx(
|
|
86
|
+
PageButton,
|
|
87
|
+
{
|
|
88
|
+
onClick: () => {
|
|
89
|
+
onPageChange(num);
|
|
90
|
+
},
|
|
91
|
+
active: num === page,
|
|
92
|
+
"aria-label": `Page ${String(num)}`,
|
|
93
|
+
"aria-current": num === page ? "page" : void 0,
|
|
94
|
+
children: num
|
|
95
|
+
},
|
|
96
|
+
num
|
|
97
|
+
)
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
PageButton,
|
|
101
|
+
{
|
|
102
|
+
onClick: () => {
|
|
103
|
+
onPageChange(page + 1);
|
|
104
|
+
},
|
|
105
|
+
disabled: !canNext,
|
|
106
|
+
"aria-label": "Next page",
|
|
107
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "w-3.5 h-3.5" })
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsx(
|
|
111
|
+
PageButton,
|
|
112
|
+
{
|
|
113
|
+
onClick: () => {
|
|
114
|
+
onPageChange(totalPages);
|
|
115
|
+
},
|
|
116
|
+
disabled: !canNext,
|
|
117
|
+
"aria-label": "Last page",
|
|
118
|
+
children: /* @__PURE__ */ jsx(ChevronDoubleRightIcon, { className: "w-3.5 h-3.5" })
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] })
|
|
122
|
+
] })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function PageButton({
|
|
128
|
+
children,
|
|
129
|
+
active = false,
|
|
130
|
+
disabled = false,
|
|
131
|
+
className,
|
|
132
|
+
...rest
|
|
133
|
+
}) {
|
|
134
|
+
return /* @__PURE__ */ jsx(
|
|
135
|
+
"button",
|
|
136
|
+
{
|
|
137
|
+
type: "button",
|
|
138
|
+
disabled,
|
|
139
|
+
className: cn(
|
|
140
|
+
"min-w-[32px] h-8 px-2 rounded-sm font-medium transition-all duration-normal text-sm flex items-center justify-center",
|
|
141
|
+
active ? "bg-primary text-text-inverse shadow-sm" : "text-text-secondary hover:bg-hover active:bg-active",
|
|
142
|
+
disabled && "opacity-40 cursor-not-allowed pointer-events-none",
|
|
143
|
+
className
|
|
144
|
+
),
|
|
145
|
+
...rest,
|
|
146
|
+
children
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function buildPageNumbers(current, total) {
|
|
151
|
+
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
152
|
+
const pages = [1];
|
|
153
|
+
if (current > 3) pages.push("\u2026");
|
|
154
|
+
const start = Math.max(2, current - 1);
|
|
155
|
+
const end = Math.min(total - 1, current + 1);
|
|
156
|
+
for (let i = start; i <= end; i++) pages.push(i);
|
|
157
|
+
if (current < total - 2) pages.push("\u2026");
|
|
158
|
+
pages.push(total);
|
|
159
|
+
return pages;
|
|
160
|
+
}
|
|
161
|
+
var cellPadding = {
|
|
162
|
+
sm: "px-3 py-1.5 text-xs",
|
|
163
|
+
md: "px-4 py-3 text-sm",
|
|
164
|
+
lg: "px-5 py-4 text-base"
|
|
165
|
+
};
|
|
166
|
+
var headerPadding = {
|
|
167
|
+
sm: "px-3 py-2 text-xs",
|
|
168
|
+
md: "px-4 py-3 text-sm",
|
|
169
|
+
lg: "px-5 py-4 text-base"
|
|
170
|
+
};
|
|
171
|
+
function SortIcon({ direction }) {
|
|
172
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "inline-flex flex-col ml-1 -space-y-1.5", children: [
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
ChevronUpIcon,
|
|
175
|
+
{
|
|
176
|
+
className: cn(
|
|
177
|
+
"w-3.5 h-3.5 transition-all duration-normal",
|
|
178
|
+
direction === "asc" ? "text-primary" : "text-text-muted/30"
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
/* @__PURE__ */ jsx(
|
|
183
|
+
ChevronDownIcon,
|
|
184
|
+
{
|
|
185
|
+
className: cn(
|
|
186
|
+
"w-3.5 h-3.5 transition-all duration-normal",
|
|
187
|
+
direction === "desc" ? "text-primary" : "text-text-muted/30"
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
] });
|
|
192
|
+
}
|
|
193
|
+
function SkeletonRows({ cols, size }) {
|
|
194
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 5 }).map((_, ri) => /* @__PURE__ */ jsx("tr", { children: Array.from({ length: cols }).map((__, ci) => /* @__PURE__ */ jsx("td", { className: cellPadding[size], children: /* @__PURE__ */ jsx(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
className: "h-4 bg-surface-secondary rounded-sm animate-pulse",
|
|
198
|
+
style: { width: `${String(Math.floor(60 + Math.random() * 30))}%` }
|
|
199
|
+
}
|
|
200
|
+
) }, ci)) }, ri)) });
|
|
201
|
+
}
|
|
202
|
+
function Table({
|
|
203
|
+
data,
|
|
204
|
+
columns,
|
|
205
|
+
rowKey,
|
|
206
|
+
loading = false,
|
|
207
|
+
emptyMessage = "No data",
|
|
208
|
+
striped = false,
|
|
209
|
+
bordered = false,
|
|
210
|
+
hoverable = true,
|
|
211
|
+
stickyHeader = false,
|
|
212
|
+
size = "md",
|
|
213
|
+
sortState: externalSort,
|
|
214
|
+
onSortChange,
|
|
215
|
+
className,
|
|
216
|
+
tableClassName,
|
|
217
|
+
pagination,
|
|
218
|
+
headerVariant = "light"
|
|
219
|
+
}) {
|
|
220
|
+
const [internalSort, setInternalSort] = useState(null);
|
|
221
|
+
const activeSort = externalSort ?? internalSort;
|
|
222
|
+
const handleHeaderClick = useCallback(
|
|
223
|
+
(col) => {
|
|
224
|
+
if (!col.sortable) return;
|
|
225
|
+
const next = {
|
|
226
|
+
key: col.key,
|
|
227
|
+
direction: activeSort?.key === col.key && activeSort.direction === "asc" ? "desc" : "asc"
|
|
228
|
+
};
|
|
229
|
+
if (onSortChange) {
|
|
230
|
+
onSortChange(next);
|
|
231
|
+
} else {
|
|
232
|
+
setInternalSort(next);
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
[activeSort, onSortChange]
|
|
236
|
+
);
|
|
237
|
+
const sortedData = useMemo(() => {
|
|
238
|
+
if (!activeSort || onSortChange) return data;
|
|
239
|
+
return [...data].sort((a, b) => {
|
|
240
|
+
const aVal = a[activeSort.key];
|
|
241
|
+
const bVal = b[activeSort.key];
|
|
242
|
+
const cmp = typeof aVal === "string" && typeof bVal === "string" ? aVal.localeCompare(bVal) : String(aVal).localeCompare(String(bVal));
|
|
243
|
+
return activeSort.direction === "asc" ? cmp : -cmp;
|
|
244
|
+
});
|
|
245
|
+
}, [data, activeSort, onSortChange]);
|
|
246
|
+
const isEmpty = !loading && sortedData.length === 0;
|
|
247
|
+
return /* @__PURE__ */ jsxs(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
className: cn(
|
|
251
|
+
"w-full overflow-hidden rounded-xl border border-border bg-surface shadow-sm transition-colors duration-normal",
|
|
252
|
+
bordered && "border",
|
|
253
|
+
className
|
|
254
|
+
),
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: cn("w-full border-collapse", tableClassName), children: [
|
|
257
|
+
/* @__PURE__ */ jsx("thead", { className: cn(stickyHeader && "sticky top-0 z-dropdown"), children: /* @__PURE__ */ jsx(
|
|
258
|
+
"tr",
|
|
259
|
+
{
|
|
260
|
+
className: cn(
|
|
261
|
+
"border-b border-border transition-colors duration-normal",
|
|
262
|
+
headerVariant === "light" ? "bg-surface-secondary" : "bg-black"
|
|
263
|
+
),
|
|
264
|
+
children: columns.map((col) => {
|
|
265
|
+
const isSorted = activeSort?.key === col.key;
|
|
266
|
+
const dir = isSorted ? activeSort.direction : null;
|
|
267
|
+
return /* @__PURE__ */ jsx(
|
|
268
|
+
"th",
|
|
269
|
+
{
|
|
270
|
+
scope: "col",
|
|
271
|
+
style: { width: col.width },
|
|
272
|
+
"aria-sort": isSorted ? dir === "asc" ? "ascending" : "descending" : col.sortable ? "none" : void 0,
|
|
273
|
+
className: cn(
|
|
274
|
+
headerPadding[size],
|
|
275
|
+
"font-black tracking-widest uppercase whitespace-nowrap select-none transition-all duration-normal",
|
|
276
|
+
headerVariant === "light" ? "text-text-secondary" : "text-white",
|
|
277
|
+
col.align === "center" && "text-center",
|
|
278
|
+
col.align === "right" && "text-right",
|
|
279
|
+
col.sortable && "cursor-pointer hover:bg-hover",
|
|
280
|
+
headerVariant === "dark" && col.sortable && "hover:bg-white/10",
|
|
281
|
+
bordered && "border border-border",
|
|
282
|
+
col.headerClassName
|
|
283
|
+
),
|
|
284
|
+
onClick: col.sortable ? () => {
|
|
285
|
+
handleHeaderClick(col);
|
|
286
|
+
} : void 0,
|
|
287
|
+
onKeyDown: col.sortable ? (e) => {
|
|
288
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
handleHeaderClick(col);
|
|
291
|
+
}
|
|
292
|
+
} : void 0,
|
|
293
|
+
tabIndex: col.sortable ? 0 : void 0,
|
|
294
|
+
children: /* @__PURE__ */ jsxs(
|
|
295
|
+
"span",
|
|
296
|
+
{
|
|
297
|
+
className: cn(
|
|
298
|
+
"flex items-center gap-1",
|
|
299
|
+
col.align === "center" && "justify-center",
|
|
300
|
+
col.align === "right" && "justify-end"
|
|
301
|
+
),
|
|
302
|
+
children: [
|
|
303
|
+
col.header,
|
|
304
|
+
col.sortable && /* @__PURE__ */ jsx(SortIcon, { direction: dir })
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
},
|
|
309
|
+
col.key
|
|
310
|
+
);
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
) }),
|
|
314
|
+
/* @__PURE__ */ jsx("tbody", { children: loading ? /* @__PURE__ */ jsx(SkeletonRows, { cols: columns.length, size }) : isEmpty ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
315
|
+
"td",
|
|
316
|
+
{
|
|
317
|
+
colSpan: columns.length,
|
|
318
|
+
className: "py-16 text-center text-text-muted text-sm font-medium",
|
|
319
|
+
children: emptyMessage
|
|
320
|
+
}
|
|
321
|
+
) }) : sortedData.map((row, ri) => /* @__PURE__ */ jsx(
|
|
322
|
+
"tr",
|
|
323
|
+
{
|
|
324
|
+
className: cn(
|
|
325
|
+
"border-b border-border-light last:border-0 transition-colors duration-fast",
|
|
326
|
+
striped && ri % 2 !== 0 && "bg-surface-secondary/40",
|
|
327
|
+
hoverable && "hover:bg-hover/60"
|
|
328
|
+
),
|
|
329
|
+
children: columns.map((col) => /* @__PURE__ */ jsx(
|
|
330
|
+
"td",
|
|
331
|
+
{
|
|
332
|
+
className: cn(
|
|
333
|
+
cellPadding[size],
|
|
334
|
+
"text-text font-medium",
|
|
335
|
+
col.align === "center" && "text-center",
|
|
336
|
+
col.align === "right" && "text-right",
|
|
337
|
+
bordered && "border border-border",
|
|
338
|
+
col.cellClassName
|
|
339
|
+
),
|
|
340
|
+
children: col.render ? col.render(row, ri) : (() => {
|
|
341
|
+
const v = row[col.key];
|
|
342
|
+
if (v === null || v === void 0) return "";
|
|
343
|
+
if (typeof v === "object") return JSON.stringify(v);
|
|
344
|
+
return String(v);
|
|
345
|
+
})()
|
|
346
|
+
},
|
|
347
|
+
col.key
|
|
348
|
+
))
|
|
349
|
+
},
|
|
350
|
+
rowKey(row)
|
|
351
|
+
)) })
|
|
352
|
+
] }) }),
|
|
353
|
+
pagination && /* @__PURE__ */ jsx(Pagination, { ...pagination })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export { Pagination, Table };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkXFNRKHHF_cjs = require('./chunk-XFNRKHHF.cjs');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var outline = require('@heroicons/react/24/outline');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
var SearchInput = react.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
debounce = 300,
|
|
11
|
+
onDebouncedChange,
|
|
12
|
+
onChange,
|
|
13
|
+
value: valueProp,
|
|
14
|
+
defaultValue,
|
|
15
|
+
clearable = true,
|
|
16
|
+
leftElement,
|
|
17
|
+
...rest
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const [innerValue, setInnerValue] = react.useState(
|
|
20
|
+
valueProp ?? defaultValue ?? ""
|
|
21
|
+
);
|
|
22
|
+
const [prevValueProp, setPrevValueProp] = react.useState(valueProp);
|
|
23
|
+
const [lastEmittedValue, setLastEmittedValue] = react.useState(
|
|
24
|
+
String(valueProp ?? defaultValue ?? "")
|
|
25
|
+
);
|
|
26
|
+
if (valueProp !== prevValueProp) {
|
|
27
|
+
setInnerValue(valueProp ?? "");
|
|
28
|
+
setPrevValueProp(valueProp);
|
|
29
|
+
setLastEmittedValue(String(valueProp ?? ""));
|
|
30
|
+
}
|
|
31
|
+
react.useEffect(() => {
|
|
32
|
+
if (String(innerValue) === lastEmittedValue) return;
|
|
33
|
+
const timer = setTimeout(() => {
|
|
34
|
+
if (onDebouncedChange) {
|
|
35
|
+
onDebouncedChange(String(innerValue));
|
|
36
|
+
setLastEmittedValue(String(innerValue));
|
|
37
|
+
}
|
|
38
|
+
}, debounce);
|
|
39
|
+
return () => {
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
};
|
|
42
|
+
}, [innerValue, debounce, onDebouncedChange, lastEmittedValue]);
|
|
43
|
+
const handleChange = (e) => {
|
|
44
|
+
setInnerValue(e.target.value);
|
|
45
|
+
if (onChange) {
|
|
46
|
+
onChange(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const defaultSearchIcon = /* @__PURE__ */ jsxRuntime.jsx(outline.MagnifyingGlassIcon, { className: "w-[18px] h-[18px] text-text-muted" });
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
chunkXFNRKHHF_cjs.TextInput,
|
|
52
|
+
{
|
|
53
|
+
...rest,
|
|
54
|
+
ref,
|
|
55
|
+
value: innerValue,
|
|
56
|
+
onChange: handleChange,
|
|
57
|
+
clearable,
|
|
58
|
+
leftElement: leftElement ?? defaultSearchIcon,
|
|
59
|
+
type: "text"
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
SearchInput.displayName = "SearchInput";
|
|
65
|
+
|
|
66
|
+
exports.SearchInput = SearchInput;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkL5VQZZVR_cjs = require('./chunk-L5VQZZVR.cjs');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var solid = require('@heroicons/react/16/solid');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
var sizeClasses = {
|
|
9
|
+
xs: "w-3.5 h-3.5",
|
|
10
|
+
sm: "w-4 h-4",
|
|
11
|
+
md: "w-5 h-5",
|
|
12
|
+
lg: "w-6 h-6",
|
|
13
|
+
xl: "w-7 h-7"
|
|
14
|
+
};
|
|
15
|
+
var labelSizeClasses = {
|
|
16
|
+
xs: "text-xs",
|
|
17
|
+
sm: "text-xs",
|
|
18
|
+
md: "text-sm",
|
|
19
|
+
lg: "text-sm",
|
|
20
|
+
xl: "text-base"
|
|
21
|
+
};
|
|
22
|
+
var descriptionSizeClasses = {
|
|
23
|
+
xs: "text-[10px]",
|
|
24
|
+
sm: "text-xs",
|
|
25
|
+
md: "text-sm",
|
|
26
|
+
lg: "text-base",
|
|
27
|
+
xl: "text-lg"
|
|
28
|
+
};
|
|
29
|
+
var stateClasses = {
|
|
30
|
+
default: "border-border text-accent focus:ring-accent/40",
|
|
31
|
+
error: "border-error text-error focus:ring-error/20",
|
|
32
|
+
success: "border-success text-success focus:ring-success/20",
|
|
33
|
+
warning: "border-warning text-warning focus:ring-warning/20"
|
|
34
|
+
};
|
|
35
|
+
var stateMessageClasses = {
|
|
36
|
+
default: "text-text-muted",
|
|
37
|
+
error: "text-error font-medium",
|
|
38
|
+
success: "text-success font-medium",
|
|
39
|
+
warning: "text-warning font-medium"
|
|
40
|
+
};
|
|
41
|
+
var disabledClasses = "disabled:opacity-50 disabled:bg-surface-secondary disabled:cursor-not-allowed disabled:border-border";
|
|
42
|
+
function getStateMessage(state, errorMessage, successMessage, warningMessage) {
|
|
43
|
+
if (state === "error" && errorMessage) return errorMessage;
|
|
44
|
+
if (state === "success" && successMessage) return successMessage;
|
|
45
|
+
if (state === "warning" && warningMessage) return warningMessage;
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
var Checkbox = react.forwardRef(function Checkbox2({
|
|
49
|
+
id: idProp,
|
|
50
|
+
label,
|
|
51
|
+
helperText,
|
|
52
|
+
errorMessage,
|
|
53
|
+
successMessage,
|
|
54
|
+
warningMessage,
|
|
55
|
+
size = "md",
|
|
56
|
+
state = "default",
|
|
57
|
+
indeterminate = false,
|
|
58
|
+
className,
|
|
59
|
+
containerClassName,
|
|
60
|
+
wrapperClassName,
|
|
61
|
+
inputClassName,
|
|
62
|
+
labelClassName,
|
|
63
|
+
messageClassName,
|
|
64
|
+
disabled = false,
|
|
65
|
+
required = false,
|
|
66
|
+
...rest
|
|
67
|
+
}, forwardedRef) {
|
|
68
|
+
const autoId = react.useId();
|
|
69
|
+
const inputId = idProp ?? `checkbox-${autoId.replace(/:/g, "")}`;
|
|
70
|
+
const helperId = `${inputId}-helper`;
|
|
71
|
+
const stateMessageId = `${inputId}-state`;
|
|
72
|
+
const internalRef = react.useRef(null);
|
|
73
|
+
const handleRef = (node) => {
|
|
74
|
+
internalRef.current = node;
|
|
75
|
+
if (typeof forwardedRef === "function") {
|
|
76
|
+
forwardedRef(node);
|
|
77
|
+
} else if (forwardedRef) {
|
|
78
|
+
forwardedRef.current = node;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
react.useEffect(() => {
|
|
82
|
+
if (internalRef.current) {
|
|
83
|
+
internalRef.current.indeterminate = indeterminate;
|
|
84
|
+
}
|
|
85
|
+
}, [indeterminate]);
|
|
86
|
+
const stateMessage = getStateMessage(state, errorMessage, successMessage, warningMessage);
|
|
87
|
+
const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null].filter(Boolean).join(" ") || void 0;
|
|
88
|
+
const hasDescription = helperText ?? stateMessage;
|
|
89
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: chunkL5VQZZVR_cjs.cn("relative flex items-start", containerClassName, wrapperClassName, className),
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex h-6 w-auto items-center justify-center", children: [
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
"input",
|
|
97
|
+
{
|
|
98
|
+
...rest,
|
|
99
|
+
ref: handleRef,
|
|
100
|
+
id: inputId,
|
|
101
|
+
type: "checkbox",
|
|
102
|
+
disabled,
|
|
103
|
+
required,
|
|
104
|
+
"aria-invalid": state === "error" ? true : void 0,
|
|
105
|
+
"aria-describedby": describedBy,
|
|
106
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
107
|
+
"peer appearance-none rounded-sm border bg-surface transition-all duration-normal",
|
|
108
|
+
"checked:bg-current checked:border-transparent",
|
|
109
|
+
"indeterminate:bg-current indeterminate:border-transparent",
|
|
110
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface",
|
|
111
|
+
sizeClasses[size],
|
|
112
|
+
stateClasses[state],
|
|
113
|
+
disabledClasses,
|
|
114
|
+
inputClassName
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
solid.CheckIcon,
|
|
120
|
+
{
|
|
121
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
122
|
+
"pointer-events-none absolute inset-0 m-auto text-text-inverse opacity-0 transition-opacity peer-checked:opacity-100",
|
|
123
|
+
size === "xs" ? "w-2.5 h-2.5" : size === "sm" ? "w-3 h-3" : size === "md" ? "w-3.5 h-3.5" : size === "lg" ? "w-4 h-4" : "w-5 h-5"
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
128
|
+
solid.MinusIcon,
|
|
129
|
+
{
|
|
130
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
131
|
+
"pointer-events-none absolute inset-0 m-auto text-text-inverse opacity-0 transition-opacity peer-indeterminate:opacity-100",
|
|
132
|
+
size === "xs" ? "w-2.5 h-2.5" : size === "sm" ? "w-3 h-3" : size === "md" ? "w-3.5 h-3.5" : size === "lg" ? "w-4 h-4" : "w-5 h-5"
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }),
|
|
137
|
+
(!!label || !!hasDescription) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-3 flex flex-col pt-0.5", children: [
|
|
138
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
139
|
+
"label",
|
|
140
|
+
{
|
|
141
|
+
htmlFor: inputId,
|
|
142
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
143
|
+
"font-bold leading-none text-text uppercase tracking-widest select-none",
|
|
144
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
145
|
+
labelSizeClasses[size],
|
|
146
|
+
labelClassName
|
|
147
|
+
),
|
|
148
|
+
children: [
|
|
149
|
+
label,
|
|
150
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
155
|
+
"p",
|
|
156
|
+
{
|
|
157
|
+
id: helperId,
|
|
158
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
159
|
+
"text-text-muted mt-1 font-medium",
|
|
160
|
+
disabled && "opacity-50",
|
|
161
|
+
descriptionSizeClasses[size],
|
|
162
|
+
messageClassName
|
|
163
|
+
),
|
|
164
|
+
children: helperText
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
stateMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
168
|
+
"p",
|
|
169
|
+
{
|
|
170
|
+
id: stateMessageId,
|
|
171
|
+
role: state === "error" ? "alert" : void 0,
|
|
172
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
173
|
+
"mt-1",
|
|
174
|
+
disabled && "opacity-50",
|
|
175
|
+
stateMessageClasses[state],
|
|
176
|
+
descriptionSizeClasses[size],
|
|
177
|
+
messageClassName
|
|
178
|
+
),
|
|
179
|
+
children: stateMessage
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] })
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
Checkbox.displayName = "Checkbox";
|
|
188
|
+
|
|
189
|
+
exports.Checkbox = Checkbox;
|