@datum-cloud/datum-ui 0.8.0 → 0.9.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/dist/{adapter-context-NyGTDZYq.mjs → adapter-context-DemTWhel.mjs} +3 -3
- package/dist/alert/index.mjs +1 -1
- package/dist/{alert-BDj6od5I.mjs → alert-Cz56SqdN.mjs} +2 -2
- package/dist/app-navigation/index.mjs +2 -2
- package/dist/{app-navigation-rSOfo1KV.mjs → app-navigation-CnGkJvwF.mjs} +1 -1
- package/dist/autocomplete/index.mjs +1 -1
- package/dist/{autocomplete-DdbTQe6u.mjs → autocomplete-ChuPNldi.mjs} +6 -6
- package/dist/autosearch/index.mjs +12 -12
- package/dist/avatar-stack/index.mjs +1 -1
- package/dist/{avatar-stack-CDhlA1Nm.mjs → avatar-stack-WqoQ3l06.mjs} +1 -1
- package/dist/{button-D3RrsMfQ.mjs → button-Rw1xI-k9.mjs} +2 -2
- package/dist/calendar/index.mjs +1 -1
- package/dist/calendar-D_DriVHT.mjs +77 -0
- package/dist/{calendar-C-Hbf74r.mjs → calendar-Dwvq3Vu_.mjs} +6 -6
- package/dist/calendar-date-picker-CchHKodM.mjs +52 -0
- package/dist/chart/index.mjs +1 -1
- package/dist/{chart-CUa21ynK.mjs → chart-DgcOwkOh.mjs} +5 -5
- package/dist/code-editor/index.mjs +1 -1
- package/dist/{col-DISdGlqY.mjs → col-Q6yazFwL.mjs} +2 -1
- package/dist/components/base/button/button.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts +6 -5
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/types.d.ts +19 -0
- package/dist/components/features/calendar-date-picker/types.d.ts.map +1 -1
- package/dist/components/features/code-editor/code-editor.d.ts +1 -1
- package/dist/components/features/code-editor/code-editor.d.ts.map +1 -1
- package/dist/components/features/code-editor/index.d.ts +1 -1
- package/dist/components/features/code-editor/index.d.ts.map +1 -1
- package/dist/components/features/code-editor/types.d.ts +25 -2
- package/dist/components/features/code-editor/types.d.ts.map +1 -1
- package/dist/components/features/data-table/core/client-provider.d.ts.map +1 -1
- package/dist/components/features/date-time-picker/date-time-picker.d.ts +12 -4
- package/dist/components/features/date-time-picker/date-time-picker.d.ts.map +1 -1
- package/dist/components/features/date-time-picker/types.d.ts +9 -0
- package/dist/components/features/date-time-picker/types.d.ts.map +1 -1
- package/dist/components/features/grid/components/col.d.ts +1 -1
- package/dist/components/features/grid/components/col.d.ts.map +1 -1
- package/dist/components/features/grid/components/row.d.ts +1 -1
- package/dist/components/features/grid/components/row.d.ts.map +1 -1
- package/dist/components/features/picker/components/calendar.d.ts +14 -0
- package/dist/components/features/picker/components/calendar.d.ts.map +1 -0
- package/dist/components/features/picker/components/content.d.ts +18 -0
- package/dist/components/features/picker/components/content.d.ts.map +1 -0
- package/dist/components/features/picker/components/context.d.ts +57 -0
- package/dist/components/features/picker/components/context.d.ts.map +1 -0
- package/dist/components/features/picker/components/footer.d.ts +35 -0
- package/dist/components/features/picker/components/footer.d.ts.map +1 -0
- package/dist/components/features/picker/components/index.d.ts +36 -0
- package/dist/components/features/picker/components/index.d.ts.map +1 -0
- package/dist/components/features/picker/components/presets.d.ts +9 -0
- package/dist/components/features/picker/components/presets.d.ts.map +1 -0
- package/dist/components/features/picker/components/root.d.ts +40 -0
- package/dist/components/features/picker/components/root.d.ts.map +1 -0
- package/dist/components/features/picker/components/time-input-field.d.ts +13 -0
- package/dist/components/features/picker/components/time-input-field.d.ts.map +1 -0
- package/dist/components/features/picker/components/time-input.d.ts +13 -0
- package/dist/components/features/picker/components/time-input.d.ts.map +1 -0
- package/dist/components/features/picker/components/timezone-indicator.d.ts +14 -0
- package/dist/components/features/picker/components/timezone-indicator.d.ts.map +1 -0
- package/dist/components/features/picker/components/timezone-select.d.ts +16 -0
- package/dist/components/features/picker/components/timezone-select.d.ts.map +1 -0
- package/dist/components/features/picker/components/trigger.d.ts +23 -0
- package/dist/components/features/picker/components/trigger.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/index.d.ts +5 -0
- package/dist/components/features/picker/hooks/index.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-keyboard-shortcuts.d.ts +25 -0
- package/dist/components/features/picker/hooks/use-keyboard-shortcuts.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-picker-state.d.ts +51 -0
- package/dist/components/features/picker/hooks/use-picker-state.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-presets.d.ts +24 -0
- package/dist/components/features/picker/hooks/use-presets.d.ts.map +1 -0
- package/dist/components/features/picker/hooks/use-time-slots.d.ts +21 -0
- package/dist/components/features/picker/hooks/use-time-slots.d.ts.map +1 -0
- package/dist/components/features/picker/index.d.ts +8 -0
- package/dist/components/features/picker/index.d.ts.map +1 -0
- package/dist/components/features/picker/internal/use-deprecation-warning.d.ts +9 -0
- package/dist/components/features/picker/internal/use-deprecation-warning.d.ts.map +1 -0
- package/dist/components/features/picker/presets/defaults.d.ts +16 -0
- package/dist/components/features/picker/presets/defaults.d.ts.map +1 -0
- package/dist/components/features/picker/presets/index.d.ts +2 -0
- package/dist/components/features/picker/presets/index.d.ts.map +1 -0
- package/dist/components/features/picker/types.d.ts +70 -0
- package/dist/components/features/picker/types.d.ts.map +1 -0
- package/dist/components/features/picker/utils/commit.d.ts +16 -0
- package/dist/components/features/picker/utils/commit.d.ts.map +1 -0
- package/dist/components/features/picker/utils/compare.d.ts +12 -0
- package/dist/components/features/picker/utils/compare.d.ts.map +1 -0
- package/dist/components/features/picker/utils/format-value.d.ts +25 -0
- package/dist/components/features/picker/utils/format-value.d.ts.map +1 -0
- package/dist/components/features/picker/utils/format.d.ts +38 -0
- package/dist/components/features/picker/utils/format.d.ts.map +1 -0
- package/dist/components/features/picker/utils/index.d.ts +7 -0
- package/dist/components/features/picker/utils/index.d.ts.map +1 -0
- package/dist/components/features/picker/utils/range.d.ts +26 -0
- package/dist/components/features/picker/utils/range.d.ts.map +1 -0
- package/dist/components/features/picker/utils/timezone.d.ts +38 -0
- package/dist/components/features/picker/utils/timezone.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-picker.d.ts +10 -0
- package/dist/components/features/picker/wrappers/date-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-range-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/date-range-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-range-time-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/date-range-time-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-time-picker.d.ts +20 -0
- package/dist/components/features/picker/wrappers/date-time-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/date-time-range-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/date-time-range-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/index.d.ts +16 -0
- package/dist/components/features/picker/wrappers/index.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/internal/default-footer.d.ts +7 -0
- package/dist/components/features/picker/wrappers/internal/default-footer.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/time-picker.d.ts +14 -0
- package/dist/components/features/picker/wrappers/time-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/time-range-picker.d.ts +16 -0
- package/dist/components/features/picker/wrappers/time-range-picker.d.ts.map +1 -0
- package/dist/components/features/picker/wrappers/types.d.ts +118 -0
- package/dist/components/features/picker/wrappers/types.d.ts.map +1 -0
- package/dist/components/features/tag-input/tag-input.d.ts +1 -1
- package/dist/components/features/tag-input/tag-input.d.ts.map +1 -1
- package/dist/components/features/time-picker/time-picker.d.ts +5 -0
- package/dist/components/features/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/features/time-picker/types.d.ts +5 -0
- package/dist/components/features/time-picker/types.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/index.d.ts +5 -0
- package/dist/components/features/time-range-picker/index.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/time-range-picker.d.ts +19 -14
- package/dist/components/features/time-range-picker/time-range-picker.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/types.d.ts +20 -0
- package/dist/components/features/time-range-picker/types.d.ts.map +1 -1
- package/dist/data-table/index.mjs +22 -15
- package/dist/date-picker/index.mjs +2 -2
- package/dist/date-range-picker-DNZh06zo.mjs +77 -0
- package/dist/date-time-picker/index.mjs +1 -1
- package/dist/date-time-picker-BiobghTJ.mjs +43 -0
- package/dist/date-time-picker-C0fF7s_e.mjs +109 -0
- package/dist/date-time-range-picker-cW4rbuFn.mjs +82 -0
- package/dist/default-footer-DbpemJVl.mjs +1037 -0
- package/dist/dropzone/index.mjs +1 -1
- package/dist/{dropzone-Bt0plEuw.mjs → dropzone-DXH0xHso.mjs} +1 -1
- package/dist/empty-content/index.mjs +1 -1
- package/dist/form/adapters/conform/index.mjs +19 -19
- package/dist/form/adapters/rhf/index.mjs +18 -18
- package/dist/form/index.mjs +2 -2
- package/dist/form/stepper/index.mjs +23 -23
- package/dist/{form-CCNN9VtJ.mjs → form-DvgKb4s4.mjs} +49 -42
- package/dist/{form-context-CeKyvO-A.mjs → form-context-0usxTumz.mjs} +3 -3
- package/dist/grid/index.mjs +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.mjs +41 -41
- package/dist/input-group/index.mjs +1 -1
- package/dist/{input-group-DDtz-RT7.mjs → input-group-CeMsDhOk.mjs} +1 -1
- package/dist/input-number/index.mjs +1 -1
- package/dist/{input-number-Diu-C6d5.mjs → input-number-BU4nno8J.mjs} +1 -1
- package/dist/loader-overlay/index.mjs +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/{map-qo7bY_g_.mjs → map-l7iwhEwM.mjs} +24 -27
- package/dist/more-actions/index.mjs +2 -2
- package/dist/{more-actions-Ca5qqd0H.mjs → more-actions-Baqor0yr.mjs} +2 -2
- package/dist/multi-select/index.mjs +1 -1
- package/dist/{multi-select-DM_dxnSV.mjs → multi-select-BHmtkQIi.mjs} +6 -6
- package/dist/nprogress/nprogress.css +59 -11
- package/dist/page-title/index.mjs +1 -1
- package/dist/picker/index.mjs +273 -0
- package/dist/rich-text-editor/index.mjs +1 -1
- package/dist/{rich-text-editor-CQH_U4T5.mjs → rich-text-editor-aWuLRaj9.mjs} +1 -1
- package/dist/select/index.mjs +1 -1
- package/dist/select-By1ZqPgr.mjs +94 -0
- package/dist/select-Ck0szhAH.mjs +73 -0
- package/dist/sidebar/index.mjs +1 -1
- package/dist/{sidebar-B8LQJiNI.mjs → sidebar-CUnFkH7o.mjs} +32 -32
- package/dist/skeleton/index.mjs +1 -1
- package/dist/{skeleton-D4HOEiOZ.mjs → skeleton-CxAhQT6T.mjs} +1 -1
- package/dist/stepper/index.mjs +1 -1
- package/dist/{stepper-Beb-zbdL.mjs → stepper-adDdiJMx.mjs} +7 -7
- package/dist/styles/root.css +4 -2
- package/dist/styles/shadcn/shadcn.css +212 -213
- package/dist/switch/index.mjs +1 -1
- package/dist/table/index.mjs +1 -1
- package/dist/tag-input/index.mjs +1 -1
- package/dist/{tag-input-Bf4GMptp.mjs → tag-input-D3NYy9-_.mjs} +1 -1
- package/dist/task-queue/index.mjs +1 -1
- package/dist/{task-queue-dropdown-D-LncEWm.mjs → task-queue-dropdown-t9KKIL6j.mjs} +3 -3
- package/dist/textarea/index.mjs +1 -1
- package/dist/theme/index.mjs +1 -1
- package/dist/{themes-CAiN4b6G.mjs → themes-08-znmBI.mjs} +16 -16
- package/dist/time-input-9LdNL0Us.mjs +196 -0
- package/dist/time-picker/index.mjs +1 -1
- package/dist/time-picker-B-vpUClR.mjs +45 -0
- package/dist/time-picker-C840fLl6.mjs +49 -0
- package/dist/timezone-indicator-COoeMKKs.mjs +27 -0
- package/dist/{to-api-format-CgKcC9SK.mjs → to-api-format-CNqrcrz7.mjs} +58 -243
- package/dist/toast/index.mjs +2 -2
- package/dist/{toast-DDdLgY53.mjs → toast-Bd5Kk7BB.mjs} +1 -1
- package/dist/tooltip/index.mjs +1 -1
- package/dist/transfer/index.mjs +1 -1
- package/dist/{transfer-CoGPwOc6.mjs → transfer-CuJGL420.mjs} +6 -6
- package/dist/{types-CKIe2WlV.mjs → types-DvMIxilw.mjs} +9 -3
- package/dist/typography/index.mjs +1 -1
- package/dist/{typography-TRKP_CLT.mjs → typography-CBwfg-vz.mjs} +5 -5
- package/dist/{use-copy-to-clipboard-D7KyLIAt.mjs → use-copy-to-clipboard-ZHDvfV3W.mjs} +1 -1
- package/dist/use-deprecation-warning-Dy_DOyLu.mjs +20 -0
- package/dist/{use-display-touched-C-afz17j.mjs → use-display-touched-DpX3fsOl.mjs} +5 -5
- package/dist/{use-option-picker-BXQOfyrK.mjs → use-option-picker-DV5O68eV.mjs} +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/visually-hidden/index.mjs +1 -1
- package/package.json +30 -25
- package/dist/calendar-date-picker-BaykEs6j.mjs +0 -749
- package/dist/date-time-picker-DKOxrhmc.mjs +0 -193
- package/dist/select-zxwykvQn.mjs +0 -163
- package/dist/time-picker-BZF5jbF6.mjs +0 -99
- package/dist/use-date-constraints-R3H4lIoT.mjs +0 -41
- /package/dist/{action-row-DnhBhMtt.mjs → action-row-ZaMsJ8cP.mjs} +0 -0
- /package/dist/{empty-content-CBh5bbtJ.mjs → empty-content-DTk_lwnh.mjs} +0 -0
- /package/dist/{hooks-DQXVwbrs.mjs → hooks-CnphNpwz.mjs} +0 -0
- /package/dist/{loader-overlay-C2WDla6V.mjs → loader-overlay-B3YEoOFJ.mjs} +0 -0
- /package/dist/{map-leaflet-imports-yWwH4CHB.mjs → map-leaflet-imports-Ix8F7E8j.mjs} +0 -0
- /package/dist/{page-title-ChLiv6gB.mjs → page-title-D5JhOpxV.mjs} +0 -0
- /package/dist/{skeleton-D2xuJdE1.mjs → skeleton-B1NOdZGM.mjs} +0 -0
- /package/dist/{switch-DcSF42Kc.mjs → switch-BcQaR1Bp.mjs} +0 -0
- /package/dist/{table-DWGT4cqh.mjs → table-ouGk4Vxe.mjs} +0 -0
- /package/dist/{textarea-BoChBcFz.mjs → textarea-q-k7DYwi.mjs} +0 -0
- /package/dist/{toast-D5XD7goD.mjs → toast-BWol1pyV.mjs} +0 -0
- /package/dist/{tooltip-a7NTDCWw.mjs → tooltip-CHuzXR_O.mjs} +0 -0
- /package/dist/{utils-BwB1mIdZ.mjs → utils-bUueJ2r9.mjs} +0 -0
- /package/dist/{visuallyhidden-BHOPczmW.mjs → visuallyhidden-CoIJOJ9z.mjs} +0 -0
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { t as Button } from "./button-BllvE9Lm.mjs";
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as Icon } from "./icon-wrapper-DuLp3RM1.mjs";
|
|
5
|
-
import { t as Calendar$1 } from "./calendar-C-Hbf74r.mjs";
|
|
3
|
+
import { t as Calendar } from "./calendar-Dwvq3Vu_.mjs";
|
|
6
4
|
import { t as Input } from "./input-FKGqZypx.mjs";
|
|
7
|
-
import { t as MobileSheet } from "./mobile-sheet-BxMvkzAj.mjs";
|
|
8
|
-
import { i as PopoverTrigger, r as PopoverContent, t as Popover } from "./popover-JOuXJOZ2.mjs";
|
|
9
|
-
import { t as useBreakpoint } from "./use-breakpoint-DGcVmB3c.mjs";
|
|
10
5
|
import { t as ResponsivePopover } from "./responsive-popover-D-t9bxSN.mjs";
|
|
11
|
-
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
6
|
+
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-Ck0szhAH.mjs";
|
|
7
|
+
import { t as useDeprecationWarning } from "./use-deprecation-warning-Dy_DOyLu.mjs";
|
|
8
|
+
import { t as DateTimeRangePicker } from "./date-time-range-picker-cW4rbuFn.mjs";
|
|
9
|
+
import { CalendarIcon, Globe } from "lucide-react";
|
|
10
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
12
|
import { format, isSameDay, isSameYear, parse, subDays, subHours, subMinutes } from "date-fns";
|
|
16
13
|
import { fromZonedTime, toZonedTime } from "date-fns-tz";
|
|
17
14
|
//#region src/components/features/time-range-picker/utils/timezone.ts
|
|
@@ -296,7 +293,7 @@ function CustomRangePanel({ fromUtc, toUtc, timezone, onRangeChange, disableFutu
|
|
|
296
293
|
children: format(startDate, "MMM d, yyyy")
|
|
297
294
|
})]
|
|
298
295
|
}),
|
|
299
|
-
children: /* @__PURE__ */ jsx(Calendar
|
|
296
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
300
297
|
mode: "single",
|
|
301
298
|
selected: startDate,
|
|
302
299
|
onSelect: handleStartDateSelect,
|
|
@@ -340,7 +337,7 @@ function CustomRangePanel({ fromUtc, toUtc, timezone, onRangeChange, disableFutu
|
|
|
340
337
|
children: format(endDate, "MMM d, yyyy")
|
|
341
338
|
})]
|
|
342
339
|
}),
|
|
343
|
-
children: /* @__PURE__ */ jsx(Calendar
|
|
340
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
344
341
|
mode: "single",
|
|
345
342
|
selected: endDate,
|
|
346
343
|
onSelect: handleEndDateSelect,
|
|
@@ -550,6 +547,54 @@ function getPresetRange(preset, timezone) {
|
|
|
550
547
|
};
|
|
551
548
|
}
|
|
552
549
|
//#endregion
|
|
550
|
+
//#region src/components/features/time-range-picker/time-range-picker.tsx
|
|
551
|
+
/**
|
|
552
|
+
* @deprecated Use `DateTimeRangePicker` from `@datum-cloud/datum-ui/picker`
|
|
553
|
+
* (or `TimeRangePicker` for time-of-day-only ranges). This adapter shim ships
|
|
554
|
+
* through 0.10.x and is removed in 1.0.0. See `picker-migration.mdx`.
|
|
555
|
+
*
|
|
556
|
+
* Notable diff: legacy `TimeRangeValue` envelope had a `type: 'preset' | 'custom'`
|
|
557
|
+
* discriminator. The shim translates to/from the new wrapper's flatter
|
|
558
|
+
* `{ from, to, preset? }` shape.
|
|
559
|
+
*/
|
|
560
|
+
function TimeRangePicker({ value, onChange, onClear: _onClear, timezone, presets, disableFuture, maxDate, minDate, className, disabled, placeholder = "Select time range", align: _align, side: _side }) {
|
|
561
|
+
useDeprecationWarning("TimeRangePicker (legacy)", "DateTimeRangePicker");
|
|
562
|
+
return /* @__PURE__ */ jsx(DateTimeRangePicker, {
|
|
563
|
+
value: value ? {
|
|
564
|
+
from: value.from,
|
|
565
|
+
to: value.to
|
|
566
|
+
} : null,
|
|
567
|
+
onChange: (next) => {
|
|
568
|
+
if (next === null) {
|
|
569
|
+
onChange({
|
|
570
|
+
type: "custom",
|
|
571
|
+
from: "",
|
|
572
|
+
to: ""
|
|
573
|
+
});
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const withPreset = next;
|
|
577
|
+
onChange({
|
|
578
|
+
type: withPreset.preset ? "preset" : "custom",
|
|
579
|
+
preset: withPreset.preset,
|
|
580
|
+
from: withPreset.from,
|
|
581
|
+
to: withPreset.to
|
|
582
|
+
});
|
|
583
|
+
},
|
|
584
|
+
placeholder,
|
|
585
|
+
sheetTitle: placeholder,
|
|
586
|
+
timezone,
|
|
587
|
+
presets,
|
|
588
|
+
disableFuture,
|
|
589
|
+
maxDate,
|
|
590
|
+
minDate,
|
|
591
|
+
className,
|
|
592
|
+
disabled,
|
|
593
|
+
numberOfMonths: 2
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
TimeRangePicker.displayName = "TimeRangePicker";
|
|
597
|
+
//#endregion
|
|
553
598
|
//#region src/components/features/time-range-picker/utils/format-display.ts
|
|
554
599
|
/**
|
|
555
600
|
* Format a TimeRangeValue for display in the trigger button
|
|
@@ -593,236 +638,6 @@ function formatDateForInput(date) {
|
|
|
593
638
|
return format(date, "yyyy-MM-dd'T'HH:mm");
|
|
594
639
|
}
|
|
595
640
|
//#endregion
|
|
596
|
-
//#region src/components/features/time-range-picker/time-range-picker.tsx
|
|
597
|
-
function TimeRangePicker({ value, onChange, onClear, timezone: timezoneProp, presets = DEFAULT_PRESETS, disableFuture = false, maxDate, minDate, className, disabled = false, placeholder = "Select time range", align = "start", side = "bottom" }) {
|
|
598
|
-
const [open, setOpen] = useState(false);
|
|
599
|
-
const isMobile = useBreakpoint() === "mobile";
|
|
600
|
-
const timezone = timezoneProp ?? getBrowserTimezone();
|
|
601
|
-
const defaultPreset = getDefaultPreset(presets);
|
|
602
|
-
const defaultRange = useMemo(() => getPresetRange(defaultPreset, timezone), [defaultPreset, timezone]);
|
|
603
|
-
const currentFromUtc = value?.from ?? defaultRange.from;
|
|
604
|
-
const currentToUtc = value?.to ?? defaultRange.to;
|
|
605
|
-
const calendarRange = useMemo(() => {
|
|
606
|
-
try {
|
|
607
|
-
return {
|
|
608
|
-
from: utcStringToZonedDate(currentFromUtc, timezone),
|
|
609
|
-
to: utcStringToZonedDate(currentToUtc, timezone)
|
|
610
|
-
};
|
|
611
|
-
} catch {
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
}, [
|
|
615
|
-
currentFromUtc,
|
|
616
|
-
currentToUtc,
|
|
617
|
-
timezone
|
|
618
|
-
]);
|
|
619
|
-
const effectiveValue = useMemo(() => {
|
|
620
|
-
if (value?.type === "preset" && value?.preset && (!value?.from || !value?.to)) {
|
|
621
|
-
const preset = presets.find((p) => p.key === value.preset) ?? defaultPreset;
|
|
622
|
-
const range = getPresetRange(preset, timezone);
|
|
623
|
-
return {
|
|
624
|
-
type: "preset",
|
|
625
|
-
preset: preset.key,
|
|
626
|
-
from: range.from,
|
|
627
|
-
to: range.to
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
if (value?.from && value?.to) return value;
|
|
631
|
-
return {
|
|
632
|
-
type: "preset",
|
|
633
|
-
preset: defaultPreset.key,
|
|
634
|
-
from: defaultRange.from,
|
|
635
|
-
to: defaultRange.to
|
|
636
|
-
};
|
|
637
|
-
}, [
|
|
638
|
-
value,
|
|
639
|
-
defaultPreset,
|
|
640
|
-
defaultRange.from,
|
|
641
|
-
defaultRange.to,
|
|
642
|
-
presets,
|
|
643
|
-
timezone
|
|
644
|
-
]);
|
|
645
|
-
const displayText = useMemo(() => formatTimeRangeDisplay(effectiveValue, timezone) || placeholder, [
|
|
646
|
-
effectiveValue,
|
|
647
|
-
timezone,
|
|
648
|
-
placeholder
|
|
649
|
-
]);
|
|
650
|
-
const handlePresetSelect = useCallback((preset) => {
|
|
651
|
-
const range = getPresetRange(preset, timezone);
|
|
652
|
-
onChange({
|
|
653
|
-
type: "preset",
|
|
654
|
-
preset: preset.key,
|
|
655
|
-
from: range.from,
|
|
656
|
-
to: range.to
|
|
657
|
-
});
|
|
658
|
-
setOpen(false);
|
|
659
|
-
}, [onChange, timezone]);
|
|
660
|
-
const userClickedCalendarRef = useRef(false);
|
|
661
|
-
const handleDayClick = useCallback(() => {
|
|
662
|
-
userClickedCalendarRef.current = true;
|
|
663
|
-
}, []);
|
|
664
|
-
const handleCalendarSelect = useCallback((range) => {
|
|
665
|
-
if (!userClickedCalendarRef.current) return;
|
|
666
|
-
userClickedCalendarRef.current = false;
|
|
667
|
-
if (range?.from && range?.to) {
|
|
668
|
-
const now = /* @__PURE__ */ new Date();
|
|
669
|
-
const fromStart = new Date(range.from);
|
|
670
|
-
fromStart.setHours(0, 0, 0, 0);
|
|
671
|
-
const toEnd = new Date(range.to);
|
|
672
|
-
toEnd.setHours(23, 59, 59, 999);
|
|
673
|
-
const effectiveToEnd = toEnd > now ? now : toEnd;
|
|
674
|
-
onChange({
|
|
675
|
-
type: "custom",
|
|
676
|
-
from: zonedDateToUtcString(fromStart, timezone),
|
|
677
|
-
to: zonedDateToUtcString(effectiveToEnd, timezone)
|
|
678
|
-
});
|
|
679
|
-
} else if (range?.from) {
|
|
680
|
-
const now = /* @__PURE__ */ new Date();
|
|
681
|
-
const fromStart = new Date(range.from);
|
|
682
|
-
fromStart.setHours(0, 0, 0, 0);
|
|
683
|
-
const toEnd = new Date(range.from);
|
|
684
|
-
toEnd.setHours(23, 59, 59, 999);
|
|
685
|
-
const effectiveToEnd = toEnd > now ? now : toEnd;
|
|
686
|
-
onChange({
|
|
687
|
-
type: "custom",
|
|
688
|
-
from: zonedDateToUtcString(fromStart, timezone),
|
|
689
|
-
to: zonedDateToUtcString(effectiveToEnd, timezone)
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
}, [onChange, timezone]);
|
|
693
|
-
const handleCustomRangeChange = useCallback((fromUtc, toUtc) => {
|
|
694
|
-
onChange({
|
|
695
|
-
type: "custom",
|
|
696
|
-
from: fromUtc,
|
|
697
|
-
to: toUtc
|
|
698
|
-
});
|
|
699
|
-
}, [onChange]);
|
|
700
|
-
useEffect(() => {
|
|
701
|
-
if (!open) return;
|
|
702
|
-
const handleKeyDown = (e) => {
|
|
703
|
-
const preset = getPresetByShortcut(e.key, presets);
|
|
704
|
-
if (preset) {
|
|
705
|
-
e.preventDefault();
|
|
706
|
-
handlePresetSelect(preset);
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
710
|
-
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
711
|
-
}, [
|
|
712
|
-
open,
|
|
713
|
-
presets,
|
|
714
|
-
handlePresetSelect
|
|
715
|
-
]);
|
|
716
|
-
const effectiveMaxDate = disableFuture ? /* @__PURE__ */ new Date() : maxDate;
|
|
717
|
-
const handleClear = useCallback((e) => {
|
|
718
|
-
e.stopPropagation();
|
|
719
|
-
onClear?.();
|
|
720
|
-
}, [onClear]);
|
|
721
|
-
const showClearButton = value && onClear;
|
|
722
|
-
const triggerButton = /* @__PURE__ */ jsxs(Button, {
|
|
723
|
-
type: "quaternary",
|
|
724
|
-
theme: "outline",
|
|
725
|
-
disabled,
|
|
726
|
-
className: cn("text-foreground min-w-[200px] items-center justify-between gap-2 px-3 font-normal", className),
|
|
727
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
728
|
-
className: "flex flex-1 items-center gap-2",
|
|
729
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
730
|
-
icon: Calendar,
|
|
731
|
-
size: 16
|
|
732
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
733
|
-
className: "truncate text-xs",
|
|
734
|
-
children: displayText
|
|
735
|
-
})]
|
|
736
|
-
}), showClearButton && /* @__PURE__ */ jsx("div", {
|
|
737
|
-
onClick: (e) => {
|
|
738
|
-
e.stopPropagation();
|
|
739
|
-
e.preventDefault();
|
|
740
|
-
handleClear(e);
|
|
741
|
-
},
|
|
742
|
-
className: cn("size-[14px] shrink-0 p-0 hover:bg-transparent", "hover:text-destructive text-icon-quaternary hover:bg-transparent dark:text-white", "focus:ring-ring focus:ring-2 focus:ring-offset-1 focus:outline-none", "disabled:pointer-events-none disabled:opacity-50", "transition-colors"),
|
|
743
|
-
"aria-label": "Clear time range",
|
|
744
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
745
|
-
icon: X,
|
|
746
|
-
size: 14
|
|
747
|
-
})
|
|
748
|
-
})]
|
|
749
|
-
});
|
|
750
|
-
const pickerContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
751
|
-
/* @__PURE__ */ jsxs("div", {
|
|
752
|
-
className: "divide-border flex flex-col divide-x sm:flex-row",
|
|
753
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
754
|
-
className: "flex-1 px-0",
|
|
755
|
-
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
756
|
-
className: "w-full",
|
|
757
|
-
mode: "range",
|
|
758
|
-
defaultMonth: calendarRange?.from,
|
|
759
|
-
selected: calendarRange,
|
|
760
|
-
onSelect: handleCalendarSelect,
|
|
761
|
-
onDayClick: handleDayClick,
|
|
762
|
-
numberOfMonths: 1,
|
|
763
|
-
disabled: (date) => {
|
|
764
|
-
if (effectiveMaxDate && date > effectiveMaxDate) return true;
|
|
765
|
-
if (minDate && date < minDate) return true;
|
|
766
|
-
return false;
|
|
767
|
-
},
|
|
768
|
-
initialFocus: true
|
|
769
|
-
})
|
|
770
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
771
|
-
className: "p-3",
|
|
772
|
-
children: /* @__PURE__ */ jsx(QuickRangesPanel, {
|
|
773
|
-
presets,
|
|
774
|
-
value: effectiveValue,
|
|
775
|
-
onPresetSelect: handlePresetSelect
|
|
776
|
-
})
|
|
777
|
-
})]
|
|
778
|
-
}),
|
|
779
|
-
/* @__PURE__ */ jsx(Separator, {}),
|
|
780
|
-
/* @__PURE__ */ jsx("div", {
|
|
781
|
-
className: "p-3",
|
|
782
|
-
children: /* @__PURE__ */ jsx(CustomRangePanel, {
|
|
783
|
-
fromUtc: currentFromUtc,
|
|
784
|
-
toUtc: currentToUtc,
|
|
785
|
-
timezone,
|
|
786
|
-
onRangeChange: handleCustomRangeChange,
|
|
787
|
-
disableFuture
|
|
788
|
-
})
|
|
789
|
-
}),
|
|
790
|
-
/* @__PURE__ */ jsx(Separator, {}),
|
|
791
|
-
/* @__PURE__ */ jsxs("div", {
|
|
792
|
-
className: "text-muted-foreground bg-muted/30 flex items-center gap-2 px-3 py-2 text-xs",
|
|
793
|
-
children: [/* @__PURE__ */ jsx(Globe, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsxs("span", { children: ["Your timezone:", formatTimezoneLabel(timezone)] })]
|
|
794
|
-
})
|
|
795
|
-
] });
|
|
796
|
-
if (isMobile) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
797
|
-
className: "relative inline-flex",
|
|
798
|
-
onClick: () => setOpen(true),
|
|
799
|
-
children: triggerButton
|
|
800
|
-
}), /* @__PURE__ */ jsx(MobileSheet, {
|
|
801
|
-
open,
|
|
802
|
-
onOpenChange: setOpen,
|
|
803
|
-
title: "Select time range",
|
|
804
|
-
description: "Choose a preset or custom date range",
|
|
805
|
-
children: pickerContent
|
|
806
|
-
})] });
|
|
807
|
-
return /* @__PURE__ */ jsxs(Popover, {
|
|
808
|
-
open,
|
|
809
|
-
onOpenChange: setOpen,
|
|
810
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
811
|
-
className: "relative inline-flex",
|
|
812
|
-
children: /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
813
|
-
asChild: true,
|
|
814
|
-
children: triggerButton
|
|
815
|
-
})
|
|
816
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
817
|
-
className: "w-auto rounded-xl p-0",
|
|
818
|
-
align,
|
|
819
|
-
side,
|
|
820
|
-
sideOffset: 4,
|
|
821
|
-
children: pickerContent
|
|
822
|
-
})]
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
//#endregion
|
|
826
641
|
//#region src/components/features/time-range-picker/utils/to-api-format.ts
|
|
827
642
|
/**
|
|
828
643
|
* Convert a TimeRangeValue to API format (startTime/endTime)
|
|
@@ -864,4 +679,4 @@ function toApiTimeRange(value, timezone, presets = DEFAULT_PRESETS) {
|
|
|
864
679
|
};
|
|
865
680
|
}
|
|
866
681
|
//#endregion
|
|
867
|
-
export { utcToLocalInputString as C, utcStringToZonedDate as S, getBrowserTimezone as _,
|
|
682
|
+
export { utcToLocalInputString as C, utcStringToZonedDate as S, getBrowserTimezone as _, TimeRangePicker as a, getTimezoneOffset as b, getPresetByKey as c, TimezoneSelector as d, QuickRangesPanel as f, formatUtcForDisplay as g, formatTimezoneLabel as h, formatTimeRangeDisplay as i, getPresetByShortcut as l, createTimezoneOption as m, formatDateForInput as n, DEFAULT_PRESETS as o, CustomRangePanel as p, formatSingleTimeDisplay as r, getDefaultPreset as s, toApiTimeRange as t, getPresetRange as u, getDefaultTimezoneOptions as v, zonedDateToUtcString as w, localInputStringToUtc as x, getShortTimezoneDisplay as y };
|
package/dist/toast/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as toast } from "../toast-
|
|
2
|
-
import { n as Toaster, t as useToast } from "../toast-
|
|
1
|
+
import { t as toast } from "../toast-BWol1pyV.mjs";
|
|
2
|
+
import { n as Toaster, t as useToast } from "../toast-Bd5Kk7BB.mjs";
|
|
3
3
|
export { Toaster, toast, useToast };
|
package/dist/tooltip/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Tooltip } from "../tooltip-
|
|
1
|
+
import { t as Tooltip } from "../tooltip-CHuzXR_O.mjs";
|
|
2
2
|
export { Tooltip };
|
package/dist/transfer/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Transfer } from "../transfer-
|
|
1
|
+
import { t as Transfer } from "../transfer-CuJGL420.mjs";
|
|
2
2
|
export { Transfer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { t as Button } from "./button-BllvE9Lm.mjs";
|
|
3
3
|
import { Search, X } from "lucide-react";
|
|
4
|
-
import * as React
|
|
4
|
+
import * as React from "react";
|
|
5
5
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/features/transfer/components/transfer-group.tsx
|
|
@@ -63,7 +63,7 @@ const TransferSearch = ({ value, onChange, placeholder = "Search...", disabled =
|
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region src/components/features/transfer/components/transfer-panel.tsx
|
|
65
65
|
const TransferPanel = ({ title, items, groups, searchable, searchValue, onSearchChange, searchPlaceholder, onItemClick, onSelectAll, enableSelectAll, disabled = false, panelType }) => {
|
|
66
|
-
const groupedItems = React
|
|
66
|
+
const groupedItems = React.useMemo(() => {
|
|
67
67
|
if (groups.length === 0) return { "": items };
|
|
68
68
|
const grouped = {};
|
|
69
69
|
groups.forEach((group) => {
|
|
@@ -203,14 +203,14 @@ function Transfer({ items, value, onChange, itemKey, itemLabel, itemGroup, searc
|
|
|
203
203
|
itemLabel,
|
|
204
204
|
itemGroup
|
|
205
205
|
});
|
|
206
|
-
const handleSelect = React
|
|
206
|
+
const handleSelect = React.useCallback((key) => {
|
|
207
207
|
if (value.includes(key)) return;
|
|
208
208
|
onChange([...value, key]);
|
|
209
209
|
}, [value, onChange]);
|
|
210
|
-
const handleDeselect = React
|
|
210
|
+
const handleDeselect = React.useCallback((key) => {
|
|
211
211
|
onChange(value.filter((k) => k !== key));
|
|
212
212
|
}, [value, onChange]);
|
|
213
|
-
const handleSelectAll = React
|
|
213
|
+
const handleSelectAll = React.useCallback(() => {
|
|
214
214
|
const sourceKeys = state.filteredSourceItems.map((item) => item.key);
|
|
215
215
|
const existing = new Set(value);
|
|
216
216
|
const newKeys = sourceKeys.filter((k) => !existing.has(k));
|
|
@@ -220,7 +220,7 @@ function Transfer({ items, value, onChange, itemKey, itemLabel, itemGroup, searc
|
|
|
220
220
|
value,
|
|
221
221
|
onChange
|
|
222
222
|
]);
|
|
223
|
-
const handleClearAll = React
|
|
223
|
+
const handleClearAll = React.useCallback(() => {
|
|
224
224
|
onChange([]);
|
|
225
225
|
}, [onChange]);
|
|
226
226
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs/index.mjs";
|
|
3
|
-
import { n as useTheme } from "./themes-
|
|
4
|
-
import { t as toast } from "./toast-
|
|
3
|
+
import { n as useTheme } from "./themes-08-znmBI.mjs";
|
|
4
|
+
import { t as toast } from "./toast-BWol1pyV.mjs";
|
|
5
5
|
import { useEffect, useRef, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import Editor from "@monaco-editor/react";
|
|
@@ -63,11 +63,12 @@ import { z } from "zod";
|
|
|
63
63
|
* @param props.minHeight - Minimum editor height (default: '200px')
|
|
64
64
|
* @returns Rendered Monaco editor with form integration
|
|
65
65
|
*/
|
|
66
|
-
function CodeEditor({ value, onChange, language, id, name = "code-editor", error, className, readOnly = false, minHeight = "200px" }) {
|
|
66
|
+
function CodeEditor({ value, onChange, language, placeholder, id, name = "code-editor", error, className, readOnly = false, minHeight = "200px" }) {
|
|
67
67
|
const { theme } = useTheme();
|
|
68
68
|
const editorRef = useRef(null);
|
|
69
69
|
const [mounted, setMounted] = useState(false);
|
|
70
70
|
const monacoTheme = theme === "dark" ? "vs-dark" : "light";
|
|
71
|
+
const showPlaceholder = !!placeholder && value.length === 0;
|
|
71
72
|
useEffect(() => {
|
|
72
73
|
if (editorRef.current && !mounted) {
|
|
73
74
|
setTimeout(() => {
|
|
@@ -104,6 +105,11 @@ function CodeEditor({ value, onChange, language, id, name = "code-editor", error
|
|
|
104
105
|
},
|
|
105
106
|
className: cn(error && "border border-destructive rounded-md")
|
|
106
107
|
}),
|
|
108
|
+
showPlaceholder && /* @__PURE__ */ jsx("div", {
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
className: "text-input-placeholder pointer-events-none absolute top-0 left-14 z-10 py-0.5 text-sm whitespace-pre-wrap",
|
|
111
|
+
children: placeholder
|
|
112
|
+
}),
|
|
107
113
|
/* @__PURE__ */ jsx("input", {
|
|
108
114
|
type: "hidden",
|
|
109
115
|
id,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ListItem, c as Title, d as titleVariants, i as List, l as paragraphVariants, n as Code, o as Paragraph, r as Link, s as Text, t as Blockquote, u as textVariants } from "../typography-
|
|
1
|
+
import { a as ListItem, c as Title, d as titleVariants, i as List, l as paragraphVariants, n as Code, o as Paragraph, r as Link, s as Text, t as Blockquote, u as textVariants } from "../typography-CBwfg-vz.mjs";
|
|
2
2
|
export { Blockquote, Code, Link, List, ListItem, Paragraph, Text, Title, paragraphVariants, textVariants, titleVariants };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
3
|
import { CopyIcon } from "lucide-react";
|
|
4
|
-
import * as React
|
|
4
|
+
import * as React from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/base/typography/typography.tsx
|
|
7
7
|
const titleVariants = cva("font-semibold leading-tight tracking-tight", {
|
|
@@ -106,7 +106,7 @@ const paragraphVariants = cva("leading-relaxed", {
|
|
|
106
106
|
});
|
|
107
107
|
function Title({ className, level, weight, textColor, as, children, ...props }) {
|
|
108
108
|
const Component = as ?? `h${level ?? 4}`;
|
|
109
|
-
return React
|
|
109
|
+
return React.createElement(Component, {
|
|
110
110
|
className: cn(titleVariants({
|
|
111
111
|
level,
|
|
112
112
|
weight,
|
|
@@ -131,7 +131,7 @@ function Text({ className, size, weight, textColor, type, as = "span", copyable,
|
|
|
131
131
|
"aria-hidden": "true"
|
|
132
132
|
})
|
|
133
133
|
})] });
|
|
134
|
-
return React
|
|
134
|
+
return React.createElement(as, {
|
|
135
135
|
className: cn(textVariants({
|
|
136
136
|
size,
|
|
137
137
|
weight,
|
|
@@ -142,7 +142,7 @@ function Text({ className, size, weight, textColor, type, as = "span", copyable,
|
|
|
142
142
|
}, content);
|
|
143
143
|
}
|
|
144
144
|
function Paragraph({ className, size, spacing, as = "p", children, ...props }) {
|
|
145
|
-
return React
|
|
145
|
+
return React.createElement(as, {
|
|
146
146
|
className: cn(paragraphVariants({
|
|
147
147
|
size,
|
|
148
148
|
spacing,
|
|
@@ -163,7 +163,7 @@ function Link({ className, children, href, target = "_self", rel, ...props }) {
|
|
|
163
163
|
}
|
|
164
164
|
function List({ className, as, listType = "unordered", children, ...props }) {
|
|
165
165
|
const Component = as ?? (listType === "ordered" ? "ol" : "ul");
|
|
166
|
-
return React
|
|
166
|
+
return React.createElement(Component, {
|
|
167
167
|
className: cn("space-y-2", listType === "ordered" ? "list-decimal list-inside" : "list-disc list-inside", className),
|
|
168
168
|
...props
|
|
169
169
|
}, children);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
//#region src/components/features/picker/internal/use-deprecation-warning.ts
|
|
3
|
+
const warned = /* @__PURE__ */ new Set();
|
|
4
|
+
/**
|
|
5
|
+
* Logs a one-time `console.warn` in development warning that the legacy
|
|
6
|
+
* component is deprecated and pointing the consumer at the replacement.
|
|
7
|
+
*
|
|
8
|
+
* No-op in `test` and `production` builds. Deduplicated by `legacyName`
|
|
9
|
+
* across the entire session.
|
|
10
|
+
*/
|
|
11
|
+
function useDeprecationWarning(legacyName, replacement) {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
14
|
+
if (warned.has(legacyName)) return;
|
|
15
|
+
warned.add(legacyName);
|
|
16
|
+
console.warn(`[datum-ui] ${legacyName} is deprecated. Use ${replacement} from '@datum-cloud/datum-ui/picker' instead. See picker-migration.mdx.`);
|
|
17
|
+
}, [legacyName, replacement]);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { useDeprecationWarning as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import "zod";
|
|
3
3
|
//#region src/components/features/form/utils/zod-helpers.ts
|
|
4
4
|
/**
|
|
@@ -60,8 +60,8 @@ function isRequired(schema) {
|
|
|
60
60
|
* behaviour across validation modes (onChange, onBlur, onSubmit).
|
|
61
61
|
*/
|
|
62
62
|
function useDisplayTouched(schema) {
|
|
63
|
-
const [touchedSet, setTouchedSet] = React
|
|
64
|
-
const markFieldTouched = React
|
|
63
|
+
const [touchedSet, setTouchedSet] = React.useState(/* @__PURE__ */ new Set());
|
|
64
|
+
const markFieldTouched = React.useCallback((fieldName) => {
|
|
65
65
|
setTouchedSet((prev) => {
|
|
66
66
|
if (prev.has(fieldName)) return prev;
|
|
67
67
|
const next = new Set(prev);
|
|
@@ -69,12 +69,12 @@ function useDisplayTouched(schema) {
|
|
|
69
69
|
return next;
|
|
70
70
|
});
|
|
71
71
|
}, []);
|
|
72
|
-
const markAllFieldsTouched = React
|
|
72
|
+
const markAllFieldsTouched = React.useCallback(() => {
|
|
73
73
|
const allFieldNames = Object.keys(getFieldConstraints(schema));
|
|
74
74
|
setTouchedSet(new Set(allFieldNames));
|
|
75
75
|
}, [schema]);
|
|
76
76
|
return {
|
|
77
|
-
displayTouchedFields: React
|
|
77
|
+
displayTouchedFields: React.useMemo(() => Array.from(touchedSet), [touchedSet]),
|
|
78
78
|
markFieldTouched,
|
|
79
79
|
markAllFieldsTouched
|
|
80
80
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as CommandInput, i as CommandGroup, o as CommandItem, r as CommandEmpty, s as CommandList, t as Command } from "./command-DqHWukGK.mjs";
|
|
2
|
-
import { t as LoaderOverlay } from "./loader-overlay-
|
|
2
|
+
import { t as LoaderOverlay } from "./loader-overlay-B3YEoOFJ.mjs";
|
|
3
3
|
import { CheckIcon } from "lucide-react";
|
|
4
4
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as cn } from "../cn-D2KYQ917.mjs";
|
|
2
|
-
import { n as toUTCTimestampStartOfDay, t as toUTCTimestampEndOfDay } from "../utils-
|
|
2
|
+
import { n as toUTCTimestampStartOfDay, t as toUTCTimestampEndOfDay } from "../utils-bUueJ2r9.mjs";
|
|
3
3
|
export { cn, toUTCTimestampEndOfDay, toUTCTimestampStartOfDay };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as VisuallyHidden } from "../visuallyhidden-
|
|
1
|
+
import { t as VisuallyHidden } from "../visuallyhidden-CoIJOJ9z.mjs";
|
|
2
2
|
export { VisuallyHidden };
|