@epam/ai-dial-ui-kit 0.15.0-dev.3 → 0.15.0-dev.30

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.
Files changed (168) hide show
  1. package/README.md +185 -0
  2. package/dist/CHANGELOG.md +48 -0
  3. package/dist/{DateCellRenderer-BVM-Q8yx.cjs → DateCellRenderer-BFEh4rXZ.cjs} +26 -26
  4. package/dist/DateCellRenderer-J1V3xwF7.cjs +1 -0
  5. package/dist/IconButton-DHOFapLo.cjs +1 -0
  6. package/dist/{JsonEditor-qv1Z0dLX.cjs → JsonEditor-BDe6elKO.cjs} +1 -1
  7. package/dist/{MarkdownEditor-DHn2pYOJ.cjs → MarkdownEditor-C7BONfsl.cjs} +1 -1
  8. package/dist/{MarkdownEditor-jQ8nDJfx.cjs → MarkdownEditor-FVzYMdkC.cjs} +1 -1
  9. package/dist/{MarkdownEditorContainer-Bzcnoemw.cjs → MarkdownEditorContainer-GvlxX6kx.cjs} +1 -1
  10. package/dist/{Switch-CUKClcEz.cjs → Switch-DE6MrcqJ.cjs} +1 -1
  11. package/dist/components/Button/constants.js +9 -8
  12. package/dist/components/Dropdown/Dropdown.js +70 -65
  13. package/dist/components/Dropdown/DropdownSubMenuItem.js +63 -55
  14. package/dist/components/Dropdown/constants.js +16 -14
  15. package/dist/components/DropdownIcon/DropdownIcon.js +43 -32
  16. package/dist/components/FileManager/FileManager.js +373 -372
  17. package/dist/components/FileManager/FileManagerProvider.js +266 -264
  18. package/dist/components/FileManager/hooks/use-grid-context-menu.js +59 -59
  19. package/dist/components/New/Accordion/Accordion.js +87 -71
  20. package/dist/components/New/Breadcrumbs/Breadcrumbs.js +159 -0
  21. package/dist/components/New/Breadcrumbs/constants.js +41 -0
  22. package/dist/components/New/Button/Button.js +32 -32
  23. package/dist/components/New/Button/ButtonWrappers.js +93 -37
  24. package/dist/components/New/Button/constants.js +3 -0
  25. package/dist/components/New/Button/utils.js +18 -8
  26. package/dist/components/New/ButtonDropdown/ButtonDropdown.js +26 -16
  27. package/dist/components/New/Calendar/Calendar.js +337 -289
  28. package/dist/components/New/Calendar/constants.js +5 -5
  29. package/dist/components/New/CaptionText/CaptionText.js +18 -15
  30. package/dist/components/New/CardShell/CardShell.js +5 -3
  31. package/dist/components/New/Checkbox/Checkbox.js +67 -56
  32. package/dist/components/New/Checkbox/CheckboxBox.js +5 -3
  33. package/dist/components/New/CloseButton/CloseButton.js +18 -16
  34. package/dist/components/New/CollapsibleSidebar/CollapsibleSidebar.js +39 -34
  35. package/dist/components/New/ConfirmationPopup/ConfirmationPopup.js +44 -39
  36. package/dist/components/New/Dropdown/Dropdown.js +112 -105
  37. package/dist/components/New/Dropdown/DropdownSubMenuItem.js +17 -17
  38. package/dist/components/New/Dropdown/constants.js +22 -17
  39. package/dist/components/New/EllipsisTooltip/EllipsisTooltip.js +20 -18
  40. package/dist/components/New/FileDropzone/FileDropzone.js +27 -25
  41. package/dist/components/New/FileIcon/FileIcon.js +55 -0
  42. package/dist/components/New/FileIcon/constants.js +134 -0
  43. package/dist/components/New/FileIcon/icons/FileGlyph.js +150 -0
  44. package/dist/components/New/FileIcon/icons/FolderGlyph.js +50 -0
  45. package/dist/components/New/FileName/FileName.js +78 -0
  46. package/dist/components/New/FilterChips/FilterChips.js +43 -0
  47. package/dist/components/New/FilterChips/constants.js +5 -0
  48. package/dist/components/New/FolderName/FolderName.js +16 -0
  49. package/dist/components/New/FolderPath/FolderPath.js +29 -28
  50. package/dist/components/New/Highlight/Highlight.js +23 -30
  51. package/dist/components/New/IconButton/IconButton.js +30 -28
  52. package/dist/components/New/InfoButton/InfoButton.js +13 -11
  53. package/dist/components/New/InlineSelect/InlineSelect.js +74 -56
  54. package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +41 -39
  55. package/dist/components/New/InteractiveTooltip/constants.js +2 -2
  56. package/dist/components/New/Label/Label.js +13 -8
  57. package/dist/components/New/MenuItem/MenuItem.js +29 -27
  58. package/dist/components/New/MenuItem/constants.js +9 -8
  59. package/dist/components/New/NoDataContent/NoDataContent.js +21 -19
  60. package/dist/components/New/Notification/Notification.js +33 -29
  61. package/dist/components/New/NumberInput/NumberInput.js +42 -33
  62. package/dist/components/New/PasswordInput/PasswordInput.js +41 -35
  63. package/dist/components/New/Popup/Popup.js +46 -44
  64. package/dist/components/New/Popup/constants.js +3 -3
  65. package/dist/components/New/Radio/Radio.js +75 -64
  66. package/dist/components/New/RadioGroup/RadioGroup.js +76 -65
  67. package/dist/components/New/RadioGroupPopupField/RadioGroupPopupField.js +117 -106
  68. package/dist/components/New/ResizableContainer/ResizableContainer.js +42 -40
  69. package/dist/components/New/Search/Search.js +29 -27
  70. package/dist/components/New/SegmentedControl/SegmentedControl.js +29 -23
  71. package/dist/components/New/Select/Select.js +120 -109
  72. package/dist/components/New/Select/constants.js +23 -20
  73. package/dist/components/New/SharedEntityIndicator/SharedEntityIndicator.js +34 -0
  74. package/dist/components/New/Switch/Switch.js +69 -58
  75. package/dist/components/New/Tabs/Tabs.js +125 -61
  76. package/dist/components/New/Tag/Tag.js +42 -40
  77. package/dist/components/New/TagInput/TagInput.js +45 -43
  78. package/dist/components/New/ToggleIconButton/ToggleIconButton.js +26 -24
  79. package/dist/components/New/Tooltip/TooltipContent.js +11 -9
  80. package/dist/components/New/Tooltip/constants.js +1 -1
  81. package/dist/components/New/TransferQueue/TransferQueue.js +124 -0
  82. package/dist/components/New/TransferQueue/TransferQueueHeader.js +71 -0
  83. package/dist/components/New/TransferQueue/TransferQueueRow.js +119 -0
  84. package/dist/components/New/TransferQueue/constants.js +24 -0
  85. package/dist/components/New/constants/overlay.js +15 -9
  86. package/dist/components/Popup/constants.js +8 -8
  87. package/dist/components/ProgressBar/ProgressBar.js +45 -33
  88. package/dist/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.js +46 -31
  89. package/dist/components/SchemaRenderer/components/SchemaField.js +19 -19
  90. package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +18 -18
  91. package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +223 -135
  92. package/dist/components/SchemaRenderer/types.js +19 -8
  93. package/dist/components/SchemaRenderer/utils.js +122 -95
  94. package/dist/components/Skeleton/Skeleton.js +25 -19
  95. package/dist/components/Spinner/Spinner.js +7 -5
  96. package/dist/components/Tooltip/TooltipContent.js +11 -11
  97. package/dist/components-manifest.json +830 -31
  98. package/dist/constants/public-class-names.js +198 -0
  99. package/dist/dial-ui-kit.cjs +2 -2
  100. package/dist/dial-ui-kit.js +330 -302
  101. package/dist/editors.cjs +1 -1
  102. package/dist/file-manager.cjs +1 -1
  103. package/dist/grid.cjs +1 -1
  104. package/dist/index.css +2 -2
  105. package/dist/lazy-BEsZqouS.cjs +1 -0
  106. package/dist/merge-classes-BEJXjzkx.cjs +1 -0
  107. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +419 -399
  108. package/dist/src/components/FileManager/FileManager.d.ts +2 -0
  109. package/dist/src/components/FileManager/FileManagerContext.d.ts +1 -0
  110. package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +2 -1
  111. package/dist/src/components/New/Accordion/Accordion.d.ts +6 -1
  112. package/dist/src/components/New/Breadcrumbs/Breadcrumbs.d.ts +94 -0
  113. package/dist/src/components/New/Breadcrumbs/constants.d.ts +60 -0
  114. package/dist/src/components/New/Button/Button.d.ts +4 -1
  115. package/dist/src/components/New/Button/ButtonWrappers.d.ts +20 -0
  116. package/dist/src/components/New/Button/utils.d.ts +15 -0
  117. package/dist/src/components/New/ButtonDropdown/ButtonDropdown.d.ts +4 -0
  118. package/dist/src/components/New/Calendar/Calendar.d.ts +14 -1
  119. package/dist/src/components/New/Calendar/constants.d.ts +1 -1
  120. package/dist/src/components/New/Dropdown/Dropdown.d.ts +9 -1
  121. package/dist/src/components/New/Dropdown/constants.d.ts +3 -0
  122. package/dist/src/components/New/FileIcon/FileIcon.d.ts +61 -0
  123. package/dist/src/components/New/FileIcon/constants.d.ts +16 -0
  124. package/dist/src/components/New/FileIcon/icons/FileGlyph.d.ts +18 -0
  125. package/dist/src/components/New/FileIcon/icons/FolderGlyph.d.ts +17 -0
  126. package/dist/src/components/New/FileName/FileName.d.ts +79 -0
  127. package/dist/src/components/New/FilterChips/FilterChips.d.ts +69 -0
  128. package/dist/src/components/New/FilterChips/constants.d.ts +13 -0
  129. package/dist/src/components/New/FolderName/FolderName.d.ts +37 -0
  130. package/dist/src/components/New/InlineSelect/InlineSelect.d.ts +16 -1
  131. package/dist/src/components/New/InteractiveTooltip/constants.d.ts +5 -4
  132. package/dist/src/components/New/Notification/Notification.d.ts +18 -0
  133. package/dist/src/components/New/Popup/constants.d.ts +1 -1
  134. package/dist/src/components/New/Select/constants.d.ts +3 -2
  135. package/dist/src/components/New/SharedEntityIndicator/SharedEntityIndicator.d.ts +35 -0
  136. package/dist/src/components/New/Tabs/Tabs.d.ts +54 -6
  137. package/dist/src/components/New/Tooltip/constants.d.ts +5 -3
  138. package/dist/src/components/New/TransferQueue/TransferQueue.d.ts +139 -0
  139. package/dist/src/components/New/TransferQueue/TransferQueueHeader.d.ts +16 -0
  140. package/dist/src/components/New/TransferQueue/TransferQueueRow.d.ts +10 -0
  141. package/dist/src/components/New/TransferQueue/constants.d.ts +6 -0
  142. package/dist/src/components/New/constants/overlay.d.ts +13 -0
  143. package/dist/src/components/Popup/constants.d.ts +1 -1
  144. package/dist/src/components/SchemaRenderer/types.d.ts +11 -0
  145. package/dist/src/components/SchemaRenderer/utils.d.ts +10 -1
  146. package/dist/src/constants/public-class-names.d.ts +189 -0
  147. package/dist/src/index.d.ts +22 -1
  148. package/dist/src/types/accordion.d.ts +7 -0
  149. package/dist/src/types/breadcrumbs.d.ts +9 -0
  150. package/dist/src/types/button.d.ts +1 -0
  151. package/dist/src/types/transfer-queue.d.ts +10 -0
  152. package/dist/src/utils/__tests__/timezone.spec.d.ts +1 -0
  153. package/dist/src/utils/sub-menu-floating.d.ts +7 -4
  154. package/dist/src/utils/timezone.d.ts +24 -0
  155. package/dist/types/accordion.js +4 -0
  156. package/dist/types/breadcrumbs.js +4 -0
  157. package/dist/types/button.js +3 -3
  158. package/dist/types/transfer-queue.js +4 -0
  159. package/dist/use-file-manager-tabs-C0h1Sq5T.cjs +3 -0
  160. package/dist/utils/merge-classes.js +12 -5
  161. package/dist/utils/sub-menu-floating.js +98 -54
  162. package/dist/utils/timezone.js +19 -0
  163. package/package.json +3 -3
  164. package/dist/DateCellRenderer-ssp7eaZY.cjs +0 -1
  165. package/dist/IconButton-DWqoaBWf.cjs +0 -1
  166. package/dist/lazy-tfN4sKhq.cjs +0 -1
  167. package/dist/merge-classes-Dipy1Ih1.cjs +0 -1
  168. package/dist/use-file-manager-tabs-DjdR_mYM.cjs +0 -3
