@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,107 @@
|
|
|
1
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ChevronRightIcon } from '@heroicons/react/20/solid';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var sizeClasses = {
|
|
7
|
+
xs: "text-xs",
|
|
8
|
+
sm: "text-sm",
|
|
9
|
+
md: "text-base",
|
|
10
|
+
lg: "text-lg"
|
|
11
|
+
};
|
|
12
|
+
var SEPARATORS = {
|
|
13
|
+
slash: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "select-none text-text-muted/60", children: "/" }),
|
|
14
|
+
chevron: /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true", className: "w-4 h-4 text-text-muted/60 shrink-0" }),
|
|
15
|
+
dot: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "select-none text-text-muted/60", children: "\xB7" })
|
|
16
|
+
};
|
|
17
|
+
function resolveSeparator(sep) {
|
|
18
|
+
if (typeof sep === "string" && sep in SEPARATORS) return SEPARATORS[sep];
|
|
19
|
+
return sep;
|
|
20
|
+
}
|
|
21
|
+
function Crumb({ item, isCurrent, size }) {
|
|
22
|
+
const baseClass = cn(
|
|
23
|
+
"inline-flex items-center gap-1 transition-colors leading-none",
|
|
24
|
+
sizeClasses[size],
|
|
25
|
+
isCurrent ? "font-bold text-text cursor-default" : item.disabled ? "text-text-muted cursor-not-allowed" : "text-primary hover:text-primary-hover hover:underline underline-offset-4 cursor-pointer"
|
|
26
|
+
);
|
|
27
|
+
if (isCurrent) {
|
|
28
|
+
return /* @__PURE__ */ jsx("span", { className: baseClass, "aria-current": "page", children: item.label });
|
|
29
|
+
}
|
|
30
|
+
if (item.disabled) {
|
|
31
|
+
return /* @__PURE__ */ jsx("span", { className: baseClass, children: item.label });
|
|
32
|
+
}
|
|
33
|
+
if (item.onClick != null) {
|
|
34
|
+
return /* @__PURE__ */ jsx("button", { type: "button", onClick: item.onClick, className: baseClass, children: item.label });
|
|
35
|
+
}
|
|
36
|
+
if (item.href != null) {
|
|
37
|
+
return /* @__PURE__ */ jsx("a", { href: item.href, className: baseClass, children: item.label });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx("span", { className: baseClass, children: item.label });
|
|
40
|
+
}
|
|
41
|
+
function Breadcrumbs({
|
|
42
|
+
items,
|
|
43
|
+
separator = "chevron",
|
|
44
|
+
size = "sm",
|
|
45
|
+
collapsible = false,
|
|
46
|
+
maxItems = 4,
|
|
47
|
+
className
|
|
48
|
+
}) {
|
|
49
|
+
const [expanded, setExpanded] = useState(false);
|
|
50
|
+
if (items.length === 0) return null;
|
|
51
|
+
const sep = resolveSeparator(separator);
|
|
52
|
+
let visibleItems;
|
|
53
|
+
let showEllipsis = false;
|
|
54
|
+
if (collapsible && !expanded && items.length > maxItems) {
|
|
55
|
+
const keep = Math.max(1, maxItems - 1);
|
|
56
|
+
visibleItems = items.slice(0, keep);
|
|
57
|
+
showEllipsis = true;
|
|
58
|
+
} else {
|
|
59
|
+
visibleItems = items;
|
|
60
|
+
}
|
|
61
|
+
const segments = [];
|
|
62
|
+
visibleItems.forEach((item, idx) => {
|
|
63
|
+
const isCurrent = !showEllipsis && idx === items.length - 1;
|
|
64
|
+
if (idx > 0) {
|
|
65
|
+
segments.push(
|
|
66
|
+
/* @__PURE__ */ jsx("li", { role: "presentation", className: "flex items-center", children: sep }, `sep-${String(idx)}`)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
segments.push(
|
|
70
|
+
/* @__PURE__ */ jsx("li", { className: "flex items-center", children: /* @__PURE__ */ jsx(Crumb, { item, isCurrent, size }) }, `item-${String(idx)}`)
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
if (showEllipsis) {
|
|
74
|
+
segments.push(
|
|
75
|
+
/* @__PURE__ */ jsx("li", { role: "presentation", className: "flex items-center", children: sep }, "sep-ellipsis")
|
|
76
|
+
);
|
|
77
|
+
segments.push(
|
|
78
|
+
/* @__PURE__ */ jsx("li", { className: "flex items-center", children: /* @__PURE__ */ jsx(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
type: "button",
|
|
82
|
+
"aria-label": "Show full path",
|
|
83
|
+
onClick: () => {
|
|
84
|
+
setExpanded(true);
|
|
85
|
+
},
|
|
86
|
+
className: cn(
|
|
87
|
+
"text-text-muted hover:text-text-secondary transition-colors leading-none px-1",
|
|
88
|
+
sizeClasses[size]
|
|
89
|
+
),
|
|
90
|
+
children: "\xB7\xB7\xB7"
|
|
91
|
+
}
|
|
92
|
+
) }, "ellipsis")
|
|
93
|
+
);
|
|
94
|
+
const last = items[items.length - 1];
|
|
95
|
+
if (last != null) {
|
|
96
|
+
segments.push(
|
|
97
|
+
/* @__PURE__ */ jsx("li", { role: "presentation", className: "flex items-center", children: sep }, "sep-last")
|
|
98
|
+
);
|
|
99
|
+
segments.push(
|
|
100
|
+
/* @__PURE__ */ jsx("li", { className: "flex items-center", children: /* @__PURE__ */ jsx(Crumb, { item: last, isCurrent: true, size }) }, "item-last")
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: cn("w-full", className), children: /* @__PURE__ */ jsx("ol", { className: cn("flex flex-wrap items-center gap-1", sizeClasses[size]), children: segments }) });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { Breadcrumbs };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
2
|
+
import { forwardRef, useId, useRef } from 'react';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var sizeClasses = {
|
|
6
|
+
sm: "w-4 h-4",
|
|
7
|
+
md: "w-5 h-5",
|
|
8
|
+
lg: "w-6 h-6"
|
|
9
|
+
};
|
|
10
|
+
var labelSizeClasses = {
|
|
11
|
+
sm: "text-xs",
|
|
12
|
+
md: "text-sm",
|
|
13
|
+
lg: "text-sm"
|
|
14
|
+
};
|
|
15
|
+
var stateClasses = {
|
|
16
|
+
default: "border-border text-accent focus:ring-accent/40 checked:border-accent checked:bg-accent",
|
|
17
|
+
error: "border-error text-error focus:ring-error/20 checked:border-error checked:bg-error",
|
|
18
|
+
success: "border-success text-success focus:ring-success/20 checked:border-success checked:bg-success",
|
|
19
|
+
warning: "border-warning text-warning focus:ring-warning/20 checked:border-warning checked:bg-warning"
|
|
20
|
+
};
|
|
21
|
+
var stateMessageClasses = {
|
|
22
|
+
default: "text-text-muted",
|
|
23
|
+
error: "text-error font-medium",
|
|
24
|
+
success: "text-success font-medium",
|
|
25
|
+
warning: "text-warning font-medium"
|
|
26
|
+
};
|
|
27
|
+
function getStateMessage(state, errorMessage, successMessage, warningMessage) {
|
|
28
|
+
if (state === "error" && errorMessage) return errorMessage;
|
|
29
|
+
if (state === "success" && successMessage) return successMessage;
|
|
30
|
+
if (state === "warning" && warningMessage) return warningMessage;
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
var RadioButton = forwardRef(function RadioButton2({
|
|
34
|
+
label,
|
|
35
|
+
required = false,
|
|
36
|
+
helperText,
|
|
37
|
+
errorMessage,
|
|
38
|
+
successMessage,
|
|
39
|
+
warningMessage,
|
|
40
|
+
size = "md",
|
|
41
|
+
state = "default",
|
|
42
|
+
className,
|
|
43
|
+
wrapperClassName,
|
|
44
|
+
inputClassName,
|
|
45
|
+
labelClassName,
|
|
46
|
+
helperClassName,
|
|
47
|
+
id: idProp,
|
|
48
|
+
disabled,
|
|
49
|
+
onClick,
|
|
50
|
+
onPointerDown,
|
|
51
|
+
onKeyDown,
|
|
52
|
+
...rest
|
|
53
|
+
}, ref) {
|
|
54
|
+
const generatedId = useId();
|
|
55
|
+
const inputId = idProp ?? generatedId;
|
|
56
|
+
const helperId = `${inputId}-helper`;
|
|
57
|
+
const stateMessageId = `${inputId}-state`;
|
|
58
|
+
const stateMessage = getStateMessage(state, errorMessage, successMessage, warningMessage);
|
|
59
|
+
const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null].filter(Boolean).join(" ") || void 0;
|
|
60
|
+
const wasChecked = useRef(false);
|
|
61
|
+
const handlePointerDown = (e) => {
|
|
62
|
+
wasChecked.current = e.currentTarget.checked;
|
|
63
|
+
if (onPointerDown) onPointerDown(e);
|
|
64
|
+
};
|
|
65
|
+
const handleKeyDown = (e) => {
|
|
66
|
+
if (e.key === " " || e.key === "Enter") {
|
|
67
|
+
wasChecked.current = e.currentTarget.checked;
|
|
68
|
+
}
|
|
69
|
+
if (onKeyDown) onKeyDown(e);
|
|
70
|
+
};
|
|
71
|
+
const handleClick = (e) => {
|
|
72
|
+
if (wasChecked.current) {
|
|
73
|
+
e.currentTarget.checked = false;
|
|
74
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(
|
|
75
|
+
window.HTMLInputElement.prototype,
|
|
76
|
+
"checked"
|
|
77
|
+
);
|
|
78
|
+
const nativeInputValueSetter = descriptor?.set;
|
|
79
|
+
if (nativeInputValueSetter) {
|
|
80
|
+
Reflect.apply(nativeInputValueSetter, e.currentTarget, [false]);
|
|
81
|
+
}
|
|
82
|
+
const event = new Event("change", { bubbles: true });
|
|
83
|
+
e.currentTarget.dispatchEvent(event);
|
|
84
|
+
}
|
|
85
|
+
if (onClick) onClick(e);
|
|
86
|
+
};
|
|
87
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", wrapperClassName, className), children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
89
|
+
/* @__PURE__ */ jsxs(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: cn("flex items-center justify-center shrink-0 relative", sizeClasses[size]),
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
"input",
|
|
96
|
+
{
|
|
97
|
+
ref,
|
|
98
|
+
...rest,
|
|
99
|
+
id: inputId,
|
|
100
|
+
type: "radio",
|
|
101
|
+
disabled,
|
|
102
|
+
"aria-invalid": state === "error" ? true : void 0,
|
|
103
|
+
"aria-describedby": describedBy,
|
|
104
|
+
required,
|
|
105
|
+
onClick: handleClick,
|
|
106
|
+
onPointerDown: handlePointerDown,
|
|
107
|
+
onKeyDown: handleKeyDown,
|
|
108
|
+
className: cn(
|
|
109
|
+
"peer m-0 appearance-none rounded-full border bg-surface transition-all overflow-hidden focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface disabled:cursor-not-allowed disabled:bg-surface-secondary disabled:border-border disabled:checked:bg-border",
|
|
110
|
+
sizeClasses[size],
|
|
111
|
+
stateClasses[state],
|
|
112
|
+
inputClassName
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute h-[1em] w-[1em] rounded-full text-[0.4em] text-text-inverse opacity-0 transition-opacity peer-checked:bg-current peer-checked:opacity-100 peer-disabled:peer-checked:bg-text-muted/40" })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
label !== void 0 && /* @__PURE__ */ jsxs(
|
|
121
|
+
"label",
|
|
122
|
+
{
|
|
123
|
+
htmlFor: inputId,
|
|
124
|
+
className: cn(
|
|
125
|
+
"font-bold leading-none text-text mt-[0.125rem] select-none uppercase tracking-widest",
|
|
126
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
127
|
+
labelSizeClasses[size],
|
|
128
|
+
labelClassName
|
|
129
|
+
),
|
|
130
|
+
children: [
|
|
131
|
+
label,
|
|
132
|
+
required && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }),
|
|
137
|
+
(helperText !== void 0 || stateMessage !== void 0) && /* @__PURE__ */ jsxs(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: cn(
|
|
141
|
+
"ml-6",
|
|
142
|
+
size === "sm" && "ml-6",
|
|
143
|
+
size === "md" && "ml-7",
|
|
144
|
+
size === "lg" && "ml-8"
|
|
145
|
+
),
|
|
146
|
+
children: [
|
|
147
|
+
helperText !== void 0 && /* @__PURE__ */ jsx(
|
|
148
|
+
"p",
|
|
149
|
+
{
|
|
150
|
+
id: helperId,
|
|
151
|
+
className: cn("text-xs leading-tight text-text-muted font-medium", helperClassName),
|
|
152
|
+
children: helperText
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
stateMessage !== void 0 && /* @__PURE__ */ jsx(
|
|
156
|
+
"p",
|
|
157
|
+
{
|
|
158
|
+
id: stateMessageId,
|
|
159
|
+
role: state === "error" ? "alert" : void 0,
|
|
160
|
+
className: cn(
|
|
161
|
+
"text-xs leading-tight mt-1 font-medium",
|
|
162
|
+
stateMessageClasses[state],
|
|
163
|
+
helperClassName
|
|
164
|
+
),
|
|
165
|
+
children: stateMessage
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
] });
|
|
172
|
+
});
|
|
173
|
+
RadioButton.displayName = "RadioButton";
|
|
174
|
+
|
|
175
|
+
export { RadioButton };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkL5VQZZVR_cjs = require('./chunk-L5VQZZVR.cjs');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
var cardVariantClasses = {
|
|
8
|
+
default: "bg-surface text-text border border-border shadow-sm",
|
|
9
|
+
outlined: "bg-surface text-text border border-border",
|
|
10
|
+
elevated: "bg-surface text-text border-transparent shadow-md",
|
|
11
|
+
filled: "bg-surface-secondary border-transparent text-text-secondary"
|
|
12
|
+
};
|
|
13
|
+
var cardPaddingClasses = {
|
|
14
|
+
none: "p-0",
|
|
15
|
+
sm: "p-2",
|
|
16
|
+
md: "p-4",
|
|
17
|
+
lg: "p-6",
|
|
18
|
+
xl: "p-8"
|
|
19
|
+
};
|
|
20
|
+
var Card = react.forwardRef(function Card2({ className, variant = "default", padding = "none", ...props }, ref) {
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
26
|
+
"rounded-lg flex flex-col transition-all duration-normal",
|
|
27
|
+
cardVariantClasses[variant],
|
|
28
|
+
cardPaddingClasses[padding],
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
Card.displayName = "Card";
|
|
36
|
+
var CardHeader = react.forwardRef(function CardHeader2({ className, ...props }, ref) {
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkL5VQZZVR_cjs.cn("flex flex-col space-y-1 p-4", className), ...props });
|
|
38
|
+
});
|
|
39
|
+
CardHeader.displayName = "CardHeader";
|
|
40
|
+
var CardTitle = react.forwardRef(function CardTitle2({ className, children, ...props }, ref) {
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
"h3",
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
className: chunkL5VQZZVR_cjs.cn("font-bold leading-none tracking-tight text-lg text-text", className),
|
|
46
|
+
...props,
|
|
47
|
+
children
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
CardTitle.displayName = "CardTitle";
|
|
52
|
+
var CardDescription = react.forwardRef(function CardDescription2({ className, ...props }, ref) {
|
|
53
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { ref, className: chunkL5VQZZVR_cjs.cn("text-sm text-text-secondary", className), ...props });
|
|
54
|
+
});
|
|
55
|
+
CardDescription.displayName = "CardDescription";
|
|
56
|
+
var CardContent = react.forwardRef(function CardContent2({ className, ...props }, ref) {
|
|
57
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkL5VQZZVR_cjs.cn("p-4 pt-0", className), ...props });
|
|
58
|
+
});
|
|
59
|
+
CardContent.displayName = "CardContent";
|
|
60
|
+
var CardFooter = react.forwardRef(function CardFooter2({ className, ...props }, ref) {
|
|
61
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkL5VQZZVR_cjs.cn("flex items-center p-4 pt-0", className), ...props });
|
|
62
|
+
});
|
|
63
|
+
CardFooter.displayName = "CardFooter";
|
|
64
|
+
|
|
65
|
+
exports.Card = Card;
|
|
66
|
+
exports.CardContent = CardContent;
|
|
67
|
+
exports.CardDescription = CardDescription;
|
|
68
|
+
exports.CardFooter = CardFooter;
|
|
69
|
+
exports.CardHeader = CardHeader;
|
|
70
|
+
exports.CardTitle = CardTitle;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTNGW5YHA_cjs = require('./chunk-TNGW5YHA.cjs');
|
|
4
|
+
var chunkL5VQZZVR_cjs = require('./chunk-L5VQZZVR.cjs');
|
|
5
|
+
var outline = require('@heroicons/react/24/outline');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
var Header = ({
|
|
9
|
+
logo,
|
|
10
|
+
children,
|
|
11
|
+
actions,
|
|
12
|
+
userSection,
|
|
13
|
+
isSticky = true,
|
|
14
|
+
className,
|
|
15
|
+
glass = false,
|
|
16
|
+
onMenuToggle
|
|
17
|
+
}) => {
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19
|
+
"header",
|
|
20
|
+
{
|
|
21
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
22
|
+
"h-16 flex items-center justify-between px-6 bg-surface border-b border-border transition-all duration-normal",
|
|
23
|
+
isSticky && "sticky top-0 z-index-sticky",
|
|
24
|
+
glass && "glass",
|
|
25
|
+
className
|
|
26
|
+
),
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
29
|
+
onMenuToggle && /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
chunkTNGW5YHA_cjs.IconButton,
|
|
31
|
+
{
|
|
32
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(outline.Bars3Icon, { className: "w-5 h-5" }),
|
|
33
|
+
"aria-label": "Toggle Menu",
|
|
34
|
+
variant: "ghost",
|
|
35
|
+
size: "sm",
|
|
36
|
+
onClick: onMenuToggle,
|
|
37
|
+
className: "lg:hidden"
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
logo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center", children: logo })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 max-w-xl px-8 hidden md:block", children }),
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
44
|
+
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1", children: actions }),
|
|
45
|
+
userSection && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center pl-2 ml-2 border-l border-border h-8", children: userSection })
|
|
46
|
+
] })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
Header.displayName = "Header";
|
|
52
|
+
|
|
53
|
+
exports.Header = Header;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IconButton } from './chunk-BVBCAAES.mjs';
|
|
2
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
3
|
+
import { Bars3Icon } from '@heroicons/react/24/outline';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var Header = ({
|
|
7
|
+
logo,
|
|
8
|
+
children,
|
|
9
|
+
actions,
|
|
10
|
+
userSection,
|
|
11
|
+
isSticky = true,
|
|
12
|
+
className,
|
|
13
|
+
glass = false,
|
|
14
|
+
onMenuToggle
|
|
15
|
+
}) => {
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
"header",
|
|
18
|
+
{
|
|
19
|
+
className: cn(
|
|
20
|
+
"h-16 flex items-center justify-between px-6 bg-surface border-b border-border transition-all duration-normal",
|
|
21
|
+
isSticky && "sticky top-0 z-index-sticky",
|
|
22
|
+
glass && "glass",
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
27
|
+
onMenuToggle && /* @__PURE__ */ jsx(
|
|
28
|
+
IconButton,
|
|
29
|
+
{
|
|
30
|
+
icon: /* @__PURE__ */ jsx(Bars3Icon, { className: "w-5 h-5" }),
|
|
31
|
+
"aria-label": "Toggle Menu",
|
|
32
|
+
variant: "ghost",
|
|
33
|
+
size: "sm",
|
|
34
|
+
onClick: onMenuToggle,
|
|
35
|
+
className: "lg:hidden"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
logo && /* @__PURE__ */ jsx("div", { className: "flex items-center", children: logo })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 max-w-xl px-8 hidden md:block", children }),
|
|
41
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
42
|
+
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: actions }),
|
|
43
|
+
userSection && /* @__PURE__ */ jsx("div", { className: "flex items-center pl-2 ml-2 border-l border-border h-8", children: userSection })
|
|
44
|
+
] })
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
Header.displayName = "Header";
|
|
50
|
+
|
|
51
|
+
export { Header };
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { IconButton } from './chunk-BVBCAAES.mjs';
|
|
2
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
3
|
+
import { forwardRef, useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var sizeClasses = {
|
|
8
|
+
xs: "h-8 px-3 text-xs tracking-tight",
|
|
9
|
+
sm: "h-9 px-4 text-sm tracking-tight",
|
|
10
|
+
md: "h-10 px-5 text-sm font-medium tracking-tight",
|
|
11
|
+
lg: "h-11 px-6 text-base font-medium tracking-tight",
|
|
12
|
+
xl: "h-12 px-8 text-lg font-medium tracking-tight"
|
|
13
|
+
};
|
|
14
|
+
var variantListClasses = {
|
|
15
|
+
default: "border-b border-border/60 bg-transparent gap-2",
|
|
16
|
+
filled: "bg-surface-secondary/80 p-1.5 rounded-xl gap-1.5 border border-border/40 shadow-inner backdrop-blur-sm",
|
|
17
|
+
flushed: "border-b border-border/60 bg-transparent gap-8",
|
|
18
|
+
unstyled: "gap-4"
|
|
19
|
+
};
|
|
20
|
+
var variantTabClasses = {
|
|
21
|
+
default: {
|
|
22
|
+
default: "border border-transparent text-text-muted hover:text-text hover:bg-hover/5 rounded-t-lg mb-[-1px] transition-all duration-normal",
|
|
23
|
+
selected: "border border-border border-b-surface text-primary rounded-t-lg mb-[-1px] bg-surface font-bold shadow-[0_-4px_12px_-4px_rgba(0,0,0,0.08)]"
|
|
24
|
+
},
|
|
25
|
+
filled: {
|
|
26
|
+
default: "text-text-muted hover:text-text rounded-lg hover:bg-hover/30 transition-all duration-normal px-4",
|
|
27
|
+
selected: "bg-surface text-primary shadow-md rounded-lg font-bold scale-[1.02] px-4"
|
|
28
|
+
},
|
|
29
|
+
flushed: {
|
|
30
|
+
default: "border-b-2 border-transparent text-text-muted hover:text-text hover:border-border/40 mb-[-1px] transition-all duration-normal px-1",
|
|
31
|
+
selected: "border-b-2 border-primary text-primary mb-[-1px] font-bold px-1 tracking-normal"
|
|
32
|
+
},
|
|
33
|
+
unstyled: {
|
|
34
|
+
default: "text-text-muted hover:text-text transition-all duration-normal opacity-70 hover:opacity-100",
|
|
35
|
+
selected: "text-primary font-bold"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var Tabs = forwardRef(function Tabs2({
|
|
39
|
+
items,
|
|
40
|
+
defaultSelectedId,
|
|
41
|
+
selectedId: externalSelectedId,
|
|
42
|
+
onChange,
|
|
43
|
+
variant = "default",
|
|
44
|
+
size = "md",
|
|
45
|
+
fullWidth = false,
|
|
46
|
+
className,
|
|
47
|
+
tabListClassName,
|
|
48
|
+
tabClassName,
|
|
49
|
+
tabPanelClassName,
|
|
50
|
+
...rest
|
|
51
|
+
}, ref) {
|
|
52
|
+
const [internalSelectedId, setInternalSelectedId] = useState(() => {
|
|
53
|
+
if (externalSelectedId !== void 0) return externalSelectedId;
|
|
54
|
+
if (defaultSelectedId !== void 0) return defaultSelectedId;
|
|
55
|
+
return items.length > 0 ? items[0]?.id ?? "" : "";
|
|
56
|
+
});
|
|
57
|
+
const scrollContainerRef = useRef(null);
|
|
58
|
+
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
59
|
+
const [canScrollRight, setCanScrollRight] = useState(false);
|
|
60
|
+
const isControlled = externalSelectedId !== void 0;
|
|
61
|
+
const currentSelectedId = isControlled ? externalSelectedId : internalSelectedId;
|
|
62
|
+
const handleTabClick = (id, disabled) => {
|
|
63
|
+
if (disabled) return;
|
|
64
|
+
if (!isControlled) {
|
|
65
|
+
setInternalSelectedId(id);
|
|
66
|
+
}
|
|
67
|
+
onChange?.(id);
|
|
68
|
+
};
|
|
69
|
+
const checkScroll = () => {
|
|
70
|
+
if (scrollContainerRef.current) {
|
|
71
|
+
const { scrollLeft, scrollWidth, clientWidth } = scrollContainerRef.current;
|
|
72
|
+
setCanScrollLeft(scrollLeft > 5);
|
|
73
|
+
setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 5);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const container = scrollContainerRef.current;
|
|
78
|
+
if (!container) return;
|
|
79
|
+
checkScroll();
|
|
80
|
+
container.addEventListener("scroll", checkScroll);
|
|
81
|
+
window.addEventListener("resize", checkScroll);
|
|
82
|
+
const timer = setTimeout(checkScroll, 100);
|
|
83
|
+
return () => {
|
|
84
|
+
container.removeEventListener("scroll", checkScroll);
|
|
85
|
+
window.removeEventListener("resize", checkScroll);
|
|
86
|
+
clearTimeout(timer);
|
|
87
|
+
};
|
|
88
|
+
}, [items, fullWidth]);
|
|
89
|
+
const scroll = (direction) => {
|
|
90
|
+
if (scrollContainerRef.current) {
|
|
91
|
+
const scrollAmount = scrollContainerRef.current.clientWidth / 2;
|
|
92
|
+
scrollContainerRef.current.scrollBy({
|
|
93
|
+
left: direction === "left" ? -scrollAmount : scrollAmount,
|
|
94
|
+
behavior: "smooth"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (scrollContainerRef.current) {
|
|
100
|
+
const activeTab = scrollContainerRef.current.querySelector('[aria-selected="true"]');
|
|
101
|
+
if (activeTab) {
|
|
102
|
+
activeTab.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, [currentSelectedId]);
|
|
106
|
+
const selectedItem = items.find((item) => item.id === currentSelectedId);
|
|
107
|
+
if (items.length === 0) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn("w-full", className), ...rest, children: [
|
|
111
|
+
/* @__PURE__ */ jsxs("div", { className: "relative group/tabs flex items-center", children: [
|
|
112
|
+
canScrollLeft && /* @__PURE__ */ jsxs("div", { className: "absolute left-0 z-20 flex h-full items-center pl-1 lg:hidden pointer-events-none", children: [
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
IconButton,
|
|
115
|
+
{
|
|
116
|
+
icon: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "w-4 h-4" }),
|
|
117
|
+
"aria-label": "Scroll left",
|
|
118
|
+
variant: "ghost",
|
|
119
|
+
size: "xs",
|
|
120
|
+
isRound: true,
|
|
121
|
+
onClick: () => {
|
|
122
|
+
scroll("left");
|
|
123
|
+
},
|
|
124
|
+
className: "pointer-events-auto shadow-xl border border-border/20 bg-surface/98 backdrop-blur-xl hover:bg-primary hover:text-surface transition-all duration-300"
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsx("div", { className: "w-12 h-full bg-gradient-to-r from-surface/80 to-transparent pointer-events-none -ml-6" })
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
ref: scrollContainerRef,
|
|
133
|
+
className: cn(
|
|
134
|
+
"flex-1 overflow-x-auto scrollbar-none scroll-smooth",
|
|
135
|
+
variant === "filled" ? "py-1" : "",
|
|
136
|
+
fullWidth && "w-full"
|
|
137
|
+
),
|
|
138
|
+
children: /* @__PURE__ */ jsx(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
role: "tablist",
|
|
142
|
+
className: cn(
|
|
143
|
+
"flex flex-nowrap",
|
|
144
|
+
(fullWidth || variant !== "filled") && "min-w-full",
|
|
145
|
+
variant === "filled" && "w-max mx-auto lg:mx-0",
|
|
146
|
+
variantListClasses[variant],
|
|
147
|
+
tabListClassName
|
|
148
|
+
),
|
|
149
|
+
children: items.map((item) => {
|
|
150
|
+
const isSelected = item.id === currentSelectedId;
|
|
151
|
+
const isDisabled = item.disabled;
|
|
152
|
+
return /* @__PURE__ */ jsx(
|
|
153
|
+
"button",
|
|
154
|
+
{
|
|
155
|
+
type: "button",
|
|
156
|
+
role: "tab",
|
|
157
|
+
"aria-selected": isSelected,
|
|
158
|
+
"aria-disabled": isDisabled,
|
|
159
|
+
disabled: isDisabled,
|
|
160
|
+
onClick: () => {
|
|
161
|
+
handleTabClick(item.id, isDisabled);
|
|
162
|
+
},
|
|
163
|
+
className: cn(
|
|
164
|
+
"flex items-center justify-center font-medium transition-all duration-normal outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface whitespace-nowrap shrink-0",
|
|
165
|
+
sizeClasses[size],
|
|
166
|
+
variantTabClasses[variant][isSelected ? "selected" : "default"],
|
|
167
|
+
fullWidth && "flex-1",
|
|
168
|
+
isDisabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
169
|
+
tabClassName
|
|
170
|
+
),
|
|
171
|
+
children: item.label
|
|
172
|
+
},
|
|
173
|
+
item.id
|
|
174
|
+
);
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
canScrollRight && /* @__PURE__ */ jsxs("div", { className: "absolute right-0 z-20 flex h-full items-center pr-1 lg:hidden pointer-events-none", children: [
|
|
181
|
+
/* @__PURE__ */ jsx("div", { className: "w-8 h-full bg-gradient-to-l from-surface to-transparent pointer-events-none -mr-4" }),
|
|
182
|
+
/* @__PURE__ */ jsx(
|
|
183
|
+
IconButton,
|
|
184
|
+
{
|
|
185
|
+
icon: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "w-4 h-4" }),
|
|
186
|
+
"aria-label": "Scroll right",
|
|
187
|
+
variant: "ghost",
|
|
188
|
+
size: "xs",
|
|
189
|
+
isRound: true,
|
|
190
|
+
onClick: () => {
|
|
191
|
+
scroll("right");
|
|
192
|
+
},
|
|
193
|
+
className: "pointer-events-auto shadow-xl border border-border/20 bg-surface/98 backdrop-blur-xl hover:bg-primary hover:text-surface transition-all duration-300"
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] })
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ jsx("div", { role: "tabpanel", className: cn("pt-4", tabPanelClassName), tabIndex: 0, children: selectedItem?.content })
|
|
199
|
+
] });
|
|
200
|
+
});
|
|
201
|
+
Tabs.displayName = "Tabs";
|
|
202
|
+
|
|
203
|
+
export { Tabs };
|