@overdoser/react-toolkit 0.7.0 → 0.8.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/CHANGELOG.md +32 -0
- package/components/ActionButton/ActionButton.js +211 -0
- package/components/ActionButton/ActionButton.module.scss.js +47 -0
- package/components/ActionButton/CopyButton.js +66 -0
- package/components/Alert/Alert.js +82 -0
- package/components/Alert/Alert.module.scss.js +25 -0
- package/components/Avatar/Avatar.js +57 -0
- package/components/Avatar/Avatar.module.scss.js +43 -0
- package/components/Badge/Badge.js +38 -0
- package/components/Badge/Badge.module.scss.js +31 -0
- package/components/Breadcrumbs/Breadcrumbs.js +49 -0
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +17 -0
- package/components/Button/Button.js +57 -0
- package/components/Button/Button.module.scss.js +47 -0
- package/components/Chart/AreaChart.js +244 -0
- package/components/Chart/Axis.js +45 -0
- package/components/Chart/BarChart.js +353 -0
- package/components/Chart/Chart.module.scss.js +61 -0
- package/components/Chart/ChartContainer.js +41 -0
- package/components/Chart/ChartLegend.js +31 -0
- package/components/Chart/ChartTooltip.js +42 -0
- package/components/Chart/LineChart.js +236 -0
- package/components/Chart/PieChart.js +248 -0
- package/components/Chart/RadarChart.js +221 -0
- package/components/Chart/Sparkline.js +69 -0
- package/components/Chart/TradingChart.js +732 -0
- package/components/Chart/scales.js +39 -0
- package/components/Chart/trading/indicators.js +68 -0
- package/components/Chart/trading/period.js +71 -0
- package/components/Chart/useChartDimensions.js +23 -0
- package/components/Divider/Divider.js +36 -0
- package/components/Divider/Divider.module.scss.js +31 -0
- package/components/Draggable/Draggable.js +155 -0
- package/components/Draggable/Draggable.module.scss.js +17 -0
- package/components/Drawer/Drawer.js +126 -0
- package/components/Drawer/Drawer.module.scss.js +117 -0
- package/components/Dropdown/Dropdown.js +142 -0
- package/components/Dropdown/Dropdown.module.scss.js +35 -0
- package/components/Dropdown/DropdownItem.js +31 -0
- package/components/Dropzone/Dropzone.js +107 -0
- package/components/Dropzone/Dropzone.module.scss.js +21 -0
- package/components/Form/Form.js +36 -0
- package/components/Form/Form.module.scss.js +29 -0
- package/components/Form/FormField.js +76 -0
- package/components/Form/FormRow.js +9 -0
- package/components/Form/formFieldDefaults.js +5 -0
- package/components/Link/Link.js +59 -0
- package/components/Link/Link.module.scss.js +16 -0
- package/components/List/List.js +46 -0
- package/components/List/List.module.scss.js +21 -0
- package/components/Modal/Modal.js +109 -0
- package/components/Modal/Modal.module.scss.js +31 -0
- package/components/Pagination/Pagination.js +84 -0
- package/components/Pagination/Pagination.module.scss.js +23 -0
- package/components/Pagination/paginationRange.js +24 -0
- package/components/Popover/Popover.js +138 -0
- package/components/Popover/Popover.module.scss.js +21 -0
- package/components/Skeleton/Skeleton.js +50 -0
- package/components/Skeleton/Skeleton.module.scss.js +25 -0
- package/components/Spinner/Spinner.js +25 -0
- package/components/Spinner/Spinner.module.scss.js +20 -0
- package/components/Table/Table.js +284 -0
- package/components/Table/Table.module.scss.js +59 -0
- package/components/Table/useTableSort.js +44 -0
- package/components/Tabs/Tabs.js +163 -0
- package/components/Tabs/Tabs.module.scss.js +53 -0
- package/components/Timer/Timer.js +159 -0
- package/components/Timer/Timer.module.scss.js +55 -0
- package/components/Toast/Toast.js +133 -0
- package/components/Toast/Toast.module.scss.js +62 -0
- package/components/Toast/toastStore.js +62 -0
- package/components/ToggleIconButton/ToggleIconButton.js +58 -0
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +27 -0
- package/components/Tooltip/Tooltip.js +86 -0
- package/components/Tooltip/Tooltip.module.scss.js +30 -0
- package/components/Typography/Typography.js +37 -0
- package/components/Typography/Typography.module.scss.js +53 -0
- package/components/inputs/Checkbox/Checkbox.js +50 -0
- package/components/inputs/Checkbox/Checkbox.module.scss.js +15 -0
- package/components/inputs/Checkbox/CheckboxGroup.js +111 -0
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +31 -0
- package/components/inputs/DatePicker/DatePicker.js +229 -0
- package/components/inputs/DatePicker/DatePicker.module.scss.js +45 -0
- package/components/inputs/DatePicker/dateUtils.js +41 -0
- package/components/inputs/Input/Input.js +50 -0
- package/components/inputs/Input/Input.module.scss.js +25 -0
- package/components/inputs/NumberInput/NumberInput.js +134 -0
- package/components/inputs/NumberInput/NumberInput.module.scss.js +25 -0
- package/components/inputs/Radio/Radio.js +68 -0
- package/components/inputs/Radio/Radio.module.scss.js +13 -0
- package/components/inputs/Select/Select.js +520 -0
- package/components/inputs/Select/Select.module.scss.js +69 -0
- package/components/inputs/Slider/Slider.js +128 -0
- package/components/inputs/Slider/Slider.module.scss.js +15 -0
- package/components/inputs/Textarea/Textarea.js +58 -0
- package/components/inputs/Textarea/Textarea.module.scss.js +25 -0
- package/hooks/useClickOutside.js +15 -0
- package/hooks/useFocusTrap.js +39 -0
- package/hooks/useKeyboard.js +19 -0
- package/hooks/usePortalPosition.js +20 -0
- package/index.css +1 -1
- package/index.js +119 -7000
- package/index.layered.css +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { forwardRef as c, createElement as n } from "react";
|
|
2
|
+
import d from "clsx";
|
|
3
|
+
import r from "./Typography.module.scss.js";
|
|
4
|
+
const i = c(
|
|
5
|
+
({
|
|
6
|
+
variant: e = "p",
|
|
7
|
+
weight: o,
|
|
8
|
+
color: p,
|
|
9
|
+
align: t,
|
|
10
|
+
truncate: m = !1,
|
|
11
|
+
className: a,
|
|
12
|
+
style: s,
|
|
13
|
+
children: f,
|
|
14
|
+
...y
|
|
15
|
+
}, l) => n(
|
|
16
|
+
e,
|
|
17
|
+
{
|
|
18
|
+
ref: l,
|
|
19
|
+
className: d(
|
|
20
|
+
r.root,
|
|
21
|
+
r[e],
|
|
22
|
+
o && r[o],
|
|
23
|
+
p && r[p],
|
|
24
|
+
t && r[`align-${t}`],
|
|
25
|
+
m && r.truncate,
|
|
26
|
+
a
|
|
27
|
+
),
|
|
28
|
+
style: s,
|
|
29
|
+
...y
|
|
30
|
+
},
|
|
31
|
+
f
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
i.displayName = "Typography";
|
|
35
|
+
export {
|
|
36
|
+
i as Typography
|
|
37
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const c = "crk-root-U-oiq", r = "crk-h1-Aivwz", t = "crk-h2-CV8Oo", n = "crk-h3-lrbrK", e = "crk-h4--jkC1", o = "crk-h5-GnQvD", s = "crk-h6-MKlIN", l = "crk-p-FzRtm", a = "crk-span-NZvLx", i = "crk-label-Cwi6a", k = "crk-normal-7AeZz", h = "crk-medium-36OXr", g = "crk-semibold-oQixc", m = "crk-bold-bk4b4", d = "crk-muted-itOSW", u = "crk-primary-rp36t", b = "crk-danger-SyOy-", p = "crk-success-w8PpD", f = "crk-align-left-3AGYw", y = "crk-align-center-h-x--", w = "crk-align-right-IXFhK", x = "crk-truncate-eqr85", C = {
|
|
2
|
+
root: c,
|
|
3
|
+
h1: r,
|
|
4
|
+
h2: t,
|
|
5
|
+
h3: n,
|
|
6
|
+
h4: e,
|
|
7
|
+
h5: o,
|
|
8
|
+
h6: s,
|
|
9
|
+
p: l,
|
|
10
|
+
span: a,
|
|
11
|
+
label: i,
|
|
12
|
+
normal: k,
|
|
13
|
+
medium: h,
|
|
14
|
+
semibold: g,
|
|
15
|
+
bold: m,
|
|
16
|
+
default: "crk-default-79lKR",
|
|
17
|
+
muted: d,
|
|
18
|
+
primary: u,
|
|
19
|
+
danger: b,
|
|
20
|
+
success: p,
|
|
21
|
+
"align-left": "crk-align-left-3AGYw",
|
|
22
|
+
alignLeft: f,
|
|
23
|
+
"align-center": "crk-align-center-h-x--",
|
|
24
|
+
alignCenter: y,
|
|
25
|
+
"align-right": "crk-align-right-IXFhK",
|
|
26
|
+
alignRight: w,
|
|
27
|
+
truncate: x
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
y as alignCenter,
|
|
31
|
+
f as alignLeft,
|
|
32
|
+
w as alignRight,
|
|
33
|
+
m as bold,
|
|
34
|
+
b as danger,
|
|
35
|
+
C as default,
|
|
36
|
+
r as h1,
|
|
37
|
+
t as h2,
|
|
38
|
+
n as h3,
|
|
39
|
+
e as h4,
|
|
40
|
+
o as h5,
|
|
41
|
+
s as h6,
|
|
42
|
+
i as label,
|
|
43
|
+
h as medium,
|
|
44
|
+
d as muted,
|
|
45
|
+
k as normal,
|
|
46
|
+
l as p,
|
|
47
|
+
u as primary,
|
|
48
|
+
c as root,
|
|
49
|
+
g as semibold,
|
|
50
|
+
a as span,
|
|
51
|
+
p as success,
|
|
52
|
+
x as truncate
|
|
53
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsxs as x, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as b, useRef as d, useEffect as w } from "react";
|
|
3
|
+
import s from "clsx";
|
|
4
|
+
import t from "./Checkbox.module.scss.js";
|
|
5
|
+
const k = b(
|
|
6
|
+
({
|
|
7
|
+
label: m,
|
|
8
|
+
variant: f = "checkbox",
|
|
9
|
+
indeterminate: l = !1,
|
|
10
|
+
classes: r,
|
|
11
|
+
className: p,
|
|
12
|
+
style: u,
|
|
13
|
+
...h
|
|
14
|
+
}, e) => {
|
|
15
|
+
const i = d(null), n = f === "switch", c = l && !n;
|
|
16
|
+
return w(() => {
|
|
17
|
+
i.current && (i.current.indeterminate = c);
|
|
18
|
+
}, [c]), /* @__PURE__ */ x(
|
|
19
|
+
"label",
|
|
20
|
+
{
|
|
21
|
+
className: s(
|
|
22
|
+
t.root,
|
|
23
|
+
n && t.switchRoot,
|
|
24
|
+
c && t.indeterminate,
|
|
25
|
+
r?.root,
|
|
26
|
+
p
|
|
27
|
+
),
|
|
28
|
+
style: u,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ a(
|
|
31
|
+
"input",
|
|
32
|
+
{
|
|
33
|
+
ref: (o) => {
|
|
34
|
+
i.current = o, typeof e == "function" ? e(o) : e && (e.current = o);
|
|
35
|
+
},
|
|
36
|
+
type: "checkbox",
|
|
37
|
+
className: s(t.input, n && t.switchInput, r?.input),
|
|
38
|
+
...h
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
m && /* @__PURE__ */ a("span", { className: s(t.label, r?.label), children: m })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
k.displayName = "Checkbox";
|
|
48
|
+
export {
|
|
49
|
+
k as Checkbox
|
|
50
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const t = "crk-root-61cKD", n = "crk-input-bAjPU", e = "crk-switchInput-Ichse", c = "crk-label-W9IeS", o = "crk-indeterminate-mLarv", r = {
|
|
2
|
+
root: t,
|
|
3
|
+
input: n,
|
|
4
|
+
switchInput: e,
|
|
5
|
+
label: c,
|
|
6
|
+
indeterminate: o
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
r as default,
|
|
10
|
+
o as indeterminate,
|
|
11
|
+
n as input,
|
|
12
|
+
c as label,
|
|
13
|
+
t as root,
|
|
14
|
+
e as switchInput
|
|
15
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as s, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as z } from "react";
|
|
3
|
+
import o from "clsx";
|
|
4
|
+
import { Checkbox as D } from "./Checkbox.js";
|
|
5
|
+
import i from "./CheckboxGroup.module.scss.js";
|
|
6
|
+
const O = z(
|
|
7
|
+
({
|
|
8
|
+
options: p,
|
|
9
|
+
value: a = [],
|
|
10
|
+
onChange: t,
|
|
11
|
+
variant: d = "checkbox",
|
|
12
|
+
chipShape: b = "pill",
|
|
13
|
+
chipCheckmark: h = !0,
|
|
14
|
+
orientation: u,
|
|
15
|
+
disabled: m = !1,
|
|
16
|
+
error: f = !1,
|
|
17
|
+
name: x,
|
|
18
|
+
classes: l,
|
|
19
|
+
className: k,
|
|
20
|
+
style: v,
|
|
21
|
+
id: C,
|
|
22
|
+
"aria-label": y,
|
|
23
|
+
"aria-labelledby": g,
|
|
24
|
+
"aria-describedby": N,
|
|
25
|
+
"aria-invalid": q,
|
|
26
|
+
required: G
|
|
27
|
+
}, S) => {
|
|
28
|
+
const j = u ?? (d === "chips" ? "horizontal" : "vertical"), R = {
|
|
29
|
+
pill: i.chipPill,
|
|
30
|
+
rounded: i.chipRounded,
|
|
31
|
+
square: i.chipSquare
|
|
32
|
+
}[b], n = (e) => {
|
|
33
|
+
const r = a.includes(e) ? a.filter((c) => c !== e) : [...a, e];
|
|
34
|
+
t?.(r);
|
|
35
|
+
};
|
|
36
|
+
return /* @__PURE__ */ s(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
ref: S,
|
|
40
|
+
id: C,
|
|
41
|
+
role: "group",
|
|
42
|
+
"aria-label": y,
|
|
43
|
+
"aria-labelledby": g,
|
|
44
|
+
"aria-describedby": N,
|
|
45
|
+
"aria-invalid": q,
|
|
46
|
+
"aria-required": G || void 0,
|
|
47
|
+
className: o(
|
|
48
|
+
i.group,
|
|
49
|
+
i[j],
|
|
50
|
+
d === "chips" && i.chipsGroup,
|
|
51
|
+
f && i.error,
|
|
52
|
+
l?.group,
|
|
53
|
+
k
|
|
54
|
+
),
|
|
55
|
+
style: v,
|
|
56
|
+
children: p.map((e) => {
|
|
57
|
+
const r = a.includes(e.value), c = m || e.disabled;
|
|
58
|
+
return d === "chips" ? /* @__PURE__ */ w(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
role: "checkbox",
|
|
63
|
+
"aria-checked": r,
|
|
64
|
+
disabled: c,
|
|
65
|
+
className: o(
|
|
66
|
+
i.chip,
|
|
67
|
+
R,
|
|
68
|
+
r && i.chipSelected,
|
|
69
|
+
h && r && i.chipChecked,
|
|
70
|
+
l?.option,
|
|
71
|
+
l?.chip,
|
|
72
|
+
r && l?.chipSelected
|
|
73
|
+
),
|
|
74
|
+
onClick: () => n(e.value),
|
|
75
|
+
children: [
|
|
76
|
+
h && // Always rendered so it can transition; collapsed to zero
|
|
77
|
+
// width when unselected, expanding in when selected. Padding
|
|
78
|
+
// stays symmetric, so the icon + label remain centered.
|
|
79
|
+
/* @__PURE__ */ s(
|
|
80
|
+
"span",
|
|
81
|
+
{
|
|
82
|
+
className: o(i.chipCheck, r && i.chipCheckVisible),
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
e.label
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
e.value
|
|
90
|
+
) : /* @__PURE__ */ s(
|
|
91
|
+
D,
|
|
92
|
+
{
|
|
93
|
+
name: x,
|
|
94
|
+
value: e.value,
|
|
95
|
+
label: e.label,
|
|
96
|
+
checked: r,
|
|
97
|
+
disabled: c,
|
|
98
|
+
className: o(i.option, l?.option),
|
|
99
|
+
onChange: () => n(e.value)
|
|
100
|
+
},
|
|
101
|
+
e.value
|
|
102
|
+
);
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
O.displayName = "CheckboxGroup";
|
|
109
|
+
export {
|
|
110
|
+
O as CheckboxGroup
|
|
111
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const c = "crk-group-3jaV7", i = "crk-vertical--i2tD", h = "crk-horizontal-4qzrj", e = "crk-chipsGroup-jyDEd", r = "crk-chip-NYeqm", p = "crk-chipPill-DfnpS", o = "crk-chipRounded-oi-hI", t = "crk-chipSquare-ZcbQB", n = "crk-chipCheck-4nqaQ", s = "crk-chipCheckVisible-nGulJ", k = "crk-chipChecked-4h2bc", l = "crk-chipSelected-qbOpf", d = "crk-error-phPRL", u = {
|
|
2
|
+
group: c,
|
|
3
|
+
vertical: i,
|
|
4
|
+
horizontal: h,
|
|
5
|
+
chipsGroup: e,
|
|
6
|
+
chip: r,
|
|
7
|
+
chipPill: p,
|
|
8
|
+
chipRounded: o,
|
|
9
|
+
chipSquare: t,
|
|
10
|
+
chipCheck: n,
|
|
11
|
+
chipCheckVisible: s,
|
|
12
|
+
chipChecked: k,
|
|
13
|
+
chipSelected: l,
|
|
14
|
+
error: d
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
r as chip,
|
|
18
|
+
n as chipCheck,
|
|
19
|
+
s as chipCheckVisible,
|
|
20
|
+
k as chipChecked,
|
|
21
|
+
p as chipPill,
|
|
22
|
+
o as chipRounded,
|
|
23
|
+
l as chipSelected,
|
|
24
|
+
t as chipSquare,
|
|
25
|
+
e as chipsGroup,
|
|
26
|
+
u as default,
|
|
27
|
+
d as error,
|
|
28
|
+
c as group,
|
|
29
|
+
h as horizontal,
|
|
30
|
+
i as vertical
|
|
31
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { jsxs as k, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as me, useState as w, useRef as F, useMemo as h, useCallback as f, useEffect as he } from "react";
|
|
3
|
+
import { createPortal as ye } from "react-dom";
|
|
4
|
+
import l from "clsx";
|
|
5
|
+
import { useClickOutside as De } from "../../../hooks/useClickOutside.js";
|
|
6
|
+
import { usePortalPosition as ve } from "../../../hooks/usePortalPosition.js";
|
|
7
|
+
import t from "./DatePicker.module.scss.js";
|
|
8
|
+
import { startOfMonth as R, startOfDay as y, weekdayLabels as be, buildCalendarDays as ke, toISODate as S, isSameMonth as J, addMonths as g, isSameDay as A, addDays as p } from "./dateUtils.js";
|
|
9
|
+
const we = me(
|
|
10
|
+
({
|
|
11
|
+
value: j,
|
|
12
|
+
defaultValue: Q,
|
|
13
|
+
onChange: K,
|
|
14
|
+
min: C,
|
|
15
|
+
max: N,
|
|
16
|
+
disabledDate: O,
|
|
17
|
+
weekStartsOn: u = 0,
|
|
18
|
+
locale: s,
|
|
19
|
+
format: B,
|
|
20
|
+
placeholder: X = "Select date",
|
|
21
|
+
inputSize: Y = "md",
|
|
22
|
+
error: W = !1,
|
|
23
|
+
disabled: m = !1,
|
|
24
|
+
portal: D = !0,
|
|
25
|
+
classes: n,
|
|
26
|
+
className: Z,
|
|
27
|
+
style: _,
|
|
28
|
+
"aria-label": ee
|
|
29
|
+
}, te) => {
|
|
30
|
+
const x = j !== void 0, [re, ae] = w(Q ?? null), d = x ? j ?? null : re, [c, v] = w(!1), [i, b] = w(() => R(d ?? /* @__PURE__ */ new Date())), [a, q] = w(() => y(d ?? /* @__PURE__ */ new Date())), L = F(null), U = F(null), G = F(null), H = ve(L, c && D), oe = h(() => y(/* @__PURE__ */ new Date()), []), ne = h(
|
|
31
|
+
() => B ?? ((e) => new Intl.DateTimeFormat(s, { year: "numeric", month: "short", day: "numeric" }).format(e)),
|
|
32
|
+
[B, s]
|
|
33
|
+
), ie = h(
|
|
34
|
+
() => new Intl.DateTimeFormat(s, { month: "long", year: "numeric" }).format(i),
|
|
35
|
+
[s, i]
|
|
36
|
+
), le = h(() => be(s, u), [s, u]), se = h(() => ke(i, u), [i, u]), M = f(
|
|
37
|
+
(e) => C && e < y(C) || N && e > y(N) ? !0 : O?.(e) ?? !1,
|
|
38
|
+
[C, N, O]
|
|
39
|
+
), V = f(
|
|
40
|
+
(e) => {
|
|
41
|
+
x || ae(e), K?.(e);
|
|
42
|
+
},
|
|
43
|
+
[x, K]
|
|
44
|
+
), I = f(() => {
|
|
45
|
+
if (m) return;
|
|
46
|
+
const e = y(d ?? /* @__PURE__ */ new Date());
|
|
47
|
+
b(R(e)), q(e), v(!0);
|
|
48
|
+
}, [m, d]), P = f((e = !0) => {
|
|
49
|
+
v(!1), e && L.current?.querySelector("input")?.focus();
|
|
50
|
+
}, []), $ = f(
|
|
51
|
+
(e) => {
|
|
52
|
+
M(e) || (V(e), P());
|
|
53
|
+
},
|
|
54
|
+
[M, V, P]
|
|
55
|
+
);
|
|
56
|
+
De(U, () => v(!1), c), he(() => {
|
|
57
|
+
if (!c) return;
|
|
58
|
+
G.current?.querySelector(`[data-date="${S(a)}"]`)?.focus();
|
|
59
|
+
}, [c, a]);
|
|
60
|
+
const de = f(
|
|
61
|
+
(e) => {
|
|
62
|
+
q(e), J(e, i) || b(R(e));
|
|
63
|
+
},
|
|
64
|
+
[i]
|
|
65
|
+
), ce = (e) => {
|
|
66
|
+
let o = null;
|
|
67
|
+
switch (e.key) {
|
|
68
|
+
case "ArrowLeft":
|
|
69
|
+
o = p(a, -1);
|
|
70
|
+
break;
|
|
71
|
+
case "ArrowRight":
|
|
72
|
+
o = p(a, 1);
|
|
73
|
+
break;
|
|
74
|
+
case "ArrowUp":
|
|
75
|
+
o = p(a, -7);
|
|
76
|
+
break;
|
|
77
|
+
case "ArrowDown":
|
|
78
|
+
o = p(a, 7);
|
|
79
|
+
break;
|
|
80
|
+
case "Home":
|
|
81
|
+
o = p(a, -((a.getDay() - u + 7) % 7));
|
|
82
|
+
break;
|
|
83
|
+
case "End":
|
|
84
|
+
o = p(a, 6 - (a.getDay() - u + 7) % 7);
|
|
85
|
+
break;
|
|
86
|
+
case "PageUp":
|
|
87
|
+
o = g(a, -1);
|
|
88
|
+
break;
|
|
89
|
+
case "PageDown":
|
|
90
|
+
o = g(a, 1);
|
|
91
|
+
break;
|
|
92
|
+
case "Enter":
|
|
93
|
+
case " ":
|
|
94
|
+
e.preventDefault(), $(a);
|
|
95
|
+
return;
|
|
96
|
+
case "Escape":
|
|
97
|
+
e.preventDefault(), P();
|
|
98
|
+
return;
|
|
99
|
+
default:
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
e.preventDefault(), de(o);
|
|
103
|
+
}, ue = (e) => {
|
|
104
|
+
e.key === "ArrowDown" || e.key === "Enter" ? (e.preventDefault(), I()) : e.key === "Escape" && c && v(!1);
|
|
105
|
+
}, z = /* @__PURE__ */ k(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
ref: U,
|
|
109
|
+
className: l(t.popover, D && t.portalled, n?.popover),
|
|
110
|
+
style: D ? { position: "fixed", top: H.top + 4, left: H.left } : void 0,
|
|
111
|
+
role: "dialog",
|
|
112
|
+
"aria-modal": "false",
|
|
113
|
+
"aria-label": "Choose date",
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ k("div", { className: l(t.header, n?.header), children: [
|
|
116
|
+
/* @__PURE__ */ r(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
type: "button",
|
|
120
|
+
className: l(t.nav, n?.nav),
|
|
121
|
+
onClick: () => b(g(i, -1)),
|
|
122
|
+
"aria-label": "Previous month",
|
|
123
|
+
children: /* @__PURE__ */ r("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M7 2L3 6l4 4" }) })
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ r("span", { className: t.monthLabel, "aria-live": "polite", children: ie }),
|
|
127
|
+
/* @__PURE__ */ r(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
type: "button",
|
|
131
|
+
className: l(t.nav, n?.nav),
|
|
132
|
+
onClick: () => b(g(i, 1)),
|
|
133
|
+
"aria-label": "Next month",
|
|
134
|
+
children: /* @__PURE__ */ r("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M5 2l4 4-4 4" }) })
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ r("div", { className: t.weekdays, "aria-hidden": "true", children: le.map((e, o) => /* @__PURE__ */ r("span", { className: t.weekday, children: e }, o)) }),
|
|
139
|
+
/* @__PURE__ */ r(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
ref: G,
|
|
143
|
+
role: "grid",
|
|
144
|
+
className: l(t.grid, n?.grid),
|
|
145
|
+
onKeyDown: ce,
|
|
146
|
+
children: se.map((e) => {
|
|
147
|
+
const o = !J(e, i), T = A(e, d), E = A(e, oe), fe = M(e), pe = A(e, a);
|
|
148
|
+
return /* @__PURE__ */ r(
|
|
149
|
+
"button",
|
|
150
|
+
{
|
|
151
|
+
type: "button",
|
|
152
|
+
role: "gridcell",
|
|
153
|
+
"data-date": S(e),
|
|
154
|
+
tabIndex: pe ? 0 : -1,
|
|
155
|
+
className: l(
|
|
156
|
+
t.day,
|
|
157
|
+
o && t.dayOutside,
|
|
158
|
+
E && t.dayToday,
|
|
159
|
+
T && t.daySelected,
|
|
160
|
+
o && n?.dayOutside,
|
|
161
|
+
E && n?.dayToday,
|
|
162
|
+
T && n?.daySelected,
|
|
163
|
+
n?.day
|
|
164
|
+
),
|
|
165
|
+
"aria-selected": T,
|
|
166
|
+
"aria-disabled": fe || void 0,
|
|
167
|
+
"aria-current": E ? "date" : void 0,
|
|
168
|
+
"aria-label": new Intl.DateTimeFormat(s, { dateStyle: "full" }).format(e),
|
|
169
|
+
onClick: () => $(e),
|
|
170
|
+
children: e.getDate()
|
|
171
|
+
},
|
|
172
|
+
S(e)
|
|
173
|
+
);
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
return /* @__PURE__ */ k(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
ref: L,
|
|
184
|
+
className: l(t.root, t[Y], W && t.error, m && t.disabled, n?.root, Z),
|
|
185
|
+
style: _,
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ r(
|
|
188
|
+
"input",
|
|
189
|
+
{
|
|
190
|
+
ref: te,
|
|
191
|
+
type: "text",
|
|
192
|
+
readOnly: !0,
|
|
193
|
+
className: l(t.input, n?.input),
|
|
194
|
+
value: d ? ne(d) : "",
|
|
195
|
+
placeholder: X,
|
|
196
|
+
disabled: m,
|
|
197
|
+
"aria-label": ee,
|
|
198
|
+
"aria-haspopup": "dialog",
|
|
199
|
+
"aria-expanded": c,
|
|
200
|
+
"aria-invalid": W || void 0,
|
|
201
|
+
onClick: I,
|
|
202
|
+
onKeyDown: ue
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ r(
|
|
206
|
+
"button",
|
|
207
|
+
{
|
|
208
|
+
type: "button",
|
|
209
|
+
tabIndex: -1,
|
|
210
|
+
className: l(t.icon, n?.icon),
|
|
211
|
+
onClick: I,
|
|
212
|
+
disabled: m,
|
|
213
|
+
"aria-label": "Open calendar",
|
|
214
|
+
children: /* @__PURE__ */ k("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: [
|
|
215
|
+
/* @__PURE__ */ r("rect", { x: "3", y: "4", width: "14", height: "13", rx: "2" }),
|
|
216
|
+
/* @__PURE__ */ r("path", { d: "M3 8h14M7 2v3M13 2v3", strokeLinecap: "round" })
|
|
217
|
+
] })
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
c && (D ? typeof document < "u" && ye(z, document.body) : z)
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
we.displayName = "DatePicker";
|
|
227
|
+
export {
|
|
228
|
+
we as DatePicker
|
|
229
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const e = "crk-root-ZBCoP", o = "crk-sm-7EeFF", c = "crk-input-62G21", d = "crk-md-OVdqx", r = "crk-lg-a9KsJ", t = "crk-icon-jS307", a = "crk-error-c4lUO", s = "crk-disabled-3PiA5", n = "crk-popover-x1-UT", k = "crk-portalled-iPe0Y", y = "crk-header-KmYtH", l = "crk-monthLabel-69Pwi", i = "crk-nav-uKYXN", p = "crk-weekdays--RSzS", m = "crk-grid-tf4tT", u = "crk-weekday-Zc1su", h = "crk-day-5SuBX", w = "crk-dayOutside-q3Phh", S = "crk-dayToday-7rRns", b = "crk-daySelected-a3XL4", g = {
|
|
2
|
+
root: e,
|
|
3
|
+
sm: o,
|
|
4
|
+
input: c,
|
|
5
|
+
md: d,
|
|
6
|
+
lg: r,
|
|
7
|
+
icon: t,
|
|
8
|
+
error: a,
|
|
9
|
+
disabled: s,
|
|
10
|
+
popover: n,
|
|
11
|
+
portalled: k,
|
|
12
|
+
header: y,
|
|
13
|
+
monthLabel: l,
|
|
14
|
+
nav: i,
|
|
15
|
+
weekdays: p,
|
|
16
|
+
grid: m,
|
|
17
|
+
weekday: u,
|
|
18
|
+
day: h,
|
|
19
|
+
dayOutside: w,
|
|
20
|
+
dayToday: S,
|
|
21
|
+
daySelected: b
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
h as day,
|
|
25
|
+
w as dayOutside,
|
|
26
|
+
b as daySelected,
|
|
27
|
+
S as dayToday,
|
|
28
|
+
g as default,
|
|
29
|
+
s as disabled,
|
|
30
|
+
a as error,
|
|
31
|
+
m as grid,
|
|
32
|
+
y as header,
|
|
33
|
+
t as icon,
|
|
34
|
+
c as input,
|
|
35
|
+
r as lg,
|
|
36
|
+
d as md,
|
|
37
|
+
l as monthLabel,
|
|
38
|
+
i as nav,
|
|
39
|
+
n as popover,
|
|
40
|
+
k as portalled,
|
|
41
|
+
e as root,
|
|
42
|
+
o as sm,
|
|
43
|
+
u as weekday,
|
|
44
|
+
p as weekdays
|
|
45
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function f(t) {
|
|
2
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate());
|
|
3
|
+
}
|
|
4
|
+
function s(t, e) {
|
|
5
|
+
return !t || !e ? !1 : t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
|
|
6
|
+
}
|
|
7
|
+
function i(t, e) {
|
|
8
|
+
return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth();
|
|
9
|
+
}
|
|
10
|
+
function a(t, e) {
|
|
11
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate() + e);
|
|
12
|
+
}
|
|
13
|
+
function D(t, e) {
|
|
14
|
+
return new Date(t.getFullYear(), t.getMonth() + e, 1);
|
|
15
|
+
}
|
|
16
|
+
function l(t) {
|
|
17
|
+
return new Date(t.getFullYear(), t.getMonth(), 1);
|
|
18
|
+
}
|
|
19
|
+
function c(t) {
|
|
20
|
+
const e = (n) => String(n).padStart(2, "0");
|
|
21
|
+
return `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())}`;
|
|
22
|
+
}
|
|
23
|
+
function h(t, e) {
|
|
24
|
+
const n = l(t), r = (n.getDay() - e + 7) % 7, o = a(n, -r);
|
|
25
|
+
return Array.from({ length: 42 }, (u, g) => a(o, g));
|
|
26
|
+
}
|
|
27
|
+
function M(t, e) {
|
|
28
|
+
const n = new Intl.DateTimeFormat(t, { weekday: "short" }), r = new Date(2023, 0, 1);
|
|
29
|
+
return Array.from({ length: 7 }, (o, u) => n.format(a(r, (e + u) % 7)));
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
a as addDays,
|
|
33
|
+
D as addMonths,
|
|
34
|
+
h as buildCalendarDays,
|
|
35
|
+
s as isSameDay,
|
|
36
|
+
i as isSameMonth,
|
|
37
|
+
f as startOfDay,
|
|
38
|
+
l as startOfMonth,
|
|
39
|
+
c as toISODate,
|
|
40
|
+
M as weekdayLabels
|
|
41
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import r from "./Input.module.scss.js";
|
|
5
|
+
const u = N(
|
|
6
|
+
({
|
|
7
|
+
inputSize: e = "md",
|
|
8
|
+
error: p = !1,
|
|
9
|
+
prefix: o,
|
|
10
|
+
suffix: t,
|
|
11
|
+
classes: m,
|
|
12
|
+
className: d,
|
|
13
|
+
style: l,
|
|
14
|
+
...i
|
|
15
|
+
}, c) => {
|
|
16
|
+
const s = /* @__PURE__ */ n(
|
|
17
|
+
"input",
|
|
18
|
+
{
|
|
19
|
+
ref: c,
|
|
20
|
+
className: a(
|
|
21
|
+
r.root,
|
|
22
|
+
r[e],
|
|
23
|
+
p && r.error,
|
|
24
|
+
o && r.hasPrefix,
|
|
25
|
+
t && r.hasSuffix,
|
|
26
|
+
m?.root,
|
|
27
|
+
!o && !t && d
|
|
28
|
+
),
|
|
29
|
+
style: !o && !t ? l : void 0,
|
|
30
|
+
...i
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
return o || t ? /* @__PURE__ */ h(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: a(r.wrapper, r[e], p && r.error, m?.wrapper, d),
|
|
37
|
+
style: l,
|
|
38
|
+
children: [
|
|
39
|
+
o && /* @__PURE__ */ n("span", { className: a(r.prefix, m?.prefix), children: o }),
|
|
40
|
+
s,
|
|
41
|
+
t && /* @__PURE__ */ n("span", { className: a(r.suffix, m?.suffix), children: t })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
) : s;
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
u.displayName = "Input";
|
|
48
|
+
export {
|
|
49
|
+
u as Input
|
|
50
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const r = "crk-root-rSgdy", s = "crk-wrapper-GHy8V", c = "crk-sm-DptM5", f = "crk-md-F4B0G", o = "crk-lg-pBxwX", t = "crk-error-fucxe", e = "crk-prefix-w53Md", x = "crk-suffix-fcNgR", i = "crk-hasPrefix--bqPD", n = "crk-hasSuffix-zO0nX", p = {
|
|
2
|
+
root: r,
|
|
3
|
+
wrapper: s,
|
|
4
|
+
sm: c,
|
|
5
|
+
md: f,
|
|
6
|
+
lg: o,
|
|
7
|
+
error: t,
|
|
8
|
+
prefix: e,
|
|
9
|
+
suffix: x,
|
|
10
|
+
hasPrefix: i,
|
|
11
|
+
hasSuffix: n
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
p as default,
|
|
15
|
+
t as error,
|
|
16
|
+
i as hasPrefix,
|
|
17
|
+
n as hasSuffix,
|
|
18
|
+
o as lg,
|
|
19
|
+
f as md,
|
|
20
|
+
e as prefix,
|
|
21
|
+
r as root,
|
|
22
|
+
c as sm,
|
|
23
|
+
x as suffix,
|
|
24
|
+
s as wrapper
|
|
25
|
+
};
|