@alfadocs/ui-kit 0.17.1 → 0.17.3
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/_chunks/{accordion-DOmxGEWU.js → accordion-CNcodXuO.js} +6 -6
- package/dist/_chunks/{ai-prompt-input-DEiQwIMn.js → ai-prompt-input-B-w5Rx3V.js} +184 -181
- package/dist/_chunks/{alert-pgdXrEO5.js → alert-DBnawbmf.js} +64 -59
- package/dist/_chunks/{audio-recorder-CRh4uyFL.js → audio-recorder-DNkQLW1G.js} +3 -3
- package/dist/_chunks/{autocomplete-mOg7WLOh.js → autocomplete-BxfabhZ8.js} +167 -164
- package/dist/_chunks/{balance-cell-renderer-DWWtX-VM.js → balance-cell-renderer-DJB6WDPe.js} +2 -2
- package/dist/_chunks/{chat-input-UK-bXU7u.js → chat-input-B3XmFGDw.js} +123 -122
- package/dist/_chunks/checkbox-group-Bwmt1ovQ.js +213 -0
- package/dist/_chunks/{checkbox-D5EHnB14.js → checkbox-mwbrPZDY.js} +75 -70
- package/dist/_chunks/{collapsible-CuxUBoHJ.js → collapsible-hHiyZp0b.js} +61 -63
- package/dist/_chunks/{color-picker-BPfcByHH.js → color-picker-Bm-gzpsh.js} +2 -2
- package/dist/_chunks/{combobox-D5tWe0t_.js → combobox-Da9eq00i.js} +214 -211
- package/dist/_chunks/{copy-field-BCHAZ8QV.js → copy-field-BAF4mt9h.js} +95 -132
- package/dist/_chunks/{date-picker-BlhtBhPo.js → date-picker-BIoSLRly.js} +222 -219
- package/dist/_chunks/{date-range-picker-C2hRu_Ke.js → date-range-picker-9gANFNG9.js} +81 -78
- package/dist/_chunks/{date-time-picker-B67mPZmP.js → date-time-picker-DG7BiGdb.js} +98 -95
- package/dist/_chunks/{dialog-DRp6Dejy.js → dialog-DUomPCRS.js} +69 -71
- package/dist/_chunks/{dropdown-menu-dyV7gHh_.js → dropdown-menu-DZxwF23X.js} +108 -110
- package/dist/_chunks/{freemium-paywall-BTEiVkes.js → freemium-paywall-DXc7XlGE.js} +98 -97
- package/dist/_chunks/{leo-sidebar-D3TuyH5_.js → leo-sidebar-DIsiTju3.js} +2 -2
- package/dist/_chunks/{list-DcjV0m5B.js → list-BdvDctBz.js} +184 -180
- package/dist/_chunks/{message-tray-Fsend-du.js → message-tray-BNAS8al4.js} +111 -111
- package/dist/_chunks/{multi-select-DooDzQIp.js → multi-select-CyspR5ZF.js} +157 -154
- package/dist/_chunks/{navigation-menu-DdufF-_4.js → navigation-menu-CyS1fBJ7.js} +85 -87
- package/dist/_chunks/{notification-tray-C3dYdLAF.js → notification-tray-D_69dXFY.js} +114 -114
- package/dist/_chunks/{number-input-DH00o0DN.js → number-input-BZXu6bPY.js} +92 -89
- package/dist/_chunks/{otp-input-BBXYvLx5.js → otp-input-BDF_iNpa.js} +92 -93
- package/dist/_chunks/{pagination-F1ei4khE.js → pagination-BWaXF7W0.js} +194 -211
- package/dist/_chunks/{patient-shell-BE0CdPOJ.js → patient-shell-BOOaWZA9.js} +3 -3
- package/dist/_chunks/{payment-form-CI77oIx1.js → payment-form-BjkuQeqR.js} +2 -2
- package/dist/_chunks/{pdf-viewer-CnEJvmXC.js → pdf-viewer-BG_nsFT5.js} +2 -2
- package/dist/_chunks/{radio-group-Cz1a4QCA.js → radio-group-BHZOxrIK.js} +4 -4
- package/dist/_chunks/{select-Ca6ibiDL.js → select-C92AT_OZ.js} +7 -7
- package/dist/_chunks/{sidebar-D8Lq065m.js → sidebar-BqzlRBvC.js} +271 -291
- package/dist/_chunks/{slider-CkR6CLun.js → slider-CfEzeseL.js} +4 -4
- package/dist/_chunks/{tabs-CRCyPpJo.js → tabs-aEQfQV3x.js} +8 -8
- package/dist/_chunks/{theme-toggle-B3meAb3y.js → theme-toggle-BswYl0Yp.js} +2 -2
- package/dist/_chunks/use-controllable-state-BiY4xTzM.js +23 -0
- package/dist/_chunks/use-copy-to-clipboard-Cyfc_dlv.js +43 -0
- package/dist/_chunks/use-persistent-state-i23OWy6G.js +24 -0
- package/dist/_chunks/{warning-stack-CeRihME9.js → warning-stack-CDH9TudY.js} +2 -2
- package/dist/_chunks/{workflow-map-D3MvrsZV.js → workflow-map-BeKe23uw.js} +3 -3
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/use-debounced-callback.d.ts +1 -5
- package/dist/components/_shared/use-direction.d.ts +1 -18
- package/dist/components/_shared/use-focus-trap.d.ts +1 -31
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/ai-prompt-input/index.js +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/chat-input/index.js +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/command-palette/command-palette.d.ts +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/icon-button-group/icon-button-group.d.ts +14 -14
- package/dist/components/list/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/navigation-menu/index.js +1 -1
- package/dist/components/notification-tray/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/sidebar/index.js +8 -7
- package/dist/components/sidebar/sidebar.d.ts +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.js +98 -15
- package/dist/hooks/use-debounced-callback.d.ts +19 -0
- package/dist/hooks/use-debounced-value.d.ts +16 -0
- package/dist/hooks/use-direction.d.ts +19 -0
- package/dist/hooks/use-focus-trap.d.ts +32 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +13 -0
- package/dist/hooks/use-persistent-state.d.ts +16 -0
- package/dist/index.js +493 -492
- package/dist/patterns/leo-assistant/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +4 -2
- package/dist/_chunks/checkbox-group-Qkm3Rg1S.js +0 -208
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useTranslation as
|
|
1
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as J, useState as S, useRef as Q, useCallback as U, useMemo as X, useImperativeHandle as Z } from "react";
|
|
3
|
+
import { useTranslation as z } from "react-i18next";
|
|
4
4
|
import * as m from "@radix-ui/react-popover";
|
|
5
|
+
import { u as ee } from "./use-controllable-state-BiY4xTzM.js";
|
|
5
6
|
import { u as te } from "./form-field-context-B3APVHKx.js";
|
|
6
|
-
import { a as ae, g as ne, b as re, e as
|
|
7
|
-
import { c as
|
|
7
|
+
import { a as ae, g as ne, b as re, e as N, c as se, C as oe, d as ie, t as de, p as ce, D as le, f as pe, h as ge } from "./react-day-picker-C5F3-TTX.js";
|
|
8
|
+
import { c as ue, b as I, s as fe, f as b, d as me } from "./isSameMonth-5wNF2f4I.js";
|
|
8
9
|
import { u as ye } from "./registry-C9nwlNyL.js";
|
|
9
|
-
function
|
|
10
|
-
return
|
|
10
|
+
function v(t, r, o) {
|
|
11
|
+
return ue(t, -r, o);
|
|
11
12
|
}
|
|
12
|
-
function he(t,
|
|
13
|
-
return ae(t, -1,
|
|
13
|
+
function he(t, r, o) {
|
|
14
|
+
return ae(t, -1, o);
|
|
14
15
|
}
|
|
15
16
|
const ke = {
|
|
16
17
|
id: "date-range-picker",
|
|
@@ -21,11 +22,11 @@ const ke = {
|
|
|
21
22
|
descriptionKey: "ui.agent.dateRangePicker.state.range",
|
|
22
23
|
description: "Currently-selected ISO date range endpoints, each possibly null.",
|
|
23
24
|
read: (t) => {
|
|
24
|
-
var
|
|
25
|
-
const
|
|
25
|
+
var o, l;
|
|
26
|
+
const r = t.getRange();
|
|
26
27
|
return {
|
|
27
|
-
from: ((
|
|
28
|
-
to: ((l =
|
|
28
|
+
from: ((o = r.from) == null ? void 0 : o.toISOString()) ?? null,
|
|
29
|
+
to: ((l = r.to) == null ? void 0 : l.toISOString()) ?? null
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
},
|
|
@@ -42,8 +43,8 @@ const ke = {
|
|
|
42
43
|
argsType: "{ from: string, to: string }",
|
|
43
44
|
descriptionKey: "ui.agent.dateRangePicker.actions.setRange",
|
|
44
45
|
description: "Replace the selected range with the given ISO endpoints.",
|
|
45
|
-
invoke: (t,
|
|
46
|
-
t.setRange({ from: new Date(
|
|
46
|
+
invoke: (t, r) => {
|
|
47
|
+
t.setRange({ from: new Date(r.from), to: new Date(r.to) });
|
|
47
48
|
}
|
|
48
49
|
},
|
|
49
50
|
clear: {
|
|
@@ -83,177 +84,179 @@ const ke = {
|
|
|
83
84
|
description: "Sourced from the id prop."
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
}, be =
|
|
87
|
+
}, be = J(
|
|
87
88
|
({
|
|
88
89
|
value: t,
|
|
89
|
-
defaultValue:
|
|
90
|
-
onChange:
|
|
90
|
+
defaultValue: r,
|
|
91
|
+
onChange: o,
|
|
91
92
|
minDate: l,
|
|
92
93
|
maxDate: T,
|
|
93
94
|
presets: y,
|
|
94
95
|
mergePresets: W = !1,
|
|
95
|
-
size:
|
|
96
|
+
size: R = "md",
|
|
96
97
|
disabled: V,
|
|
97
98
|
placeholder: K,
|
|
98
99
|
className: L,
|
|
99
100
|
id: F
|
|
100
101
|
}, j) => {
|
|
101
|
-
const { t:
|
|
102
|
-
t
|
|
103
|
-
|
|
102
|
+
const { t: s, i18n: A } = z(), c = te(), h = F ?? c.id, D = c.disabled || V, B = c.invalid ? "error" : "default", i = ne(A.language), H = K ?? s("inputs.dateRangePicker.placeholder", "Select date range"), [_, P] = ee({
|
|
103
|
+
value: t,
|
|
104
|
+
defaultValue: r ?? {},
|
|
105
|
+
onChange: o
|
|
106
|
+
}), a = _ ?? {}, [p, g] = S(!1), [$, w] = S(a.from ?? /* @__PURE__ */ new Date()), Y = Q(null), d = U(
|
|
104
107
|
(e) => {
|
|
105
|
-
|
|
108
|
+
P(e);
|
|
106
109
|
},
|
|
107
|
-
[
|
|
108
|
-
),
|
|
110
|
+
[P]
|
|
111
|
+
), q = re(l, T), M = [
|
|
109
112
|
{
|
|
110
|
-
label:
|
|
113
|
+
label: s("inputs.dateRangePicker.presets.today", "Today"),
|
|
111
114
|
range: () => {
|
|
112
115
|
const e = /* @__PURE__ */ new Date();
|
|
113
116
|
return { from: e, to: e };
|
|
114
117
|
}
|
|
115
118
|
},
|
|
116
119
|
{
|
|
117
|
-
label:
|
|
120
|
+
label: s("inputs.dateRangePicker.presets.yesterday", "Yesterday"),
|
|
118
121
|
range: () => {
|
|
119
|
-
const e =
|
|
122
|
+
const e = v(/* @__PURE__ */ new Date(), 1);
|
|
120
123
|
return { from: e, to: e };
|
|
121
124
|
}
|
|
122
125
|
},
|
|
123
126
|
{
|
|
124
|
-
label:
|
|
127
|
+
label: s("inputs.dateRangePicker.presets.last7", "Last 7 days"),
|
|
125
128
|
range: () => ({
|
|
126
|
-
from:
|
|
129
|
+
from: v(/* @__PURE__ */ new Date(), 6),
|
|
127
130
|
to: /* @__PURE__ */ new Date()
|
|
128
131
|
})
|
|
129
132
|
},
|
|
130
133
|
{
|
|
131
|
-
label:
|
|
134
|
+
label: s("inputs.dateRangePicker.presets.thisWeek", "This week"),
|
|
132
135
|
range: () => ({
|
|
133
|
-
from:
|
|
134
|
-
to:
|
|
136
|
+
from: I(/* @__PURE__ */ new Date(), { locale: i }),
|
|
137
|
+
to: N(/* @__PURE__ */ new Date(), { locale: i })
|
|
135
138
|
})
|
|
136
139
|
},
|
|
137
140
|
{
|
|
138
|
-
label:
|
|
141
|
+
label: s("inputs.dateRangePicker.presets.lastWeek", "Last week"),
|
|
139
142
|
range: () => {
|
|
140
143
|
const e = he(/* @__PURE__ */ new Date());
|
|
141
144
|
return {
|
|
142
|
-
from:
|
|
143
|
-
to:
|
|
145
|
+
from: I(e, { locale: i }),
|
|
146
|
+
to: N(e, { locale: i })
|
|
144
147
|
};
|
|
145
148
|
}
|
|
146
149
|
},
|
|
147
150
|
{
|
|
148
|
-
label:
|
|
151
|
+
label: s("inputs.dateRangePicker.presets.thisMonth", "This month"),
|
|
149
152
|
range: () => ({
|
|
150
|
-
from:
|
|
153
|
+
from: fe(/* @__PURE__ */ new Date()),
|
|
151
154
|
to: se(/* @__PURE__ */ new Date())
|
|
152
155
|
})
|
|
153
156
|
},
|
|
154
157
|
{
|
|
155
|
-
label:
|
|
158
|
+
label: s("inputs.dateRangePicker.presets.last30", "Last 30 days"),
|
|
156
159
|
range: () => ({
|
|
157
|
-
from:
|
|
160
|
+
from: v(/* @__PURE__ */ new Date(), 29),
|
|
158
161
|
to: /* @__PURE__ */ new Date()
|
|
159
162
|
})
|
|
160
163
|
}
|
|
161
|
-
],
|
|
164
|
+
], C = y ? W ? [...M, ...y] : y : M, E = (e) => {
|
|
162
165
|
d(e ? { from: e.from, to: e.to } : {});
|
|
163
|
-
},
|
|
164
|
-
const
|
|
165
|
-
d(
|
|
166
|
-
},
|
|
166
|
+
}, G = (e) => {
|
|
167
|
+
const u = e.range();
|
|
168
|
+
d(u), w(u.from), g(!1);
|
|
169
|
+
}, O = (() => {
|
|
167
170
|
if (a.from && a.to) {
|
|
168
|
-
const e =
|
|
169
|
-
return `${e} – ${
|
|
171
|
+
const e = b(a.from, "MMM d, yyyy", { locale: i }), u = b(a.to, "MMM d, yyyy", { locale: i });
|
|
172
|
+
return `${e} – ${u}`;
|
|
170
173
|
}
|
|
171
|
-
return a.from ?
|
|
172
|
-
})(),
|
|
174
|
+
return a.from ? b(a.from, "MMM d, yyyy", { locale: i }) : "";
|
|
175
|
+
})(), x = (() => {
|
|
173
176
|
if (a.from && a.to) {
|
|
174
177
|
const e = me(a.to, a.from) + 1;
|
|
175
|
-
return
|
|
178
|
+
return s("inputs.dateRangePicker.days", "{{count}} days", {
|
|
176
179
|
count: e
|
|
177
180
|
});
|
|
178
181
|
}
|
|
179
182
|
return "";
|
|
180
|
-
})(),
|
|
183
|
+
})(), k = X(
|
|
181
184
|
() => ({
|
|
182
185
|
getRange: () => a,
|
|
183
186
|
setRange: (e) => d(e),
|
|
184
187
|
clear: () => d({}),
|
|
185
188
|
isOpen: () => p,
|
|
186
|
-
open: () =>
|
|
187
|
-
close: () =>
|
|
189
|
+
open: () => g(!0),
|
|
190
|
+
close: () => g(!1)
|
|
188
191
|
}),
|
|
189
192
|
[a, d, p]
|
|
190
193
|
);
|
|
191
|
-
return
|
|
194
|
+
return Z(j, () => k, [k]), ye(ke, k, h), /* @__PURE__ */ n(m.Root, { open: p, onOpenChange: g, children: /* @__PURE__ */ f(
|
|
192
195
|
"div",
|
|
193
196
|
{
|
|
194
197
|
className: L,
|
|
195
198
|
"data-component": "date-range-picker",
|
|
196
199
|
"data-component-id": h,
|
|
197
200
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ n(m.Trigger, { asChild: !0, disabled: D, children: /* @__PURE__ */ f(
|
|
199
202
|
"button",
|
|
200
203
|
{
|
|
201
|
-
ref:
|
|
204
|
+
ref: Y,
|
|
202
205
|
id: h,
|
|
203
206
|
type: "button",
|
|
204
|
-
disabled:
|
|
207
|
+
disabled: D,
|
|
205
208
|
"aria-describedby": c.describedBy || void 0,
|
|
206
209
|
"aria-invalid": c.invalid || void 0,
|
|
207
210
|
"aria-haspopup": "dialog",
|
|
208
211
|
"aria-expanded": p,
|
|
209
|
-
className: de({ size:
|
|
212
|
+
className: de({ size: R, tone: B }),
|
|
210
213
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ n(
|
|
212
215
|
"span",
|
|
213
216
|
{
|
|
214
|
-
className:
|
|
215
|
-
children:
|
|
217
|
+
className: O ? "ds:text-foreground" : "ds:text-muted-foreground",
|
|
218
|
+
children: O || H
|
|
216
219
|
}
|
|
217
220
|
),
|
|
218
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ n(
|
|
219
222
|
"span",
|
|
220
223
|
{
|
|
221
224
|
"aria-hidden": "true",
|
|
222
|
-
className: ie({ size:
|
|
223
|
-
children: /* @__PURE__ */
|
|
225
|
+
className: ie({ size: R }),
|
|
226
|
+
children: /* @__PURE__ */ n(oe, {})
|
|
224
227
|
}
|
|
225
228
|
)
|
|
226
229
|
]
|
|
227
230
|
}
|
|
228
231
|
) }),
|
|
229
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ n(m.Portal, { children: /* @__PURE__ */ n(
|
|
230
233
|
m.Content,
|
|
231
234
|
{
|
|
232
235
|
sideOffset: 4,
|
|
233
236
|
align: "start",
|
|
234
|
-
className:
|
|
235
|
-
children: /* @__PURE__ */
|
|
236
|
-
|
|
237
|
+
className: ge(),
|
|
238
|
+
children: /* @__PURE__ */ f("div", { className: "ds:flex ds:gap-[var(--spacing-md)]", children: [
|
|
239
|
+
C.length > 0 ? /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:min-w-[8rem] ds:border-e ds:border-border ds:pe-[var(--spacing-md)]", children: C.map((e) => /* @__PURE__ */ n(
|
|
237
240
|
"button",
|
|
238
241
|
{
|
|
239
242
|
type: "button",
|
|
240
|
-
onClick: () =>
|
|
243
|
+
onClick: () => G(e),
|
|
241
244
|
className: ce(),
|
|
242
245
|
children: e.label
|
|
243
246
|
},
|
|
244
247
|
e.label
|
|
245
248
|
)) }) : null,
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ f("div", { children: [
|
|
250
|
+
/* @__PURE__ */ n(
|
|
248
251
|
le,
|
|
249
252
|
{
|
|
250
253
|
mode: "range",
|
|
251
254
|
selected: a.from ? { from: a.from, to: a.to } : void 0,
|
|
252
|
-
onSelect:
|
|
253
|
-
month:
|
|
254
|
-
onMonthChange:
|
|
255
|
+
onSelect: E,
|
|
256
|
+
month: $,
|
|
257
|
+
onMonthChange: w,
|
|
255
258
|
numberOfMonths: 2,
|
|
256
|
-
disabled:
|
|
259
|
+
disabled: q,
|
|
257
260
|
locale: i,
|
|
258
261
|
showOutsideDays: !0,
|
|
259
262
|
fixedWeeks: !0,
|
|
@@ -261,13 +264,13 @@ const ke = {
|
|
|
261
264
|
components: { Chevron: pe }
|
|
262
265
|
}
|
|
263
266
|
),
|
|
264
|
-
|
|
267
|
+
x ? /* @__PURE__ */ n(
|
|
265
268
|
"div",
|
|
266
269
|
{
|
|
267
270
|
role: "status",
|
|
268
271
|
"aria-live": "polite",
|
|
269
272
|
className: "type-body-sm ds:text-muted-foreground ds:mt-[var(--spacing-sm)] ds:text-center",
|
|
270
|
-
children:
|
|
273
|
+
children: x
|
|
271
274
|
}
|
|
272
275
|
) : null
|
|
273
276
|
] })
|
|
@@ -284,4 +287,4 @@ export {
|
|
|
284
287
|
be as D,
|
|
285
288
|
ke as d
|
|
286
289
|
};
|
|
287
|
-
//# sourceMappingURL=date-range-picker-
|
|
290
|
+
//# sourceMappingURL=date-range-picker-9gANFNG9.js.map
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
1
|
+
import { jsx as s, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ne, useState as T, useRef as oe, useCallback as F, useMemo as de, useImperativeHandle as le } from "react";
|
|
3
|
+
import { c as ce } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as ue } from "react-i18next";
|
|
5
5
|
import * as k from "@radix-ui/react-popover";
|
|
6
|
+
import { u as me } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
7
|
import { u as pe } from "./form-field-context-B3APVHKx.js";
|
|
7
8
|
import { T as fe } from "./time-picker-DeVZkIY2.js";
|
|
8
|
-
import { g as ge, b as he, i as ve, j as be, C as ye, d as Te, t as ke, D as we, f as De, h as
|
|
9
|
-
import { f as
|
|
10
|
-
import { u as
|
|
9
|
+
import { g as ge, b as he, i as ve, j as be, C as ye, d as Te, t as ke, D as we, f as De, h as Ce } from "./react-day-picker-C5F3-TTX.js";
|
|
10
|
+
import { f as Pe } from "./isSameMonth-5wNF2f4I.js";
|
|
11
|
+
import { u as xe } from "./registry-C9nwlNyL.js";
|
|
11
12
|
import { t as j } from "./isSameDay-ecuM8PBB.js";
|
|
12
|
-
function K(e,
|
|
13
|
-
const i = j(e,
|
|
14
|
-
return i.setHours(
|
|
13
|
+
function K(e, t, r) {
|
|
14
|
+
const i = j(e, r == null ? void 0 : r.in);
|
|
15
|
+
return i.setHours(t), i;
|
|
15
16
|
}
|
|
16
|
-
function A(e,
|
|
17
|
-
const i = j(e,
|
|
18
|
-
return i.setMinutes(
|
|
17
|
+
function A(e, t, r) {
|
|
18
|
+
const i = j(e, r == null ? void 0 : r.in);
|
|
19
|
+
return i.setMinutes(t), i;
|
|
19
20
|
}
|
|
20
21
|
const Oe = {
|
|
21
22
|
id: "date-time-picker",
|
|
@@ -26,8 +27,8 @@ const Oe = {
|
|
|
26
27
|
descriptionKey: "ui.agent.dateTimePicker.state.value",
|
|
27
28
|
description: "Currently-selected ISO datetime, or null.",
|
|
28
29
|
read: (e) => {
|
|
29
|
-
var
|
|
30
|
-
return ((
|
|
30
|
+
var t;
|
|
31
|
+
return ((t = e.getValue()) == null ? void 0 : t.toISOString()) ?? null;
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
isOpen: {
|
|
@@ -43,8 +44,8 @@ const Oe = {
|
|
|
43
44
|
argsType: "{ datetime: string }",
|
|
44
45
|
descriptionKey: "ui.agent.dateTimePicker.actions.setDatetime",
|
|
45
46
|
description: "Select a specific datetime (ISO string).",
|
|
46
|
-
invoke: (e,
|
|
47
|
-
e.setValue(new Date(
|
|
47
|
+
invoke: (e, t) => {
|
|
48
|
+
e.setValue(new Date(t.datetime));
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
clear: {
|
|
@@ -85,13 +86,13 @@ const Oe = {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
|
-
function Me(e,
|
|
89
|
-
var
|
|
89
|
+
function Me(e, t) {
|
|
90
|
+
var r;
|
|
90
91
|
try {
|
|
91
92
|
const i = { timeZoneName: "short" };
|
|
92
|
-
return
|
|
93
|
+
return t && t !== "local" && (i.timeZone = t === "utc" ? "UTC" : t), ((r = new Intl.DateTimeFormat(e, i).formatToParts(
|
|
93
94
|
/* @__PURE__ */ new Date()
|
|
94
|
-
).find((d) => d.type === "timeZoneName")) == null ? void 0 :
|
|
95
|
+
).find((d) => d.type === "timeZoneName")) == null ? void 0 : r.value) ?? "";
|
|
95
96
|
} catch {
|
|
96
97
|
return "";
|
|
97
98
|
}
|
|
@@ -99,13 +100,13 @@ function Me(e, s) {
|
|
|
99
100
|
function Ne(e) {
|
|
100
101
|
if (!e || e === "local") return !1;
|
|
101
102
|
try {
|
|
102
|
-
const
|
|
103
|
-
return e === "utc" ?
|
|
103
|
+
const t = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
104
|
+
return e === "utc" ? t !== "UTC" : t !== e;
|
|
104
105
|
} catch {
|
|
105
106
|
return !1;
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
|
-
const Ve =
|
|
109
|
+
const Ve = ce(
|
|
109
110
|
[
|
|
110
111
|
"ds:w-full ds:rounded-[var(--radius-sm)]",
|
|
111
112
|
"ds:bg-primary ds:text-primary-foreground",
|
|
@@ -125,139 +126,141 @@ const Ve = ue(
|
|
|
125
126
|
},
|
|
126
127
|
defaultVariants: { size: "md" }
|
|
127
128
|
}
|
|
128
|
-
),
|
|
129
|
+
), Se = ne(
|
|
129
130
|
({
|
|
130
131
|
value: e,
|
|
131
|
-
defaultValue:
|
|
132
|
-
onChange:
|
|
132
|
+
defaultValue: t,
|
|
133
|
+
onChange: r,
|
|
133
134
|
timezone: i,
|
|
134
135
|
showTimezone: w,
|
|
135
136
|
minDate: d,
|
|
136
|
-
maxDate:
|
|
137
|
+
maxDate: p,
|
|
137
138
|
hour12: B,
|
|
138
139
|
minuteStep: Z = 1,
|
|
139
|
-
size:
|
|
140
|
+
size: f = "md",
|
|
140
141
|
disabled: _,
|
|
141
142
|
placeholder: z,
|
|
142
143
|
className: E,
|
|
143
144
|
id: U
|
|
144
145
|
}, W) => {
|
|
145
|
-
const { t:
|
|
146
|
+
const { t: l, i18n: M } = ue(), c = pe(), D = U ?? c.id, N = c.disabled || _, q = c.invalid ? "error" : "default", V = ge(M.language), G = z ?? l("inputs.dateTimePicker.placeholder", "Select date and time"), J = l("inputs.dateTimePicker.apply", "Apply"), Q = l(
|
|
146
147
|
"inputs.dateTimePicker.outOfRange",
|
|
147
148
|
"Date/time is out of allowed range"
|
|
148
|
-
), S = (w !== void 0 ? w : Ne(i)) ? Me(
|
|
149
|
-
e
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
), S = (w !== void 0 ? w : Ne(i)) ? Me(M.language, i) : "", [X, I] = me({
|
|
150
|
+
value: e,
|
|
151
|
+
defaultValue: t,
|
|
152
|
+
onChange: r
|
|
153
|
+
}), n = X, [o, g] = T(n), [h, v] = T(!1), [Y, C] = T(n ?? /* @__PURE__ */ new Date()), [R, u] = T(!1), L = oe(null), b = F(
|
|
154
|
+
(a) => {
|
|
155
|
+
I(a);
|
|
153
156
|
},
|
|
154
|
-
[
|
|
155
|
-
),
|
|
156
|
-
(
|
|
157
|
-
[d,
|
|
158
|
-
),
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
if (!
|
|
162
|
-
const
|
|
163
|
-
K(
|
|
164
|
-
|
|
157
|
+
[I]
|
|
158
|
+
), $ = he(d, p), P = F(
|
|
159
|
+
(a) => !(d && ve(a, d) || p && be(a, p)),
|
|
160
|
+
[d, p]
|
|
161
|
+
), ee = (a) => {
|
|
162
|
+
a && (g(n ?? /* @__PURE__ */ new Date()), C(n ?? /* @__PURE__ */ new Date()), u(!1)), v(a);
|
|
163
|
+
}, te = (a) => {
|
|
164
|
+
if (!a) return;
|
|
165
|
+
const O = o ?? /* @__PURE__ */ new Date(), m = A(
|
|
166
|
+
K(a, O.getHours()),
|
|
167
|
+
O.getMinutes()
|
|
165
168
|
);
|
|
166
|
-
|
|
167
|
-
}, ae = (
|
|
168
|
-
const m = A(K(o ?? /* @__PURE__ */ new Date(),
|
|
169
|
-
|
|
170
|
-
},
|
|
171
|
-
var
|
|
169
|
+
g(m), u(!P(m));
|
|
170
|
+
}, ae = (a) => {
|
|
171
|
+
const m = A(K(o ?? /* @__PURE__ */ new Date(), a.hours), a.minutes);
|
|
172
|
+
g(m), u(!P(m));
|
|
173
|
+
}, se = () => {
|
|
174
|
+
var a;
|
|
172
175
|
if (o) {
|
|
173
|
-
if (!
|
|
176
|
+
if (!P(o)) {
|
|
174
177
|
u(!0);
|
|
175
178
|
return;
|
|
176
179
|
}
|
|
177
|
-
|
|
180
|
+
b(o), v(!1), (a = L.current) == null || a.focus();
|
|
178
181
|
}
|
|
179
|
-
}, H = n ?
|
|
182
|
+
}, H = n ? Pe(n, "MMM d, yyyy HH:mm", { locale: V }) : "", re = l("inputs.datePicker.gridLabel", "Calendar"), ie = l("inputs.timePicker.groupLabel", "Time"), x = de(
|
|
180
183
|
() => ({
|
|
181
184
|
getValue: () => n,
|
|
182
|
-
setValue: (
|
|
183
|
-
clear: () =>
|
|
184
|
-
isOpen: () =>
|
|
185
|
+
setValue: (a) => b(a),
|
|
186
|
+
clear: () => b(void 0),
|
|
187
|
+
isOpen: () => h,
|
|
185
188
|
// Mirror the trigger's open behaviour so draft state seeds correctly.
|
|
186
189
|
open: () => {
|
|
187
|
-
|
|
190
|
+
g(n ?? /* @__PURE__ */ new Date()), C(n ?? /* @__PURE__ */ new Date()), u(!1), v(!0);
|
|
188
191
|
},
|
|
189
|
-
close: () =>
|
|
192
|
+
close: () => v(!1)
|
|
190
193
|
}),
|
|
191
|
-
[n,
|
|
194
|
+
[n, b, h]
|
|
192
195
|
);
|
|
193
|
-
return le(W, () =>
|
|
196
|
+
return le(W, () => x, [x]), xe(Oe, x, D), /* @__PURE__ */ s(k.Root, { open: h, onOpenChange: ee, children: /* @__PURE__ */ y(
|
|
194
197
|
"div",
|
|
195
198
|
{
|
|
196
199
|
className: E,
|
|
197
200
|
"data-component": "date-time-picker",
|
|
198
201
|
"data-component-id": D,
|
|
199
202
|
children: [
|
|
200
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ s(k.Trigger, { asChild: !0, disabled: N, children: /* @__PURE__ */ y(
|
|
201
204
|
"button",
|
|
202
205
|
{
|
|
203
|
-
ref:
|
|
206
|
+
ref: L,
|
|
204
207
|
id: D,
|
|
205
208
|
type: "button",
|
|
206
|
-
disabled:
|
|
207
|
-
"aria-describedby":
|
|
208
|
-
"aria-invalid":
|
|
209
|
+
disabled: N,
|
|
210
|
+
"aria-describedby": c.describedBy || void 0,
|
|
211
|
+
"aria-invalid": c.invalid || void 0,
|
|
209
212
|
"aria-haspopup": "dialog",
|
|
210
|
-
"aria-expanded":
|
|
211
|
-
className: ke({ size:
|
|
213
|
+
"aria-expanded": h,
|
|
214
|
+
className: ke({ size: f, tone: q }),
|
|
212
215
|
children: [
|
|
213
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ s(
|
|
214
217
|
"span",
|
|
215
218
|
{
|
|
216
219
|
className: H ? "ds:text-foreground" : "ds:text-muted-foreground",
|
|
217
220
|
children: H || G
|
|
218
221
|
}
|
|
219
222
|
),
|
|
220
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ s(
|
|
221
224
|
"span",
|
|
222
225
|
{
|
|
223
226
|
"aria-hidden": "true",
|
|
224
|
-
className: Te({ size:
|
|
225
|
-
children: /* @__PURE__ */
|
|
227
|
+
className: Te({ size: f }),
|
|
228
|
+
children: /* @__PURE__ */ s(ye, {})
|
|
226
229
|
}
|
|
227
230
|
)
|
|
228
231
|
]
|
|
229
232
|
}
|
|
230
233
|
) }),
|
|
231
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ s(k.Portal, { children: /* @__PURE__ */ s(
|
|
232
235
|
k.Content,
|
|
233
236
|
{
|
|
234
237
|
sideOffset: 4,
|
|
235
238
|
align: "start",
|
|
236
|
-
className:
|
|
237
|
-
children: /* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
+
className: Ce(),
|
|
240
|
+
children: /* @__PURE__ */ y("div", { className: "ds:flex ds:flex-col ds:sm:flex-row ds:gap-[var(--spacing-md)]", children: [
|
|
241
|
+
/* @__PURE__ */ s("div", { role: "region", "aria-label": re, children: /* @__PURE__ */ s(
|
|
239
242
|
we,
|
|
240
243
|
{
|
|
241
244
|
mode: "single",
|
|
242
245
|
selected: o,
|
|
243
|
-
onSelect:
|
|
244
|
-
month:
|
|
245
|
-
onMonthChange:
|
|
246
|
-
disabled:
|
|
247
|
-
locale:
|
|
246
|
+
onSelect: te,
|
|
247
|
+
month: Y,
|
|
248
|
+
onMonthChange: C,
|
|
249
|
+
disabled: $,
|
|
250
|
+
locale: V,
|
|
248
251
|
showOutsideDays: !0,
|
|
249
252
|
fixedWeeks: !0,
|
|
250
253
|
components: { Chevron: De }
|
|
251
254
|
}
|
|
252
255
|
) }),
|
|
253
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ y(
|
|
254
257
|
"div",
|
|
255
258
|
{
|
|
256
259
|
role: "region",
|
|
257
|
-
"aria-label":
|
|
260
|
+
"aria-label": ie,
|
|
258
261
|
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:sm:border-s ds:sm:border-border ds:sm:ps-[var(--spacing-md)] ds:min-w-[10rem]",
|
|
259
262
|
children: [
|
|
260
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ s(
|
|
261
264
|
fe,
|
|
262
265
|
{
|
|
263
266
|
value: o ? {
|
|
@@ -267,11 +270,11 @@ const Ve = ue(
|
|
|
267
270
|
onChange: ae,
|
|
268
271
|
hour12: B,
|
|
269
272
|
minuteStep: Z,
|
|
270
|
-
size:
|
|
273
|
+
size: f
|
|
271
274
|
}
|
|
272
275
|
),
|
|
273
|
-
S ? /* @__PURE__ */
|
|
274
|
-
|
|
276
|
+
S ? /* @__PURE__ */ s("span", { className: "type-meta ds:text-muted-foreground", children: S }) : null,
|
|
277
|
+
R ? /* @__PURE__ */ s(
|
|
275
278
|
"span",
|
|
276
279
|
{
|
|
277
280
|
role: "alert",
|
|
@@ -279,13 +282,13 @@ const Ve = ue(
|
|
|
279
282
|
children: Q
|
|
280
283
|
}
|
|
281
284
|
) : null,
|
|
282
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ s(
|
|
283
286
|
"button",
|
|
284
287
|
{
|
|
285
288
|
type: "button",
|
|
286
|
-
onClick:
|
|
287
|
-
disabled: !o ||
|
|
288
|
-
className: Ve({ size:
|
|
289
|
+
onClick: se,
|
|
290
|
+
disabled: !o || R,
|
|
291
|
+
className: Ve({ size: f }),
|
|
289
292
|
children: J
|
|
290
293
|
}
|
|
291
294
|
)
|
|
@@ -300,9 +303,9 @@ const Ve = ue(
|
|
|
300
303
|
) });
|
|
301
304
|
}
|
|
302
305
|
);
|
|
303
|
-
|
|
306
|
+
Se.displayName = "DateTimePicker";
|
|
304
307
|
export {
|
|
305
|
-
|
|
308
|
+
Se as D,
|
|
306
309
|
Oe as d
|
|
307
310
|
};
|
|
308
|
-
//# sourceMappingURL=date-time-picker-
|
|
311
|
+
//# sourceMappingURL=date-time-picker-DG7BiGdb.js.map
|