@spear-ai/spectral 1.9.0 → 1.10.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/README.md +6 -5
- package/dist/.js +112 -239
- package/dist/Accordion-CDXdSAST.js +363 -0
- package/dist/Accordion.js +3 -498
- package/dist/Alert/AlertBase.js +69 -152
- package/dist/Alert.js +58 -106
- package/dist/AnimatePresence-D-9jXfgI.js +178 -0
- package/dist/App.js +6 -6
- package/dist/Avatar.js +83 -65
- package/dist/Badge.d.ts +1 -3
- package/dist/Badge.js +21 -25
- package/dist/Button.js +102 -178
- package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
- package/dist/ButtonGroup.js +55 -59
- package/dist/ButtonIcon.js +58 -134
- package/dist/Calendar-s4lyijkn.js +3109 -0
- package/dist/Checkbox/CheckboxBase.js +94 -126
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.js +40 -105
- package/dist/Combobox/ComboboxBase.js +2 -79
- package/dist/Combobox.js +106 -172
- package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
- package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
- package/dist/ControlGroup/ControlGroupSelect.js +85 -101
- package/dist/ControlGroup.js +45 -48
- package/dist/DataCard/Card.js +37 -12
- package/dist/DataCard.d.ts +1 -1
- package/dist/DataCard.js +36 -16
- package/dist/DateTimePicker/Calendar.js +2 -2967
- package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
- package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -274
- package/dist/DateTimePicker/DateTimeInput.d.ts +5 -3
- package/dist/DateTimePicker/DateTimeInput.js +133 -88
- package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
- package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
- package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
- package/dist/DateTimePicker/TimePicker.d.ts +1 -1
- package/dist/DateTimePicker/TimePicker.js +76 -60
- package/dist/DateTimePicker.d.ts +2 -2
- package/dist/DateTimePicker.js +87 -205
- package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
- package/dist/Dialog.js +74 -74
- package/dist/Drawer.js +67 -37
- package/dist/HoverCard-CYDsIiVK.js +201 -0
- package/dist/HoverCard.d.ts +1 -1
- package/dist/HoverCard.js +2 -218
- package/dist/Icons/AnalyzeIcon.js +50 -57
- package/dist/Icons/AnnotationsIcon.js +20 -15
- package/dist/Icons/ApprovedIcon.js +26 -18
- package/dist/Icons/ArrowDownIcon.js +20 -6
- package/dist/Icons/ArrowUpIcon.js +20 -6
- package/dist/Icons/BoxToolIcon.js +17 -12
- package/dist/Icons/CalendarIcon.js +43 -20
- package/dist/Icons/CheckCircleIcon.js +26 -10
- package/dist/Icons/CheckSquareIcon.js +26 -10
- package/dist/Icons/CheckmarkIcon.js +22 -9
- package/dist/Icons/ChevronDownIcon.js +22 -9
- package/dist/Icons/ChevronUpIcon.js +22 -9
- package/dist/Icons/ClockIcon.js +26 -18
- package/dist/Icons/CloseCircleIcon.js +26 -10
- package/dist/Icons/CloseIcon.js +18 -9
- package/dist/Icons/DashboardIcon.js +36 -10
- package/dist/Icons/DatabaseIcon.js +36 -19
- package/dist/Icons/DeleteIcon.js +36 -19
- package/dist/Icons/DurationIcon.js +57 -22
- package/dist/Icons/EditIcon.js +26 -27
- package/dist/Icons/EmailIcon.js +26 -10
- package/dist/Icons/EraserIcon.js +41 -25
- package/dist/Icons/ErrorIcon.js +27 -11
- package/dist/Icons/EyeClosedIcon.js +29 -13
- package/dist/Icons/EyeClosedIcon2.js +27 -11
- package/dist/Icons/EyeOpenIcon.js +22 -9
- package/dist/Icons/FileDownloadIcon.js +43 -20
- package/dist/Icons/GoToFirstIcon.js +26 -9
- package/dist/Icons/GoToLastIcon.js +26 -9
- package/dist/Icons/HarmonicCursorsIcon.js +23 -9
- package/dist/Icons/IconBase.d.ts +3 -3
- package/dist/Icons/IconBase.js +49 -23
- package/dist/Icons/InfoIcon.js +36 -10
- package/dist/Icons/KeyboardIcon.js +26 -27
- package/dist/Icons/LabelIcon.js +19 -14
- package/dist/Icons/LassoIcon.js +36 -28
- package/dist/Icons/LineToolIcon.js +48 -39
- package/dist/Icons/LiveViewIcon.js +50 -12
- package/dist/Icons/LoaderIcon.js +67 -27
- package/dist/Icons/LocationIcon.js +26 -27
- package/dist/Icons/LogoutIcon.js +20 -15
- package/dist/Icons/MeasureIcon.js +78 -25
- package/dist/Icons/MessagesIcon.js +33 -18
- package/dist/Icons/MetadataIcon.js +20 -15
- package/dist/Icons/MinusIcon.d.ts +1 -1
- package/dist/Icons/MinusIcon.js +18 -6
- package/dist/Icons/OntologyIcon.js +87 -71
- package/dist/Icons/PanelIconClose.js +28 -10
- package/dist/Icons/PanelIconOpen.js +28 -10
- package/dist/Icons/PlayIcon.js +20 -6
- package/dist/Icons/PlusIcon.js +20 -14
- package/dist/Icons/PolygonIcon.js +50 -39
- package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
- package/dist/Icons/ProgressCheckIcon.js +58 -0
- package/dist/Icons/ResetIcon.js +17 -12
- package/dist/Icons/ReviewedIcon.js +36 -19
- package/dist/Icons/ScissorsIcon.js +22 -17
- package/dist/Icons/SearchIcon.js +26 -9
- package/dist/Icons/SettingsIcon.js +26 -27
- package/dist/Icons/SortAscendingIcon.js +50 -12
- package/dist/Icons/SortAtoZIcon.js +50 -12
- package/dist/Icons/SortDescendingIcon.js +50 -12
- package/dist/Icons/SortZtoAIcon.js +50 -12
- package/dist/Icons/StackIcon.js +26 -9
- package/dist/Icons/StarIcon.js +20 -6
- package/dist/Icons/TrashIcon.js +17 -12
- package/dist/Icons/UndoIcon.js +20 -15
- package/dist/Icons/User2Icon.js +26 -10
- package/dist/Icons/UserIcon.js +19 -14
- package/dist/Icons/WarningIcon.js +19 -14
- package/dist/Icons/ZoomAllIcon.js +71 -15
- package/dist/Icons/ZoomXIcon.js +36 -10
- package/dist/Icons/ZoomYIcon.js +36 -10
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons.js +68 -136
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
- package/dist/IconsAnimated.js +3 -6
- package/dist/Input/InputUtils.js +51 -52
- package/dist/Input.js +132 -185
- package/dist/InputOTP-XUWW9xcI.js +461 -0
- package/dist/InputOTP.js +2 -382
- package/dist/Kbd.d.ts +1 -1
- package/dist/Kbd.js +182 -86
- package/dist/Label.js +12 -14
- package/dist/MultiSelect/MultiSelectBase.js +331 -403
- package/dist/MultiSelect.d.ts +1 -1
- package/dist/MultiSelect.js +23 -23
- package/dist/Popover.js +28 -32
- package/dist/RadioButton.d.ts +17 -0
- package/dist/RadioButton.js +33 -0
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
- package/dist/RadioButtonGroup.d.ts +1 -1
- package/dist/RadioButtonGroup.js +11 -8
- package/dist/RadioGroup-w_q6RGEK.js +447 -0
- package/dist/RadioGroup.js +2 -505
- package/dist/Select.js +163 -186
- package/dist/Separator.js +16 -19
- package/dist/Skeleton.js +10 -6
- package/dist/Slider-BzzZT3Zm.js +490 -0
- package/dist/Slider.js +2 -562
- package/dist/SpectralProvider.js +8 -5
- package/dist/Switch/SwitchBase.js +91 -95
- package/dist/Switch-CVzRJ-0n.js +126 -0
- package/dist/Switch.d.ts +1 -1
- package/dist/Switch.js +2 -134
- package/dist/Tabs/TabsBase.js +242 -250
- package/dist/Tabs/tabsUtils.js +65 -73
- package/dist/Tabs.d.ts +1 -1
- package/dist/Tabs.js +73 -103
- package/dist/Textarea/TextareaUtils.js +35 -46
- package/dist/Textarea.js +83 -160
- package/dist/Toast-9zqXxKKO.js +711 -0
- package/dist/Toast.js +2 -885
- package/dist/Toggle/ToggleBase.js +46 -56
- package/dist/Toggle.d.ts +1 -1
- package/dist/Toggle.js +52 -62
- package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
- package/dist/ToggleGroup.d.ts +1 -1
- package/dist/ToggleGroup.js +52 -63
- package/dist/Tooltip-D1K8kY1y.js +389 -0
- package/dist/Tooltip.js +2 -365
- package/dist/Tray.js +174 -217
- package/dist/chunk-h9knIhTc.js +20 -0
- package/dist/clsx-jM1GlMvB.js +16 -0
- package/dist/dist-3Af8168y.js +913 -0
- package/dist/dist-7HRQ5IKN.js +249 -0
- package/dist/dist-B2k1iWFp.js +129 -0
- package/dist/dist-B4FgboI8.js +122 -0
- package/dist/dist-B4g6zpUF.js +33 -0
- package/dist/dist-B9tup-4O.js +216 -0
- package/dist/dist-BK1K0g9W.js +29 -0
- package/dist/dist-Bfjk-jx9.js +28 -0
- package/dist/dist-Bft31cJh.js +65 -0
- package/dist/dist-BtdmHAzK.js +190 -0
- package/dist/dist-C0Hifjgh.js +1287 -0
- package/dist/dist-CGzgmYB9.js +68 -0
- package/dist/dist-ClmepHp4.js +10 -0
- package/dist/dist-D8Wb_MX9.js +6 -0
- package/dist/dist-Dtvmk11N.js +12 -0
- package/dist/dist-fW81qjVl.js +677 -0
- package/dist/dist-s1uWaZYZ.js +11 -0
- package/dist/es2015-YHaMV-St.js +701 -0
- package/dist/hooks/useAccordionAutoScroll.js +66 -67
- package/dist/hooks/useControllableState.js +14 -13
- package/dist/hooks/useTheme.js +21 -17
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/main.js +18954 -27224
- package/dist/primitives/button.js +39 -41
- package/dist/primitives/input-group.js +57 -73
- package/dist/primitives/input.js +11 -20
- package/dist/primitives/popover.d.ts.map +1 -1
- package/dist/primitives/popover.js +34 -25
- package/dist/primitives/select.js +70 -138
- package/dist/primitives/slot.js +32 -31
- package/dist/primitives/textarea.js +10 -16
- package/dist/proxy-Dn10Pl_g.js +4920 -0
- package/dist/styles/main.css +2 -1
- package/dist/styles/spectral.css +1 -1
- package/dist/twUtils-VNWgstKL.js +1673 -0
- package/dist/use-animation-CBUDycyW.js +57 -0
- package/dist/utils/constants.js +4 -4
- package/dist/utils/formFieldUtils.js +136 -148
- package/dist/utils/sharedUtils.js +26 -7
- package/dist/utils/twUtils.js +2 -2919
- package/package.json +24 -28
- package/dist/ComboboxBase-CxNxYtdT.js +0 -408
- package/dist/clsx-OuTLNxxd.js +0 -16
- package/dist/index-0ioNhtNM.js +0 -10
- package/dist/index-6oYKCvIn.js +0 -677
- package/dist/index-BFOf48AQ.js +0 -69
- package/dist/index-BZPx6jYI.js +0 -8
- package/dist/index-BlHU_t18.js +0 -142
- package/dist/index-Bm1RbF6w.js +0 -1037
- package/dist/index-Bv2OIg5P.js +0 -225
- package/dist/index-CKEI0pDv.js +0 -56
- package/dist/index-CM_hWgfC.js +0 -32
- package/dist/index-C_YVr64u.js +0 -1538
- package/dist/index-Cl8VeY0o.js +0 -149
- package/dist/index-CwSyIPrv.js +0 -13
- package/dist/index-D29mdTf5.js +0 -34
- package/dist/index-DEYs15GP.js +0 -66
- package/dist/index-Dc0No4pV.js +0 -233
- package/dist/index-T6XEa11q.js +0 -822
- package/dist/index-pBCLb6Gr.js +0 -240
- package/dist/index-psiVrsnE.js +0 -27
- package/dist/index-rKs9bXHr.js +0 -6
- package/dist/proxy-CO_-Vget.js +0 -4975
- package/dist/use-animation-DhEPRwZ3.js +0 -62
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Period, PeriodLabels } from './DateTimeUtils';
|
|
2
1
|
import { ComponentProps } from 'react';
|
|
2
|
+
import { Period, PeriodLabels } from './DateTimeUtils';
|
|
3
3
|
export interface TimePeriodSelectProps extends Omit<ComponentProps<'button'>, 'onChange' | 'ref'> {
|
|
4
4
|
ariaLabel?: string;
|
|
5
5
|
labels?: PeriodLabels;
|
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
import { t as e } from "../twUtils-VNWgstKL.js";
|
|
4
|
+
import { Select as t, SelectContent as n, SelectItem as r, SelectTrigger as i, SelectValue as a } from "../primitives/select.js";
|
|
5
|
+
import { forwardRef as o } from "react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/DateTimePicker/TimePeriodSelect.tsx
|
|
8
|
+
var l = {
|
|
9
|
+
am: "AM",
|
|
10
|
+
pm: "PM"
|
|
11
|
+
}, u = o(({ ariaLabel: o, className: u, disabled: d, labels: f = l, onLeftFocus: p, onPeriodChange: m, onRightFocus: h, period: g, ..._ }, v) => {
|
|
12
|
+
let y = o ?? `Select ${f.am} or ${f.pm}`, b = (e) => {
|
|
13
|
+
e.key === "ArrowRight" && (e.preventDefault(), h?.()), e.key === "ArrowLeft" && (e.preventDefault(), p?.());
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ c(t, {
|
|
16
|
+
defaultValue: g,
|
|
17
|
+
disabled: d,
|
|
18
|
+
onValueChange: (e) => m(e),
|
|
19
|
+
value: g,
|
|
20
|
+
children: [/* @__PURE__ */ s(i, {
|
|
21
|
+
"aria-label": y,
|
|
22
|
+
className: e("w-fit", u),
|
|
23
|
+
"data-slot": "time-period-select",
|
|
24
|
+
"data-testid": "spectral-time-period-select",
|
|
25
|
+
onKeyDown: b,
|
|
26
|
+
ref: v,
|
|
27
|
+
size: "sm",
|
|
28
|
+
..._,
|
|
29
|
+
children: /* @__PURE__ */ s(a, { children: g === "AM" ? f.am : f.pm })
|
|
30
|
+
}), /* @__PURE__ */ c(n, {
|
|
31
|
+
"data-testid": "spectral-time-period-select-content",
|
|
32
|
+
position: "popper",
|
|
33
|
+
sideOffset: 4,
|
|
34
|
+
children: [/* @__PURE__ */ s(r, {
|
|
35
|
+
"data-testid": "spectral-time-period-select-am",
|
|
36
|
+
value: "AM",
|
|
37
|
+
children: f.am
|
|
38
|
+
}), /* @__PURE__ */ s(r, {
|
|
39
|
+
"data-testid": "spectral-time-period-select-pm",
|
|
40
|
+
value: "PM",
|
|
41
|
+
children: f.pm
|
|
42
|
+
})]
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
19
45
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
46
|
+
u.displayName = "TimePeriodSelect";
|
|
47
|
+
//#endregion
|
|
48
|
+
export { u as TimePeriodSelect };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HourFormat, Period, TimePickerTranslations } from './DateTimeUtils';
|
|
2
1
|
import { ComponentProps } from 'react';
|
|
2
|
+
import { HourFormat, Period, TimePickerTranslations } from './DateTimeUtils';
|
|
3
3
|
export interface TimePickerProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
4
4
|
date: Date | undefined;
|
|
5
5
|
hourFormat?: HourFormat;
|
|
@@ -1,63 +1,79 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { TimePeriodSelect as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
3
|
+
import { t as e } from "../twUtils-VNWgstKL.js";
|
|
4
|
+
import { S as t, b as n, f as r, t as i, u as a, x as o } from "../DateTimeUtils-DVvG6H-p.js";
|
|
5
|
+
import { DateTimeInput as s } from "./DateTimeInput.js";
|
|
6
|
+
import { TimePeriodSelect as c } from "./TimePeriodSelect.js";
|
|
7
|
+
import { useMemo as l, useRef as u } from "react";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/DateTimePicker/TimePicker.tsx
|
|
10
|
+
var p = ({ className: p, date: m, hourFormat: h, locale: g, onChange: _, onPeriodChange: v, translations: y, ...b }) => {
|
|
11
|
+
let x = u(null), S = u(null), C = u(null), w = l(() => t(g), [g]), T = l(() => ({
|
|
12
|
+
...i,
|
|
13
|
+
...y
|
|
14
|
+
}), [y]), E = l(() => h ?? a(w), [h, w]), D = l(() => n(w), [w]), O = l(() => r(D, T.selectPeriodTemplate), [T.selectPeriodTemplate, D]), k = E === "24", A = m ? o(m.getHours()) : "AM", j = (e) => {
|
|
15
|
+
if (!m) {
|
|
16
|
+
v?.(e);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let t = new Date(m), n = t.getHours();
|
|
20
|
+
if (o(n) !== e) {
|
|
21
|
+
let r = e === "PM" ? 12 : -12;
|
|
22
|
+
t.setHours(n + r), _(t);
|
|
23
|
+
}
|
|
24
|
+
v?.(e);
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ f("div", {
|
|
27
|
+
"aria-label": k ? T.timePicker24Hour : T.timePicker12Hour,
|
|
28
|
+
className: e("gap-1 inline-flex items-center", p),
|
|
29
|
+
"data-slot": "time-picker",
|
|
30
|
+
"data-testid": "spectral-time-picker",
|
|
31
|
+
role: "group",
|
|
32
|
+
...b,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ d(s, {
|
|
35
|
+
"aria-label": k ? T.hours24 : T.hours12,
|
|
36
|
+
className: "w-12",
|
|
37
|
+
"data-testid": "spectral-time-picker-hours",
|
|
38
|
+
date: m,
|
|
39
|
+
locale: w,
|
|
40
|
+
onRightFocus: () => x.current?.focus(),
|
|
41
|
+
period: k ? void 0 : A,
|
|
42
|
+
picker: k ? "hours" : "12hours",
|
|
43
|
+
ref: S,
|
|
44
|
+
setDate: _,
|
|
45
|
+
translations: T
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ d("span", {
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
className: "select-none",
|
|
50
|
+
children: ":"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ d(s, {
|
|
53
|
+
"aria-label": T.minutes,
|
|
54
|
+
className: "w-12",
|
|
55
|
+
"data-testid": "spectral-time-picker-minutes",
|
|
56
|
+
date: m,
|
|
57
|
+
locale: w,
|
|
58
|
+
onLeftFocus: () => S.current?.focus(),
|
|
59
|
+
onRightFocus: k ? void 0 : () => C.current?.focus(),
|
|
60
|
+
period: k ? void 0 : A,
|
|
61
|
+
picker: "minutes",
|
|
62
|
+
ref: x,
|
|
63
|
+
setDate: _,
|
|
64
|
+
translations: T
|
|
65
|
+
}),
|
|
66
|
+
!k && /* @__PURE__ */ d(c, {
|
|
67
|
+
ariaLabel: O,
|
|
68
|
+
labels: D,
|
|
69
|
+
onLeftFocus: () => x.current?.focus(),
|
|
70
|
+
onPeriodChange: j,
|
|
71
|
+
period: A,
|
|
72
|
+
ref: C
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
});
|
|
63
76
|
};
|
|
77
|
+
p.displayName = "TimePicker";
|
|
78
|
+
//#endregion
|
|
79
|
+
export { p as TimePicker };
|
package/dist/DateTimePicker.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CalendarProps } from './Calendar';
|
|
2
|
-
import { HourFormat, TimePickerTranslations } from './DateTimeUtils';
|
|
3
1
|
import { ComponentProps } from 'react';
|
|
4
2
|
import { Locale } from 'react-day-picker';
|
|
3
|
+
import { CalendarProps } from './Calendar';
|
|
4
|
+
import { HourFormat, TimePickerTranslations } from './DateTimeUtils';
|
|
5
5
|
export interface DateTimePickerProps extends Omit<ComponentProps<'div'>, 'onChange' | 'defaultValue'> {
|
|
6
6
|
calendarProps?: Omit<CalendarProps, 'mode' | 'selected' | 'onSelect' | 'disablePastDates' | 'locale'>;
|
|
7
7
|
defaultValue?: Date;
|
package/dist/DateTimePicker.js
CHANGED
|
@@ -1,208 +1,90 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./
|
|
13
|
-
import "./
|
|
14
|
-
import "
|
|
15
|
-
import {
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
defaultValue: T,
|
|
88
|
-
disabled: m = !1,
|
|
89
|
-
disablePastDates: v = !0,
|
|
90
|
-
errorMessage: s,
|
|
91
|
-
hourFormat: d,
|
|
92
|
-
label: x,
|
|
93
|
-
locale: H,
|
|
94
|
-
onChange: y,
|
|
95
|
-
showTimePicker: o = !0,
|
|
96
|
-
state: c = "default",
|
|
97
|
-
timeLocale: u,
|
|
98
|
-
timeTranslations: V,
|
|
99
|
-
value: C,
|
|
100
|
-
...S
|
|
101
|
-
}) => {
|
|
102
|
-
const [r, i] = O({
|
|
103
|
-
defaultValue: T,
|
|
104
|
-
onChange: y,
|
|
105
|
-
value: C
|
|
106
|
-
}), l = g(() => w(u), [u]), p = g(() => d ?? I(l), [d, l]), N = (t) => {
|
|
107
|
-
if (!t) {
|
|
108
|
-
i(void 0);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
r && t.setHours(r.getHours(), r.getMinutes(), 0, 0), i(t);
|
|
112
|
-
}, P = R(
|
|
113
|
-
(t) => {
|
|
114
|
-
i(t);
|
|
115
|
-
},
|
|
116
|
-
[i]
|
|
117
|
-
), A = (t) => {
|
|
118
|
-
}, D = (t) => {
|
|
119
|
-
i(t);
|
|
120
|
-
};
|
|
121
|
-
return /* @__PURE__ */ n(F, { children: [
|
|
122
|
-
/* @__PURE__ */ n("div", { className: a("w-full", h), "data-slot": "datetime-picker", "data-testid": "spectral-datetime-picker", ...S, children: [
|
|
123
|
-
/* @__PURE__ */ e(
|
|
124
|
-
k,
|
|
125
|
-
{
|
|
126
|
-
className: a("flex w-full justify-start gap-4 pr-12", !r && "text-text-secondary"),
|
|
127
|
-
"data-testid": "spectral-datetime-picker-input",
|
|
128
|
-
disabled: m,
|
|
129
|
-
endIcon: /* @__PURE__ */ e(E, { asChild: !0, disabled: m, children: /* @__PURE__ */ e(
|
|
130
|
-
M,
|
|
131
|
-
{
|
|
132
|
-
"aria-label": "Open date picker",
|
|
133
|
-
className: a("text-input-icon hover:text-input-icon--hover absolute top-1/2 right-4 -translate-y-1/2 cursor-pointer focus:outline-none", m ? "pointer-events-none cursor-not-allowed opacity-50" : "hover:text-input-icon--hover cursor-pointer"),
|
|
134
|
-
"data-testid": "spectral-datetime-picker-trigger",
|
|
135
|
-
disabled: m
|
|
136
|
-
}
|
|
137
|
-
) }),
|
|
138
|
-
hourFormat: p,
|
|
139
|
-
label: x,
|
|
140
|
-
onChange: D,
|
|
141
|
-
showTime: o,
|
|
142
|
-
state: c,
|
|
143
|
-
value: r
|
|
144
|
-
}
|
|
145
|
-
),
|
|
146
|
-
c === "error" && s && /* @__PURE__ */ e(j, { message: s, dataTestId: "spectral-datetime-picker-error-message", id: "datetime-picker-error" })
|
|
147
|
-
] }),
|
|
148
|
-
/* @__PURE__ */ n(
|
|
149
|
-
B,
|
|
150
|
-
{
|
|
151
|
-
align: "start",
|
|
152
|
-
className: a("flex rounded-lg px-6 py-4", !o && "w-[330px]", o && p === "24" && "w-[486px]", o && p === "12" && "w-[560px]"),
|
|
153
|
-
"data-testid": "spectral-datetime-picker-popover",
|
|
154
|
-
onOpenAutoFocus: (t) => t.preventDefault(),
|
|
155
|
-
children: [
|
|
156
|
-
/* @__PURE__ */ e(b, { ...f, disablePastDates: v, locale: H, mode: "single", onSelect: N, selected: r }),
|
|
157
|
-
o && /* @__PURE__ */ e("div", { className: "border-border-secondary border-l pl-6", children: /* @__PURE__ */ e(L, { date: r, hourFormat: p, locale: l, onChange: P, onPeriodChange: A, translations: V }) })
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
] });
|
|
162
|
-
};
|
|
163
|
-
_.displayName = "DateTimePicker";
|
|
164
|
-
export {
|
|
165
|
-
b as Calendar,
|
|
166
|
-
gr as DEFAULT_TRANSLATIONS,
|
|
167
|
-
fr as DateTimeConfigSchema,
|
|
168
|
-
k as DateTimeDisplayInput,
|
|
169
|
-
Wr as DateTimeInput,
|
|
170
|
-
_ as DateTimePicker,
|
|
171
|
-
hr as HourFormatSchema,
|
|
172
|
-
Tr as PICKER_TYPES,
|
|
173
|
-
vr as PeriodSchema,
|
|
174
|
-
xr as TIME_BOUNDS,
|
|
175
|
-
Zr as TimePeriodSelect,
|
|
176
|
-
L as TimePicker,
|
|
177
|
-
Hr as TimePickerTypeSchema,
|
|
178
|
-
yr as TimeValueSchema,
|
|
179
|
-
Vr as convert12HourTo24Hour,
|
|
180
|
-
I as detectHourFormat,
|
|
181
|
-
Cr as display12HourValue,
|
|
182
|
-
Sr as formatSelectPeriodLabel,
|
|
183
|
-
Nr as formatTimeNumber,
|
|
184
|
-
Pr as getAriaLabel,
|
|
185
|
-
Ar as getAriaValueMinMax,
|
|
186
|
-
Dr as getAriaValueNow,
|
|
187
|
-
br as getArrowByType,
|
|
188
|
-
kr as getDateByType,
|
|
189
|
-
wr as getLocalizedPeriodLabel,
|
|
190
|
-
Ir as getLocalizedPeriodLabels,
|
|
191
|
-
Lr as getPeriodFromHours,
|
|
192
|
-
w as getResolvedLocale,
|
|
193
|
-
Mr as getValid12Hour,
|
|
194
|
-
Fr as getValidArrow12Hour,
|
|
195
|
-
Er as getValidArrowHour,
|
|
196
|
-
Br as getValidArrowMinute,
|
|
197
|
-
Or as getValidArrowNumber,
|
|
198
|
-
jr as getValidHour,
|
|
199
|
-
Rr as getValidMinute,
|
|
200
|
-
_r as getValidNumber,
|
|
201
|
-
zr as isValid12Hour,
|
|
202
|
-
Ur as isValidHour,
|
|
203
|
-
Kr as isValidMinute,
|
|
204
|
-
Yr as set12Hours,
|
|
205
|
-
qr as setDateByType,
|
|
206
|
-
Gr as setHours,
|
|
207
|
-
Jr as setMinutes
|
|
3
|
+
import { CalendarIcon as e } from "./Icons/CalendarIcon.js";
|
|
4
|
+
import { t } from "./twUtils-VNWgstKL.js";
|
|
5
|
+
import { ErrorMessage as n } from "./utils/formFieldUtils.js";
|
|
6
|
+
import { useControllableState as r } from "./hooks/useControllableState.js";
|
|
7
|
+
import { Popover as i, PopoverContent as a, PopoverTrigger as o } from "./Popover.js";
|
|
8
|
+
import { t as s } from "./Calendar-s4lyijkn.js";
|
|
9
|
+
import { A as c, C as l, D as u, E as d, F as f, I as p, L as m, M as h, N as g, O as _, P as v, S as y, T as b, _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as O, i as k, j as A, k as j, l as M, m as N, n as P, o as F, p as I, r as L, s as R, t as z, u as B, v as V, w as H, x as U, y as W } from "./DateTimeUtils-DVvG6H-p.js";
|
|
10
|
+
import { DateTimeDisplayInput as G } from "./DateTimePicker/DateTimeDisplayInput.js";
|
|
11
|
+
import { DateTimeInput as K } from "./DateTimePicker/DateTimeInput.js";
|
|
12
|
+
import { TimePeriodSelect as q } from "./DateTimePicker/TimePeriodSelect.js";
|
|
13
|
+
import { TimePicker as J } from "./DateTimePicker/TimePicker.js";
|
|
14
|
+
import { useCallback as Y, useMemo as X } from "react";
|
|
15
|
+
import { jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
16
|
+
//#region src/components/DateTimePicker/DateTimePicker.tsx
|
|
17
|
+
var $ = ({ calendarProps: c, className: l, defaultValue: u, disabled: d = !1, disablePastDates: f = !0, errorMessage: p, hourFormat: m, label: h, locale: g, onChange: _, showTimePicker: v = !0, state: b = "default", timeLocale: x, timeTranslations: S, value: C, ...w }) => {
|
|
18
|
+
let [T, E] = r({
|
|
19
|
+
defaultValue: u,
|
|
20
|
+
onChange: _,
|
|
21
|
+
value: C
|
|
22
|
+
}), D = X(() => y(x), [x]), O = X(() => m ?? B(D), [m, D]), k = (e) => {
|
|
23
|
+
if (!e) {
|
|
24
|
+
E(void 0);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
T && e.setHours(T.getHours(), T.getMinutes(), 0, 0), E(e);
|
|
28
|
+
}, A = Y((e) => {
|
|
29
|
+
E(e);
|
|
30
|
+
}, [E]), j = (e) => {}, M = (e) => {
|
|
31
|
+
E(e);
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ Q(i, { children: [/* @__PURE__ */ Q("div", {
|
|
34
|
+
className: t("w-full", l),
|
|
35
|
+
"data-slot": "datetime-picker",
|
|
36
|
+
"data-testid": "spectral-datetime-picker",
|
|
37
|
+
...w,
|
|
38
|
+
children: [/* @__PURE__ */ Z(G, {
|
|
39
|
+
className: t("gap-4 pr-12 flex w-full justify-start", !T && "text-text-secondary"),
|
|
40
|
+
"data-testid": "spectral-datetime-picker-input",
|
|
41
|
+
disabled: d,
|
|
42
|
+
endIcon: /* @__PURE__ */ Z(o, {
|
|
43
|
+
asChild: !0,
|
|
44
|
+
disabled: d,
|
|
45
|
+
children: /* @__PURE__ */ Z(e, {
|
|
46
|
+
"aria-label": "Open date picker",
|
|
47
|
+
className: t("right-4 text-input-icon hover:text-input-icon--hover absolute top-1/2 -translate-y-1/2 cursor-pointer focus:outline-none", d ? "pointer-events-none cursor-not-allowed opacity-50" : "hover:text-input-icon--hover cursor-pointer"),
|
|
48
|
+
"data-testid": "spectral-datetime-picker-trigger",
|
|
49
|
+
disabled: d
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
hourFormat: O,
|
|
53
|
+
label: h,
|
|
54
|
+
onChange: M,
|
|
55
|
+
showTime: v,
|
|
56
|
+
state: b,
|
|
57
|
+
value: T
|
|
58
|
+
}), b === "error" && p && /* @__PURE__ */ Z(n, {
|
|
59
|
+
message: p,
|
|
60
|
+
dataTestId: "spectral-datetime-picker-error-message",
|
|
61
|
+
id: "datetime-picker-error"
|
|
62
|
+
})]
|
|
63
|
+
}), /* @__PURE__ */ Q(a, {
|
|
64
|
+
align: "start",
|
|
65
|
+
className: t("rounded-lg py-4 px-6 flex", !v && "w-[330px]", v && O === "24" && "w-[486px]", v && O === "12" && "w-[560px]"),
|
|
66
|
+
"data-testid": "spectral-datetime-picker-popover",
|
|
67
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
68
|
+
children: [/* @__PURE__ */ Z(s, {
|
|
69
|
+
...c,
|
|
70
|
+
disablePastDates: f,
|
|
71
|
+
locale: g,
|
|
72
|
+
mode: "single",
|
|
73
|
+
onSelect: k,
|
|
74
|
+
selected: T
|
|
75
|
+
}), v && /* @__PURE__ */ Z("div", {
|
|
76
|
+
className: "pl-6 border-l border-border-secondary",
|
|
77
|
+
children: /* @__PURE__ */ Z(J, {
|
|
78
|
+
date: T,
|
|
79
|
+
hourFormat: O,
|
|
80
|
+
locale: D,
|
|
81
|
+
onChange: A,
|
|
82
|
+
onPeriodChange: j,
|
|
83
|
+
translations: S
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
})] });
|
|
208
87
|
};
|
|
88
|
+
$.displayName = "DateTimePicker";
|
|
89
|
+
//#endregion
|
|
90
|
+
export { s as Calendar, z as DEFAULT_TRANSLATIONS, P as DateTimeConfigSchema, G as DateTimeDisplayInput, K as DateTimeInput, $ as DateTimePicker, L as HourFormatSchema, k as PICKER_TYPES, S as PeriodSchema, F as TIME_BOUNDS, q as TimePeriodSelect, J as TimePicker, R as TimePickerTypeSchema, w as TimeValueSchema, M as convert12HourTo24Hour, B as detectHourFormat, T as display12HourValue, E as formatSelectPeriodLabel, I as formatTimeNumber, N as getAriaLabel, O as getAriaValueMinMax, D as getAriaValueNow, x as getArrowByType, V as getDateByType, W as getLocalizedPeriodLabel, C as getLocalizedPeriodLabels, U as getPeriodFromHours, y as getResolvedLocale, l as getValid12Hour, H as getValidArrow12Hour, b as getValidArrowHour, d as getValidArrowMinute, u as getValidArrowNumber, _ as getValidHour, j as getValidMinute, c as getValidNumber, A as isValid12Hour, h as isValidHour, g as isValidMinute, v as set12Hours, f as setDateByType, p as setHours, m as setMinutes };
|