impact-nova 1.3.0 → 1.5.2

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 (117) hide show
  1. package/README.md +49 -0
  2. package/dist/components/layout/dashboard-layout.d.ts +15 -1
  3. package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
  4. package/dist/components/ui/accordion.js +38 -34
  5. package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
  6. package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
  7. package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
  8. package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
  9. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
  10. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
  11. package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
  12. package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
  13. package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
  14. package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
  15. package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
  16. package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
  17. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
  18. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
  19. package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
  20. package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
  21. package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
  22. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
  23. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
  24. package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
  25. package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
  26. package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
  27. package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
  28. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
  29. package/dist/components/ui/alert.js +62 -58
  30. package/dist/components/ui/breadcrumb.js +81 -74
  31. package/dist/components/ui/calendar.js +354 -354
  32. package/dist/components/ui/chart/chart.js +63 -62
  33. package/dist/components/ui/chips.js +42 -38
  34. package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
  35. package/dist/components/ui/command-palette/command-palette-context.js +110 -0
  36. package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
  37. package/dist/components/ui/command-palette/command-palette.js +402 -0
  38. package/dist/components/ui/command-palette/index.d.ts +23 -0
  39. package/dist/components/ui/command-palette/index.js +44 -0
  40. package/dist/components/ui/command-palette/kbd.d.ts +28 -0
  41. package/dist/components/ui/command-palette/kbd.js +52 -0
  42. package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
  43. package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
  44. package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
  45. package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
  46. package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
  47. package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
  48. package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
  49. package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
  50. package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
  51. package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
  52. package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
  53. package/dist/components/ui/command-palette/use-shortcut.js +49 -0
  54. package/dist/components/ui/command-palette/utils.d.ts +119 -0
  55. package/dist/components/ui/command-palette/utils.js +248 -0
  56. package/dist/components/ui/data-table/data-table-column-list.js +87 -86
  57. package/dist/components/ui/data-table/data-table-format-options.js +45 -44
  58. package/dist/components/ui/data-table/data-table-view-options.js +39 -38
  59. package/dist/components/ui/date-picker/date-picker.js +89 -87
  60. package/dist/components/ui/date-picker/date-range-picker.js +140 -138
  61. package/dist/components/ui/date-picker/month-picker.js +82 -81
  62. package/dist/components/ui/date-picker/month-range-picker.js +108 -105
  63. package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
  64. package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
  65. package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
  66. package/dist/components/ui/date-picker/week-picker.js +117 -115
  67. package/dist/components/ui/date-picker/week-range-picker.js +166 -164
  68. package/dist/components/ui/dialog.js +78 -73
  69. package/dist/components/ui/drawer.js +71 -66
  70. package/dist/components/ui/file-upload.js +131 -127
  71. package/dist/components/ui/filter-panel/filter-panel.js +98 -94
  72. package/dist/components/ui/filter-strip/filter-strip.js +95 -91
  73. package/dist/components/ui/filter-strip/filter-summary.js +91 -90
  74. package/dist/components/ui/header.js +57 -53
  75. package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
  76. package/dist/components/ui/loader.js +17 -16
  77. package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
  78. package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
  79. package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
  80. package/dist/components/ui/nested-list/nested-list.js +184 -182
  81. package/dist/components/ui/notification-panel/notification-panel.js +60 -53
  82. package/dist/components/ui/popover.js +45 -40
  83. package/dist/components/ui/prompt.js +90 -86
  84. package/dist/components/ui/select/select.js +206 -209
  85. package/dist/components/ui/sheet.d.ts +1 -0
  86. package/dist/components/ui/sheet.js +50 -48
  87. package/dist/components/ui/sidebar.js +273 -267
  88. package/dist/components/ui/stepper.js +75 -63
  89. package/dist/components/ui/tag.js +48 -44
  90. package/dist/components/ui/toast.js +46 -41
  91. package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
  92. package/dist/i18n/ImpactNovaI18nContext.js +76 -0
  93. package/dist/i18n/defaultMessages.d.ts +231 -0
  94. package/dist/i18n/defaultMessages.js +206 -0
  95. package/dist/i18n/getDateFnsLocale.d.ts +11 -0
  96. package/dist/i18n/getDateFnsLocale.js +21 -0
  97. package/dist/i18n/index.d.ts +5 -0
  98. package/dist/i18n/locales/de.d.ts +2 -0
  99. package/dist/i18n/locales/de.js +206 -0
  100. package/dist/i18n/locales/es.d.ts +2 -0
  101. package/dist/i18n/locales/es.js +206 -0
  102. package/dist/i18n/locales/hi.d.ts +2 -0
  103. package/dist/i18n/locales/hi.js +206 -0
  104. package/dist/i18n/locales/index.d.ts +4 -0
  105. package/dist/i18n/locales/kn.d.ts +2 -0
  106. package/dist/i18n/locales/kn.js +206 -0
  107. package/dist/icons/assets/boxAdd.svg.js +5 -0
  108. package/dist/icons/assets/boxed.svg.js +5 -0
  109. package/dist/icons/assets/trolley.svg.js +5 -0
  110. package/dist/icons/assets/unlocked.svg.js +5 -0
  111. package/dist/icons/index.d.ts +4 -0
  112. package/dist/icons/index.js +179 -171
  113. package/dist/impact-nova.css +1 -1
  114. package/dist/index.d.ts +4 -0
  115. package/dist/index.js +232 -172
  116. package/package.json +36 -4
  117. package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
