@overdoser/react-toolkit 0.19.0 → 0.21.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 (279) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +47 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.js +20 -0
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.js +25 -0
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +92 -95
  9. package/components/Alert/Alert.module.js +18 -0
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.js +23 -0
  12. package/components/Badge/Badge.js +16 -38
  13. package/components/Badge/Badge.module.js +17 -0
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.js +10 -0
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.js +25 -0
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.js +35 -0
  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.js +32 -0
  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 +46 -41
  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.js +32 -0
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.js +23 -0
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.js +28 -0
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.js +12 -0
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.js +17 -0
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.js +10 -0
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.js +66 -0
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.js +29 -0
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +12 -10
  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.js +12 -0
  71. package/components/EmptyState/EmptyState.js +58 -55
  72. package/components/EmptyState/EmptyState.module.js +14 -0
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +32 -35
  75. package/components/Form/Form.module.js +16 -0
  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.js +26 -0
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +25 -22
  85. package/components/Kbd/Kbd.module.js +10 -0
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.js +23 -0
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.js +10 -0
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.js +12 -0
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.js +40 -0
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.js +18 -0
  96. package/components/PageHeader/PageHeader.js +78 -72
  97. package/components/PageHeader/PageHeader.module.js +23 -0
  98. package/components/Pagination/Pagination.js +63 -84
  99. package/components/Pagination/Pagination.module.js +13 -0
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.js +12 -0
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +57 -90
  105. package/components/ProgressBar/ProgressBar.module.js +29 -0
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.js +3 -0
  108. package/components/SegmentedControl/SegmentedControl.js +94 -130
  109. package/components/SegmentedControl/SegmentedControl.module.js +21 -0
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.js +15 -0
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.js +12 -0
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.js +31 -0
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.js +14 -0
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.js +42 -0
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.js +18 -0
  122. package/components/Table/Table.d.ts +41 -16
  123. package/components/Table/Table.js +383 -442
  124. package/components/Table/Table.module.js +42 -0
  125. package/components/Table/index.d.ts +1 -1
  126. package/components/Table/useTableSort.d.ts +1 -1
  127. package/components/Table/useTableSort.js +51 -42
  128. package/components/Tabs/Tabs.js +109 -161
  129. package/components/Tabs/Tabs.module.js +28 -0
  130. package/components/ThemeToggle/ThemeToggle.d.ts +2 -0
  131. package/components/ThemeToggle/ThemeToggle.js +122 -97
  132. package/components/ThemeToggle/ThemeToggle.module.js +13 -0
  133. package/components/Timeline/GanttTimeline.js +357 -318
  134. package/components/Timeline/GanttTimeline.module.js +29 -0
  135. package/components/Timeline/HistoryTimeline.js +486 -450
  136. package/components/Timeline/HistoryTimeline.module.js +31 -0
  137. package/components/Timeline/Timeline.module.js +76 -0
  138. package/components/Timeline/TimelineShared.d.ts +7 -7
  139. package/components/Timeline/TimelineShared.js +288 -279
  140. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  141. package/components/Timeline/TraceEventDetails.js +245 -178
  142. package/components/Timeline/TraceTimeline.js +823 -783
  143. package/components/Timeline/TraceTimeline.module.js +98 -0
  144. package/components/Timeline/historyLayout.js +336 -263
  145. package/components/Timeline/timelineCore.js +208 -183
  146. package/components/Timeline/traceEvent.js +59 -61
  147. package/components/Timeline/traceLayout.js +101 -90
  148. package/components/Timeline/useTimeline.js +76 -79
  149. package/components/Timer/Timer.js +190 -156
  150. package/components/Timer/Timer.module.js +29 -0
  151. package/components/Toast/Toast.d.ts +1 -1
  152. package/components/Toast/Toast.js +128 -128
  153. package/components/Toast/Toast.module.js +37 -0
  154. package/components/Toast/toastStore.js +58 -62
  155. package/components/ToggleIconButton/ToggleIconButton.js +35 -57
  156. package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
  157. package/components/Tooltip/Tooltip.d.ts +1 -1
  158. package/components/Tooltip/Tooltip.js +76 -85
  159. package/components/Tooltip/Tooltip.module.js +17 -0
  160. package/components/Typography/Typography.js +11 -36
  161. package/components/Typography/Typography.module.js +30 -0
  162. package/components/inputs/Checkbox/Checkbox.js +27 -51
  163. package/components/inputs/Checkbox/Checkbox.module.js +10 -0
  164. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  165. package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
  166. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  167. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  168. package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
  169. package/components/inputs/DatePicker/DatePicker.js +115 -142
  170. package/components/inputs/DatePicker/DatePicker.module.js +14 -0
  171. package/components/inputs/DatePicker/dateUtils.js +32 -41
  172. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  173. package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
  174. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  175. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  176. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  177. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  178. package/components/inputs/Input/Input.js +98 -109
  179. package/components/inputs/Input/Input.module.js +15 -0
  180. package/components/inputs/NumberInput/NumberInput.js +112 -132
  181. package/components/inputs/NumberInput/NumberInput.module.js +14 -0
  182. package/components/inputs/Radio/Radio.js +50 -73
  183. package/components/inputs/Radio/Radio.module.js +9 -0
  184. package/components/inputs/SearchInput/SearchInput.js +98 -115
  185. package/components/inputs/SearchInput/SearchInput.module.js +8 -0
  186. package/components/inputs/Select/Select.js +555 -682
  187. package/components/inputs/Select/Select.module.js +38 -0
  188. package/components/inputs/Slider/Slider.js +97 -128
  189. package/components/inputs/Slider/Slider.module.js +9 -0
  190. package/components/inputs/Switch/Switch.js +11 -8
  191. package/components/inputs/Textarea/Textarea.js +42 -58
  192. package/components/inputs/Textarea/Textarea.module.js +14 -0
  193. package/hooks/useClickOutside.js +17 -14
  194. package/hooks/useDebouncedValue.js +13 -14
  195. package/hooks/useElementSize.js +27 -22
  196. package/hooks/useEscapeLayer.js +28 -29
  197. package/hooks/useFocusTrap.js +27 -38
  198. package/hooks/useKeyboard.js +76 -64
  199. package/hooks/useMediaQuery.js +10 -15
  200. package/hooks/useNow.js +28 -33
  201. package/hooks/usePersistedState.js +98 -91
  202. package/hooks/usePortalPosition.js +25 -19
  203. package/hooks/useResizable.js +106 -104
  204. package/hooks/useTheme.d.ts +2 -2
  205. package/hooks/useTheme.js +28 -25
  206. package/index.css +2 -1
  207. package/index.d.ts +1 -1
  208. package/index.js +97 -215
  209. package/index.layered.css +2 -3
  210. package/llms.txt +9 -6
  211. package/manifest.json +66 -10
  212. package/package.json +1 -1
  213. package/utils/formatBytes.js +29 -13
  214. package/utils/themeScript.d.ts +2 -0
  215. package/utils/themeScript.js +6 -8
  216. package/utils/timeAgo.js +59 -32
  217. package/components/Accordion/Accordion.module.scss.js +0 -36
  218. package/components/ActionButton/ActionButton.module.scss.js +0 -47
  219. package/components/Alert/Alert.module.scss.js +0 -33
  220. package/components/Avatar/Avatar.module.scss.js +0 -43
  221. package/components/Badge/Badge.module.scss.js +0 -31
  222. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
  223. package/components/Button/Button.module.scss.js +0 -47
  224. package/components/Card/Card.module.scss.js +0 -60
  225. package/components/Chart/Chart.module.scss.js +0 -61
  226. package/components/Chip/Chip.module.scss.js +0 -59
  227. package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
  228. package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
  229. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
  230. package/components/Divider/Divider.module.scss.js +0 -31
  231. package/components/Draggable/Draggable.module.scss.js +0 -17
  232. package/components/Drawer/Drawer.module.scss.js +0 -119
  233. package/components/Dropdown/Dropdown.module.scss.js +0 -53
  234. package/components/Dropzone/Dropzone.module.scss.js +0 -21
  235. package/components/EmptyState/EmptyState.module.scss.js +0 -25
  236. package/components/Form/Form.module.scss.js +0 -29
  237. package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
  238. package/components/Kbd/Kbd.module.scss.js +0 -17
  239. package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
  240. package/components/Link/Link.module.scss.js +0 -16
  241. package/components/List/List.module.scss.js +0 -21
  242. package/components/Loader/Loader.module.scss.js +0 -70
  243. package/components/Modal/Modal.module.scss.js +0 -33
  244. package/components/PageHeader/PageHeader.module.scss.js +0 -43
  245. package/components/Pagination/Pagination.module.scss.js +0 -23
  246. package/components/Popover/Popover.module.scss.js +0 -21
  247. package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
  248. package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
  249. package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
  250. package/components/Skeleton/Skeleton.module.scss.js +0 -25
  251. package/components/Spinner/Spinner.module.scss.js +0 -20
  252. package/components/SplitButton/SplitButton.module.scss.js +0 -57
  253. package/components/SplitPane/SplitPane.module.scss.js +0 -25
  254. package/components/StatCard/StatCard.module.scss.js +0 -72
  255. package/components/StatusDot/StatusDot.module.scss.js +0 -32
  256. package/components/Table/Table.module.scss.js +0 -81
  257. package/components/Tabs/Tabs.module.scss.js +0 -53
  258. package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
  259. package/components/Timeline/GanttTimeline.module.scss.js +0 -55
  260. package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
  261. package/components/Timeline/Timeline.module.scss.js +0 -141
  262. package/components/Timeline/TraceTimeline.module.scss.js +0 -189
  263. package/components/Timer/Timer.module.scss.js +0 -55
  264. package/components/Toast/Toast.module.scss.js +0 -62
  265. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
  266. package/components/Tooltip/Tooltip.module.scss.js +0 -30
  267. package/components/Typography/Typography.module.scss.js +0 -53
  268. package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
  269. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
  270. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
  271. package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
  272. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
  273. package/components/inputs/Input/Input.module.scss.js +0 -27
  274. package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
  275. package/components/inputs/Radio/Radio.module.scss.js +0 -15
  276. package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
  277. package/components/inputs/Select/Select.module.scss.js +0 -73
  278. package/components/inputs/Slider/Slider.module.scss.js +0 -15
  279. package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
