@overdoser/react-toolkit 0.20.0 → 0.22.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 (212) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +41 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.scss.js +19 -35
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.scss.js +24 -46
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +93 -96
  9. package/components/Alert/Alert.module.scss.js +17 -32
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.scss.js +22 -42
  12. package/components/Badge/Badge.js +15 -37
  13. package/components/Badge/Badge.module.scss.js +16 -30
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.scss.js +24 -46
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.scss.js +34 -59
  21. package/components/Chart/AreaChart.d.ts +1 -1
  22. package/components/Chart/AreaChart.js +248 -249
  23. package/components/Chart/Axis.d.ts +2 -2
  24. package/components/Chart/Axis.js +34 -43
  25. package/components/Chart/BarChart.d.ts +1 -1
  26. package/components/Chart/BarChart.js +307 -348
  27. package/components/Chart/Chart.module.scss.js +31 -60
  28. package/components/Chart/ChartContainer.js +33 -41
  29. package/components/Chart/ChartLegend.d.ts +1 -1
  30. package/components/Chart/ChartLegend.js +31 -30
  31. package/components/Chart/ChartTooltip.d.ts +1 -1
  32. package/components/Chart/ChartTooltip.js +45 -40
  33. package/components/Chart/LineChart.d.ts +1 -1
  34. package/components/Chart/LineChart.js +220 -232
  35. package/components/Chart/PieChart.d.ts +1 -1
  36. package/components/Chart/PieChart.js +224 -240
  37. package/components/Chart/RadarChart.d.ts +1 -1
  38. package/components/Chart/RadarChart.js +166 -215
  39. package/components/Chart/Sparkline.js +73 -68
  40. package/components/Chart/TradingChart.d.ts +1 -1
  41. package/components/Chart/TradingChart.js +804 -701
  42. package/components/Chart/scales.js +28 -35
  43. package/components/Chart/trading/indicators.js +61 -62
  44. package/components/Chart/trading/period.js +46 -68
  45. package/components/Chart/useChartDimensions.js +30 -22
  46. package/components/Chip/Chip.js +98 -141
  47. package/components/Chip/Chip.module.scss.js +31 -58
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.scss.js +16 -30
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.scss.js +9 -16
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.scss.js +65 -118
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.scss.js +28 -52
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +13 -11
  67. package/components/Dropdown/dropdownContext.js +4 -5
  68. package/components/Dropdown/useContextMenu.js +27 -17
  69. package/components/Dropzone/Dropzone.js +99 -105
  70. package/components/Dropzone/Dropzone.module.scss.js +11 -20
  71. package/components/EmptyState/EmptyState.js +57 -54
  72. package/components/EmptyState/EmptyState.module.scss.js +13 -24
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +31 -34
  75. package/components/Form/Form.module.scss.js +15 -28
  76. package/components/Form/FormField.d.ts +1 -1
  77. package/components/Form/FormField.js +71 -75
  78. package/components/Form/FormRow.d.ts +1 -1
  79. package/components/Form/FormRow.js +11 -8
  80. package/components/Form/formFieldDefaults.js +4 -5
  81. package/components/ImageViewer/ImageViewer.js +312 -201
  82. package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +24 -21
  85. package/components/Kbd/Kbd.module.scss.js +9 -16
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.scss.js +9 -15
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.scss.js +11 -20
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.scss.js +39 -69
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.scss.js +17 -32
  96. package/components/PageHeader/PageHeader.js +79 -73
  97. package/components/PageHeader/PageHeader.module.scss.js +22 -42
  98. package/components/Pagination/Pagination.js +62 -83
  99. package/components/Pagination/Pagination.module.scss.js +12 -22
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.scss.js +11 -20
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +56 -89
  105. package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
  108. package/components/SegmentedControl/SegmentedControl.js +93 -129
  109. package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.scss.js +14 -24
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.scss.js +11 -19
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.scss.js +30 -56
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.scss.js +13 -24
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.scss.js +41 -71
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.scss.js +17 -31
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.scss.js +41 -80
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.scss.js +27 -52
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.scss.js +28 -54
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
  134. package/components/Timeline/Timeline.module.scss.js +75 -140
  135. package/components/Timeline/TimelineShared.d.ts +7 -7
  136. package/components/Timeline/TimelineShared.js +288 -279
  137. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  138. package/components/Timeline/TraceEventDetails.js +244 -177
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.scss.js +97 -188
  141. package/components/Timeline/historyLayout.js +336 -263
  142. package/components/Timeline/timelineCore.js +208 -183
  143. package/components/Timeline/traceEvent.js +59 -61
  144. package/components/Timeline/traceLayout.js +101 -90
  145. package/components/Timeline/useTimeline.js +76 -79
  146. package/components/Timer/Timer.js +190 -156
  147. package/components/Timer/Timer.module.scss.js +28 -54
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.scss.js +36 -61
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +36 -58
  153. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.scss.js +16 -29
  157. package/components/Typography/Typography.js +10 -35
  158. package/components/Typography/Typography.module.scss.js +29 -52
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
  163. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  164. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  165. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
  168. package/components/inputs/DatePicker/dateUtils.js +32 -41
  169. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  170. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
  171. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  172. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  173. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  174. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  175. package/components/inputs/Input/Input.js +98 -109
  176. package/components/inputs/Input/Input.module.scss.js +14 -26
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.scss.js +8 -14
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
  183. package/components/inputs/Select/Select.d.ts +55 -3
  184. package/components/inputs/Select/Select.js +696 -682
  185. package/components/inputs/Select/Select.module.scss.js +49 -72
  186. package/components/inputs/Slider/Slider.js +97 -128
  187. package/components/inputs/Slider/Slider.module.scss.js +8 -14
  188. package/components/inputs/Switch/Switch.js +11 -8
  189. package/components/inputs/Textarea/Textarea.js +42 -58
  190. package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
  191. package/hooks/useClickOutside.js +17 -14
  192. package/hooks/useDebouncedValue.js +13 -14
  193. package/hooks/useElementSize.js +27 -22
  194. package/hooks/useEscapeLayer.js +28 -29
  195. package/hooks/useFocusTrap.js +27 -38
  196. package/hooks/useKeyboard.js +76 -64
  197. package/hooks/useMediaQuery.js +10 -15
  198. package/hooks/useNow.js +28 -33
  199. package/hooks/usePersistedState.js +98 -94
  200. package/hooks/usePortalPosition.d.ts +2 -1
  201. package/hooks/usePortalPosition.js +28 -19
  202. package/hooks/useResizable.js +106 -104
  203. package/hooks/useTheme.js +28 -23
  204. package/index.css +2 -1
  205. package/index.js +96 -214
  206. package/index.layered.css +2 -3
  207. package/llms.txt +28 -4
  208. package/manifest.json +41 -4
  209. package/package.json +1 -1
  210. package/utils/formatBytes.js +29 -13
  211. package/utils/themeScript.js +6 -8
  212. package/utils/timeAgo.js +59 -32
