impact-nova 1.2.4 → 1.5.0
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.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/ui/alert.js +76 -60
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +355 -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 -85
- package/dist/components/ui/select/select.js +225 -229
- 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/tabs.d.ts +11 -1
- package/dist/components/ui/tabs.js +79 -54
- 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/assets/webp/delete-3d.webp.js +4 -0
- package/dist/icons/assets/webp/info-3d.webp.js +4 -0
- package/dist/icons/assets/webp/success-3d.webp.js +4 -0
- package/dist/icons/assets/webp/warning-3d.webp.js +4 -0
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.js +197 -181
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +260 -199
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as J } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import * as k from "@radix-ui/react-dialog";
|
|
4
|
+
import { Search as D } from "lucide-react";
|
|
5
|
+
import { cn as i } from "../../../lib/utils.js";
|
|
6
|
+
import { useCommandPalette as W } from "./command-palette-context.js";
|
|
7
|
+
import { Kbd as v } from "./kbd.js";
|
|
8
|
+
import { fuzzyFilter as X, keybindingToSymbols as Y } from "./utils.js";
|
|
9
|
+
const O = r.createContext({
|
|
10
|
+
query: "",
|
|
11
|
+
setQuery: () => {
|
|
12
|
+
},
|
|
13
|
+
selectedIndex: 0,
|
|
14
|
+
setSelectedIndex: () => {
|
|
15
|
+
},
|
|
16
|
+
flatItems: [],
|
|
17
|
+
onExecute: () => {
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
function Z({
|
|
21
|
+
className: s,
|
|
22
|
+
children: a,
|
|
23
|
+
commands: o,
|
|
24
|
+
placeholder: u = "Type a command or search...",
|
|
25
|
+
onCommandExecute: f,
|
|
26
|
+
onOpenChange: y
|
|
27
|
+
}) {
|
|
28
|
+
const { open: h, setOpen: P, getPaletteCommands: T, getEffectiveKeybinding: B, registry: C } = W(), [b, I] = r.useState(""), [N, g] = r.useState(0), E = r.useRef(null), R = r.useRef(null), S = r.useMemo(() => o ?? T(), [o, h]), z = r.useMemo(() => {
|
|
29
|
+
const t = X(
|
|
30
|
+
S,
|
|
31
|
+
b,
|
|
32
|
+
(n) => `${n.category ? n.category + ": " : ""}${n.label}${n.description ? " " + n.description : ""}`
|
|
33
|
+
);
|
|
34
|
+
if (!b.trim()) {
|
|
35
|
+
const n = C.getRecentCommandIds(), x = new Set(n), l = [], m = [];
|
|
36
|
+
for (const p of t)
|
|
37
|
+
x.has(p.item.id) ? l.push(p) : m.push(p);
|
|
38
|
+
return l.sort((p, _) => n.indexOf(p.item.id) - n.indexOf(_.item.id)), [...l, ...m];
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
}, [S, b, C]), c = r.useMemo(() => z.map((t) => t.item), [z]), Q = r.useMemo(() => {
|
|
42
|
+
const t = /* @__PURE__ */ new Map(), n = new Set(C.getRecentCommandIds());
|
|
43
|
+
if (b.trim())
|
|
44
|
+
for (const x of c) {
|
|
45
|
+
const l = x.category || "Commands";
|
|
46
|
+
t.has(l) || t.set(l, []), t.get(l).push(x);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const x = c.filter((m) => n.has(m.id));
|
|
50
|
+
x.length > 0 && t.set("Recently Used", x);
|
|
51
|
+
const l = c.filter((m) => !n.has(m.id));
|
|
52
|
+
for (const m of l) {
|
|
53
|
+
const p = m.category || "Commands";
|
|
54
|
+
t.has(p) || t.set(p, []), t.get(p).push(m);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
}, [c, b, C]);
|
|
59
|
+
r.useEffect(() => {
|
|
60
|
+
h && (I(""), g(0), requestAnimationFrame(() => {
|
|
61
|
+
E.current?.focus();
|
|
62
|
+
}));
|
|
63
|
+
}, [h]);
|
|
64
|
+
const M = (t) => {
|
|
65
|
+
P(t), y?.(t);
|
|
66
|
+
}, w = r.useCallback((t) => {
|
|
67
|
+
t.handler(), C.addRecentCommand(t.id), f?.(t), M(!1);
|
|
68
|
+
}, [C, f]), U = r.useCallback((t) => {
|
|
69
|
+
switch (t.key) {
|
|
70
|
+
case "ArrowDown": {
|
|
71
|
+
t.preventDefault(), g((n) => Math.min(n + 1, c.length - 1));
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case "ArrowUp": {
|
|
75
|
+
t.preventDefault(), g((n) => Math.max(n - 1, 0));
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case "Enter": {
|
|
79
|
+
t.preventDefault();
|
|
80
|
+
const n = c[N];
|
|
81
|
+
n && w(n);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case "Home": {
|
|
85
|
+
t.preventDefault(), g(0);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "End": {
|
|
89
|
+
t.preventDefault(), g(Math.max(c.length - 1, 0));
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, [c, N, w]);
|
|
94
|
+
r.useEffect(() => {
|
|
95
|
+
g(0);
|
|
96
|
+
}, [b]), r.useEffect(() => {
|
|
97
|
+
const t = R.current;
|
|
98
|
+
if (!t) return;
|
|
99
|
+
const n = t.querySelector('[data-selected="true"]');
|
|
100
|
+
n && n.scrollIntoView({ block: "nearest" });
|
|
101
|
+
}, [N]);
|
|
102
|
+
const H = r.useMemo(
|
|
103
|
+
() => ({
|
|
104
|
+
query: b,
|
|
105
|
+
setQuery: I,
|
|
106
|
+
selectedIndex: N,
|
|
107
|
+
setSelectedIndex: g,
|
|
108
|
+
flatItems: c,
|
|
109
|
+
onExecute: w
|
|
110
|
+
}),
|
|
111
|
+
[b, N, c, w]
|
|
112
|
+
), V = r.Children.count(a) > 0;
|
|
113
|
+
return /* @__PURE__ */ e(k.Root, { open: h, onOpenChange: M, children: /* @__PURE__ */ d(k.Portal, { children: [
|
|
114
|
+
/* @__PURE__ */ e(
|
|
115
|
+
k.Overlay,
|
|
116
|
+
{
|
|
117
|
+
className: "fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ d(
|
|
121
|
+
k.Content,
|
|
122
|
+
{
|
|
123
|
+
"aria-describedby": void 0,
|
|
124
|
+
"data-command-palette": !0,
|
|
125
|
+
"data-component": "command-palette",
|
|
126
|
+
onKeyDown: U,
|
|
127
|
+
className: i(
|
|
128
|
+
"fixed left-[50%] top-[20%] z-50 w-full max-w-[640px] -translate-x-1/2",
|
|
129
|
+
"rounded-xl border border-[#d1d5db] bg-white shadow-2xl overflow-hidden",
|
|
130
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
131
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
132
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
133
|
+
// Pin translate-x at -50% during animation so it stays centered (no horizontal slide)
|
|
134
|
+
"data-[state=open]:slide-in-from-left-1/2 data-[state=closed]:slide-out-to-left-1/2",
|
|
135
|
+
"duration-150",
|
|
136
|
+
s
|
|
137
|
+
),
|
|
138
|
+
style: { transformOrigin: "top center" },
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ e(k.Title, { className: "sr-only", children: "Command Palette" }),
|
|
141
|
+
/* @__PURE__ */ e(O.Provider, { value: H, children: V ? a : /* @__PURE__ */ d(J, { children: [
|
|
142
|
+
/* @__PURE__ */ e(
|
|
143
|
+
A,
|
|
144
|
+
{
|
|
145
|
+
ref: E,
|
|
146
|
+
placeholder: u
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
/* @__PURE__ */ e(F, { ref: R, children: c.length === 0 ? /* @__PURE__ */ e(G, {}) : Array.from(Q.entries()).map(([t, n], x) => /* @__PURE__ */ d(r.Fragment, { children: [
|
|
150
|
+
x > 0 && /* @__PURE__ */ e(K, {}),
|
|
151
|
+
/* @__PURE__ */ e(j, { heading: t, children: n.map((l) => {
|
|
152
|
+
const m = c.indexOf(l), p = B(l.id);
|
|
153
|
+
return /* @__PURE__ */ e(
|
|
154
|
+
q,
|
|
155
|
+
{
|
|
156
|
+
command: l,
|
|
157
|
+
isSelected: m === N,
|
|
158
|
+
onSelect: () => w(l),
|
|
159
|
+
onMouseEnter: () => g(m),
|
|
160
|
+
keybinding: p
|
|
161
|
+
},
|
|
162
|
+
l.id
|
|
163
|
+
);
|
|
164
|
+
}) })
|
|
165
|
+
] }, t)) }),
|
|
166
|
+
/* @__PURE__ */ e(L, {})
|
|
167
|
+
] }) })
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
] }) });
|
|
172
|
+
}
|
|
173
|
+
Z.displayName = "CommandPalette";
|
|
174
|
+
const A = r.forwardRef(
|
|
175
|
+
({ className: s, placeholder: a, onValueChange: o, ...u }, f) => {
|
|
176
|
+
const { query: y, setQuery: h } = r.useContext(O);
|
|
177
|
+
return /* @__PURE__ */ d(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
className: i(
|
|
181
|
+
"flex items-center gap-3 border-b border-[#e5e7eb] px-4",
|
|
182
|
+
s
|
|
183
|
+
),
|
|
184
|
+
"data-command-palette-input": !0,
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ e(D, { className: "h-4 w-4 shrink-0 text-[#9ca3af]" }),
|
|
187
|
+
/* @__PURE__ */ e(
|
|
188
|
+
"input",
|
|
189
|
+
{
|
|
190
|
+
ref: f,
|
|
191
|
+
value: y,
|
|
192
|
+
onChange: (P) => {
|
|
193
|
+
h(P.target.value), o?.(P.target.value);
|
|
194
|
+
},
|
|
195
|
+
placeholder: a,
|
|
196
|
+
autoComplete: "off",
|
|
197
|
+
autoCorrect: "off",
|
|
198
|
+
spellCheck: !1,
|
|
199
|
+
className: i(
|
|
200
|
+
"flex h-12 w-full bg-transparent py-3 text-sm font-medium outline-none",
|
|
201
|
+
"placeholder:text-[#9ca3af]"
|
|
202
|
+
),
|
|
203
|
+
...u
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ e(
|
|
207
|
+
v,
|
|
208
|
+
{
|
|
209
|
+
keybinding: { key: "Escape" },
|
|
210
|
+
size: "sm",
|
|
211
|
+
variant: "muted",
|
|
212
|
+
className: "shrink-0"
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
A.displayName = "CommandPaletteInput";
|
|
221
|
+
const F = r.forwardRef(({ className: s, children: a, ...o }, u) => /* @__PURE__ */ e(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
ref: u,
|
|
225
|
+
role: "listbox",
|
|
226
|
+
"data-command-palette-list": !0,
|
|
227
|
+
className: i(
|
|
228
|
+
"max-h-[360px] overflow-y-auto overscroll-contain py-1",
|
|
229
|
+
s
|
|
230
|
+
),
|
|
231
|
+
...o,
|
|
232
|
+
children: a
|
|
233
|
+
}
|
|
234
|
+
));
|
|
235
|
+
F.displayName = "CommandPaletteList";
|
|
236
|
+
const j = r.forwardRef(
|
|
237
|
+
({ className: s, heading: a, children: o, ...u }, f) => /* @__PURE__ */ d(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
ref: f,
|
|
241
|
+
role: "group",
|
|
242
|
+
"aria-label": a,
|
|
243
|
+
"data-command-palette-group": !0,
|
|
244
|
+
className: i("py-1", s),
|
|
245
|
+
...u,
|
|
246
|
+
children: [
|
|
247
|
+
a && /* @__PURE__ */ e("div", { className: "px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-[#9ca3af]", children: a }),
|
|
248
|
+
o
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
);
|
|
253
|
+
j.displayName = "CommandPaletteGroup";
|
|
254
|
+
const ee = {
|
|
255
|
+
browser: "Browser",
|
|
256
|
+
"ag-grid": "AG Grid",
|
|
257
|
+
system: "System"
|
|
258
|
+
};
|
|
259
|
+
function te({ source: s, isSelected: a }) {
|
|
260
|
+
if (!s || s === "user") return null;
|
|
261
|
+
const o = ee[s];
|
|
262
|
+
return o ? /* @__PURE__ */ e(
|
|
263
|
+
"span",
|
|
264
|
+
{
|
|
265
|
+
className: i(
|
|
266
|
+
"shrink-0 rounded px-1.5 py-px text-[9px] font-medium leading-tight tracking-wide",
|
|
267
|
+
a ? "text-white/50" : "text-[#9ca3af] border border-[#e5e7eb]"
|
|
268
|
+
),
|
|
269
|
+
children: o
|
|
270
|
+
}
|
|
271
|
+
) : null;
|
|
272
|
+
}
|
|
273
|
+
const q = r.forwardRef(
|
|
274
|
+
({ className: s, command: a, isSelected: o, onSelect: u, keybinding: f, ...y }, h) => /* @__PURE__ */ d(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
ref: h,
|
|
278
|
+
role: "option",
|
|
279
|
+
"aria-selected": o,
|
|
280
|
+
"data-selected": o,
|
|
281
|
+
"data-command-palette-item": !0,
|
|
282
|
+
"data-command-id": a.id,
|
|
283
|
+
onClick: u,
|
|
284
|
+
className: i(
|
|
285
|
+
"flex items-center gap-3 cursor-pointer px-4 py-2 text-sm",
|
|
286
|
+
"transition-colors duration-75",
|
|
287
|
+
o ? "bg-[#4259ee] text-white" : "text-[#374151] hover:bg-[#f3f4f6]",
|
|
288
|
+
s
|
|
289
|
+
),
|
|
290
|
+
...y,
|
|
291
|
+
children: [
|
|
292
|
+
a.icon && /* @__PURE__ */ e("span", { className: i(
|
|
293
|
+
"flex h-4 w-4 shrink-0 items-center justify-center",
|
|
294
|
+
o ? "text-white" : "text-[#6b7280]"
|
|
295
|
+
), children: a.icon }),
|
|
296
|
+
/* @__PURE__ */ d("div", { className: "flex flex-1 flex-col min-w-0", children: [
|
|
297
|
+
/* @__PURE__ */ e("span", { className: "truncate font-medium", children: a.label }),
|
|
298
|
+
a.description && /* @__PURE__ */ e("span", { className: i(
|
|
299
|
+
"truncate text-xs",
|
|
300
|
+
o ? "text-white/70" : "text-[#9ca3af]"
|
|
301
|
+
), children: a.description })
|
|
302
|
+
] }),
|
|
303
|
+
/* @__PURE__ */ e(te, { source: a.source, isSelected: o }),
|
|
304
|
+
f && /* @__PURE__ */ e($, { keybinding: f, isSelected: o })
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
);
|
|
309
|
+
q.displayName = "CommandPaletteItem";
|
|
310
|
+
function $({ keybinding: s, isSelected: a, className: o, ...u }) {
|
|
311
|
+
const f = Y(s);
|
|
312
|
+
return /* @__PURE__ */ e(
|
|
313
|
+
"span",
|
|
314
|
+
{
|
|
315
|
+
className: i("ml-auto flex items-center gap-0.5 shrink-0", o),
|
|
316
|
+
"data-command-palette-shortcut": !0,
|
|
317
|
+
...u,
|
|
318
|
+
children: f.map((y, h) => /* @__PURE__ */ e(
|
|
319
|
+
"kbd",
|
|
320
|
+
{
|
|
321
|
+
className: i(
|
|
322
|
+
"inline-flex min-w-[20px] items-center justify-center rounded px-1 h-[20px] text-[10px] font-mono leading-none",
|
|
323
|
+
a ? "bg-white/20 text-white border border-white/30" : "bg-[#f4f5f7] text-[#6b7280] border border-[#d1d5db]"
|
|
324
|
+
),
|
|
325
|
+
children: y
|
|
326
|
+
},
|
|
327
|
+
`${y}-${h}`
|
|
328
|
+
))
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
$.displayName = "CommandPaletteShortcut";
|
|
333
|
+
function G({ className: s, ...a }) {
|
|
334
|
+
return /* @__PURE__ */ d(
|
|
335
|
+
"div",
|
|
336
|
+
{
|
|
337
|
+
"data-command-palette-empty": !0,
|
|
338
|
+
className: i(
|
|
339
|
+
"flex flex-col items-center justify-center py-12 text-center text-sm text-[#9ca3af]",
|
|
340
|
+
s
|
|
341
|
+
),
|
|
342
|
+
...a,
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ e(D, { className: "h-8 w-8 mb-3 text-[#d1d5db]" }),
|
|
345
|
+
/* @__PURE__ */ e("p", { className: "font-medium", children: "No results found" }),
|
|
346
|
+
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: "Try a different search term" })
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
G.displayName = "CommandPaletteEmpty";
|
|
352
|
+
function K({ className: s, ...a }) {
|
|
353
|
+
return /* @__PURE__ */ e(
|
|
354
|
+
"div",
|
|
355
|
+
{
|
|
356
|
+
"data-command-palette-separator": !0,
|
|
357
|
+
className: i("h-px bg-[#e5e7eb] mx-2", s),
|
|
358
|
+
...a
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
K.displayName = "CommandPaletteSeparator";
|
|
363
|
+
function L({ className: s, ...a }) {
|
|
364
|
+
return /* @__PURE__ */ d(
|
|
365
|
+
"div",
|
|
366
|
+
{
|
|
367
|
+
"data-command-palette-footer": !0,
|
|
368
|
+
className: i(
|
|
369
|
+
"flex items-center gap-4 border-t border-[#e5e7eb] px-4 py-2 text-[11px] text-[#9ca3af]",
|
|
370
|
+
s
|
|
371
|
+
),
|
|
372
|
+
...a,
|
|
373
|
+
children: [
|
|
374
|
+
/* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1", children: [
|
|
375
|
+
/* @__PURE__ */ e(v, { keys: ["↑"], size: "sm", variant: "muted" }),
|
|
376
|
+
/* @__PURE__ */ e(v, { keys: ["↓"], size: "sm", variant: "muted" }),
|
|
377
|
+
/* @__PURE__ */ e("span", { children: "Navigate" })
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1", children: [
|
|
380
|
+
/* @__PURE__ */ e(v, { keys: ["↵"], size: "sm", variant: "muted" }),
|
|
381
|
+
/* @__PURE__ */ e("span", { children: "Run" })
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1", children: [
|
|
384
|
+
/* @__PURE__ */ e(v, { keys: ["Escape"], size: "sm", variant: "muted" }),
|
|
385
|
+
/* @__PURE__ */ e("span", { children: "Close" })
|
|
386
|
+
] })
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
L.displayName = "CommandPaletteFooter";
|
|
392
|
+
export {
|
|
393
|
+
Z as CommandPalette,
|
|
394
|
+
G as CommandPaletteEmpty,
|
|
395
|
+
L as CommandPaletteFooter,
|
|
396
|
+
j as CommandPaletteGroup,
|
|
397
|
+
A as CommandPaletteInput,
|
|
398
|
+
q as CommandPaletteItem,
|
|
399
|
+
F as CommandPaletteList,
|
|
400
|
+
K as CommandPaletteSeparator,
|
|
401
|
+
$ as CommandPaletteShortcut
|
|
402
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Palette & Keyboard Shortcuts — Public API
|
|
3
|
+
*/
|
|
4
|
+
export type { ShortcutScope, KeyBinding, CommandDefinition, FuzzyResult, SerializedOverride, BrowserShortcutInfo, } from './utils';
|
|
5
|
+
export { isMac, getKeySymbol, keybindingToSymbols, keybindingToString, matchesKeybinding, parseKeybinding, keybindingsEqual, keybindingFromEvent, isReservedShortcut, getBrowserShortcutInfo, BROWSER_SHORTCUTS, fuzzyScore, fuzzyFilter, scopePriority, } from './utils';
|
|
6
|
+
export { ShortcutRegistry } from './shortcut-registry';
|
|
7
|
+
export type { RegistryChangeEvent, RegistryListener, ConflictInfo } from './shortcut-registry';
|
|
8
|
+
export { CommandPaletteProvider, useCommandPalette, } from './command-palette-context';
|
|
9
|
+
export type { CommandPaletteContextValue, CommandPaletteProviderProps } from './command-palette-context';
|
|
10
|
+
export { useShortcut } from './use-shortcut';
|
|
11
|
+
export type { UseShortcutOptions } from './use-shortcut';
|
|
12
|
+
export { useGlobalShortcut } from './use-global-shortcut';
|
|
13
|
+
export type { UseGlobalShortcutOptions } from './use-global-shortcut';
|
|
14
|
+
export { useBrowserShortcuts } from './use-browser-shortcuts';
|
|
15
|
+
export type { UseBrowserShortcutsOptions } from './use-browser-shortcuts';
|
|
16
|
+
export { ShortcutScopeProvider } from './shortcut-scope-provider';
|
|
17
|
+
export type { ShortcutScopeProviderProps } from './shortcut-scope-provider';
|
|
18
|
+
export { CommandPalette, CommandPaletteInput, CommandPaletteList, CommandPaletteGroup, CommandPaletteItem, CommandPaletteShortcut, CommandPaletteEmpty, CommandPaletteSeparator, CommandPaletteFooter, } from './command-palette';
|
|
19
|
+
export type { CommandPaletteProps, CommandPaletteInputProps, CommandPaletteGroupProps, CommandPaletteItemProps, CommandPaletteShortcutProps, } from './command-palette';
|
|
20
|
+
export { Kbd } from './kbd';
|
|
21
|
+
export type { KbdProps } from './kbd';
|
|
22
|
+
export { ShortcutSettings } from './shortcut-settings';
|
|
23
|
+
export type { ShortcutSettingsProps } from './shortcut-settings';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BROWSER_SHORTCUTS as o, fuzzyFilter as r, fuzzyScore as m, getBrowserShortcutInfo as a, getKeySymbol as n, isMac as i, isReservedShortcut as d, keybindingFromEvent as S, keybindingToString as s, keybindingToSymbols as u, keybindingsEqual as l, matchesKeybinding as p, parseKeybinding as c, scopePriority as y } from "./utils.js";
|
|
2
|
+
import { ShortcutRegistry as f } from "./shortcut-registry.js";
|
|
3
|
+
import { CommandPaletteProvider as g, useCommandPalette as b } from "./command-palette-context.js";
|
|
4
|
+
import { useShortcut as x } from "./use-shortcut.js";
|
|
5
|
+
import { useGlobalShortcut as k } from "./use-global-shortcut.js";
|
|
6
|
+
import { useBrowserShortcuts as z } from "./use-browser-shortcuts.js";
|
|
7
|
+
import { ShortcutScopeProvider as K } from "./shortcut-scope-provider.js";
|
|
8
|
+
import { CommandPalette as B, CommandPaletteEmpty as F, CommandPaletteFooter as I, CommandPaletteGroup as w, CommandPaletteInput as G, CommandPaletteItem as O, CommandPaletteList as q, CommandPaletteSeparator as H, CommandPaletteShortcut as L } from "./command-palette.js";
|
|
9
|
+
import { Kbd as U } from "./kbd.js";
|
|
10
|
+
import { ShortcutSettings as _ } from "./shortcut-settings.js";
|
|
11
|
+
export {
|
|
12
|
+
o as BROWSER_SHORTCUTS,
|
|
13
|
+
B as CommandPalette,
|
|
14
|
+
F as CommandPaletteEmpty,
|
|
15
|
+
I as CommandPaletteFooter,
|
|
16
|
+
w as CommandPaletteGroup,
|
|
17
|
+
G as CommandPaletteInput,
|
|
18
|
+
O as CommandPaletteItem,
|
|
19
|
+
q as CommandPaletteList,
|
|
20
|
+
g as CommandPaletteProvider,
|
|
21
|
+
H as CommandPaletteSeparator,
|
|
22
|
+
L as CommandPaletteShortcut,
|
|
23
|
+
U as Kbd,
|
|
24
|
+
f as ShortcutRegistry,
|
|
25
|
+
K as ShortcutScopeProvider,
|
|
26
|
+
_ as ShortcutSettings,
|
|
27
|
+
r as fuzzyFilter,
|
|
28
|
+
m as fuzzyScore,
|
|
29
|
+
a as getBrowserShortcutInfo,
|
|
30
|
+
n as getKeySymbol,
|
|
31
|
+
i as isMac,
|
|
32
|
+
d as isReservedShortcut,
|
|
33
|
+
S as keybindingFromEvent,
|
|
34
|
+
s as keybindingToString,
|
|
35
|
+
u as keybindingToSymbols,
|
|
36
|
+
l as keybindingsEqual,
|
|
37
|
+
p as matchesKeybinding,
|
|
38
|
+
c as parseKeybinding,
|
|
39
|
+
y as scopePriority,
|
|
40
|
+
z as useBrowserShortcuts,
|
|
41
|
+
b as useCommandPalette,
|
|
42
|
+
k as useGlobalShortcut,
|
|
43
|
+
x as useShortcut
|
|
44
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { KeyBinding } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* Kbd — Keyboard key badge component.
|
|
5
|
+
*
|
|
6
|
+
* Renders individual key caps (e.g. ⌘, ⇧, K) as styled <kbd> elements.
|
|
7
|
+
* Automatically maps modifier names to platform-appropriate symbols.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* <Kbd keys={['meta', 'shift', 'P']} />
|
|
11
|
+
* // Renders: [⌘] [⇧] [P] on Mac, [Ctrl] [Shift] [P] on Windows
|
|
12
|
+
*
|
|
13
|
+
* <Kbd keybinding={{ key: 'k', meta: true }} />
|
|
14
|
+
* // Renders: [⌘] [K] on Mac, [Ctrl] [K] on Windows
|
|
15
|
+
*/
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
declare const kbdVariants: (props?: {
|
|
18
|
+
size?: "sm" | "lg" | "default";
|
|
19
|
+
variant?: "default" | "dark" | "muted";
|
|
20
|
+
} & import('class-variance-authority/types').ClassProp) => string;
|
|
21
|
+
export interface KbdProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'>, VariantProps<typeof kbdVariants> {
|
|
22
|
+
/** Array of key names/symbols to render. e.g. ['meta', 'shift', 'P'] */
|
|
23
|
+
keys?: string[];
|
|
24
|
+
/** Or provide a KeyBinding object directly */
|
|
25
|
+
keybinding?: KeyBinding;
|
|
26
|
+
}
|
|
27
|
+
declare const Kbd: React.ForwardRefExoticComponent<KbdProps & React.RefAttributes<HTMLElement>>;
|
|
28
|
+
export { Kbd, kbdVariants };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { cva as l } from "class-variance-authority";
|
|
4
|
+
import { cn as o } from "../../../lib/utils.js";
|
|
5
|
+
import { keybindingToSymbols as b, getKeySymbol as c } from "./utils.js";
|
|
6
|
+
const u = l(
|
|
7
|
+
"inline-flex items-center justify-center rounded border font-mono leading-none select-none",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "min-w-[18px] h-[18px] px-1 text-[10px]",
|
|
12
|
+
default: "min-w-[22px] h-[22px] px-1.5 text-[11px]",
|
|
13
|
+
lg: "min-w-[26px] h-[26px] px-2 text-xs"
|
|
14
|
+
},
|
|
15
|
+
variant: {
|
|
16
|
+
default: "bg-[#f4f5f7] border-[#d1d5db] text-[#374151] shadow-[0_1px_0_0_#d1d5db]",
|
|
17
|
+
muted: "bg-[#e5e7eb] border-[#d1d5db] text-[#6b7280]",
|
|
18
|
+
dark: "bg-[#374151] border-[#4b5563] text-[#e5e7eb] shadow-[0_1px_0_0_#1f2937]"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
size: "default",
|
|
23
|
+
variant: "default"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
), h = d.forwardRef(
|
|
27
|
+
({ className: i, keys: t, keybinding: r, size: m, variant: p, ...s }, x) => {
|
|
28
|
+
const n = d.useMemo(() => r ? b(r) : t ? t.map((e) => c(e)) : [], [t, r]);
|
|
29
|
+
return n.length === 0 ? null : /* @__PURE__ */ a(
|
|
30
|
+
"span",
|
|
31
|
+
{
|
|
32
|
+
ref: x,
|
|
33
|
+
className: o("inline-flex items-center gap-0.5", i),
|
|
34
|
+
"data-component": "kbd",
|
|
35
|
+
...s,
|
|
36
|
+
children: n.map((e, f) => /* @__PURE__ */ a(
|
|
37
|
+
"kbd",
|
|
38
|
+
{
|
|
39
|
+
className: o(u({ size: m, variant: p })),
|
|
40
|
+
children: e
|
|
41
|
+
},
|
|
42
|
+
`${e}-${f}`
|
|
43
|
+
))
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
h.displayName = "Kbd";
|
|
49
|
+
export {
|
|
50
|
+
h as Kbd,
|
|
51
|
+
u as kbdVariants
|
|
52
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CommandDefinition, KeyBinding, ShortcutScope } from './utils';
|
|
2
|
+
export type RegistryChangeEvent = {
|
|
3
|
+
type: 'register' | 'unregister' | 'update-keybinding' | 'reset-keybinding' | 'scope-change';
|
|
4
|
+
commandId?: string;
|
|
5
|
+
};
|
|
6
|
+
export type RegistryListener = (event: RegistryChangeEvent) => void;
|
|
7
|
+
export interface ConflictInfo {
|
|
8
|
+
conflictingCommandId: string;
|
|
9
|
+
conflictingLabel: string;
|
|
10
|
+
scope: ShortcutScope;
|
|
11
|
+
}
|
|
12
|
+
export declare class ShortcutRegistry {
|
|
13
|
+
private commands;
|
|
14
|
+
private overrides;
|
|
15
|
+
private recentCommandIds;
|
|
16
|
+
private listeners;
|
|
17
|
+
private activeScopes;
|
|
18
|
+
private activeInstance;
|
|
19
|
+
constructor();
|
|
20
|
+
setActiveInstance(instance: string | null): void;
|
|
21
|
+
getActiveInstance(): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Get all unique instance identifiers currently registered.
|
|
24
|
+
*/
|
|
25
|
+
getRegisteredInstances(): string[];
|
|
26
|
+
register(command: CommandDefinition): void;
|
|
27
|
+
unregister(commandId: string): void;
|
|
28
|
+
getEffectiveKeybinding(commandId: string): KeyBinding | undefined;
|
|
29
|
+
updateKeybinding(commandId: string, keybinding: KeyBinding): {
|
|
30
|
+
success: boolean;
|
|
31
|
+
conflict?: ConflictInfo;
|
|
32
|
+
reserved?: boolean;
|
|
33
|
+
};
|
|
34
|
+
resetKeybinding(commandId: string): void;
|
|
35
|
+
findConflict(commandId: string, keybinding: KeyBinding, scope: ShortcutScope): ConflictInfo | null;
|
|
36
|
+
pushScope(scope: ShortcutScope): void;
|
|
37
|
+
popScope(scope: ShortcutScope): void;
|
|
38
|
+
getActiveScopes(): ShortcutScope[];
|
|
39
|
+
getHighestActiveScope(): ShortcutScope;
|
|
40
|
+
getCommand(id: string): CommandDefinition | undefined;
|
|
41
|
+
getAllCommands(): CommandDefinition[];
|
|
42
|
+
/**
|
|
43
|
+
* Get commands visible in the command palette.
|
|
44
|
+
* Instance-scoped commands are filtered (only active instance shows unless
|
|
45
|
+
* there's only one instance, in which case it always shows).
|
|
46
|
+
* When multiple instances exist, labels are auto-prefixed with the instance name.
|
|
47
|
+
*/
|
|
48
|
+
getPaletteCommands(): CommandDefinition[];
|
|
49
|
+
/**
|
|
50
|
+
* Get commands for the settings panel (all registered, including hidden).
|
|
51
|
+
*/
|
|
52
|
+
getSettingsCommands(): CommandDefinition[];
|
|
53
|
+
/**
|
|
54
|
+
* Handle a keyboard event. Finds the highest-priority matching command
|
|
55
|
+
* and executes its handler.
|
|
56
|
+
*
|
|
57
|
+
* @returns true if a command was executed, false otherwise
|
|
58
|
+
*/
|
|
59
|
+
handleKeyEvent(event: KeyboardEvent): boolean;
|
|
60
|
+
getRecentCommandIds(): string[];
|
|
61
|
+
addRecentCommand(commandId: string): void;
|
|
62
|
+
subscribe(listener: RegistryListener): () => void;
|
|
63
|
+
private emit;
|
|
64
|
+
private loadOverrides;
|
|
65
|
+
private saveOverrides;
|
|
66
|
+
private loadRecentCommands;
|
|
67
|
+
private saveRecentCommands;
|
|
68
|
+
}
|