impact-nova 1.5.6 → 1.5.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 (36) hide show
  1. package/dist/components/layout/dashboard-layout.d.ts +24 -39
  2. package/dist/components/ui/ag-grid-react/cell-renderers/date-display-renderer.js +39 -32
  3. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +47 -47
  4. package/dist/components/ui/ag-grid-react/cell-renderers/editors/percent-progress-cell-editor.d.ts +16 -0
  5. package/dist/components/ui/ag-grid-react/cell-renderers/editors/percent-progress-cell-editor.js +135 -0
  6. package/dist/components/ui/ag-grid-react/cell-renderers/editors/select-cell-editor.js +39 -36
  7. package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +14 -1
  8. package/dist/components/ui/ag-grid-react/cell-renderers/index.js +41 -35
  9. package/dist/components/ui/ag-grid-react/cell-renderers/percent-progress-display-renderer.d.ts +31 -0
  10. package/dist/components/ui/ag-grid-react/cell-renderers/percent-progress-display-renderer.js +63 -0
  11. package/dist/components/ui/ag-grid-react/cell-renderers/select-display-renderer.js +18 -12
  12. package/dist/components/ui/badge.d.ts +2 -1
  13. package/dist/components/ui/badge.js +17 -12
  14. package/dist/components/ui/command-palette/command-palette-context.d.ts +4 -2
  15. package/dist/components/ui/command-palette/command-palette-context.js +76 -77
  16. package/dist/components/ui/command-palette/command-palette.d.ts +20 -4
  17. package/dist/components/ui/command-palette/command-palette.js +210 -180
  18. package/dist/components/ui/command-palette/index.d.ts +3 -3
  19. package/dist/components/ui/command-palette/index.js +43 -40
  20. package/dist/components/ui/command-palette/shortcut-registry.d.ts +15 -2
  21. package/dist/components/ui/command-palette/shortcut-registry.js +61 -35
  22. package/dist/components/ui/command-palette/shortcut-settings.d.ts +14 -3
  23. package/dist/components/ui/command-palette/shortcut-settings.js +97 -90
  24. package/dist/components/ui/command-palette/utils.d.ts +15 -0
  25. package/dist/components/ui/command-palette/utils.js +105 -70
  26. package/dist/components/ui/filter-strip/filter-strip.d.ts +1 -1
  27. package/dist/components/ui/filter-strip/filter-strip.js +24 -22
  28. package/dist/components/ui/filter-strip/filter-tag-list.js +4 -4
  29. package/dist/components/ui/select/select.js +41 -41
  30. package/dist/components/ui/tabs.js +46 -45
  31. package/dist/icons/assets/command-pallet.svg.js +5 -0
  32. package/dist/icons/index.d.ts +2 -0
  33. package/dist/icons/index.js +146 -143
  34. package/dist/impact-nova.css +1 -1
  35. package/dist/index.js +100 -97
  36. package/package.json +1 -1
@@ -8,16 +8,18 @@ import { InputDisplayRenderer as a } from "./input-display-renderer.js";
8
8
  import { SelectDisplayRenderer as p } from "./select-display-renderer.js";
9
9
  import { CheckboxDisplayRenderer as m } from "./checkbox-display-renderer.js";
10
10
  import { SwitchDisplayRenderer as d } from "./switch-display-renderer.js";
