impact-nova 2.0.3 → 2.0.5

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.
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ interface LayoutProps extends React.ComponentProps<"div"> {
3
+ /**
4
+ * Sidebar column — render `<Sidebar collapsible="offcanvas">` here.
5
+ * Do **not** wrap with SidebarProvider; place SidebarProvider at the app
6
+ * root around this entire layout (see impact-nova://layout).
7
+ */
8
+ sidebar: React.ReactNode;
9
+ /**
10
+ * App header — compose with Header, HeaderLeft, HeaderRight, etc.
11
+ */
12
+ header: React.ReactNode;
13
+ /**
14
+ * Main content area. Pages compose breadcrumb, filter strip, and body
15
+ * directly here using BreadcrumbHeader, FilterStrip, etc.
16
+ */
17
+ children: React.ReactNode;
18
+ }
19
+ /**
20
+ * App shell: Sidebar | (Header + scrollable main).
21
+ *
22
+ * Place SidebarProvider at the app root around this layout. Pages handle
23
+ * their own breadcrumb and filter strip inside `children`.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * <SidebarProvider
28
+ * defaultOpen={false}
29
+ * id="app-sidebar"
30
+ * className="flex h-svh min-h-0 w-full min-w-0 overflow-hidden"
31
+ * >
32
+ * <Layout sidebar={<AppSidebar />} header={<AppHeader />}>
33
+ * <Suspense fallback={<Loader />}>
34
+ * <Outlet />
35
+ * </Suspense>
36
+ * </Layout>
37
+ * <CommandPalette />
38
+ * </SidebarProvider>
39
+ * ```
40
+ */
41
+ export declare function Layout({ sidebar, header, children, className, ...props }: LayoutProps): import("react/jsx-runtime").JSX.Element;
42
+ export {};
@@ -0,0 +1,41 @@
1
+ import { jsxs as o, jsx as i } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as f } from "../../lib/utils.js";
4
+ function c({
5
+ sidebar: e,
6
+ header: l,
7
+ children: t,
8
+ className: a,
9
+ ...n
10
+ }) {
11
+ return /* @__PURE__ */ o(
12
+ "div",
13
+ {
14
+ className: f(
15
+ "flex h-full min-h-0 w-full min-w-0 flex-1 overflow-hidden",
16
+ a
17
+ ),
18
+ "data-testid": "app-root",
19
+ "data-component": "layout",
20
+ ...n,
21
+ children: [
22
+ e,
23
+ /* @__PURE__ */ o("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children: [
24
+ l,
25
+ /* @__PURE__ */ i(
26
+ "main",
27
+ {
28
+ id: "layout-content",
29
+ "data-testid": "layout-content",
30
+ className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto bg-canvas-wash",
31
+ children: t
32
+ }
33
+ )
34
+ ] })
35
+ ]
36
+ }
37
+ );
38
+ }
39
+ export {
40
+ c as Layout
41
+ };
@@ -0,0 +1,42 @@
1
+ import { ReactNode } from 'react';
2
+ export type RouteItem = {
3
+ value: string;
4
+ label: string;
5
+ icon?: ReactNode;
6
+ url?: string;
7
+ disabled?: boolean;
8
+ children?: {
9
+ value: string;
10
+ label: string;
11
+ url: string;
12
+ }[];
13
+ };
14
+ export declare function getMockRoutes(tStory: (key: string) => string): RouteItem[];
15
+ /** Production pattern: SidebarProvider wraps the full layout at the app root. */
16
+ export declare function LayoutStoryShell({ defaultSidebarOpen, children, }: {
17
+ defaultSidebarOpen?: boolean;
18
+ children: ReactNode;
19
+ }): import("react/jsx-runtime").JSX.Element;
20
+ export declare function MockAppSidebar(): import("react/jsx-runtime").JSX.Element;
21
+ export declare function MockHeaderSimple({ title }: {
22
+ title?: string;
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ export declare function MockHeaderFull({ title, userInitials, showIndicator, }: {
25
+ title?: string;
26
+ userInitials?: string;
27
+ showIndicator?: boolean;
28
+ }): import("react/jsx-runtime").JSX.Element;
29
+ export declare function MockBreadcrumbDeep(): import("react/jsx-runtime").JSX.Element;
30
+ export declare function MockBreadcrumbShallow({ label }: {
31
+ label?: string;
32
+ }): import("react/jsx-runtime").JSX.Element;
33
+ export declare function MockFilterStrip(): import("react/jsx-runtime").JSX.Element;
34
+ export declare function MockHeaderWithBot({ title }: {
35
+ title: string;
36
+ }): import("react/jsx-runtime").JSX.Element;
37
+ export declare function WidgetGrid({ count }: {
38
+ count?: number;
39
+ }): import("react/jsx-runtime").JSX.Element;
40
+ export declare function ScrollContent({ rows }: {
41
+ rows?: number;
42
+ }): import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,6 @@ import { getDefaultClassNames as Ke, DayPicker as We } from "react-day-picker";
4
4
  import { ChevronRight as oe } from "impact-nova-icons";
5
5
  import { cn as m } from "../../lib/utils.js";
6
6
  import { Button as O } from "./button.js";
7
- import "./button-variants.js";
8
7
  import me from "./select/select.js";
9
8
  import { FISCAL_PATTERNS as Ge, resolveWeekSelection as qe } from "../../lib/fiscal-calendar.js";
10
9
  import { getIntlLocale as Je, getDateFnsLocale as Qe } from "../../i18n/getDateFnsLocale.js";
@@ -33,7 +32,7 @@ function Ve({ children: A }) {
33
32
  }
34
33
  );
35
34
  }
