@ethisyscore/plugin-ui 1.70.0 → 1.71.1

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 (34) hide show
  1. package/README.md +3 -1
  2. package/dist/components/data-grid/index.cjs +26 -1
  3. package/dist/components/data-grid/index.cjs.map +1 -1
  4. package/dist/components/data-grid/index.d.cts +36 -22
  5. package/dist/components/data-grid/index.d.ts +36 -22
  6. package/dist/components/data-grid/index.js +27 -2
  7. package/dist/components/data-grid/index.js.map +1 -1
  8. package/dist/components/date/index.cjs +466 -0
  9. package/dist/components/date/index.cjs.map +1 -0
  10. package/dist/components/date/index.d.cts +41 -0
  11. package/dist/components/date/index.d.ts +41 -0
  12. package/dist/components/date/index.js +437 -0
  13. package/dist/components/date/index.js.map +1 -0
  14. package/dist/components/layout/index.cjs +34 -466
  15. package/dist/components/layout/index.cjs.map +1 -1
  16. package/dist/components/layout/index.js +0 -410
  17. package/dist/components/layout/index.js.map +1 -1
  18. package/dist/components/shared/index.cjs +20 -452
  19. package/dist/components/shared/index.cjs.map +1 -1
  20. package/dist/components/shared/index.js +0 -410
  21. package/dist/components/shared/index.js.map +1 -1
  22. package/dist/components/ui/index.cjs +10 -447
  23. package/dist/components/ui/index.cjs.map +1 -1
  24. package/dist/components/ui/index.d.cts +1 -39
  25. package/dist/components/ui/index.d.ts +1 -39
  26. package/dist/components/ui/index.js +1 -411
  27. package/dist/components/ui/index.js.map +1 -1
  28. package/dist/platform-react/index.cjs +23 -0
  29. package/dist/platform-react/index.cjs.map +1 -1
  30. package/dist/platform-react/index.d.cts +98 -1
  31. package/dist/platform-react/index.d.ts +98 -1
  32. package/dist/platform-react/index.js +21 -1
  33. package/dist/platform-react/index.js.map +1 -1
  34. package/package.json +9 -3
