@epam/ai-dial-ui-kit 0.16.0-dev.57 → 0.16.0-dev.59
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/CHANGELOG.md +8 -0
- package/dist/MarkdownEditor-5Jq0NTTP.cjs +1 -0
- package/dist/components/New/Calendar/Calendar.js +163 -154
- package/dist/components/New/MarkdownEditor/MarkdownEditor.js +40 -28
- package/dist/components/New/Notification/Notification.js +25 -24
- package/dist/components/New/StateScreen/StateScreen.js +23 -21
- package/dist/components/New/Steps/Steps.js +37 -35
- package/dist/components-manifest.json +39 -3
- package/dist/dial-ui-kit.cjs +3 -3
- package/dist/editors.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/src/components/New/Calendar/Calendar.d.ts +7 -0
- package/dist/src/components/New/MarkdownEditor/MarkdownEditor.d.ts +6 -0
- package/dist/src/components/New/Notification/Notification.d.ts +3 -0
- package/dist/src/components/New/StateScreen/StateScreen.d.ts +8 -0
- package/dist/src/components/New/Steps/Steps.d.ts +1 -1
- package/dist/src/models/step.d.ts +2 -0
- package/package.json +1 -1
- package/dist/MarkdownEditor-B-x8Ntfe.cjs +0 -1
package/dist/CHANGELOG.md
CHANGED
|
@@ -31,6 +31,14 @@ Versions match the git tags on the `development` branch.
|
|
|
31
31
|
|
|
32
32
|
### Added
|
|
33
33
|
|
|
34
|
+
- **`Calendar`, `MarkdownEditor` (2.0) — `ariaDescribedBy`; `MarkdownEditor` — `invalid`** — a host rendering its own `ErrorText` under these controls had nothing to link it with: `Calendar` took `invalid` but no description, and `MarkdownEditor` took neither, so hosts patched the DOM. `Calendar` sets `aria-describedby` on the focusable control — the masked input in `time` mode, which also gets `aria-invalid`, and the popover trigger otherwise. `MarkdownEditor` sets `aria-describedby` and `aria-invalid` on its textarea, and `invalid` draws the card border in the error colour. Reported from pg-ai-chat. Additive.
|
|
35
|
+
|
|
36
|
+
- **`StateScreen` (2.0) — `announce`** — wraps the screen in a `LiveRegion` of the given politeness, for a state that replaces content the user was working in (a load error, a crash), so hosts no longer wrap it in their own `role="alert"` div. Omitted, the screen renders exactly as before. Reported from pg-ai-chat. Additive.
|
|
37
|
+
|
|
38
|
+
- **`Notification` (2.0) — `closeAriaLabel`** — the close button was always named "Close notification", so a localised host could not use `closable`. Defaults to the old text, as `Popup` and `BottomSheet` already do. Reported from pg-ai-chat. Additive.
|
|
39
|
+
|
|
40
|
+
- **`Steps` (2.0) — `Step.disabled`** — blocks entering a step regardless of the statuses before it; the button is disabled and drawn with the 2.0 disable tokens. Reported from pg-ai-chat. Additive.
|
|
41
|
+
|
|
34
42
|
- **`Dropdown` (2.0) — `overlayRole` (`DropdownOverlayRole.Menu` / `Dialog` / `None`), `overlayAriaLabel`, `overlayAriaLabelledBy`, `returnFocus`** — the floating wrapper was always `role="menu"`, so a `renderOverlay` panel that is not a menu — a usage-limits dialog, an announcements region — sat inside a menu, which is invalid ARIA. `overlayRole={DropdownOverlayRole.Dialog}` renders `role="dialog"` with `aria-haspopup="dialog"` on the trigger, named by `overlayAriaLabelledBy`, `overlayAriaLabel` or, failing both, the trigger; `DropdownOverlayRole.None` renders a role-less wrapper and drops `aria-haspopup`, keeping `aria-expanded` / `aria-controls`, for content that brings its own role. Arrow-key navigation between options now runs for `Menu` only, so a dialog's own text field or listbox keeps its arrow keys. The role applies to `renderOverlay` only; the `items` list stays a menu. Closing the overlay — Escape, a chosen item, the close button — already returned focus to the trigger; `returnFocus={false}` now opts out. The default, `Menu`, renders exactly as before. ai-dial-chat's `UsageLimitsControl` and `AnnouncementsPopover` needed a non-menu panel. Additive.
|
|
35
43
|
|
|
36
44
|
- **`ToggleChip` (2.0)** — a chip that switches one option on and off on its own, for a row of independent toggles such as the tools a model may call. A native `<button aria-pressed>` drawn as the `TagAppearance.Selectable` filter chip — no fill until on, the accent-alpha fill and a semibold label once on — with `icon` before a `ReactNode` `label`, so a caller can add trailing ON / OFF text; `isSelected` (default `false`) and `onToggle(next)`, named as on `ToggleIconButton`; `disabled` greys it out with the 2.0 disable tokens while keeping its state visible. It has no remove control. `FilterChips` picks one value and `Tag` is a `<span>` with a string label, so neither fit. The root carries `dial-kit-toggle-chip` (`DIAL_KIT_CLASS.toggleChip`). ai-dial-chat's `ToolsChips` hand-rolled these. Additive.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),k=require("@uiw/react-md-editor"),f=require("./editors.cjs"),O=require("./icon-4D9xu6E_.cjs"),o=require("@tabler/icons-react");function p(n){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(s,r,a.get?a:{enumerable:!0,get:()=>n[r]})}}return s.default=n,Object.freeze(s)}const C=p(k),v=O.DIAL_ICON_SIZE.SM,t={size:v,stroke:O.DIAL_KIT_ICON_STROKE},i=(n,s)=>({...n,icon:s}),E=()=>{const{bold:n,code:s,divider:r,group:a,heading1:c,heading2:l,heading3:u,italic:m,link:I,orderedListCommand:x,quote:d,strikethrough:g,table:j,unorderedListCommand:b}=C;return[i(n,e.jsx(o.IconBold,{...t})),i(m,e.jsx(o.IconItalic,{...t})),i(g,e.jsx(o.IconStrikethrough,{...t})),r,a([c,l,u],{name:"heading",groupName:"heading",icon:e.jsx(o.IconTextSize,{...t}),buttonProps:{"aria-label":"Text style",title:"Text style"}}),r,i(b,e.jsx(o.IconList,{...t})),i(x,e.jsx(o.IconListNumbers,{...t})),r,i(d,e.jsx(o.IconQuote,{...t})),i(I,e.jsx(o.IconLink,{...t})),i(s,e.jsx(o.IconCode,{...t})),r,i(j,e.jsx(o.IconTable,{...t}))]},L=()=>{const{codeEdit:n,codeLive:s,codePreview:r,divider:a,fullscreen:c}=C;return[i(n,e.jsx(o.IconPencil,{...t})),i(s,e.jsx(o.IconLayoutColumns,{...t})),i(r,e.jsx(o.IconEye,{...t})),a,i(c,e.jsx(o.IconMaximize,{...t}))]},M=({value:n,onChange:s,height:r=300,theme:a=f.EditorThemes.light,className:c,placeholder:l,defaultPreview:u="edit",id:m,ariaLabel:I,ariaDescribedBy:x,invalid:d=!1,showDragbar:g=!0})=>{const j=h.useMemo(()=>E(),[]),b=h.useMemo(()=>L(),[]);return e.jsx("div",{"data-color-mode":a,className:O.mergeClasses("dial-kit-markdown-editor",d&&"dial-kit-markdown-editor-invalid",c),children:e.jsx(k,{value:n,onChange:_=>s?.(_||""),height:r,preview:u,visibleDragbar:g,commands:j,extraCommands:b,textareaProps:{placeholder:l,id:m,"aria-label":I,"aria-describedby":x,"aria-invalid":d||void 0}})})};exports.MarkdownEditor=M;
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { jsx as e, jsxs as d, Fragment as
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import { IconChevronDown as
|
|
4
|
-
import { useId as
|
|
5
|
-
import { Label as
|
|
6
|
-
import { StaticIconButton as
|
|
7
|
-
import { DIAL_KIT_ICON_STROKE as
|
|
8
|
-
import { DIAL_ICON_SIZE as
|
|
9
|
-
import { CalendarMode as
|
|
10
|
-
import { ElementSize as
|
|
11
|
-
import { useThemeScope as
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as ee, autoUpdate as te, offset as ae, flip as le, shift as ne, useDismiss as se, useRole as re, useInteractions as ie, FloatingPortal as oe, FloatingFocusManager as ce, useClick as De } from "@floating-ui/react";
|
|
3
|
+
import { IconChevronDown as Ie, IconClock as Fe } from "@tabler/icons-react";
|
|
4
|
+
import { useId as Le, useState as _, useMemo as A, useEffect as Se } from "react";
|
|
5
|
+
import { Label as Te } from "../Label/Label.js";
|
|
6
|
+
import { StaticIconButton as U } from "../IconButton/IconButtonWrappers.js";
|
|
7
|
+
import { DIAL_KIT_ICON_STROKE as de } from "../constants/icon.js";
|
|
8
|
+
import { DIAL_ICON_SIZE as me } from "../../../constants/icon.js";
|
|
9
|
+
import { CalendarMode as L } from "../../../types/calendar.js";
|
|
10
|
+
import { ElementSize as Y } from "../../../types/size.js";
|
|
11
|
+
import { useThemeScope as pe } from "../ThemeScope/ThemeScope.js";
|
|
12
12
|
import { mergeClasses as i } from "../../../utils/merge-classes.js";
|
|
13
|
-
import { getTimezoneLabel as
|
|
14
|
-
import { DEFAULT_CALENDAR_LOCALE as
|
|
15
|
-
import { getWeekdayShortLabels as
|
|
16
|
-
import { DIAL_KIT_CLASS as
|
|
17
|
-
import { TimePickerPanel as
|
|
18
|
-
const
|
|
13
|
+
import { getTimezoneLabel as Me } from "../../../utils/timezone.js";
|
|
14
|
+
import { DEFAULT_CALENDAR_LOCALE as Oe, calendarModeDefaultPlaceholder as ke, calendarFieldIconClassName as we, calendarNavIcons as G, calendarDaySelectedClassName as Pe, calendarDayTodayClassName as Ae, calendarDayOutsideClassName as Be, calendarDayButtonBaseClassName as Ee, calendarIcon as _e, calendarFieldDisabledClassName as fe, calendarFieldInvalidClassName as ue, calendarFieldBaseClassName as he, timePickerButtonClassName as Re, timePickerPopoverClassName as ze, calendarPopoverClassName as $e } from "./constants.js";
|
|
15
|
+
import { getWeekdayShortLabels as je, getWeekdayOptions as Ve, getMonthGrid as Ke, formatTimeLabel as E, formatMonthLabel as We, isSameDay as Z, isDateOutOfRange as q, formatDayAriaLabel as Ue, sanitizeTimeInput as Ye, isCompleteTimeString as Ge, setTimeOnDate as H, formatDateLabel as J } from "./utils.js";
|
|
16
|
+
import { DIAL_KIT_CLASS as $ } from "../../../constants/public-class-names.js";
|
|
17
|
+
import { TimePickerPanel as Ze } from "./TimePickerPanel.js";
|
|
18
|
+
const Q = ({
|
|
19
19
|
id: m,
|
|
20
20
|
disabled: l,
|
|
21
21
|
invalid: g,
|
|
22
|
-
trigger:
|
|
22
|
+
trigger: S,
|
|
23
23
|
panelClassName: r,
|
|
24
24
|
fieldClassName: T,
|
|
25
25
|
panel: N,
|
|
26
26
|
labelledBy: C,
|
|
27
|
-
|
|
27
|
+
describedBy: D,
|
|
28
|
+
panelLabel: O
|
|
28
29
|
}) => {
|
|
29
|
-
const b =
|
|
30
|
+
const b = pe(), [v, p] = _(!1), { refs: n, floatingStyles: y, context: f } = ee({
|
|
30
31
|
open: v,
|
|
31
|
-
onOpenChange: (
|
|
32
|
+
onOpenChange: (M) => p(l ? !1 : M),
|
|
32
33
|
placement: "bottom-start",
|
|
33
|
-
whileElementsMounted:
|
|
34
|
-
middleware: [
|
|
35
|
-
}),
|
|
36
|
-
|
|
34
|
+
whileElementsMounted: te,
|
|
35
|
+
middleware: [ae(8), le({ padding: 8 }), ne({ padding: 8 })]
|
|
36
|
+
}), I = De(f, { enabled: !l }), h = se(f), a = re(f, { role: "dialog" }), { getReferenceProps: k, getFloatingProps: o } = ie([
|
|
37
|
+
I,
|
|
37
38
|
h,
|
|
38
39
|
a
|
|
39
40
|
]);
|
|
40
|
-
return /* @__PURE__ */ d(
|
|
41
|
+
return /* @__PURE__ */ d(B, { children: [
|
|
41
42
|
/* @__PURE__ */ e(
|
|
42
43
|
"div",
|
|
43
44
|
{
|
|
@@ -48,20 +49,21 @@ const J = ({
|
|
|
48
49
|
"aria-expanded": v,
|
|
49
50
|
"aria-disabled": l,
|
|
50
51
|
"aria-labelledby": C,
|
|
52
|
+
"aria-describedby": D,
|
|
51
53
|
tabIndex: l ? -1 : 0,
|
|
52
54
|
className: i(
|
|
53
|
-
|
|
55
|
+
he,
|
|
54
56
|
"focus-visible:outline focus-visible:outline-focus",
|
|
55
|
-
g &&
|
|
56
|
-
l &&
|
|
57
|
+
g && ue,
|
|
58
|
+
l && fe,
|
|
57
59
|
T
|
|
58
60
|
),
|
|
59
|
-
...
|
|
60
|
-
children:
|
|
61
|
+
...k(),
|
|
62
|
+
children: S
|
|
61
63
|
}
|
|
62
64
|
),
|
|
63
|
-
v && /* @__PURE__ */ e(
|
|
64
|
-
|
|
65
|
+
v && /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(
|
|
66
|
+
ce,
|
|
65
67
|
{
|
|
66
68
|
context: f,
|
|
67
69
|
modal: !1,
|
|
@@ -71,10 +73,10 @@ const J = ({
|
|
|
71
73
|
"div",
|
|
72
74
|
{
|
|
73
75
|
ref: n.setFloating,
|
|
74
|
-
style:
|
|
75
|
-
"aria-label":
|
|
76
|
+
style: y,
|
|
77
|
+
"aria-label": O,
|
|
76
78
|
className: i(
|
|
77
|
-
|
|
79
|
+
$e,
|
|
78
80
|
b,
|
|
79
81
|
r
|
|
80
82
|
),
|
|
@@ -85,31 +87,32 @@ const J = ({
|
|
|
85
87
|
}
|
|
86
88
|
) })
|
|
87
89
|
] });
|
|
88
|
-
},
|
|
90
|
+
}, X = ({
|
|
89
91
|
id: m,
|
|
90
92
|
value: l,
|
|
91
93
|
onChange: g,
|
|
92
|
-
onBlur:
|
|
94
|
+
onBlur: S,
|
|
93
95
|
disabled: r,
|
|
94
96
|
invalid: T,
|
|
95
97
|
className: N,
|
|
96
98
|
ariaLabel: C,
|
|
97
|
-
|
|
99
|
+
describedBy: D,
|
|
100
|
+
placeholder: O = "--:--",
|
|
98
101
|
timezoneLabel: b,
|
|
99
102
|
timezoneLabelClassName: v,
|
|
100
103
|
picker: p = !1
|
|
101
104
|
}) => {
|
|
102
|
-
const [n,
|
|
105
|
+
const [n, y] = _(l), [f, I] = _(!1), h = pe(), { refs: a, floatingStyles: k, context: o } = ee({
|
|
103
106
|
open: f,
|
|
104
|
-
onOpenChange: (c) =>
|
|
107
|
+
onOpenChange: (c) => I(r ? !1 : c),
|
|
105
108
|
placement: "bottom-start",
|
|
106
|
-
whileElementsMounted:
|
|
107
|
-
middleware: [
|
|
108
|
-
}),
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
whileElementsMounted: te,
|
|
110
|
+
middleware: [ae(8), le({ padding: 8 }), ne({ padding: 8 })]
|
|
111
|
+
}), M = se(o), R = re(o, { role: "dialog" }), { getFloatingProps: w } = ie([M, R]);
|
|
112
|
+
Se(() => {
|
|
113
|
+
y(l);
|
|
111
114
|
}, [l]);
|
|
112
|
-
const
|
|
115
|
+
const P = /* @__PURE__ */ e(
|
|
113
116
|
"input",
|
|
114
117
|
{
|
|
115
118
|
id: m,
|
|
@@ -117,30 +120,32 @@ const J = ({
|
|
|
117
120
|
inputMode: "numeric",
|
|
118
121
|
autoComplete: "off",
|
|
119
122
|
"aria-label": C,
|
|
120
|
-
|
|
123
|
+
"aria-describedby": D,
|
|
124
|
+
"aria-invalid": T || void 0,
|
|
125
|
+
placeholder: O,
|
|
121
126
|
disabled: r,
|
|
122
127
|
value: n,
|
|
123
128
|
onChange: (c) => {
|
|
124
|
-
const u =
|
|
125
|
-
|
|
129
|
+
const u = Ye(c.target.value);
|
|
130
|
+
y(u), Ge(u) && g(u);
|
|
126
131
|
},
|
|
127
|
-
onBlur:
|
|
132
|
+
onBlur: S,
|
|
128
133
|
className: i(
|
|
129
|
-
|
|
130
|
-
T &&
|
|
131
|
-
r &&
|
|
134
|
+
he,
|
|
135
|
+
T && ue,
|
|
136
|
+
r && fe,
|
|
132
137
|
p && "pe-12",
|
|
133
138
|
N
|
|
134
139
|
)
|
|
135
140
|
}
|
|
136
141
|
);
|
|
137
|
-
return !b && !p ?
|
|
142
|
+
return !b && !p ? P : /* @__PURE__ */ d(
|
|
138
143
|
"div",
|
|
139
144
|
{
|
|
140
145
|
ref: p ? a.setReference : void 0,
|
|
141
146
|
className: "relative w-full",
|
|
142
147
|
children: [
|
|
143
|
-
|
|
148
|
+
P,
|
|
144
149
|
b && /* @__PURE__ */ e(
|
|
145
150
|
"span",
|
|
146
151
|
{
|
|
@@ -152,7 +157,7 @@ const J = ({
|
|
|
152
157
|
children: b
|
|
153
158
|
}
|
|
154
159
|
),
|
|
155
|
-
p && /* @__PURE__ */ d(
|
|
160
|
+
p && /* @__PURE__ */ d(B, { children: [
|
|
156
161
|
/* @__PURE__ */ e(
|
|
157
162
|
"button",
|
|
158
163
|
{
|
|
@@ -161,20 +166,20 @@ const J = ({
|
|
|
161
166
|
"aria-haspopup": "dialog",
|
|
162
167
|
"aria-expanded": f,
|
|
163
168
|
disabled: r,
|
|
164
|
-
className:
|
|
165
|
-
onClick: () =>
|
|
169
|
+
className: Re,
|
|
170
|
+
onClick: () => I((c) => !c),
|
|
166
171
|
children: /* @__PURE__ */ e(
|
|
167
|
-
|
|
172
|
+
Fe,
|
|
168
173
|
{
|
|
169
|
-
size:
|
|
170
|
-
stroke:
|
|
174
|
+
size: me.MD,
|
|
175
|
+
stroke: de,
|
|
171
176
|
"aria-hidden": "true"
|
|
172
177
|
}
|
|
173
178
|
)
|
|
174
179
|
}
|
|
175
180
|
),
|
|
176
|
-
f && /* @__PURE__ */ e(
|
|
177
|
-
|
|
181
|
+
f && /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(
|
|
182
|
+
ce,
|
|
178
183
|
{
|
|
179
184
|
context: o,
|
|
180
185
|
modal: !1,
|
|
@@ -184,19 +189,19 @@ const J = ({
|
|
|
184
189
|
"div",
|
|
185
190
|
{
|
|
186
191
|
ref: a.setFloating,
|
|
187
|
-
style:
|
|
192
|
+
style: k,
|
|
188
193
|
"aria-label": "Choose time",
|
|
189
194
|
className: i(
|
|
190
|
-
|
|
195
|
+
ze,
|
|
191
196
|
h
|
|
192
197
|
),
|
|
193
|
-
...
|
|
198
|
+
...w(),
|
|
194
199
|
children: /* @__PURE__ */ e(
|
|
195
|
-
|
|
200
|
+
Ze,
|
|
196
201
|
{
|
|
197
202
|
value: n,
|
|
198
203
|
onSelect: (c, u) => {
|
|
199
|
-
|
|
204
|
+
y(c), g(c), u && I(!1);
|
|
200
205
|
}
|
|
201
206
|
}
|
|
202
207
|
)
|
|
@@ -208,47 +213,48 @@ const J = ({
|
|
|
208
213
|
]
|
|
209
214
|
}
|
|
210
215
|
);
|
|
211
|
-
},
|
|
212
|
-
mode: m =
|
|
216
|
+
}, pt = ({
|
|
217
|
+
mode: m = L.Date,
|
|
213
218
|
value: l,
|
|
214
219
|
onChange: g,
|
|
215
|
-
onBlur:
|
|
220
|
+
onBlur: S,
|
|
216
221
|
labelProps: r,
|
|
217
222
|
placeholder: T,
|
|
218
223
|
disabled: N = !1,
|
|
219
224
|
invalid: C = !1,
|
|
220
|
-
|
|
225
|
+
ariaDescribedBy: D,
|
|
226
|
+
id: O,
|
|
221
227
|
className: b,
|
|
222
228
|
minDate: v,
|
|
223
229
|
maxDate: p,
|
|
224
|
-
locale: n =
|
|
225
|
-
fieldClassName:
|
|
230
|
+
locale: n = Oe,
|
|
231
|
+
fieldClassName: y,
|
|
226
232
|
showTimezone: f = !1,
|
|
227
|
-
showTimePicker:
|
|
233
|
+
showTimePicker: I = !0
|
|
228
234
|
}) => {
|
|
229
|
-
const h = T ??
|
|
235
|
+
const h = T ?? ke[m], a = l instanceof Date ? l : null, k = Le(), o = O ?? k, M = r?.id ?? `${o}-label`, R = !!r?.label, w = typeof r?.label == "string" ? r.label : void 0, P = R ? `${M} ${o}` : void 0, c = r ? /* @__PURE__ */ e(Te, { ...r, id: M, htmlFor: o }) : null, [u, ge] = _(
|
|
230
236
|
() => a ?? /* @__PURE__ */ new Date()
|
|
231
|
-
),
|
|
232
|
-
() => f ?
|
|
237
|
+
), be = A(() => /* @__PURE__ */ new Date(), []), z = A(
|
|
238
|
+
() => f ? Me({ locale: n }) : null,
|
|
233
239
|
[f, n]
|
|
234
|
-
),
|
|
235
|
-
() =>
|
|
240
|
+
), ye = A(
|
|
241
|
+
() => je(n),
|
|
236
242
|
[n]
|
|
237
|
-
),
|
|
238
|
-
() =>
|
|
243
|
+
), j = A(() => Ve(n), [n]), xe = A(
|
|
244
|
+
() => Ke(u.getFullYear(), u.getMonth()),
|
|
239
245
|
[u]
|
|
240
|
-
),
|
|
241
|
-
|
|
246
|
+
), V = (s) => {
|
|
247
|
+
ge(
|
|
242
248
|
(t) => new Date(t.getFullYear(), t.getMonth() + s, 1)
|
|
243
249
|
);
|
|
244
|
-
},
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
-
g?.(
|
|
248
|
-
},
|
|
249
|
-
g?.(
|
|
250
|
-
},
|
|
251
|
-
if (m ===
|
|
250
|
+
}, ve = (s, t) => {
|
|
251
|
+
if (q(s, v, p)) return;
|
|
252
|
+
const F = m === L.DateTime && a ? H(s, E(a)) : s;
|
|
253
|
+
g?.(F), m === L.Date && t();
|
|
254
|
+
}, Ne = (s) => {
|
|
255
|
+
g?.(H(a ?? /* @__PURE__ */ new Date(), s));
|
|
256
|
+
}, Ce = () => a ? m === L.DateTime ? `${J(a, n)}, ${E(a)}` : J(a, n) : h;
|
|
257
|
+
if (m === L.Time) {
|
|
252
258
|
const s = typeof l == "string" ? l : a ? E(a) : "";
|
|
253
259
|
return /* @__PURE__ */ d(
|
|
254
260
|
"div",
|
|
@@ -256,51 +262,53 @@ const J = ({
|
|
|
256
262
|
className: i(
|
|
257
263
|
"flex flex-col gap-y-3",
|
|
258
264
|
b,
|
|
259
|
-
|
|
265
|
+
$.calendar
|
|
260
266
|
),
|
|
261
267
|
children: [
|
|
262
268
|
c,
|
|
263
269
|
/* @__PURE__ */ e(
|
|
264
|
-
|
|
270
|
+
X,
|
|
265
271
|
{
|
|
266
272
|
id: o,
|
|
267
273
|
value: s,
|
|
268
274
|
onChange: (t) => g?.(t),
|
|
269
|
-
onBlur:
|
|
275
|
+
onBlur: S,
|
|
270
276
|
disabled: N,
|
|
271
277
|
invalid: C,
|
|
278
|
+
describedBy: D,
|
|
272
279
|
placeholder: h,
|
|
273
|
-
className:
|
|
274
|
-
timezoneLabel:
|
|
275
|
-
picker:
|
|
280
|
+
className: y,
|
|
281
|
+
timezoneLabel: z,
|
|
282
|
+
picker: I
|
|
276
283
|
}
|
|
277
284
|
)
|
|
278
285
|
]
|
|
279
286
|
}
|
|
280
287
|
);
|
|
281
288
|
}
|
|
282
|
-
if (m ===
|
|
283
|
-
const s = typeof l == "string" ? l : void 0, t =
|
|
289
|
+
if (m === L.Weekday) {
|
|
290
|
+
const s = typeof l == "string" ? l : void 0, t = j.find((F) => F.value === s);
|
|
284
291
|
return /* @__PURE__ */ d(
|
|
285
292
|
"div",
|
|
286
293
|
{
|
|
287
294
|
className: i(
|
|
288
295
|
"flex flex-col gap-y-3",
|
|
289
296
|
b,
|
|
290
|
-
|
|
297
|
+
$.calendar
|
|
291
298
|
),
|
|
292
299
|
children: [
|
|
293
300
|
c,
|
|
294
301
|
/* @__PURE__ */ e(
|
|
295
|
-
|
|
302
|
+
Q,
|
|
296
303
|
{
|
|
297
304
|
id: o,
|
|
298
305
|
disabled: N,
|
|
299
306
|
invalid: C,
|
|
300
|
-
labelledBy:
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
307
|
+
labelledBy: P,
|
|
308
|
+
describedBy: D,
|
|
309
|
+
panelLabel: w ?? h,
|
|
310
|
+
fieldClassName: y,
|
|
311
|
+
trigger: /* @__PURE__ */ d(B, { children: [
|
|
304
312
|
/* @__PURE__ */ e(
|
|
305
313
|
"span",
|
|
306
314
|
{
|
|
@@ -312,38 +320,38 @@ const J = ({
|
|
|
312
320
|
}
|
|
313
321
|
),
|
|
314
322
|
/* @__PURE__ */ e(
|
|
315
|
-
|
|
323
|
+
Ie,
|
|
316
324
|
{
|
|
317
|
-
size:
|
|
318
|
-
stroke:
|
|
325
|
+
size: me.MD,
|
|
326
|
+
stroke: de,
|
|
319
327
|
"aria-hidden": "true",
|
|
320
|
-
className:
|
|
328
|
+
className: we
|
|
321
329
|
}
|
|
322
330
|
)
|
|
323
331
|
] }),
|
|
324
|
-
panel: (
|
|
332
|
+
panel: (F) => /* @__PURE__ */ e(
|
|
325
333
|
"div",
|
|
326
334
|
{
|
|
327
335
|
role: "listbox",
|
|
328
|
-
"aria-label":
|
|
336
|
+
"aria-label": w ?? h,
|
|
329
337
|
className: "flex flex-col gap-0.5",
|
|
330
|
-
children:
|
|
338
|
+
children: j.map((x) => /* @__PURE__ */ e(
|
|
331
339
|
"button",
|
|
332
340
|
{
|
|
333
341
|
type: "button",
|
|
334
342
|
role: "option",
|
|
335
|
-
"aria-selected":
|
|
343
|
+
"aria-selected": x.value === s,
|
|
336
344
|
className: i(
|
|
337
345
|
"flex w-full items-center rounded-lg px-3 py-2 text-left dial-small-text text-primary hover:bg-control-accent-alpha-hover",
|
|
338
346
|
"focus-visible:outline focus-visible:outline-focus",
|
|
339
|
-
|
|
347
|
+
x.value === s && "bg-control-accent-alpha-hover"
|
|
340
348
|
),
|
|
341
349
|
onClick: () => {
|
|
342
|
-
g?.(
|
|
350
|
+
g?.(x.value), F();
|
|
343
351
|
},
|
|
344
|
-
children:
|
|
352
|
+
children: x.label
|
|
345
353
|
},
|
|
346
|
-
|
|
354
|
+
x.value
|
|
347
355
|
))
|
|
348
356
|
}
|
|
349
357
|
)
|
|
@@ -359,20 +367,21 @@ const J = ({
|
|
|
359
367
|
className: i(
|
|
360
368
|
"flex flex-col gap-y-3",
|
|
361
369
|
b,
|
|
362
|
-
|
|
370
|
+
$.calendar
|
|
363
371
|
),
|
|
364
372
|
children: [
|
|
365
373
|
c,
|
|
366
374
|
/* @__PURE__ */ e(
|
|
367
|
-
|
|
375
|
+
Q,
|
|
368
376
|
{
|
|
369
377
|
id: o,
|
|
370
378
|
disabled: N,
|
|
371
379
|
invalid: C,
|
|
372
|
-
labelledBy:
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
380
|
+
labelledBy: P,
|
|
381
|
+
describedBy: D,
|
|
382
|
+
panelLabel: w ?? h,
|
|
383
|
+
fieldClassName: y,
|
|
384
|
+
trigger: /* @__PURE__ */ d(B, { children: [
|
|
376
385
|
/* @__PURE__ */ e(
|
|
377
386
|
"span",
|
|
378
387
|
{
|
|
@@ -380,20 +389,20 @@ const J = ({
|
|
|
380
389
|
"truncate",
|
|
381
390
|
!a && "text-secondary"
|
|
382
391
|
),
|
|
383
|
-
children:
|
|
392
|
+
children: Ce()
|
|
384
393
|
}
|
|
385
394
|
),
|
|
386
395
|
_e
|
|
387
396
|
] }),
|
|
388
|
-
panel: (s) => /* @__PURE__ */ d(
|
|
397
|
+
panel: (s) => /* @__PURE__ */ d(B, { children: [
|
|
389
398
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
390
399
|
/* @__PURE__ */ e(
|
|
391
|
-
|
|
400
|
+
U,
|
|
392
401
|
{
|
|
393
402
|
"aria-label": "Previous month",
|
|
394
|
-
icon:
|
|
395
|
-
size:
|
|
396
|
-
onClick: () =>
|
|
403
|
+
icon: G.prev,
|
|
404
|
+
size: Y.Small,
|
|
405
|
+
onClick: () => V(-1)
|
|
397
406
|
}
|
|
398
407
|
),
|
|
399
408
|
/* @__PURE__ */ e(
|
|
@@ -401,21 +410,21 @@ const J = ({
|
|
|
401
410
|
{
|
|
402
411
|
className: "dial-small-semi-text text-primary",
|
|
403
412
|
"aria-live": "polite",
|
|
404
|
-
children:
|
|
413
|
+
children: We(u, n)
|
|
405
414
|
}
|
|
406
415
|
),
|
|
407
416
|
/* @__PURE__ */ e(
|
|
408
|
-
|
|
417
|
+
U,
|
|
409
418
|
{
|
|
410
419
|
"aria-label": "Next month",
|
|
411
|
-
icon:
|
|
412
|
-
size:
|
|
413
|
-
onClick: () =>
|
|
420
|
+
icon: G.next,
|
|
421
|
+
size: Y.Small,
|
|
422
|
+
onClick: () => V(1)
|
|
414
423
|
}
|
|
415
424
|
)
|
|
416
425
|
] }),
|
|
417
426
|
/* @__PURE__ */ d("div", { className: "grid grid-cols-7 gap-y-1 text-center", children: [
|
|
418
|
-
|
|
427
|
+
ye.map((t) => /* @__PURE__ */ e(
|
|
419
428
|
"div",
|
|
420
429
|
{
|
|
421
430
|
"aria-hidden": "true",
|
|
@@ -425,43 +434,43 @@ const J = ({
|
|
|
425
434
|
t
|
|
426
435
|
)),
|
|
427
436
|
xe.map((t) => {
|
|
428
|
-
const
|
|
437
|
+
const F = t.getMonth() !== u.getMonth(), x = Z(t, a), K = Z(t, be), W = q(t, v, p);
|
|
429
438
|
return /* @__PURE__ */ e(
|
|
430
439
|
"button",
|
|
431
440
|
{
|
|
432
441
|
type: "button",
|
|
433
|
-
disabled:
|
|
434
|
-
"aria-label":
|
|
435
|
-
"aria-pressed":
|
|
436
|
-
"aria-current":
|
|
442
|
+
disabled: W,
|
|
443
|
+
"aria-label": Ue(t, n),
|
|
444
|
+
"aria-pressed": x,
|
|
445
|
+
"aria-current": K ? "date" : void 0,
|
|
437
446
|
className: i(
|
|
438
447
|
Ee,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
448
|
+
F && Be,
|
|
449
|
+
K && !x && Ae,
|
|
450
|
+
x && Pe,
|
|
451
|
+
W && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
443
452
|
),
|
|
444
|
-
onClick: () =>
|
|
453
|
+
onClick: () => ve(t, s),
|
|
445
454
|
children: t.getDate()
|
|
446
455
|
},
|
|
447
456
|
t.toISOString()
|
|
448
457
|
);
|
|
449
458
|
})
|
|
450
459
|
] }),
|
|
451
|
-
m ===
|
|
460
|
+
m === L.DateTime && /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 border-t border-secondary pt-3", children: [
|
|
452
461
|
/* @__PURE__ */ e("span", { className: "dial-small-text text-primary", children: "Time" }),
|
|
453
462
|
/* @__PURE__ */ e(
|
|
454
|
-
|
|
463
|
+
X,
|
|
455
464
|
{
|
|
456
465
|
ariaLabel: "Time",
|
|
457
466
|
value: a ? E(a) : "",
|
|
458
|
-
onChange:
|
|
459
|
-
onBlur:
|
|
467
|
+
onChange: Ne,
|
|
468
|
+
onBlur: S,
|
|
460
469
|
className: i(
|
|
461
|
-
!
|
|
470
|
+
!z && "w-[120px]",
|
|
462
471
|
"px-3 py-1.5"
|
|
463
472
|
),
|
|
464
|
-
timezoneLabel:
|
|
473
|
+
timezoneLabel: z,
|
|
465
474
|
timezoneLabelClassName: "end-3 max-w-[60%]"
|
|
466
475
|
}
|
|
467
476
|
)
|
|
@@ -474,5 +483,5 @@ const J = ({
|
|
|
474
483
|
);
|
|
475
484
|
};
|
|
476
485
|
export {
|
|
477
|
-
|
|
486
|
+
pt as Calendar
|
|
478
487
|
};
|