36
- function ft({
35
+ function ut({
37
36
  className: A,
38
37
  classNames: B,
39
38
  showOutsideDays: p = !1,
@@ -893,6 +892,6 @@ function et({
893
892
  );
894
893
  }
895
894
  export {
896
- ft as Calendar,
895
+ ut as Calendar,
897
896
  et as CalendarDayButton
898
897
  };
@@ -1,2 +1,3 @@
1
- export * from './horizontal-scroller';
1
+ export { default } from './horizontal-scroller';
2
+ export { default as HorizontalScroller } from './horizontal-scroller';
2
3
  export * from '../types/horizontal-scroller.types';
@@ -1 +1,5 @@
1
-
1
+ import { default as r, default as a } from "./horizontal-scroller.js";
2
+ export {
3
+ r as HorizontalScroller,
4
+ a as default
5
+ };
@@ -8,7 +8,7 @@ import { LoadingSpinner as Nt, Cross as kt, ChevronRight as Re, Search as Pt, In
8
8
  import { Checkbox as He } from "../checkbox.js";
9
9
  import { Button as Dt } from "../button.js";
10
10
  import { cn as y } from "../../../lib/utils.js";
11
- import { isInvertedSelection as z, isOptionArray as V, isSelected as Ot, getSequence as Ct, getLeafOptions as At } from "./utils/select.js";
11
+ import { isInvertedSelection as z, isOptionArray as N, isSelected as Ot, getSequence as Ct, getLeafOptions as At } from "./utils/select.js";
12
12
  import { useFlattenOptions as It } from "./hooks/useFlattenOptions.js";
13
13
  import { useSelectionModel as Tt } from "./hooks/useSelectionModel.js";
14
14
  import { useVisibleStats as Et } from "./hooks/useVisibleStats.js";
@@ -20,7 +20,7 @@ const zt = (Ne) => {
20
20
  defaultValue: _e,
21
21
  onChange: u,
22
22
  isMulti: p,
23
- isDisabled: N,
23
+ isDisabled: S,
24
24
  isLoading: T,
25
25
  isClearable: qe = !0,
26
26
  isSearchable: $ = !0,
@@ -94,11 +94,11 @@ const zt = (Ne) => {
94
94
  filterOption: rt,
95
95
  enableSubMenus: w,
96
96
  enableGroups: D
97
- }), S = Tt(f, p ?? !1), { stats: B, getGroupStats: ve } = Et(
97
+ }), V = Tt(f, p ?? !1), { stats: B, getGroupStats: ve } = Et(
98
98
  m,
99
99
  $e,
100
100
  q,
101
- S,
101
+ V,
102
102
  f,
103
103
  p ?? !1
104
104
  ), k = wt({
@@ -149,7 +149,7 @@ const zt = (Ne) => {
149
149
  return () => cancelAnimationFrame(e);
150
150
  }, [d, k]), C(() => {
151
151
  if (d && ke && !I && m.length > 0) {
152
- const e = m.findIndex((t) => p ? S.mode === "exclude" ? !S.set.has(t.value) : S.set.has(t.value) : f?.value === t.value);
152
+ const e = m.findIndex((t) => p ? V.mode === "exclude" ? !V.set.has(t.value) : V.set.has(t.value) : f?.value === t.value);
153
153
  if (e !== -1) {
154
154
  const t = setTimeout(() => {
155
155
  k.scrollToIndex(e, { align: "center" });
@@ -157,7 +157,7 @@ const zt = (Ne) => {
157
157
  return () => clearTimeout(t);
158
158
  }
159
159
  }
160
- }, [d, ke, I, m.length, p, S.mode, S.set, f, k]);
160
+ }, [d, ke, I, m.length, p, V.mode, V.set, f, k]);
161
161
  const K = M(null), Fe = k.getVirtualItems(), ye = Fe[Fe.length - 1], te = yt.useCallback(() => {
162
162
  T || I || K.current || F && (F(), K.current = setTimeout(() => {
163
163
  K.current = null;
@@ -190,11 +190,11 @@ const zt = (Ne) => {
190
190
  te
191
191
  ]);
192
192
  const E = (e) => {
193
- if (!N)
193
+ if (!(S && e))
194
194
  if (Me(e), e)
195
195
  et?.();
196
196
  else {
197
- const t = f, n = p && V(f) ? f.map((s) => s.value) : void 0;
197
+ const t = f, n = p && N(f) ? f.map((s) => s.value) : void 0;
198
198
  Ae?.(t, n), Z(""), he(null);
199
199
  }
200
200
  };
@@ -209,7 +209,7 @@ const zt = (Ne) => {
209
209
  };
210
210
  }, [d]);
211
211
  const ne = (e) => {
212
- if (!(N || h || e.isDisabled || ("children" in e || "options" in e) && e.isParentSelectable === !1))
212
+ if (!(S || h || e.isDisabled || ("children" in e || "options" in e) && e.isParentSelectable === !1))
213
213
  if (p) {
214
214
  const n = f || [];
215
215
  if ("children" in e || "options" in e) {
@@ -236,7 +236,7 @@ const zt = (Ne) => {
236
236
  action: "select-option",
237
237
  option: e
238
238
  });
239
- } else if (V(n)) {
239
+ } else if (N(n)) {
240
240
  const i = n, r = l.every(
241
241
  (o) => i.some((x) => x.value === o.value)
242
242
  );
@@ -264,8 +264,8 @@ const zt = (Ne) => {
264
264
  action: l ? "select-option" : "deselect-option",
265
265
  option: e
266
266
  });
267
- } else if (V(n)) {
268
- const s = n, l = p ? S.mode === "exclude" ? !S.set.has(e.value) : S.set.has(e.value) : f?.value === e.value;
267
+ } else if (N(n)) {
268
+ const s = n, l = p ? V.mode === "exclude" ? !V.set.has(e.value) : V.set.has(e.value) : f?.value === e.value;
269
269
  let i = [];
270
270
  if (l)
271
271
  i = s.filter((r) => r.value !== e.value);
@@ -285,7 +285,7 @@ const zt = (Ne) => {
285
285
  option: e
286
286
  }), Ke && (Me(!1), Ae?.(e, void 0), Z(""));
287
287
  }, we = async () => {
288
- if (!(!p || N || h)) {
288
+ if (!(!p || S || h)) {
289
289
  if (L.length > 3e3) {
290
290
  try {
291
291
  const e = await ft(
@@ -325,7 +325,7 @@ const zt = (Ne) => {
325
325
  excludedValues: r
326
326
  };
327
327
  v(c), u && u(c, { action: "select-option" });
328
- } else if (V(t)) {
328
+ } else if (N(t)) {
329
329
  const n = t, { totalVisible: s, selectedVisible: l } = B, i = s > 0 && s === l;
330
330
  let r = [...n];
331
331
  if (i) {
@@ -343,13 +343,13 @@ const zt = (Ne) => {
343
343
  v(r), u && u(r, { action: "select-option" });
344
344
  }
345
345
  } else if (b) {
346
- const e = f, { totalVisible: t } = B, n = V(e) ? e.length : 0, s = Math.min(t, b);
347
- if (V(e) && n >= s && n > 0) {
346
+ const e = f, { totalVisible: t } = B, n = N(e) ? e.length : 0, s = Math.min(t, b);
347
+ if (N(e) && n >= s && n > 0) {
348
348
  const l = e.filter((i) => i.isDisabled);
349
349
  v(l), u && u(l, {
350
350
  action: "select-option"
351
351
  });
352
- } else if (V(e)) {
352
+ } else if (N(e)) {
353
353
  const l = e.filter(
354
354
  (r) => r.isDisabled
355
355
  );
@@ -365,7 +365,7 @@ const zt = (Ne) => {
365
365
  const e = f, t = z(e) && e.excludedValues.length === 0;
366
366
  if (Ne.enableInvertedSelection)
367
367
  if (t) {
368
- const n = V(e) ? e.filter((s) => s.isDisabled) : [];
368
+ const n = N(e) ? e.filter((s) => s.isDisabled) : [];
369
369
  v(n), u && u(n, {
370
370
  action: "select-option"
371
371
  });
@@ -373,7 +373,7 @@ const zt = (Ne) => {
373
373
  const s = {
374
374
  isAllSelected: !0,
375
375
  excludedValues: m.filter(
376
- (l) => l.isDisabled && (V(e) ? !e.some((i) => i.value === l.value) : !0)
376
+ (l) => l.isDisabled && (N(e) ? !e.some((i) => i.value === l.value) : !0)
377
377
  ).map((l) => l.value)
378
378
  };
379
379
  v(s), u && u(s, { action: "select-option" });
@@ -381,12 +381,12 @@ const zt = (Ne) => {
381
381
  else {
382
382
  const { totalVisible: n, selectedVisible: s } = B;
383
383
  if (n > 0 && n === s) {
384
- const l = V(e) ? e.filter((i) => i.isDisabled) : [];
384
+ const l = N(e) ? e.filter((i) => i.isDisabled) : [];
385
385
  v(l), u && u(l, {
386
386
  action: "select-option"
387
387
  });
388
388
  } else {
389
- const l = V(e) ? e.filter((i) => i.isDisabled) : [];
389
+ const l = N(e) ? e.filter((i) => i.isDisabled) : [];
390
390
  for (const i of m)
391
391
  !i.isGroup && !i.isSubmenuParent && !i.isDisabled && l.push(i);
392
392
  v(l), u && u(l, {
@@ -412,7 +412,7 @@ const zt = (Ne) => {
412
412
  continue;
413
413
  }
414
414
  const r = i;
415
- r.isDisabled && (S.mode === "exclude" ? !S.set.has(r.value) : S.set.has(r.value)) && t.push(r);
415
+ r.isDisabled && (V.mode === "exclude" ? !V.set.has(r.value) : V.set.has(r.value)) && t.push(r);
416
416
  }
417
417
  };
418
418
  n(L);
@@ -462,7 +462,7 @@ const zt = (Ne) => {
462
462
  !n.isGroup && !(w && n.isSubmenuParent) && !n.isDisabled && e.push(s);
463
463
  }), e;
464
464
  }, ht = (e) => {
465
- if (N || h) return;
465
+ if (S || h) return;
466
466
  if (e.key === "Tab") {
467
467
  d && E(!1);
468
468
  return;
@@ -525,10 +525,10 @@ const zt = (Ne) => {
525
525
  if (p) {
526
526
  const e = f || [];
527
527
  let t = 0;
528
- return z(e) ? t = Math.max(0, (typeof De == "number" ? De : $e) - e.excludedValues.length) : V(e) && (t = e.length), t === 0 ? null : t === 1 && V(e) ? /* @__PURE__ */ a("span", { className: y("text-[14px] font-medium truncate min-w-0 block", N ? "text-disabled-foreground" : "text-[#1f2b4d]"), children: le(e[0]) }) : /* @__PURE__ */ a("span", { className: y("text-[14px] font-medium truncate min-w-0 block", N ? "text-disabled-foreground" : "text-[#1f2b4d]"), children: Y("select.selectedCount", { count: t }) });
528
+ return z(e) ? t = Math.max(0, (typeof De == "number" ? De : $e) - e.excludedValues.length) : N(e) && (t = e.length), t === 0 ? null : t === 1 && N(e) ? /* @__PURE__ */ a("span", { className: y("text-[14px] font-medium truncate min-w-0 block", S ? "text-disabled-foreground" : "text-[#1f2b4d]"), children: le(e[0]) }) : /* @__PURE__ */ a("span", { className: y("text-[14px] font-medium truncate min-w-0 block", S ? "text-disabled-foreground" : "text-[#1f2b4d]"), children: Y("select.selectedCount", { count: t }) });
529
529
  } else {
530
530
  const e = f;
531
- return e ? /* @__PURE__ */ a("span", { className: y("text-[14px] font-medium truncate min-w-0 block", N ? "text-disabled-foreground" : "text-[#1f2b4d]"), children: le(e) }) : null;
531
+ return e ? /* @__PURE__ */ a("span", { className: y("text-[14px] font-medium truncate min-w-0 block", S ? "text-disabled-foreground" : "text-[#1f2b4d]"), children: le(e) }) : null;
532
532
  }
533
533
  };
534
534
  return /* @__PURE__ */ g(
@@ -564,7 +564,7 @@ const zt = (Ne) => {
564
564
  X && ue === "absolute" && "relative"
565
565
  ),
566
566
  children: [
567
- /* @__PURE__ */ g(re.Root, { open: d, onOpenChange: E, children: [
567
+ /* @__PURE__ */ g(re.Root, { open: d && !S, onOpenChange: E, children: [
568
568
  /* @__PURE__ */ a(re.Trigger, { asChild: !0, children: /* @__PURE__ */ a(
569
569
  "div",
570
570
  {
@@ -572,23 +572,23 @@ const zt = (Ne) => {
572
572
  className: y(
573
573
  "relative h-[32px] w-full cursor-pointer rounded-[8px] border border-solid px-3 py-1 text-left shadow-sm sm:text-sm transition-all flex items-center overflow-hidden",
574
574
  ce ? "border-[#e15554] focus-visible:ring-[#e15554]" : "border-[#c3c8d4] hover:border-gray-400 focus-visible:border-indigo-500 focus-visible:ring-1 focus-visible:ring-indigo-500",
575
- N ? "bg-[#f2f4fb] cursor-not-allowed opacity-75" : "",
575
+ S ? "bg-[#f2f4fb] cursor-not-allowed opacity-75" : "",
576
576
  h ? "cursor-default bg-[#f2f4fb]" : "",
577
577
  d ? "ring-1 ring-indigo-500 border-indigo-500" : "",
578
- !N && !h && "bg-white",
578
+ !S && !h && "bg-white",
579
579
  Ye
580
580
  ),
581
581
  id: P,
582
- tabIndex: N ? -1 : 0,
582
+ tabIndex: S ? -1 : 0,
583
583
  onFocus: ot,
584
584
  onBlur: ct,
585
585
  role: "combobox",
586
586
  "aria-expanded": d,
587
587
  "aria-haspopup": "listbox",
588
588
  "aria-label": H ? String(H) : me,
589
- "aria-disabled": N || void 0,
589
+ "aria-disabled": S || void 0,
590
590
  "data-component": "select-trigger",
591
- "data-disabled": N || void 0,
591
+ "data-disabled": S || void 0,
592
592
  "data-state": d ? "open" : "closed",
593
593
  onKeyDown: ht,
594
594
  onClick: (e) => {
@@ -632,9 +632,9 @@ const zt = (Ne) => {
632
632
  }
633
633
  ),
634
634
  /* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-gray-400 shrink-0", children: !d && (T || I) ? /* @__PURE__ */ a(Nt, { size: "14px" }) : /* @__PURE__ */ g(vt, { children: [
635
- qe && !h && !N && (p && (z(
635
+ qe && !h && !S && (p && (z(
636
636
  f
637
- ) && f.isAllSelected || V(f) && f.length > 0) || !p && f) && /* @__PURE__ */ a(
637
+ ) && f.isAllSelected || N(f) && f.length > 0) || !p && f) && /* @__PURE__ */ a(
638
638
  "div",
639
639
  {
640
640
  role: "button",
@@ -768,7 +768,7 @@ const zt = (Ne) => {
768
768
  const n = b ? Math.min(e, b) : e;
769
769
  return t > 0 && t < n ? "indeterminate" : t >= n;
770
770
  })(),
771
- disabled: N || h,
771
+ disabled: S || h,
772
772
  onChange: () => {
773
773
  },
774
774
  "data-testid": `select-select-all-checkbox-${P || "default"}`
@@ -842,7 +842,7 @@ const zt = (Ne) => {
842
842
  position: "relative"
843
843
  },
844
844
  children: k.getVirtualItems().map((e) => {
845
- const t = m[e.index], n = p ? S.mode === "exclude" ? !S.set.has(t.value) : S.set.has(t.value) : f?.value === t.value, s = f || [], l = p && b ? z(s) ? !1 : V(s) && s.length >= b : !1, i = t.isDisabled || l && !n && !(D && t.isGroup) && !(w && t.isSubmenuParent), r = D && t.isGroup || w && t.isSubmenuParent ? ve(t.original) : void 0, c = r?.selected || 0, o = r?.total || 0, x = c > 0 && c < o, se = t.isParentSelectable !== !1, Se = P || "default", ie = String(t.value || ""), Ve = le(
845
+ const t = m[e.index], n = p ? V.mode === "exclude" ? !V.set.has(t.value) : V.set.has(t.value) : f?.value === t.value, s = f || [], l = p && b ? z(s) ? !1 : N(s) && s.length >= b : !1, i = t.isDisabled || l && !n && !(D && t.isGroup) && !(w && t.isSubmenuParent), r = D && t.isGroup || w && t.isSubmenuParent ? ve(t.original) : void 0, c = r?.selected || 0, o = r?.total || 0, x = c > 0 && c < o, se = t.isParentSelectable !== !1, Se = P || "default", ie = String(t.value || ""), Ve = le(
846
846
  t
847
847
  ), bt = typeof Ve == "string" ? Ve : ie;
848
848
  return /* @__PURE__ */ g(