impact-nova 2.5.17 → 2.5.18

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 (68) hide show
  1. package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +1 -0
  2. package/dist/components/data/data-table/build-column-tree-from-grid.js +55 -50
  3. package/dist/components/data/data-table/column-picker-authority.d.ts +34 -0
  4. package/dist/components/data/data-table/column-picker-authority.js +116 -0
  5. package/dist/components/data/data-table/column-picker-drop-validation.d.ts +7 -0
  6. package/dist/components/data/data-table/column-picker-drop-validation.js +37 -0
  7. package/dist/components/data/data-table/data-table-column-apply.d.ts +2 -0
  8. package/dist/components/data/data-table/data-table-column-apply.js +84 -73
  9. package/dist/components/data/data-table/data-table-column-list-tree-apply.d.ts +10 -0
  10. package/dist/components/data/data-table/data-table-column-list-tree-apply.js +79 -0
  11. package/dist/components/data/data-table/data-table-column-list.js +94 -64
  12. package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +12 -6
  13. package/dist/components/data/data-table/data-table-column-tree-cache.js +250 -131
  14. package/dist/components/data/data-table/data-table-flat-column-virtual-rows.d.ts +26 -0
  15. package/dist/components/data/data-table/data-table-flat-column-virtual-rows.js +195 -0
  16. package/dist/components/data/data-table/data-table-picker-column-eligibility.d.ts +1 -0
  17. package/dist/components/data/data-table/data-table-picker-column-eligibility.js +7 -0
  18. package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.d.ts +5 -0
  19. package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.js +28 -11
  20. package/dist/components/data/data-table/reconcile-column-tree-from-grid.d.ts +12 -0
  21. package/dist/components/data/data-table/reconcile-column-tree-from-grid.js +12 -0
  22. package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +10 -0
  23. package/dist/components/data/data-table/use-data-table-column-list-sync.js +250 -196
  24. package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +2 -3
  25. package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +2 -3
  26. package/dist/components/data/nested-list/components/NestedListContent.d.ts +10 -2
  27. package/dist/components/data/nested-list/components/NestedListContent.js +253 -138
  28. package/dist/components/data/nested-list/components/SortableItem.d.ts +2 -1
  29. package/dist/components/data/nested-list/components/SortableItem.js +62 -60
  30. package/dist/components/data/nested-list/hooks/useNestedListDragDrop.d.ts +10 -20
  31. package/dist/components/data/nested-list/hooks/useNestedListDragDrop.js +44 -233
  32. package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.d.ts +24 -0
  33. package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.js +128 -0
  34. package/dist/components/data/nested-list/nested-list-constants.d.ts +4 -1
  35. package/dist/components/data/nested-list/nested-list-constants.js +10 -4
  36. package/dist/components/data/nested-list/nested-list-display-utils.d.ts +11 -0
  37. package/dist/components/data/nested-list/nested-list-display-utils.js +74 -0
  38. package/dist/components/data/nested-list/nested-list-drop-engine.d.ts +31 -0
  39. package/dist/components/data/nested-list/nested-list-drop-engine.js +209 -0
  40. package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.d.ts +26 -0
  41. package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.js +67 -0
  42. package/dist/components/data/nested-list/nested-list-item-tree-mutations.d.ts +4 -0
  43. package/dist/components/data/nested-list/nested-list-item-tree-mutations.js +43 -0
  44. package/dist/components/data/nested-list/nested-list-lazy-flat-rows.d.ts +3 -0
  45. package/dist/components/data/nested-list/nested-list-lazy-flat-rows.js +34 -0
  46. package/dist/components/data/nested-list/nested-list-row-estimates.d.ts +9 -0
  47. package/dist/components/data/nested-list/nested-list-row-estimates.js +14 -0
  48. package/dist/components/data/nested-list/nested-list-scroll-anchor.d.ts +36 -0
  49. package/dist/components/data/nested-list/nested-list-scroll-anchor.js +47 -0
  50. package/dist/components/data/nested-list/nested-list-virtual-drop.d.ts +59 -0
  51. package/dist/components/data/nested-list/nested-list-virtual-drop.js +341 -0
  52. package/dist/components/data/nested-list/nested-list.js +322 -336
  53. package/dist/components/data/nested-list/nested-list.types.d.ts +17 -0
  54. package/dist/components/feedback/tooltip/tab-tooltip-render.js +2 -3
  55. package/dist/components/flows/command-palette/shortcut-settings.js +10 -10
  56. package/dist/components/flows/filter-panel/filter-panel.js +4 -4
  57. package/dist/components/forms/select/components/SelectTriggerValue.js +2 -3
  58. package/dist/components/forms/select/components/Submenu.js +2 -3
  59. package/dist/form-react/Fields/ChipsField.js +49 -48
  60. package/dist/form-react/Fields/SelectField.js +24 -26
  61. package/dist/form-react/Fields/WeekRangePicker.js +16 -16
  62. package/dist/impact-nova.css +1 -1
  63. package/dist/lib/hash/fnv1a128.d.ts +16 -0
  64. package/dist/lib/hash/fnv1a128.js +21 -0
  65. package/dist/llms/rules/ag-grid.js +1 -1
  66. package/dist/llms/rules/installation.js +1 -1
  67. package/dist/llms/rules/requirements.js +1 -1
  68. package/package.json +1 -1