@@ -1,91 +1,93 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import * as a from "react";
3
- import { X as v } from "lucide-react";
4
- import { CalendarMonth as w } from "../../../icons/index.js";
5
- import { format as j } from "date-fns";
6
- import { cn as R } from "../../../lib/utils.js";
7
- import { Input as b } from "../input.js";
8
- import { Popover as E, PopoverTrigger as I, PopoverContent as L } from "../popover.js";
9
- import { Calendar as V } from "../calendar.js";
10
- import { Tooltip as f, TooltipTrigger as h, TooltipContent as u } from "../tooltip.js";
11
- const X = a.forwardRef(
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import * as r from "react";
3
+ import { X as j } from "lucide-react";
4
+ import { CalendarMonth as R } from "../../../icons/index.js";
5
+ import { format as b } from "date-fns";
6
+ import { cn as E } from "../../../lib/utils.js";
7
+ import { Input as F } from "../input.js";
8
+ import { Popover as V, PopoverTrigger as X, PopoverContent as $ } from "../popover.js";
9
+ import { Calendar as q } from "../calendar.js";
10
+ import { Tooltip as u, TooltipTrigger as g, TooltipContent as y } from "../tooltip.js";
11
+ import { getDateFnsLocale as z } from "../../../i18n/getDateFnsLocale.js";
12
+ import { useImpactNovaI18n as B } from "../../../i18n/ImpactNovaI18nContext.js";
13
+ const G = r.forwardRef(
12
14
  ({
13
15
  value: e,
14
- onChange: l,
15
- format: y = "MM/dd/yyyy",
16
- placeholder: g = "Select Dates",
17
- minDate: C,
18
- maxDate: P,
19
- startMonth: x,
20
- endMonth: T,
16
+ onChange: i,
17
+ format: C = "MM/dd/yyyy",
18
+ placeholder: P,
19
+ minDate: M,
20
+ maxDate: x,
21
+ startMonth: D,
22
+ endMonth: N,
21
23
  showFooter: s = !0,
22
- disabled: c,
23
- className: N,
24
- ...A
25
- }, D) => {
26
- const [d, o] = a.useState(!1), [p, n] = a.useState(e);
27
- a.useEffect(() => {
28
- n(e);
29
- }, [d, e]);
30
- const M = (r) => {
31
- n(r), s || l?.(r);
32
- }, S = (r) => {
33
- l?.(r !== void 0 ? r : p), o(!1);
34
- }, k = () => {
35
- n(e), o(!1);
36
- }, m = () => {
37
- n(void 0), l?.(void 0), s || o(!1);
38
- }, O = e && e.length > 0 ? e.length === 1 ? j(e[0], y) : `${e.length} dates selected` : "";
39
- return /* @__PURE__ */ i(E, { open: d, onOpenChange: o, children: [
40
- /* @__PURE__ */ t(I, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
41
- b,
24
+ disabled: d,
25
+ className: T,
26
+ ...k
27
+ }, A) => {
28
+ const { locale: p, t: c } = B(), v = r.useMemo(() => z(p), [p]), L = P ?? c("datePicker.selectMultipleDates"), [m, n] = r.useState(!1), [f, a] = r.useState(e);
29
+ r.useEffect(() => {
30
+ a(e);
31
+ }, [m, e]);
32
+ const O = (o) => {
33
+ a(o), s || i?.(o);
34
+ }, S = (o) => {
35
+ i?.(o !== void 0 ? o : f), n(!1);
36
+ }, w = () => {
37
+ a(e), n(!1);
38
+ }, h = () => {
39
+ a(void 0), i?.(void 0), s || n(!1);
40
+ }, I = e && e.length > 0 ? e.length === 1 ? b(e[0], C, { locale: v }) : `${e.length} dates selected` : "";
41
+ return /* @__PURE__ */ l(V, { open: m, onOpenChange: n, children: [
42
+ /* @__PURE__ */ t(X, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
43
+ F,
42
44
  {
43
- ref: D,
44
- value: O,
45
- placeholder: g,
45
+ ref: A,
46
+ value: I,
47
+ placeholder: L,
46
48
  readOnly: !0,
47
- disabled: c,
48
- className: R("cursor-pointer", N),
49
- suffix: /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
50
- e && e.length > 0 && !c && /* @__PURE__ */ i(f, { children: [
51
- /* @__PURE__ */ t(h, { asChild: !0, children: /* @__PURE__ */ t(
52
- v,
49
+ disabled: d,
50
+ className: E("cursor-pointer", T),
51
+ suffix: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
52
+ e && e.length > 0 && !d && /* @__PURE__ */ l(u, { children: [
53
+ /* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(
54
+ j,
53
55
  {
54
56
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
55
- onClick: (r) => {
56
- r.stopPropagation(), m();
57
+ onClick: (o) => {
58
+ o.stopPropagation(), h();
57
59
  }
58
60
  }
59
61
  ) }),
60
- /* @__PURE__ */ t(u, { variant: "tertiary", side: "top", children: "Clear" })
62
+ /* @__PURE__ */ t(y, { variant: "tertiary", side: "top", children: c("calendar.clear") })
61
63
  ] }),
62
- /* @__PURE__ */ i(f, { children: [
63
- /* @__PURE__ */ t(h, { asChild: !0, children: /* @__PURE__ */ t(w, { className: "h-4 w-4 text-secondary-foreground" }) }),
64
- /* @__PURE__ */ t(u, { variant: "tertiary", side: "top", children: "Pick dates" })
64
+ /* @__PURE__ */ l(u, { children: [
65
+ /* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(R, { className: "h-4 w-4 text-secondary-foreground" }) }),
66
+ /* @__PURE__ */ t(y, { variant: "tertiary", side: "top", children: c("datePicker.selectMultipleDates") })
65
67
  ] })
66
68
  ] }),
67
- ...A
69
+ ...k
68
70
  }
69
71
  ) }) }),
70
72
  /* @__PURE__ */ t(
71
- L,
73
+ $,
72
74
  {
73
75
  className: "w-auto p-0",
74
76
  align: "start",
75
- onOpenAutoFocus: (r) => r.preventDefault(),
77
+ onOpenAutoFocus: (o) => o.preventDefault(),
76
78
  children: /* @__PURE__ */ t(
77
- V,
79
+ q,
78
80
  {
79
81
  mode: "multiple",
80
- selected: p,
81
- onSelect: M,
82
- disabled: { before: C, after: P },
83
- startMonth: x,
84
- endMonth: T,
82
+ selected: f,
83
+ onSelect: O,
84
+ disabled: { before: M, after: x },
85
+ startMonth: D,
86
+ endMonth: N,
85
87
  showFooter: s,
86
88
  onApply: S,
87
- onCancel: k,
88
- onClear: m,
89
+ onCancel: w,
90
+ onClear: h,
89
91
  captionLayout: "dropdown"
90
92
  }
91
93
  )
@@ -94,7 +96,7 @@ const X = a.forwardRef(
94
96
  ] });
95
97
  }
96
98
  );
97
- X.displayName = "MultiDatePicker";
99
+ G.displayName = "MultiDatePicker";
98
100
  export {
99
- X as MultiDatePicker
101
+ G as MultiDatePicker
100
102
  };
@@ -1,90 +1,91 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { X as w } from "lucide-react";
4
- import { CalendarMonth as $ } from "../../../icons/index.js";
5
- import { cn as j } from "../../../lib/utils.js";
6
- import { Input as v } from "../input.js";
7
- import { Popover as R, PopoverTrigger as b, PopoverContent as D } from "../popover.js";
8
- import { Calendar as E } from "../calendar.js";
9
- import { Tooltip as m, TooltipTrigger as f, TooltipContent as g } from "../tooltip.js";
10
- const I = s.forwardRef(
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { X as I } from "lucide-react";
4
+ import { CalendarMonth as j } from "../../../icons/index.js";
5
+ import { cn as R } from "../../../lib/utils.js";
6
+ import { Input as $ } from "../input.js";
7
+ import { Popover as b, PopoverTrigger as D, PopoverContent as E } from "../popover.js";
8
+ import { Calendar as L } from "../calendar.js";
9
+ import { Tooltip as f, TooltipTrigger as u, TooltipContent as g } from "../tooltip.js";
10
+ import { useImpactNovaI18n as V } from "../../../i18n/ImpactNovaI18nContext.js";
11
+ const X = c.forwardRef(
11
12
  ({
12
13
  value: e,
13
- onChange: l,
14
- placeholder: u = "Select Months",
15
- minDate: y,
14
+ onChange: s,
15
+ placeholder: y,
16
+ minDate: M,
16
17
  maxDate: C,
17
- startMonth: M,
18
- endMonth: P,
18
+ startMonth: P,
19
+ endMonth: T,
19
20
  showFooter: a = !0,
20
- disabled: c,
21
- className: T,
21
+ disabled: p,
22
+ className: k,
22
23
  ...x
23
24
  }, N) => {
24
- const [p, r] = s.useState(!1), [d, n] = s.useState(e);
25
- s.useEffect(() => {
26
- n(e);
27
- }, [p, e]);
28
- const k = (o) => {
29
- n(o), a || l?.(o);
30
- }, A = (o) => {
31
- l?.(o !== void 0 ? o : d), r(!1);
32
- }, S = () => {
33
- n(e), r(!1);
34
- }, h = () => {
35
- n(void 0), l?.(void 0), a || r(!1);
36
- }, O = e && e.length > 0 ? e.length === 1 ? `${e[0].month + 1}/${e[0].year}` : `${e.length} months selected` : "";
37
- return /* @__PURE__ */ i(R, { open: p, onOpenChange: r, children: [
38
- /* @__PURE__ */ t(b, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
39
- v,
25
+ const { t: r } = V(), A = y ?? r("datePicker.selectMultipleMonths"), [d, n] = c.useState(!1), [h, i] = c.useState(e);
26
+ c.useEffect(() => {
27
+ i(e);
28
+ }, [d, e]);
29
+ const S = (o) => {
30
+ i(o), a || s?.(o);
31
+ }, O = (o) => {
32
+ s?.(o !== void 0 ? o : h), n(!1);
33
+ }, v = () => {
34
+ i(e), n(!1);
35
+ }, m = () => {
36
+ i(void 0), s?.(void 0), a || n(!1);
37
+ }, w = e && e.length > 0 ? e.length === 1 ? `${e[0].month + 1}/${e[0].year}` : r("datePicker.monthsSelected", { count: e.length }) : "";
38
+ return /* @__PURE__ */ l(b, { open: d, onOpenChange: n, children: [
39
+ /* @__PURE__ */ t(D, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
40
+ $,
40
41
  {
41
42
  ref: N,
42
- value: O,
43
- placeholder: u,
43
+ value: w,
44
+ placeholder: A,
44
45
  readOnly: !0,
45
- disabled: c,
46
- className: j("cursor-pointer", T),
47
- suffix: /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
48
- e && e.length > 0 && !c && /* @__PURE__ */ i(m, { children: [
49
- /* @__PURE__ */ t(f, { asChild: !0, children: /* @__PURE__ */ t(
50
- w,
46
+ disabled: p,
47
+ className: R("cursor-pointer", k),
48
+ suffix: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
49
+ e && e.length > 0 && !p && /* @__PURE__ */ l(f, { children: [
50
+ /* @__PURE__ */ t(u, { asChild: !0, children: /* @__PURE__ */ t(
51
+ I,
51
52
  {
52
53
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
53
54
  onClick: (o) => {
54
- o.stopPropagation(), h();
55
+ o.stopPropagation(), m();
55
56
  }
56
57
  }
57
58
  ) }),
58
- /* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: "Clear" })
59
+ /* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: r("calendar.clear") })
59
60
  ] }),
60
- /* @__PURE__ */ i(m, { children: [
61
- /* @__PURE__ */ t(f, { asChild: !0, children: /* @__PURE__ */ t($, { className: "h-4 w-4 text-secondary-foreground" }) }),
62
- /* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: "Pick months" })
61
+ /* @__PURE__ */ l(f, { children: [
62
+ /* @__PURE__ */ t(u, { asChild: !0, children: /* @__PURE__ */ t(j, { className: "h-4 w-4 text-secondary-foreground" }) }),
63
+ /* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: r("datePicker.selectMultipleMonths") })
63
64
  ] })
64
65
  ] }),
65
66
  ...x
66
67
  }
67
68
  ) }) }),
68
69
  /* @__PURE__ */ t(
69
- D,
70
+ E,
70
71
  {
71
72
  className: "w-auto p-0",
72
73
  align: "start",
73
74
  onOpenAutoFocus: (o) => o.preventDefault(),
74
75
  children: /* @__PURE__ */ t(
75
- E,
76
+ L,
76
77
  {
77
78
  pickerType: "month",
78
79
  monthMode: "multiple",
79
- selectedMonths: d,
80
- onMonthSelect: k,
81
- disabled: { before: y, after: C },
82
- startMonth: M,
83
- endMonth: P,
80
+ selectedMonths: h,
81
+ onMonthSelect: S,
82
+ disabled: { before: M, after: C },
83
+ startMonth: P,
84
+ endMonth: T,
84
85
  showFooter: a,
85
- onApply: A,
86
- onCancel: S,
87
- onClear: h,
86
+ onApply: O,
87
+ onCancel: v,
88
+ onClear: m,
88
89
  captionLayout: "dropdown"
89
90
  }
90
91
  )
@@ -93,7 +94,7 @@ const I = s.forwardRef(
93
94
  ] });
94
95
  }
95
96
  );
96
- I.displayName = "MultiMonthPicker";
97
+ X.displayName = "MultiMonthPicker";
97
98
  export {
98
- I as MultiMonthPicker
99
+ X as MultiMonthPicker
99
100
  };
@@ -1,107 +1,109 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import * as a from "react";
3
- import { X as E } from "lucide-react";
4
- import { CalendarMonth as I } from "../../../icons/index.js";
5
- import { format as y } from "date-fns";
6
- import { cn as L } from "../../../lib/utils.js";
7
- import { Input as V } from "../input.js";
8
- import { Popover as X, PopoverTrigger as q, PopoverContent as z } from "../popover.js";
9
- import { Calendar as B } from "../calendar.js";
10
- import { Tooltip as k, TooltipTrigger as u, TooltipContent as g } from "../tooltip.js";
11
- const G = (e, o = "MM/dd/yyyy") => {
12
- const l = y(e.startDate, o), c = y(e.endDate, o);
13
- return `${l} - ${c}`;
14
- }, H = a.forwardRef(
1
+ import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { X } from "lucide-react";
4
+ import { CalendarMonth as q } from "../../../icons/index.js";
5
+ import { format as g } from "date-fns";
6
+ import { cn as z } from "../../../lib/utils.js";
7
+ import { Input as B } from "../input.js";
8
+ import { Popover as F, PopoverTrigger as G, PopoverContent as H } from "../popover.js";
9
+ import { Calendar as J } from "../calendar.js";
10
+ import { Tooltip as C, TooltipTrigger as M, TooltipContent as P } from "../tooltip.js";
11
+ import { getDateFnsLocale as K } from "../../../i18n/getDateFnsLocale.js";
12
+ import { useImpactNovaI18n as Q } from "../../../i18n/ImpactNovaI18nContext.js";
13
+ const U = (e, o = "MM/dd/yyyy", n) => {
14
+ const l = g(e.startDate, o, n ? { locale: n } : {}), d = g(e.endDate, o, n ? { locale: n } : {});
15
+ return `${l} - ${d}`;
16
+ }, Y = s.forwardRef(
15
17
  ({
16
18
  value: e,
17
19
  onChange: o,
18
- format: l = "MM/dd/yyyy",
19
- placeholder: c = "Select Weeks",
20
- minDate: C,
21
- maxDate: w,
22
- startMonth: M,
23
- endMonth: P,
24
- showFooter: d = !0,
25
- calendarType: T = "calendar",
26
- fiscalMode: x = "basic",
20
+ format: n = "MM/dd/yyyy",
21
+ placeholder: l,
22
+ minDate: d,
23
+ maxDate: T,
24
+ startMonth: W,
25
+ endMonth: w,
26
+ showFooter: p = !0,
27
+ calendarType: x = "calendar",
28
+ fiscalMode: N = "basic",
27
29
  selectionMode: S = "week",
28
- fiscalMonthPattern: W,
29
- fiscalYearStartMonth: N = 1,
30
- weekStartsOn: A = 1,
31
- disabled: p,
32
- className: O,
33
- ...v
34
- }, D) => {
35
- const [f, n] = a.useState(!1), [m, i] = a.useState(e);
36
- a.useEffect(() => {
30
+ fiscalMonthPattern: A,
31
+ fiscalYearStartMonth: v = 1,
32
+ weekStartsOn: D = 1,
33
+ disabled: f,
34
+ className: L,
35
+ ...O
36
+ }, I) => {
37
+ const { locale: h, t: m } = Q(), $ = s.useMemo(() => K(h), [h]), b = l ?? m("datePicker.selectWeeks"), [y, a] = s.useState(!1), [k, i] = s.useState(e);
38
+ s.useEffect(() => {
37
39
  i(e);
38
- }, [f, e]);
39
- const $ = (r) => {
40
- i(r), d || o?.(r);
41
- }, b = (r) => {
42
- o?.(r !== void 0 ? r : m), n(!1);
43
- }, j = () => {
44
- i(e), n(!1);
45
- }, h = () => {
46
- i(void 0), o?.(void 0), d || n(!1);
47
- }, R = e && e.length > 0 ? e.length === 1 ? G(e[0], l) : `${e.length} weeks selected` : "";
48
- return /* @__PURE__ */ s(X, { open: f, onOpenChange: n, children: [
49
- /* @__PURE__ */ t(q, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
50
- V,
40
+ }, [y, e]);
41
+ const j = (r) => {
42
+ i(r), p || o?.(r);
43
+ }, R = (r) => {
44
+ o?.(r !== void 0 ? r : k), a(!1);
45
+ }, E = () => {
46
+ i(e), a(!1);
47
+ }, u = () => {
48
+ i(void 0), o?.(void 0), p || a(!1);
49
+ }, V = e && e.length > 0 ? e.length === 1 ? U(e[0], n, $) : `${e.length} weeks selected` : "";
50
+ return /* @__PURE__ */ c(F, { open: y, onOpenChange: a, children: [
51
+ /* @__PURE__ */ t(G, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
52
+ B,
51
53
  {
52
- ref: D,
53
- value: R,
54
- placeholder: c,
54
+ ref: I,
55
+ value: V,
56
+ placeholder: b,
55
57
  readOnly: !0,
56
- disabled: p,
57
- className: L("cursor-pointer", O),
58
- suffix: /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
59
- e && e.length > 0 && !p && /* @__PURE__ */ s(k, { children: [
60
- /* @__PURE__ */ t(u, { asChild: !0, children: /* @__PURE__ */ t(
61
- E,
58
+ disabled: f,
59
+ className: z("cursor-pointer", L),
60
+ suffix: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
61
+ e && e.length > 0 && !f && /* @__PURE__ */ c(C, { children: [
62
+ /* @__PURE__ */ t(M, { asChild: !0, children: /* @__PURE__ */ t(
63
+ X,
62
64
  {
63
65
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
64
66
  onClick: (r) => {
65
- r.stopPropagation(), h();
67
+ r.stopPropagation(), u();
66
68
  }
67
69
  }
68
70
  ) }),
69
- /* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: "Clear" })
71
+ /* @__PURE__ */ t(P, { variant: "tertiary", side: "top", children: m("calendar.clear") })
70
72
  ] }),
71
- /* @__PURE__ */ s(k, { children: [
72
- /* @__PURE__ */ t(u, { asChild: !0, children: /* @__PURE__ */ t(I, { className: "h-4 w-4 text-secondary-foreground" }) }),
73
- /* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: "Pick weeks" })
73
+ /* @__PURE__ */ c(C, { children: [
74
+ /* @__PURE__ */ t(M, { asChild: !0, children: /* @__PURE__ */ t(q, { className: "h-4 w-4 text-secondary-foreground" }) }),
75
+ /* @__PURE__ */ t(P, { variant: "tertiary", side: "top", children: m("datePicker.selectWeeks") })
74
76
  ] })
75
77
  ] }),
76
- ...v
78
+ ...O
77
79
  }
78
80
  ) }) }),
79
81
  /* @__PURE__ */ t(
80
- z,
82
+ H,
81
83
  {
82
84
  className: "w-auto p-0",
83
85
  align: "start",
84
86
  onOpenAutoFocus: (r) => r.preventDefault(),
85
87
  children: /* @__PURE__ */ t(
86
- B,
88
+ J,
87
89
  {
88
90
  pickerType: "week",
89
91
  weekMode: "multiple",
90
- selectedWeeks: m,
91
- onWeekSelect: $,
92
- disabled: { before: C, after: w },
93
- startMonth: M,
94
- endMonth: P,
95
- showFooter: d,
96
- calendarType: T,
97
- fiscalMode: x,
92
+ selectedWeeks: k,
93
+ onWeekSelect: j,
94
+ disabled: { before: d, after: T },
95
+ startMonth: W,
96
+ endMonth: w,
97
+ showFooter: p,
98
+ calendarType: x,
99
+ fiscalMode: N,
98
100
  selectionMode: S,
99
- fiscalMonthPattern: W,
100
- fiscalYearStartMonth: N,
101
- weekStartsOn: A,
102
- onApply: b,
103
- onCancel: j,
104
- onClear: h,
101
+ fiscalMonthPattern: A,
102
+ fiscalYearStartMonth: v,
103
+ weekStartsOn: D,
104
+ onApply: R,
105
+ onCancel: E,
106
+ onClear: u,
105
107
  captionLayout: "dropdown"
106
108
  }
107
109
  )
@@ -110,7 +112,7 @@ const G = (e, o = "MM/dd/yyyy") => {
110
112
  ] });
111
113
  }
112
114
  );
113
- H.displayName = "MultiWeekPicker";
115
+ Y.displayName = "MultiWeekPicker";
114
116
  export {
115
- H as MultiWeekPicker
117
+ Y as MultiWeekPicker
116
118
  };