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.
- package/README.md +49 -0
- package/dist/components/layout/dashboard-layout.d.ts +15 -1
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
- package/dist/components/ui/accordion.js +38 -34
- package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
- package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
- package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
- package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
- package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
- package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
- package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
- package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
- package/dist/components/ui/alert.js +62 -58
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +354 -354
- package/dist/components/ui/chart/chart.js +63 -62
- package/dist/components/ui/chips.js +42 -38
- package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
- package/dist/components/ui/command-palette/command-palette-context.js +110 -0
- package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
- package/dist/components/ui/command-palette/command-palette.js +402 -0
- package/dist/components/ui/command-palette/index.d.ts +23 -0
- package/dist/components/ui/command-palette/index.js +44 -0
- package/dist/components/ui/command-palette/kbd.d.ts +28 -0
- package/dist/components/ui/command-palette/kbd.js +52 -0
- package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
- package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
- package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
- package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
- package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
- package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
- package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
- package/dist/components/ui/command-palette/use-shortcut.js +49 -0
- package/dist/components/ui/command-palette/utils.d.ts +119 -0
- package/dist/components/ui/command-palette/utils.js +248 -0
- package/dist/components/ui/data-table/data-table-column-list.js +87 -86
- package/dist/components/ui/data-table/data-table-format-options.js +45 -44
- package/dist/components/ui/data-table/data-table-view-options.js +39 -38
- package/dist/components/ui/date-picker/date-picker.js +89 -87
- package/dist/components/ui/date-picker/date-range-picker.js +140 -138
- package/dist/components/ui/date-picker/month-picker.js +82 -81
- package/dist/components/ui/date-picker/month-range-picker.js +108 -105
- package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
- package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
- package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
- package/dist/components/ui/date-picker/week-picker.js +117 -115
- package/dist/components/ui/date-picker/week-range-picker.js +166 -164
- package/dist/components/ui/dialog.js +78 -73
- package/dist/components/ui/drawer.js +71 -66
- package/dist/components/ui/file-upload.js +131 -127
- package/dist/components/ui/filter-panel/filter-panel.js +98 -94
- package/dist/components/ui/filter-strip/filter-strip.js +95 -91
- package/dist/components/ui/filter-strip/filter-summary.js +91 -90
- package/dist/components/ui/header.js +57 -53
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
- package/dist/components/ui/loader.js +17 -16
- package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
- package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
- package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
- package/dist/components/ui/nested-list/nested-list.js +184 -182
- package/dist/components/ui/notification-panel/notification-panel.js +60 -53
- package/dist/components/ui/popover.js +45 -40
- package/dist/components/ui/prompt.js +90 -86
- package/dist/components/ui/select/select.js +206 -209
- package/dist/components/ui/sheet.d.ts +1 -0
- package/dist/components/ui/sheet.js +50 -48
- package/dist/components/ui/sidebar.js +273 -267
- package/dist/components/ui/stepper.js +75 -63
- package/dist/components/ui/tag.js +48 -44
- package/dist/components/ui/toast.js +46 -41
- package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
- package/dist/i18n/ImpactNovaI18nContext.js +76 -0
- package/dist/i18n/defaultMessages.d.ts +231 -0
- package/dist/i18n/defaultMessages.js +206 -0
- package/dist/i18n/getDateFnsLocale.d.ts +11 -0
- package/dist/i18n/getDateFnsLocale.js +21 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.js +206 -0
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.js +206 -0
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.js +206 -0
- package/dist/i18n/locales/index.d.ts +4 -0
- package/dist/i18n/locales/kn.d.ts +2 -0
- package/dist/i18n/locales/kn.js +206 -0
- package/dist/icons/assets/boxAdd.svg.js +5 -0
- package/dist/icons/assets/boxed.svg.js +5 -0
- package/dist/icons/assets/trolley.svg.js +5 -0
- package/dist/icons/assets/unlocked.svg.js +5 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +179 -171
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +232 -172
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as b } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import * as l from "highcharts";
|
|
4
4
|
import H from "highcharts-react-official";
|
|
5
5
|
import { cn as g } from "../../../lib/utils.js";
|
|
6
|
-
import { Skeleton as
|
|
7
|
-
import { Minimize2 as A, Maximize2 as
|
|
8
|
-
import { Button as
|
|
6
|
+
import { Skeleton as L } from "../skeleton.js";
|
|
7
|
+
import { Minimize2 as A, Maximize2 as j } from "lucide-react";
|
|
8
|
+
import { Button as I } from "../button.js";
|
|
9
9
|
import B from "highcharts/highcharts-more";
|
|
10
10
|
import M from "highcharts/highcharts-3d";
|
|
11
|
-
import
|
|
11
|
+
import T from "highcharts/modules/heatmap";
|
|
12
12
|
import P from "highcharts/modules/treemap";
|
|
13
13
|
import D from "highcharts/modules/venn";
|
|
14
14
|
import V from "highcharts/modules/stock";
|
|
@@ -18,35 +18,36 @@ import J from "highcharts/modules/dumbbell";
|
|
|
18
18
|
import K from "highcharts/modules/lollipop";
|
|
19
19
|
import Q from "highcharts-border-radius";
|
|
20
20
|
import { getBaseChartOptions as U } from "./chart.utils.js";
|
|
21
|
+
import { useImpactNovaI18n as W } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
21
22
|
const c = (e, r) => {
|
|
22
23
|
typeof e == "function" ? e(r) : typeof e == "object" && e.default && typeof e.default == "function" && e.default(r);
|
|
23
24
|
};
|
|
24
|
-
typeof l == "object" && (c(B, l), c(M, l), c(
|
|
25
|
-
const
|
|
26
|
-
const e = n.useContext(
|
|
25
|
+
typeof l == "object" && (c(B, l), c(M, l), c(T, l), c(P, l), c(D, l), c(O, l), c(G, l), c(J, l), c(K, l), c(V, l), c(Q, l));
|
|
26
|
+
const F = n.createContext(null), k = () => {
|
|
27
|
+
const e = n.useContext(F);
|
|
27
28
|
if (!e)
|
|
28
29
|
throw new Error("Chart components must be used within a ChartContainer");
|
|
29
30
|
return e;
|
|
30
31
|
}, z = n.forwardRef(
|
|
31
|
-
({ className: e, children: r, isLoading: i = !1, ...o },
|
|
32
|
-
const a = n.useRef(null),
|
|
33
|
-
n.useImperativeHandle(
|
|
32
|
+
({ className: e, children: r, isLoading: i = !1, ...o }, f) => {
|
|
33
|
+
const a = n.useRef(null), u = n.useRef(null), [m, h] = n.useState(!1), [x, p] = n.useState(!1);
|
|
34
|
+
n.useImperativeHandle(f, () => a.current);
|
|
34
35
|
const w = () => {
|
|
35
36
|
const t = a.current;
|
|
36
37
|
t && (p(!0), t.classList.add("fullscreen-animating"), setTimeout(() => {
|
|
37
|
-
t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.msRequestFullscreen && t.msRequestFullscreen(),
|
|
38
|
+
t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.msRequestFullscreen && t.msRequestFullscreen(), h(!0), t.classList.remove("fullscreen-animating");
|
|
38
39
|
}, 200));
|
|
39
40
|
}, C = () => {
|
|
40
41
|
const t = a.current;
|
|
41
42
|
t && (p(!0), t.classList.add("fullscreen-animating-out"), setTimeout(() => {
|
|
42
|
-
document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.msExitFullscreen && document.msExitFullscreen(),
|
|
43
|
+
document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.msExitFullscreen && document.msExitFullscreen(), h(!1), t.classList.remove("fullscreen-animating-out");
|
|
43
44
|
}, 200));
|
|
44
45
|
}, q = () => {
|
|
45
|
-
|
|
46
|
+
m ? C() : w();
|
|
46
47
|
};
|
|
47
48
|
return n.useEffect(() => {
|
|
48
49
|
const t = () => {
|
|
49
|
-
document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement ||
|
|
50
|
+
document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || h(!1);
|
|
50
51
|
};
|
|
51
52
|
return document.addEventListener("fullscreenchange", t), document.addEventListener("webkitfullscreenchange", t), () => {
|
|
52
53
|
document.removeEventListener("fullscreenchange", t), document.removeEventListener(
|
|
@@ -55,14 +56,14 @@ const b = n.createContext(null), L = () => {
|
|
|
55
56
|
);
|
|
56
57
|
};
|
|
57
58
|
}, []), n.useEffect(() => {
|
|
58
|
-
if (!
|
|
59
|
-
const t =
|
|
59
|
+
if (!u?.current?.chart) return;
|
|
60
|
+
const t = u.current.chart;
|
|
60
61
|
let d = null;
|
|
61
62
|
const E = () => {
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const R =
|
|
63
|
+
m && a.current ? (d && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
|
|
64
|
+
const v = a.current;
|
|
65
|
+
if (!v) return;
|
|
66
|
+
const R = v.getBoundingClientRect(), N = v.querySelector('[class*="ChartContent"]');
|
|
66
67
|
if (N) {
|
|
67
68
|
const y = N.getBoundingClientRect();
|
|
68
69
|
t.setSize(y.width, y.height, !1);
|
|
@@ -74,15 +75,15 @@ const b = n.createContext(null), L = () => {
|
|
|
74
75
|
return window.addEventListener("resize", E), () => {
|
|
75
76
|
d && cancelAnimationFrame(d), window.removeEventListener("resize", E);
|
|
76
77
|
};
|
|
77
|
-
}, [
|
|
78
|
-
|
|
78
|
+
}, [m]), /* @__PURE__ */ s(
|
|
79
|
+
F.Provider,
|
|
79
80
|
{
|
|
80
81
|
value: {
|
|
81
|
-
isExpanded:
|
|
82
|
+
isExpanded: m,
|
|
82
83
|
toggleFullscreen: q,
|
|
83
84
|
isLoading: i,
|
|
84
85
|
containerRef: a,
|
|
85
|
-
chartComponentRef:
|
|
86
|
+
chartComponentRef: u
|
|
86
87
|
},
|
|
87
88
|
children: /* @__PURE__ */ s(
|
|
88
89
|
"div",
|
|
@@ -91,7 +92,7 @@ const b = n.createContext(null), L = () => {
|
|
|
91
92
|
className: g(
|
|
92
93
|
e,
|
|
93
94
|
"w-full relative bg-card transition-all duration-200 ease-in-out",
|
|
94
|
-
|
|
95
|
+
m && "fixed inset-0 z-50 h-screen w-screen p-4 bg-background flex flex-col",
|
|
95
96
|
x && "overflow-hidden"
|
|
96
97
|
),
|
|
97
98
|
...o,
|
|
@@ -103,66 +104,66 @@ const b = n.createContext(null), L = () => {
|
|
|
103
104
|
}
|
|
104
105
|
);
|
|
105
106
|
z.displayName = "ChartContainer";
|
|
106
|
-
const
|
|
107
|
+
const X = n.forwardRef(
|
|
107
108
|
({ className: e, children: r, ...i }, o) => /* @__PURE__ */ s("div", { ref: o, className: g("flex items-center justify-between mb-4", e), ...i, children: r })
|
|
108
109
|
);
|
|
109
|
-
|
|
110
|
-
const
|
|
110
|
+
X.displayName = "ChartHeader";
|
|
111
|
+
const Y = n.forwardRef(
|
|
111
112
|
({ className: e, ...r }, i) => /* @__PURE__ */ s("h3", { ref: i, className: g("text-lg font-semibold leading-none tracking-tight", e), ...r })
|
|
112
113
|
);
|
|
113
|
-
|
|
114
|
-
const
|
|
114
|
+
Y.displayName = "ChartTitle";
|
|
115
|
+
const Z = n.forwardRef(
|
|
115
116
|
({ className: e, ...r }, i) => /* @__PURE__ */ s("div", { ref: i, className: g("flex items-center gap-2", e), ...r })
|
|
116
117
|
);
|
|
117
|
-
|
|
118
|
-
const
|
|
118
|
+
Z.displayName = "ChartActions";
|
|
119
|
+
const _ = n.forwardRef(
|
|
119
120
|
({ className: e, ...r }, i) => {
|
|
120
|
-
const {
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
|
|
121
|
+
const { t: o } = W(), { toggleFullscreen: f, isExpanded: a } = k(), u = o("aria.toggleFullscreen");
|
|
122
|
+
return /* @__PURE__ */ b(
|
|
123
|
+
I,
|
|
123
124
|
{
|
|
124
125
|
variant: "ghost",
|
|
125
126
|
size: "icon",
|
|
126
|
-
onClick:
|
|
127
|
+
onClick: f,
|
|
127
128
|
ref: i,
|
|
128
129
|
className: g("h-8 w-8", e),
|
|
129
|
-
"aria-label":
|
|
130
|
+
"aria-label": u,
|
|
130
131
|
...r,
|
|
131
132
|
children: [
|
|
132
|
-
|
|
133
|
-
/* @__PURE__ */ s("span", { className: "sr-only", children:
|
|
133
|
+
a ? /* @__PURE__ */ s(A, { className: "h-4 w-4" }) : /* @__PURE__ */ s(j, { className: "h-4 w-4" }),
|
|
134
|
+
/* @__PURE__ */ s("span", { className: "sr-only", children: u })
|
|
134
135
|
]
|
|
135
136
|
}
|
|
136
137
|
);
|
|
137
138
|
}
|
|
138
139
|
);
|
|
139
|
-
|
|
140
|
+
_.displayName = "ChartFullScreen";
|
|
140
141
|
const S = n.forwardRef(
|
|
141
|
-
({ className: e, children: r, loader: i, ...o },
|
|
142
|
-
const { isLoading: a, chartComponentRef:
|
|
143
|
-
return a && i ? /* @__PURE__ */ s("div", { ref:
|
|
144
|
-
a && /* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */ s(
|
|
146
|
-
/* @__PURE__ */ s(
|
|
142
|
+
({ className: e, children: r, loader: i, ...o }, f) => {
|
|
143
|
+
const { isLoading: a, chartComponentRef: u, isExpanded: m } = k();
|
|
144
|
+
return a && i ? /* @__PURE__ */ s("div", { ref: f, className: g(e, "w-full relative flex items-center justify-center flex-1 min-h-[300px]", m && "min-h-0"), ...o, children: i }) : /* @__PURE__ */ b("div", { ref: f, className: g(e, "w-full relative flex-1 min-h-[300px]", m && "min-h-0"), ...o, children: [
|
|
145
|
+
a && /* @__PURE__ */ b("div", { className: "absolute inset-0 z-10 bg-background/50 flex flex-col gap-2 p-4", children: [
|
|
146
|
+
/* @__PURE__ */ s(L, { className: "h-8 w-1/3" }),
|
|
147
|
+
/* @__PURE__ */ s(L, { className: "flex-1 w-full" })
|
|
147
148
|
] }),
|
|
148
|
-
n.Children.map(r, (
|
|
149
|
+
n.Children.map(r, (h) => n.isValidElement(h) ? n.cloneElement(h, { ref: u }) : h)
|
|
149
150
|
] });
|
|
150
151
|
}
|
|
151
152
|
);
|
|
152
153
|
S.displayName = "ChartContent";
|
|
153
|
-
const
|
|
154
|
+
const $ = n.forwardRef(
|
|
154
155
|
(e, r) => {
|
|
155
156
|
const {
|
|
156
157
|
height: i,
|
|
157
158
|
width: o,
|
|
158
|
-
className:
|
|
159
|
+
className: f,
|
|
159
160
|
isLoading: a,
|
|
160
|
-
loader:
|
|
161
|
-
title:
|
|
162
|
-
children:
|
|
161
|
+
loader: u,
|
|
162
|
+
title: m,
|
|
163
|
+
children: h,
|
|
163
164
|
...x
|
|
164
|
-
} = e, p = n.useContext(
|
|
165
|
-
const C = U({ title:
|
|
165
|
+
} = e, p = n.useContext(F), w = n.useMemo(() => {
|
|
166
|
+
const C = U({ title: m, ...x });
|
|
166
167
|
return {
|
|
167
168
|
...C,
|
|
168
169
|
chart: {
|
|
@@ -180,7 +181,7 @@ const _ = n.forwardRef(
|
|
|
180
181
|
ref: r,
|
|
181
182
|
containerProps: { style: { height: "100%", width: "100%" } }
|
|
182
183
|
}
|
|
183
|
-
) : /* @__PURE__ */ s(z, { className:
|
|
184
|
+
) : /* @__PURE__ */ s(z, { className: f, isLoading: a, children: /* @__PURE__ */ s(S, { loader: u, children: /* @__PURE__ */ s(
|
|
184
185
|
H,
|
|
185
186
|
{
|
|
186
187
|
highcharts: l,
|
|
@@ -191,13 +192,13 @@ const _ = n.forwardRef(
|
|
|
191
192
|
) }) });
|
|
192
193
|
}
|
|
193
194
|
);
|
|
194
|
-
|
|
195
|
+
$.displayName = "Chart";
|
|
195
196
|
export {
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
$ as Chart,
|
|
198
|
+
Z as ChartActions,
|
|
198
199
|
z as ChartContainer,
|
|
199
200
|
S as ChartContent,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
_ as ChartFullScreen,
|
|
202
|
+
X as ChartHeader,
|
|
203
|
+
Y as ChartTitle
|
|
203
204
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { Slot as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { Cross as
|
|
6
|
-
import { cn as
|
|
7
|
-
|
|
2
|
+
import * as f from "react";
|
|
3
|
+
import { Slot as g } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as x } from "class-variance-authority";
|
|
5
|
+
import { Cross as b } from "../../icons/index.js";
|
|
6
|
+
import { cn as v } from "../../lib/utils.js";
|
|
7
|
+
import { useImpactNovaI18n as h } from "../../i18n/ImpactNovaI18nContext.js";
|
|
8
|
+
const y = x(
|
|
8
9
|
"inline-flex items-center gap-1.5 px-2.5 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
9
10
|
{
|
|
10
11
|
variants: {
|
|
@@ -31,38 +32,41 @@ const v = g(
|
|
|
31
32
|
shape: "pill"
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
),
|
|
35
|
-
({ className:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
35
|
+
), C = f.forwardRef(
|
|
36
|
+
({ className: a, variant: r, size: o, shape: e, onRemove: n, removable: i, asChild: s = !1, children: d, ...p }, c) => {
|
|
37
|
+
const { t: u } = h();
|
|
38
|
+
return /* @__PURE__ */ l(
|
|
39
|
+
s ? g : "div",
|
|
40
|
+
{
|
|
41
|
+
ref: c,
|
|
42
|
+
className: v(y({ variant: r, size: o, shape: e }), a),
|
|
43
|
+
"data-component": "chip",
|
|
44
|
+
"data-variant": r ?? "default",
|
|
45
|
+
"data-size": o ?? "md",
|
|
46
|
+
"data-shape": e ?? "pill",
|
|
47
|
+
...p,
|
|
48
|
+
children: [
|
|
49
|
+
d,
|
|
50
|
+
i && /* @__PURE__ */ t(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
type: "button",
|
|
54
|
+
onClick: (m) => {
|
|
55
|
+
m.stopPropagation(), n?.();
|
|
56
|
+
},
|
|
57
|
+
className: "ml-1 p-1 rounded-full hover:bg-black/20 focus:outline-none focus:ring-2 focus:ring-ring",
|
|
58
|
+
"aria-label": u("aria.remove"),
|
|
59
|
+
"data-component": "chip-remove",
|
|
60
|
+
children: /* @__PURE__ */ t(b, { size: 8 })
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
63
67
|
);
|
|
64
|
-
|
|
68
|
+
C.displayName = "Chip";
|
|
65
69
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
C as Chip,
|
|
71
|
+
y as chipVariants
|
|
68
72
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ShortcutRegistry, ConflictInfo } from './shortcut-registry';
|
|
2
|
+
import { CommandDefinition, KeyBinding, ShortcutScope } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* CommandPaletteProvider — React context that wraps ShortcutRegistry,
|
|
5
|
+
* manages ⌘K open/close, and provides the API to all descendants.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
export interface CommandPaletteContextValue {
|
|
9
|
+
/** The underlying registry instance */
|
|
10
|
+
registry: ShortcutRegistry;
|
|
11
|
+
/** Whether the command palette dialog is open */
|
|
12
|
+
open: boolean;
|
|
13
|
+
setOpen: (open: boolean) => void;
|
|
14
|
+
/** Register a command (auto-applies saved overrides) */
|
|
15
|
+
registerCommand: (command: CommandDefinition) => void;
|
|
16
|
+
/** Unregister a command by ID */
|
|
17
|
+
unregisterCommand: (commandId: string) => void;
|
|
18
|
+
/** Update a command's keybinding (returns conflict info if any) */
|
|
19
|
+
updateKeybinding: (commandId: string, keybinding: KeyBinding) => {
|
|
20
|
+
success: boolean;
|
|
21
|
+
conflict?: ConflictInfo;
|
|
22
|
+
reserved?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** Reset a command's keybinding to default */
|
|
25
|
+
resetKeybinding: (commandId: string) => void;
|
|
26
|
+
/** Get all commands for the palette */
|
|
27
|
+
getPaletteCommands: () => CommandDefinition[];
|
|
28
|
+
/** Get all commands for settings */
|
|
29
|
+
getSettingsCommands: () => CommandDefinition[];
|
|
30
|
+
/** Get effective keybinding for a command */
|
|
31
|
+
getEffectiveKeybinding: (commandId: string) => KeyBinding | undefined;
|
|
32
|
+
/** Get recent command IDs (most recent first) */
|
|
33
|
+
getRecentCommandIds: () => string[];
|
|
34
|
+
/** Push/pop scope */
|
|
35
|
+
pushScope: (scope: ShortcutScope) => void;
|
|
36
|
+
popScope: (scope: ShortcutScope) => void;
|
|
37
|
+
/** Set/get the currently focused instance (for multi-table dispatch) */
|
|
38
|
+
setActiveInstance: (instance: string | null) => void;
|
|
39
|
+
getActiveInstance: () => string | null;
|
|
40
|
+
/** Force a re-render of consumers (incremented on registry change) */
|
|
41
|
+
version: number;
|
|
42
|
+
}
|
|
43
|
+
export interface CommandPaletteProviderProps {
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
/** Custom keybinding to open the palette (defaults to ⌘K / Ctrl+K) */
|
|
46
|
+
openKeybinding?: KeyBinding;
|
|
47
|
+
}
|
|
48
|
+
export declare function CommandPaletteProvider({ children, openKeybinding, }: CommandPaletteProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare namespace CommandPaletteProvider {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
export declare function useCommandPalette(): CommandPaletteContextValue;
|
|
@@ -0,0 +1,110 @@
|
|
|
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);
|
|
6
|
+
function T({
|
|
7
|
+
children: o,
|
|
8
|
+
openKeybinding: u = { key: "k", meta: !0 }
|
|
9
|
+
}) {
|
|
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);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
c || x && !I && !(r.metaKey || r.ctrlKey) || s.handleKeyEvent(r);
|
|
23
|
+
};
|
|
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,
|
|
65
|
+
setOpen: i,
|
|
66
|
+
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
|
|
79
|
+
}), [
|
|
80
|
+
s,
|
|
81
|
+
c,
|
|
82
|
+
l,
|
|
83
|
+
m,
|
|
84
|
+
d,
|
|
85
|
+
C,
|
|
86
|
+
g,
|
|
87
|
+
p,
|
|
88
|
+
b,
|
|
89
|
+
f,
|
|
90
|
+
y,
|
|
91
|
+
P,
|
|
92
|
+
k,
|
|
93
|
+
E,
|
|
94
|
+
v
|
|
95
|
+
]);
|
|
96
|
+
return /* @__PURE__ */ R(h.Provider, { value: S, children: o });
|
|
97
|
+
}
|
|
98
|
+
T.displayName = "CommandPaletteProvider";
|
|
99
|
+
function V() {
|
|
100
|
+
const o = e.useContext(h);
|
|
101
|
+
if (!o)
|
|
102
|
+
throw new Error(
|
|
103
|
+
"useCommandPalette must be used within a <CommandPaletteProvider>. Wrap your application root with <CommandPaletteProvider>."
|
|
104
|
+
);
|
|
105
|
+
return o;
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
T as CommandPaletteProvider,
|
|
109
|
+
V as useCommandPalette
|
|
110
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CommandDefinition, KeyBinding } from './utils';
|
|
2
|
+
/**
|
|
3
|
+
* CommandPalette — The ⌘K overlay with search, grouped results, and keyboard navigation.
|
|
4
|
+
*
|
|
5
|
+
* Built from scratch using existing impact-nova Dialog, Input, and Separator components.
|
|
6
|
+
* Implements fuzzy search, keyboard navigation (↑↓ Enter Esc), recently-used sorting,
|
|
7
|
+
* and displays shortcut badges via the Kbd component.
|
|
8
|
+
*
|
|
9
|
+
* Sub-components exported:
|
|
10
|
+
* CommandPalette, CommandPaletteInput, CommandPaletteList,
|
|
11
|
+
* CommandPaletteGroup, CommandPaletteItem, CommandPaletteShortcut,
|
|
12
|
+
* CommandPaletteEmpty, CommandPaletteSeparator, CommandPaletteFooter
|
|
13
|
+
*/
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
export interface CommandPaletteProps {
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Custom list of commands (overrides automatic registry commands) */
|
|
19
|
+
commands?: CommandDefinition[];
|
|
20
|
+
/** Placeholder text for the search input */
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** Called when a command is executed */
|
|
23
|
+
onCommandExecute?: (command: CommandDefinition) => void;
|
|
24
|
+
/** Called when the palette opens/closes */
|
|
25
|
+
onOpenChange?: (open: boolean) => void;
|
|
26
|
+
}
|
|
27
|
+
declare function CommandPalette({ className, children, commands: externalCommands, placeholder, onCommandExecute, onOpenChange, }: CommandPaletteProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare namespace CommandPalette {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CommandPaletteInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
|
|
32
|
+
onValueChange?: (value: string) => void;
|
|
33
|
+
}
|
|
34
|
+
declare const CommandPaletteInput: React.ForwardRefExoticComponent<CommandPaletteInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
35
|
+
declare const CommandPaletteList: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export interface CommandPaletteGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
37
|
+
heading?: string;
|
|
38
|
+
}
|
|
39
|
+
declare const CommandPaletteGroup: React.ForwardRefExoticComponent<CommandPaletteGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
export interface CommandPaletteItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
41
|
+
command: CommandDefinition;
|
|
42
|
+
isSelected?: boolean;
|
|
43
|
+
onSelect?: () => void;
|
|
44
|
+
keybinding?: KeyBinding;
|
|
45
|
+
}
|
|
46
|
+
declare const CommandPaletteItem: React.ForwardRefExoticComponent<CommandPaletteItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
export interface CommandPaletteShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
48
|
+
keybinding: KeyBinding;
|
|
49
|
+
isSelected?: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare function CommandPaletteShortcut({ keybinding, isSelected, className, ...props }: CommandPaletteShortcutProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
declare namespace CommandPaletteShortcut {
|
|
53
|
+
var displayName: string;
|
|
54
|
+
}
|
|
55
|
+
declare function CommandPaletteEmpty({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
declare namespace CommandPaletteEmpty {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
declare function CommandPaletteSeparator({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
declare namespace CommandPaletteSeparator {
|
|
61
|
+
var displayName: string;
|
|
62
|
+
}
|
|
63
|
+
declare function CommandPaletteFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
declare namespace CommandPaletteFooter {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
export { CommandPalette, CommandPaletteInput, CommandPaletteList, CommandPaletteGroup, CommandPaletteItem, CommandPaletteShortcut, CommandPaletteEmpty, CommandPaletteSeparator, CommandPaletteFooter, };
|