11
- import { TextAreaDisplayRenderer as n } from "./textarea-display-renderer.js";
12
- import { DateDisplayRenderer as s } from "./date-display-renderer.js";
13
- import { InputCellEditor as c } from "./editors/input-cell-editor.js";
14
- import { SelectCellEditor as f } from "./editors/select-cell-editor.js";
15
- import { TextAreaCellEditor as C } from "./editors/textarea-cell-editor.js";
16
- import { DateCellEditor as D } from "./editors/date-cell-editor.js";
17
- import { SplitCellEditor as E } from "./editors/split-cell-editor.js";
18
- import { applyValueFormatter as M, evaluateValidationRules as U, getFieldValue as j, mapBadgeColor as q, mapBadgeVariant as z, resolveCellEditable as H, resolveValueFormatter as J } from "./cell-renderer-utils.js";
19
- import { addRowDataEditableCheck as Q } from "../editable-utils.js";
20
- const V = "ag-cell-no-padding", F = "ag-cell-renderer-full-control", T = "ag-cell-inner-padding", v = {
11
+ import { TextAreaDisplayRenderer as s } from "./textarea-display-renderer.js";
12
+ import { DateDisplayRenderer as n } from "./date-display-renderer.js";
13
+ import { PercentProgressDisplayRenderer as c } from "./percent-progress-display-renderer.js";
14
+ import { InputCellEditor as f } from "./editors/input-cell-editor.js";
15
+ import { PercentProgressCellEditor as D } from "./editors/percent-progress-cell-editor.js";
16
+ import { SelectCellEditor as C } from "./editors/select-cell-editor.js";
17
+ import { TextAreaCellEditor as E } from "./editors/textarea-cell-editor.js";
18
+ import { DateCellEditor as R } from "./editors/date-cell-editor.js";
19
+ import { SplitCellEditor as y } from "./editors/split-cell-editor.js";
20
+ import { applyValueFormatter as z, evaluateValidationRules as H, getFieldValue as J, mapBadgeColor as K, mapBadgeVariant as Q, resolveCellEditable as W, resolveValueFormatter as X } from "./cell-renderer-utils.js";
21
+ import { addRowDataEditableCheck as Z } from "../editable-utils.js";
22
+ const v = "ag-cell-no-padding", w = "ag-cell-renderer-full-control", M = "ag-cell-inner-padding", U = {
21
23
  // Display-only renderers
22
24
  empty: e,
23
25
  badge: r,
@@ -30,42 +32,46 @@ const V = "ag-cell-no-padding", F = "ag-cell-renderer-full-control", T = "ag-cel
30
32
  selectDisplay: p,
31
33
  checkboxDisplay: m,
32
34
  switchDisplay: d,
33
- textareaDisplay: n,
34
- dateDisplay: s,
35
+ textareaDisplay: s,
36
+ dateDisplay: n,
37
+ percentProgressDisplay: c,
35
38
  // Cell editors (real interactive components, mounted on edit)
36
- inputEditor: c,
37
- selectEditor: f,
38
- textareaEditor: C,
39
- dateEditor: D,
40
- splitEditor: E
39
+ inputEditor: f,
40
+ selectEditor: C,
41
+ textareaEditor: E,
42
+ dateEditor: R,
43
+ splitEditor: y,
44
+ percentProgressEditor: D
41
45
  };
42
46
  export {
43
- F as AG_CELL_FULL_CONTROL,
44
- T as AG_CELL_INNER_PADDING,
45
- V as AG_CELL_NO_PADDING,
46
- v as AG_GRID_CELL_COMPONENTS,
47
+ w as AG_CELL_FULL_CONTROL,
48
+ M as AG_CELL_INNER_PADDING,
49
+ v as AG_CELL_NO_PADDING,
50
+ U as AG_GRID_CELL_COMPONENTS,
47
51
  o as ActionsCellRenderer,
48
52
  r as BadgeCellRenderer,
49
53
  m as CheckboxDisplayRenderer,
50
- D as DateCellEditor,
51
- s as DateDisplayRenderer,
54
+ R as DateCellEditor,
55
+ n as DateDisplayRenderer,
52
56
  e as EmptyCellRenderer,
53
57
  a as InputDisplayRenderer,
54
58
  l as LinkCellRenderer,
55
- f as SelectCellEditor,
59
+ D as PercentProgressCellEditor,
60
+ c as PercentProgressDisplayRenderer,
61
+ C as SelectCellEditor,
56
62
  p as SelectDisplayRenderer,
57
- E as SplitCellEditor,
63
+ y as SplitCellEditor,
58
64
  i as SplitCellRenderer,
59
65
  t as StatusBadgeRenderer,
60
66
  d as SwitchDisplayRenderer,
61
- C as TextAreaCellEditor,
62
- n as TextAreaDisplayRenderer,
63
- Q as addRowDataEditableCheck,
64
- M as applyValueFormatter,
65
- U as evaluateValidationRules,
66
- j as getFieldValue,
67
- q as mapBadgeColor,
68
- z as mapBadgeVariant,
69
- H as resolveCellEditable,
70
- J as resolveValueFormatter
67
+ E as TextAreaCellEditor,
68
+ s as TextAreaDisplayRenderer,
69
+ Z as addRowDataEditableCheck,
70
+ z as applyValueFormatter,
71
+ H as evaluateValidationRules,
72
+ J as getFieldValue,
73
+ K as mapBadgeColor,
74
+ Q as mapBadgeVariant,
75
+ W as resolveCellEditable,
76
+ X as resolveValueFormatter
71
77
  };
@@ -0,0 +1,31 @@
1
+ import { ICellRendererParams } from 'ag-grid-enterprise';
2
+ import { BadgeProps } from '../../badge';
3
+ import { ProgressProps } from '../../progress';
4
+ export interface PercentProgressDisplayRendererProps extends ICellRendererParams {
5
+ disabled?: boolean;
6
+ className?: string;
7
+ /** Inclusive min for the scale (default 0) */
8
+ min?: number;
9
+ /** Inclusive max for the scale (default 100) */
10
+ max?: number;
11
+ /** Decimal places for the badge label (default 0) */
12
+ fractionDigits?: number;
13
+ /** Percentage pill — same options as `Badge` (defaults: subtle / neutral / circle) */
14
+ badgeVariant?: BadgeProps['variant'];
15
+ badgeColor?: BadgeProps['color'];
16
+ badgeShape?: BadgeProps['shape'];
17
+ /** Progress track + fill — same options as `ProgressBar` / `Progress` (default: default) */
18
+ progressVariant?: ProgressProps['variant'];
19
+ }
20
+ /**
21
+ * PercentProgressDisplayRenderer — capsule progress bar + percentage pill (display).
22
+ * Pair with `PercentProgressCellEditor` via `cellEditor` for editing.
23
+ *
24
+ * Cell value: number or string like `"25"` / `"25%"`, or `{ value, cellMetadata? }`.
25
+ *
26
+ * Styling via `cellRendererParams`: `badgeVariant`, `badgeColor`, `badgeShape`, `progressVariant`.
27
+ */
28
+ export declare const PercentProgressDisplayRenderer: {
29
+ (props: PercentProgressDisplayRendererProps): import("react/jsx-runtime").JSX.Element;
30
+ displayName: string;
31
+ };
@@ -0,0 +1,63 @@
1
+ import { jsx as o, jsxs as V } from "react/jsx-runtime";
2
+ import { Badge as j } from "../../badge.js";
3
+ import { cn as w } from "../../../../lib/utils.js";
4
+ import { Progress as $ } from "../../progress.js";
5
+ function E(e) {
6
+ return e && typeof e == "object" && "value" in e ? e.value : e;
7
+ }
8
+ function F(e) {
9
+ if (e == null || e === "") return null;
10
+ if (typeof e == "number") return isNaN(e) ? null : e;
11
+ const a = Number(String(e).replace(/%/g, "").trim());
12
+ return isNaN(a) ? null : a;
13
+ }
14
+ function S(e, a, n) {
15
+ return Math.min(n, Math.max(a, e));
16
+ }
17
+ const _ = (e) => {
18
+ const { value: a, disabled: n, colDef: c, className: b, data: s } = e, l = e.min ?? 0, d = e.max ?? 100, u = e.fractionDigits ?? 0, x = e.badgeVariant ?? "subtle", h = e.badgeColor ?? "neutral", p = e.badgeShape ?? "circle", N = e.progressVariant ?? "default", f = a && typeof a == "object" && "cellMetadata" in a ? a.cellMetadata?._isDisabled : void 0, m = s && typeof s == "object" && "rowMetadata" in s ? s.rowMetadata?._isDisabled : void 0;
19
+ let t = !1;
20
+ if (!n) {
21
+ const P = c?._originalEditable;
22
+ c?.editable === !1 ? t = !1 : f === !1 ? t = !0 : f === !0 ? t = !1 : m === !1 ? t = !0 : m === !0 ? t = !1 : t = P === !0 || c?.editable === !0;
23
+ }
24
+ const v = E(a), g = F(v), i = g != null, r = i ? S(g, l, d) : l, y = d - l || 1, D = i ? (r - l) / y * 100 : 0, M = i ? u > 0 ? `${r.toFixed(u)}%` : `${Math.round(r)}%` : "--";
25
+ return /* @__PURE__ */ o(
26
+ "div",
27
+ {
28
+ className: `w-full h-full flex items-center ag-cell-inner-padding ${b ?? ""} ${n ? "opacity-60 cursor-not-allowed" : t ? "in-ag-editable-cell-highlight" : ""}`,
29
+ children: /* @__PURE__ */ V("div", { className: "flex w-full min-w-0 items-center gap-2", children: [
30
+ /* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ o(
31
+ $,
32
+ {
33
+ label: !1,
34
+ variant: N,
35
+ value: D,
36
+ max: 100,
37
+ "aria-valuenow": i ? r : void 0,
38
+ "aria-valuemin": l,
39
+ "aria-valuemax": d,
40
+ className: "h-2.5"
41
+ }
42
+ ) }),
43
+ /* @__PURE__ */ o(
44
+ j,
45
+ {
46
+ variant: x,
47
+ color: h,
48
+ shape: p,
49
+ className: w(
50
+ "shrink-0 tabular-nums px-2 py-0.5 text-xs font-medium leading-none border-0",
51
+ !i && "text-[#dfe2e7]"
52
+ ),
53
+ children: M
54
+ }
55
+ )
56
+ ] })
57
+ }
58
+ );
59
+ };
60
+ _.displayName = "PercentProgressDisplayRenderer";
61
+ export {
62
+ _ as PercentProgressDisplayRenderer
63
+ };
@@ -1,25 +1,31 @@
1
- import { jsx as t, jsxs as p } from "react/jsx-runtime";
2
- import { ChevronDown as m } from "lucide-react";
3
- const u = (s) => {
4
- const { value: e, options: r = [], placeholder: a = "Select...", disabled: l, colDef: o } = s, c = !l && o?.editable === !0, i = r.find((d) => d.value === String(e ?? ""))?.label ?? (e != null && e !== "" ? String(e) : ""), n = !i;
5
- return /* @__PURE__ */ t(
1
+ import { jsx as n, jsxs as m } from "react/jsx-runtime";
2
+ import { ChevronDown as g } from "lucide-react";
3
+ const h = (u) => {
4
+ const { value: e, options: b = [], placeholder: p = "Select...", disabled: o, colDef: i, data: t } = u, r = e && typeof e == "object" && "cellMetadata" in e ? e.cellMetadata?._isDisabled : void 0, d = t && typeof t == "object" && "rowMetadata" in t ? t.rowMetadata?._isDisabled : void 0;
5
+ let l = !1;
6
+ if (!o) {
7
+ const s = i?._originalEditable;
8
+ i?.editable === !1 ? l = !1 : r === !1 ? l = !0 : r === !0 ? l = !1 : d === !1 ? l = !0 : d === !0 ? l = !1 : l = s === !0 || i?.editable === !0;
9
+ }
10
+ const a = e && typeof e == "object" && "value" in e ? e.value : e, c = b.find((s) => s.value === String(a ?? ""))?.label ?? (a != null && a !== "" ? String(a) : ""), f = !c;
11
+ return /* @__PURE__ */ n(
6
12
  "div",
7
13
  {
8
- className: `w-full h-full flex items-center ag-cell-inner-padding ${l ? "opacity-60 cursor-not-allowed" : c ? "in-ag-editable-cell-highlight" : ""}`,
9
- children: /* @__PURE__ */ p(
14
+ className: `w-full h-full flex items-center ag-cell-inner-padding ${o ? "opacity-60 cursor-not-allowed" : l ? "in-ag-editable-cell-highlight" : ""}`,
15
+ children: /* @__PURE__ */ m(
10
16
  "div",
11
17
  {
12
- className: "flex w-full items-center justify-between rounded-[8px] bg-white px-1.5 h-7 cursor-pointer",
18
+ className: `flex w-full items-center justify-between rounded-[8px] px-1.5 h-7 ${l ? "bg-white cursor-pointer" : "bg-inherit"}`,
13
19
  children: [
14
- /* @__PURE__ */ t("span", { className: `truncate text-sm font-medium text-[#1f2b4d] ${n ? "text-[#dfe2e7]" : ""}`, children: n ? a : i }),
15
- /* @__PURE__ */ t(m, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
20
+ /* @__PURE__ */ n("span", { className: `truncate text-sm font-medium text-[#1f2b4d] ${f ? "text-[#dfe2e7]" : ""}`, children: f ? p : c }),
21
+ l && /* @__PURE__ */ n(g, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
16
22
  ]
17
23
  }
18
24
  )
19
25
  }
20
26
  );
21
27
  };
22
- u.displayName = "SelectDisplayRenderer";
28
+ h.displayName = "SelectDisplayRenderer";
23
29
  export {
24
- u as SelectDisplayRenderer
30
+ h as SelectDisplayRenderer
25
31
  };
@@ -3,8 +3,9 @@ import * as React from "react";
3
3
  declare const badgeVariants: (props?: {
4
4
  variant?: "solid" | "outline" | "subtle";
5
5
  color?: "primary" | "destructive" | "warning" | "success" | "neutral";
6
+ shape?: "circle" | "square";
6
7
  } & import('class-variance-authority/types').ClassProp) => string;
7
8
  export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "color">, VariantProps<typeof badgeVariants> {
8
9
  }
9
- declare function Badge({ className, variant, color, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
10
+ declare function Badge({ className, variant, color, shape, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
10
11
  export { Badge, badgeVariants };
@@ -1,9 +1,9 @@
1
- import { jsx as s } from "react/jsx-runtime";
1
+ import { jsx as n } from "react/jsx-runtime";
2
2
  import "react";
3
- import { cva as n } from "class-variance-authority";
4
- import { cn as o } from "../../lib/utils.js";
5
- const i = n(
6
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-sm leading-[18px] font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
3
+ import { cva as o } from "class-variance-authority";
4
+ import { cn as i } from "../../lib/utils.js";
5
+ const c = o(
6
+ "inline-flex items-center border px-2.5 py-0.5 text-sm leading-[18px] font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
7
7
  {
8
8
  variants: {
9
9
  variant: {
@@ -17,6 +17,10 @@ const i = n(
17
17
  warning: "",
18
18
  destructive: "",
19
19
  neutral: ""
20
+ },
21
+ shape: {
22
+ circle: "rounded-full",
23
+ square: "rounded"
20
24
  }
21
25
  },
22
26
  compoundVariants: [
@@ -41,21 +45,22 @@ const i = n(
41
45
  ],
42
46
  defaultVariants: {
43
47
  variant: "solid",
44
- color: "primary"
48
+ color: "primary",
49
+ shape: "circle"
45
50
  }
46
51
  }
47
52
  );
48
- function d({ className: r, variant: t, color: a, ...e }) {
49
- return /* @__PURE__ */ s(
53
+ function m({ className: r, variant: t, color: a, shape: e, ...s }) {
54
+ return /* @__PURE__ */ n(
50
55
  "div",
51
56
  {
52
- className: o(i({ variant: t, color: a }), r),
57
+ className: i(c({ variant: t, color: a, shape: e }), r),
53
58
  "data-component": "badge",
54
- ...e
59
+ ...s
55
60
  }
56
61
  );
57
62
  }
58
63
  export {
59
- d as Badge,
60
- i as badgeVariants
64
+ m as Badge,
65
+ c as badgeVariants
61
66
  };
@@ -1,5 +1,5 @@
1
1
  import { ShortcutRegistry, ConflictInfo } from './shortcut-registry';
2
- import { CommandDefinition, KeyBinding, ShortcutScope } from './utils';
2
+ import { CommandDefinition, KeyBinding, ShortcutScope, ShortcutStorageAdapter } from './utils';
3
3
  /**
4
4
  * CommandPaletteProvider — React context that wraps ShortcutRegistry,
5
5
  * manages ⌘K open/close, and provides the API to all descendants.
@@ -44,8 +44,10 @@ export interface CommandPaletteProviderProps {
44
44
  children: React.ReactNode;
45
45
  /** Custom keybinding to open the palette (defaults to ⌘K / Ctrl+K) */
46
46
  openKeybinding?: KeyBinding;
47
+ /** Custom storage adapter for shortcuts and recent commands */
48
+ storage?: ShortcutStorageAdapter;
47
49
  }
48
- export declare function CommandPaletteProvider({ children, openKeybinding, }: CommandPaletteProviderProps): import("react/jsx-runtime").JSX.Element;
50
+ export declare function CommandPaletteProvider({ children, openKeybinding, storage, }: CommandPaletteProviderProps): import("react/jsx-runtime").JSX.Element;
49
51
  export declare namespace CommandPaletteProvider {
50
52
  var displayName: string;
51
53
  }
@@ -1,86 +1,86 @@
1
- import { jsx as R } from "react/jsx-runtime";
2
- import * as e from "react";
3
- import { ShortcutRegistry as A } from "./shortcut-registry.js";
4
- import { matchesKeybinding as N } from "./utils.js";
5
- const h = e.createContext(null);
1
+ import { jsx as A } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { ShortcutRegistry as N } from "./shortcut-registry.js";
4
+ import { matchesKeybinding as R } from "./utils.js";
5
+ const w = t.createContext(null);
6
6
  function T({
7
7
  children: o,
8
- openKeybinding: u = { key: "k", meta: !0 }
8
+ openKeybinding: c = { key: "k", meta: !0 },
9
+ storage: h
9
10
  }) {
10
- const n = e.useRef(null);
11
- n.current || (n.current = new A());
12
- const s = n.current, [c, i] = e.useState(!1), [l, K] = e.useState(0);
13
- e.useEffect(() => s.subscribe(() => {
14
- K((r) => r + 1);
15
- }), [s]), e.useEffect(() => {
16
- const t = (r) => {
17
- const a = r.target, I = a.closest?.("[data-command-palette]"), x = a.tagName === "INPUT" || a.tagName === "TEXTAREA" || a.tagName === "SELECT" || a.isContentEditable;
18
- if (N(r, u)) {
19
- r.preventDefault(), r.stopPropagation(), i((w) => !w);
11
+ const [e] = t.useState(() => new N(h)), [r, i] = t.useState(!1), [u, S] = t.useState(0);
12
+ t.useEffect(() => e.subscribe(() => {
13
+ S((s) => s + 1);
14
+ }), [e]), t.useEffect(() => {
15
+ const n = (s) => {
16
+ const a = s.target, I = a.closest?.("[data-command-palette]"), x = a.tagName === "INPUT" || a.tagName === "TEXTAREA" || a.tagName === "SELECT" || a.isContentEditable;
17
+ if (R(s, c)) {
18
+ s.preventDefault(), s.stopPropagation(), i((v) => !v);
20
19
  return;
21
20
  }
22
- c || x && !I && !(r.metaKey || r.ctrlKey) || s.handleKeyEvent(r);
21
+ r || x && !I && !(s.metaKey || s.ctrlKey) || e.handleKeyEvent(s);
23
22
  };
24
- return window.addEventListener("keydown", t, !0), () => window.removeEventListener("keydown", t, !0);
25
- }, [s, c, u]);
26
- const m = e.useCallback(
27
- (t) => n.current.register(t),
28
- []
29
- ), d = e.useCallback(
30
- (t) => n.current.unregister(t),
31
- []
32
- ), C = e.useCallback(
33
- (t, r) => n.current.updateKeybinding(t, r),
34
- []
35
- ), g = e.useCallback(
36
- (t) => n.current.resetKeybinding(t),
37
- []
38
- ), p = e.useCallback(
39
- () => n.current.getPaletteCommands(),
40
- []
41
- ), b = e.useCallback(
42
- () => n.current.getSettingsCommands(),
43
- []
44
- ), f = e.useCallback(
45
- (t) => n.current.getEffectiveKeybinding(t),
46
- []
47
- ), y = e.useCallback(
48
- () => n.current.getRecentCommandIds(),
49
- []
50
- ), P = e.useCallback(
51
- (t) => n.current.pushScope(t),
52
- []
53
- ), k = e.useCallback(
54
- (t) => n.current.popScope(t),
55
- []
56
- ), E = e.useCallback(
57
- (t) => n.current.setActiveInstance(t),
58
- []
59
- ), v = e.useCallback(
60
- () => n.current.getActiveInstance(),
61
- []
62
- ), S = e.useMemo(() => ({
63
- registry: s,
64
- open: c,
23
+ return window.addEventListener("keydown", n, !0), () => window.removeEventListener("keydown", n, !0);
24
+ }, [e, r, c]);
25
+ const m = t.useCallback(
26
+ (n) => e.register(n),
27
+ [e]
28
+ ), l = t.useCallback(
29
+ (n) => e.unregister(n),
30
+ [e]
31
+ ), d = t.useCallback(
32
+ (n, s) => e.updateKeybinding(n, s),
33
+ [e]
34
+ ), C = t.useCallback(
35
+ (n) => e.resetKeybinding(n),
36
+ [e]
37
+ ), g = t.useCallback(
38
+ () => e.getPaletteCommands(),
39
+ [e]
40
+ ), p = t.useCallback(
41
+ () => e.getSettingsCommands(),
42
+ [e]
43
+ ), b = t.useCallback(
44
+ (n) => e.getEffectiveKeybinding(n),
45
+ [e]
46
+ ), f = t.useCallback(
47
+ () => e.getRecentCommandIds(),
48
+ [e]
49
+ ), y = t.useCallback(
50
+ (n) => e.pushScope(n),
51
+ [e]
52
+ ), P = t.useCallback(
53
+ (n) => e.popScope(n),
54
+ [e]
55
+ ), k = t.useCallback(
56
+ (n) => e.setActiveInstance(n),
57
+ [e]
58
+ ), E = t.useCallback(
59
+ () => e.getActiveInstance(),
60
+ [e]
61
+ ), K = t.useMemo(() => ({
62
+ registry: e,
63
+ open: r,
65
64
  setOpen: i,
66
65
  registerCommand: m,
67
- unregisterCommand: d,
68
- updateKeybinding: C,
69
- resetKeybinding: g,
70
- getPaletteCommands: p,
71
- getSettingsCommands: b,
72
- getEffectiveKeybinding: f,
73
- getRecentCommandIds: y,
74
- pushScope: P,
75
- popScope: k,
76
- setActiveInstance: E,
77
- getActiveInstance: v,
78
- version: l
66
+ unregisterCommand: l,
67
+ updateKeybinding: d,
68
+ resetKeybinding: C,
69
+ getPaletteCommands: g,
70
+ getSettingsCommands: p,
71
+ getEffectiveKeybinding: b,
72
+ getRecentCommandIds: f,
73
+ pushScope: y,
74
+ popScope: P,
75
+ setActiveInstance: k,
76
+ getActiveInstance: E,
77
+ version: u
79
78
  }), [
80
- s,
81
- c,
82
- l,
79
+ e,
80
+ r,
81
+ u,
83
82
  m,
83
+ l,
84
84
  d,
85
85
  C,
86
86
  g,
@@ -90,14 +90,13 @@ function T({
90
90
  y,
91
91
  P,
92
92
  k,
93
- E,
94
- v
93
+ E
95
94
  ]);
96
- return /* @__PURE__ */ R(h.Provider, { value: S, children: o });
95
+ return /* @__PURE__ */ A(w.Provider, { value: K, children: o });
97
96
  }
98
97
  T.displayName = "CommandPaletteProvider";
99
98
  function V() {
100
- const o = e.useContext(h);
99
+ const o = t.useContext(w);
101
100
  if (!o)
102
101
  throw new Error(
103
102
  "useCommandPalette must be used within a <CommandPaletteProvider>. Wrap your application root with <CommandPaletteProvider>."
@@ -12,19 +12,35 @@ import { CommandDefinition, KeyBinding } from './utils';
12
12
  * CommandPaletteEmpty, CommandPaletteSeparator, CommandPaletteFooter
13
13
  */
14
14
  import * as React from 'react';
15
- export interface CommandPaletteProps {
15
+ interface CommandPaletteLabels {
16
+ /** Placeholder text for the search input */
17
+ placeholder?: string;
18
+ /** Title shown when no results are found */
19
+ emptyTitle?: string;
20
+ /** Description shown when no results are found */
21
+ emptyDescription?: string;
22
+ /** Group heading for recently used commands */
23
+ recentGroupLabel?: string;
24
+ /** Group heading for searched commands when no category is present */
25
+ defaultGroupLabel?: string;
26
+ /** Label for the navigation hint in the footer */
27
+ navigateLabel?: string;
28
+ /** Label for the execution hint in the footer */
29
+ runLabel?: string;
30
+ /** Label for the close hint in the footer */
31
+ closeLabel?: string;
32
+ }
33
+ export interface CommandPaletteProps extends CommandPaletteLabels {
16
34
  className?: string;
17
35
  children?: React.ReactNode;
18
36
  /** Custom list of commands (overrides automatic registry commands) */
19
37
  commands?: CommandDefinition[];
20
- /** Placeholder text for the search input */
21
- placeholder?: string;
22
38
  /** Called when a command is executed */
23
39
  onCommandExecute?: (command: CommandDefinition) => void;
24
40
  /** Called when the palette opens/closes */
25
41
  onOpenChange?: (open: boolean) => void;
26
42
  }
27
- declare function CommandPalette({ className, children, commands: externalCommands, placeholder, onCommandExecute, onOpenChange, }: CommandPaletteProps): import("react/jsx-runtime").JSX.Element;
43
+ declare function CommandPalette({ className, children, commands: externalCommands, placeholder, emptyTitle, emptyDescription, recentGroupLabel, defaultGroupLabel, navigateLabel, runLabel, closeLabel, onCommandExecute, onOpenChange, }: CommandPaletteProps): import("react/jsx-runtime").JSX.Element;
28
44
  declare namespace CommandPalette {
29
45
  var displayName: string;
30
46
  }