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.
Files changed (183) hide show
  1. package/dist/AsheeUIProvider.js +22 -24
  2. package/dist/components/accordion/Accordion.js +79 -173
  3. package/dist/components/accordion/accordion-config.js +12 -13
  4. package/dist/components/accordion/accordion-styles.js +21 -24
  5. package/dist/components/autocomplete/Autocomplete.js +78 -136
  6. package/dist/components/autocomplete/autocomplete-config.js +7 -12
  7. package/dist/components/button/Button.d.ts +29 -1
  8. package/dist/components/button/Button.d.ts.map +1 -1
  9. package/dist/components/button/Button.js +47 -108
  10. package/dist/components/button/button-config.js +16 -17
  11. package/dist/components/button/button-styles.js +10 -11
  12. package/dist/components/card/Card.d.ts +36 -16
  13. package/dist/components/card/Card.d.ts.map +1 -1
  14. package/dist/components/card/Card.js +115 -205
  15. package/dist/components/card/card-config.js +24 -21
  16. package/dist/components/card/card-styles.js +19 -22
  17. package/dist/components/carousel/Carousel.js +123 -248
  18. package/dist/components/carousel/carousel-config.js +24 -25
  19. package/dist/components/carousel/carousel-styles.js +14 -16
  20. package/dist/components/chip/Chip.js +84 -191
  21. package/dist/components/chip/chip-config.js +13 -14
  22. package/dist/components/chip/chip-styles.js +22 -26
  23. package/dist/components/date-picker/Calendar.d.ts +3 -3
  24. package/dist/components/date-picker/Calendar.d.ts.map +1 -1
  25. package/dist/components/date-picker/Calendar.js +141 -222
  26. package/dist/components/date-picker/DatePicker.d.ts +5 -5
  27. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  28. package/dist/components/date-picker/DatePicker.js +122 -220
  29. package/dist/components/date-picker/TimeSpinner.js +58 -82
  30. package/dist/components/date-picker/date-picker-config.d.ts +4 -4
  31. package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
  32. package/dist/components/date-picker/date-picker-config.js +10 -11
  33. package/dist/components/date-picker/date-picker-styles.js +44 -45
  34. package/dist/components/date-picker/date-picker.helpers.d.ts +4 -4
  35. package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -1
  36. package/dist/components/date-picker/date-picker.helpers.js +74 -102
  37. package/dist/components/drawer/Drawer.d.ts +26 -8
  38. package/dist/components/drawer/Drawer.d.ts.map +1 -1
  39. package/dist/components/drawer/Drawer.js +54 -131
  40. package/dist/components/drawer/drawer-config.js +14 -15
  41. package/dist/components/drawer/drawer-styles.js +38 -42
  42. package/dist/components/field/FieldShell.js +49 -56
  43. package/dist/components/field/field-config.js +17 -18
  44. package/dist/components/field/field-styles.js +8 -8
  45. package/dist/components/image/Image.d.ts +7 -7
  46. package/dist/components/image/Image.d.ts.map +1 -1
  47. package/dist/components/image/Image.js +65 -132
  48. package/dist/components/image/image-config.js +17 -18
  49. package/dist/components/image/image-styles.js +14 -15
  50. package/dist/components/input/Input.js +65 -150
  51. package/dist/components/input/PasswordInput.js +30 -49
  52. package/dist/components/input/input-config.js +7 -7
  53. package/dist/components/input/input-styles.js +9 -10
  54. package/dist/components/keyboard/KeyboardContext.js +10 -11
  55. package/dist/components/keyboard/KeyboardProvider.js +100 -181
  56. package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
  57. package/dist/components/keyboard/OnScreenKeyboard.js +159 -166
  58. package/dist/components/keyboard/keyboard-config.js +59 -57
  59. package/dist/components/keyboard/keyboard-styles.js +10 -11
  60. package/dist/components/keyboard/use-keyboard-field.js +29 -21
  61. package/dist/components/link/Link.js +47 -137
  62. package/dist/components/link/link-config.js +14 -15
  63. package/dist/components/link/link-styles.js +25 -29
  64. package/dist/components/marquee/Marquee.js +55 -144
  65. package/dist/components/marquee/marquee-config.js +18 -19
  66. package/dist/components/marquee/marquee-styles.js +13 -15
  67. package/dist/components/modal/Modal.d.ts +26 -10
  68. package/dist/components/modal/Modal.d.ts.map +1 -1
  69. package/dist/components/modal/Modal.js +56 -136
  70. package/dist/components/modal/modal-config.js +15 -16
  71. package/dist/components/modal/modal-styles.js +13 -14
  72. package/dist/components/multi-select/MultiSelect.d.ts +18 -2
  73. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  74. package/dist/components/multi-select/MultiSelect.js +149 -283
  75. package/dist/components/multi-select/multi-select-config.d.ts +23 -18
  76. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  77. package/dist/components/multi-select/multi-select-config.js +18 -21
  78. package/dist/components/multi-select/multi-select-styles.js +17 -20
  79. package/dist/components/radio/Radio.js +43 -80
  80. package/dist/components/radio/RadioGroup.js +57 -155
  81. package/dist/components/radio/radio-config.js +15 -16
  82. package/dist/components/radio/radio-context.js +6 -6
  83. package/dist/components/radio/radio-styles.js +55 -60
  84. package/dist/components/resizable-screen/ResizableScreen.js +87 -177
  85. package/dist/components/resizable-screen/resizable-screen-config.js +16 -17
  86. package/dist/components/select/Select.d.ts +3 -2
  87. package/dist/components/select/Select.d.ts.map +1 -1
  88. package/dist/components/select/Select.js +97 -195
  89. package/dist/components/select/select-config.js +8 -9
  90. package/dist/components/select/select-styles.js +5 -5
  91. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  92. package/dist/components/select-menu/SelectMenu.js +102 -196
  93. package/dist/components/select-menu/select-menu-config.js +12 -12
  94. package/dist/components/select-menu/use-select-floating.d.ts +11 -1
  95. package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
  96. package/dist/components/select-menu/use-select-floating.js +41 -48
  97. package/dist/components/sidebar/Sidebar.d.ts +43 -22
  98. package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
  99. package/dist/components/sidebar/Sidebar.js +146 -331
  100. package/dist/components/sidebar/sidebar-config.d.ts +98 -31
  101. package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
  102. package/dist/components/sidebar/sidebar-config.js +47 -33
  103. package/dist/components/sidebar/sidebar-styles.js +27 -32
  104. package/dist/components/spinner/spinner-config.js +12 -13
  105. package/dist/components/spinner/spinner-styles.js +13 -14
  106. package/dist/components/spinner/spinner.js +39 -82
  107. package/dist/components/switch/Switch.js +62 -154
  108. package/dist/components/switch/switch-config.js +11 -12
  109. package/dist/components/switch/switch-styles.js +14 -16
  110. package/dist/components/table/Table.js +64 -186
  111. package/dist/components/table/table-config.js +17 -18
  112. package/dist/components/table/table-styles.js +48 -52
  113. package/dist/components/tabs/Tabs.d.ts +16 -8
  114. package/dist/components/tabs/Tabs.d.ts.map +1 -1
  115. package/dist/components/tabs/Tabs.js +93 -208
  116. package/dist/components/tabs/tabs-config.d.ts +42 -20
  117. package/dist/components/tabs/tabs-config.d.ts.map +1 -1
  118. package/dist/components/tabs/tabs-config.js +26 -18
  119. package/dist/components/tabs/tabs-styles.js +15 -17
  120. package/dist/components/textarea/Textarea.js +52 -138
  121. package/dist/components/textarea/textarea-config.js +10 -11
  122. package/dist/components/textarea/textarea-styles.js +9 -10
  123. package/dist/components/toast/ToastContext.js +22 -26
  124. package/dist/components/toast/ToastItem.js +82 -144
  125. package/dist/components/toast/ToastProvider.d.ts.map +1 -1
  126. package/dist/components/toast/ToastProvider.js +128 -190
  127. package/dist/components/toast/toast-config.js +23 -24
  128. package/dist/components/toast/toast-styles.js +50 -55
  129. package/dist/components/toast/use-pausable-timeout.js +17 -13
  130. package/dist/components/tooltip/Tooltip.d.ts +5 -0
  131. package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
  132. package/dist/components/tooltip/Tooltip.js +68 -158
  133. package/dist/components/tooltip/tooltip-config.d.ts +25 -0
  134. package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
  135. package/dist/components/tooltip/tooltip-config.js +26 -22
  136. package/dist/components/tooltip/tooltip-styles.js +15 -17
  137. package/dist/config/default-config.js +11 -34
  138. package/dist/config/resolve-color.js +23 -23
  139. package/dist/config/resolve-config.d.ts.map +1 -1
  140. package/dist/config/resolve-config.js +14 -12
  141. package/dist/icons/ArrowLeftIcon.js +16 -19
  142. package/dist/icons/CalendarIcon.js +43 -24
  143. package/dist/icons/CheckIcon.js +16 -19
  144. package/dist/icons/ChevronDownIcon.js +15 -21
  145. package/dist/icons/ChevronLeftIcon.js +16 -19
  146. package/dist/icons/ChevronRightIcon.js +16 -19
  147. package/dist/icons/ChevronUpIcon.js +16 -19
  148. package/dist/icons/ClearIcon.js +26 -22
  149. package/dist/icons/ClockIcon.js +20 -22
  150. package/dist/icons/CloseIcon.js +26 -22
  151. package/dist/icons/ErrorIcon.js +16 -19
  152. package/dist/icons/ExternalLinkIcon.js +25 -23
  153. package/dist/icons/EyeIcon.js +20 -22
  154. package/dist/icons/EyeOffIcon.js +21 -22
  155. package/dist/icons/InfoIcon.js +16 -19
  156. package/dist/icons/SearchIcon.js +25 -22
  157. package/dist/icons/WarningIcon.js +16 -19
  158. package/dist/index.js +65 -163
  159. package/dist/libs/context.js +10 -13
  160. package/dist/libs/index.js +1 -0
  161. package/dist/libs/registry.js +10 -12
  162. package/dist/libs/use-floating-z-index.d.ts +32 -0
  163. package/dist/libs/use-floating-z-index.d.ts.map +1 -0
  164. package/dist/libs/use-floating-z-index.js +16 -0
  165. package/dist/libs/use-isomorphic-layout-effect.js +5 -5
  166. package/dist/scripts/AsheeThemeScript.js +35 -44
  167. package/dist/shared/radius.d.ts.map +1 -1
  168. package/dist/shared/radius.js +12 -13
  169. package/dist/shared/variant.js +46 -134
  170. package/dist/theme/color.js +28 -28
  171. package/dist/theme/controller.d.ts.map +1 -1
  172. package/dist/theme/controller.js +65 -178
  173. package/dist/theme/useTheme.js +13 -44
  174. package/dist/utils/cn.js +7 -7
  175. package/dist/utils/index.d.ts +1 -0
  176. package/dist/utils/index.d.ts.map +1 -1
  177. package/dist/utils/index.js +1 -0
  178. package/dist/utils/merge-object.js +13 -14
  179. package/dist/utils/resolve-token.js +11 -14
  180. package/dist/utils/stacking.d.ts +76 -0
  181. package/dist/utils/stacking.d.ts.map +1 -0
  182. package/dist/utils/stacking.js +34 -0
  183. package/package.json +12 -11
