asheeui 0.6.15 → 0.7.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/AsheeUIProvider.js +22 -24
- package/dist/components/accordion/Accordion.js +79 -173
- package/dist/components/accordion/accordion-config.js +12 -13
- package/dist/components/accordion/accordion-styles.js +21 -24
- package/dist/components/autocomplete/Autocomplete.js +78 -136
- package/dist/components/autocomplete/autocomplete-config.js +7 -12
- package/dist/components/button/Button.d.ts +29 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +47 -108
- package/dist/components/button/button-config.js +16 -17
- package/dist/components/button/button-styles.js +10 -11
- package/dist/components/card/Card.d.ts +36 -16
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +115 -205
- package/dist/components/card/card-config.js +24 -21
- package/dist/components/card/card-styles.js +19 -22
- package/dist/components/carousel/Carousel.js +123 -248
- package/dist/components/carousel/carousel-config.js +24 -25
- package/dist/components/carousel/carousel-styles.js +14 -16
- package/dist/components/chip/Chip.js +84 -191
- package/dist/components/chip/chip-config.js +13 -14
- package/dist/components/chip/chip-styles.js +22 -26
- package/dist/components/date-picker/Calendar.d.ts +3 -3
- package/dist/components/date-picker/Calendar.d.ts.map +1 -1
- package/dist/components/date-picker/Calendar.js +141 -222
- package/dist/components/date-picker/DatePicker.d.ts +5 -5
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +122 -220
- package/dist/components/date-picker/TimeSpinner.js +58 -82
- package/dist/components/date-picker/date-picker-config.d.ts +4 -4
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +10 -11
- package/dist/components/date-picker/date-picker-styles.js +44 -45
- package/dist/components/date-picker/date-picker.helpers.d.ts +4 -4
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.helpers.js +74 -102
- package/dist/components/drawer/Drawer.d.ts +26 -8
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +54 -131
- package/dist/components/drawer/drawer-config.js +14 -15
- package/dist/components/drawer/drawer-styles.js +38 -42
- package/dist/components/field/FieldShell.js +49 -56
- package/dist/components/field/field-config.js +17 -18
- package/dist/components/field/field-styles.js +8 -8
- package/dist/components/image/Image.d.ts +7 -7
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +65 -132
- package/dist/components/image/image-config.js +17 -18
- package/dist/components/image/image-styles.js +14 -15
- package/dist/components/input/Input.js +65 -150
- package/dist/components/input/PasswordInput.js +30 -49
- package/dist/components/input/input-config.js +7 -7
- package/dist/components/input/input-styles.js +9 -10
- package/dist/components/keyboard/KeyboardContext.js +10 -11
- package/dist/components/keyboard/KeyboardProvider.js +100 -181
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +159 -166
- package/dist/components/keyboard/keyboard-config.js +59 -57
- package/dist/components/keyboard/keyboard-styles.js +10 -11
- package/dist/components/keyboard/use-keyboard-field.js +29 -21
- package/dist/components/link/Link.js +47 -137
- package/dist/components/link/link-config.js +14 -15
- package/dist/components/link/link-styles.js +25 -29
- package/dist/components/marquee/Marquee.js +55 -144
- package/dist/components/marquee/marquee-config.js +18 -19
- package/dist/components/marquee/marquee-styles.js +13 -15
- package/dist/components/modal/Modal.d.ts +26 -10
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +56 -136
- package/dist/components/modal/modal-config.js +15 -16
- package/dist/components/modal/modal-styles.js +13 -14
- package/dist/components/multi-select/MultiSelect.d.ts +18 -2
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +149 -283
- package/dist/components/multi-select/multi-select-config.d.ts +23 -18
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +18 -21
- package/dist/components/multi-select/multi-select-styles.js +17 -20
- package/dist/components/radio/Radio.js +43 -80
- package/dist/components/radio/RadioGroup.js +57 -155
- package/dist/components/radio/radio-config.js +15 -16
- package/dist/components/radio/radio-context.js +6 -6
- package/dist/components/radio/radio-styles.js +55 -60
- package/dist/components/resizable-screen/ResizableScreen.js +87 -177
- package/dist/components/resizable-screen/resizable-screen-config.js +16 -17
- package/dist/components/select/Select.d.ts +3 -2
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +97 -195
- package/dist/components/select/select-config.js +8 -9
- package/dist/components/select/select-styles.js +5 -5
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +102 -196
- package/dist/components/select-menu/select-menu-config.js +12 -12
- package/dist/components/select-menu/use-select-floating.d.ts +11 -1
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
- package/dist/components/select-menu/use-select-floating.js +41 -48
- package/dist/components/sidebar/Sidebar.d.ts +43 -22
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +146 -331
- package/dist/components/sidebar/sidebar-config.d.ts +98 -31
- package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar-config.js +47 -33
- package/dist/components/sidebar/sidebar-styles.js +27 -32
- package/dist/components/spinner/spinner-config.js +12 -13
- package/dist/components/spinner/spinner-styles.js +13 -14
- package/dist/components/spinner/spinner.js +39 -82
- package/dist/components/switch/Switch.js +62 -154
- package/dist/components/switch/switch-config.js +11 -12
- package/dist/components/switch/switch-styles.js +14 -16
- package/dist/components/table/Table.js +64 -186
- package/dist/components/table/table-config.js +17 -18
- package/dist/components/table/table-styles.js +48 -52
- package/dist/components/tabs/Tabs.d.ts +16 -8
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +93 -208
- package/dist/components/tabs/tabs-config.d.ts +42 -20
- package/dist/components/tabs/tabs-config.d.ts.map +1 -1
- package/dist/components/tabs/tabs-config.js +26 -18
- package/dist/components/tabs/tabs-styles.js +15 -17
- package/dist/components/textarea/Textarea.js +52 -138
- package/dist/components/textarea/textarea-config.js +10 -11
- package/dist/components/textarea/textarea-styles.js +9 -10
- package/dist/components/toast/ToastContext.js +22 -26
- package/dist/components/toast/ToastItem.js +82 -144
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.js +128 -190
- package/dist/components/toast/toast-config.js +23 -24
- package/dist/components/toast/toast-styles.js +50 -55
- package/dist/components/toast/use-pausable-timeout.js +17 -13
- package/dist/components/tooltip/Tooltip.d.ts +5 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +68 -158
- package/dist/components/tooltip/tooltip-config.d.ts +25 -0
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +26 -22
- package/dist/components/tooltip/tooltip-styles.js +15 -17
- package/dist/config/default-config.js +11 -34
- package/dist/config/resolve-color.js +23 -23
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +14 -12
- package/dist/icons/ArrowLeftIcon.js +16 -19
- package/dist/icons/CalendarIcon.js +43 -24
- package/dist/icons/CheckIcon.js +16 -19
- package/dist/icons/ChevronDownIcon.js +15 -21
- package/dist/icons/ChevronLeftIcon.js +16 -19
- package/dist/icons/ChevronRightIcon.js +16 -19
- package/dist/icons/ChevronUpIcon.js +16 -19
- package/dist/icons/ClearIcon.js +26 -22
- package/dist/icons/ClockIcon.js +20 -22
- package/dist/icons/CloseIcon.js +26 -22
- package/dist/icons/ErrorIcon.js +16 -19
- package/dist/icons/ExternalLinkIcon.js +25 -23
- package/dist/icons/EyeIcon.js +20 -22
- package/dist/icons/EyeOffIcon.js +21 -22
- package/dist/icons/InfoIcon.js +16 -19
- package/dist/icons/SearchIcon.js +25 -22
- package/dist/icons/WarningIcon.js +16 -19
- package/dist/index.js +65 -163
- package/dist/libs/context.js +10 -13
- package/dist/libs/index.js +1 -0
- package/dist/libs/registry.js +10 -12
- package/dist/libs/use-floating-z-index.d.ts +32 -0
- package/dist/libs/use-floating-z-index.d.ts.map +1 -0
- package/dist/libs/use-floating-z-index.js +16 -0
- package/dist/libs/use-isomorphic-layout-effect.js +5 -5
- package/dist/scripts/AsheeThemeScript.js +35 -44
- package/dist/shared/radius.d.ts.map +1 -1
- package/dist/shared/radius.js +12 -13
- package/dist/shared/variant.js +46 -134
- package/dist/theme/color.js +28 -28
- package/dist/theme/controller.d.ts.map +1 -1
- package/dist/theme/controller.js +65 -178
- package/dist/theme/useTheme.js +13 -44
- package/dist/utils/cn.js +7 -7
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/merge-object.js +13 -14
- package/dist/utils/resolve-token.js +11 -14
- package/dist/utils/stacking.d.ts +76 -0
- package/dist/utils/stacking.d.ts.map +1 -0
- package/dist/utils/stacking.js +34 -0
- package/package.json +12 -11
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
e as CALENDAR_COLOR_CLASSES,
|
|
46
|
-
r as DATE_PICKER_CELL_SIZE_CLASS
|
|
2
|
+
//#region src/components/date-picker/date-picker-styles.ts
|
|
3
|
+
var e = {
|
|
4
|
+
sm: "size-7 text-xs",
|
|
5
|
+
md: "size-8 text-xs",
|
|
6
|
+
lg: "size-9 text-sm"
|
|
7
|
+
}, t = {
|
|
8
|
+
default: {
|
|
9
|
+
bg: "bg-foreground text-background",
|
|
10
|
+
text: "text-foreground",
|
|
11
|
+
border: "border-foreground",
|
|
12
|
+
hover: "hover:text-foreground hover:bg-secondary"
|
|
13
|
+
},
|
|
14
|
+
primary: {
|
|
15
|
+
bg: "bg-primary text-primary-foreground",
|
|
16
|
+
text: "text-primary",
|
|
17
|
+
border: "border-primary",
|
|
18
|
+
hover: "hover:text-primary hover:bg-primary/10"
|
|
19
|
+
},
|
|
20
|
+
secondary: {
|
|
21
|
+
bg: "bg-secondary text-foreground/70",
|
|
22
|
+
text: "text-secondary",
|
|
23
|
+
border: "border-secondary",
|
|
24
|
+
hover: "hover:text-secondary hover:bg-secondary/10"
|
|
25
|
+
},
|
|
26
|
+
success: {
|
|
27
|
+
bg: "bg-success text-success-foreground",
|
|
28
|
+
text: "text-success",
|
|
29
|
+
border: "border-success",
|
|
30
|
+
hover: "hover:text-success hover:bg-success/10"
|
|
31
|
+
},
|
|
32
|
+
warning: {
|
|
33
|
+
bg: "bg-warning text-warning-foreground",
|
|
34
|
+
text: "text-warning",
|
|
35
|
+
border: "border-warning",
|
|
36
|
+
hover: "hover:text-warning hover:bg-warning/10"
|
|
37
|
+
},
|
|
38
|
+
danger: {
|
|
39
|
+
bg: "bg-danger text-danger-foreground",
|
|
40
|
+
text: "text-danger",
|
|
41
|
+
border: "border-danger",
|
|
42
|
+
hover: "hover:text-danger hover:bg-danger/10"
|
|
43
|
+
}
|
|
47
44
|
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { t as CALENDAR_COLOR_CLASSES, e as DATE_PICKER_CELL_SIZE_CLASS };
|
|
@@ -19,7 +19,7 @@ export declare const MONTHS: readonly ["January", "February", "March", "April",
|
|
|
19
19
|
* - `time`: Select only a time.
|
|
20
20
|
* - `datetime`: Select both date and time.
|
|
21
21
|
*/
|
|
22
|
-
export type
|
|
22
|
+
export type DatePickerMode = "date" | "time" | "datetime";
|
|
23
23
|
/**
|
|
24
24
|
* Pads a number with leading zero to two digits.
|
|
25
25
|
* Used for formatting hours, minutes, and seconds.
|
|
@@ -49,14 +49,14 @@ export declare function pad2(n: number): string;
|
|
|
49
49
|
* formatDisplay(date, "datetime") // "15/01/2024 14:30:45"
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
export declare function formatDisplay(date: Date, mode:
|
|
52
|
+
export declare function formatDisplay(date: Date, mode: DatePickerMode): string;
|
|
53
53
|
/**
|
|
54
54
|
* Gets the default placeholder text for the input based on mode.
|
|
55
55
|
*
|
|
56
56
|
* @param mode - The picker mode.
|
|
57
57
|
* @returns The placeholder text.
|
|
58
58
|
*/
|
|
59
|
-
export declare function getDefaultPlaceholder(mode:
|
|
59
|
+
export declare function getDefaultPlaceholder(mode: DatePickerMode): string;
|
|
60
60
|
/**
|
|
61
61
|
* Builds a 2D array of day numbers for the calendar grid.
|
|
62
62
|
* Returns a flat array where null values represent empty slots
|
|
@@ -90,7 +90,7 @@ export declare function buildDayCells(year: number, month: number): (number | nu
|
|
|
90
90
|
* parseDateString("150120241430", "datetime") // Date(2024, 0, 15, 14, 30)
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export declare function parseDateString(input: string, mode:
|
|
93
|
+
export declare function parseDateString(input: string, mode: DatePickerMode, fallbackDate?: Date): Date | null;
|
|
94
94
|
/**
|
|
95
95
|
* Calculates the new cursor position after input formatting.
|
|
96
96
|
* Ensures the cursor stays at the correct position when the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker.helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;GAGG;AACH,eAAO,MAAM,YAAY,qDAAsD,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,MAAM,qIAaT,CAAC;AAIX;;;;;GAKG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"date-picker.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker.helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;GAGG;AACH,eAAO,MAAM,YAAY,qDAAsD,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,MAAM,qIAaT,CAAC;AAIX;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAI1D;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAgBtE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CASlE;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAS5E;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,cAAc,EACpB,YAAY,CAAC,EAAE,IAAI,GAClB,IAAI,GAAG,IAAI,CAsDb;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,GACxB,MAAM,CAqBR"}
|
|
@@ -1,110 +1,82 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
//#region src/components/date-picker/date-picker.helpers.ts
|
|
3
|
+
var e = [
|
|
4
|
+
"Su",
|
|
5
|
+
"Mo",
|
|
6
|
+
"Tu",
|
|
7
|
+
"We",
|
|
8
|
+
"Th",
|
|
9
|
+
"Fr",
|
|
10
|
+
"Sa"
|
|
11
|
+
], t = [
|
|
12
|
+
"January",
|
|
13
|
+
"February",
|
|
14
|
+
"March",
|
|
15
|
+
"April",
|
|
16
|
+
"May",
|
|
17
|
+
"June",
|
|
18
|
+
"July",
|
|
19
|
+
"August",
|
|
20
|
+
"September",
|
|
21
|
+
"October",
|
|
22
|
+
"November",
|
|
23
|
+
"December"
|
|
15
24
|
];
|
|
16
|
-
function
|
|
17
|
-
|
|
25
|
+
function n(e) {
|
|
26
|
+
return String(e).padStart(2, "0");
|
|
18
27
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
case "datetime":
|
|
27
|
-
return `${o}/${t}/${s} ${i}:${c}:${e}`;
|
|
28
|
-
}
|
|
28
|
+
function r(e, t) {
|
|
29
|
+
let r = n(e.getDate()), i = n(e.getMonth() + 1), a = e.getFullYear(), o = n(e.getHours()), s = n(e.getMinutes()), c = n(e.getSeconds());
|
|
30
|
+
switch (t) {
|
|
31
|
+
case "date": return `${r}/${i}/${a}`;
|
|
32
|
+
case "time": return `${o}:${s}:${c}`;
|
|
33
|
+
case "datetime": return `${r}/${i}/${a} ${o}:${s}:${c}`;
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
case "datetime":
|
|
37
|
-
return "Select date & time...";
|
|
38
|
-
}
|
|
36
|
+
function i(e) {
|
|
37
|
+
switch (e) {
|
|
38
|
+
case "date": return "Select date...";
|
|
39
|
+
case "time": return "Select time...";
|
|
40
|
+
case "datetime": return "Select date & time...";
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
];
|
|
45
|
-
for (; s.length % 7 !== 0; ) s.push(null);
|
|
46
|
-
return s;
|
|
43
|
+
function a(e, t) {
|
|
44
|
+
let n = new Date(e, t + 1, 0).getDate(), r = new Date(e, t, 1).getDay(), i = [...Array(r).fill(null), ...Array.from({ length: n }, (e, t) => t + 1)];
|
|
45
|
+
for (; i.length % 7 != 0;) i.push(null);
|
|
46
|
+
return i;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
case "datetime": {
|
|
72
|
-
const i = parseInt(t.slice(0, 2), 10) || 1, c = parseInt(t.slice(2, 4), 10) || 1;
|
|
73
|
-
let e = parseInt(t.slice(4, 8), 10) || s.getFullYear();
|
|
74
|
-
t.length >= 4 && t.length < 8 && (e = 2e3 + e), t.length < 4 && (e = s.getFullYear());
|
|
75
|
-
const a = parseInt(t.slice(8, 10), 10) || 0, u = parseInt(t.slice(10, 12), 10) || 0, h = parseInt(t.slice(12, 14), 10) || 0, g = Math.min(c - 1, 11), m = new Date(e, g + 1, 0).getDate(), f = Math.min(i, m);
|
|
76
|
-
return new Date(
|
|
77
|
-
e,
|
|
78
|
-
g,
|
|
79
|
-
f,
|
|
80
|
-
Math.min(a, 23),
|
|
81
|
-
Math.min(u, 59),
|
|
82
|
-
Math.min(h, 59)
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
48
|
+
function o(e, t, n) {
|
|
49
|
+
let r = e.replace(/\D/g, "");
|
|
50
|
+
if (r.length === 0) return null;
|
|
51
|
+
let i = n ?? /* @__PURE__ */ new Date();
|
|
52
|
+
switch (t) {
|
|
53
|
+
case "date": {
|
|
54
|
+
let e = parseInt(r.slice(0, 2), 10) || 1, t = parseInt(r.slice(2, 4), 10) || 1, n = parseInt(r.slice(4, 8), 10) || i.getFullYear();
|
|
55
|
+
r.length === 4 && (n = 2e3 + n), r.length === 2 && (n = i.getFullYear());
|
|
56
|
+
let a = Math.min(t - 1, 11), o = new Date(n, a + 1, 0).getDate();
|
|
57
|
+
return new Date(n, a, Math.min(e, o));
|
|
58
|
+
}
|
|
59
|
+
case "time": {
|
|
60
|
+
let e = parseInt(r.slice(0, 2), 10) || 0, t = parseInt(r.slice(2, 4), 10) || 0, n = parseInt(r.slice(4, 6), 10) || 0, a = i;
|
|
61
|
+
return new Date(a.getFullYear(), a.getMonth(), a.getDate(), Math.min(e, 23), Math.min(t, 59), Math.min(n, 59));
|
|
62
|
+
}
|
|
63
|
+
case "datetime": {
|
|
64
|
+
let e = parseInt(r.slice(0, 2), 10) || 1, t = parseInt(r.slice(2, 4), 10) || 1, n = parseInt(r.slice(4, 8), 10) || i.getFullYear();
|
|
65
|
+
r.length >= 4 && r.length < 8 && (n = 2e3 + n), r.length < 4 && (n = i.getFullYear());
|
|
66
|
+
let a = parseInt(r.slice(8, 10), 10) || 0, o = parseInt(r.slice(10, 12), 10) || 0, s = parseInt(r.slice(12, 14), 10) || 0, c = Math.min(t - 1, 11), l = new Date(n, c + 1, 0).getDate();
|
|
67
|
+
return new Date(n, c, Math.min(e, l), Math.min(a, 23), Math.min(o, 59), Math.min(s, 59));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
86
70
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return a + 1;
|
|
97
|
-
return r.length;
|
|
98
|
-
}
|
|
99
|
-
return r.length;
|
|
71
|
+
function s(e, t, n) {
|
|
72
|
+
if (n >= e.length) return t.length;
|
|
73
|
+
let r = (e.slice(0, n).match(/\d/g) || []).length, i = 0;
|
|
74
|
+
for (let e = 0; e < t.length; e++) if (/\d/.test(t[e]) && i++, i > r) {
|
|
75
|
+
let e = 0;
|
|
76
|
+
for (let n = 0; n < t.length; n++) if (/\d/.test(t[n]) && e++, e === r + 1) return n + 1;
|
|
77
|
+
return t.length;
|
|
78
|
+
}
|
|
79
|
+
return t.length;
|
|
100
80
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
D as MONTHS,
|
|
104
|
-
y as buildDayCells,
|
|
105
|
-
p as formatDisplay,
|
|
106
|
-
M as getDefaultPlaceholder,
|
|
107
|
-
$ as getNewCursorPosition,
|
|
108
|
-
l as pad2,
|
|
109
|
-
I as parseDateString
|
|
110
|
-
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { e as DAYS_OF_WEEK, t as MONTHS, a as buildDayCells, r as formatDisplay, i as getDefaultPlaceholder, s as getNewCursorPosition, n as pad2, o as parseDateString };
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { DrawerConfig } from './drawer-config';
|
|
3
|
-
type BaseDrawerProps = DrawerConfig & HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
type BaseDrawerProps = DrawerConfig & Omit<HTMLAttributes<HTMLDivElement>, "content">;
|
|
4
|
+
/**
|
|
5
|
+
* Props for the drawer's backdrop overlay.
|
|
6
|
+
*/
|
|
7
|
+
export interface DrawerOverlayProps {
|
|
8
|
+
/**
|
|
9
|
+
* Extra classes applied to the overlay.
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Props for the drawer's content panel.
|
|
15
|
+
*/
|
|
16
|
+
export interface DrawerContentProps {
|
|
17
|
+
/**
|
|
18
|
+
* Extra classes applied to the drawer content.
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
4
22
|
/**
|
|
5
23
|
* Configuration options for the Drawer component.
|
|
6
24
|
*/
|
|
@@ -16,13 +34,13 @@ export interface DrawerProps extends BaseDrawerProps {
|
|
|
16
34
|
*/
|
|
17
35
|
onClose?: () => void;
|
|
18
36
|
/**
|
|
19
|
-
*
|
|
37
|
+
* Backdrop overlay overrides, including its class override.
|
|
20
38
|
*/
|
|
21
|
-
|
|
39
|
+
overlay?: DrawerOverlayProps;
|
|
22
40
|
/**
|
|
23
|
-
*
|
|
41
|
+
* Content panel overrides, including its class override.
|
|
24
42
|
*/
|
|
25
|
-
|
|
43
|
+
content?: DrawerContentProps;
|
|
26
44
|
/**
|
|
27
45
|
* The content to display inside the drawer.
|
|
28
46
|
*/
|
|
@@ -49,8 +67,8 @@ export interface DrawerProps extends BaseDrawerProps {
|
|
|
49
67
|
* @param props.animated - Whether the drawer has slide animations. Defaults to true.
|
|
50
68
|
* @param props.closeOnOverlayClick - Whether clicking the overlay closes the drawer. Defaults to true.
|
|
51
69
|
* @param props.closeOnEsc - Whether pressing Escape closes the drawer. Defaults to true.
|
|
52
|
-
* @param props.
|
|
53
|
-
* @param props.
|
|
70
|
+
* @param props.overlay - Backdrop overlay overrides (className).
|
|
71
|
+
* @param props.content - Content panel overrides (className).
|
|
54
72
|
* @param props.children - The content to display inside the drawer.
|
|
55
73
|
* @param props.className - Extra classes for the container.
|
|
56
74
|
*
|
|
@@ -90,7 +108,7 @@ export interface DrawerProps extends BaseDrawerProps {
|
|
|
90
108
|
* onClose={onClose}
|
|
91
109
|
* placement="bottom"
|
|
92
110
|
* size="full"
|
|
93
|
-
*
|
|
111
|
+
* overlay={{ className: "bg-black/50" }}
|
|
94
112
|
* >
|
|
95
113
|
* <div className="p-6 max-h-[80vh] overflow-y-auto">
|
|
96
114
|
* {content}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,iBAAiB,CAAC;AASzB,KAAK,eAAe,GAAG,YAAY,GACjC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,eAAO,MAAM,MAAM,wGAyLlB,CAAC"}
|
|
@@ -1,132 +1,55 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
t.closeOnOverlayClick
|
|
57
|
-
), u = a(
|
|
58
|
-
_,
|
|
59
|
-
e == null ? void 0 : e.closeOnEsc,
|
|
60
|
-
void 0,
|
|
61
|
-
t.closeOnEsc
|
|
62
|
-
), p = a(
|
|
63
|
-
O,
|
|
64
|
-
e == null ? void 0 : e.animated,
|
|
65
|
-
void 0,
|
|
66
|
-
t.animated
|
|
67
|
-
), g = k ?? "bg-black/70 backdrop-blur-md", F = D ?? "bg-secondary", A = n === "left" || n === "right", H = A ? R(
|
|
68
|
-
m,
|
|
69
|
-
U,
|
|
70
|
-
t.size
|
|
71
|
-
) : "w-full", K = A ? "h-full" : R(
|
|
72
|
-
m,
|
|
73
|
-
X,
|
|
74
|
-
t.size
|
|
75
|
-
), P = y[n] ?? y.right, M = b[n] ?? b.right, E = Y[n], v = o === "open" || o === "opening", j = p ? v ? E.open : E.closed : "", B = p ? v ? "drawer-backdrop-in" : "drawer-backdrop-out" : "", i = J(
|
|
76
|
-
(s) => {
|
|
77
|
-
u && s.key === "Escape" && r && r();
|
|
78
|
-
},
|
|
79
|
-
[u, r]
|
|
80
|
-
);
|
|
81
|
-
return C(() => {
|
|
82
|
-
if (o !== "unmounted")
|
|
83
|
-
return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
|
|
84
|
-
}, [o, i]), o === "unmounted" ? null : /* @__PURE__ */ G(
|
|
85
|
-
"div",
|
|
86
|
-
{
|
|
87
|
-
ref: W,
|
|
88
|
-
role: "dialog",
|
|
89
|
-
"aria-modal": "true",
|
|
90
|
-
className: d(
|
|
91
|
-
"fixed inset-0 z-50 flex w-full h-full",
|
|
92
|
-
P,
|
|
93
|
-
L
|
|
94
|
-
),
|
|
95
|
-
...z,
|
|
96
|
-
children: [
|
|
97
|
-
/* @__PURE__ */ w(
|
|
98
|
-
"button",
|
|
99
|
-
{
|
|
100
|
-
type: "button",
|
|
101
|
-
onClick: I ? r : void 0,
|
|
102
|
-
className: d(
|
|
103
|
-
"absolute inset-0",
|
|
104
|
-
g,
|
|
105
|
-
B
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ w(
|
|
110
|
-
"div",
|
|
111
|
-
{
|
|
112
|
-
style: x,
|
|
113
|
-
className: d(
|
|
114
|
-
"relative z-10 flex flex-col text-foreground shadow-2xl border-border",
|
|
115
|
-
M,
|
|
116
|
-
H,
|
|
117
|
-
K,
|
|
118
|
-
F,
|
|
119
|
-
j
|
|
120
|
-
),
|
|
121
|
-
children: T
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
Z.displayName = "Drawer";
|
|
130
|
-
export {
|
|
131
|
-
Z as Drawer
|
|
132
|
-
};
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { ASHEE_GLOBAL_LAYER as t } from "../../utils/stacking.js";
|
|
5
|
+
import { useAsheeConfig as n } from "../../libs/context.js";
|
|
6
|
+
import { resolveCascade as r, resolveClassKey as i } from "../../utils/resolve-token.js";
|
|
7
|
+
import { FALLBACK_DRAWER_CONFIG as a } from "./drawer-config.js";
|
|
8
|
+
import { DRAWER_ANIMATION_STATE as o, DRAWER_BORDER_PLACEMENT_CLASS as s, DRAWER_CONTAINER_PLACEMENT_CLASS as c, DRAWER_HEIGHT_CLASS as l, DRAWER_WIDTH_CLASS as u } from "./drawer-styles.js";
|
|
9
|
+
import { forwardRef as d, useCallback as f, useEffect as p, useState as m } from "react";
|
|
10
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/drawer/Drawer.tsx
|
|
12
|
+
var _ = d(({ isOpen: d, onClose: _, placement: v, size: y, animated: b, closeOnOverlayClick: x, closeOnEsc: S, overlay: C, content: w, className: T, children: E, style: D, ...O }, k) => {
|
|
13
|
+
let A = n().components?.drawer, [j, M] = m(d ? "open" : "unmounted");
|
|
14
|
+
p(() => {
|
|
15
|
+
if (d) {
|
|
16
|
+
M("opening");
|
|
17
|
+
let e = requestAnimationFrame(() => {
|
|
18
|
+
M("open");
|
|
19
|
+
});
|
|
20
|
+
return () => cancelAnimationFrame(e);
|
|
21
|
+
}
|
|
22
|
+
if (j !== "unmounted") {
|
|
23
|
+
M("closing");
|
|
24
|
+
let e = setTimeout(() => {
|
|
25
|
+
M("unmounted");
|
|
26
|
+
}, 250);
|
|
27
|
+
return () => clearTimeout(e);
|
|
28
|
+
}
|
|
29
|
+
}, [d]);
|
|
30
|
+
let N = r(y, A?.size, void 0, a.size), P = r(v, A?.placement, void 0, a.placement), F = r(x, A?.closeOnOverlayClick, void 0, a.closeOnOverlayClick), I = r(S, A?.closeOnEsc, void 0, a.closeOnEsc), L = r(b, A?.animated, void 0, a.animated), R = C?.className ?? "bg-black/70 backdrop-blur-md", z = w?.className ?? "bg-secondary", B = P === "left" || P === "right", V = B ? i(N, u, a.size) : "w-full", H = B ? "h-full" : i(N, l, a.size), U = c[P] ?? c.right, W = s[P] ?? s.right, G = o[P], K = j === "open" || j === "opening", q = L ? K ? G.open : G.closed : "", J = L ? K ? "drawer-backdrop-in" : "drawer-backdrop-out" : "", Y = f((e) => {
|
|
31
|
+
I && e.key === "Escape" && _ && _();
|
|
32
|
+
}, [I, _]);
|
|
33
|
+
return p(() => {
|
|
34
|
+
if (j !== "unmounted") return window.addEventListener("keydown", Y), () => window.removeEventListener("keydown", Y);
|
|
35
|
+
}, [j, Y]), j === "unmounted" ? null : /* @__PURE__ */ g("div", {
|
|
36
|
+
ref: k,
|
|
37
|
+
role: "dialog",
|
|
38
|
+
"aria-modal": "true",
|
|
39
|
+
className: e("fixed inset-0 flex w-full h-full", U, T),
|
|
40
|
+
style: { zIndex: t.overlay },
|
|
41
|
+
...O,
|
|
42
|
+
children: [/* @__PURE__ */ h("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
onClick: F ? _ : void 0,
|
|
45
|
+
className: e("absolute inset-0", R, J)
|
|
46
|
+
}), /* @__PURE__ */ h("div", {
|
|
47
|
+
style: D,
|
|
48
|
+
className: e("relative z-10 flex flex-col text-foreground shadow-2xl border-border", W, V, H, z, q),
|
|
49
|
+
children: E
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
_.displayName = "Drawer";
|
|
54
|
+
//#endregion
|
|
55
|
+
export { _ as Drawer };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
//#region src/components/drawer/drawer-config.ts
|
|
4
|
+
var t = {
|
|
5
|
+
size: "md",
|
|
6
|
+
placement: "right",
|
|
7
|
+
animated: !0,
|
|
8
|
+
closeOnOverlayClick: !0,
|
|
9
|
+
closeOnEsc: !0
|
|
9
10
|
}, n = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
size: "md",
|
|
12
|
+
placement: "right",
|
|
13
|
+
animated: !0,
|
|
14
|
+
closeOnOverlayClick: !0,
|
|
15
|
+
closeOnEsc: !0
|
|
15
16
|
};
|
|
16
17
|
e("drawer", t);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
t as defaultDrawerConfig
|
|
20
|
-
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as FALLBACK_DRAWER_CONFIG, t as defaultDrawerConfig };
|