@@ -1,4 +1,9 @@
1
+ import { FlatNestedListRow } from './nested-list-virtual-drop';
1
2
  import type * as React from "react";
3
+ export interface FlatVirtualRowModel {
4
+ rowCount: number;
5
+ getRowAt: (index: number) => FlatNestedListRow;
6
+ }
2
7
  export interface NestedListItem {
3
8
  id: string;
4
9
  label: string;
@@ -47,9 +52,21 @@ export interface NestedListProps {
47
52
  initialCollapsedItems?: Record<string, boolean>;
48
53
  onCollapseChange?: (collapsedItems: Record<string, boolean>) => void;
49
54
  canDrag?: (item: NestedListItem, level: number) => boolean;
55
+ isValidDropTarget?: (options: {
56
+ activeItemId: string;
57
+ overItemId: string;
58
+ items: NestedListItem[];
59
+ insertAfter?: boolean;
60
+ }) => boolean;
50
61
  searchPlaceholder?: string;
51
62
  className?: string;
52
63
  groupLabel?: string;
53
64
  submitButtonLabel?: string;
54
65
  cancelButtonLabel?: string;
66
+ dragMode?: NestedListDragMode;
67
+ onVirtualReorder?: (fromIndex: number, toIndex: number) => void;
68
+ onVirtualDrop?: (activeId: string, overId: string, insertAfter: boolean) => void;
69
+ flatVirtualRowResolver?: (searchQuery: string) => FlatVirtualRowModel;
70
+ onFlatVirtualSelectAll?: (shouldSelectAll: boolean) => void;
55
71
  }
72
+ export type NestedListDragMode = 'sortable' | 'virtual-index';
@@ -1,7 +1,6 @@
1
1
  import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
2
  import { Tooltip as l, TooltipTrigger as n, TooltipContent as o } from "./tooltip.js";
3
- import "react";
4
- const p = (i, r, a) => /* @__PURE__ */ t(l, { children: [
3
+ const d = (i, r, a) => /* @__PURE__ */ t(l, { children: [
5
4
  /* @__PURE__ */ e(n, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "inline-flex items-center justify-center h-full w-full", children: i }) }),
6
5
  /* @__PURE__ */ e(o, { variant: "tertiary", className: a, children: r })
7
6
  ] }), h = (i, r) => /* @__PURE__ */ t(l, { children: [
@@ -10,5 +9,5 @@ const p = (i, r, a) => /* @__PURE__ */ t(l, { children: [
10
9
  ] });
11
10
  export {
12
11
  h as defaultAccordionTooltipRender,
13
- p as defaultTabTooltipRender
12
+ d as defaultTabTooltipRender
14
13
  };
@@ -2,17 +2,17 @@ import { jsx as r, jsxs as h, Fragment as z } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
3
  import { Person as G, Monitor as U, PriorityAlert as q, Locked as O, Reset as B } from "impact-nova-icons";
4
4
  import { cn as p } from "../../../lib/utils.js";
5
- import { Kbd as $ } from "../../primitives/kbd/kbd.js";
6
- import { keybindingToString as H } from "../../primitives/kbd/keybinding-display.js";
7
5
  import { OverflowTooltip as A } from "../../feedback/tooltip/overflow-tooltip.js";
8
- import { ModuleRegistry as V, AllCommunityModule as J } from "ag-grid-community";
9
- import { AllEnterpriseModule as Q } from "ag-grid-enterprise";
10
- import { DataTable as X, DataTableContent as Y } from "../../data/data-table/data-table.js";
6
+ import { ModuleRegistry as $, AllCommunityModule as H } from "ag-grid-community";
7
+ import { AllEnterpriseModule as V } from "ag-grid-enterprise";
8
+ import { DataTable as J, DataTableContent as Q } from "../../data/data-table/data-table.js";
11
9
  import { AG_CELL_NO_PADDING as F } from "../../data/ag-grid-react/cell-renderers/index.js";
10
+ import { Kbd as X } from "../../primitives/kbd/kbd.js";
11
+ import { keybindingToString as Y } from "../../primitives/kbd/keybinding-display.js";
12
12
  import { useCommandPalette as Z } from "./use-command-palette.js";
13
13
  import { COMMAND_SOURCE_LABELS as m, keybindingFromEvent as W, isReservedShortcut as ee } from "./utils.js";
14
14
  import { BadgeCellRenderer as te } from "../../data/ag-grid-react/cell-renderers/badge-cell-renderer.js";
15
- V.registerModules([J, Q]);
15
+ $.registerModules([H, V]);
16
16
  function re(a) {
17
17
  const t = a.data;
18
18
  return t ? /* @__PURE__ */ h("div", { className: "flex items-center gap-2 min-w-0 h-full", children: [
@@ -69,7 +69,7 @@ function ne(a) {
69
69
  "flex items-center justify-end h-full w-full text-end",
70
70
  t.customisable ? "cursor-pointer" : "cursor-default opacity-70"
71
71
  ),
72
- children: /* @__PURE__ */ r($, { keybinding: t.keybinding, size: "sm" })
72
+ children: /* @__PURE__ */ r(X, { keybinding: t.keybinding, size: "sm" })
73
73
  }
74
74
  ) : t.customisable ? /* @__PURE__ */ r(
75
75
  "button",
@@ -133,7 +133,7 @@ function le({
133
133
  description: e.description || "",
134
134
  category: e.category || "General",
135
135
  keybinding: i,
136
- keybindingDisplay: i ? H(i) : "",
136
+ keybindingDisplay: i ? Y(i) : "",
137
137
  scope: e.scope,
138
138
  source: D,
139
139
  sourceColor: T ? "primary" : "neutral",
@@ -278,10 +278,10 @@ function le({
278
278
  u?.type === "conflict" ? /* @__PURE__ */ r(q, { className: "h-3.5 w-3.5 shrink-0" }) : u?.type === "reserved" ? /* @__PURE__ */ r(O, { className: "h-3.5 w-3.5 shrink-0" }) : c ? /* @__PURE__ */ r("span", { className: "shrink-0 text-base", children: "⌨️" }) : null,
279
279
  /* @__PURE__ */ r("span", { children: u ? u.text : L })
280
280
  ] }) : null;
281
- return /* @__PURE__ */ h(X, { className: p("flex flex-col w-full h-full border-t-0", a), children: [
281
+ return /* @__PURE__ */ h(J, { className: p("flex flex-col w-full h-full border-t-0", a), children: [
282
282
  s ? s(E) : E,
283
283
  /* @__PURE__ */ r(
284
- Y,
284
+ Q,
285
285
  {
286
286
  rowData: y,
287
287
  columnDefs: I,
@@ -6,8 +6,8 @@ import { cn as o } from "../../../lib/utils.js";
6
6
  import { MultiColorFilter as F, Cross as P, InfoBadge as u } from "impact-nova-icons";
7
7
  import { Button as D } from "../../primitives/button/button.js";
8
8
  import { Tooltip as c, TooltipTrigger as f, TooltipContent as h } from "../../feedback/tooltip/tooltip.js";
9
- import { Kbd as S } from "../../primitives/kbd/kbd.js";
10
- import { OverflowTooltip as j } from "../../feedback/tooltip/overflow-tooltip.js";
9
+ import { OverflowTooltip as S } from "../../feedback/tooltip/overflow-tooltip.js";
10
+ import { Kbd as j } from "../../primitives/kbd/kbd.js";
11
11
  import { useImpactNovaI18n as v } from "../../../i18n/use-impact-nova-i18n.js";
12
12
  import { useOverlayHostDismissNestedLayersOnNavigation as I } from "../../../lib/overlay/overlay-portal-context.js";
13
13
  import { preventDismissOnTooltipOutside as x } from "../../../lib/overlay/prevent-dismiss-on-tooltip-outside.js";
@@ -145,14 +145,14 @@ const O = ({
145
145
  ),
146
146
  /* @__PURE__ */ a("div", { className: "flex items-center gap-1 min-w-0", children: [
147
147
  /* @__PURE__ */ e(
148
- j,
148
+ S,
149
149
  {
150
150
  triggerClassName: "truncate font-['Manrope'] block min-w-0",
151
151
  content: t.tooltipKeybinding ? /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
152
152
  t.label,
153
153
  " ",
154
154
  /* @__PURE__ */ e(
155
- S,
155
+ j,
156
156
  {
157
157
  keybinding: t.tooltipKeybinding,
158
158
  size: "sm"
@@ -1,9 +1,8 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { cn as x } from "../../../../lib/utils.js";
3
- import "react";
4
3
  import { OverflowTooltip as m } from "../../../feedback/tooltip/overflow-tooltip.js";
5
4
  import { isInvertedSelection as h, isOptionArray as d } from "../utils/select.js";
6
- function C({
5
+ function w({
7
6
  isMulti: u,
8
7
  isDisabled: p,
9
8
  internalValue: o,
@@ -53,5 +52,5 @@ function C({
53
52
  );
54
53
  }
55
54
  export {
56
- C as SelectTriggerValue
55
+ w as SelectTriggerValue
57
56
  };
@@ -1,14 +1,13 @@
1
1
  import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
2
  import * as i from "@radix-ui/react-popover";
3
3
  import { Checkbox as P } from "../../checkbox/checkbox.js";
4
- import "react";
5
4
  import { OverflowTooltip as y } from "../../../feedback/tooltip/overflow-tooltip.js";
6
5
  import { ChevronRight as A, Checkmark as O } from "impact-nova-icons";
7
6
  import { cn as v } from "../../../../lib/utils.js";
8
7
  import { useOverlayPortalContainer as T } from "../../../../lib/overlay/overlay-portal-context.js";
9
8
  import { OVERLAY_NESTED_FLOATING_INSTANT_HIDE_CLASS as _ } from "../../../../lib/overlay/overlay-host.constants.js";
10
9
  import { useSuppressOptionClickForTextSelection as E } from "../hooks/useSuppressOptionClickForTextSelection.js";
11
- const R = ({
10
+ const G = ({
12
11
  parentOption: n,
13
12
  isMulti: u,
14
13
  isReadOnly: l,
@@ -106,5 +105,5 @@ const R = ({
106
105
  ] });
107
106
  };
108
107
  export {
109
- R as Submenu
108
+ G as Submenu
110
109
  };
@@ -1,39 +1,39 @@
1
- import { jsx as t, jsxs as o } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as u } from "react/jsx-runtime";
2
2
  import "react";
3
- import { Controller as w } from "react-hook-form";
4
- import { Info as T } from "impact-nova-icons";
3
+ import { Controller as V } from "react-hook-form";
4
+ import { Info as w } from "impact-nova-icons";
5
5
  import { Chip as f } from "../../components/primitives/chips/chips.js";
6
- import { Checkbox as z } from "../../components/forms/checkbox/checkbox.js";
6
+ import { Checkbox as T } from "../../components/forms/checkbox/checkbox.js";
7
7
  import { cn as i } from "../../lib/utils.js";
8
- import { getFieldTestId as V } from "../utils/fieldTestIds.js";
9
- const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertiary", G = ({
10
- field: s,
8
+ import { getFieldTestId as z } from "../utils/fieldTestIds.js";
9
+ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertiary", R = ({
10
+ field: l,
11
11
  validationRules: h,
12
- isDisabled: n,
13
- formHelpers: v
12
+ isDisabled: a,
13
+ formHelpers: n
14
14
  }) => {
15
- if (s.fieldType !== "chips") return null;
16
- const u = s, d = u.options ?? [], g = u.chipsType ?? "single", b = u.allowDeselect === !0, C = v.form.control, N = s.id;
15
+ if (l.fieldType !== "chips") return null;
16
+ const d = l, p = d.options ?? [], g = d.chipsType ?? "single", b = d.allowDeselect === !0, N = n.form.control, c = l.id;
17
17
  return /* @__PURE__ */ t(
18
- w,
18
+ V,
19
19
  {
20
- name: N,
21
- control: C,
22
- disabled: n,
20
+ name: c,
21
+ control: N,
22
+ disabled: a,
23
23
  rules: h,
24
- render: ({ field: a, fieldState: p }) => {
25
- const c = a.value, k = typeof c == "string" ? c : "", m = Array.isArray(c) ? c : [], l = !!p.error, x = l ? p.error?.message : s.helpText;
26
- return /* @__PURE__ */ o("div", { "data-testid": V(s.id), children: [
27
- s.label ? /* @__PURE__ */ o(
24
+ render: ({ field: C, fieldState: x }) => {
25
+ const o = C.value, k = typeof o == "string" ? o : "", m = Array.isArray(o) ? o : [], r = !!x.error, v = r ? x.error?.message : l.helpText;
26
+ return /* @__PURE__ */ u("div", { "data-testid": z(l.id), children: [
27
+ l.label ? /* @__PURE__ */ u(
28
28
  "div",
29
29
  {
30
30
  className: i(
31
31
  j,
32
- l && "text-destructive"
32
+ r && "text-destructive"
33
33
  ),
34
34
  children: [
35
- s.label,
36
- s.isRequired ? /* @__PURE__ */ t("span", { className: "ml-1 text-destructive", children: "*" }) : null
35
+ l.label,
36
+ l.isRequired ? /* @__PURE__ */ t("span", { className: "ml-1 text-destructive", children: "*" }) : null
37
37
  ]
38
38
  }
39
39
  ) : null,
@@ -41,11 +41,11 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
41
41
  "div",
42
42
  {
43
43
  role: "radiogroup",
44
- "aria-label": s.label,
45
- "aria-invalid": l,
44
+ "aria-label": l.label,
45
+ "aria-invalid": r,
46
46
  className: "mb-2 flex w-full flex-wrap items-center gap-3",
47
- children: d.map((e) => {
48
- const r = k === e.value;
47
+ children: p.map((e) => {
48
+ const s = k === e.value;
49
49
  return /* @__PURE__ */ t(
50
50
  f,
51
51
  {
@@ -53,19 +53,19 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
53
53
  shape: "rounded",
54
54
  size: "lg",
55
55
  selectionMode: "single",
56
- selected: r,
57
- disabled: n,
56
+ selected: s,
57
+ disabled: a,
58
58
  className: i(
59
59
  "cursor-pointer gap-2 focus-visible:ring-0 focus-visible:ring-offset-0",
60
- l && !r && "!border-destructive !text-destructive"
60
+ r && !s && "!border-destructive !text-destructive"
61
61
  ),
62
62
  onClick: () => {
63
- if (!n) {
64
- if (r && b) {
65
- a.onChange("");
63
+ if (!a) {
64
+ if (s && b) {
65
+ n.setValue(c, "");
66
66
  return;
67
67
  }
68
- r || a.onChange(e.value);
68
+ s || n.setValue(c, e.value);
69
69
  }
70
70
  },
71
71
  children: /* @__PURE__ */ t("span", { className: "text-sm", children: e.label })
@@ -74,52 +74,53 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
74
74
  );
75
75
  })
76
76
  }
77
- ) : /* @__PURE__ */ t("div", { className: "mb-2 flex w-full flex-wrap gap-3", children: d.map((e) => {
78
- const r = m.includes(e.value);
79
- return /* @__PURE__ */ o(
77
+ ) : /* @__PURE__ */ t("div", { className: "mb-2 flex w-full flex-wrap gap-3", children: p.map((e) => {
78
+ const s = m.includes(e.value);
79
+ return /* @__PURE__ */ u(
80
80
  f,
81
81
  {
82
82
  variant: "outline",
83
83
  shape: "rounded",
84
84
  size: "lg",
85
- selected: r,
85
+ selected: s,
86
86
  className: i(
87
87
  "cursor-pointer gap-2 focus-visible:ring-0 focus-visible:ring-offset-0",
88
- l && !r && "!border-destructive !text-destructive"
88
+ r && !s && "!border-destructive !text-destructive"
89
89
  ),
90
90
  onClick: () => {
91
- n || (r ? a.onChange(
91
+ a || (s ? n.setValue(
92
+ c,
92
93
  m.filter(
93
94
  (y) => y !== e.value
94
95
  )
95
- ) : a.onChange([
96
+ ) : n.setValue(c, [
96
97
  ...m,
97
98
  e.value
98
99
  ]));
99
100
  },
100
101
  children: [
101
- /* @__PURE__ */ t(z, { checked: r, disabled: n }),
102
+ /* @__PURE__ */ t(T, { checked: s, disabled: a }),
102
103
  /* @__PURE__ */ t("span", { className: "text-sm", children: e.label })
103
104
  ]
104
105
  },
105
106
  e.value
106
107
  );
107
108
  }) }),
108
- x ? /* @__PURE__ */ o(
109
+ v ? /* @__PURE__ */ u(
109
110
  "div",
110
111
  {
111
112
  className: i(
112
113
  "mt-1 flex items-center gap-1",
113
- l && "text-destructive"
114
+ r && "text-destructive"
114
115
  ),
115
116
  children: [
116
117
  /* @__PURE__ */ t(
117
- T,
118
+ w,
118
119
  {
119
120
  size: "xs",
120
121
  className: i(
121
122
  "shrink-0",
122
- l ? "text-destructive" : "text-content-icon"
123
+ r ? "text-destructive" : "text-content-icon"
123
124
  )
124
125
  }
125
126
  ),
@@ -128,9 +129,9 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
128
129
  {
129
130
  className: i(
130
131
  "text-[12px] font-medium leading-[18px] text-navigation-muted",
131
- l && "text-destructive"
132
+ r && "text-destructive"
132
133
  ),
133
- children: x
134
+ children: v
134
135
  }
135
136
  )
136
137
  ]
@@ -142,5 +143,5 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
142
143
  );
143
144
  };
144
145
  export {
145
- G as ChipsField
146
+ R as ChipsField
146
147
  };
@@ -1,47 +1,46 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
2
  import { useState as A } from "react";
3
- import { Controller as M } from "react-hook-form";
4
- import { Select as f } from "../../components/forms/select/select.js";
3
+ import { Controller as f } from "react-hook-form";
4
+ import { Select as M } from "../../components/forms/select/select.js";
5
5
  import { useSelectOptions as x } from "../hooks/useSelectOptions.js";
6
- import { getFieldTestId as E } from "../utils/fieldTestIds.js";
7
- import { isEmptyValue as R } from "../../form-engine/is-empty-value.js";
8
- const $ = ({
6
+ import { getFieldTestId as T } from "../utils/fieldTestIds.js";
7
+ const L = ({
9
8
  field: e,
10
9
  validationRules: p,
11
- isDisabled: m,
12
- formHelpers: s,
13
- supportedValues: u
10
+ isDisabled: u,
11
+ formHelpers: n,
12
+ supportedValues: d
14
13
  }) => {
15
- const t = e.fieldType === "select" ? e : null, [d, n] = A(!1), S = s.form.control, h = u?.[e.id], { options: g, isLoading: b, error: y, refetch: O } = x({
14
+ const t = e.fieldType === "select" ? e : null, [m, i] = A(!1), S = n.form.control, h = d?.[e.id], { options: g, isLoading: b, error: O, refetch: C } = x({
16
15
  apiConfig: t?.apiConfig,
17
- formHelpers: s,
16
+ formHelpers: n,
18
17
  initialOptions: t?.options,
19
18
  id: e.id,
20
- isEnabled: d,
19
+ isEnabled: m,
21
20
  getSelectOptionsName: t?.getSelectOptionsName,
22
21
  fieldSupportedValues: h,
23
22
  cascadingDependency: e.cascadingDependency
24
23
  });
25
24
  return t ? /* @__PURE__ */ c(
26
- M,
25
+ f,
27
26
  {
28
27
  name: e.id,
29
28
  control: S,
30
29
  rules: p,
31
30
  render: ({ field: o, fieldState: l }) => {
32
- const a = !!l.error, i = o.value, C = t?.isMultiSelect ? e.id : `${e.id}-${R(i) ? "empty" : "has-value"}`;
31
+ const s = !!l.error, a = o.value, y = t?.isMultiSelect ? a ?? [] : a?.[0] ?? null;
33
32
  return /* @__PURE__ */ c(
34
- f,
33
+ M,
35
34
  {
36
35
  id: e.id,
37
36
  label: e.label,
38
37
  placeholder: e?.placeholder,
39
38
  required: e.isRequired,
40
39
  isReadOnly: e.isFieldReadonly,
41
- disabled: m,
40
+ disabled: u,
42
41
  options: g,
43
42
  maxSelectableOptions: t?.maxSelectLimit,
44
- value: t?.isMultiSelect ? i ?? [] : i?.[0],
43
+ value: y,
45
44
  onChange: (r) => {
46
45
  t?.isMultiSelect ? o.onChange(
47
46
  Array.isArray(r) ? r : []
@@ -54,22 +53,21 @@ const $ = ({
54
53
  multiple: t?.isMultiSelect,
55
54
  isSelectAllEnabled: !t?.disableSelectAll,
56
55
  labelOrientation: t?.labelOrientation || "top",
57
- error: a,
58
- helperText: a ? l.error?.message : e.helpText,
56
+ error: s,
57
+ helperText: s ? l.error?.message : e.helpText,
59
58
  ignoreAccents: !0,
60
59
  isLoading: b,
61
- fetchError: y,
62
- onRefetch: O,
63
- onMenuOpen: () => n(!0),
64
- onMenuClose: () => n(!1),
65
- "data-testid": E(e.id)
66
- },
67
- C
60
+ fetchError: O,
61
+ onRefetch: C,
62
+ onMenuOpen: () => i(!0),
63
+ onMenuClose: () => i(!1),
64
+ "data-testid": T(e.id)
65
+ }
68
66
  );
69
67
  }
70
68
  }
71
69
  ) : null;
72
70
  };
73
71
  export {
74
- $ as SelectField
72
+ L as SelectField
75
73
  };
@@ -1,10 +1,10 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
2
  import { Controller as b } from "react-hook-form";
3
3
  import { WeekRangePicker as x } from "../../components/forms/date-picker/week-range-picker.js";
4
- import { toLocalDate as M } from "../utils/calendar-boundary.js";
4
+ import { toLocalDate as f } from "../utils/calendar-boundary.js";
5
5
  import { resolveWeekSelection as Y } from "../../lib/fiscal-calendar/week-selection.js";
6
6
  import { resolveWeekRangeMinMax as $ } from "../utils/date.utils.js";
7
- const f = (e, a) => Y(e, {
7
+ const S = (e, a) => Y(e, {
8
8
  calendarKind: a.calendarKind,
9
9
  fiscalMode: a.fiscalMode ?? "basic",
10
10
  granularity: a.granularity,
@@ -14,44 +14,44 @@ const f = (e, a) => Y(e, {
14
14
  }), C = ({
15
15
  field: e,
16
16
  validationRules: a,
17
- isDisabled: S,
17
+ isDisabled: p,
18
18
  formHelpers: d
19
19
  }) => {
20
20
  const t = e.fieldType === "week_range" ? e : null;
21
21
  if (!t) return null;
22
- const { minDate: p, maxDate: u, startMonth: D, endMonth: k } = $(t), v = d.form.control;
22
+ const { minDate: u, maxDate: m, startMonth: D, endMonth: k } = $(t), v = d.form.control;
23
23
  return /* @__PURE__ */ c(
24
24
  b,
25
25
  {
26
26
  name: e.id,
27
27
  control: v,
28
28
  rules: a,
29
- render: ({ field: w, fieldState: m }) => {
30
- const h = !!m.error, r = w.value, s = r?.start ? M(r.start) ?? null : null, i = r?.end ? M(r.end) ?? null : null, F = !!(s && i);
29
+ render: ({ field: w, fieldState: h }) => {
30
+ const g = !!h.error, r = w.value, s = r?.start ? f(r.start) ?? null : null, i = r?.end ? f(r.end) ?? null : null, F = !!(s && i);
31
31
  return /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(
32
32
  x,
33
33
  {
34
34
  label: e.label,
35
35
  value: F && s && i ? {
36
- from: f(s, t),
37
- to: f(i, t)
36
+ from: S(s, t),
37
+ to: S(i, t)
38
38
  } : void 0,
39
39
  onChange: (o) => {
40
- const g = o?.from ? { from: o.from, to: o.to ?? o.from } : void 0, n = g?.from?.startDate, l = g?.to?.endDate, P = n ? `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")}` : null, T = l ? `${l.getFullYear()}-${String(l.getMonth() + 1).padStart(2, "0")}-${String(l.getDate()).padStart(2, "0")}` : null;
40
+ const M = o?.from ? { from: o.from, to: o.to ?? o.from } : void 0, n = M?.from?.startDate, l = M?.to?.endDate, P = n ? `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")}` : null, T = l ? `${l.getFullYear()}-${String(l.getMonth() + 1).padStart(2, "0")}-${String(l.getDate()).padStart(2, "0")}` : null;
41
41
  d.setValue(e.id, { start: P, end: T });
42
42
  },
43
43
  placeholder: t.placeholder,
44
- startMonth: D,
45
- endMonth: u ?? k,
44
+ startMonth: u ?? D,
45
+ endMonth: m ?? k,
46
46
  required: e.isRequired,
47
- disabled: S,
48
- error: h,
49
- helperText: h ? m.error?.message : e.helpText,
47
+ disabled: p,
48
+ error: g,
49
+ helperText: g ? h.error?.message : e.helpText,
50
50
  calendarKind: t.calendarKind,
51
51
  fiscalMode: t.fiscalMode,
52
52
  weekStartsOn: t.weekStartsOn,
53
- minDate: p,
54
- maxDate: u,
53
+ minDate: u,
54
+ maxDate: m,
55
55
  granularity: t.granularity,
56
56
  fiscalMonthPattern: t.fiscalMonthPattern,
57
57
  fiscalYearStartMonth: t.fiscalYearStartMonth,