@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.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as k } from "react";
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
3
2
|
import t from "clsx";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
3
|
+
import n from "./EmptyState.module.scss.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
// src/components/EmptyState/EmptyState.tsx
|
|
6
|
+
var a = () => /* @__PURE__ */ i("svg", {
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: "1.5",
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
children: [/* @__PURE__ */ r("path", { d: "M3 13h4l2 3h6l2-3h4" }), /* @__PURE__ */ r("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" })]
|
|
15
|
+
}), o = () => /* @__PURE__ */ i("svg", {
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
fill: "none",
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
strokeWidth: "1.5",
|
|
20
|
+
strokeLinecap: "round",
|
|
21
|
+
strokeLinejoin: "round",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ r("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z" }),
|
|
25
|
+
/* @__PURE__ */ r("path", { d: "M12 9v4" }),
|
|
26
|
+
/* @__PURE__ */ r("path", { d: "M12 17h.01" })
|
|
27
|
+
]
|
|
28
|
+
}), s = e(({ variant: e = "empty", icon: s, title: c, description: l, action: u, children: d, size: f = "md", bordered: p = !1, classes: m, className: h, ...g }, _) => {
|
|
29
|
+
let v = s === void 0 ? r(e === "error" ? o : a, {}) : s;
|
|
30
|
+
return /* @__PURE__ */ i("div", {
|
|
31
|
+
ref: _,
|
|
32
|
+
role: e === "error" ? "alert" : void 0,
|
|
33
|
+
className: t(n.root, n[e], n[f], p && n.bordered, m?.root, h),
|
|
34
|
+
...g,
|
|
35
|
+
children: [
|
|
36
|
+
v !== !1 && v != null && /* @__PURE__ */ r("div", {
|
|
37
|
+
className: t(n.icon, m?.icon),
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: v
|
|
40
|
+
}),
|
|
41
|
+
c && /* @__PURE__ */ r("div", {
|
|
42
|
+
className: t(n.title, m?.title),
|
|
43
|
+
children: c
|
|
44
|
+
}),
|
|
45
|
+
l && /* @__PURE__ */ r("div", {
|
|
46
|
+
className: t(n.description, m?.description),
|
|
47
|
+
children: l
|
|
48
|
+
}),
|
|
49
|
+
d,
|
|
50
|
+
u && /* @__PURE__ */ r("div", {
|
|
51
|
+
className: t(n.action, m?.action),
|
|
52
|
+
children: u
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
s.displayName = "EmptyState";
|
|
58
|
+
export { s as EmptyState };
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
k as action,
|
|
15
|
-
e as bordered,
|
|
16
|
-
l as default,
|
|
17
|
-
d as description,
|
|
18
|
-
s as error,
|
|
19
|
-
i as icon,
|
|
20
|
-
n as lg,
|
|
21
|
-
c as md,
|
|
22
|
-
r as root,
|
|
23
|
-
o as sm,
|
|
24
|
-
t as title
|
|
1
|
+
// src/components/EmptyState/EmptyState.module.scss
|
|
2
|
+
var e = "crk-root--QSMy", t = "crk-sm-X3NZF", n = "crk-title-AfRVx", r = "crk-md-redWw", i = "crk-lg-Lnt1u", a = "crk-error-Y09vt", o = "crk-bordered-aCCLu", s = "crk-icon-ABwaI", c = "crk-description--LJrG", l = "crk-action-7ICV2", u = {
|
|
3
|
+
root: e,
|
|
4
|
+
sm: t,
|
|
5
|
+
title: n,
|
|
6
|
+
md: r,
|
|
7
|
+
lg: i,
|
|
8
|
+
error: a,
|
|
9
|
+
bordered: o,
|
|
10
|
+
icon: s,
|
|
11
|
+
description: c,
|
|
12
|
+
action: l
|
|
25
13
|
};
|
|
14
|
+
export { l as action, o as bordered, u as default, c as description, a as error, s as icon, i as lg, r as md, e as root, t as sm, n as title };
|
|
@@ -38,4 +38,4 @@ export interface FormProps<T extends FieldValues> {
|
|
|
38
38
|
* <Button type="submit">Save</Button>
|
|
39
39
|
* </Form>
|
|
40
40
|
*/
|
|
41
|
-
export declare function Form<T extends FieldValues>({ form, onSubmit, errors, reserveErrorSpace, fieldClasses, className, style, children, }: FormProps<T>): import("react
|
|
41
|
+
export declare function Form<T extends FieldValues>({ form, onSubmit, errors, reserveErrorSpace, fieldClasses, className, style, children, }: FormProps<T>): import("react").JSX.Element;
|
package/components/Form/Form.js
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import F from "clsx";
|
|
1
|
+
import { useMemo as e } from "react";
|
|
2
|
+
import { FormProvider as t } from "react-hook-form";
|
|
3
|
+
import n from "clsx";
|
|
5
4
|
import r from "./Form.module.scss.js";
|
|
6
|
-
import { FormFieldDefaultsContext as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
5
|
+
import { FormFieldDefaultsContext as i } from "./formFieldDefaults.js";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
// src/components/Form/Form.tsx
|
|
8
|
+
function s({ form: s, onSubmit: c, errors: l, reserveErrorSpace: u, fieldClasses: d, className: f, style: p, children: m }) {
|
|
9
|
+
let h = l && l.length > 0, g = e(() => ({
|
|
10
|
+
reserveErrorSpace: u,
|
|
11
|
+
classes: d
|
|
12
|
+
}), [u, d]);
|
|
13
|
+
return /* @__PURE__ */ a(t, {
|
|
14
|
+
...s,
|
|
15
|
+
children: /* @__PURE__ */ a(i.Provider, {
|
|
16
|
+
value: g,
|
|
17
|
+
children: /* @__PURE__ */ o("form", {
|
|
18
|
+
onSubmit: s.handleSubmit(c),
|
|
19
|
+
className: n(r.root, u === !1 && r.rootLooseGap, f),
|
|
20
|
+
style: p,
|
|
21
|
+
children: [h && /* @__PURE__ */ a("ul", {
|
|
22
|
+
className: r.formErrors,
|
|
23
|
+
role: "alert",
|
|
24
|
+
children: l.map((e, t) => /* @__PURE__ */ a("li", {
|
|
25
|
+
className: r.formError,
|
|
26
|
+
children: e
|
|
27
|
+
}, t))
|
|
28
|
+
}), m]
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
});
|
|
33
32
|
}
|
|
34
|
-
export {
|
|
35
|
-
y as Form
|
|
36
|
-
};
|
|
33
|
+
export { s as Form };
|
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
E as default,
|
|
17
|
-
k as error,
|
|
18
|
-
c as field,
|
|
19
|
-
s as formError,
|
|
20
|
-
e as formErrors,
|
|
21
|
-
m as helperText,
|
|
22
|
-
t as label,
|
|
23
|
-
l as labelError,
|
|
24
|
-
n as messageReserve,
|
|
25
|
-
a as required,
|
|
26
|
-
r as root,
|
|
27
|
-
o as rootLooseGap,
|
|
28
|
-
f as row
|
|
1
|
+
// src/components/Form/Form.module.scss
|
|
2
|
+
var e = "crk-root-jHIIP", t = "crk-rootLooseGap-NaOGK", n = "crk-formErrors-eh-OP", r = "crk-formError-XEuWv", i = "crk-field-OUlYz", a = "crk-label-udkR7", o = "crk-labelError-LOgKi", s = "crk-required-IYiA2", c = "crk-messageReserve-vTOdL", l = "crk-error-yFZXm", u = "crk-helperText-Dm-rb", d = "crk-row-nNbx-", f = {
|
|
3
|
+
root: e,
|
|
4
|
+
rootLooseGap: t,
|
|
5
|
+
formErrors: n,
|
|
6
|
+
formError: r,
|
|
7
|
+
field: i,
|
|
8
|
+
label: a,
|
|
9
|
+
labelError: o,
|
|
10
|
+
required: s,
|
|
11
|
+
messageReserve: c,
|
|
12
|
+
error: l,
|
|
13
|
+
helperText: u,
|
|
14
|
+
row: d
|
|
29
15
|
};
|
|
16
|
+
export { f as default, l as error, i as field, r as formError, n as formErrors, u as helperText, a as label, o as labelError, c as messageReserve, s as required, e as root, t as rootLooseGap, d as row };
|
|
@@ -56,4 +56,4 @@ export interface FormFieldProps {
|
|
|
56
56
|
* <Input type="email" />
|
|
57
57
|
* </FormField>
|
|
58
58
|
*/
|
|
59
|
-
export declare function FormField({ name, label, helperText, required, rules, reserveErrorSpace, classes, className, style, children, }: FormFieldProps): import("react
|
|
59
|
+
export declare function FormField({ name, label, helperText, required, rules, reserveErrorSpace, classes, className, style, children, }: FormFieldProps): import("react").JSX.Element;
|
|
@@ -1,77 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { cloneElement as e, useCallback as t, useContext as n, useRef as r } from "react";
|
|
2
|
+
import { useController as i, useFormContext as a } from "react-hook-form";
|
|
3
|
+
import o from "clsx";
|
|
4
|
+
import s from "./Form.module.scss.js";
|
|
5
|
+
import { FormFieldDefaultsContext as c } from "./formFieldDefaults.js";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
// src/components/Form/FormField.tsx
|
|
8
|
+
var d = /* @__PURE__ */ new Set([
|
|
9
|
+
"Select",
|
|
10
|
+
"NativeSelect",
|
|
11
|
+
"SearchableSelect",
|
|
12
|
+
"MultiSelect",
|
|
13
|
+
"Dropdown"
|
|
13
14
|
]);
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
] });
|
|
15
|
+
function f({ name: f, label: p, helperText: m, required: h, rules: g, reserveErrorSpace: _, classes: v, className: y, style: b, children: x }) {
|
|
16
|
+
let { control: S } = a(), { field: C, fieldState: w } = i({
|
|
17
|
+
name: f,
|
|
18
|
+
control: S,
|
|
19
|
+
rules: g
|
|
20
|
+
}), T = n(c), E = _ ?? T?.reserveErrorSpace ?? !0, D = T?.classes, O = x.type, k = typeof O == "string" ? "" : O?.displayName ?? O?.name ?? "", A = d.has(k), { ref: j, ...M } = C, N = typeof M.value == "boolean", P = r(j);
|
|
21
|
+
P.current = j;
|
|
22
|
+
let F = t((e) => {
|
|
23
|
+
if (e) {
|
|
24
|
+
let t = e.matches("input, select, textarea, button, [tabindex]") ? e : e.querySelector("input, select, textarea, button, [tabindex]:not([tabindex=\"-1\"])");
|
|
25
|
+
P.current(t ?? e);
|
|
26
|
+
} else P.current(null);
|
|
27
|
+
}, []);
|
|
28
|
+
return /* @__PURE__ */ u("div", {
|
|
29
|
+
className: o(s.field, D?.field, v?.field, y),
|
|
30
|
+
style: b,
|
|
31
|
+
children: [
|
|
32
|
+
p && /* @__PURE__ */ u("label", {
|
|
33
|
+
className: o(s.label, w.error && s.labelError, D?.label, v?.label),
|
|
34
|
+
htmlFor: f,
|
|
35
|
+
children: [p, h && /* @__PURE__ */ l("span", {
|
|
36
|
+
className: s.required,
|
|
37
|
+
children: "*"
|
|
38
|
+
})]
|
|
39
|
+
}),
|
|
40
|
+
e(x, {
|
|
41
|
+
...M,
|
|
42
|
+
...N && { value: void 0 },
|
|
43
|
+
ref: F,
|
|
44
|
+
id: f,
|
|
45
|
+
error: !!w.error,
|
|
46
|
+
"aria-invalid": w.error ? !0 : void 0,
|
|
47
|
+
"aria-describedby": [w.error?.message ? `${f}-error` : null, m ? `${f}-helper` : null].filter(Boolean).join(" ") || void 0,
|
|
48
|
+
...A && {
|
|
49
|
+
onValueChange: M.onChange,
|
|
50
|
+
onValuesChange: M.onChange
|
|
51
|
+
},
|
|
52
|
+
checked: N ? M.value : void 0
|
|
53
|
+
}),
|
|
54
|
+
w.error?.message && /* @__PURE__ */ l("span", {
|
|
55
|
+
id: `${f}-error`,
|
|
56
|
+
className: o(s.error, D?.error, v?.error),
|
|
57
|
+
role: "alert",
|
|
58
|
+
children: w.error.message
|
|
59
|
+
}),
|
|
60
|
+
m && /* @__PURE__ */ l("span", {
|
|
61
|
+
id: `${f}-helper`,
|
|
62
|
+
className: o(s.helperText, D?.helperText, v?.helperText),
|
|
63
|
+
children: m
|
|
64
|
+
}),
|
|
65
|
+
E !== !1 && !w.error?.message && /* @__PURE__ */ l("div", {
|
|
66
|
+
"aria-hidden": "true",
|
|
67
|
+
className: o(s.messageReserve, D?.message, v?.message),
|
|
68
|
+
style: typeof E == "number" ? { minHeight: `${E}px` } : typeof E == "string" ? { minHeight: E } : void 0
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
74
72
|
}
|
|
75
|
-
export {
|
|
76
|
-
P as FormField
|
|
77
|
-
};
|
|
73
|
+
export { f as FormField };
|
|
@@ -5,4 +5,4 @@ export interface FormRowProps {
|
|
|
5
5
|
style?: CSSProperties;
|
|
6
6
|
}
|
|
7
7
|
/** Horizontal flex row that lays out its children — useful for putting two `<FormField>`s side-by-side. */
|
|
8
|
-
export declare function FormRow({ children, className, style }: FormRowProps): import("react
|
|
8
|
+
export declare function FormRow({ children, className, style }: FormRowProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import e from "clsx";
|
|
2
|
+
import t from "./Form.module.scss.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/components/Form/FormRow.tsx
|
|
5
|
+
function r({ children: r, className: i, style: a }) {
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
|
+
className: e(t.row, i),
|
|
8
|
+
style: a,
|
|
9
|
+
children: r
|
|
10
|
+
});
|
|
6
11
|
}
|
|
7
|
-
export {
|
|
8
|
-
c as FormRow
|
|
9
|
-
};
|
|
12
|
+
export { r as FormRow };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
// src/components/Form/formFieldDefaults.ts
|
|
3
|
+
var t = e(null);
|
|
4
|
+
export { t as FormFieldDefaultsContext };
|