@@ -1,73 +1,79 @@
1
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as R, createElement as C } from "react";
1
+ import e from "./PageHeader.module.js";
2
+ import { createElement as t, forwardRef as n } from "react";
3
3
  import r from "clsx";
4
- import e from "./PageHeader.module.scss.js";
5
- const k = /* @__PURE__ */ t("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", width: "1em", height: "1em", children: /* @__PURE__ */ t("path", { d: "M12 4l-6 6 6 6", strokeLinecap: "round", strokeLinejoin: "round" }) }), L = R(
6
- ({
7
- title: u,
8
- as: v = "h1",
9
- subtitle: o,
10
- description: l,
11
- actions: n,
12
- breadcrumbs: c,
13
- backHref: m,
14
- onBack: h,
15
- backLabel: s = "Back",
16
- badge: N,
17
- meta: p,
18
- tabs: d,
19
- divider: b = !0,
20
- size: f = "md",
21
- sticky: w = !1,
22
- classes: i,
23
- className: g,
24
- children: x,
25
- ...y
26
- }, j) => {
27
- const B = m !== void 0 ? /* @__PURE__ */ a("a", { href: m, className: r(e.back, i?.back), children: [
28
- k,
29
- s
30
- ] }) : h ? /* @__PURE__ */ a("button", { type: "button", onClick: h, className: r(e.back, i?.back), children: [
31
- k,
32
- s
33
- ] }) : null;
34
- return /* @__PURE__ */ a(
35
- "header",
36
- {
37
- ref: j,
38
- className: r(
39
- e.root,
40
- e[f],
41
- b && e.divider,
42
- w && e.sticky,
43
- d && e.hasTabs,
44
- i?.root,
45
- g
46
- ),
47
- ...y,
48
- children: [
49
- c && /* @__PURE__ */ t("div", { className: r(e.breadcrumbs, i?.breadcrumbs), children: c }),
50
- B,
51
- /* @__PURE__ */ a("div", { className: r(e.titleRow, i?.titleRow), children: [
52
- /* @__PURE__ */ a("div", { className: e.titleBlock, children: [
53
- /* @__PURE__ */ a("div", { className: e.titleLine, children: [
54
- C(v, { className: r(e.title, i?.title) }, u),
55
- N && /* @__PURE__ */ t("span", { className: r(e.badge, i?.badge), children: N })
56
- ] }),
57
- o && /* @__PURE__ */ t("p", { className: r(e.subtitle, i?.subtitle), children: o }),
58
- l && /* @__PURE__ */ t("p", { className: r(e.description, i?.description), children: l }),
59
- p && /* @__PURE__ */ t("div", { className: r(e.meta, i?.meta), children: p })
60
- ] }),
61
- n && /* @__PURE__ */ t("div", { className: r(e.actions, i?.actions), children: n })
62
- ] }),
63
- x,
64
- d && /* @__PURE__ */ t("div", { className: r(e.tabs, i?.tabs), children: d })
65
- ]
66
- }
67
- );
68
- }
69
- );
70
- L.displayName = "PageHeader";
71
- export {
72
- L as PageHeader
73
- };
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ // src/components/PageHeader/PageHeader.tsx
6
+ var o = /* @__PURE__ */ i("svg", {
7
+ viewBox: "0 0 20 20",
8
+ fill: "none",
9
+ stroke: "currentColor",
10
+ strokeWidth: "2",
11
+ "aria-hidden": "true",
12
+ width: "1em",
13
+ height: "1em",
14
+ children: /* @__PURE__ */ i("path", {
15
+ d: "M12 4l-6 6 6 6",
16
+ strokeLinecap: "round",
17
+ strokeLinejoin: "round"
18
+ })
19
+ }), s = n(({ title: n, as: s = "h1", subtitle: c, description: l, actions: u, breadcrumbs: d, backHref: f, onBack: p, backLabel: m = "Back", badge: h, meta: g, tabs: _, divider: v = !0, size: y = "md", sticky: b = !1, classes: x, className: S, children: C, ...w }, T) => {
20
+ let E = f === void 0 ? p ? /* @__PURE__ */ a("button", {
21
+ type: "button",
22
+ onClick: p,
23
+ className: r(e.back, x?.back),
24
+ children: [o, m]
25
+ }) : null : /* @__PURE__ */ a("a", {
26
+ href: f,
27
+ className: r(e.back, x?.back),
28
+ children: [o, m]
29
+ });
30
+ return /* @__PURE__ */ a("header", {
31
+ ref: T,
32
+ className: r(e.root, e[y], v && e.divider, b && e.sticky, _ && e.hasTabs, x?.root, S),
33
+ ...w,
34
+ children: [
35
+ d && /* @__PURE__ */ i("div", {
36
+ className: r(e.breadcrumbs, x?.breadcrumbs),
37
+ children: d
38
+ }),
39
+ E,
40
+ /* @__PURE__ */ a("div", {
41
+ className: r(e.titleRow, x?.titleRow),
42
+ children: [/* @__PURE__ */ a("div", {
43
+ className: e.titleBlock,
44
+ children: [
45
+ /* @__PURE__ */ a("div", {
46
+ className: e.titleLine,
47
+ children: [t(s, { className: r(e.title, x?.title) }, n), h && /* @__PURE__ */ i("span", {
48
+ className: r(e.badge, x?.badge),
49
+ children: h
50
+ })]
51
+ }),
52
+ c && /* @__PURE__ */ i("p", {
53
+ className: r(e.subtitle, x?.subtitle),
54
+ children: c
55
+ }),
56
+ l && /* @__PURE__ */ i("p", {
57
+ className: r(e.description, x?.description),
58
+ children: l
59
+ }),
60
+ g && /* @__PURE__ */ i("div", {
61
+ className: r(e.meta, x?.meta),
62
+ children: g
63
+ })
64
+ ]
65
+ }), u && /* @__PURE__ */ i("div", {
66
+ className: r(e.actions, x?.actions),
67
+ children: u
68
+ })]
69
+ }),
70
+ C,
71
+ _ && /* @__PURE__ */ i("div", {
72
+ className: r(e.tabs, x?.tabs),
73
+ children: _
74
+ })
75
+ ]
76
+ });
77
+ });
78
+ s.displayName = "PageHeader";
79
+ export { s as PageHeader };
@@ -0,0 +1,23 @@
1
+ // src/components/PageHeader/PageHeader.module.scss
2
+ var e = "crk-root-K-SAd", t = "crk-sm-XJoTL", n = "crk-md-obtrZ", r = "crk-lg--8FAx", i = "crk-divider-q-A5e", a = "crk-hasTabs-YLYqx", o = "crk-sticky-e3pQP", s = "crk-breadcrumbs-rTXxK", c = "crk-back-R4Oq3", l = "crk-titleRow-4-MEi", u = "crk-titleBlock-37A6l", d = "crk-titleLine-oWB7d", f = "crk-title-1nY9v", p = "crk-badge-Uesjc", m = "crk-subtitle-BREZj", h = "crk-description--PNl0", g = "crk-meta-fkWcX", _ = "crk-actions-EYOW1", v = "crk-tabs-qDTiN", y = {
3
+ root: e,
4
+ sm: t,
5
+ md: n,
6
+ lg: r,
7
+ divider: i,
8
+ hasTabs: a,
9
+ sticky: o,
10
+ breadcrumbs: s,
11
+ back: c,
12
+ titleRow: l,
13
+ titleBlock: u,
14
+ titleLine: d,
15
+ title: f,
16
+ badge: p,
17
+ subtitle: m,
18
+ description: h,
19
+ meta: g,
20
+ actions: _,
21
+ tabs: v
22
+ };
23
+ export { _ as actions, c as back, p as badge, s as breadcrumbs, y as default, h as description, i as divider, a as hasTabs, r as lg, n as md, g as meta, e as root, t as sm, o as sticky, m as subtitle, v as tabs, f as title, u as titleBlock, d as titleLine, l as titleRow };
@@ -1,84 +1,63 @@
1
- import { jsx as t, jsxs as d, Fragment as x } from "react/jsx-runtime";
2
- import { forwardRef as T, useState as W } from "react";
3
- import l from "clsx";
4
- import r from "./Pagination.module.scss.js";
5
- import { paginationRange as q } from "./paginationRange.js";
6
- const w = ({ dir: c }) => /* @__PURE__ */ t("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: {
7
- left: /* @__PURE__ */ t("path", { d: "M7 2L3 6l4 4" }),
8
- right: /* @__PURE__ */ t("path", { d: "M5 2l4 4-4 4" }),
9
- first: /* @__PURE__ */ d(x, { children: [
10
- /* @__PURE__ */ t("path", { d: "M8 2L4 6l4 4" }),
11
- /* @__PURE__ */ t("path", { d: "M4 2v8" })
12
- ] }),
13
- last: /* @__PURE__ */ d(x, { children: [
14
- /* @__PURE__ */ t("path", { d: "M4 2l4 4-4 4" }),
15
- /* @__PURE__ */ t("path", { d: "M8 2v8" })
16
- ] })
17
- }[c] }), z = T(
18
- ({
19
- count: c,
20
- total: p,
21
- pageSize: b = 10,
22
- page: h,
23
- defaultPage: k = 1,
24
- onChange: C,
25
- boundaryCount: G = 1,
26
- siblingCount: N = 2,
27
- showPrevNext: m = !0,
28
- showFirstLast: f = !1,
29
- size: y = "md",
30
- disabled: u = !1,
31
- label: j = "Pagination",
32
- classes: e,
33
- className: L,
34
- ...P
35
- }, R) => {
36
- const i = c ?? (p != null ? Math.max(1, Math.ceil(p / b)) : 1), g = h !== void 0, [$, B] = W(k), n = Math.min(Math.max(g ? h : $, 1), i), v = (o) => {
37
- const a = Math.min(Math.max(o, 1), i);
38
- a !== n && (g || B(a), C?.(a));
39
- }, I = q(n, i, G, N), s = (o, a, M, S) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
40
- "button",
41
- {
42
- type: "button",
43
- className: l(r.item, r.control, e?.item, e?.control),
44
- onClick: () => v(M),
45
- disabled: u || n === M || (a === "left" || a === "first" ? n === 1 : n === i),
46
- "aria-label": S,
47
- children: /* @__PURE__ */ t(w, { dir: a })
48
- }
49
- ) }, o);
50
- return /* @__PURE__ */ t(
51
- "nav",
52
- {
53
- ref: R,
54
- "aria-label": j,
55
- className: l(r.root, r[y], e?.root, L),
56
- ...P,
57
- children: /* @__PURE__ */ d("ul", { className: l(r.list, e?.list), children: [
58
- f && s("first", "first", 1, "Go to first page"),
59
- m && s("prev", "left", n - 1, "Go to previous page"),
60
- I.map(
61
- (o, a) => o === "ellipsis" ? /* @__PURE__ */ t("li", { "aria-hidden": "true", className: l(r.ellipsis, e?.ellipsis), children: "…" }, `e${a}`) : /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
62
- "button",
63
- {
64
- type: "button",
65
- className: l(r.item, o === n && r.active, e?.item, o === n && e?.active),
66
- onClick: () => v(o),
67
- disabled: u,
68
- "aria-current": o === n ? "page" : void 0,
69
- "aria-label": `Go to page ${o}`,
70
- children: o
71
- }
72
- ) }, o)
73
- ),
74
- m && s("next", "right", n + 1, "Go to next page"),
75
- f && s("last", "last", i, "Go to last page")
76
- ] })
77
- }
78
- );
79
- }
80
- );
81
- z.displayName = "Pagination";
82
- export {
83
- z as Pagination
84
- };
1
+ import e from "./Pagination.module.js";
2
+ import { paginationRange as t } from "./paginationRange.js";
3
+ import { forwardRef as n, useState as r } from "react";
4
+ import i from "clsx";
5
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ // src/components/Pagination/Pagination.tsx
7
+ var c = ({ dir: e }) => /* @__PURE__ */ o("svg", {
8
+ viewBox: "0 0 12 12",
9
+ fill: "none",
10
+ stroke: "currentColor",
11
+ strokeWidth: "1.5",
12
+ strokeLinecap: "round",
13
+ strokeLinejoin: "round",
14
+ "aria-hidden": "true",
15
+ children: {
16
+ left: /* @__PURE__ */ o("path", { d: "M7 2L3 6l4 4" }),
17
+ right: /* @__PURE__ */ o("path", { d: "M5 2l4 4-4 4" }),
18
+ first: /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M8 2L4 6l4 4" }), /* @__PURE__ */ o("path", { d: "M4 2v8" })] }),
19
+ last: /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M4 2l4 4-4 4" }), /* @__PURE__ */ o("path", { d: "M8 2v8" })] })
20
+ }[e]
21
+ }), l = n(({ count: n, total: a, pageSize: l = 10, page: u, defaultPage: d = 1, onChange: f, boundaryCount: p = 1, siblingCount: m = 2, showPrevNext: h = !0, showFirstLast: g = !1, size: _ = "md", disabled: v = !1, label: y = "Pagination", classes: b, className: x, ...S }, C) => {
22
+ let w = n ?? (a == null ? 1 : Math.max(1, Math.ceil(a / l))), T = u !== void 0, [E, D] = r(d), O = Math.min(Math.max(T ? u : E, 1), w), k = (e) => {
23
+ let t = Math.min(Math.max(e, 1), w);
24
+ t !== O && (T || D(t), f?.(t));
25
+ }, A = t(O, w, p, m), j = (t, n, r, a) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
26
+ type: "button",
27
+ className: i(e.item, e.control, b?.item, b?.control),
28
+ onClick: () => k(r),
29
+ disabled: v || O === r || (n === "left" || n === "first" ? O === 1 : O === w),
30
+ "aria-label": a,
31
+ children: /* @__PURE__ */ o(c, { dir: n })
32
+ }) }, t);
33
+ return /* @__PURE__ */ o("nav", {
34
+ ref: C,
35
+ "aria-label": y,
36
+ className: i(e.root, e[_], b?.root, x),
37
+ ...S,
38
+ children: /* @__PURE__ */ s("ul", {
39
+ className: i(e.list, b?.list),
40
+ children: [
41
+ g && j("first", "first", 1, "Go to first page"),
42
+ h && j("prev", "left", O - 1, "Go to previous page"),
43
+ A.map((t, n) => t === "ellipsis" ? /* @__PURE__ */ o("li", {
44
+ "aria-hidden": "true",
45
+ className: i(e.ellipsis, b?.ellipsis),
46
+ children: "…"
47
+ }, `e${n}`) : /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
48
+ type: "button",
49
+ className: i(e.item, t === O && e.active, b?.item, t === O && b?.active),
50
+ onClick: () => k(t),
51
+ disabled: v,
52
+ "aria-current": t === O ? "page" : void 0,
53
+ "aria-label": `Go to page ${t}`,
54
+ children: t
55
+ }) }, t)),
56
+ h && j("next", "right", O + 1, "Go to next page"),
57
+ g && j("last", "last", w, "Go to last page")
58
+ ]
59
+ })
60
+ });
61
+ });
62
+ l.displayName = "Pagination";
63
+ export { l as Pagination };
@@ -0,0 +1,13 @@
1
+ // src/components/Pagination/Pagination.module.scss
2
+ var e = "crk-root-IuiQ5", t = "crk-sm-tfMLg", n = "crk-md-MdjxU", r = "crk-lg-6-p8a", i = "crk-list-UN-OF", a = "crk-item-ZOauk", o = "crk-active-gs4QO", s = "crk-control-HnlrC", c = "crk-ellipsis-iAsGN", l = {
3
+ root: e,
4
+ sm: t,
5
+ md: n,
6
+ lg: r,
7
+ list: i,
8
+ item: a,
9
+ active: o,
10
+ control: s,
11
+ ellipsis: c
12
+ };
13
+ export { o as active, s as control, l as default, c as ellipsis, a as item, r as lg, i as list, n as md, e as root, t as sm };
@@ -1,24 +1,17 @@
1
- function l(i, s) {
2
- const e = Math.max(s - i + 1, 0);
3
- return Array.from({ length: e }, (h, m) => i + m);
1
+ // src/components/Pagination/paginationRange.ts
2
+ function e(e, t) {
3
+ let n = Math.max(t - e + 1, 0);
4
+ return Array.from({ length: n }, (t, n) => e + n);
4
5
  }
5
- function x(i, s, e = 1, h = 2) {
6
- if (s <= 0) return [];
7
- const m = l(1, Math.min(e, s)), M = l(Math.max(s - e + 1, e + 1), s), a = Math.max(
8
- Math.min(i - h, s - e - h * 2 - 1),
9
- e + 2
10
- ), g = Math.min(
11
- Math.max(i + h, e + h * 2 + 2),
12
- M.length > 0 ? M[0] - 2 : s - 1
13
- );
14
- return [
15
- ...m,
16
- ...a > e + 2 ? ["ellipsis"] : e + 1 < s - e ? [e + 1] : [],
17
- ...l(a, g),
18
- ...g < s - e - 1 ? ["ellipsis"] : s - e > e ? [s - e] : [],
19
- ...M
20
- ];
6
+ function t(t, n, r = 1, i = 2) {
7
+ if (n <= 0) return [];
8
+ let a = e(1, Math.min(r, n)), o = e(Math.max(n - r + 1, r + 1), n), s = Math.max(Math.min(t - i, n - r - i * 2 - 1), r + 2), c = Math.min(Math.max(t + i, r + i * 2 + 2), o.length > 0 ? o[0] - 2 : n - 1);
9
+ return [
10
+ ...a,
11
+ ...s > r + 2 ? ["ellipsis"] : r + 1 < n - r ? [r + 1] : [],
12
+ ...e(s, c),
13
+ ...c < n - r - 1 ? ["ellipsis"] : n - r > r ? [n - r] : [],
14
+ ...o
15
+ ];
21
16
  }
22
- export {
23
- x as paginationRange
24
- };
17
+ export { t as paginationRange };
@@ -1,135 +1,111 @@
1
- import { jsx as y, jsxs as K } from "react/jsx-runtime";
2
- import { forwardRef as Q, useState as E, useRef as B, useId as U, useCallback as O, useLayoutEffect as Z, useEffect as _, isValidElement as ee, cloneElement as te } from "react";
3
- import R from "clsx";
4
- import L from "./Popover.module.scss.js";
5
- import { useClickOutside as oe } from "../../hooks/useClickOutside.js";
6
- import { useEscapeLayer as re, EscapeLayerProvider as ne } from "../../hooks/useEscapeLayer.js";
7
- function ie(...a) {
8
- return (h) => {
9
- for (const l of a)
10
- l && (typeof l == "function" ? l(h) : l.current = h);
11
- };
1
+ import e from "./Popover.module.js";
2
+ import { useClickOutside as t } from "../../hooks/useClickOutside.js";
3
+ import { EscapeLayerProvider as n, useEscapeLayer as r } from "../../hooks/useEscapeLayer.js";
4
+ import { cloneElement as i, forwardRef as a, isValidElement as o, useCallback as s, useEffect as c, useId as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
5
+ import p from "clsx";
6
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
7
+ // src/components/Popover/Popover.tsx
8
+ function g(...e) {
9
+ return (t) => {
10
+ for (let n of e) n && (typeof n == "function" ? n(t) : n.current = t);
11
+ };
12
12
  }
13
- const se = Q(
14
- ({
15
- trigger: a,
16
- asChild: h = !1,
17
- content: l,
18
- position: n = "bottom",
19
- autoPosition: m = !0,
20
- open: j,
21
- onOpenChange: z,
22
- classes: g,
23
- className: H,
24
- style: T
25
- }, V) => {
26
- const [W, A] = E(!1), [D, M] = E(n), [F, P] = E(0), [G, X] = E(0), Y = B(null), u = B(null), v = B(null), k = U(), C = j !== void 0, o = C ? j : W, w = O(
27
- (t) => {
28
- C || A(t), z?.(t);
29
- },
30
- [C, z]
31
- ), $ = O(() => {
32
- w(!1), v.current?.focus();
33
- }, [w]), q = O(() => {
34
- w(!o);
35
- }, [o, w]);
36
- oe(Y, $, o);
37
- const J = re($, o);
38
- Z(() => {
39
- if (!o || !m) {
40
- M(n), P(0), X(0);
41
- return;
42
- }
43
- if (typeof window > "u") return;
44
- const t = () => {
45
- const b = v.current, x = u.current;
46
- if (!b || !x) return;
47
- const s = b.getBoundingClientRect(), i = x.getBoundingClientRect(), I = window.innerWidth, S = window.innerHeight, r = 8;
48
- let c = n;
49
- if (n === "bottom" || n === "top") {
50
- const e = s.bottom + r + i.height <= S, p = s.top - r - i.height >= 0;
51
- n === "bottom" && !e && p ? c = "top" : n === "top" && !p && e && (c = "bottom");
52
- } else {
53
- const e = s.right + r + i.width <= I, p = s.left - r - i.width >= 0;
54
- n === "right" && !e && p ? c = "left" : n === "left" && !p && e && (c = "right");
55
- }
56
- let f = 0, d = 0;
57
- if (c === "bottom" || c === "top") {
58
- const e = s.left + s.width / 2 - i.width / 2;
59
- e < r ? f = r - e : e + i.width > I - r && (f = I - r - (e + i.width));
60
- } else {
61
- const e = s.top + s.height / 2 - i.height / 2;
62
- e < r ? d = r - e : e + i.height > S - r && (d = S - r - (e + i.height));
63
- }
64
- f = Math.round(f), d = Math.round(d), M((e) => e === c ? e : c), P((e) => e === f ? e : f), X((e) => e === d ? e : d);
65
- };
66
- return t(), window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), () => {
67
- window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
68
- };
69
- }, [o, m, n]), _(() => {
70
- if (o && u.current) {
71
- const t = u.current.querySelector(
72
- 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
73
- );
74
- t ? t.focus() : u.current.focus();
75
- }
76
- }, [o]);
77
- let N;
78
- if (h && ee(a)) {
79
- const t = a, b = t.ref;
80
- N = te(t, {
81
- ref: ie(v, b),
82
- onClick: (x) => {
83
- t.props.onClick?.(x), q();
84
- },
85
- className: R(t.props.className, g?.trigger),
86
- "aria-expanded": o,
87
- "aria-haspopup": "dialog",
88
- "aria-controls": o ? k : void 0
89
- });
90
- } else
91
- N = /* @__PURE__ */ y(
92
- "button",
93
- {
94
- ref: v,
95
- type: "button",
96
- className: R(L.trigger, g?.trigger),
97
- onClick: q,
98
- "aria-expanded": o,
99
- "aria-haspopup": "dialog",
100
- "aria-controls": o ? k : void 0,
101
- children: a
102
- }
103
- );
104
- return /* @__PURE__ */ y(
105
- "div",
106
- {
107
- ref: V,
108
- className: R(L.root, g?.root, H),
109
- style: T,
110
- children: /* @__PURE__ */ K("div", { ref: Y, children: [
111
- N,
112
- o && /* @__PURE__ */ y(
113
- "div",
114
- {
115
- ref: u,
116
- id: k,
117
- role: "dialog",
118
- tabIndex: -1,
119
- className: R(L.popover, L[m ? D : n], g?.popover),
120
- style: m ? {
121
- "--crk-popover-shift-x": `${F}px`,
122
- "--crk-popover-shift-y": `${G}px`
123
- } : void 0,
124
- children: /* @__PURE__ */ y(ne, { value: J, children: l })
125
- }
126
- )
127
- ] })
128
- }
129
- );
130
- }
131
- );
132
- se.displayName = "Popover";
133
- export {
134
- se as Popover
135
- };
13
+ var _ = a(({ trigger: a, asChild: _ = !1, content: v, position: y = "bottom", autoPosition: b = !0, open: x, onOpenChange: S, classes: C, className: w, style: T }, E) => {
14
+ let [D, O] = f(!1), [k, A] = f(y), [j, M] = f(0), [N, P] = f(0), F = d(null), I = d(null), L = d(null), R = l(), z = x !== void 0, B = z ? x : D, V = s((e) => {
15
+ z || O(e), S?.(e);
16
+ }, [z, S]), H = s(() => {
17
+ V(!1), L.current?.focus();
18
+ }, [V]), U = s(() => {
19
+ V(!B);
20
+ }, [B, V]);
21
+ t(F, H, B);
22
+ let W = r(H, B);
23
+ u(() => {
24
+ if (!B || !b) {
25
+ A(y), M(0), P(0);
26
+ return;
27
+ }
28
+ if (typeof window > "u") return;
29
+ let e = () => {
30
+ let e = L.current, t = I.current;
31
+ if (!e || !t) return;
32
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight, o = y;
33
+ if (y === "bottom" || y === "top") {
34
+ let e = n.bottom + 8 + r.height <= a, t = n.top - 8 - r.height >= 0;
35
+ y === "bottom" && !e && t ? o = "top" : y === "top" && !t && e && (o = "bottom");
36
+ } else {
37
+ let e = n.right + 8 + r.width <= i, t = n.left - 8 - r.width >= 0;
38
+ y === "right" && !e && t ? o = "left" : y === "left" && !t && e && (o = "right");
39
+ }
40
+ let s = 0, c = 0;
41
+ if (o === "bottom" || o === "top") {
42
+ let e = n.left + n.width / 2 - r.width / 2;
43
+ e < 8 ? s = 8 - e : e + r.width > i - 8 && (s = i - 8 - (e + r.width));
44
+ } else {
45
+ let e = n.top + n.height / 2 - r.height / 2;
46
+ e < 8 ? c = 8 - e : e + r.height > a - 8 && (c = a - 8 - (e + r.height));
47
+ }
48
+ s = Math.round(s), c = Math.round(c), A((e) => e === o ? e : o), M((e) => e === s ? e : s), P((e) => e === c ? e : c);
49
+ };
50
+ return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
51
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
52
+ };
53
+ }, [
54
+ B,
55
+ b,
56
+ y
57
+ ]), c(() => {
58
+ if (B && I.current) {
59
+ let e = I.current.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])");
60
+ e ? e.focus() : I.current.focus();
61
+ }
62
+ }, [B]);
63
+ let G;
64
+ if (_ && o(a)) {
65
+ let e = a, t = e.ref;
66
+ G = i(e, {
67
+ ref: g(L, t),
68
+ onClick: (t) => {
69
+ e.props.onClick?.(t), U();
70
+ },
71
+ className: p(e.props.className, C?.trigger),
72
+ "aria-expanded": B,
73
+ "aria-haspopup": "dialog",
74
+ "aria-controls": B ? R : void 0
75
+ });
76
+ } else G = /* @__PURE__ */ m("button", {
77
+ ref: L,
78
+ type: "button",
79
+ className: p(e.trigger, C?.trigger),
80
+ onClick: U,
81
+ "aria-expanded": B,
82
+ "aria-haspopup": "dialog",
83
+ "aria-controls": B ? R : void 0,
84
+ children: a
85
+ });
86
+ return /* @__PURE__ */ m("div", {
87
+ ref: E,
88
+ className: p(e.root, C?.root, w),
89
+ style: T,
90
+ children: /* @__PURE__ */ h("div", {
91
+ ref: F,
92
+ children: [G, B && /* @__PURE__ */ m("div", {
93
+ ref: I,
94
+ id: R,
95
+ role: "dialog",
96
+ tabIndex: -1,
97
+ className: p(e.popover, e[b ? k : y], C?.popover),
98
+ style: b ? {
99
+ "--crk-popover-shift-x": `${j}px`,
100
+ "--crk-popover-shift-y": `${N}px`
101
+ } : void 0,
102
+ children: /* @__PURE__ */ m(n, {
103
+ value: W,
104
+ children: v
105
+ })
106
+ })]
107
+ })
108
+ });
109
+ });
110
+ _.displayName = "Popover";
111
+ export { _ as Popover };