impact-nova 2.1.0-alpha.6 → 2.1.0-alpha.8

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 (113) hide show
  1. package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +6 -0
  2. package/dist/components/data/ag-grid-react/build-ag-grid-theme.d.ts +3 -0
  3. package/dist/components/data/ag-grid-react/cell-renderers/editors/input-cell-editor.js +58 -58
  4. package/dist/components/data/ag-grid-react/column-indicator-sync-bus.d.ts +9 -0
  5. package/dist/components/data/ag-grid-react/column-indicator-sync-bus.js +15 -0
  6. package/dist/components/data/ag-grid-react/headers/column-menu/column-settings-menu.js +78 -73
  7. package/dist/components/data/ag-grid-react/headers/custom-header.js +3 -1
  8. package/dist/components/data/ag-grid-react/headers/header-search-input.js +87 -91
  9. package/dist/components/data/ag-grid-react/index.d.ts +1 -1
  10. package/dist/components/data/ag-grid-react/index.js +109 -100
  11. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +3 -2
  12. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.js +4 -3
  13. package/dist/components/data/ag-grid-react/sync-ag-grid-theme-mode.d.ts +3 -0
  14. package/dist/components/data/ag-grid-react/sync-ag-grid-theme-mode.js +10 -0
  15. package/dist/components/data/ag-grid-react/theme.d.ts +1 -0
  16. package/dist/components/data/ag-grid-react/theme.js +93 -21
  17. package/dist/components/data/data-table/column-indicator.d.ts +1 -1
  18. package/dist/components/data/data-table/column-indicator.js +15 -11
  19. package/dist/components/data/data-table/data-table-column-def-pin.d.ts +9 -4
  20. package/dist/components/data/data-table/data-table-column-def-pin.js +38 -38
  21. package/dist/components/data/data-table/data-table-saved-views.js +37 -37
  22. package/dist/components/data/data-table/data-table-sheet.js +15 -17
  23. package/dist/components/data/data-table/data-table.js +62 -57
  24. package/dist/components/data/data-table/data-table.types.d.ts +7 -1
  25. package/dist/components/data/data-table/indicator-legend.d.ts +13 -2
  26. package/dist/components/data/data-table/indicator-legend.js +20 -17
  27. package/dist/components/data/data-table/pin-switch.js +9 -9
  28. package/dist/components/data/data-table/use-data-table-column-list-sync.js +133 -130
  29. package/dist/components/data/nested-list/nested-list-change-detection.d.ts +11 -0
  30. package/dist/components/data/nested-list/nested-list-change-detection.js +13 -0
  31. package/dist/components/data/nested-list/nested-list.js +107 -97
  32. package/dist/components/data-display/calendar/calendar.d.ts +1 -1
  33. package/dist/components/data-display/calendar/calendar.js +194 -189
  34. package/dist/components/data-display/chart/chart-palette.d.ts +16 -0
  35. package/dist/components/data-display/chart/chart-palette.js +28 -0
  36. package/dist/components/data-display/chart/chart.js +121 -115
  37. package/dist/components/data-display/chart/chart.utils.js +9 -6
  38. package/dist/components/data-display/chart/index.d.ts +1 -0
  39. package/dist/components/data-display/chart/index.js +15 -9
  40. package/dist/components/data-display/chart/resolve-highcharts-options.d.ts +3 -0
  41. package/dist/components/data-display/chart/resolve-highcharts-options.js +35 -0
  42. package/dist/components/data-display/statistics-card/statistics-card.color.d.ts +6 -0
  43. package/dist/components/data-display/statistics-card/statistics-card.color.js +19 -0
  44. package/dist/components/data-display/statistics-card/statistics-card.hooks.js +50 -48
  45. package/dist/components/data-display/statistics-card/statistics-card.js +127 -146
  46. package/dist/components/feedback/alert-dialog/alert-dialog.js +15 -15
  47. package/dist/components/feedback/dialog/dialog.js +3 -3
  48. package/dist/components/feedback/drawer/drawer.js +32 -32
  49. package/dist/components/feedback/sheet/sheet.js +8 -8
  50. package/dist/components/feedback/sheet/sheet.variants.js +1 -1
  51. package/dist/components/feedback/toast/toast.js +83 -92
  52. package/dist/components/flows/command-palette/command-palette-context.types.d.ts +5 -0
  53. package/dist/components/flows/command-palette/command-palette.d.ts +4 -16
  54. package/dist/components/flows/command-palette/command-palette.js +245 -258
  55. package/dist/components/flows/command-palette/command-palette.types.d.ts +9 -0
  56. package/dist/components/flows/command-palette/shortcut-overlay.js +6 -6
  57. package/dist/components/flows/filter-panel/filter-panel.d.ts +3 -2
  58. package/dist/components/flows/filter-panel/filter-panel.js +99 -104
  59. package/dist/components/flows/filter-strip/filter-summary.js +41 -41
  60. package/dist/components/flows/filter-strip/filter-tag-list.js +48 -48
  61. package/dist/components/flows/wizard/wizard.js +32 -32
  62. package/dist/components/forms/choice-card/choice-card.d.ts +2 -2
  63. package/dist/components/forms/choice-card/choice-card.js +156 -166
  64. package/dist/components/forms/combobox/combobox.js +70 -70
  65. package/dist/components/forms/date-picker/date-picker.js +31 -30
  66. package/dist/components/forms/file-upload/file-upload.js +146 -168
  67. package/dist/components/forms/prompt/prompt.js +47 -48
  68. package/dist/components/forms/select/components/SelectAllRow.js +14 -14
  69. package/dist/components/forms/select/components/SelectMenuFooter.js +12 -12
  70. package/dist/components/forms/select/components/SelectMenuHeader.js +44 -44
  71. package/dist/components/forms/select/components/SelectMenuListBody.js +22 -22
  72. package/dist/components/forms/select/components/SelectMenuPanel.js +8 -8
  73. package/dist/components/forms/select/components/SelectOptionRow.js +62 -62
  74. package/dist/components/forms/select/select.d.ts +5 -4
  75. package/dist/components/forms/select/select.js +123 -120
  76. package/dist/components/forms/select/select.types.d.ts +95 -204
  77. package/dist/components/forms/slider/slider.js +17 -17
  78. package/dist/components/forms/smart-input/smart-input.js +49 -49
  79. package/dist/components/forms/textarea/textarea.js +25 -25
  80. package/dist/components/layout/breadcrumb/breadcrumb.js +112 -118
  81. package/dist/components/layout/header/header.d.ts +5 -17
  82. package/dist/components/layout/header/header.js +113 -116
  83. package/dist/components/layout/header/header.types.d.ts +3 -0
  84. package/dist/components/layout/sidebar/sidebar.js +5 -5
  85. package/dist/components/layout/sidebar/sidebar.variants.js +1 -1
  86. package/dist/components/primitives/accordion/accordion.js +38 -41
  87. package/dist/components/primitives/kbd/kbd.variants.js +1 -1
  88. package/dist/i18n/defaultMessages.d.ts +2 -0
  89. package/dist/i18n/defaultMessages.js +6 -4
  90. package/dist/i18n/locales/de.js +2 -0
  91. package/dist/i18n/locales/es.js +2 -0
  92. package/dist/i18n/locales/hi.js +2 -0
  93. package/dist/i18n/locales/kn.js +2 -0
  94. package/dist/impact-nova-base.scss +8 -5
  95. package/dist/impact-nova-components.css +2 -2
  96. package/dist/impact-nova-tokens.scss +346 -189
  97. package/dist/impact-nova.css +1 -1
  98. package/dist/index.js +505 -499
  99. package/dist/lib/primitives/create-component.d.ts +1 -1
  100. package/dist/lib/primitives/create-component.js +4 -4
  101. package/dist/lib/primitives/field.js +17 -18
  102. package/dist/lib/resolve-design-token-color.d.ts +5 -0
  103. package/dist/lib/resolve-design-token-color.js +12 -0
  104. package/dist/lib/virtualized/virtualized-list-parts.d.ts +1 -2
  105. package/dist/lib/virtualized/virtualized-list-parts.js +23 -23
  106. package/dist/lib/virtualized/virtualized.types.d.ts +10 -0
  107. package/dist/llms/rules/ag-grid.js +1 -1
  108. package/dist/llms/rules/installation.js +1 -1
  109. package/dist/llms/rules/requirements.js +1 -1
  110. package/dist/theme/tokens/chart-series-palette.json.d.ts +53 -0
  111. package/dist/theme/tokens/chart-series-palette.json.js +7 -0
  112. package/package.json +22 -254
  113. package/tailwind.config.js +10 -229
