@jfrader/ui 0.3.0 → 0.5.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 +2 -0
- package/dist/{accordion-Bd-j04hW.js → accordion-xCI_u0BV.js} +2 -2
- package/dist/accordion.js +1 -1
- package/dist/{alert-BBqaKI4k.js → alert-DS_einpy.js} +1 -1
- package/dist/alert.js +1 -1
- package/dist/announcement-bar-B58xempt.js +382 -0
- package/dist/announcement-bar.js +2 -0
- package/dist/avatar-group-DOQQuV51.js +138 -0
- package/dist/avatar-group.js +2 -0
- package/dist/bottom-sheet-DPJBFkie.js +673 -0
- package/dist/bottom-sheet.js +2 -0
- package/dist/{breadcrumbs-DVAOxfvL.js → breadcrumbs-Cfw_hgt2.js} +1 -1
- package/dist/breadcrumbs.js +1 -1
- package/dist/{button-P2e7_44z.js → button-C92uYFJW.js} +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar-B3Svu0X2.js +447 -0
- package/dist/calendar.js +1 -1
- package/dist/carousel-IvPqN-oM.js +472 -0
- package/dist/carousel.js +2 -0
- package/dist/{checkbox-COYG6L7d.js → checkbox-cFquiSdy.js} +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip-group-DTQd_M-G.js +289 -0
- package/dist/chip-group.js +2 -0
- package/dist/code-block/shiki.js +147 -0
- package/dist/code-block-ahnRi-g8.js +292 -0
- package/dist/code-block.js +2 -0
- package/dist/collection-registry-k6JcD3Jr.js +44 -0
- package/dist/combobox-Bhzvu9ma.js +334 -0
- package/dist/combobox.js +1 -1
- package/dist/command-palette-BQ5LleGb.js +384 -0
- package/dist/command-palette.js +1 -1
- package/dist/copy-button-ByiA6D3R.js +252 -0
- package/dist/copy-button.js +2 -0
- package/dist/countdown-Dp_TD1VP.js +293 -0
- package/dist/countdown.js +2 -0
- package/dist/date-picker-5zKSSuFF.js +255 -0
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker-B5uFWsm-.js +562 -0
- package/dist/date-range-picker.js +2 -0
- package/dist/{dialog-xaydbXl2.js → dialog-ciiv9H2b.js} +19 -19
- package/dist/dialog.js +1 -1
- package/dist/drawer-DsASTiP-.js +553 -0
- package/dist/drawer.js +2 -0
- package/dist/empty-state-CDgrjPPf.js +142 -0
- package/dist/empty-state.js +2 -0
- package/dist/expandable-card-C-qJcZ14.js +340 -0
- package/dist/expandable-card.js +2 -0
- package/dist/field-anatomy-COVdNpf5.js +84 -0
- package/dist/file-dropzone-pR4v7owg.js +457 -0
- package/dist/file-dropzone.js +2 -0
- package/dist/filter-toolbar-D5KEKTSe.js +312 -0
- package/dist/filter-toolbar.js +2 -0
- package/dist/hold-to-confirm-DjB2EVjM.js +294 -0
- package/dist/hold-to-confirm.js +2 -0
- package/dist/hover-card-B-nrCIy2.js +347 -0
- package/dist/hover-card.js +2 -0
- package/dist/image-compare-ciuhPtQZ.js +415 -0
- package/dist/image-compare.js +2 -0
- package/dist/index.js +79 -38
- package/dist/inline-edit-C0eeml65.js +535 -0
- package/dist/inline-edit.js +2 -0
- package/dist/input-control-DmMuAuPS.js +34 -0
- package/dist/json-viewer-BcySQfjZ.js +798 -0
- package/dist/json-viewer.js +2 -0
- package/dist/listbox-style-WX-RASp1.js +59 -0
- package/dist/{media-D_eA_I-e.js → media-8yrN85VT.js} +2 -2
- package/dist/mention-input-BcQKX2EJ.js +599 -0
- package/dist/mention-input.js +2 -0
- package/dist/menu-xwOOUtWP.js +275 -0
- package/dist/menu.js +1 -1
- package/dist/metric-card-Bh9K4fZs.js +118 -0
- package/dist/metric-card.js +2 -0
- package/dist/multi-select-Pce_IYnz.js +590 -0
- package/dist/multi-select.js +2 -0
- package/dist/{navigation-DhnKriOp.js → navigation-sP5fiuQS.js} +4 -4
- package/dist/navigation.js +1 -1
- package/dist/overlay-layer-SeUyyEPD.js +64 -0
- package/dist/overlay-portal-C4JZFq2M.js +15 -0
- package/dist/{pagination-DYdwsxwe.js → pagination-DmXZ8E85.js} +1 -1
- package/dist/pagination.js +1 -1
- package/dist/password-field-03pWRkuY.js +250 -0
- package/dist/password-field.js +2 -0
- package/dist/popover-QHcEvf9c.js +119 -0
- package/dist/popover.js +1 -1
- package/dist/{progress-BpJswTG4.js → progress-CbOWBUdA.js} +4 -4
- package/dist/progress.js +1 -1
- package/dist/radio-cards-D2QZENI_.js +455 -0
- package/dist/radio-cards.js +2 -0
- package/dist/{radio-group-Ce0_IWQr.js → radio-group-E6mMRgo7.js} +4 -4
- package/dist/radio-group.js +1 -1
- package/dist/resizable-panels-BhjUVXZZ.js +519 -0
- package/dist/resizable-panels.js +2 -0
- package/dist/scroll-area-CcZyiSOQ.js +371 -0
- package/dist/scroll-area.js +2 -0
- package/dist/search-field-IxF0IJXm.js +274 -0
- package/dist/search-field.js +2 -0
- package/dist/segmented-control-yO1K1nbi.js +326 -0
- package/dist/segmented-control.js +2 -0
- package/dist/select-n_H52W1Z.js +292 -0
- package/dist/select.js +1 -1
- package/dist/signature-pad-q2SAsrdD.js +640 -0
- package/dist/signature-pad.js +2 -0
- package/dist/{skeleton-OoFlOEXO.js → skeleton-XQQDkCHd.js} +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/slider-t0B5cecO.js +477 -0
- package/dist/slider.js +2 -0
- package/dist/sortable-data-table-tirqlLY2.js +365 -0
- package/dist/sortable-data-table.js +2 -0
- package/dist/{spinner-C2YDoiMn.js → spinner-DtxvDPdM.js} +1 -1
- package/dist/spinner.js +1 -1
- package/dist/split-button-Cb3EHs64.js +268 -0
- package/dist/split-button.js +2 -0
- package/dist/stepper-CruHbXxX.js +480 -0
- package/dist/stepper.js +2 -0
- package/dist/swipe-actions-DiZC57-3.js +418 -0
- package/dist/swipe-actions.js +2 -0
- package/dist/{switch-Dr-qjmT4.js → switch-qwv8jQnR.js} +1 -1
- package/dist/switch.js +1 -1
- package/dist/{tabs-CK_g1RKa.js → tabs-CAVJndX1.js} +2 -2
- package/dist/tabs.js +1 -1
- package/dist/tag-input-DSRCyrX2.js +418 -0
- package/dist/tag-input.js +2 -0
- package/dist/{text-field-D60ok14S.js → text-field-C8TWG-tY.js} +6 -5
- package/dist/text-field.js +1 -1
- package/dist/{textarea-DyfjtP0A.js → textarea-BrW0XcG_.js} +6 -5
- package/dist/textarea.js +1 -1
- package/dist/theme-root-BbTBuLMQ.js +46 -0
- package/dist/theme-root.js +1 -1
- package/dist/theme-scope-t7nAKc2c.js +27 -0
- package/dist/time-picker-Db8D49cP.js +305 -0
- package/dist/time-picker.js +2 -0
- package/dist/timeline-k3nURuCP.js +618 -0
- package/dist/timeline.js +2 -0
- package/dist/toast-BHxI32ZA.js +352 -0
- package/dist/toast-stack-DqrAzdg5.js +183 -0
- package/dist/toast-stack.js +2 -0
- package/dist/toast.js +1 -1
- package/dist/{toggle-group-CI0e7hFm.js → toggle-group-fcjzpifI.js} +4 -4
- package/dist/toggle-group.js +1 -1
- package/dist/tooltip-CkeiW9C1.js +113 -0
- package/dist/tooltip.js +1 -1
- package/dist/tree-view-C2liIxqy.js +360 -0
- package/dist/tree-view.js +2 -0
- package/dist/types/components/announcement-bar/announcement-bar.d.ts +75 -0
- package/dist/types/components/announcement-bar/index.d.ts +2 -0
- package/dist/types/components/avatar-group/avatar-group.d.ts +43 -0
- package/dist/types/components/avatar-group/index.d.ts +2 -0
- package/dist/types/components/bottom-sheet/bottom-sheet.d.ts +60 -0
- package/dist/types/components/bottom-sheet/index.d.ts +2 -0
- package/dist/types/components/calendar/calendar.d.ts +25 -1
- package/dist/types/components/calendar/index.d.ts +1 -1
- package/dist/types/components/carousel/carousel.d.ts +73 -0
- package/dist/types/components/carousel/index.d.ts +2 -0
- package/dist/types/components/chip-group/chip-group.d.ts +54 -0
- package/dist/types/components/chip-group/index.d.ts +1 -0
- package/dist/types/components/code-block/code-block.d.ts +58 -0
- package/dist/types/components/code-block/index.d.ts +1 -0
- package/dist/types/components/code-block/shiki.d.ts +3 -0
- package/dist/types/components/combobox/combobox.d.ts +1 -1
- package/dist/types/components/command-palette/command-palette.d.ts +1 -1
- package/dist/types/components/copy-button/copy-button.d.ts +49 -0
- package/dist/types/components/copy-button/index.d.ts +2 -0
- package/dist/types/components/countdown/countdown.d.ts +37 -0
- package/dist/types/components/countdown/index.d.ts +1 -0
- package/dist/types/components/date-picker/date-picker.d.ts +1 -1
- package/dist/types/components/date-range-picker/date-range-picker.d.ts +103 -0
- package/dist/types/components/date-range-picker/index.d.ts +2 -0
- package/dist/types/components/drawer/drawer.d.ts +59 -0
- package/dist/types/components/drawer/index.d.ts +2 -0
- package/dist/types/components/empty-state/empty-state.d.ts +36 -0
- package/dist/types/components/empty-state/index.d.ts +2 -0
- package/dist/types/components/expandable-card/expandable-card.d.ts +28 -0
- package/dist/types/components/expandable-card/index.d.ts +2 -0
- package/dist/types/components/field/field-anatomy.d.ts +4 -2
- package/dist/types/components/file-dropzone/file-dropzone.d.ts +93 -0
- package/dist/types/components/file-dropzone/index.d.ts +2 -0
- package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +70 -0
- package/dist/types/components/filter-toolbar/index.d.ts +1 -0
- package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +32 -0
- package/dist/types/components/hold-to-confirm/index.d.ts +2 -0
- package/dist/types/components/hover-card/hover-card.d.ts +97 -0
- package/dist/types/components/hover-card/index.d.ts +2 -0
- package/dist/types/components/image-compare/image-compare.d.ts +54 -0
- package/dist/types/components/image-compare/index.d.ts +1 -0
- package/dist/types/components/inline-edit/index.d.ts +2 -0
- package/dist/types/components/inline-edit/inline-edit.d.ts +93 -0
- package/dist/types/components/json-viewer/index.d.ts +2 -0
- package/dist/types/components/json-viewer/json-viewer.d.ts +82 -0
- package/dist/types/components/mention-input/index.d.ts +2 -0
- package/dist/types/components/mention-input/mention-input.d.ts +87 -0
- package/dist/types/components/menu/menu.d.ts +23 -5
- package/dist/types/components/metric-card/index.d.ts +1 -0
- package/dist/types/components/metric-card/metric-card.d.ts +37 -0
- package/dist/types/components/multi-select/index.d.ts +2 -0
- package/dist/types/components/multi-select/multi-select.d.ts +73 -0
- package/dist/types/components/password-field/index.d.ts +2 -0
- package/dist/types/components/password-field/password-field.d.ts +34 -0
- package/dist/types/components/popover/popover.d.ts +1 -1
- package/dist/types/components/radio-cards/index.d.ts +1 -0
- package/dist/types/components/radio-cards/radio-cards.d.ts +42 -0
- package/dist/types/components/resizable-panels/index.d.ts +2 -0
- package/dist/types/components/resizable-panels/resizable-panels.d.ts +42 -0
- package/dist/types/components/scroll-area/index.d.ts +2 -0
- package/dist/types/components/scroll-area/scroll-area.d.ts +34 -0
- package/dist/types/components/search-field/index.d.ts +1 -0
- package/dist/types/components/search-field/search-field.d.ts +31 -0
- package/dist/types/components/segmented-control/index.d.ts +2 -0
- package/dist/types/components/segmented-control/segmented-control.d.ts +32 -0
- package/dist/types/components/select/select.d.ts +1 -1
- package/dist/types/components/signature-pad/index.d.ts +2 -0
- package/dist/types/components/signature-pad/signature-pad.d.ts +104 -0
- package/dist/types/components/slider/index.d.ts +1 -0
- package/dist/types/components/slider/slider.d.ts +70 -0
- package/dist/types/components/sortable-data-table/index.d.ts +1 -0
- package/dist/types/components/sortable-data-table/sortable-data-table.d.ts +76 -0
- package/dist/types/components/split-button/index.d.ts +2 -0
- package/dist/types/components/split-button/split-button.d.ts +55 -0
- package/dist/types/components/stepper/index.d.ts +2 -0
- package/dist/types/components/stepper/stepper.d.ts +85 -0
- package/dist/types/components/swipe-actions/index.d.ts +2 -0
- package/dist/types/components/swipe-actions/swipe-actions.d.ts +44 -0
- package/dist/types/components/tag-input/index.d.ts +2 -0
- package/dist/types/components/tag-input/tag-input.d.ts +66 -0
- package/dist/types/components/theme-root/theme-root.d.ts +9 -3
- package/dist/types/components/time-picker/index.d.ts +2 -0
- package/dist/types/components/time-picker/time-picker.d.ts +48 -0
- package/dist/types/components/timeline/index.d.ts +2 -0
- package/dist/types/components/timeline/timeline.d.ts +66 -0
- package/dist/types/components/toast/toast.d.ts +37 -2
- package/dist/types/components/toast-stack/index.d.ts +2 -0
- package/dist/types/components/toast-stack/toast-stack.d.ts +28 -0
- package/dist/types/components/tooltip/tooltip.d.ts +1 -1
- package/dist/types/components/tree-view/index.d.ts +1 -0
- package/dist/types/components/tree-view/tree-view.d.ts +47 -0
- package/dist/types/components/usage-meter/index.d.ts +2 -0
- package/dist/types/components/usage-meter/usage-meter.d.ts +83 -0
- package/dist/types/index.d.ts +40 -0
- package/dist/types/overlay/overlay-layer.d.ts +33 -0
- package/dist/types/overlay/overlay-portal.d.ts +7 -0
- package/dist/types/overlay/use-overlay-floating.d.ts +11 -1
- package/dist/types/styling/media.d.ts +1 -0
- package/dist/types/styling/theme-scope.d.ts +19 -0
- package/dist/types/styling/theme.d.ts +12 -0
- package/dist/types/utils/use-controlled-state.d.ts +2 -1
- package/dist/usage-meter-qyQ3rYVv.js +463 -0
- package/dist/usage-meter.js +2 -0
- package/dist/use-controlled-state-DpeVQZNR.js +20 -0
- package/dist/use-latest-callback-cj1OOQL6.js +11 -0
- package/dist/use-overlay-floating-DvJifLpF.js +31 -0
- package/package.json +175 -3
- package/dist/calendar-C9Yad_-w.js +0 -394
- package/dist/collection-registry-BTYi6zGh.js +0 -98
- package/dist/combobox-DrmjBbo7.js +0 -327
- package/dist/command-palette-V_2pEay7.js +0 -379
- package/dist/date-picker-ClUYBIBh.js +0 -250
- package/dist/field-anatomy-D2ToMeRa.js +0 -109
- package/dist/menu-DU60SMdt.js +0 -216
- package/dist/popover-BtN_0ejj.js +0 -113
- package/dist/select-BCS0-LVW.js +0 -286
- package/dist/theme-root-BiXXvQvr.js +0 -42
- package/dist/toast-iqelR-r0.js +0 -282
- package/dist/tooltip-CB-HC1js.js +0 -108
- package/dist/use-controlled-state-CVXDa-qM.js +0 -21
- package/dist/use-overlay-floating-efeqppiw.js +0 -19
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as r } from "./use-controlled-state-DpeVQZNR.js";
|
|
5
|
+
import { t as i } from "./renderable-DzcIj1Lo.js";
|
|
6
|
+
import { t as a } from "./icon-wrapper-stN8sD7R.js";
|
|
7
|
+
import { a as o } from "./field-anatomy-COVdNpf5.js";
|
|
8
|
+
import { t as s } from "./select-n_H52W1Z.js";
|
|
9
|
+
import { useEffect as c, useId as ee, useMemo as te, useRef as l, useState as ne } from "react";
|
|
10
|
+
import { vars as u } from "@jfrader/tokens/vars";
|
|
11
|
+
import { createElement as re } from "@emotion/react";
|
|
12
|
+
import { jsx as d, jsxs as f } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import { useMergeRefs as p } from "@floating-ui/react";
|
|
14
|
+
//#region src/components/time-picker/time-picker.tsx
|
|
15
|
+
var m = 60, ie = 1440, ae = 6e4, h = "250px", oe = "09:00", se = 8, ce = 8, g = /^([01]\d|2[0-3]):([0-5]\d)$/, le = () => typeof navigator > "u" ? void 0 : navigator.language;
|
|
16
|
+
function _(e) {
|
|
17
|
+
if (e !== void 0 && g.test(e)) return Number(e.slice(0, 2)) * m + Number(e.slice(3));
|
|
18
|
+
}
|
|
19
|
+
function ue(e) {
|
|
20
|
+
return `${String(Math.floor(e / m)).padStart(2, "0")}:${String(e % m).padStart(2, "0")}`;
|
|
21
|
+
}
|
|
22
|
+
function v(e, t) {
|
|
23
|
+
e.offsetTop < t.scrollTop ? t.scrollTop = e.offsetTop : e.offsetTop + e.offsetHeight > t.scrollTop + t.clientHeight && (t.scrollTop = e.offsetTop + e.offsetHeight - t.clientHeight);
|
|
24
|
+
}
|
|
25
|
+
var de = e({
|
|
26
|
+
display: "grid",
|
|
27
|
+
gap: u.space[1],
|
|
28
|
+
inlineSize: "100%"
|
|
29
|
+
}), fe = e({
|
|
30
|
+
fontSize: u.textSize.sm,
|
|
31
|
+
fontWeight: u.fontWeight.medium,
|
|
32
|
+
color: u.color.text
|
|
33
|
+
}), pe = e({
|
|
34
|
+
fontSize: u.textSize.sm,
|
|
35
|
+
color: u.color.textMuted
|
|
36
|
+
}), y = e({
|
|
37
|
+
fontSize: u.textSize.sm,
|
|
38
|
+
color: u.color.dangerText
|
|
39
|
+
}), me = e({
|
|
40
|
+
minInlineSize: u.space[12],
|
|
41
|
+
inlineSize: "100%",
|
|
42
|
+
gap: u.space[2],
|
|
43
|
+
"&[aria-invalid=\"true\"]": { borderColor: u.color.dangerText },
|
|
44
|
+
[n]: {
|
|
45
|
+
backgroundColor: "Canvas",
|
|
46
|
+
color: "CanvasText",
|
|
47
|
+
borderColor: "CanvasText",
|
|
48
|
+
"&:focus-visible": { outlineColor: "Highlight" }
|
|
49
|
+
}
|
|
50
|
+
}), he = {
|
|
51
|
+
sm: e({
|
|
52
|
+
minBlockSize: u.space[8],
|
|
53
|
+
paddingInline: u.space[3],
|
|
54
|
+
fontSize: u.textSize.sm
|
|
55
|
+
}),
|
|
56
|
+
md: e({
|
|
57
|
+
minBlockSize: u.space[10],
|
|
58
|
+
paddingInline: u.space[4],
|
|
59
|
+
fontSize: u.textSize.sm
|
|
60
|
+
}),
|
|
61
|
+
lg: e({
|
|
62
|
+
minBlockSize: u.space[12],
|
|
63
|
+
paddingInline: u.space[4],
|
|
64
|
+
fontSize: u.textSize.md
|
|
65
|
+
})
|
|
66
|
+
}, ge = e({
|
|
67
|
+
flex: 1,
|
|
68
|
+
minInlineSize: 0,
|
|
69
|
+
textAlign: "start",
|
|
70
|
+
overflow: "hidden",
|
|
71
|
+
textOverflow: "ellipsis",
|
|
72
|
+
whiteSpace: "nowrap",
|
|
73
|
+
"&[data-placeholder]": { color: u.color.textMuted }
|
|
74
|
+
}), _e = e({
|
|
75
|
+
inlineSize: "var(--time-picker-inline-size)",
|
|
76
|
+
minInlineSize: 0,
|
|
77
|
+
maxInlineSize: "calc(100vw - 16px)",
|
|
78
|
+
maxBlockSize: `min(${h}, var(--time-picker-available-height, ${h}))`,
|
|
79
|
+
overscrollBehavior: "contain",
|
|
80
|
+
[n]: {
|
|
81
|
+
backgroundColor: "Canvas",
|
|
82
|
+
color: "CanvasText",
|
|
83
|
+
borderColor: "CanvasText"
|
|
84
|
+
}
|
|
85
|
+
}), ve = e({
|
|
86
|
+
minBlockSize: u.space[8],
|
|
87
|
+
[n]: {
|
|
88
|
+
"&[data-active]": { outlineColor: "Highlight" },
|
|
89
|
+
"&[aria-selected=\"true\"]": { border: "1px solid Highlight" }
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
function b({ ref: e, value: n, defaultValue: u = oe, onValueChange: m, open: h, defaultOpen: g = !1, onOpenChange: b, minuteStep: x = 15, min: S, max: C, locale: ye, hourCycle: w, label: T, description: E, error: D, placeholder: be, size: xe = "md", disabled: Se = !1, readOnly: O = !1, required: k = !1, name: Ce, icon: A, slotProps: j, className: we, sx: Te, dir: M, id: Ee, onClick: De, onKeyDown: Oe, onBlur: ke, ...N }) {
|
|
93
|
+
let P = l(u).current, [F = "", I, L] = r(n, P, m), [Ae = !1, je] = r(h, g, b), R = Se || j?.control?.disabled === !0, z = R || O, B = Ae && !z, V = l(null), H = l(null), [U, Me] = ne(null), W = l(!1), Ne = p([
|
|
94
|
+
V,
|
|
95
|
+
e,
|
|
96
|
+
j?.control?.ref
|
|
97
|
+
]), Pe = p([
|
|
98
|
+
H,
|
|
99
|
+
Me,
|
|
100
|
+
j?.content?.ref
|
|
101
|
+
]), G = `${ee()}-label`, K = te(() => new Intl.DateTimeFormat(ye ?? le(), {
|
|
102
|
+
hour: "numeric",
|
|
103
|
+
minute: "2-digit",
|
|
104
|
+
timeZone: "UTC",
|
|
105
|
+
...w === void 0 ? {} : { hourCycle: w }
|
|
106
|
+
}), [ye, w]), q = _(S), J = _(C), Y = S !== void 0 && q === void 0 || C !== void 0 && J === void 0 || q !== void 0 && J !== void 0 && q > J, X = te(() => Y ? [] : Array.from({ length: ie / x }, (e, t) => t * x).filter((e) => e >= (q ?? 0) && e <= (J ?? 1439)).map((e) => ({
|
|
107
|
+
time: e,
|
|
108
|
+
value: ue(e),
|
|
109
|
+
label: K.format(/* @__PURE__ */ new Date(e * ae))
|
|
110
|
+
})), [
|
|
111
|
+
x,
|
|
112
|
+
q,
|
|
113
|
+
J,
|
|
114
|
+
Y,
|
|
115
|
+
K
|
|
116
|
+
]), Z = _(F), Fe = Y || F !== "" && Z === void 0, Q = j?.control, $ = o({
|
|
117
|
+
id: Ee ?? Q?.id,
|
|
118
|
+
description: E,
|
|
119
|
+
error: D,
|
|
120
|
+
"aria-describedby": [N["aria-describedby"], Q?.["aria-describedby"]].filter(Boolean).join(" ") || void 0,
|
|
121
|
+
"aria-invalid": Fe ? !0 : N["aria-invalid"] ?? Q?.["aria-invalid"]
|
|
122
|
+
}), Ie = [
|
|
123
|
+
N["aria-labelledby"],
|
|
124
|
+
Q?.["aria-labelledby"],
|
|
125
|
+
i(T) && G
|
|
126
|
+
].filter(Boolean).join(" ") || void 0, Le = Z === void 0 ? be : K.format(/* @__PURE__ */ new Date(Z * ae));
|
|
127
|
+
return c(() => {
|
|
128
|
+
let e = V.current?.form;
|
|
129
|
+
if (!e) return;
|
|
130
|
+
let t = (e) => {
|
|
131
|
+
queueMicrotask(() => {
|
|
132
|
+
e.defaultPrevented || (n === void 0 ? L() : I(P));
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
136
|
+
}, [
|
|
137
|
+
n,
|
|
138
|
+
I,
|
|
139
|
+
L,
|
|
140
|
+
P,
|
|
141
|
+
N.form,
|
|
142
|
+
Q?.form
|
|
143
|
+
]), c(() => {
|
|
144
|
+
if (!B) return;
|
|
145
|
+
let e = V.current, t = U, n = e?.ownerDocument.defaultView;
|
|
146
|
+
if (!e || !t || !n) return;
|
|
147
|
+
let r = () => {
|
|
148
|
+
let r = e.getBoundingClientRect(), i = Math.max(r.top - ce - se, n.innerHeight - r.bottom - ce - se);
|
|
149
|
+
t.dir = n.getComputedStyle(e).direction, t.style.setProperty("--time-picker-inline-size", `${r.width}px`), t.style.setProperty("--time-picker-available-height", `${Math.max(0, Math.min(i, n.innerHeight - 16))}px`);
|
|
150
|
+
};
|
|
151
|
+
r();
|
|
152
|
+
let i = new ResizeObserver(r);
|
|
153
|
+
i.observe(e), n.addEventListener("resize", r);
|
|
154
|
+
let a = !1, o = () => {
|
|
155
|
+
let e = t.querySelector("[data-active]");
|
|
156
|
+
if (!e) return;
|
|
157
|
+
let n = e.offsetTop;
|
|
158
|
+
a ? v(e, t) : (t.scrollTop = n - (t.clientHeight - e.offsetHeight) / 2, a = !0);
|
|
159
|
+
}, s = new MutationObserver(o);
|
|
160
|
+
s.observe(t, {
|
|
161
|
+
attributes: !0,
|
|
162
|
+
subtree: !0,
|
|
163
|
+
attributeFilter: ["data-active"]
|
|
164
|
+
});
|
|
165
|
+
let c = n.requestAnimationFrame(() => {
|
|
166
|
+
if (!W.current && Z !== void 0 && !X.some((e) => e.value === F)) {
|
|
167
|
+
let e = X.find((e) => e.time >= Z) ?? X.at(-1);
|
|
168
|
+
(e && t.querySelector(`[data-time="${e.value}"]`))?.dispatchEvent(new n.MouseEvent("mousemove", { bubbles: !0 }));
|
|
169
|
+
}
|
|
170
|
+
o();
|
|
171
|
+
});
|
|
172
|
+
return () => {
|
|
173
|
+
i.disconnect(), s.disconnect(), n.removeEventListener("resize", r), n.cancelAnimationFrame(c);
|
|
174
|
+
};
|
|
175
|
+
}, [
|
|
176
|
+
B,
|
|
177
|
+
U,
|
|
178
|
+
Z,
|
|
179
|
+
X,
|
|
180
|
+
F,
|
|
181
|
+
M,
|
|
182
|
+
Q?.dir,
|
|
183
|
+
j?.root?.dir
|
|
184
|
+
]), /* @__PURE__ */ d(t, {
|
|
185
|
+
className: [we, j?.root?.className].filter(Boolean).join(" "),
|
|
186
|
+
styles: [de, j?.root?.css],
|
|
187
|
+
sx: Te,
|
|
188
|
+
children: (e) => /* @__PURE__ */ f("div", {
|
|
189
|
+
...j?.root,
|
|
190
|
+
css: void 0,
|
|
191
|
+
className: e,
|
|
192
|
+
dir: M ?? j?.root?.dir,
|
|
193
|
+
"data-ui": "time-picker",
|
|
194
|
+
children: [
|
|
195
|
+
i(T) && /* @__PURE__ */ f("label", {
|
|
196
|
+
...j?.label,
|
|
197
|
+
id: G,
|
|
198
|
+
htmlFor: $.id,
|
|
199
|
+
css: [fe, j?.label?.css],
|
|
200
|
+
children: [T, k && /* @__PURE__ */ f("span", {
|
|
201
|
+
"aria-hidden": !0,
|
|
202
|
+
css: y,
|
|
203
|
+
children: [" ", "*"]
|
|
204
|
+
})]
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ f(s, {
|
|
207
|
+
value: F,
|
|
208
|
+
onValueChange: I,
|
|
209
|
+
open: B,
|
|
210
|
+
onOpenChange: (e) => {
|
|
211
|
+
!z && (X.length > 0 || !e) && je(e);
|
|
212
|
+
},
|
|
213
|
+
name: Ce,
|
|
214
|
+
disabled: R,
|
|
215
|
+
children: [/* @__PURE__ */ f(s.Trigger, {
|
|
216
|
+
...Q,
|
|
217
|
+
...N,
|
|
218
|
+
ref: Ne,
|
|
219
|
+
id: $.id,
|
|
220
|
+
disabled: R,
|
|
221
|
+
dir: M ?? Q?.dir,
|
|
222
|
+
"aria-label": N["aria-label"] ?? Q?.["aria-label"],
|
|
223
|
+
"aria-labelledby": Ie,
|
|
224
|
+
"aria-describedby": $.describedBy,
|
|
225
|
+
"aria-invalid": $.ariaInvalid,
|
|
226
|
+
"aria-readonly": O || N["aria-readonly"] || Q?.["aria-readonly"],
|
|
227
|
+
"aria-required": k || N["aria-required"] || Q?.["aria-required"],
|
|
228
|
+
css: [
|
|
229
|
+
me,
|
|
230
|
+
he[xe],
|
|
231
|
+
Q?.css
|
|
232
|
+
],
|
|
233
|
+
onClick: void 0,
|
|
234
|
+
onKeyDown: void 0,
|
|
235
|
+
onClickCapture: (e) => {
|
|
236
|
+
Q?.onClickCapture?.(e), N.onClickCapture?.(e), Q?.onClick?.(e), De?.(e), B || (W.current = !1), (z || X.length === 0) && e.preventDefault(), e.defaultPrevented && e.stopPropagation();
|
|
237
|
+
},
|
|
238
|
+
onKeyDownCapture: (e) => {
|
|
239
|
+
Q?.onKeyDownCapture?.(e), N.onKeyDownCapture?.(e), Q?.onKeyDown?.(e), Oe?.(e), B || (W.current = e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.altKey && !e.metaKey), (z || X.length === 0) && e.key !== "Tab" && e.preventDefault(), e.defaultPrevented && e.stopPropagation();
|
|
240
|
+
},
|
|
241
|
+
onBlur: (e) => {
|
|
242
|
+
Q?.onBlur?.(e), ke?.(e);
|
|
243
|
+
},
|
|
244
|
+
children: [
|
|
245
|
+
i(A) && /* @__PURE__ */ d("span", {
|
|
246
|
+
...j?.icon,
|
|
247
|
+
"aria-hidden": !0,
|
|
248
|
+
css: [a, j?.icon?.css],
|
|
249
|
+
children: A
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ d("span", {
|
|
252
|
+
css: ge,
|
|
253
|
+
"data-placeholder": Z === void 0 || void 0,
|
|
254
|
+
children: Le
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ d("span", {
|
|
257
|
+
"aria-hidden": !0,
|
|
258
|
+
children: "▾"
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
}), /* @__PURE__ */ d(s.Content, {
|
|
262
|
+
...j?.content,
|
|
263
|
+
ref: Pe,
|
|
264
|
+
dir: M,
|
|
265
|
+
css: [_e, j?.content?.css],
|
|
266
|
+
children: X.map((e) => /* @__PURE__ */ re(s.Item, {
|
|
267
|
+
...j?.option,
|
|
268
|
+
key: e.value,
|
|
269
|
+
value: e.value,
|
|
270
|
+
"data-time": e.value,
|
|
271
|
+
css: [ve, j?.option?.css],
|
|
272
|
+
ref: (e) => {
|
|
273
|
+
let t = j?.option?.ref, n = typeof t == "function" ? t(e) : void 0;
|
|
274
|
+
if (t && typeof t != "function" && (t.current = e), !e) return n;
|
|
275
|
+
let r = e.scrollIntoView;
|
|
276
|
+
return e.scrollIntoView = () => {
|
|
277
|
+
let t = H.current;
|
|
278
|
+
t && v(e, t);
|
|
279
|
+
}, () => {
|
|
280
|
+
e.scrollIntoView = r, typeof n == "function" ? n() : typeof t == "function" ? t(null) : t && (t.current = null);
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}, e.label))
|
|
284
|
+
})]
|
|
285
|
+
}),
|
|
286
|
+
i(E) && /* @__PURE__ */ d("span", {
|
|
287
|
+
...j?.description,
|
|
288
|
+
id: $.descriptionId,
|
|
289
|
+
css: [pe, j?.description?.css],
|
|
290
|
+
children: E
|
|
291
|
+
}),
|
|
292
|
+
i(D) && /* @__PURE__ */ d("span", {
|
|
293
|
+
...j?.error,
|
|
294
|
+
id: $.errorId,
|
|
295
|
+
role: "alert",
|
|
296
|
+
css: [y, j?.error?.css],
|
|
297
|
+
children: D
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
})
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
b.displayName = "TimePicker";
|
|
304
|
+
//#endregion
|
|
305
|
+
export { b as t };
|