@@ -1,119 +1,66 @@
1
- const r = "crk-backdrop-LBGhN", t = "crk-crk-drawer-fade-in-fnZXU", e = "crk-backdropClosing-0aeyJ", o = "crk-crk-drawer-fade-out-iDYoX", c = "crk-backdropBare-7fB4W", s = "crk-drawer-IKoOm", i = "crk-side_right-sYQoY", d = "crk-side_right-sYQoY", k = "crk-side_left-gAeYL", n = "crk-side_left-gAeYL", l = "crk-side_top-QFjZz", a = "crk-side_top-QFjZz", u = "crk-side_bottom-Y1t6g", _ = "crk-side_bottom-Y1t6g", w = "crk-slideIn_right-HORcg", g = "crk-slideIn_right-HORcg", f = "crk-crk-drawer-in-right-lit2r", p = "crk-slideOut_right-lbnQY", I = "crk-slideOut_right-lbnQY", O = "crk-crk-drawer-out-right-lrub3", m = "crk-slideIn_left-VvJeV", h = "crk-slideIn_left-VvJeV", b = "crk-crk-drawer-in-left-98vE7", z = "crk-slideOut_left-4pc01", D = "crk-slideOut_left-4pc01", L = "crk-crk-drawer-out-left-EI6P3", B = "crk-slideIn_top-ULcWL", T = "crk-slideIn_top-ULcWL", R = "crk-crk-drawer-in-top-8ZkO6", Y = "crk-slideOut_top-00Tue", F = "crk-slideOut_top-00Tue", C = "crk-crk-drawer-out-top-KDkv7", y = "crk-slideIn_bottom-uBTzu", Q = "crk-slideIn_bottom-uBTzu", E = "crk-crk-drawer-in-bottom-b9y67", j = "crk-slideOut_bottom-g6ELp", v = "crk-slideOut_bottom-g6ELp", S = "crk-crk-drawer-out-bottom-IShFs", X = "crk-size_sm-o8tw7", Z = "crk-size_sm-o8tw7", P = "crk-size_md-akgTC", U = "crk-size_md-akgTC", V = "crk-size_lg-Yjulz", W = "crk-size_lg-Yjulz", J = "crk-size_full-DIjPg", K = "crk-size_full-DIjPg", A = "crk-header--OScS", H = "crk-headerTitle-LQr32", M = "crk-closeButton-WdXyR", x = "crk-body-CXRcE", G = "crk-footer-0kQ83", N = "crk-drawerClosing-9hrsd", q = {
2
- backdrop: r,
3
- "crk-drawer-fade-in": "crk-crk-drawer-fade-in-fnZXU",
4
- crkDrawerFadeIn: t,
5
- backdropClosing: e,
6
- "crk-drawer-fade-out": "crk-crk-drawer-fade-out-iDYoX",
7
- crkDrawerFadeOut: o,
8
- backdropBare: c,
9
- drawer: s,
10
- side_right: i,
11
- sideRight: d,
12
- side_left: k,
13
- sideLeft: n,
14
- side_top: l,
15
- sideTop: a,
16
- side_bottom: u,
17
- sideBottom: _,
18
- slideIn_right: w,
19
- slideInRight: g,
20
- "crk-drawer-in-right": "crk-crk-drawer-in-right-lit2r",
21
- crkDrawerInRight: f,
22
- slideOut_right: p,
23
- slideOutRight: I,
24
- "crk-drawer-out-right": "crk-crk-drawer-out-right-lrub3",
25
- crkDrawerOutRight: O,
26
- slideIn_left: m,
27
- slideInLeft: h,
28
- "crk-drawer-in-left": "crk-crk-drawer-in-left-98vE7",
29
- crkDrawerInLeft: b,
30
- slideOut_left: z,
31
- slideOutLeft: D,
32
- "crk-drawer-out-left": "crk-crk-drawer-out-left-EI6P3",
33
- crkDrawerOutLeft: L,
34
- slideIn_top: B,
35
- slideInTop: T,
36
- "crk-drawer-in-top": "crk-crk-drawer-in-top-8ZkO6",
37
- crkDrawerInTop: R,
38
- slideOut_top: Y,
39
- slideOutTop: F,
40
- "crk-drawer-out-top": "crk-crk-drawer-out-top-KDkv7",
41
- crkDrawerOutTop: C,
42
- slideIn_bottom: y,
43
- slideInBottom: Q,
44
- "crk-drawer-in-bottom": "crk-crk-drawer-in-bottom-b9y67",
45
- crkDrawerInBottom: E,
46
- slideOut_bottom: j,
47
- slideOutBottom: v,
48
- "crk-drawer-out-bottom": "crk-crk-drawer-out-bottom-IShFs",
49
- crkDrawerOutBottom: S,
50
- size_sm: X,
51
- sizeSm: Z,
52
- size_md: P,
53
- sizeMd: U,
54
- size_lg: V,
55
- sizeLg: W,
56
- size_full: J,
57
- sizeFull: K,
58
- header: A,
59
- headerTitle: H,
60
- closeButton: M,
61
- body: x,
62
- footer: G,
63
- drawerClosing: N
64
- };
65
- export {
66
- r as backdrop,
67
- c as backdropBare,
68
- e as backdropClosing,
69
- x as body,
70
- M as closeButton,
71
- t as crkDrawerFadeIn,
72
- o as crkDrawerFadeOut,
73
- E as crkDrawerInBottom,
74
- b as crkDrawerInLeft,
75
- f as crkDrawerInRight,
76
- R as crkDrawerInTop,
77
- S as crkDrawerOutBottom,
78
- L as crkDrawerOutLeft,
79
- O as crkDrawerOutRight,
80
- C as crkDrawerOutTop,
81
- q as default,
82
- s as drawer,
83
- N as drawerClosing,
84
- G as footer,
85
- A as header,
86
- H as headerTitle,
87
- _ as sideBottom,
88
- n as sideLeft,
89
- d as sideRight,
90
- a as sideTop,
91
- u as side_bottom,
92
- k as side_left,
93
- i as side_right,
94
- l as side_top,
95
- K as sizeFull,
96
- W as sizeLg,
97
- U as sizeMd,
98
- Z as sizeSm,
99
- J as size_full,
100
- V as size_lg,
101
- P as size_md,
102
- X as size_sm,
103
- Q as slideInBottom,
104
- h as slideInLeft,
105
- g as slideInRight,
106
- T as slideInTop,
107
- y as slideIn_bottom,
108
- m as slideIn_left,
109
- w as slideIn_right,
110
- B as slideIn_top,
111
- v as slideOutBottom,
112
- D as slideOutLeft,
113
- I as slideOutRight,
114
- F as slideOutTop,
115
- j as slideOut_bottom,
116
- z as slideOut_left,
117
- p as slideOut_right,
118
- Y as slideOut_top
1
+ // src/components/Drawer/Drawer.module.scss
2
+ var e = "crk-backdrop-LBGhN", t = "crk-crk-drawer-fade-in-fnZXU", n = "crk-backdropClosing-0aeyJ", r = "crk-crk-drawer-fade-out-iDYoX", i = "crk-backdropBare-7fB4W", a = "crk-drawer-IKoOm", o = "crk-side_right-sYQoY", s = "crk-side_right-sYQoY", c = "crk-side_left-gAeYL", l = "crk-side_left-gAeYL", u = "crk-side_top-QFjZz", d = "crk-side_top-QFjZz", f = "crk-side_bottom-Y1t6g", p = "crk-side_bottom-Y1t6g", m = "crk-slideIn_right-HORcg", h = "crk-slideIn_right-HORcg", g = "crk-crk-drawer-in-right-lit2r", _ = "crk-slideOut_right-lbnQY", v = "crk-slideOut_right-lbnQY", y = "crk-crk-drawer-out-right-lrub3", b = "crk-slideIn_left-VvJeV", x = "crk-slideIn_left-VvJeV", S = "crk-crk-drawer-in-left-98vE7", C = "crk-slideOut_left-4pc01", w = "crk-slideOut_left-4pc01", T = "crk-crk-drawer-out-left-EI6P3", E = "crk-slideIn_top-ULcWL", D = "crk-slideIn_top-ULcWL", O = "crk-crk-drawer-in-top-8ZkO6", k = "crk-slideOut_top-00Tue", A = "crk-slideOut_top-00Tue", j = "crk-crk-drawer-out-top-KDkv7", M = "crk-slideIn_bottom-uBTzu", N = "crk-slideIn_bottom-uBTzu", P = "crk-crk-drawer-in-bottom-b9y67", F = "crk-slideOut_bottom-g6ELp", I = "crk-slideOut_bottom-g6ELp", L = "crk-crk-drawer-out-bottom-IShFs", R = "crk-size_sm-o8tw7", z = "crk-size_sm-o8tw7", B = "crk-size_md-akgTC", V = "crk-size_md-akgTC", H = "crk-size_lg-Yjulz", U = "crk-size_lg-Yjulz", W = "crk-size_full-DIjPg", G = "crk-size_full-DIjPg", K = "crk-header--OScS", q = "crk-headerTitle-LQr32", J = "crk-closeButton-WdXyR", Y = "crk-body-CXRcE", X = "crk-footer-0kQ83", Z = "crk-drawerClosing-9hrsd", Q = {
3
+ backdrop: e,
4
+ "crk-drawer-fade-in": "crk-crk-drawer-fade-in-fnZXU",
5
+ crkDrawerFadeIn: t,
6
+ backdropClosing: n,
7
+ "crk-drawer-fade-out": "crk-crk-drawer-fade-out-iDYoX",
8
+ crkDrawerFadeOut: r,
9
+ backdropBare: i,
10
+ drawer: a,
11
+ side_right: o,
12
+ sideRight: s,
13
+ side_left: c,
14
+ sideLeft: l,
15
+ side_top: u,
16
+ sideTop: d,
17
+ side_bottom: f,
18
+ sideBottom: p,
19
+ slideIn_right: m,
20
+ slideInRight: h,
21
+ "crk-drawer-in-right": "crk-crk-drawer-in-right-lit2r",
22
+ crkDrawerInRight: g,
23
+ slideOut_right: _,
24
+ slideOutRight: v,
25
+ "crk-drawer-out-right": "crk-crk-drawer-out-right-lrub3",
26
+ crkDrawerOutRight: y,
27
+ slideIn_left: b,
28
+ slideInLeft: x,
29
+ "crk-drawer-in-left": "crk-crk-drawer-in-left-98vE7",
30
+ crkDrawerInLeft: S,
31
+ slideOut_left: C,
32
+ slideOutLeft: w,
33
+ "crk-drawer-out-left": "crk-crk-drawer-out-left-EI6P3",
34
+ crkDrawerOutLeft: T,
35
+ slideIn_top: E,
36
+ slideInTop: D,
37
+ "crk-drawer-in-top": "crk-crk-drawer-in-top-8ZkO6",
38
+ crkDrawerInTop: O,
39
+ slideOut_top: k,
40
+ slideOutTop: A,
41
+ "crk-drawer-out-top": "crk-crk-drawer-out-top-KDkv7",
42
+ crkDrawerOutTop: j,
43
+ slideIn_bottom: M,
44
+ slideInBottom: N,
45
+ "crk-drawer-in-bottom": "crk-crk-drawer-in-bottom-b9y67",
46
+ crkDrawerInBottom: P,
47
+ slideOut_bottom: F,
48
+ slideOutBottom: I,
49
+ "crk-drawer-out-bottom": "crk-crk-drawer-out-bottom-IShFs",
50
+ crkDrawerOutBottom: L,
51
+ size_sm: R,
52
+ sizeSm: z,
53
+ size_md: B,
54
+ sizeMd: V,
55
+ size_lg: H,
56
+ sizeLg: U,
57
+ size_full: W,
58
+ sizeFull: G,
59
+ header: K,
60
+ headerTitle: q,
61
+ closeButton: J,
62
+ body: Y,
63
+ footer: X,
64
+ drawerClosing: Z
119
65
  };
66
+ export { e as backdrop, i as backdropBare, n as backdropClosing, Y as body, J as closeButton, t as crkDrawerFadeIn, r as crkDrawerFadeOut, P as crkDrawerInBottom, S as crkDrawerInLeft, g as crkDrawerInRight, O as crkDrawerInTop, L as crkDrawerOutBottom, T as crkDrawerOutLeft, y as crkDrawerOutRight, j as crkDrawerOutTop, Q as default, a as drawer, Z as drawerClosing, X as footer, K as header, q as headerTitle, p as sideBottom, l as sideLeft, s as sideRight, d as sideTop, f as side_bottom, c as side_left, o as side_right, u as side_top, G as sizeFull, U as sizeLg, V as sizeMd, z as sizeSm, W as size_full, H as size_lg, B as size_md, R as size_sm, N as slideInBottom, x as slideInLeft, h as slideInRight, D as slideInTop, M as slideIn_bottom, b as slideIn_left, m as slideIn_right, E as slideIn_top, I as slideOutBottom, w as slideOutLeft, v as slideOutRight, A as slideOutTop, F as slideOut_bottom, C as slideOut_left, _ as slideOut_right, k as slideOut_top };
@@ -1,234 +1,175 @@
1
- import { jsx as u, jsxs as v } from "react/jsx-runtime";
2
- import { forwardRef as me, useState as $, useRef as E, useId as fe, useCallback as y, useEffect as ee, useLayoutEffect as he } from "react";
3
- import { createPortal as te } from "react-dom";
4
- import l from "clsx";
5
- import t from "./Dropdown.module.scss.js";
6
- import { useEscapeLayer as ge, EscapeLayerProvider as pe } from "../../hooks/useEscapeLayer.js";
7
- import { usePortalPosition as ve } from "../../hooks/usePortalPosition.js";
8
- import { DropdownMenuContext as ye } from "./dropdownContext.js";
9
- const ne = '[role="menuitem"]:not(:disabled), [role="menuitemcheckbox"]:not(:disabled)', g = 8, we = me(
10
- ({
11
- trigger: A,
12
- children: re,
13
- align: L = "left",
14
- className: O,
15
- style: K,
16
- id: W,
17
- onOpen: z,
18
- onClose: T,
19
- options: f,
20
- placeholder: oe = "Select...",
21
- value: H,
22
- onChange: j,
23
- error: q = !1,
24
- fullWidth: a = !0,
25
- portal: w = !0,
26
- open: B,
27
- onOpenChange: _,
28
- anchor: o,
29
- classes: i
30
- }, G) => {
31
- const [ie, ce] = $(!1), D = B !== void 0, n = D ? B : ie, M = E(n);
32
- M.current = n;
33
- const k = E(null), s = E(null), b = E(null), I = fe(), N = o !== void 0, U = N && o !== null, V = !!f || A !== void 0 || !N, x = y(
34
- (e) => {
35
- e !== M.current && (D || ce(e), _?.(e), e ? z?.() : T?.());
36
- },
37
- [D, _, z, T]
38
- );
39
- ee(() => {
40
- n && s.current && s.current.querySelector(ne)?.focus();
41
- }, [n]);
42
- const h = y(() => {
43
- x(!1), b.current?.focus();
44
- }, [x]), F = y(() => {
45
- x(!M.current);
46
- }, [x]), le = y((e) => {
47
- const m = s.current;
48
- if (!m) return;
49
- const r = Array.from(m.querySelectorAll(ne));
50
- if (r.length === 0) return;
51
- const d = r.indexOf(document.activeElement), c = (P) => {
52
- r[(P + r.length) % r.length]?.focus();
53
- };
54
- switch (e.key) {
55
- case "ArrowDown":
56
- e.preventDefault(), c(d + 1);
57
- return;
58
- case "ArrowUp":
59
- e.preventDefault(), c(d - 1);
60
- return;
61
- case "Home":
62
- e.preventDefault(), c(0);
63
- return;
64
- case "End":
65
- e.preventDefault(), c(r.length - 1);
66
- return;
67
- }
68
- if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e.key !== " ") {
69
- const P = e.key.toLowerCase();
70
- for (let S = 1; S <= r.length; S++) {
71
- const Z = r[(d + S) % r.length];
72
- if ((Z.textContent ?? "").trim().toLowerCase().startsWith(P)) {
73
- e.preventDefault(), Z.focus();
74
- return;
75
- }
76
- }
77
- }
78
- }, []), [R, J] = $(null);
79
- he(() => {
80
- if (!n || !o || !s.current || typeof window > "u") {
81
- J(null);
82
- return;
83
- }
84
- const e = s.current.getBoundingClientRect(), m = document.documentElement.clientWidth || window.innerWidth, r = document.documentElement.clientHeight || window.innerHeight;
85
- let d = o.x, c = o.y;
86
- d + e.width > m - g && (d = o.x - e.width), c + e.height > r - g && (c = o.y - e.height), d = Math.max(g, Math.min(d, m - g - e.width)), c = Math.max(g, Math.min(c, r - g - e.height)), J({ top: Math.round(c), left: Math.round(d) });
87
- }, [n, o?.x, o?.y]);
88
- const de = y(
89
- (e) => {
90
- j?.(e), h();
91
- },
92
- [j, h]
93
- );
94
- ee(() => {
95
- if (!n) return;
96
- const e = (m) => {
97
- const r = m.target;
98
- k.current?.contains(r) || s.current?.contains(r) || h();
99
- };
100
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
101
- }, [n, h]);
102
- const ue = ge(h, n), p = ve(b, n && w && !U), ae = { close: h }, Q = f?.find((e) => e.value === H)?.label, X = f ? Q || oe : A, Y = f && !Q, se = f ? f.map((e) => /* @__PURE__ */ u(
103
- "button",
104
- {
105
- type: "button",
106
- role: "menuitem",
107
- className: l(
108
- t.item,
109
- e.disabled && t.itemDisabled,
110
- e.value === H && t.itemSelected,
111
- i?.item
112
- ),
113
- disabled: e.disabled,
114
- onClick: () => de(e.value),
115
- children: e.label
116
- },
117
- e.value
118
- )) : re, C = (e) => /* @__PURE__ */ u(
119
- "div",
120
- {
121
- ref: s,
122
- id: I,
123
- className: l(
124
- t.menu,
125
- n && t.menuOpen,
126
- L === "left" ? t.alignLeft : t.alignRight,
127
- !w && a && t.fullWidth,
128
- i?.menu
129
- ),
130
- style: e,
131
- role: "menu",
132
- onKeyDown: le,
133
- children: /* @__PURE__ */ u(pe, { value: ue, children: /* @__PURE__ */ u(ye.Provider, { value: ae, children: se }) })
134
- }
135
- );
136
- return N ? /* @__PURE__ */ v(
137
- "div",
138
- {
139
- ref: G,
140
- className: l(t.root, V && a && t.fullWidth, i?.root, O),
141
- style: K,
142
- children: [
143
- V && /* @__PURE__ */ u("div", { ref: k, style: a ? { width: "100%" } : void 0, children: /* @__PURE__ */ v(
144
- "button",
145
- {
146
- ref: b,
147
- id: W,
148
- type: "button",
149
- className: l(
150
- t.trigger,
151
- n && t.triggerOpen,
152
- q && t.triggerError,
153
- a && t.fullWidth,
154
- i?.trigger
155
- ),
156
- onClick: F,
157
- "aria-expanded": n,
158
- "aria-haspopup": "menu",
159
- "aria-controls": n ? I : void 0,
160
- children: [
161
- /* @__PURE__ */ u("span", { className: l(t.triggerLabel, Y && t.placeholder, i?.triggerLabel), children: X }),
162
- /* @__PURE__ */ u("span", { className: l(t.chevron, i?.chevron), "aria-hidden": "true" })
163
- ]
164
- }
165
- ) }),
166
- n && U && typeof document < "u" && te(
167
- C({
168
- position: "fixed",
169
- top: R?.top ?? o.y,
170
- left: R?.left ?? o.x,
171
- visibility: R ? void 0 : "hidden",
172
- zIndex: "var(--crk-z-floating)"
173
- }),
174
- document.body
175
- )
176
- ]
177
- }
178
- ) : /* @__PURE__ */ v(
179
- "div",
180
- {
181
- ref: G,
182
- className: l(t.root, a && t.fullWidth, i?.root, O),
183
- style: K,
184
- children: [
185
- /* @__PURE__ */ v("div", { ref: k, style: a ? { width: "100%" } : void 0, children: [
186
- /* @__PURE__ */ v(
187
- "button",
188
- {
189
- ref: b,
190
- id: W,
191
- type: "button",
192
- className: l(
193
- t.trigger,
194
- n && t.triggerOpen,
195
- q && t.triggerError,
196
- a && t.fullWidth,
197
- i?.trigger
198
- ),
199
- onClick: F,
200
- "aria-expanded": n,
201
- "aria-haspopup": "menu",
202
- "aria-controls": n ? I : void 0,
203
- children: [
204
- /* @__PURE__ */ u("span", { className: l(t.triggerLabel, Y && t.placeholder, i?.triggerLabel), children: X }),
205
- /* @__PURE__ */ u("span", { className: l(t.chevron, i?.chevron), "aria-hidden": "true" })
206
- ]
207
- }
208
- ),
209
- !w && C()
210
- ] }),
211
- w && n && typeof document < "u" && te(
212
- C({
213
- position: "fixed",
214
- top: p.top + 4,
215
- left: L === "right" ? void 0 : p.left,
216
- // clientWidth, not innerWidth: `right` on a fixed element is
217
- // measured from the viewport edge inside the scrollbar, while
218
- // innerWidth includes it — the menu would shift left by the
219
- // scrollbar width whenever the page scrolls.
220
- right: L === "right" ? document.documentElement.clientWidth - (p.left + p.width) : void 0,
221
- minWidth: p.width,
222
- zIndex: "var(--crk-z-floating)"
223
- }),
224
- document.body
225
- )
226
- ]
227
- }
228
- );
229
- }
230
- );
231
- we.displayName = "Dropdown";
232
- export {
233
- we as Dropdown
234
- };
1
+ import { forwardRef as e, useCallback as t, useEffect as n, useId as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
2
+ import { createPortal as s } from "react-dom";
3
+ import c from "clsx";
4
+ import l from "./Dropdown.module.scss.js";
5
+ import { EscapeLayerProvider as u, useEscapeLayer as ee } from "../../hooks/useEscapeLayer.js";
6
+ import { usePortalPosition as te } from "../../hooks/usePortalPosition.js";
7
+ import { DropdownMenuContext as ne } from "./dropdownContext.js";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ // src/components/Dropdown/Dropdown.tsx
10
+ var p = "[role=\"menuitem\"]:not(:disabled), [role=\"menuitemcheckbox\"]:not(:disabled)", m = 8, h = e(({ trigger: e, children: h, align: g = "left", className: _, style: v, id: y, onOpen: b, onClose: x, options: S, placeholder: re = "Select...", value: C, onChange: w, error: T = !1, fullWidth: E = !0, portal: D = !0, open: O, onOpenChange: k, anchor: A, classes: j }, M) => {
11
+ let [N, ie] = o(!1), P = O !== void 0, F = P ? O : N, I = a(F);
12
+ I.current = F;
13
+ let L = a(null), R = a(null), z = a(null), B = r(), V = A !== void 0, H = V && A !== null, U = !!S || e !== void 0 || !V, W = t((e) => {
14
+ e !== I.current && (P || ie(e), k?.(e), e ? b?.() : x?.());
15
+ }, [
16
+ P,
17
+ k,
18
+ b,
19
+ x
20
+ ]);
21
+ n(() => {
22
+ F && R.current && R.current.querySelector(p)?.focus();
23
+ }, [F]);
24
+ let G = t(() => {
25
+ W(!1), z.current?.focus();
26
+ }, [W]), K = t(() => {
27
+ W(!I.current);
28
+ }, [W]), ae = t((e) => {
29
+ let t = R.current;
30
+ if (!t) return;
31
+ let n = Array.from(t.querySelectorAll(p));
32
+ if (n.length === 0) return;
33
+ let r = n.indexOf(document.activeElement), i = (e) => {
34
+ n[(e + n.length) % n.length]?.focus();
35
+ };
36
+ switch (e.key) {
37
+ case "ArrowDown":
38
+ e.preventDefault(), i(r + 1);
39
+ return;
40
+ case "ArrowUp":
41
+ e.preventDefault(), i(r - 1);
42
+ return;
43
+ case "Home":
44
+ e.preventDefault(), i(0);
45
+ return;
46
+ case "End":
47
+ e.preventDefault(), i(n.length - 1);
48
+ return;
49
+ }
50
+ if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e.key !== " ") {
51
+ let t = e.key.toLowerCase();
52
+ for (let i = 1; i <= n.length; i++) {
53
+ let a = n[(r + i) % n.length];
54
+ if ((a.textContent ?? "").trim().toLowerCase().startsWith(t)) {
55
+ e.preventDefault(), a.focus();
56
+ return;
57
+ }
58
+ }
59
+ }
60
+ }, []), [q, J] = o(null);
61
+ i(() => {
62
+ if (!F || !A || !R.current || typeof window > "u") {
63
+ J(null);
64
+ return;
65
+ }
66
+ let e = R.current.getBoundingClientRect(), t = document.documentElement.clientWidth || window.innerWidth, n = document.documentElement.clientHeight || window.innerHeight, r = A.x, i = A.y;
67
+ r + e.width > t - m && (r = A.x - e.width), i + e.height > n - m && (i = A.y - e.height), r = Math.max(m, Math.min(r, t - m - e.width)), i = Math.max(m, Math.min(i, n - m - e.height)), J({
68
+ top: Math.round(i),
69
+ left: Math.round(r)
70
+ });
71
+ }, [
72
+ F,
73
+ A?.x,
74
+ A?.y
75
+ ]);
76
+ let oe = t((e) => {
77
+ w?.(e), G();
78
+ }, [w, G]);
79
+ n(() => {
80
+ if (!F) return;
81
+ let e = (e) => {
82
+ let t = e.target;
83
+ L.current?.contains(t) || R.current?.contains(t) || G();
84
+ };
85
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
86
+ }, [F, G]);
87
+ let se = ee(G, F), Y = te(z, F && D && !H), ce = { close: G }, X = S?.find((e) => e.value === C)?.label, Z = S ? X || re : e, Q = S && !X, le = S ? S.map((e) => /* @__PURE__ */ d("button", {
88
+ type: "button",
89
+ role: "menuitem",
90
+ className: c(l.item, e.disabled && l.itemDisabled, e.value === C && l.itemSelected, j?.item),
91
+ disabled: e.disabled,
92
+ onClick: () => oe(e.value),
93
+ children: e.label
94
+ }, e.value)) : h, $ = (e) => /* @__PURE__ */ d("div", {
95
+ ref: R,
96
+ id: B,
97
+ className: c(l.menu, F && l.menuOpen, g === "left" ? l.alignLeft : l.alignRight, !D && E && l.fullWidth, j?.menu),
98
+ style: e,
99
+ role: "menu",
100
+ onKeyDown: ae,
101
+ children: /* @__PURE__ */ d(u, {
102
+ value: se,
103
+ children: /* @__PURE__ */ d(ne.Provider, {
104
+ value: ce,
105
+ children: le
106
+ })
107
+ })
108
+ });
109
+ return V ? /* @__PURE__ */ f("div", {
110
+ ref: M,
111
+ className: c(l.root, U && E && l.fullWidth, j?.root, _),
112
+ style: v,
113
+ children: [U && /* @__PURE__ */ d("div", {
114
+ ref: L,
115
+ style: E ? { width: "100%" } : void 0,
116
+ children: /* @__PURE__ */ f("button", {
117
+ ref: z,
118
+ id: y,
119
+ type: "button",
120
+ className: c(l.trigger, F && l.triggerOpen, T && l.triggerError, E && l.fullWidth, j?.trigger),
121
+ onClick: K,
122
+ "aria-expanded": F,
123
+ "aria-haspopup": "menu",
124
+ "aria-controls": F ? B : void 0,
125
+ children: [/* @__PURE__ */ d("span", {
126
+ className: c(l.triggerLabel, Q && l.placeholder, j?.triggerLabel),
127
+ children: Z
128
+ }), /* @__PURE__ */ d("span", {
129
+ className: c(l.chevron, j?.chevron),
130
+ "aria-hidden": "true"
131
+ })]
132
+ })
133
+ }), F && H && typeof document < "u" && s($({
134
+ position: "fixed",
135
+ top: q?.top ?? A.y,
136
+ left: q?.left ?? A.x,
137
+ visibility: q ? void 0 : "hidden",
138
+ zIndex: "var(--crk-z-floating)"
139
+ }), document.body)]
140
+ }) : /* @__PURE__ */ f("div", {
141
+ ref: M,
142
+ className: c(l.root, E && l.fullWidth, j?.root, _),
143
+ style: v,
144
+ children: [/* @__PURE__ */ f("div", {
145
+ ref: L,
146
+ style: E ? { width: "100%" } : void 0,
147
+ children: [/* @__PURE__ */ f("button", {
148
+ ref: z,
149
+ id: y,
150
+ type: "button",
151
+ className: c(l.trigger, F && l.triggerOpen, T && l.triggerError, E && l.fullWidth, j?.trigger),
152
+ onClick: K,
153
+ "aria-expanded": F,
154
+ "aria-haspopup": "menu",
155
+ "aria-controls": F ? B : void 0,
156
+ children: [/* @__PURE__ */ d("span", {
157
+ className: c(l.triggerLabel, Q && l.placeholder, j?.triggerLabel),
158
+ children: Z
159
+ }), /* @__PURE__ */ d("span", {
160
+ className: c(l.chevron, j?.chevron),
161
+ "aria-hidden": "true"
162
+ })]
163
+ }), !D && $()]
164
+ }), D && F && typeof document < "u" && s($({
165
+ position: "fixed",
166
+ top: Y.top + 4,
167
+ left: g === "right" ? void 0 : Y.left,
168
+ right: g === "right" ? document.documentElement.clientWidth - (Y.left + Y.width) : void 0,
169
+ minWidth: Y.width,
170
+ zIndex: "var(--crk-z-floating)"
171
+ }), document.body)]
172
+ });
173
+ });
174
+ h.displayName = "Dropdown";
175
+ export { h as Dropdown };