@@ -1,343 +1,391 @@
1
- import { jsx as t, jsxs as o, Fragment as O } from "react/jsx-runtime";
2
- import { useFloating as ne, autoUpdate as re, offset as se, flip as ie, shift as oe, useClick as ce, useDismiss as de, useRole as me, useInteractions as fe, FloatingPortal as pe, FloatingFocusManager as ue } from "@floating-ui/react";
3
- import { IconChevronDown as he } from "@tabler/icons-react";
4
- import { useId as ge, useState as E, useMemo as S, useEffect as be } from "react";
5
- import { Label as xe } from "../Label/Label.js";
6
- import { StaticIconButton as $ } from "../IconButton/IconButtonWrappers.js";
7
- import { DIAL_KIT_ICON_STROKE as ye } from "../constants/icon.js";
8
- import { DIAL_ICON_SIZE as ve } from "../../../constants/icon.js";
9
- import { CalendarMode as v } from "../../../types/calendar.js";
10
- import { ElementSize as j } from "../../../types/size.js";
11
- import { useThemeScope as De } from "../ThemeScope/ThemeScope.js";
12
- import { mergeClasses as c } from "../../../utils/merge-classes.js";
13
- import { DEFAULT_CALENDAR_LOCALE as Ne, calendarModeDefaultPlaceholder as Ce, calendarFieldIconClassName as Ie, calendarNavIcons as V, calendarDaySelectedClassName as Le, calendarDayTodayClassName as Te, calendarDayOutsideClassName as Fe, calendarDayButtonBaseClassName as Se, calendarIcon as Me, calendarFieldDisabledClassName as Z, calendarFieldInvalidClassName as q, calendarFieldBaseClassName as H, calendarPopoverClassName as Oe } from "./constants.js";
14
- import { getWeekdayShortLabels as we, getWeekdayOptions as ke, getMonthGrid as Be, formatTimeLabel as M, formatMonthLabel as Ee, isSameDay as P, isDateOutOfRange as W, formatDayAriaLabel as Ae, sanitizeTimeInput as _e, isCompleteTimeString as Re, setTimeOnDate as K, formatDateLabel as U } from "./utils.js";
15
- const Y = ({
1
+ import { jsx as e, jsxs as c, Fragment as O } from "react/jsx-runtime";
2
+ import { useFloating as oe, autoUpdate as ce, offset as de, flip as me, shift as pe, useClick as fe, useDismiss as ue, useRole as he, useInteractions as ge, FloatingPortal as be, FloatingFocusManager as xe } from "@floating-ui/react";
3
+ import { IconChevronDown as ye } from "@tabler/icons-react";
4
+ import { useId as ve, useState as B, useMemo as S, useEffect as Ne } from "react";
5
+ import { Label as De } from "../Label/Label.js";
6
+ import { StaticIconButton as K } from "../IconButton/IconButtonWrappers.js";
7
+ import { DIAL_KIT_ICON_STROKE as Ce } from "../constants/icon.js";
8
+ import { DIAL_ICON_SIZE as Ie } from "../../../constants/icon.js";
9
+ import { CalendarMode as D } from "../../../types/calendar.js";
10
+ import { ElementSize as P } from "../../../types/size.js";
11
+ import { useThemeScope as Le } from "../ThemeScope/ThemeScope.js";
12
+ import { mergeClasses as d } from "../../../utils/merge-classes.js";
13
+ import { getTimezoneLabel as Te } from "../../../utils/timezone.js";
14
+ import { DEFAULT_CALENDAR_LOCALE as Se, calendarModeDefaultPlaceholder as Fe, calendarFieldIconClassName as Me, calendarNavIcons as W, calendarDaySelectedClassName as Oe, calendarDayTodayClassName as we, calendarDayOutsideClassName as ke, calendarDayButtonBaseClassName as Ae, calendarIcon as _e, calendarFieldDisabledClassName as J, calendarFieldInvalidClassName as Q, calendarFieldBaseClassName as X, calendarPopoverClassName as Ee } from "./constants.js";
15
+ import { getWeekdayShortLabels as Be, getWeekdayOptions as Re, getMonthGrid as ze, formatTimeLabel as M, formatMonthLabel as $e, isSameDay as U, isDateOutOfRange as Y, formatDayAriaLabel as je, sanitizeTimeInput as Ve, isCompleteTimeString as Ke, setTimeOnDate as G, formatDateLabel as Z } from "./utils.js";
16
+ import { DIAL_KIT_CLASS as E } from "../../../constants/public-class-names.js";
17
+ const q = ({
16
18
  id: s,
17
- disabled: l,
18
- invalid: m,
19
- trigger: i,
20
- panelClassName: N,
21
- fieldClassName: h,
22
- panel: g,
23
- labelledBy: C,
24
- panelLabel: b
19
+ disabled: a,
20
+ invalid: p,
21
+ trigger: C,
22
+ panelClassName: i,
23
+ fieldClassName: I,
24
+ panel: x,
25
+ labelledBy: y,
26
+ panelLabel: L
25
27
  }) => {
26
- const x = De(), [f, n] = E(!1), { refs: D, floatingStyles: p, context: a } = ne({
27
- open: f,
28
- onOpenChange: (F) => n(l ? !1 : F),
28
+ const f = Le(), [u, h] = B(!1), { refs: l, floatingStyles: v, context: o } = oe({
29
+ open: u,
30
+ onOpenChange: (k) => h(a ? !1 : k),
29
31
  placement: "bottom-start",
30
- whileElementsMounted: re,
31
- middleware: [se(8), ie({ padding: 8 }), oe({ padding: 8 })]
32
- }), w = ce(a, { enabled: !l }), u = de(a), T = me(a, { role: "dialog" }), { getReferenceProps: k, getFloatingProps: I } = fe([
33
- w,
34
- u,
35
- T
32
+ whileElementsMounted: ce,
33
+ middleware: [de(8), me({ padding: 8 }), pe({ padding: 8 })]
34
+ }), g = fe(o, { enabled: !a }), n = ue(o), w = he(o, { role: "dialog" }), { getReferenceProps: b, getFloatingProps: F } = ge([
35
+ g,
36
+ n,
37
+ w
36
38
  ]);
37
- return /* @__PURE__ */ o(O, { children: [
38
- /* @__PURE__ */ t(
39
+ return /* @__PURE__ */ c(O, { children: [
40
+ /* @__PURE__ */ e(
39
41
  "div",
40
42
  {
41
43
  id: s,
42
- ref: D.setReference,
44
+ ref: l.setReference,
43
45
  role: "button",
44
46
  "aria-haspopup": "dialog",
45
- "aria-expanded": f,
46
- "aria-disabled": l,
47
- "aria-labelledby": C,
48
- tabIndex: l ? -1 : 0,
49
- className: c(
50
- H,
47
+ "aria-expanded": u,
48
+ "aria-disabled": a,
49
+ "aria-labelledby": y,
50
+ tabIndex: a ? -1 : 0,
51
+ className: d(
52
+ X,
51
53
  "focus-visible:outline focus-visible:outline-focus",
52
- m && q,
53
- l && Z,
54
- h
54
+ p && Q,
55
+ a && J,
56
+ I
55
57
  ),
56
- ...k(),
57
- children: i
58
+ ...b(),
59
+ children: C
58
60
  }
59
61
  ),
60
- f && /* @__PURE__ */ t(pe, { children: /* @__PURE__ */ t(
61
- ue,
62
+ u && /* @__PURE__ */ e(be, { children: /* @__PURE__ */ e(
63
+ xe,
62
64
  {
63
- context: a,
65
+ context: o,
64
66
  modal: !1,
65
67
  initialFocus: -1,
66
68
  returnFocus: !0,
67
- children: /* @__PURE__ */ t(
69
+ children: /* @__PURE__ */ e(
68
70
  "div",
69
71
  {
70
- ref: D.setFloating,
71
- style: p,
72
- "aria-label": b,
73
- className: c(
74
- Oe,
75
- x,
76
- N
72
+ ref: l.setFloating,
73
+ style: v,
74
+ "aria-label": L,
75
+ className: d(
76
+ Ee,
77
+ f,
78
+ i
77
79
  ),
78
- ...I(),
79
- children: g(() => n(!1))
80
+ ...F(),
81
+ children: x(() => h(!1))
80
82
  }
81
83
  )
82
84
  }
83
85
  ) })
84
86
  ] });
85
- }, G = ({
87
+ }, H = ({
86
88
  id: s,
87
- value: l,
88
- onChange: m,
89
+ value: a,
90
+ onChange: p,
91
+ onBlur: C,
89
92
  disabled: i,
90
- invalid: N,
91
- className: h,
92
- ariaLabel: g,
93
- placeholder: C = "--:--"
93
+ invalid: I,
94
+ className: x,
95
+ ariaLabel: y,
96
+ placeholder: L = "--:--",
97
+ timezoneLabel: f
94
98
  }) => {
95
- const [b, x] = E(l);
96
- return be(() => {
97
- x(l);
98
- }, [l]), /* @__PURE__ */ t(
99
+ const [u, h] = B(a);
100
+ Ne(() => {
101
+ h(a);
102
+ }, [a]);
103
+ const l = /* @__PURE__ */ e(
99
104
  "input",
100
105
  {
101
106
  id: s,
102
107
  type: "text",
103
108
  inputMode: "numeric",
104
109
  autoComplete: "off",
105
- "aria-label": g,
106
- placeholder: C,
110
+ "aria-label": y,
111
+ placeholder: L,
107
112
  disabled: i,
108
- value: b,
109
- onChange: (f) => {
110
- const n = _e(f.target.value);
111
- x(n), Re(n) && m(n);
113
+ value: u,
114
+ onChange: (v) => {
115
+ const o = Ve(v.target.value);
116
+ h(o), Ke(o) && p(o);
112
117
  },
113
- className: c(
114
- H,
115
- N && q,
116
- i && Z,
117
- h
118
+ onBlur: C,
119
+ className: d(
120
+ X,
121
+ I && Q,
122
+ i && J,
123
+ x
118
124
  )
119
125
  }
120
126
  );
121
- }, Qe = ({
122
- mode: s = v.Date,
123
- value: l,
124
- onChange: m,
127
+ return f ? /* @__PURE__ */ c("div", { className: "relative w-full", children: [
128
+ l,
129
+ /* @__PURE__ */ e("span", { className: "dial-small-paragraph-text pointer-events-none absolute end-4 top-1/2 -translate-y-1/2 truncate text-secondary", children: f })
130
+ ] }) : l;
131
+ }, rt = ({
132
+ mode: s = D.Date,
133
+ value: a,
134
+ onChange: p,
135
+ onBlur: C,
125
136
  labelProps: i,
126
- placeholder: N,
127
- disabled: h = !1,
128
- invalid: g = !1,
129
- id: C,
130
- className: b,
131
- minDate: x,
132
- maxDate: f,
133
- locale: n = Ne,
134
- fieldClassName: D
137
+ placeholder: I,
138
+ disabled: x = !1,
139
+ invalid: y = !1,
140
+ id: L,
141
+ className: f,
142
+ minDate: u,
143
+ maxDate: h,
144
+ locale: l = Se,
145
+ fieldClassName: v,
146
+ showTimezone: o = !1
135
147
  }) => {
136
- const p = N ?? Ce[s], a = l instanceof Date ? l : null, w = ge(), u = C ?? w, T = i?.id ?? `${u}-label`, k = !!i?.label, I = typeof i?.label == "string" ? i.label : void 0, F = k ? `${T} ${u}` : void 0, B = i ? /* @__PURE__ */ t(xe, { ...i, id: T, htmlFor: u }) : null, [L, J] = E(
137
- () => a ?? /* @__PURE__ */ new Date()
138
- ), Q = S(() => /* @__PURE__ */ new Date(), []), X = S(
139
- () => we(n),
140
- [n]
141
- ), A = S(() => ke(n), [n]), ee = S(
142
- () => Be(L.getFullYear(), L.getMonth()),
143
- [L]
144
- ), _ = (r) => {
145
- J(
146
- (e) => new Date(e.getFullYear(), e.getMonth() + r, 1)
148
+ const g = I ?? Fe[s], n = a instanceof Date ? a : null, w = ve(), b = L ?? w, F = i?.id ?? `${b}-label`, k = !!i?.label, A = typeof i?.label == "string" ? i.label : void 0, R = k ? `${F} ${b}` : void 0, _ = i ? /* @__PURE__ */ e(De, { ...i, id: F, htmlFor: b }) : null, [T, ee] = B(
149
+ () => n ?? /* @__PURE__ */ new Date()
150
+ ), te = S(() => /* @__PURE__ */ new Date(), []), ae = S(
151
+ () => o ? Te({ locale: l }) : null,
152
+ [o, l]
153
+ ), le = S(
154
+ () => Be(l),
155
+ [l]
156
+ ), z = S(() => Re(l), [l]), ne = S(
157
+ () => ze(T.getFullYear(), T.getMonth()),
158
+ [T]
159
+ ), $ = (r) => {
160
+ ee(
161
+ (t) => new Date(t.getFullYear(), t.getMonth() + r, 1)
147
162
  );
148
- }, te = (r, e) => {
149
- if (W(r, x, f)) return;
150
- const y = s === v.DateTime && a ? K(r, M(a)) : r;
151
- m?.(y), s === v.Date && e();
152
- }, ae = (r) => {
153
- m?.(K(a ?? /* @__PURE__ */ new Date(), r));
154
- }, le = () => a ? s === v.DateTime ? `${U(a, n)}, ${M(a)}` : U(a, n) : p;
155
- if (s === v.Time) {
156
- const r = typeof l == "string" ? l : a ? M(a) : "";
157
- return /* @__PURE__ */ o("div", { className: c("flex flex-col gap-y-3", b), children: [
158
- B,
159
- /* @__PURE__ */ t(
160
- G,
161
- {
162
- id: u,
163
- value: r,
164
- onChange: (e) => m?.(e),
165
- disabled: h,
166
- invalid: g,
167
- placeholder: p,
168
- className: D
169
- }
170
- )
171
- ] });
172
- }
173
- if (s === v.Weekday) {
174
- const r = typeof l == "string" ? l : void 0, e = A.find((y) => y.value === r);
175
- return /* @__PURE__ */ o("div", { className: c("flex flex-col gap-y-3", b), children: [
176
- B,
177
- /* @__PURE__ */ t(
178
- Y,
179
- {
180
- id: u,
181
- disabled: h,
182
- invalid: g,
183
- labelledBy: F,
184
- panelLabel: I ?? p,
185
- fieldClassName: D,
186
- trigger: /* @__PURE__ */ o(O, { children: [
187
- /* @__PURE__ */ t(
188
- "span",
189
- {
190
- className: c(
191
- "truncate",
192
- !e && "text-secondary"
193
- ),
194
- children: e?.label ?? p
195
- }
196
- ),
197
- /* @__PURE__ */ t(
198
- he,
199
- {
200
- size: ve.MD,
201
- stroke: ye,
202
- "aria-hidden": "true",
203
- className: Ie
204
- }
205
- )
206
- ] }),
207
- panel: (y) => /* @__PURE__ */ t(
208
- "div",
163
+ }, re = (r, t) => {
164
+ if (Y(r, u, h)) return;
165
+ const N = s === D.DateTime && n ? G(r, M(n)) : r;
166
+ p?.(N), s === D.Date && t();
167
+ }, se = (r) => {
168
+ p?.(G(n ?? /* @__PURE__ */ new Date(), r));
169
+ }, ie = () => n ? s === D.DateTime ? `${Z(n, l)}, ${M(n)}` : Z(n, l) : g;
170
+ if (s === D.Time) {
171
+ const r = typeof a == "string" ? a : n ? M(n) : "";
172
+ return /* @__PURE__ */ c(
173
+ "div",
174
+ {
175
+ className: d(
176
+ "flex flex-col gap-y-3",
177
+ f,
178
+ E.calendar
179
+ ),
180
+ children: [
181
+ _,
182
+ /* @__PURE__ */ e(
183
+ H,
209
184
  {
210
- role: "listbox",
211
- "aria-label": I ?? p,
212
- className: "flex flex-col gap-0.5",
213
- children: A.map((d) => /* @__PURE__ */ t(
214
- "button",
215
- {
216
- type: "button",
217
- role: "option",
218
- "aria-selected": d.value === r,
219
- className: c(
220
- "flex w-full items-center rounded-lg px-3 py-2 text-left dial-small-text text-primary hover:bg-control-accent-alpha-hover",
221
- "focus-visible:outline focus-visible:outline-focus",
222
- d.value === r && "bg-control-accent-alpha-hover"
223
- ),
224
- onClick: () => {
225
- m?.(d.value), y();
226
- },
227
- children: d.label
228
- },
229
- d.value
230
- ))
185
+ id: b,
186
+ value: r,
187
+ onChange: (t) => p?.(t),
188
+ onBlur: C,
189
+ disabled: x,
190
+ invalid: y,
191
+ placeholder: g,
192
+ className: v,
193
+ timezoneLabel: ae
231
194
  }
232
195
  )
233
- }
234
- )
235
- ] });
196
+ ]
197
+ }
198
+ );
236
199
  }
237
- return /* @__PURE__ */ o("div", { className: c("flex flex-col gap-y-3", b), children: [
238
- B,
239
- /* @__PURE__ */ t(
240
- Y,
200
+ if (s === D.Weekday) {
201
+ const r = typeof a == "string" ? a : void 0, t = z.find((N) => N.value === r);
202
+ return /* @__PURE__ */ c(
203
+ "div",
241
204
  {
242
- id: u,
243
- disabled: h,
244
- invalid: g,
245
- labelledBy: F,
246
- panelLabel: I ?? p,
247
- fieldClassName: D,
248
- trigger: /* @__PURE__ */ o(O, { children: [
249
- /* @__PURE__ */ t(
250
- "span",
205
+ className: d(
206
+ "flex flex-col gap-y-3",
207
+ f,
208
+ E.calendar
209
+ ),
210
+ children: [
211
+ _,
212
+ /* @__PURE__ */ e(
213
+ q,
251
214
  {
252
- className: c(
253
- "truncate",
254
- !a && "text-secondary"
255
- ),
256
- children: le()
215
+ id: b,
216
+ disabled: x,
217
+ invalid: y,
218
+ labelledBy: R,
219
+ panelLabel: A ?? g,
220
+ fieldClassName: v,
221
+ trigger: /* @__PURE__ */ c(O, { children: [
222
+ /* @__PURE__ */ e(
223
+ "span",
224
+ {
225
+ className: d(
226
+ "truncate",
227
+ !t && "text-secondary"
228
+ ),
229
+ children: t?.label ?? g
230
+ }
231
+ ),
232
+ /* @__PURE__ */ e(
233
+ ye,
234
+ {
235
+ size: Ie.MD,
236
+ stroke: Ce,
237
+ "aria-hidden": "true",
238
+ className: Me
239
+ }
240
+ )
241
+ ] }),
242
+ panel: (N) => /* @__PURE__ */ e(
243
+ "div",
244
+ {
245
+ role: "listbox",
246
+ "aria-label": A ?? g,
247
+ className: "flex flex-col gap-0.5",
248
+ children: z.map((m) => /* @__PURE__ */ e(
249
+ "button",
250
+ {
251
+ type: "button",
252
+ role: "option",
253
+ "aria-selected": m.value === r,
254
+ className: d(
255
+ "flex w-full items-center rounded-lg px-3 py-2 text-left dial-small-text text-primary hover:bg-control-accent-alpha-hover",
256
+ "focus-visible:outline focus-visible:outline-focus",
257
+ m.value === r && "bg-control-accent-alpha-hover"
258
+ ),
259
+ onClick: () => {
260
+ p?.(m.value), N();
261
+ },
262
+ children: m.label
263
+ },
264
+ m.value
265
+ ))
266
+ }
267
+ )
257
268
  }
258
- ),
259
- Me
260
- ] }),
261
- panel: (r) => /* @__PURE__ */ o(O, { children: [
262
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
263
- /* @__PURE__ */ t(
264
- $,
265
- {
266
- "aria-label": "Previous month",
267
- icon: V.prev,
268
- size: j.Small,
269
- onClick: () => _(-1)
270
- }
271
- ),
272
- /* @__PURE__ */ t(
273
- "div",
274
- {
275
- className: "dial-small-semi-text text-primary",
276
- "aria-live": "polite",
277
- children: Ee(L, n)
278
- }
279
- ),
280
- /* @__PURE__ */ t(
281
- $,
282
- {
283
- "aria-label": "Next month",
284
- icon: V.next,
285
- size: j.Small,
286
- onClick: () => _(1)
287
- }
288
- )
289
- ] }),
290
- /* @__PURE__ */ o("div", { className: "grid grid-cols-7 gap-y-1 text-center", children: [
291
- X.map((e) => /* @__PURE__ */ t(
292
- "div",
293
- {
294
- "aria-hidden": "true",
295
- className: "dial-tiny-text py-1 text-secondary",
296
- children: e
297
- },
298
- e
299
- )),
300
- ee.map((e) => {
301
- const y = e.getMonth() !== L.getMonth(), d = P(e, a), R = P(e, Q), z = W(e, x, f);
302
- return /* @__PURE__ */ t(
303
- "button",
269
+ )
270
+ ]
271
+ }
272
+ );
273
+ }
274
+ return /* @__PURE__ */ c(
275
+ "div",
276
+ {
277
+ className: d(
278
+ "flex flex-col gap-y-3",
279
+ f,
280
+ E.calendar
281
+ ),
282
+ children: [
283
+ _,
284
+ /* @__PURE__ */ e(
285
+ q,
286
+ {
287
+ id: b,
288
+ disabled: x,
289
+ invalid: y,
290
+ labelledBy: R,
291
+ panelLabel: A ?? g,
292
+ fieldClassName: v,
293
+ trigger: /* @__PURE__ */ c(O, { children: [
294
+ /* @__PURE__ */ e(
295
+ "span",
304
296
  {
305
- type: "button",
306
- disabled: z,
307
- "aria-label": Ae(e, n),
308
- "aria-pressed": d,
309
- "aria-current": R ? "date" : void 0,
310
- className: c(
311
- Se,
312
- y && Fe,
313
- R && !d && Te,
314
- d && Le,
315
- z && "cursor-not-allowed opacity-40 hover:bg-transparent"
297
+ className: d(
298
+ "truncate",
299
+ !n && "text-secondary"
316
300
  ),
317
- onClick: () => te(e, r),
318
- children: e.getDate()
319
- },
320
- e.toISOString()
321
- );
322
- })
323
- ] }),
324
- s === v.DateTime && /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-3 border-t border-secondary pt-3", children: [
325
- /* @__PURE__ */ t("span", { className: "dial-small-text text-primary", children: "Time" }),
326
- /* @__PURE__ */ t(
327
- G,
328
- {
329
- ariaLabel: "Time",
330
- value: a ? M(a) : "",
331
- onChange: ae,
332
- className: "w-[120px] px-3 py-1.5"
333
- }
334
- )
335
- ] })
336
- ] })
337
- }
338
- )
339
- ] });
301
+ children: ie()
302
+ }
303
+ ),
304
+ _e
305
+ ] }),
306
+ panel: (r) => /* @__PURE__ */ c(O, { children: [
307
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
308
+ /* @__PURE__ */ e(
309
+ K,
310
+ {
311
+ "aria-label": "Previous month",
312
+ icon: W.prev,
313
+ size: P.Small,
314
+ onClick: () => $(-1)
315
+ }
316
+ ),
317
+ /* @__PURE__ */ e(
318
+ "div",
319
+ {
320
+ className: "dial-small-semi-text text-primary",
321
+ "aria-live": "polite",
322
+ children: $e(T, l)
323
+ }
324
+ ),
325
+ /* @__PURE__ */ e(
326
+ K,
327
+ {
328
+ "aria-label": "Next month",
329
+ icon: W.next,
330
+ size: P.Small,
331
+ onClick: () => $(1)
332
+ }
333
+ )
334
+ ] }),
335
+ /* @__PURE__ */ c("div", { className: "grid grid-cols-7 gap-y-1 text-center", children: [
336
+ le.map((t) => /* @__PURE__ */ e(
337
+ "div",
338
+ {
339
+ "aria-hidden": "true",
340
+ className: "dial-tiny-text py-1 text-secondary",
341
+ children: t
342
+ },
343
+ t
344
+ )),
345
+ ne.map((t) => {
346
+ const N = t.getMonth() !== T.getMonth(), m = U(t, n), j = U(t, te), V = Y(t, u, h);
347
+ return /* @__PURE__ */ e(
348
+ "button",
349
+ {
350
+ type: "button",
351
+ disabled: V,
352
+ "aria-label": je(t, l),
353
+ "aria-pressed": m,
354
+ "aria-current": j ? "date" : void 0,
355
+ className: d(
356
+ Ae,
357
+ N && ke,
358
+ j && !m && we,
359
+ m && Oe,
360
+ V && "cursor-not-allowed opacity-40 hover:bg-transparent"
361
+ ),
362
+ onClick: () => re(t, r),
363
+ children: t.getDate()
364
+ },
365
+ t.toISOString()
366
+ );
367
+ })
368
+ ] }),
369
+ s === D.DateTime && /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 border-t border-secondary pt-3", children: [
370
+ /* @__PURE__ */ e("span", { className: "dial-small-text text-primary", children: "Time" }),
371
+ /* @__PURE__ */ e(
372
+ H,
373
+ {
374
+ ariaLabel: "Time",
375
+ value: n ? M(n) : "",
376
+ onChange: se,
377
+ onBlur: C,
378
+ className: "w-[120px] px-3 py-1.5"
379
+ }
380
+ )
381
+ ] })
382
+ ] })
383
+ }
384
+ )
385
+ ]
386
+ }
387
+ );
340
388
  };
341
389
  export {
342
- Qe as Calendar
390
+ rt as Calendar
343
391
  };