@@ -1,47 +1,46 @@
1
1
  "use client";
2
- const r = {
3
- sm: "size-7 text-xs",
4
- md: "size-8 text-xs",
5
- lg: "size-9 text-sm"
6
- }, e = {
7
- default: {
8
- bg: "bg-foreground text-background",
9
- text: "text-foreground",
10
- border: "border-foreground",
11
- hover: "hover:text-foreground hover:bg-secondary"
12
- },
13
- primary: {
14
- bg: "bg-primary text-primary-foreground",
15
- text: "text-primary",
16
- border: "border-primary",
17
- hover: "hover:text-primary hover:bg-primary/10"
18
- },
19
- secondary: {
20
- bg: "bg-secondary text-foreground/70",
21
- text: "text-secondary",
22
- border: "border-secondary",
23
- hover: "hover:text-secondary hover:bg-secondary/10"
24
- },
25
- success: {
26
- bg: "bg-success text-success-foreground",
27
- text: "text-success",
28
- border: "border-success",
29
- hover: "hover:text-success hover:bg-success/10"
30
- },
31
- warning: {
32
- bg: "bg-warning text-warning-foreground",
33
- text: "text-warning",
34
- border: "border-warning",
35
- hover: "hover:text-warning hover:bg-warning/10"
36
- },
37
- danger: {
38
- bg: "bg-danger text-danger-foreground",
39
- text: "text-danger",
40
- border: "border-danger",
41
- hover: "hover:text-danger hover:bg-danger/10"
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 PickerMode = "date" | "time" | "datetime";
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: PickerMode): string;
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: PickerMode): string;
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: PickerMode, fallbackDate?: Date): Date | null;
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,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAItD;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAgBlE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAS9D;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,UAAU,EAChB,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
+ {"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
- const d = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], D = [
3
- "January",
4
- "February",
5
- "March",
6
- "April",
7
- "May",
8
- "June",
9
- "July",
10
- "August",
11
- "September",
12
- "October",
13
- "November",
14
- "December"
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 l(n) {
17
- return String(n).padStart(2, "0");
25
+ function n(e) {
26
+ return String(e).padStart(2, "0");
18
27
  }
19
- function p(n, r) {
20
- const o = l(n.getDate()), t = l(n.getMonth() + 1), s = n.getFullYear(), i = l(n.getHours()), c = l(n.getMinutes()), e = l(n.getSeconds());
21
- switch (r) {
22
- case "date":
23
- return `${o}/${t}/${s}`;
24
- case "time":
25
- return `${i}:${c}:${e}`;
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 M(n) {
31
- switch (n) {
32
- case "date":
33
- return "Select date...";
34
- case "time":
35
- return "Select time...";
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 y(n, r) {
41
- const o = new Date(n, r + 1, 0).getDate(), t = new Date(n, r, 1).getDay(), s = [
42
- ...Array(t).fill(null),
43
- ...Array.from({ length: o }, (i, c) => c + 1)
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 I(n, r, o) {
49
- const t = n.replace(/\D/g, "");
50
- if (t.length === 0) return null;
51
- const s = o ?? /* @__PURE__ */ new Date();
52
- switch (r) {
53
- case "date": {
54
- const i = parseInt(t.slice(0, 2), 10) || 1, c = parseInt(t.slice(2, 4), 10) || 1;
55
- let e = parseInt(t.slice(4, 8), 10) || s.getFullYear();
56
- t.length === 4 && (e = 2e3 + e), t.length === 2 && (e = s.getFullYear());
57
- const a = Math.min(c - 1, 11), u = new Date(e, a + 1, 0).getDate(), h = Math.min(i, u);
58
- return new Date(e, a, h);
59
- }
60
- case "time": {
61
- const i = parseInt(t.slice(0, 2), 10) || 0, c = parseInt(t.slice(2, 4), 10) || 0, e = parseInt(t.slice(4, 6), 10) || 0, a = s;
62
- return new Date(
63
- a.getFullYear(),
64
- a.getMonth(),
65
- a.getDate(),
66
- Math.min(i, 23),
67
- Math.min(c, 59),
68
- Math.min(e, 59)
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 $(n, r, o) {
88
- if (o >= n.length) return r.length;
89
- const s = (n.slice(0, o).match(/\d/g) || []).length;
90
- let i = 0;
91
- for (let c = 0; c < r.length; c++)
92
- if (/\d/.test(r[c]) && i++, i > s) {
93
- let e = 0;
94
- for (let a = 0; a < r.length; a++)
95
- if (/\d/.test(r[a]) && e++, e === s + 1)
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
- export {
102
- d as DAYS_OF_WEEK,
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
- * Extra classes applied to the overlay.
37
+ * Backdrop overlay overrides, including its class override.
20
38
  */
21
- overlayClassName?: string;
39
+ overlay?: DrawerOverlayProps;
22
40
  /**
23
- * Extra classes applied to the drawer content.
41
+ * Content panel overrides, including its class override.
24
42
  */
25
- contentClassName?: string;
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.overlayClassName - Extra classes for the overlay.
53
- * @param props.contentClassName - Extra classes for the drawer content.
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
- * overlayClassName="bg-black/50"
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;AAIf,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,iBAAiB,CAAC;AASzB,KAAK,eAAe,GAAG,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAErE;;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,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,eAAO,MAAM,MAAM,wGAwLlB,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
- import { jsxs as G, jsx as w } from "react/jsx-runtime";
3
- import { forwardRef as q, useState as V, useEffect as C, useCallback as J } from "react";
4
- import { useAsheeConfig as Q } from "../../libs/context.js";
5
- import { resolveCascade as a, resolveClassKey as R } from "../../utils/resolve-token.js";
6
- import { FALLBACK_DRAWER_CONFIG as t } from "./drawer-config.js";
7
- import { DRAWER_WIDTH_CLASS as U, DRAWER_HEIGHT_CLASS as X, DRAWER_ANIMATION_STATE as Y, DRAWER_BORDER_PLACEMENT_CLASS as b, DRAWER_CONTAINER_PLACEMENT_CLASS as y } from "./drawer-styles.js";
8
- import { cn as d } from "../../utils/cn.js";
9
- const Z = q(
10
- ({
11
- isOpen: c,
12
- onClose: r,
13
- placement: N,
14
- size: h,
15
- animated: O,
16
- closeOnOverlayClick: S,
17
- closeOnEsc: _,
18
- overlayClassName: k,
19
- contentClassName: D,
20
- className: L,
21
- children: T,
22
- style: x,
23
- ...z
24
- }, W) => {
25
- var f;
26
- const e = (f = Q().components) == null ? void 0 : f.drawer, [o, l] = V(c ? "open" : "unmounted");
27
- C(() => {
28
- if (c) {
29
- l("opening");
30
- const s = requestAnimationFrame(() => {
31
- l("open");
32
- });
33
- return () => cancelAnimationFrame(s);
34
- } else if (o !== "unmounted") {
35
- l("closing");
36
- const s = setTimeout(() => {
37
- l("unmounted");
38
- }, 250);
39
- return () => clearTimeout(s);
40
- }
41
- }, [c]);
42
- const m = a(
43
- h,
44
- e == null ? void 0 : e.size,
45
- void 0,
46
- t.size
47
- ), n = a(
48
- N,
49
- e == null ? void 0 : e.placement,
50
- void 0,
51
- t.placement
52
- ), I = a(
53
- S,
54
- e == null ? void 0 : e.closeOnOverlayClick,
55
- void 0,
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
- const t = {
4
- size: "md",
5
- placement: "right",
6
- animated: !0,
7
- closeOnOverlayClick: !0,
8
- closeOnEsc: !0
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
- size: "md",
11
- placement: "right",
12
- animated: !0,
13
- closeOnOverlayClick: !0,
14
- closeOnEsc: !0
11
+ size: "md",
12
+ placement: "right",
13
+ animated: !0,
14
+ closeOnOverlayClick: !0,
15
+ closeOnEsc: !0
15
16
  };
16
17
  e("drawer", t);
17
- export {
18
- n as FALLBACK_DRAWER_CONFIG,
19
- t as defaultDrawerConfig
20
- };
18
+ //#endregion
19
+ export { n as FALLBACK_DRAWER_CONFIG, t as defaultDrawerConfig };