@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,447 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { n as r, r as i } from "./media-8yrN85VT.js";
|
|
5
|
+
import { t as a } from "./use-latest-callback-cj1OOQL6.js";
|
|
6
|
+
import { t as o } from "./use-controlled-state-DpeVQZNR.js";
|
|
7
|
+
import { createContext as s, useContext as c, useEffect as l, useId as u, useImperativeHandle as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
8
|
+
import { vars as g } from "@jfrader/tokens/vars";
|
|
9
|
+
import { Fragment as _, jsx as v, jsxs as y } from "@emotion/react/jsx-runtime";
|
|
10
|
+
//#region src/components/calendar/calendar.styles.ts
|
|
11
|
+
var b = e({
|
|
12
|
+
display: "inline-flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
gap: g.space[2],
|
|
15
|
+
fontFamily: g.font.sans,
|
|
16
|
+
color: g.color.text
|
|
17
|
+
}), x = e({
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
gap: g.space[2]
|
|
21
|
+
}), S = e({
|
|
22
|
+
flex: 1,
|
|
23
|
+
textAlign: "center",
|
|
24
|
+
fontSize: g.textSize.sm,
|
|
25
|
+
fontWeight: g.fontWeight.semibold
|
|
26
|
+
}), C = {
|
|
27
|
+
transitionDuration: g.motion.duration.fast,
|
|
28
|
+
transitionTimingFunction: g.motion.easeStandard,
|
|
29
|
+
[i]: { transitionDuration: "0s" }
|
|
30
|
+
}, w = e({
|
|
31
|
+
appearance: "none",
|
|
32
|
+
display: "inline-flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
inlineSize: "32px",
|
|
36
|
+
blockSize: "32px",
|
|
37
|
+
padding: 0,
|
|
38
|
+
border: `1px solid ${g.color.borderControl}`,
|
|
39
|
+
borderRadius: g.radius.sm,
|
|
40
|
+
backgroundColor: "transparent",
|
|
41
|
+
font: "inherit",
|
|
42
|
+
fontSize: g.textSize.lg,
|
|
43
|
+
lineHeight: 1,
|
|
44
|
+
color: g.color.text,
|
|
45
|
+
cursor: "pointer",
|
|
46
|
+
transitionProperty: "background-color",
|
|
47
|
+
...C,
|
|
48
|
+
"&:hover:not([aria-disabled=\"true\"])": { backgroundColor: g.color.surfaceHover },
|
|
49
|
+
"&[aria-disabled=\"true\"]": {
|
|
50
|
+
opacity: .55,
|
|
51
|
+
cursor: "not-allowed"
|
|
52
|
+
},
|
|
53
|
+
"&:focus-visible": { ...n }
|
|
54
|
+
}), T = e({
|
|
55
|
+
display: "inline-block",
|
|
56
|
+
"&:dir(rtl)": { transform: "scaleX(-1)" }
|
|
57
|
+
}), ee = e({
|
|
58
|
+
borderCollapse: "separate",
|
|
59
|
+
borderSpacing: g.space[1],
|
|
60
|
+
marginInline: `calc(-1 * ${g.space[1]})`
|
|
61
|
+
}), E = e({
|
|
62
|
+
paddingBlock: g.space[1],
|
|
63
|
+
fontSize: g.textSize.xs,
|
|
64
|
+
fontWeight: g.fontWeight.medium,
|
|
65
|
+
color: g.color.textMuted,
|
|
66
|
+
textAlign: "center"
|
|
67
|
+
}), te = e({ padding: 0 }), ne = e({
|
|
68
|
+
appearance: "none",
|
|
69
|
+
display: "inline-flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
inlineSize: "36px",
|
|
73
|
+
blockSize: "36px",
|
|
74
|
+
padding: 0,
|
|
75
|
+
border: "1px solid transparent",
|
|
76
|
+
borderRadius: g.radius.sm,
|
|
77
|
+
backgroundColor: "transparent",
|
|
78
|
+
font: "inherit",
|
|
79
|
+
fontSize: g.textSize.sm,
|
|
80
|
+
fontVariantNumeric: "tabular-nums",
|
|
81
|
+
color: g.color.text,
|
|
82
|
+
cursor: "pointer",
|
|
83
|
+
transitionProperty: "background-color, border-color, color",
|
|
84
|
+
...C,
|
|
85
|
+
"&:hover:not(:disabled):not([data-selected]):not([data-in-range])": { backgroundColor: g.color.surfaceHover },
|
|
86
|
+
"&[data-today]": {
|
|
87
|
+
borderColor: g.color.borderControl,
|
|
88
|
+
fontWeight: g.fontWeight.semibold
|
|
89
|
+
},
|
|
90
|
+
"&[data-selected]": {
|
|
91
|
+
backgroundColor: g.color.accent,
|
|
92
|
+
borderColor: g.color.accent,
|
|
93
|
+
color: g.color.accentContrast,
|
|
94
|
+
fontWeight: g.fontWeight.semibold
|
|
95
|
+
},
|
|
96
|
+
"&[data-selected]:hover": { backgroundColor: g.color.accentHover },
|
|
97
|
+
"&[data-in-range]": {
|
|
98
|
+
backgroundColor: g.color.accentSoft,
|
|
99
|
+
borderColor: g.color.accentBorder
|
|
100
|
+
},
|
|
101
|
+
"&[data-preview]:not([data-in-range])": {
|
|
102
|
+
borderStyle: "dashed",
|
|
103
|
+
borderColor: g.color.accentText
|
|
104
|
+
},
|
|
105
|
+
"&[data-range-start], &[data-range-end]": {
|
|
106
|
+
backgroundColor: g.color.accent,
|
|
107
|
+
borderColor: g.color.accent,
|
|
108
|
+
color: g.color.accentContrast,
|
|
109
|
+
fontWeight: g.fontWeight.semibold
|
|
110
|
+
},
|
|
111
|
+
"&[data-range-start]:hover, &[data-range-end]:hover": { backgroundColor: g.color.accentHover },
|
|
112
|
+
"&:disabled": {
|
|
113
|
+
opacity: .55,
|
|
114
|
+
cursor: "not-allowed",
|
|
115
|
+
textDecoration: "line-through"
|
|
116
|
+
},
|
|
117
|
+
"&:focus-visible": { ...n },
|
|
118
|
+
[r]: {
|
|
119
|
+
"&[data-in-range], &[data-preview]": { borderColor: "CanvasText" },
|
|
120
|
+
"&[data-selected], &[data-range-start], &[data-range-end]": {
|
|
121
|
+
forcedColorAdjust: "none",
|
|
122
|
+
backgroundColor: "Highlight",
|
|
123
|
+
borderColor: "Highlight",
|
|
124
|
+
color: "HighlightText"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}), D = /^\d{4}-\d{2}-\d{2}$/, O = /^\d{4}-\d{2}$/, k = 12, A = 0, re = "2026-01-04", j = (e, t) => String(e).padStart(t, "0");
|
|
128
|
+
function M(e, t, n) {
|
|
129
|
+
let r = new Date(Date.UTC(0, 0, 1));
|
|
130
|
+
return r.setUTCFullYear(e, t, n), r;
|
|
131
|
+
}
|
|
132
|
+
function N(e) {
|
|
133
|
+
let [t = NaN, n = NaN, r = 1] = e.split("-").map(Number);
|
|
134
|
+
return M(t, n - 1, r);
|
|
135
|
+
}
|
|
136
|
+
var P = (e) => `${j(e.getUTCFullYear(), 4)}-${j(e.getUTCMonth() + 1, 2)}-${j(e.getUTCDate(), 2)}`, F = (e) => e !== void 0 && D.test(e) && P(N(e)) === e, ie = (e) => e !== void 0 && O.test(e) && F(`${e}-01`), I = (e) => e.slice(0, 7), L = (e) => `${e}-01`;
|
|
137
|
+
function R(e, t) {
|
|
138
|
+
let n = N(e);
|
|
139
|
+
return P(M(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate() + t));
|
|
140
|
+
}
|
|
141
|
+
function z(e, t) {
|
|
142
|
+
let n = N(e), r = M(n.getUTCFullYear(), n.getUTCMonth() + t, 1), i = M(r.getUTCFullYear(), r.getUTCMonth() + 1, 0).getUTCDate();
|
|
143
|
+
return P(M(r.getUTCFullYear(), r.getUTCMonth(), Math.min(n.getUTCDate(), i)));
|
|
144
|
+
}
|
|
145
|
+
var B = (e, t) => I(z(L(e), t)), V = (e) => R(L(B(e, 1)), -1), H = (e, t, n) => (t === void 0 || e >= t) && (n === void 0 || e <= n);
|
|
146
|
+
function U(e, t, n) {
|
|
147
|
+
return t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
|
|
148
|
+
}
|
|
149
|
+
var W = (e, t) => (N(e).getUTCDay() - t + 7) % 7;
|
|
150
|
+
function ae(e) {
|
|
151
|
+
let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
|
|
152
|
+
return n ? n.firstDay % 7 : A;
|
|
153
|
+
}
|
|
154
|
+
var G = {
|
|
155
|
+
calendar: "gregory",
|
|
156
|
+
timeZone: "UTC"
|
|
157
|
+
};
|
|
158
|
+
function oe(e) {
|
|
159
|
+
return {
|
|
160
|
+
month: new Intl.DateTimeFormat(e, {
|
|
161
|
+
...G,
|
|
162
|
+
month: "long",
|
|
163
|
+
year: "numeric"
|
|
164
|
+
}),
|
|
165
|
+
day: new Intl.DateTimeFormat(e, {
|
|
166
|
+
...G,
|
|
167
|
+
day: "numeric"
|
|
168
|
+
}),
|
|
169
|
+
date: new Intl.DateTimeFormat(e, {
|
|
170
|
+
...G,
|
|
171
|
+
dateStyle: "long"
|
|
172
|
+
}),
|
|
173
|
+
weekdayShort: new Intl.DateTimeFormat(e, {
|
|
174
|
+
...G,
|
|
175
|
+
weekday: "short"
|
|
176
|
+
}),
|
|
177
|
+
weekdayLong: new Intl.DateTimeFormat(e, {
|
|
178
|
+
...G,
|
|
179
|
+
weekday: "long"
|
|
180
|
+
})
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
var K = () => typeof navigator > "u" ? void 0 : navigator.language, q = (e) => (t) => R(t, e), J = (e) => (t, { shiftKey: n }) => z(t, n ? e * k : e), Y = {
|
|
184
|
+
ArrowDown: q(7),
|
|
185
|
+
ArrowUp: q(-7),
|
|
186
|
+
Home: (e, { firstDayOfWeek: t }) => R(e, -W(e, t)),
|
|
187
|
+
End: (e, { firstDayOfWeek: t }) => R(e, 6 - W(e, t)),
|
|
188
|
+
PageUp: J(-1),
|
|
189
|
+
PageDown: J(1)
|
|
190
|
+
}, X = {
|
|
191
|
+
ltr: {
|
|
192
|
+
...Y,
|
|
193
|
+
ArrowRight: q(1),
|
|
194
|
+
ArrowLeft: q(-1)
|
|
195
|
+
},
|
|
196
|
+
rtl: {
|
|
197
|
+
...Y,
|
|
198
|
+
ArrowRight: q(-1),
|
|
199
|
+
ArrowLeft: q(1)
|
|
200
|
+
}
|
|
201
|
+
}, se = s(null);
|
|
202
|
+
function Z(e) {
|
|
203
|
+
let t = c(se);
|
|
204
|
+
if (!t) throw Error(`Calendar.${e} must be rendered inside <Calendar>.`);
|
|
205
|
+
return t;
|
|
206
|
+
}
|
|
207
|
+
var Q = (e, t) => t != null && e >= t.start && e <= t.end, ce = "‹", le = "›";
|
|
208
|
+
function ue({ ref: e, value: n, defaultValue: r, onValueChange: i, visibleMonth: s, defaultVisibleMonth: c, onVisibleMonthChange: l, min: d, max: f, locale: m, firstDayOfWeek: g, today: x, selectionRange: S, previewRange: C, tabStopDate: w, onDayActivate: T, onFocusedDateChange: ee, rangeLabels: E, className: te, sx: ne, children: D, ...O }) {
|
|
209
|
+
let k = u(), A = `${k}-label`, re = E !== void 0, j = p(() => re ? {
|
|
210
|
+
start: `${k}-range-start`,
|
|
211
|
+
end: `${k}-range-end`
|
|
212
|
+
} : void 0, [k, re]), N = a(T), L = a(ee), R = /* @__PURE__ */ new Date(), z = F(x) ? x : P(M(R.getFullYear(), R.getMonth(), R.getDate())), B = p(() => new Intl.DateTimeFormat(m ?? K(), G).resolvedOptions().locale, [m]), V = p(() => oe(B), [B]), H = p(() => ae(B), [B]), U = g ?? H, [W, q] = o(n, r, i), J = n ?? r, [Y, X] = o(s, c ?? I(F(J) ? J : z), l), Z = ie(Y) ? Y : I(z), Q = F(d) ? d : void 0, ce = F(f) ? f : void 0, [le, ue] = h(null), [$, de] = h(!1), fe = p(() => ({
|
|
213
|
+
value: W,
|
|
214
|
+
selectionRange: S,
|
|
215
|
+
previewRange: C,
|
|
216
|
+
tabStopDate: w,
|
|
217
|
+
onDayActivate: N,
|
|
218
|
+
onFocusedDateChange: L,
|
|
219
|
+
rangeLabelIds: j,
|
|
220
|
+
visibleMonth: Z,
|
|
221
|
+
today: z,
|
|
222
|
+
min: Q,
|
|
223
|
+
max: ce,
|
|
224
|
+
firstDayOfWeek: U,
|
|
225
|
+
formatters: V,
|
|
226
|
+
focus: le,
|
|
227
|
+
setFocus: ue,
|
|
228
|
+
requestValue: q,
|
|
229
|
+
requestVisibleMonth: X,
|
|
230
|
+
labelId: A,
|
|
231
|
+
hasHeader: $,
|
|
232
|
+
setHasHeader: de
|
|
233
|
+
}), [
|
|
234
|
+
W,
|
|
235
|
+
S,
|
|
236
|
+
C,
|
|
237
|
+
w,
|
|
238
|
+
N,
|
|
239
|
+
L,
|
|
240
|
+
j,
|
|
241
|
+
Z,
|
|
242
|
+
z,
|
|
243
|
+
Q,
|
|
244
|
+
ce,
|
|
245
|
+
U,
|
|
246
|
+
V,
|
|
247
|
+
le,
|
|
248
|
+
q,
|
|
249
|
+
X,
|
|
250
|
+
A,
|
|
251
|
+
$
|
|
252
|
+
]);
|
|
253
|
+
return /* @__PURE__ */ v(se.Provider, {
|
|
254
|
+
value: fe,
|
|
255
|
+
children: /* @__PURE__ */ v(t, {
|
|
256
|
+
className: te,
|
|
257
|
+
styles: b,
|
|
258
|
+
sx: ne,
|
|
259
|
+
children: (t) => /* @__PURE__ */ y("div", {
|
|
260
|
+
...O,
|
|
261
|
+
ref: e,
|
|
262
|
+
"data-ui": "calendar",
|
|
263
|
+
className: t,
|
|
264
|
+
children: [D, E && j && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("span", {
|
|
265
|
+
id: j.start,
|
|
266
|
+
hidden: !0,
|
|
267
|
+
children: E.start
|
|
268
|
+
}), /* @__PURE__ */ v("span", {
|
|
269
|
+
id: j.end,
|
|
270
|
+
hidden: !0,
|
|
271
|
+
children: E.end
|
|
272
|
+
})] })]
|
|
273
|
+
})
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
ue.displayName = "Calendar";
|
|
278
|
+
function $({ ref: e, className: n, sx: r, ...i }) {
|
|
279
|
+
let { visibleMonth: a, min: o, max: s, formatters: c, requestVisibleMonth: l, labelId: u, setHasHeader: d } = Z("Header");
|
|
280
|
+
f(() => (d(!0), () => d(!1)), [d]);
|
|
281
|
+
let p = B(a, -1), m = B(a, 1), h = o !== void 0 && V(p) < o, g = s !== void 0 && L(m) > s, _ = (e) => c.month.format(N(L(e)));
|
|
282
|
+
return /* @__PURE__ */ v(t, {
|
|
283
|
+
className: n,
|
|
284
|
+
styles: x,
|
|
285
|
+
sx: r,
|
|
286
|
+
children: (t) => /* @__PURE__ */ y("div", {
|
|
287
|
+
...i,
|
|
288
|
+
ref: e,
|
|
289
|
+
"data-ui": "calendar-header",
|
|
290
|
+
className: t,
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ v("button", {
|
|
293
|
+
type: "button",
|
|
294
|
+
"data-ui": "calendar-previous",
|
|
295
|
+
"aria-label": _(p),
|
|
296
|
+
"aria-disabled": h || void 0,
|
|
297
|
+
onClick: () => {
|
|
298
|
+
h || l(p);
|
|
299
|
+
},
|
|
300
|
+
css: w,
|
|
301
|
+
children: /* @__PURE__ */ v("span", {
|
|
302
|
+
"aria-hidden": "true",
|
|
303
|
+
css: T,
|
|
304
|
+
children: ce
|
|
305
|
+
})
|
|
306
|
+
}),
|
|
307
|
+
/* @__PURE__ */ v("span", {
|
|
308
|
+
id: u,
|
|
309
|
+
"aria-live": "polite",
|
|
310
|
+
"aria-atomic": "true",
|
|
311
|
+
"data-ui": "calendar-label",
|
|
312
|
+
css: S,
|
|
313
|
+
children: _(a)
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ v("button", {
|
|
316
|
+
type: "button",
|
|
317
|
+
"data-ui": "calendar-next",
|
|
318
|
+
"aria-label": _(m),
|
|
319
|
+
"aria-disabled": g || void 0,
|
|
320
|
+
onClick: () => {
|
|
321
|
+
g || l(m);
|
|
322
|
+
},
|
|
323
|
+
css: w,
|
|
324
|
+
children: /* @__PURE__ */ v("span", {
|
|
325
|
+
"aria-hidden": "true",
|
|
326
|
+
css: T,
|
|
327
|
+
children: le
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
})
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
$.displayName = "Calendar.Header";
|
|
335
|
+
function de({ date: e, isTabStop: t }) {
|
|
336
|
+
let { value: n, selectionRange: r, previewRange: i, rangeLabelIds: a, today: o, min: s, max: c, formatters: l, setFocus: u, requestValue: d, onDayActivate: f, onFocusedDateChange: p } = Z("Grid"), m = r !== void 0, h = H(e, s, c), g = m ? Q(e, r) : n === e, _ = r?.start === e, y = r?.end === e, b = o === e, x = N(e), S = [_ ? a?.start : void 0, y ? a?.end : void 0].filter(Boolean).join(" ") || void 0;
|
|
337
|
+
return /* @__PURE__ */ v("td", {
|
|
338
|
+
role: "gridcell",
|
|
339
|
+
"aria-selected": g ? !0 : m && h ? !1 : void 0,
|
|
340
|
+
css: te,
|
|
341
|
+
children: /* @__PURE__ */ v("button", {
|
|
342
|
+
type: "button",
|
|
343
|
+
"data-ui": "calendar-day",
|
|
344
|
+
"data-date": e,
|
|
345
|
+
"data-today": b || void 0,
|
|
346
|
+
"data-selected": !m && g || void 0,
|
|
347
|
+
"data-in-range": m && g || void 0,
|
|
348
|
+
"data-range-start": _ || void 0,
|
|
349
|
+
"data-range-end": y || void 0,
|
|
350
|
+
"data-preview": Q(e, i) || void 0,
|
|
351
|
+
"data-preview-start": i?.start === e || void 0,
|
|
352
|
+
"data-preview-end": i?.end === e || void 0,
|
|
353
|
+
"aria-current": b ? "date" : void 0,
|
|
354
|
+
"aria-label": l.date.format(x),
|
|
355
|
+
"aria-describedby": S,
|
|
356
|
+
tabIndex: t ? 0 : -1,
|
|
357
|
+
disabled: !h,
|
|
358
|
+
onFocus: () => {
|
|
359
|
+
u({
|
|
360
|
+
date: e,
|
|
361
|
+
fallback: e
|
|
362
|
+
}), p(e);
|
|
363
|
+
},
|
|
364
|
+
onClick: () => {
|
|
365
|
+
u({
|
|
366
|
+
date: e,
|
|
367
|
+
fallback: e
|
|
368
|
+
}), m || d(e), f(e);
|
|
369
|
+
},
|
|
370
|
+
css: ne,
|
|
371
|
+
children: l.day.format(x)
|
|
372
|
+
})
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function fe({ ref: e, onKeyDown: n, "aria-labelledby": r, "aria-label": i, className: a, sx: o, ...s }) {
|
|
376
|
+
let { value: c, selectionRange: u, tabStopDate: f, visibleMonth: p, today: h, min: g, max: _, firstDayOfWeek: b, formatters: x, focus: S, setFocus: C, requestVisibleMonth: w, onFocusedDateChange: T, labelId: ne, hasHeader: D } = Z("Grid"), O = m(null);
|
|
377
|
+
d(e, () => O.current, []);
|
|
378
|
+
let k = m(!1), A = L(p), j = N(V(p)).getUTCDate(), M = Array.from({ length: j }, (e, t) => R(A, t)), P = (e) => e != null && M.includes(e) && H(e, g, _), F = f !== void 0, ie = F ? P(f) ? f : void 0 : [
|
|
379
|
+
S?.date,
|
|
380
|
+
S?.fallback,
|
|
381
|
+
u === void 0 ? c : u?.start,
|
|
382
|
+
h
|
|
383
|
+
].find(P) ?? M.find((e) => H(e, g, _)), z = [...Array(W(A, b)).fill(null), ...M], B = Array.from({ length: Math.ceil(z.length / 7) }, (e, t) => Array.from({ length: 7 }, (e, n) => z[t * 7 + n] ?? null)), ae = Array.from({ length: 7 }, (e, t) => N(R(re, (b + t) % 7)));
|
|
384
|
+
l(() => {
|
|
385
|
+
k.current && (k.current = !1, O.current?.querySelector(`[data-date="${ie}"]`)?.focus());
|
|
386
|
+
});
|
|
387
|
+
let G = (e) => {
|
|
388
|
+
n?.(e);
|
|
389
|
+
let t = O.current;
|
|
390
|
+
if (e.defaultPrevented || !t) return;
|
|
391
|
+
let r = e.target.dataset.date;
|
|
392
|
+
if (!P(r)) return;
|
|
393
|
+
let i = X[getComputedStyle(t).direction === "rtl" ? "rtl" : "ltr"][e.key];
|
|
394
|
+
if (!i) return;
|
|
395
|
+
e.preventDefault();
|
|
396
|
+
let a = U(i(r, {
|
|
397
|
+
firstDayOfWeek: b,
|
|
398
|
+
shiftKey: e.shiftKey
|
|
399
|
+
}), g, _);
|
|
400
|
+
F ? T(a) : a !== r && (C({
|
|
401
|
+
date: a,
|
|
402
|
+
fallback: r
|
|
403
|
+
}), k.current = !0, I(a) !== p && w(I(a)));
|
|
404
|
+
}, oe = [r, D ? ne : void 0].filter(Boolean).join(" ") || void 0, K = x.month.format(N(A));
|
|
405
|
+
return /* @__PURE__ */ v(t, {
|
|
406
|
+
className: a,
|
|
407
|
+
styles: ee,
|
|
408
|
+
sx: o,
|
|
409
|
+
children: (e) => /* @__PURE__ */ y("table", {
|
|
410
|
+
...s,
|
|
411
|
+
ref: O,
|
|
412
|
+
role: "grid",
|
|
413
|
+
"aria-multiselectable": u !== void 0 || void 0,
|
|
414
|
+
"aria-labelledby": oe,
|
|
415
|
+
"aria-label": oe === void 0 ? i ?? K : i,
|
|
416
|
+
"data-ui": "calendar-grid",
|
|
417
|
+
onKeyDown: G,
|
|
418
|
+
className: e,
|
|
419
|
+
children: [/* @__PURE__ */ v("thead", { children: /* @__PURE__ */ v("tr", {
|
|
420
|
+
role: "row",
|
|
421
|
+
children: ae.map((e) => /* @__PURE__ */ v("th", {
|
|
422
|
+
role: "columnheader",
|
|
423
|
+
scope: "col",
|
|
424
|
+
abbr: x.weekdayLong.format(e),
|
|
425
|
+
css: E,
|
|
426
|
+
children: x.weekdayShort.format(e)
|
|
427
|
+
}, e.getUTCDay()))
|
|
428
|
+
}) }), /* @__PURE__ */ v("tbody", { children: B.map((e, t) => /* @__PURE__ */ v("tr", {
|
|
429
|
+
role: "row",
|
|
430
|
+
children: e.map((e, t) => e === null ? /* @__PURE__ */ v("td", {
|
|
431
|
+
role: "gridcell",
|
|
432
|
+
css: te
|
|
433
|
+
}, `empty-${t}`) : /* @__PURE__ */ v(de, {
|
|
434
|
+
date: e,
|
|
435
|
+
isTabStop: e === ie
|
|
436
|
+
}, e))
|
|
437
|
+
}, t)) })]
|
|
438
|
+
})
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
fe.displayName = "Calendar.Grid";
|
|
442
|
+
var pe = Object.assign(ue, {
|
|
443
|
+
Header: $,
|
|
444
|
+
Grid: fe
|
|
445
|
+
});
|
|
446
|
+
//#endregion
|
|
447
|
+
export { M as a, F as c, I as d, B as f, N as i, H as l, G as n, K as o, U as r, L as s, pe as t, P as u };
|
package/dist/calendar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Calendar } from "./calendar-
|
|
2
|
+
export { t as Calendar } from "./calendar-B3Svu0X2.js";
|