@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,108 +1,96 @@
1
- import { jsx as s, jsxs as E } from "react/jsx-runtime";
2
- import { forwardRef as H, useRef as v, useId as P, useEffect as j, createContext as D, useContext as p } from "react";
3
- import { createPortal as L } from "react-dom";
4
- import d from "clsx";
5
- import { useFocusTrap as O } from "../../hooks/useFocusTrap.js";
6
- import { useEscapeLayer as U, EscapeLayerProvider as S } from "../../hooks/useEscapeLayer.js";
7
- import t from "./Modal.module.scss.js";
8
- const u = D({ classes: {}, titleId: "" }), N = ({ children: e, className: a, style: l, onClose: r }) => {
9
- const { classes: c, titleId: i } = p(u);
10
- return /* @__PURE__ */ E(
11
- "div",
12
- {
13
- className: d(t.header, r && t.headerWithClose, c.header, a),
14
- style: l,
15
- children: [
16
- /* @__PURE__ */ s("div", { id: i, className: d(t.headerTitle, c.headerTitle), children: e }),
17
- r && /* @__PURE__ */ s(
18
- "button",
19
- {
20
- type: "button",
21
- className: d(t.closeButton, c.closeButton),
22
- onClick: r,
23
- "aria-label": "Close",
24
- children: "×"
25
- }
26
- )
27
- ]
28
- }
29
- );
1
+ import { createContext as e, forwardRef as t, useContext as n, useEffect as r, useId as i, useRef as a } from "react";
2
+ import { createPortal as o } from "react-dom";
3
+ import s from "clsx";
4
+ import { useFocusTrap as c } from "../../hooks/useFocusTrap.js";
5
+ import { EscapeLayerProvider as l, useEscapeLayer as u } from "../../hooks/useEscapeLayer.js";
6
+ import d from "./Modal.module.scss.js";
7
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
8
+ // src/components/Modal/Modal.tsx
9
+ var m = e({
10
+ classes: {},
11
+ titleId: ""
12
+ }), h = ({ children: e, className: t, style: r, onClose: i }) => {
13
+ let { classes: a, titleId: o } = n(m);
14
+ return /* @__PURE__ */ p("div", {
15
+ className: s(d.header, i && d.headerWithClose, a.header, t),
16
+ style: r,
17
+ children: [/* @__PURE__ */ f("div", {
18
+ id: o,
19
+ className: s(d.headerTitle, a.headerTitle),
20
+ children: e
21
+ }), i && /* @__PURE__ */ f("button", {
22
+ type: "button",
23
+ className: s(d.closeButton, a.closeButton),
24
+ onClick: i,
25
+ "aria-label": "Close",
26
+ children: "×"
27
+ })]
28
+ });
30
29
  };
31
- N.displayName = "Modal.Header";
32
- const M = ({ children: e, className: a, style: l }) => {
33
- const { classes: r } = p(u);
34
- return /* @__PURE__ */ s("div", { className: d(t.body, r.body, a), style: l, children: e });
30
+ h.displayName = "Modal.Header";
31
+ var g = ({ children: e, className: t, style: r }) => {
32
+ let { classes: i } = n(m);
33
+ return /* @__PURE__ */ f("div", {
34
+ className: s(d.body, i.body, t),
35
+ style: r,
36
+ children: e
37
+ });
35
38
  };
36
- M.displayName = "Modal.Body";
37
- const B = ({ children: e, className: a, style: l }) => {
38
- const { classes: r } = p(u);
39
- return /* @__PURE__ */ s("div", { className: d(t.footer, r.footer, a), style: l, children: e });
40
- };
41
- B.displayName = "Modal.Footer";
42
- const m = H(
43
- ({
44
- open: e,
45
- onClose: a,
46
- closeOnBackdrop: l = !0,
47
- closeOnEscape: r = !0,
48
- size: c = "md",
49
- classes: i,
50
- className: w,
51
- style: x,
52
- children: k,
53
- "aria-label": y,
54
- "aria-labelledby": C
55
- }, n) => {
56
- const b = v(null), T = (o) => {
57
- b.current = o, typeof n == "function" ? n(o) : n && (n.current = o);
58
- }, g = P(), h = C ?? `${g}-title`;
59
- O(b, e);
60
- const I = U(() => {
61
- r && a();
62
- }, e);
63
- j(() => {
64
- if (!e) return;
65
- const o = document.body.style.overflow;
66
- return document.body.style.overflow = "hidden", () => {
67
- document.body.style.overflow = o;
68
- };
69
- }, [e]);
70
- const f = v(!1), F = (o) => {
71
- f.current = o.target === o.currentTarget;
72
- }, R = (o) => {
73
- l && f.current && o.target === o.currentTarget && a(), f.current = !1;
74
- };
75
- return e ? L(
76
- /* @__PURE__ */ s(
77
- "div",
78
- {
79
- className: d(t.backdrop, i?.backdrop),
80
- onMouseDown: F,
81
- onMouseUp: R,
82
- role: "presentation",
83
- children: /* @__PURE__ */ s(
84
- "div",
85
- {
86
- ref: T,
87
- className: d(t.modal, t[c], i?.modal, w),
88
- style: x,
89
- role: "dialog",
90
- "aria-modal": "true",
91
- "aria-label": y,
92
- "aria-labelledby": y ? void 0 : h,
93
- children: /* @__PURE__ */ s(u.Provider, { value: { classes: i ?? {}, titleId: h }, children: /* @__PURE__ */ s(S, { value: I, children: k }) })
94
- }
95
- )
96
- }
97
- ),
98
- document.body
99
- ) : null;
100
- }
101
- );
102
- m.displayName = "Modal";
103
- m.Header = N;
104
- m.Body = M;
105
- m.Footer = B;
106
- export {
107
- m as Modal
39
+ g.displayName = "Modal.Body";
40
+ var _ = ({ children: e, className: t, style: r }) => {
41
+ let { classes: i } = n(m);
42
+ return /* @__PURE__ */ f("div", {
43
+ className: s(d.footer, i.footer, t),
44
+ style: r,
45
+ children: e
46
+ });
108
47
  };
48
+ _.displayName = "Modal.Footer";
49
+ var v = t(({ open: e, onClose: t, closeOnBackdrop: n = !0, closeOnEscape: p = !0, size: h = "md", classes: g, className: _, style: v, children: y, "aria-label": b, "aria-labelledby": x }, S) => {
50
+ let C = a(null), w = (e) => {
51
+ C.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
52
+ }, T = i(), E = x ?? `${T}-title`;
53
+ c(C, e);
54
+ let D = u(() => {
55
+ p && t();
56
+ }, e);
57
+ r(() => {
58
+ if (!e) return;
59
+ let t = document.body.style.overflow;
60
+ return document.body.style.overflow = "hidden", () => {
61
+ document.body.style.overflow = t;
62
+ };
63
+ }, [e]);
64
+ let O = a(!1);
65
+ return e ? o(/* @__PURE__ */ f("div", {
66
+ className: s(d.backdrop, g?.backdrop),
67
+ onMouseDown: (e) => {
68
+ O.current = e.target === e.currentTarget;
69
+ },
70
+ onMouseUp: (e) => {
71
+ n && O.current && e.target === e.currentTarget && t(), O.current = !1;
72
+ },
73
+ role: "presentation",
74
+ children: /* @__PURE__ */ f("div", {
75
+ ref: w,
76
+ className: s(d.modal, d[h], g?.modal, _),
77
+ style: v,
78
+ role: "dialog",
79
+ "aria-modal": "true",
80
+ "aria-label": b,
81
+ "aria-labelledby": b ? void 0 : E,
82
+ children: /* @__PURE__ */ f(m.Provider, {
83
+ value: {
84
+ classes: g ?? {},
85
+ titleId: E
86
+ },
87
+ children: /* @__PURE__ */ f(l, {
88
+ value: D,
89
+ children: y
90
+ })
91
+ })
92
+ })
93
+ }), document.body) : null;
94
+ });
95
+ v.displayName = "Modal", v.Header = h, v.Body = g, v.Footer = _;
96
+ export { v as Modal };
@@ -1,33 +1,18 @@
1
- const o = "crk-backdrop-jYpTA", c = "crk-backdropIn-x5Z-A", e = "crk-modal-yNG-7", r = "crk-modalIn-xFUwm", t = "crk-sm--xyY9", s = "crk-md-ETTfh", d = "crk-lg-5DBb7", n = "crk-fullscreen-b4jQ-", l = "crk-header-NS30G", a = "crk-headerTitle-tJ2Qv", k = "crk-headerWithClose-4davm", m = "crk-closeButton-JX-aq", h = "crk-body-3zIj9", b = "crk-footer-Oyz-R", f = {
2
- backdrop: o,
3
- backdropIn: c,
4
- modal: e,
5
- modalIn: r,
6
- sm: t,
7
- md: s,
8
- lg: d,
9
- fullscreen: n,
10
- header: l,
11
- headerTitle: a,
12
- headerWithClose: k,
13
- closeButton: m,
14
- body: h,
15
- footer: b
16
- };
17
- export {
18
- o as backdrop,
19
- c as backdropIn,
20
- h as body,
21
- m as closeButton,
22
- f as default,
23
- b as footer,
24
- n as fullscreen,
25
- l as header,
26
- a as headerTitle,
27
- k as headerWithClose,
28
- d as lg,
29
- s as md,
30
- e as modal,
31
- r as modalIn,
32
- t as sm
1
+ // src/components/Modal/Modal.module.scss
2
+ var e = "crk-backdrop-jYpTA", t = "crk-backdropIn-x5Z-A", n = "crk-modal-yNG-7", r = "crk-modalIn-xFUwm", i = "crk-sm--xyY9", a = "crk-md-ETTfh", o = "crk-lg-5DBb7", s = "crk-fullscreen-b4jQ-", c = "crk-header-NS30G", l = "crk-headerTitle-tJ2Qv", u = "crk-headerWithClose-4davm", d = "crk-closeButton-JX-aq", f = "crk-body-3zIj9", p = "crk-footer-Oyz-R", m = {
3
+ backdrop: e,
4
+ backdropIn: t,
5
+ modal: n,
6
+ modalIn: r,
7
+ sm: i,
8
+ md: a,
9
+ lg: o,
10
+ fullscreen: s,
11
+ header: c,
12
+ headerTitle: l,
13
+ headerWithClose: u,
14
+ closeButton: d,
15
+ body: f,
16
+ footer: p
33
17
  };
18
+ export { e as backdrop, t as backdropIn, f as body, d as closeButton, m as default, p as footer, s as fullscreen, c as header, l as headerTitle, u as headerWithClose, o as lg, a as md, n as modal, r as modalIn, i as sm };
@@ -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";
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
- };
1
+ import { createElement as e, forwardRef as t } from "react";
2
+ import n from "clsx";
3
+ import r from "./PageHeader.module.scss.js";
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 = t(({ title: t, 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: n(r.back, x?.back),
24
+ children: [o, m]
25
+ }) : null : /* @__PURE__ */ a("a", {
26
+ href: f,
27
+ className: n(r.back, x?.back),
28
+ children: [o, m]
29
+ });
30
+ return /* @__PURE__ */ a("header", {
31
+ ref: T,
32
+ className: n(r.root, r[y], v && r.divider, b && r.sticky, _ && r.hasTabs, x?.root, S),
33
+ ...w,
34
+ children: [
35
+ d && /* @__PURE__ */ i("div", {
36
+ className: n(r.breadcrumbs, x?.breadcrumbs),
37
+ children: d
38
+ }),
39
+ E,
40
+ /* @__PURE__ */ a("div", {
41
+ className: n(r.titleRow, x?.titleRow),
42
+ children: [/* @__PURE__ */ a("div", {
43
+ className: r.titleBlock,
44
+ children: [
45
+ /* @__PURE__ */ a("div", {
46
+ className: r.titleLine,
47
+ children: [e(s, { className: n(r.title, x?.title) }, t), h && /* @__PURE__ */ i("span", {
48
+ className: n(r.badge, x?.badge),
49
+ children: h
50
+ })]
51
+ }),
52
+ c && /* @__PURE__ */ i("p", {
53
+ className: n(r.subtitle, x?.subtitle),
54
+ children: c
55
+ }),
56
+ l && /* @__PURE__ */ i("p", {
57
+ className: n(r.description, x?.description),
58
+ children: l
59
+ }),
60
+ g && /* @__PURE__ */ i("div", {
61
+ className: n(r.meta, x?.meta),
62
+ children: g
63
+ })
64
+ ]
65
+ }), u && /* @__PURE__ */ i("div", {
66
+ className: n(r.actions, x?.actions),
67
+ children: u
68
+ })]
69
+ }),
70
+ C,
71
+ _ && /* @__PURE__ */ i("div", {
72
+ className: n(r.tabs, x?.tabs),
73
+ children: _
74
+ })
75
+ ]
76
+ });
77
+ });
78
+ s.displayName = "PageHeader";
79
+ export { s as PageHeader };
@@ -1,43 +1,23 @@
1
- const t = "crk-root-K-SAd", c = "crk-sm-XJoTL", s = "crk-md-obtrZ", o = "crk-lg--8FAx", e = "crk-divider-q-A5e", i = "crk-hasTabs-YLYqx", r = "crk-sticky-e3pQP", n = "crk-breadcrumbs-rTXxK", k = "crk-back-R4Oq3", a = "crk-titleRow-4-MEi", l = "crk-titleBlock-37A6l", b = "crk-titleLine-oWB7d", d = "crk-title-1nY9v", m = "crk-badge-Uesjc", u = "crk-subtitle-BREZj", g = "crk-description--PNl0", T = "crk-meta-fkWcX", p = "crk-actions-EYOW1", B = "crk-tabs-qDTiN", L = {
2
- root: t,
3
- sm: c,
4
- md: s,
5
- lg: o,
6
- divider: e,
7
- hasTabs: i,
8
- sticky: r,
9
- breadcrumbs: n,
10
- back: k,
11
- titleRow: a,
12
- titleBlock: l,
13
- titleLine: b,
14
- title: d,
15
- badge: m,
16
- subtitle: u,
17
- description: g,
18
- meta: T,
19
- actions: p,
20
- tabs: B
21
- };
22
- export {
23
- p as actions,
24
- k as back,
25
- m as badge,
26
- n as breadcrumbs,
27
- L as default,
28
- g as description,
29
- e as divider,
30
- i as hasTabs,
31
- o as lg,
32
- s as md,
33
- T as meta,
34
- t as root,
35
- c as sm,
36
- r as sticky,
37
- u as subtitle,
38
- B as tabs,
39
- d as title,
40
- l as titleBlock,
41
- b as titleLine,
42
- a as titleRow
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
43
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";
1
+ import { forwardRef as e, useState as t } from "react";
2
+ import n from "clsx";
4
3
  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
- };
4
+ import { paginationRange as i } from "./paginationRange.js";
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 = e(({ count: e, 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 = e ?? (a == null ? 1 : Math.max(1, Math.ceil(a / l))), T = u !== void 0, [E, D] = t(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 = i(O, w, p, m), j = (e, t, i, a) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
26
+ type: "button",
27
+ className: n(r.item, r.control, b?.item, b?.control),
28
+ onClick: () => k(i),
29
+ disabled: v || O === i || (t === "left" || t === "first" ? O === 1 : O === w),
30
+ "aria-label": a,
31
+ children: /* @__PURE__ */ o(c, { dir: t })
32
+ }) }, e);
33
+ return /* @__PURE__ */ o("nav", {
34
+ ref: C,
35
+ "aria-label": y,
36
+ className: n(r.root, r[_], b?.root, x),
37
+ ...S,
38
+ children: /* @__PURE__ */ s("ul", {
39
+ className: n(r.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((e, t) => e === "ellipsis" ? /* @__PURE__ */ o("li", {
44
+ "aria-hidden": "true",
45
+ className: n(r.ellipsis, b?.ellipsis),
46
+ children: "…"
47
+ }, `e${t}`) : /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
48
+ type: "button",
49
+ className: n(r.item, e === O && r.active, b?.item, e === O && b?.active),
50
+ onClick: () => k(e),
51
+ disabled: v,
52
+ "aria-current": e === O ? "page" : void 0,
53
+ "aria-label": `Go to page ${e}`,
54
+ children: e
55
+ }) }, e)),
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 };