@@ -1,8 +1,8 @@
1
1
  import { jsx as a, jsxs as xe } from "react/jsx-runtime";
2
- import * as ve from "react";
3
- import { useId as Q, useMemo as T, useState as C, useRef as R, useCallback as u, useEffect as we } from "react";
4
- import * as N from "@radix-ui/react-popover";
5
- import { cn as _ } from "../../../lib/utils.js";
2
+ import { useId as X, useMemo as T, useState as C, useRef as E, useCallback as u, useEffect as ve } from "react";
3
+ import * as H from "@radix-ui/react-popover";
4
+ import { createComponent as we } from "../../../lib/primitives/create-component.js";
5
+ import { cn as $ } from "../../../lib/utils.js";
6
6
  import { useFieldChrome as ye } from "../../../lib/primitives/use-field-chrome.js";
7
7
  import { comboboxSizeVariants as Ce } from "./combobox.variants.js";
8
8
  function Ie(c) {
@@ -21,7 +21,8 @@ function ke(c, l) {
21
21
  const d = l.toLowerCase();
22
22
  return c.filter((f) => f.toLowerCase().includes(d));
23
23
  }
24
- const De = ve.forwardRef(
24
+ const He = we(
25
+ "Combobox",
25
26
  ({
26
27
  options: c,
27
28
  min: l,
@@ -30,69 +31,69 @@ const De = ve.forwardRef(
30
31
  defaultValue: I = "",
31
32
  value: b,
32
33
  onChange: k,
33
- onBlur: $,
34
- placeholder: F,
34
+ onBlur: F,
35
+ placeholder: z,
35
36
  label: D,
36
- helperText: X,
37
- helperTextPosition: Y = "absolute",
38
- error: Z,
37
+ helperText: Y,
38
+ helperTextPosition: Z = "absolute",
39
+ error: _,
39
40
  isError: ee,
40
- disabled: p,
41
- isNumeric: E,
41
+ disabled: m,
42
+ isNumeric: N,
42
43
  size: te = "default",
43
44
  className: oe,
44
45
  emptyMessage: ne = "No options found",
45
46
  allowFreeText: L = !1,
46
- required: z,
47
+ required: B,
47
48
  labelOrientation: re
48
49
  }, x) => {
49
- const se = Q(), A = Q(), H = typeof D == "string" ? D : F ?? "Options", V = ye({
50
+ const se = X(), A = X(), R = typeof D == "string" ? D : z ?? "Options", V = ye({
50
51
  label: D,
51
- helperText: X,
52
- helperTextPosition: Y,
52
+ helperText: Y,
53
+ helperTextPosition: Z,
53
54
  labelOrientation: re,
54
- error: Z ?? ee,
55
- required: z,
56
- disabled: p,
55
+ error: _ ?? ee,
56
+ required: B,
57
+ disabled: m,
57
58
  id: se,
58
59
  className: oe
59
- }), B = T(
60
+ }), K = T(
60
61
  () => Ie({ options: c, min: l, max: d, step: f }),
61
62
  [c, l, d, f]
62
- ), M = b !== void 0, [ie, ae] = C(I), S = M ? b : ie, [ce, K] = C(""), [o, v] = C(!1), n = o ? ce : S, [O, m] = C(-1), U = R(-1), [le, w] = C("keyboard"), W = R(null), P = R(null), ue = u(
63
+ ), M = b !== void 0, [ie, ae] = C(I), S = M ? b : ie, [ce, U] = C(""), [o, v] = C(!1), n = o ? ce : S, [O, p] = C(-1), W = E(-1), [le, w] = C("keyboard"), q = E(null), P = E(null), ue = u(
63
64
  (e) => {
64
- W.current = e, typeof x == "function" ? x(e) : x && (x.current = e);
65
+ q.current = e, typeof x == "function" ? x(e) : x && (x.current = e);
65
66
  },
66
67
  [x]
67
68
  ), r = T(
68
- () => ke(B, n),
69
- [B, n]
70
- ), q = R(r), de = T(() => {
69
+ () => ke(K, n),
70
+ [K, n]
71
+ ), G = E(r), de = T(() => {
71
72
  if (!o || !n) return -1;
72
73
  const e = r.findIndex(
73
74
  (t) => t.toLowerCase() === n.toLowerCase()
74
75
  );
75
76
  return e >= 0 ? e : -1;
76
- }, [o, n, r]), h = O >= 0 ? O : de, G = O >= 0 ? le : "mouse", fe = o && h >= 0 ? `${A}-option-${h}` : void 0;
77
- we(() => {
78
- U.current = h, q.current = r, o && h >= 0 && P.current && P.current.querySelectorAll("[data-combobox-item]")[h]?.scrollIntoView({ block: "nearest" });
77
+ }, [o, n, r]), h = O >= 0 ? O : de, J = O >= 0 ? le : "mouse", fe = o && h >= 0 ? `${A}-option-${h}` : void 0;
78
+ ve(() => {
79
+ W.current = h, G.current = r, o && h >= 0 && P.current && P.current.querySelectorAll("[data-combobox-item]")[h]?.scrollIntoView({ block: "nearest" });
79
80
  }, [h, o, r]);
80
81
  const i = u(
81
82
  (e) => {
82
- M || ae(e), k?.(e), v(!1), m(-1);
83
+ M || ae(e), k?.(e), v(!1), p(-1);
83
84
  },
84
85
  [M, k]
85
86
  ), y = u(() => {
86
- v(!1), m(-1);
87
- }, []), pe = u(
87
+ v(!1), p(-1);
88
+ }, []), me = u(
88
89
  (e) => {
89
90
  const t = e.target.value;
90
- K(t), m(-1), w("mouse"), o || v(!0);
91
+ U(t), p(-1), w("mouse"), o || v(!0);
91
92
  },
92
93
  [o]
93
- ), me = u(() => {
94
- p || (K(S), v(!0));
95
- }, [p, S]), he = u(
94
+ ), pe = u(() => {
95
+ m || (U(S), v(!0));
96
+ }, [m, S]), he = u(
96
97
  (e) => {
97
98
  const t = e.relatedTarget;
98
99
  if (!P.current?.contains(t)) {
@@ -102,10 +103,10 @@ const De = ve.forwardRef(
102
103
  );
103
104
  s ? i(s) : r.length === 1 ? i(r[0]) : L && n ? i(n) : y();
104
105
  }
105
- $?.(e);
106
+ F?.(e);
106
107
  }
107
108
  },
108
- [o, r, n, i, y, L, $]
109
+ [o, r, n, i, y, L, F]
109
110
  ), ge = u(
110
111
  (e) => {
111
112
  if (!o) {
@@ -117,20 +118,20 @@ const De = ve.forwardRef(
117
118
  return;
118
119
  }
119
120
  if (e.key === "ArrowDown") {
120
- e.preventDefault(), w("keyboard"), m(
121
+ e.preventDefault(), w("keyboard"), p(
121
122
  (t) => t < r.length - 1 ? t + 1 : 0
122
123
  );
123
124
  return;
124
125
  }
125
126
  if (e.key === "ArrowUp") {
126
- e.preventDefault(), w("keyboard"), m(
127
+ e.preventDefault(), w("keyboard"), p(
127
128
  (t) => t > 0 ? t - 1 : r.length - 1
128
129
  );
129
130
  return;
130
131
  }
131
132
  if (e.key === "Enter" || e.key === "Tab") {
132
133
  e.preventDefault();
133
- const t = U.current, s = q.current;
134
+ const t = W.current, s = G.current;
134
135
  if (t >= 0 && t < s.length)
135
136
  i(s[t]);
136
137
  else {
@@ -143,9 +144,9 @@ const De = ve.forwardRef(
143
144
  }
144
145
  },
145
146
  [o, r, n, i, y, L]
146
- ), J = u(
147
+ ), Q = u(
147
148
  (e) => {
148
- i(e), setTimeout(() => W.current?.focus(), 0);
149
+ i(e), setTimeout(() => q.current?.focus(), 0);
149
150
  },
150
151
  [i]
151
152
  ), be = u(
@@ -157,25 +158,25 @@ const De = ve.forwardRef(
157
158
  if (e.button !== 0) return;
158
159
  e.preventDefault();
159
160
  const s = t.getAttribute("data-combobox-value");
160
- s != null && J(s);
161
+ s != null && Q(s);
161
162
  return;
162
163
  }
163
164
  e.preventDefault();
164
165
  },
165
- [J]
166
+ [Q]
166
167
  );
167
- return /* @__PURE__ */ a("div", { "data-component": "combobox", "data-numeric": E || void 0, children: V.wrapControl(
168
- /* @__PURE__ */ xe(N.Root, { open: o && !p, modal: !1, children: [
169
- /* @__PURE__ */ a(N.Anchor, { asChild: !0, children: /* @__PURE__ */ a(
168
+ return /* @__PURE__ */ a("div", { "data-component": "combobox", "data-numeric": N || void 0, children: V.wrapControl(
169
+ /* @__PURE__ */ xe(H.Root, { open: o && !m, modal: !1, children: [
170
+ /* @__PURE__ */ a(H.Anchor, { asChild: !0, children: /* @__PURE__ */ a(
170
171
  "div",
171
172
  {
172
173
  "data-component": "combobox-input-border",
173
174
  tabIndex: -1,
174
- className: _(
175
+ className: $(
175
176
  "flex w-full items-center gap-1 rounded-md border bg-transparent px-3 text-sm transition-colors outline-none ring-0 focus:outline-none focus:ring-0",
176
177
  "focus-within:outline-none focus-within:ring-0 focus-within:border-brand hover:border-brand",
177
178
  V.hasError ? "border-destructive hover:border-destructive" : "border-field",
178
- p && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
179
+ m && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
179
180
  Ce({ size: te }),
180
181
  "bg-canvas"
181
182
  ),
@@ -185,20 +186,20 @@ const De = ve.forwardRef(
185
186
  ref: ue,
186
187
  type: "text",
187
188
  value: n,
188
- onChange: pe,
189
- onFocus: me,
189
+ onChange: me,
190
+ onFocus: pe,
190
191
  onBlur: he,
191
192
  onKeyDown: ge,
192
- placeholder: F,
193
- disabled: !!p,
194
- className: _(
193
+ placeholder: z,
194
+ disabled: !!m,
195
+ className: $(
195
196
  "flex h-full w-full bg-transparent p-0 text-sm font-medium",
196
197
  "outline-none ring-0 shadow-none border-none",
197
198
  "focus:outline-none focus:ring-0 focus:shadow-none focus:border-none",
198
199
  "focus-visible:outline-none focus-visible:ring-0 focus-visible:shadow-none focus-visible:border-none",
199
200
  "placeholder:font-medium placeholder:text-content-empty",
200
- p && "opacity-100 text-disabled-foreground placeholder:text-disabled-foreground cursor-not-allowed",
201
- E && "text-right"
201
+ m && "opacity-100 text-disabled-foreground placeholder:text-disabled-foreground cursor-not-allowed",
202
+ N && "text-right"
202
203
  ),
203
204
  style: { boxShadow: "none", outline: "none" },
204
205
  autoComplete: "off",
@@ -208,28 +209,28 @@ const De = ve.forwardRef(
208
209
  "aria-haspopup": "listbox",
209
210
  "aria-controls": o ? A : void 0,
210
211
  "aria-activedescendant": fe,
211
- "aria-required": z || void 0,
212
- "aria-label": D ? void 0 : H,
212
+ "aria-required": B || void 0,
213
+ "aria-label": D ? void 0 : R,
213
214
  ...V.controlAria
214
215
  }
215
216
  )
216
217
  }
217
218
  ) }),
218
- /* @__PURE__ */ a(N.Portal, { children: /* @__PURE__ */ a(
219
- N.Content,
219
+ /* @__PURE__ */ a(H.Portal, { children: /* @__PURE__ */ a(
220
+ H.Content,
220
221
  {
221
222
  align: "start",
222
223
  side: "bottom",
223
224
  sideOffset: 4,
224
225
  avoidCollisions: !0,
225
226
  collisionPadding: 8,
226
- "aria-label": H,
227
+ "aria-label": R,
227
228
  onOpenAutoFocus: (e) => e.preventDefault(),
228
229
  onCloseAutoFocus: (e) => e.preventDefault(),
229
230
  onInteractOutside: () => {
230
231
  },
231
232
  onWheel: (e) => e.stopPropagation(),
232
- className: "z-[9999] overflow-hidden rounded-[12px] bg-canvas text-base shadow-[0px_1px_6px_0px_rgba(26,39,124,0.14)] focus:outline-none sm:text-sm flex flex-col border-none w-[var(--radix-popover-trigger-width)]",
233
+ className: "z-[9999] overflow-hidden rounded-[12px] bg-canvas text-base shadow-elevation-select focus:outline-none sm:text-sm flex flex-col border-none w-[var(--radix-popover-trigger-width)]",
233
234
  style: {
234
235
  maxHeight: "var(--radix-popover-content-available-height)"
235
236
  },
@@ -241,11 +242,11 @@ const De = ve.forwardRef(
241
242
  className: "flex-1 overflow-auto py-1 px-[6px]",
242
243
  style: { maxHeight: 240, overscrollBehavior: "contain" },
243
244
  role: "listbox",
244
- "aria-label": H,
245
+ "aria-label": R,
245
246
  onPointerDown: be,
246
247
  onWheel: (e) => e.stopPropagation(),
247
248
  onMouseLeave: () => {
248
- w("mouse"), m(-1);
249
+ w("mouse"), p(-1);
249
250
  },
250
251
  children: r.length === 0 ? /* @__PURE__ */ a("div", { className: "flex items-center justify-center py-6 text-sm text-secondary-foreground", children: ne }) : r.map((e, t) => {
251
252
  const s = t === h, g = e.toLowerCase() === S.toLowerCase(), j = `${A}-option-${t}`;
@@ -257,13 +258,13 @@ const De = ve.forwardRef(
257
258
  id: j,
258
259
  role: "option",
259
260
  "aria-selected": g,
260
- className: _(
261
+ className: $(
261
262
  "cursor-default select-none py-[6px] px-3 flex items-center transition-colors rounded-md",
262
- E ? "justify-end text-right" : "justify-between",
263
- s && G === "keyboard" ? "ring-2 ring-inset ring-primary bg-accent text-content" : s && G === "mouse" ? "bg-canvas-muted text-content" : g ? "bg-accent text-content" : "text-content hover:bg-canvas-muted cursor-pointer"
263
+ N ? "justify-end text-right" : "justify-between",
264
+ s && J === "keyboard" ? "ring-2 ring-inset ring-primary bg-accent text-content" : s && J === "mouse" ? "bg-canvas-muted text-content" : g ? "bg-accent text-content" : "text-content hover:bg-canvas-muted cursor-pointer"
264
265
  ),
265
266
  onMouseEnter: () => {
266
- w("mouse"), m(t);
267
+ w("mouse"), p(t);
267
268
  },
268
269
  children: /* @__PURE__ */ a("span", { className: "text-sm", children: e })
269
270
  }
@@ -277,7 +278,6 @@ const De = ve.forwardRef(
277
278
  ) });
278
279
  }
279
280
  );
280
- De.displayName = "Combobox";
281
281
  export {
282
- De as Combobox
282
+ He as Combobox
283
283
  };
@@ -1,17 +1,19 @@
1
1
  import { jsxs as w, jsx as r } from "react/jsx-runtime";
2
- import * as s from "react";
2
+ import * as p from "react";
3
3
  import { Cross as F, CalendarMonth as ee } from "impact-nova-icons";
4
4
  import { format as x, isValid as b, parse as P } from "date-fns";
5
- import { cn as ne, padValidDateString as te, maskDate as re } from "../../../lib/utils.js";
5
+ import { cn as ne, maskDate as te, padValidDateString as re } from "../../../lib/utils.js";
6
6
  import { Input as oe } from "../input/input.js";
7
7
  import { Popover as le, PopoverAnchor as ie, PopoverContent as ae } from "../../feedback/popover/popover.js";
8
8
  import { Calendar as ce } from "../../data-display/calendar/calendar.js";
9
9
  import { Tooltip as E, TooltipTrigger as T, TooltipContent as j } from "../../feedback/tooltip/tooltip.js";
10
10
  import { useImpactNovaI18n as se } from "../../../i18n/use-impact-nova-i18n.js";
11
11
  import { getDateFnsLocale as pe } from "../../../i18n/getDateFnsLocale.js";
12
- import { coerceSingleDateApply as ue, coerceSingleDate as de } from "./calendar-selection-adapters.js";
13
- import { buildDateBoundsMatcher as fe } from "../../../lib/date-bounds-matcher.js";
14
- const he = s.forwardRef(
12
+ import { createComponent as ue } from "../../../lib/primitives/create-component.js";
13
+ import { coerceSingleDateApply as de, coerceSingleDate as fe } from "./calendar-selection-adapters.js";
14
+ import { buildDateBoundsMatcher as he } from "../../../lib/date-bounds-matcher.js";
15
+ const Se = ue(
16
+ "DatePicker",
15
17
  ({
16
18
  value: t,
17
19
  onChange: f,
@@ -23,40 +25,40 @@ const he = s.forwardRef(
23
25
  endMonth: O,
24
26
  showFooter: h = !0,
25
27
  weekStartsOn: I,
26
- disabled: p,
28
+ disabled: s,
27
29
  className: H,
28
30
  ...q
29
31
  }, G) => {
30
- const { locale: N, t: m } = se(), g = s.useMemo(() => pe(N), [N]), J = L ?? m("datePicker.selectDate"), D = s.useRef(null), y = s.useRef(null);
31
- s.useImperativeHandle(G, () => D.current);
32
- const [l, Q] = s.useState(!1), v = s.useRef(!1), [k, i] = s.useState(null), C = t ? x(t, o, { locale: g }) : "", u = k?.input ?? C, R = l ? k?.pending ?? t : t, U = k?.viewMonth ?? t ?? /* @__PURE__ */ new Date(), a = (e) => {
33
- p || (i(e ? {
34
- input: C,
32
+ const { locale: S, t: m } = se(), g = p.useMemo(() => pe(S), [S]), J = L ?? m("datePicker.selectDate"), D = p.useRef(null), y = p.useRef(null);
33
+ p.useImperativeHandle(G, () => D.current);
34
+ const [l, Q] = p.useState(!1), v = p.useRef(!1), [C, i] = p.useState(null), k = t ? x(t, o, { locale: g }) : "", u = C?.input ?? k, N = l ? C?.pending ?? t : t, U = C?.viewMonth ?? t ?? /* @__PURE__ */ new Date(), a = (e) => {
35
+ s || (i(e ? {
36
+ input: k,
35
37
  pending: t,
36
38
  viewMonth: t ?? /* @__PURE__ */ new Date()
37
39
  } : null), Q(e));
38
40
  };
39
- s.useEffect(() => {
41
+ p.useEffect(() => {
40
42
  D.current && y.current !== null && (D.current.setSelectionRange(y.current, y.current), y.current = null);
41
43
  }, [u]);
42
44
  const W = (e) => {
43
- const n = de(e), d = n ? x(n, o, { locale: g }) : "";
45
+ const n = fe(e), d = n ? x(n, o, { locale: g }) : "";
44
46
  i(
45
47
  (c) => c ? { ...c, pending: n, input: d, viewMonth: n ?? c.viewMonth } : null
46
48
  ), n && !h && (f?.(n), a(!1));
47
49
  }, X = (e) => {
48
- const n = ue(e, R);
50
+ const n = de(e, N);
49
51
  f?.(n), a(!1);
50
- }, S = () => {
52
+ }, R = () => {
51
53
  a(!1);
52
54
  }, A = () => {
53
55
  f?.(void 0), h ? i(
54
56
  (e) => e ? { ...e, pending: void 0, input: "" } : null
55
57
  ) : a(!1);
56
58
  }, Y = (e) => {
57
- const n = e.target.value, d = re(n, o, u);
59
+ const n = e.target.value, d = te(n, o, u);
58
60
  if (i((M) => ({ ...M ?? {
59
- input: C,
61
+ input: k,
60
62
  pending: t,
61
63
  viewMonth: t ?? /* @__PURE__ */ new Date()
62
64
  }, input: d })), d === "") {
@@ -71,10 +73,10 @@ const he = s.forwardRef(
71
73
  }, pending: c, viewMonth: c })), h || f?.(c));
72
74
  }, Z = () => {
73
75
  if (l) return;
74
- const e = te(u, o), n = P(e, o, /* @__PURE__ */ new Date(), { locale: g });
76
+ const e = re(u, o), n = P(e, o, /* @__PURE__ */ new Date(), { locale: g });
75
77
  !b(n) || e.length !== o.length ? i(null) : h || (f?.(n), i(null));
76
78
  }, V = (t ? x(t, o, { locale: g }) : "") !== u, _ = u.length === o.length && !b(P(u, o, /* @__PURE__ */ new Date(), { locale: g }));
77
- return /* @__PURE__ */ w(le, { open: p ? !1 : l, onOpenChange: a, children: [
79
+ return /* @__PURE__ */ w(le, { open: s ? !1 : l, onOpenChange: a, children: [
78
80
  /* @__PURE__ */ r(ie, { asChild: !0, children: /* @__PURE__ */ r("div", { "data-component": "date-picker", "data-state": l ? "open" : "closed", "data-pending": V || void 0, children: /* @__PURE__ */ r(
79
81
  oe,
80
82
  {
@@ -82,12 +84,12 @@ const he = s.forwardRef(
82
84
  value: u,
83
85
  onChange: Y,
84
86
  onBlur: Z,
85
- onClick: () => !p && a(!0),
87
+ onClick: () => !s && a(!0),
86
88
  onKeyDown: (e) => {
87
- (e.key === "Enter" || e.key === "ArrowDown") && !l && !p && (e.preventDefault(), v.current = !0, a(!0)), e.key === "Escape" && l && (e.preventDefault(), S());
89
+ (e.key === "Enter" || e.key === "ArrowDown") && !l && !s && (e.preventDefault(), v.current = !0, a(!0)), e.key === "Escape" && l && (e.preventDefault(), R());
88
90
  },
89
91
  placeholder: l ? o : J,
90
- disabled: p,
92
+ disabled: s,
91
93
  "data-form-control": "input",
92
94
  className: ne(
93
95
  "cursor-pointer",
@@ -95,7 +97,7 @@ const he = s.forwardRef(
95
97
  H
96
98
  ),
97
99
  suffix: /* @__PURE__ */ w("div", { className: "flex items-center gap-1", children: [
98
- t && !p && /* @__PURE__ */ w(E, { children: [
100
+ t && !s && /* @__PURE__ */ w(E, { children: [
99
101
  /* @__PURE__ */ r(T, { asChild: !0, children: /* @__PURE__ */ r(
100
102
  "button",
101
103
  {
@@ -113,9 +115,9 @@ const he = s.forwardRef(
113
115
  ] }),
114
116
  /* @__PURE__ */ w(E, { children: [
115
117
  /* @__PURE__ */ r(T, { asChild: !0, children: /* @__PURE__ */ r("button", { type: "button", tabIndex: 0, "aria-label": m("datePicker.selectDate"), onClick: (e) => {
116
- e.stopPropagation(), p || a(!l);
118
+ e.stopPropagation(), s || a(!l);
117
119
  }, onKeyDown: (e) => {
118
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (v.current = !0, a(!l)));
120
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), s || (v.current = !0, a(!l)));
119
121
  }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ r(ee, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
120
122
  /* @__PURE__ */ r(j, { variant: "tertiary", side: "top", children: m("datePicker.selectDate") })
121
123
  ] })
@@ -136,18 +138,18 @@ const he = s.forwardRef(
136
138
  ce,
137
139
  {
138
140
  mode: "single",
139
- selected: R,
141
+ selected: N,
140
142
  onSelect: W,
141
143
  month: U,
142
144
  onMonthChange: (e) => i(
143
145
  (n) => n ? { ...n, viewMonth: e } : null
144
146
  ),
145
- disabled: fe(B, K),
147
+ disabled: he(B, K),
146
148
  startMonth: z,
147
149
  endMonth: O,
148
150
  showFooter: h,
149
151
  onApply: X,
150
- onCancel: S,
152
+ onCancel: R,
151
153
  onClear: A,
152
154
  captionLayout: "dropdown",
153
155
  ...I !== void 0 ? { weekStartsOn: I } : {}
@@ -158,7 +160,6 @@ const he = s.forwardRef(
158
160
  ] });
159
161
  }
160
162
  );
161
- he.displayName = "DatePicker";
162
163
  export {
163
- he as DatePicker
164
+ Se as DatePicker
164
165
  };