@@ -0,0 +1,41 @@
1
+ import { TextFieldProps } from '@mui/material/TextField';
2
+ import * as react from 'react';
3
+ import { Dayjs } from 'dayjs';
4
+
5
+ /** The two input shapes `DateInput` renders: a date, or a date with a time. */
6
+ type DateInputType = "date" | "datetime-local";
7
+ /**
8
+ * The default bounds a `DateInput` clamps to when the caller gives no min/max.
9
+ *
10
+ * `endOf("day")` on the upper bound is deliberate and easy to lose: without it a
11
+ * `datetime-local` input rejects any time on the final day, because the bound is midnight.
12
+ */
13
+ declare const DATE_INPUT_MIN = "1900-01-01";
14
+ declare const DATE_INPUT_MAX = "2100-12-31";
15
+ /**
16
+ * Formats a picker value as the ISO string the surrounding form expects.
17
+ *
18
+ * Pulled out of the component so the formatting rules can be tested as a function rather than
19
+ * through a rendered MUI X picker. An invalid or absent value becomes an empty string, never
20
+ * "Invalid Date" - a form that round-trips the value would otherwise persist that text.
21
+ */
22
+ declare function toIsoString(value: Dayjs | null, type: DateInputType): string;
23
+ /**
24
+ * Parses a caller-supplied string into a picker value.
25
+ *
26
+ * Returns null for empty and for unparseable input, so the picker renders blank instead of
27
+ * throwing or displaying "Invalid Date" while a user is mid-edit.
28
+ */
29
+ declare function parseIsoValue(value: string | undefined): Dayjs | null;
30
+
31
+ interface DateInputProps extends Omit<TextFieldProps, "type" | "onChange" | "value"> {
32
+ type?: DateInputType;
33
+ min?: string;
34
+ max?: string;
35
+ rejectInvalidValue?: boolean;
36
+ value?: string;
37
+ onChange?: (event: react.ChangeEvent<HTMLInputElement>) => void;
38
+ }
39
+ declare const DateInput: react.ForwardRefExoticComponent<Omit<DateInputProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
40
+
41
+ export { DATE_INPUT_MAX, DATE_INPUT_MIN, DateInput, type DateInputProps, type DateInputType, parseIsoValue, toIsoString };
@@ -0,0 +1,41 @@
1
+ import { TextFieldProps } from '@mui/material/TextField';
2
+ import * as react from 'react';
3
+ import { Dayjs } from 'dayjs';
4
+
5
+ /** The two input shapes `DateInput` renders: a date, or a date with a time. */
6
+ type DateInputType = "date" | "datetime-local";
7
+ /**
8
+ * The default bounds a `DateInput` clamps to when the caller gives no min/max.
9
+ *
10
+ * `endOf("day")` on the upper bound is deliberate and easy to lose: without it a
11
+ * `datetime-local` input rejects any time on the final day, because the bound is midnight.
12
+ */
13
+ declare const DATE_INPUT_MIN = "1900-01-01";
14
+ declare const DATE_INPUT_MAX = "2100-12-31";
15
+ /**
16
+ * Formats a picker value as the ISO string the surrounding form expects.
17
+ *
18
+ * Pulled out of the component so the formatting rules can be tested as a function rather than
19
+ * through a rendered MUI X picker. An invalid or absent value becomes an empty string, never
20
+ * "Invalid Date" - a form that round-trips the value would otherwise persist that text.
21
+ */
22
+ declare function toIsoString(value: Dayjs | null, type: DateInputType): string;
23
+ /**
24
+ * Parses a caller-supplied string into a picker value.
25
+ *
26
+ * Returns null for empty and for unparseable input, so the picker renders blank instead of
27
+ * throwing or displaying "Invalid Date" while a user is mid-edit.
28
+ */
29
+ declare function parseIsoValue(value: string | undefined): Dayjs | null;
30
+
31
+ interface DateInputProps extends Omit<TextFieldProps, "type" | "onChange" | "value"> {
32
+ type?: DateInputType;
33
+ min?: string;
34
+ max?: string;
35
+ rejectInvalidValue?: boolean;
36
+ value?: string;
37
+ onChange?: (event: react.ChangeEvent<HTMLInputElement>) => void;
38
+ }
39
+ declare const DateInput: react.ForwardRefExoticComponent<Omit<DateInputProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
40
+
41
+ export { DATE_INPUT_MAX, DATE_INPUT_MIN, DateInput, type DateInputProps, type DateInputType, parseIsoValue, toIsoString };
@@ -0,0 +1,437 @@
1
+ import dayjs2 from 'dayjs';
2
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
3
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
4
+ import { DatePicker } from '@mui/x-date-pickers/DatePicker';
5
+ import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
6
+ import * as React from 'react';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
+
9
+ // src/components/date/DateInput.tsx
10
+ function NiCalendar({
11
+ className,
12
+ variant = "outlined",
13
+ size = "medium",
14
+ oneTone = false
15
+ }) {
16
+ const iconSize = sizeHelper(size);
17
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
18
+ if (variant === "outlined") {
19
+ return /* @__PURE__ */ jsxs(
20
+ "svg",
21
+ {
22
+ width: iconSize,
23
+ height: iconSize,
24
+ className,
25
+ viewBox: "0 0 24 24",
26
+ fill: "none",
27
+ xmlns: "http://www.w3.org/2000/svg",
28
+ children: [
29
+ /* @__PURE__ */ jsx(
30
+ "path",
31
+ {
32
+ d: "M15.4356 3.38173C18.6934 3.74372 21.2712 6.30485 21.6542 9.56029V9.56029C21.8839 11.5134 21.8839 13.4866 21.6542 15.4397V15.4397C21.2712 18.6951 18.6934 21.2563 15.4356 21.6183L14.9973 21.667C13.0052 21.8883 10.9948 21.8883 9.0027 21.667L8.56439 21.6183C5.30655 21.2563 2.72884 18.6951 2.34585 15.4397V15.4397C2.11607 13.4866 2.11607 11.5134 2.34585 9.56029V9.56029C2.72884 6.30485 5.30656 3.74371 8.5644 3.38173L9.0027 3.33303C10.9948 3.11169 13.0052 3.11169 14.9973 3.33303L15.4356 3.38173Z",
33
+ stroke: "currentColor",
34
+ strokeWidth: iconStrokeWidth
35
+ }
36
+ ),
37
+ /* @__PURE__ */ jsx(
38
+ "path",
39
+ {
40
+ opacity: oneTone ? 1 : 0.6,
41
+ d: "M8.5 11L7.5 11",
42
+ stroke: "currentColor",
43
+ strokeWidth: iconStrokeWidth,
44
+ strokeLinecap: "round"
45
+ }
46
+ ),
47
+ /* @__PURE__ */ jsx(
48
+ "path",
49
+ {
50
+ opacity: oneTone ? 1 : 0.6,
51
+ d: "M8.5 15L7.5 15",
52
+ stroke: "currentColor",
53
+ strokeWidth: iconStrokeWidth,
54
+ strokeLinecap: "round"
55
+ }
56
+ ),
57
+ /* @__PURE__ */ jsx(
58
+ "path",
59
+ {
60
+ opacity: oneTone ? 1 : 0.6,
61
+ d: "M12.5 11L11.5 11",
62
+ stroke: "currentColor",
63
+ strokeWidth: iconStrokeWidth,
64
+ strokeLinecap: "round"
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(
68
+ "path",
69
+ {
70
+ opacity: oneTone ? 1 : 0.6,
71
+ d: "M12.5 15L11.5 15",
72
+ stroke: "currentColor",
73
+ strokeWidth: iconStrokeWidth,
74
+ strokeLinecap: "round"
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx(
78
+ "path",
79
+ {
80
+ opacity: oneTone ? 1 : 0.6,
81
+ d: "M16.5 11L15.5 11",
82
+ stroke: "currentColor",
83
+ strokeWidth: iconStrokeWidth,
84
+ strokeLinecap: "round"
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsx(
88
+ "path",
89
+ {
90
+ opacity: oneTone ? 1 : 0.6,
91
+ d: "M16.5 15L15.5 15",
92
+ stroke: "currentColor",
93
+ strokeWidth: iconStrokeWidth,
94
+ strokeLinecap: "round"
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsx("path", { d: "M8 2L8 5", stroke: "currentColor", strokeWidth: iconStrokeWidth, strokeLinecap: "round" }),
98
+ /* @__PURE__ */ jsx("path", { d: "M16 2L16 5", stroke: "currentColor", strokeWidth: iconStrokeWidth, strokeLinecap: "round" })
99
+ ]
100
+ }
101
+ );
102
+ } else {
103
+ return /* @__PURE__ */ jsxs(
104
+ "svg",
105
+ {
106
+ width: iconSize,
107
+ height: iconSize,
108
+ className,
109
+ viewBox: "0 0 24 24",
110
+ fill: "none",
111
+ xmlns: "http://www.w3.org/2000/svg",
112
+ children: [
113
+ /* @__PURE__ */ jsx(
114
+ "path",
115
+ {
116
+ fillRule: "evenodd",
117
+ clipRule: "evenodd",
118
+ d: "M16.0002 1.25C16.4142 1.25024 16.7502 1.58594 16.7502 2V2.87598C19.7568 3.71245 22.0243 6.29258 22.3986 9.47266C22.6352 11.4837 22.6352 13.5163 22.3986 15.5273C21.9747 19.1291 19.1222 21.9627 15.5178 22.3633L15.0793 22.4121C13.0325 22.6395 10.9659 22.6395 8.91912 22.4121L8.48065 22.3633C4.87659 21.9623 2.02462 19.1288 1.60076 15.5273C1.3642 13.5163 1.3642 11.4837 1.60076 9.47266C1.97507 6.29232 4.24318 3.71226 7.25018 2.87598V2C7.25018 1.58579 7.58596 1.25 8.00018 1.25C8.41419 1.25024 8.75018 1.58594 8.75018 2V2.60645L8.91912 2.58789C10.9659 2.36048 13.0325 2.36054 15.0793 2.58789L15.2502 2.60645V2C15.2502 1.58579 15.586 1.25 16.0002 1.25ZM7.50018 14.25L7.42303 14.2539C7.04506 14.2925 6.75018 14.6118 6.75018 15C6.75018 15.3882 7.04506 15.7075 7.42303 15.7461L7.50018 15.75H8.50018C8.91425 15.7498 9.25018 15.4141 9.25018 15C9.25018 14.5859 8.91425 14.2502 8.50018 14.25H7.50018ZM11.5002 14.25L11.423 14.2539C11.0451 14.2925 10.7502 14.6118 10.7502 15C10.7502 15.3882 11.0451 15.7075 11.423 15.7461L11.5002 15.75H12.5002C12.9142 15.7498 13.2502 15.4141 13.2502 15C13.2502 14.5859 12.9142 14.2502 12.5002 14.25H11.5002ZM15.5002 14.25L15.423 14.2539C15.0451 14.2925 14.7502 14.6118 14.7502 15C14.7502 15.3882 15.0451 15.7075 15.423 15.7461L15.5002 15.75H16.5002C16.9142 15.7498 17.2502 15.4141 17.2502 15C17.2502 14.5859 16.9142 14.2502 16.5002 14.25H15.5002ZM7.50018 10.25L7.42303 10.2539C7.04506 10.2925 6.75018 10.6118 6.75018 11C6.75018 11.3882 7.04506 11.7075 7.42303 11.7461L7.50018 11.75H8.50018C8.91425 11.7498 9.25018 11.4141 9.25018 11C9.25018 10.5859 8.91425 10.2502 8.50018 10.25H7.50018ZM11.5002 10.25L11.423 10.2539C11.0451 10.2925 10.7502 10.6118 10.7502 11C10.7502 11.3882 11.0451 11.7075 11.423 11.7461L11.5002 11.75H12.5002C12.9142 11.7498 13.2502 11.4141 13.2502 11C13.2502 10.5859 12.9142 10.2502 12.5002 10.25H11.5002ZM15.5002 10.25L15.423 10.2539C15.0451 10.2925 14.7502 10.6118 14.7502 11C14.7502 11.3882 15.0451 11.7075 15.423 11.7461L15.5002 11.75H16.5002C16.9142 11.7498 17.2502 11.4141 17.2502 11C17.2502 10.5859 16.9142 10.2502 16.5002 10.25H15.5002Z",
119
+ fill: "currentColor"
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsx(
123
+ "path",
124
+ {
125
+ opacity: oneTone ? 0 : 0.4,
126
+ d: "M8.5 14.25C8.91421 14.25 9.25 14.5858 9.25 15C9.25 15.4142 8.91421 15.75 8.5 15.75H7.5L7.42285 15.7461C7.04488 15.7075 6.75 15.3882 6.75 15C6.75 14.6118 7.04488 14.2925 7.42285 14.2539L7.5 14.25H8.5Z",
127
+ fill: "currentColor"
128
+ }
129
+ ),
130
+ /* @__PURE__ */ jsx(
131
+ "path",
132
+ {
133
+ opacity: oneTone ? 0 : 0.4,
134
+ d: "M12.5 14.25C12.9142 14.25 13.25 14.5858 13.25 15C13.25 15.4142 12.9142 15.75 12.5 15.75H11.5L11.4229 15.7461C11.0449 15.7075 10.75 15.3882 10.75 15C10.75 14.6118 11.0449 14.2925 11.4229 14.2539L11.5 14.25H12.5Z",
135
+ fill: "currentColor"
136
+ }
137
+ ),
138
+ /* @__PURE__ */ jsx(
139
+ "path",
140
+ {
141
+ opacity: oneTone ? 0 : 0.4,
142
+ d: "M16.5 14.25C16.9142 14.25 17.25 14.5858 17.25 15C17.25 15.4142 16.9142 15.75 16.5 15.75H15.5L15.4229 15.7461C15.0449 15.7075 14.75 15.3882 14.75 15C14.75 14.6118 15.0449 14.2925 15.4229 14.2539L15.5 14.25H16.5Z",
143
+ fill: "currentColor"
144
+ }
145
+ ),
146
+ /* @__PURE__ */ jsx(
147
+ "path",
148
+ {
149
+ opacity: oneTone ? 0 : 0.4,
150
+ d: "M8.5 10.25C8.91421 10.25 9.25 10.5858 9.25 11C9.25 11.4142 8.91421 11.75 8.5 11.75H7.5L7.42285 11.7461C7.04488 11.7075 6.75 11.3882 6.75 11C6.75 10.6118 7.04488 10.2925 7.42285 10.2539L7.5 10.25H8.5Z",
151
+ fill: "currentColor"
152
+ }
153
+ ),
154
+ /* @__PURE__ */ jsx(
155
+ "path",
156
+ {
157
+ opacity: oneTone ? 0 : 0.4,
158
+ d: "M12.5 10.25C12.9142 10.25 13.25 10.5858 13.25 11C13.25 11.4142 12.9142 11.75 12.5 11.75H11.5L11.4229 11.7461C11.0449 11.7075 10.75 11.3882 10.75 11C10.75 10.6118 11.0449 10.2925 11.4229 10.2539L11.5 10.25H12.5Z",
159
+ fill: "currentColor"
160
+ }
161
+ ),
162
+ /* @__PURE__ */ jsx(
163
+ "path",
164
+ {
165
+ opacity: oneTone ? 0 : 0.4,
166
+ d: "M16.5 10.25C16.9142 10.25 17.25 10.5858 17.25 11C17.25 11.4142 16.9142 11.75 16.5 11.75H15.5L15.4229 11.7461C15.0449 11.7075 14.75 11.3882 14.75 11C14.75 10.6118 15.0449 10.2925 15.4229 10.2539L15.5 10.25H16.5Z",
167
+ fill: "currentColor"
168
+ }
169
+ )
170
+ ]
171
+ }
172
+ );
173
+ }
174
+ }
175
+ function NiChevronDownSmall({ className, variant = "outlined", size = "medium" }) {
176
+ const iconSize = sizeHelper(size);
177
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
178
+ if (variant === "outlined") {
179
+ return /* @__PURE__ */ jsx(
180
+ "svg",
181
+ {
182
+ width: iconSize,
183
+ height: iconSize,
184
+ className,
185
+ viewBox: "0 0 24 24",
186
+ fill: "none",
187
+ xmlns: "http://www.w3.org/2000/svg",
188
+ children: /* @__PURE__ */ jsx(
189
+ "path",
190
+ {
191
+ d: "M8 10L11.1515 13.1515C11.6201 13.6201 12.3799 13.6201 12.8485 13.1515L16 10",
192
+ stroke: "currentColor",
193
+ strokeWidth: iconStrokeWidth,
194
+ strokeLinecap: "round"
195
+ }
196
+ )
197
+ }
198
+ );
199
+ } else {
200
+ return /* @__PURE__ */ jsx(
201
+ "svg",
202
+ {
203
+ width: iconSize,
204
+ height: iconSize,
205
+ className,
206
+ viewBox: "0 0 24 24",
207
+ fill: "none",
208
+ xmlns: "http://www.w3.org/2000/svg",
209
+ children: /* @__PURE__ */ jsx(
210
+ "path",
211
+ {
212
+ d: "M7.46967 9.46967C7.17678 9.76256 7.17678 10.2373 7.46967 10.5302L10.621 13.6816C11.3826 14.4431 12.6173 14.4431 13.3788 13.6816L16.5302 10.5302C16.8231 10.2373 16.8231 9.76256 16.5302 9.46967C16.2373 9.17678 15.7626 9.17678 15.4697 9.46967L12.3183 12.621C12.1426 12.7968 11.8573 12.7968 11.6816 12.621L8.53022 9.46967C8.23732 9.17678 7.76256 9.17678 7.46967 9.46967Z",
213
+ fill: "currentColor"
214
+ }
215
+ )
216
+ }
217
+ );
218
+ }
219
+ }
220
+ function NiChevronLeftSmall({ className, variant = "outlined", size = "medium" }) {
221
+ const iconSize = sizeHelper(size);
222
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
223
+ if (variant === "outlined") {
224
+ return /* @__PURE__ */ jsx(
225
+ "svg",
226
+ {
227
+ width: iconSize,
228
+ height: iconSize,
229
+ className,
230
+ viewBox: "0 0 24 24",
231
+ fill: "none",
232
+ xmlns: "http://www.w3.org/2000/svg",
233
+ children: /* @__PURE__ */ jsx(
234
+ "path",
235
+ {
236
+ d: "M14 8L10.8485 11.1515C10.3799 11.6201 10.3799 12.3799 10.8485 12.8485L14 16",
237
+ stroke: "currentColor",
238
+ strokeWidth: iconStrokeWidth,
239
+ strokeLinecap: "round"
240
+ }
241
+ )
242
+ }
243
+ );
244
+ } else {
245
+ return /* @__PURE__ */ jsx(
246
+ "svg",
247
+ {
248
+ width: iconSize,
249
+ height: iconSize,
250
+ className,
251
+ viewBox: "0 0 24 24",
252
+ fill: "none",
253
+ xmlns: "http://www.w3.org/2000/svg",
254
+ children: /* @__PURE__ */ jsx(
255
+ "path",
256
+ {
257
+ d: "M14.5303 7.46967C14.2374 7.17678 13.7627 7.17678 13.4698 7.46967L10.3184 10.621C9.55689 11.3826 9.55689 12.6173 10.3184 13.3788L13.4698 16.5302C13.7627 16.8231 14.2374 16.8231 14.5303 16.5302C14.8232 16.2373 14.8232 15.7626 14.5303 15.4697L11.379 12.3183C11.2032 12.1426 11.2032 11.8573 11.379 11.6816L14.5303 8.53022C14.8232 8.23732 14.8232 7.76256 14.5303 7.46967Z",
258
+ fill: "currentColor"
259
+ }
260
+ )
261
+ }
262
+ );
263
+ }
264
+ }
265
+ function NiChevronRightSmall({ className, variant = "outlined", size = "medium" }) {
266
+ const iconSize = sizeHelper(size);
267
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
268
+ if (variant === "outlined") {
269
+ return /* @__PURE__ */ jsx(
270
+ "svg",
271
+ {
272
+ width: iconSize,
273
+ height: iconSize,
274
+ className,
275
+ viewBox: "0 0 24 24",
276
+ fill: "none",
277
+ xmlns: "http://www.w3.org/2000/svg",
278
+ children: /* @__PURE__ */ jsx(
279
+ "path",
280
+ {
281
+ d: "M10 16L13.1515 12.8485C13.6201 12.3799 13.6201 11.6201 13.1515 11.1515L10 8",
282
+ stroke: "currentColor",
283
+ strokeWidth: iconStrokeWidth,
284
+ strokeLinecap: "round"
285
+ }
286
+ )
287
+ }
288
+ );
289
+ } else {
290
+ return /* @__PURE__ */ jsx(
291
+ "svg",
292
+ {
293
+ width: iconSize,
294
+ height: iconSize,
295
+ className,
296
+ viewBox: "0 0 24 24",
297
+ fill: "none",
298
+ xmlns: "http://www.w3.org/2000/svg",
299
+ children: /* @__PURE__ */ jsx(
300
+ "path",
301
+ {
302
+ d: "M9.46967 16.5303C9.76256 16.8232 10.2373 16.8232 10.5302 16.5303L13.6816 13.379C14.4431 12.6174 14.4431 11.3827 13.6816 10.6212L10.5302 7.46978C10.2373 7.17689 9.76256 7.17689 9.46967 7.46978C9.17678 7.76268 9.17678 8.23744 9.46967 8.53033L12.621 11.6817C12.7968 11.8574 12.7968 12.1427 12.621 12.3184L9.46967 15.4698C9.17678 15.7627 9.17678 16.2374 9.46967 16.5303Z",
303
+ fill: "currentColor"
304
+ }
305
+ )
306
+ }
307
+ );
308
+ }
309
+ }
310
+ var sizeHelper = (size) => {
311
+ if (typeof size === "number") {
312
+ return size;
313
+ } else if (size === "large") {
314
+ return 24;
315
+ } else if (size === "small" || size === "tiny") {
316
+ return 16;
317
+ } else {
318
+ return 20;
319
+ }
320
+ };
321
+ var strokeSizeHelper = (size) => {
322
+ if (size === 32) {
323
+ return 1.15;
324
+ } else if (size >= 20) {
325
+ return 1.5;
326
+ } else {
327
+ return 1.75;
328
+ }
329
+ };
330
+ var DATE_INPUT_MIN = "1900-01-01";
331
+ var DATE_INPUT_MAX = "2100-12-31";
332
+ function toIsoString(value, type) {
333
+ if (!value?.isValid()) {
334
+ return "";
335
+ }
336
+ return type === "datetime-local" ? value.format("YYYY-MM-DDTHH:mm") : value.format("YYYY-MM-DD");
337
+ }
338
+ function parseIsoValue(value) {
339
+ if (!value) {
340
+ return null;
341
+ }
342
+ const parsed = dayjs2(value);
343
+ return parsed.isValid() ? parsed : null;
344
+ }
345
+ var popperModifiers = [
346
+ { name: "preventOverflow", options: { altBoundary: true } },
347
+ { name: "flip", options: { altBoundary: true } }
348
+ ];
349
+ var withSecondaryText = (className) => [typeof className === "string" ? className : void 0, "text-text-secondary"].filter(Boolean).join(" ");
350
+ var pickerSlots = {
351
+ openPickerIcon: (props) => /* @__PURE__ */ jsx(NiCalendar, { ...props, className: withSecondaryText(props.className) }),
352
+ switchViewIcon: (props) => /* @__PURE__ */ jsx(NiChevronDownSmall, { ...props, className: withSecondaryText(props.className) }),
353
+ leftArrowIcon: (props) => /* @__PURE__ */ jsx(NiChevronLeftSmall, { ...props, className: withSecondaryText(props.className) }),
354
+ rightArrowIcon: (props) => /* @__PURE__ */ jsx(NiChevronRightSmall, { ...props, className: withSecondaryText(props.className) })
355
+ };
356
+ var DateInput = React.forwardRef(
357
+ ({
358
+ type = "date",
359
+ min,
360
+ max,
361
+ rejectInvalidValue: _rejectInvalidValue,
362
+ value,
363
+ onChange,
364
+ onBlur,
365
+ label,
366
+ helperText,
367
+ error,
368
+ disabled,
369
+ slotProps: callerSlotProps,
370
+ ...rest
371
+ }, ref) => {
372
+ const handleChange = React.useCallback(
373
+ (newValue) => {
374
+ if (!onChange) return;
375
+ const strValue = toIsoString(newValue, type);
376
+ const input = document.createElement("input");
377
+ input.value = strValue;
378
+ onChange({
379
+ target: input,
380
+ currentTarget: input,
381
+ type: "change"
382
+ });
383
+ },
384
+ [onChange, type]
385
+ );
386
+ const parsedValue = parseIsoValue(value);
387
+ const minDate = min ? dayjs2(min) : dayjs2(DATE_INPUT_MIN);
388
+ const maxDate = max ? dayjs2(max) : dayjs2(DATE_INPUT_MAX).endOf("day");
389
+ const textFieldProps = {
390
+ ...rest,
391
+ disabled,
392
+ error: Boolean(error),
393
+ helperText,
394
+ onBlur,
395
+ inputRef: ref,
396
+ slotProps: callerSlotProps
397
+ };
398
+ return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: type === "datetime-local" ? /* @__PURE__ */ jsx(
399
+ DateTimePicker,
400
+ {
401
+ label,
402
+ value: parsedValue,
403
+ onChange: handleChange,
404
+ minDateTime: minDate,
405
+ maxDateTime: maxDate,
406
+ disabled,
407
+ slots: pickerSlots,
408
+ slotProps: {
409
+ textField: textFieldProps,
410
+ desktopPaper: { className: "outlined" },
411
+ popper: { sx: { zIndex: 1600 }, popperOptions: { modifiers: popperModifiers } }
412
+ }
413
+ }
414
+ ) : /* @__PURE__ */ jsx(
415
+ DatePicker,
416
+ {
417
+ label,
418
+ value: parsedValue,
419
+ onChange: handleChange,
420
+ minDate,
421
+ maxDate,
422
+ disabled,
423
+ slots: pickerSlots,
424
+ slotProps: {
425
+ textField: textFieldProps,
426
+ desktopPaper: { className: "outlined" },
427
+ popper: { sx: { zIndex: 1600 }, popperOptions: { modifiers: popperModifiers } }
428
+ }
429
+ }
430
+ ) });
431
+ }
432
+ );
433
+ DateInput.displayName = "DateInput";
434
+
435
+ export { DATE_INPUT_MAX, DATE_INPUT_MIN, DateInput, parseIsoValue, toIsoString };
436
+ //# sourceMappingURL=index.js.map
437
+ //# sourceMappingURL=index.js.map