mal-ui 0.1.3
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 +244 -0
- package/dist/carousel/extensions.d.ts +1 -0
- package/dist/carousel/index.d.ts +2 -0
- package/dist/carousel/index.js +424 -0
- package/dist/carousel/index.js.map +15 -0
- package/dist/charts/extensions.d.ts +1 -0
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.js +3499 -0
- package/dist/charts/index.js.map +53 -0
- package/dist/chunks/index-3ffbn0gc.js +29976 -0
- package/dist/chunks/index-3ffbn0gc.js.map +637 -0
- package/dist/chunks/index-6b5mapr4.js +2 -0
- package/dist/chunks/index-6b5mapr4.js.map +9 -0
- package/dist/chunks/index-6tm93gww.js +38 -0
- package/dist/chunks/index-6tm93gww.js.map +10 -0
- package/dist/chunks/index-cg10ezdx.js +2 -0
- package/dist/chunks/index-cg10ezdx.js.map +9 -0
- package/dist/chunks/index-mc01z7m9.js +48 -0
- package/dist/chunks/index-mc01z7m9.js.map +9 -0
- package/dist/chunks/index-rz8zh7g4.js +5015 -0
- package/dist/chunks/index-rz8zh7g4.js.map +113 -0
- package/dist/chunks/index-syjq3515.js +4893 -0
- package/dist/chunks/index-syjq3515.js.map +101 -0
- package/dist/chunks/index-w9ekv5h5.js +733 -0
- package/dist/chunks/index-w9ekv5h5.js.map +17 -0
- package/dist/code-highlight/extensions.d.ts +1 -0
- package/dist/code-highlight/index.d.ts +2 -0
- package/dist/code-highlight/index.js +1685 -0
- package/dist/code-highlight/index.js.map +25 -0
- package/dist/core/extensions.d.ts +2 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +844 -0
- package/dist/core/index.js.map +9 -0
- package/dist/dates/extensions.d.ts +1 -0
- package/dist/dates/index.d.ts +2 -0
- package/dist/dates/index.js +107 -0
- package/dist/dates/index.js.map +9 -0
- package/dist/dropzone/extensions.d.ts +1 -0
- package/dist/dropzone/index.d.ts +2 -0
- package/dist/dropzone/index.js +2681 -0
- package/dist/dropzone/index.js.map +21 -0
- package/dist/form/extensions.d.ts +1 -0
- package/dist/form/index.d.ts +2 -0
- package/dist/form/index.js +1605 -0
- package/dist/form/index.js.map +51 -0
- package/dist/hooks/extensions.d.ts +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +214 -0
- package/dist/hooks/index.js.map +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1052 -0
- package/dist/index.js.map +9 -0
- package/dist/modals/extensions.d.ts +1 -0
- package/dist/modals/index.d.ts +2 -0
- package/dist/modals/index.js +387 -0
- package/dist/modals/index.js.map +15 -0
- package/dist/notifications/extensions.d.ts +1 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +1122 -0
- package/dist/notifications/index.js.map +28 -0
- package/dist/nprogress/extensions.d.ts +1 -0
- package/dist/nprogress/index.d.ts +2 -0
- package/dist/nprogress/index.js +207 -0
- package/dist/nprogress/index.js.map +12 -0
- package/dist/schedule/extensions.d.ts +1 -0
- package/dist/schedule/index.d.ts +2 -0
- package/dist/schedule/index.js +8569 -0
- package/dist/schedule/index.js.map +135 -0
- package/dist/spotlight/extensions.d.ts +1 -0
- package/dist/spotlight/index.d.ts +2 -0
- package/dist/spotlight/index.js +666 -0
- package/dist/spotlight/index.js.map +24 -0
- package/dist/styles.css +1 -0
- package/dist/theme/index.d.ts +13 -0
- package/dist/theme/index.js +202 -0
- package/dist/theme/index.js.map +11 -0
- package/dist/theme/tokens.d.ts +65 -0
- package/dist/tiptap/extensions.d.ts +1 -0
- package/dist/tiptap/index.d.ts +2 -0
- package/dist/tiptap/index.js +1549 -0
- package/dist/tiptap/index.js.map +25 -0
- package/package.json +163 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
createStore,
|
|
4
|
+
useStore
|
|
5
|
+
} from "../chunks/index-6tm93gww.js";
|
|
6
|
+
import {
|
|
7
|
+
Box,
|
|
8
|
+
Highlight,
|
|
9
|
+
Input,
|
|
10
|
+
Modal,
|
|
11
|
+
ScrollArea,
|
|
12
|
+
UnstyledButton,
|
|
13
|
+
createSafeContext,
|
|
14
|
+
factory,
|
|
15
|
+
getDefaultZIndex,
|
|
16
|
+
rem,
|
|
17
|
+
useProps,
|
|
18
|
+
useResolvedStylesApi,
|
|
19
|
+
useStyles
|
|
20
|
+
} from "../chunks/index-3ffbn0gc.js";
|
|
21
|
+
import {
|
|
22
|
+
clamp,
|
|
23
|
+
useDidUpdate,
|
|
24
|
+
useHotkeys,
|
|
25
|
+
useUncontrolled
|
|
26
|
+
} from "../chunks/index-syjq3515.js";
|
|
27
|
+
import"../chunks/index-mc01z7m9.js";
|
|
28
|
+
|
|
29
|
+
// node_modules/@mantine/spotlight/esm/spotlight.store.mjs
|
|
30
|
+
|
|
31
|
+
var createSpotlightStore = () => createStore({
|
|
32
|
+
opened: false,
|
|
33
|
+
empty: false,
|
|
34
|
+
selected: -1,
|
|
35
|
+
listId: "",
|
|
36
|
+
query: "",
|
|
37
|
+
registeredActions: /* @__PURE__ */ new Set
|
|
38
|
+
});
|
|
39
|
+
var useSpotlight = (store) => useStore(store);
|
|
40
|
+
function updateSpotlightStateAction(update, store) {
|
|
41
|
+
const state = store.getState();
|
|
42
|
+
store.setState({
|
|
43
|
+
...state,
|
|
44
|
+
...update(store.getState())
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function openSpotlightAction(store) {
|
|
48
|
+
updateSpotlightStateAction(() => ({
|
|
49
|
+
opened: true,
|
|
50
|
+
selected: -1
|
|
51
|
+
}), store);
|
|
52
|
+
}
|
|
53
|
+
function closeSpotlightAction(store) {
|
|
54
|
+
updateSpotlightStateAction(() => ({ opened: false }), store);
|
|
55
|
+
}
|
|
56
|
+
function toggleSpotlightAction(store) {
|
|
57
|
+
updateSpotlightStateAction((state) => ({
|
|
58
|
+
opened: !state.opened,
|
|
59
|
+
selected: state.opened ? state.selected : -1
|
|
60
|
+
}), store);
|
|
61
|
+
}
|
|
62
|
+
function setSelectedAction(index, store) {
|
|
63
|
+
store.updateState((state) => ({
|
|
64
|
+
...state,
|
|
65
|
+
selected: index
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
function setListId(id, store) {
|
|
69
|
+
store.updateState((state) => ({
|
|
70
|
+
...state,
|
|
71
|
+
listId: id
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
function findElementByQuerySelector(selector, root = document) {
|
|
75
|
+
const element = root.querySelector(selector);
|
|
76
|
+
if (element)
|
|
77
|
+
return element;
|
|
78
|
+
const children = root instanceof ShadowRoot ? root.host.children : root.children;
|
|
79
|
+
for (let i = 0;i < children.length; i += 1) {
|
|
80
|
+
const child = children[i];
|
|
81
|
+
if (child.shadowRoot) {
|
|
82
|
+
const shadowElement = findElementByQuerySelector(selector, child.shadowRoot);
|
|
83
|
+
if (shadowElement)
|
|
84
|
+
return shadowElement;
|
|
85
|
+
}
|
|
86
|
+
const nestedElement = findElementByQuerySelector(selector, child);
|
|
87
|
+
if (nestedElement)
|
|
88
|
+
return nestedElement;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
function selectAction(index, store) {
|
|
93
|
+
const state = store.getState();
|
|
94
|
+
const actionsList = state.listId ? findElementByQuerySelector(`#${state.listId}`) : null;
|
|
95
|
+
const selected = actionsList?.querySelector("[data-selected]");
|
|
96
|
+
const actions = actionsList?.querySelectorAll("[data-action]") ?? [];
|
|
97
|
+
const selectedIndex = clamp(index === -1 ? actions.length - 1 : index === actions.length ? 0 : index, 0, actions.length - 1);
|
|
98
|
+
selected?.removeAttribute("data-selected");
|
|
99
|
+
actions[selectedIndex]?.scrollIntoView({ block: "nearest" });
|
|
100
|
+
actions[selectedIndex]?.setAttribute("data-selected", "true");
|
|
101
|
+
setSelectedAction(selectedIndex, store);
|
|
102
|
+
return selectedIndex;
|
|
103
|
+
}
|
|
104
|
+
function selectNextAction(store) {
|
|
105
|
+
return selectAction(store.getState().selected + 1, store);
|
|
106
|
+
}
|
|
107
|
+
function selectPreviousAction(store) {
|
|
108
|
+
return selectAction(store.getState().selected - 1, store);
|
|
109
|
+
}
|
|
110
|
+
function triggerSelectedAction(store) {
|
|
111
|
+
const state = store.getState();
|
|
112
|
+
(state.listId ? findElementByQuerySelector(`#${state.listId} [data-selected]`) : null)?.click();
|
|
113
|
+
}
|
|
114
|
+
function registerAction(id, store) {
|
|
115
|
+
const state = store.getState();
|
|
116
|
+
state.registeredActions.add(id);
|
|
117
|
+
return () => {
|
|
118
|
+
state.registeredActions.delete(id);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function setQuery(query, store) {
|
|
122
|
+
updateSpotlightStateAction(() => ({ query }), store);
|
|
123
|
+
Promise.resolve().then(() => {
|
|
124
|
+
selectAction(0, store);
|
|
125
|
+
updateSpotlightStateAction((state) => ({ empty: state.query.trim().length > 0 && state.registeredActions.size === 0 || false }), store);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function clearSpotlightState({ clearQuery }, store) {
|
|
129
|
+
store.updateState((state) => ({
|
|
130
|
+
...state,
|
|
131
|
+
selected: -1,
|
|
132
|
+
query: clearQuery ? "" : state.query,
|
|
133
|
+
empty: clearQuery ? false : state.empty
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
var spotlightActions = {
|
|
137
|
+
open: openSpotlightAction,
|
|
138
|
+
close: closeSpotlightAction,
|
|
139
|
+
toggle: toggleSpotlightAction,
|
|
140
|
+
updateState: updateSpotlightStateAction,
|
|
141
|
+
setSelectedAction,
|
|
142
|
+
setListId,
|
|
143
|
+
selectAction,
|
|
144
|
+
selectNextAction,
|
|
145
|
+
selectPreviousAction,
|
|
146
|
+
triggerSelectedAction,
|
|
147
|
+
registerAction,
|
|
148
|
+
setQuery,
|
|
149
|
+
clearSpotlightState
|
|
150
|
+
};
|
|
151
|
+
function createSpotlight() {
|
|
152
|
+
const store = createSpotlightStore();
|
|
153
|
+
return [store, {
|
|
154
|
+
open: () => openSpotlightAction(store),
|
|
155
|
+
close: () => closeSpotlightAction(store),
|
|
156
|
+
toggle: () => toggleSpotlightAction(store)
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
var [spotlightStore, spotlight] = createSpotlight();
|
|
160
|
+
var { open: openSpotlight, close: closeSpotlight, toggle: toggleSpotlight } = spotlight;
|
|
161
|
+
|
|
162
|
+
// node_modules/@mantine/spotlight/esm/is-actions-group.mjs
|
|
163
|
+
|
|
164
|
+
function isActionsGroup(item) {
|
|
165
|
+
const _item = item;
|
|
166
|
+
return _item.group !== undefined && Array.isArray(_item.actions);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// node_modules/@mantine/spotlight/esm/Spotlight.context.mjs
|
|
170
|
+
|
|
171
|
+
var [SpotlightProvider, useSpotlightContext] = createSafeContext("Spotlight component was not found in tree");
|
|
172
|
+
|
|
173
|
+
// node_modules/@mantine/spotlight/esm/Spotlight.module.mjs
|
|
174
|
+
|
|
175
|
+
var Spotlight_module_default = {
|
|
176
|
+
root: "m_d2b315db",
|
|
177
|
+
content: "m_3cd250e0",
|
|
178
|
+
body: "m_d2abce9b",
|
|
179
|
+
search: "m_f366a061",
|
|
180
|
+
actionsList: "m_6e463822",
|
|
181
|
+
action: "m_d49bb8ef",
|
|
182
|
+
actionBody: "m_3d475731",
|
|
183
|
+
actionSection: "m_832642f6",
|
|
184
|
+
actionLabel: "m_6c2a1345",
|
|
185
|
+
actionDescription: "m_a6d9d78d",
|
|
186
|
+
empty: "m_82f78f74",
|
|
187
|
+
footer: "m_ddcaf054",
|
|
188
|
+
actionsGroup: "m_5a3e5f7b"
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// node_modules/@mantine/spotlight/esm/SpotlightAction.mjs
|
|
192
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
193
|
+
|
|
194
|
+
var defaultProps = {
|
|
195
|
+
dimmedSections: true,
|
|
196
|
+
highlightQuery: false
|
|
197
|
+
};
|
|
198
|
+
var SpotlightAction = factory((_props) => {
|
|
199
|
+
const { className, style, classNames, styles, id, description, label, leftSection, rightSection, children, dimmedSections, highlightQuery, highlightColor, closeSpotlightOnTrigger, onClick, onMouseDown, keywords, vars, ...others } = useProps("SpotlightAction", defaultProps, _props);
|
|
200
|
+
const ctx = useSpotlightContext();
|
|
201
|
+
const stylesApi = {
|
|
202
|
+
classNames,
|
|
203
|
+
styles
|
|
204
|
+
};
|
|
205
|
+
const labelNode = highlightQuery && typeof label === "string" ? /* @__PURE__ */ jsx(Highlight, {
|
|
206
|
+
component: "span",
|
|
207
|
+
highlight: ctx.query,
|
|
208
|
+
color: highlightColor,
|
|
209
|
+
...ctx.getStyles("actionLabel", stylesApi),
|
|
210
|
+
children: label
|
|
211
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
212
|
+
...ctx.getStyles("actionLabel", stylesApi),
|
|
213
|
+
children: label
|
|
214
|
+
});
|
|
215
|
+
return /* @__PURE__ */ jsx(UnstyledButton, {
|
|
216
|
+
"data-action": true,
|
|
217
|
+
...ctx.getStyles("action", {
|
|
218
|
+
className,
|
|
219
|
+
style,
|
|
220
|
+
...stylesApi
|
|
221
|
+
}),
|
|
222
|
+
...others,
|
|
223
|
+
onMouseDown: (event) => {
|
|
224
|
+
event.preventDefault();
|
|
225
|
+
onMouseDown?.(event);
|
|
226
|
+
},
|
|
227
|
+
onClick: (event) => {
|
|
228
|
+
onClick?.(event);
|
|
229
|
+
if (closeSpotlightOnTrigger ?? ctx.closeOnActionTrigger)
|
|
230
|
+
spotlightActions.close(ctx.store);
|
|
231
|
+
},
|
|
232
|
+
tabIndex: -1,
|
|
233
|
+
children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
234
|
+
leftSection && /* @__PURE__ */ jsx(Box, {
|
|
235
|
+
component: "span",
|
|
236
|
+
mod: {
|
|
237
|
+
position: "left",
|
|
238
|
+
dimmed: dimmedSections
|
|
239
|
+
},
|
|
240
|
+
...ctx.getStyles("actionSection", stylesApi),
|
|
241
|
+
children: leftSection
|
|
242
|
+
}),
|
|
243
|
+
/* @__PURE__ */ jsxs("span", {
|
|
244
|
+
...ctx.getStyles("actionBody", stylesApi),
|
|
245
|
+
children: [labelNode, /* @__PURE__ */ jsx("span", {
|
|
246
|
+
...ctx.getStyles("actionDescription", stylesApi),
|
|
247
|
+
children: description
|
|
248
|
+
})]
|
|
249
|
+
}),
|
|
250
|
+
rightSection && /* @__PURE__ */ jsx(Box, {
|
|
251
|
+
component: "span",
|
|
252
|
+
mod: {
|
|
253
|
+
position: "right",
|
|
254
|
+
dimmed: dimmedSections
|
|
255
|
+
},
|
|
256
|
+
...ctx.getStyles("actionSection", stylesApi),
|
|
257
|
+
children: rightSection
|
|
258
|
+
})
|
|
259
|
+
] })
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
SpotlightAction.classes = Spotlight_module_default;
|
|
263
|
+
SpotlightAction.displayName = "@mantine/spotlight/SpotlightAction";
|
|
264
|
+
|
|
265
|
+
// node_modules/@mantine/spotlight/esm/SpotlightActionsGroup.mjs
|
|
266
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
267
|
+
|
|
268
|
+
var SpotlightActionsGroup = factory((props) => {
|
|
269
|
+
const { className, style, styles, classNames, label, children, ...others } = useProps("SpotlightActionsGroup", null, props);
|
|
270
|
+
return /* @__PURE__ */ jsx2(Box, {
|
|
271
|
+
...useSpotlightContext().getStyles("actionsGroup", {
|
|
272
|
+
className,
|
|
273
|
+
style,
|
|
274
|
+
classNames,
|
|
275
|
+
styles
|
|
276
|
+
}),
|
|
277
|
+
...others,
|
|
278
|
+
__vars: { "--spotlight-label": `'${label?.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'` },
|
|
279
|
+
children
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
SpotlightActionsGroup.classes = Spotlight_module_default;
|
|
283
|
+
SpotlightActionsGroup.displayName = "@mantine/core/SpotlightActionsGroup";
|
|
284
|
+
|
|
285
|
+
// node_modules/@mantine/spotlight/esm/SpotlightActionsList.mjs
|
|
286
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
287
|
+
import { useEffect, useId } from "react";
|
|
288
|
+
|
|
289
|
+
var SpotlightActionsList = factory((props) => {
|
|
290
|
+
const { className, style, id, children, vars, classNames, styles, ...others } = useProps("SpotlightActionsList", null, props);
|
|
291
|
+
const ctx = useSpotlightContext();
|
|
292
|
+
const generatedId = `mantine-${useId().replace(/:/g, "")}`;
|
|
293
|
+
const listId = id || generatedId;
|
|
294
|
+
useEffect(() => {
|
|
295
|
+
spotlightActions.setListId(listId, ctx.store);
|
|
296
|
+
return () => spotlightActions.setListId("", ctx.store);
|
|
297
|
+
}, []);
|
|
298
|
+
return /* @__PURE__ */ jsx3(ScrollArea.Autosize, {
|
|
299
|
+
...ctx.getStyles("actionsList", {
|
|
300
|
+
className,
|
|
301
|
+
style,
|
|
302
|
+
classNames,
|
|
303
|
+
styles
|
|
304
|
+
}),
|
|
305
|
+
type: "scroll",
|
|
306
|
+
scrollbarSize: "var(--spotlight-actions-list-padding)",
|
|
307
|
+
offsetScrollbars: "y",
|
|
308
|
+
id: listId,
|
|
309
|
+
...others,
|
|
310
|
+
children
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
SpotlightActionsList.classes = Spotlight_module_default;
|
|
314
|
+
SpotlightActionsList.displayName = "@mantine/spotlight/SpotlightActionsList";
|
|
315
|
+
|
|
316
|
+
// node_modules/@mantine/spotlight/esm/SpotlightEmpty.mjs
|
|
317
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
318
|
+
|
|
319
|
+
var SpotlightEmpty = factory((props) => {
|
|
320
|
+
const { className, style, classNames, styles, ...others } = useProps("SpotlightEmpty", null, props);
|
|
321
|
+
return /* @__PURE__ */ jsx4(Box, {
|
|
322
|
+
...useSpotlightContext().getStyles("empty", {
|
|
323
|
+
classNames,
|
|
324
|
+
styles,
|
|
325
|
+
className,
|
|
326
|
+
style
|
|
327
|
+
}),
|
|
328
|
+
...others
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
SpotlightEmpty.classes = Spotlight_module_default;
|
|
332
|
+
SpotlightEmpty.displayName = "@mantine/spotlight/SpotlightEmpty";
|
|
333
|
+
|
|
334
|
+
// node_modules/@mantine/spotlight/esm/SpotlightFooter.mjs
|
|
335
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
336
|
+
|
|
337
|
+
var SpotlightFooter = factory((props) => {
|
|
338
|
+
const { className, style, classNames, styles, ...others } = useProps("SpotlightFooter", null, props);
|
|
339
|
+
return /* @__PURE__ */ jsx5(Box, {
|
|
340
|
+
...useSpotlightContext().getStyles("footer", {
|
|
341
|
+
className,
|
|
342
|
+
classNames,
|
|
343
|
+
style,
|
|
344
|
+
styles
|
|
345
|
+
}),
|
|
346
|
+
...others
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
SpotlightFooter.classes = Spotlight_module_default;
|
|
350
|
+
SpotlightFooter.displayName = "@mantine/spotlight/SpotlightFooter";
|
|
351
|
+
|
|
352
|
+
// node_modules/@mantine/spotlight/esm/get-hotkeys.mjs
|
|
353
|
+
|
|
354
|
+
function getHotkeys(hotkeys, store) {
|
|
355
|
+
if (!hotkeys)
|
|
356
|
+
return [];
|
|
357
|
+
const open = () => spotlightActions.open(store);
|
|
358
|
+
if (Array.isArray(hotkeys))
|
|
359
|
+
return hotkeys.map((hotkey) => [hotkey, open]);
|
|
360
|
+
return [[hotkeys, open]];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// node_modules/@mantine/spotlight/esm/SpotlightRoot.mjs
|
|
364
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
365
|
+
|
|
366
|
+
var defaultProps2 = {
|
|
367
|
+
size: 600,
|
|
368
|
+
yOffset: 80,
|
|
369
|
+
zIndex: getDefaultZIndex("max"),
|
|
370
|
+
overlayProps: {
|
|
371
|
+
backgroundOpacity: 0.35,
|
|
372
|
+
blur: 7
|
|
373
|
+
},
|
|
374
|
+
transitionProps: {
|
|
375
|
+
duration: 200,
|
|
376
|
+
transition: "pop"
|
|
377
|
+
},
|
|
378
|
+
store: spotlightStore,
|
|
379
|
+
clearQueryOnClose: true,
|
|
380
|
+
closeOnActionTrigger: true,
|
|
381
|
+
shortcut: "mod + K",
|
|
382
|
+
maxHeight: 400
|
|
383
|
+
};
|
|
384
|
+
var SpotlightRoot = factory((_props) => {
|
|
385
|
+
const props = useProps("SpotlightRoot", defaultProps2, _props);
|
|
386
|
+
const { classNames, className, style, styles, unstyled, vars, store, children, query, onQueryChange, transitionProps, clearQueryOnClose, shortcut, tagsToIgnore, triggerOnContentEditable, disabled, onSpotlightOpen, onSpotlightClose, forceOpened, closeOnActionTrigger, maxHeight, scrollable, attributes, ...others } = props;
|
|
387
|
+
const { opened, query: storeQuery } = useSpotlight(store);
|
|
388
|
+
const _query = typeof query === "string" ? query : storeQuery;
|
|
389
|
+
const setQuery2 = (q) => {
|
|
390
|
+
onQueryChange?.(q);
|
|
391
|
+
spotlightActions.setQuery(q, store);
|
|
392
|
+
};
|
|
393
|
+
const getStyles = useStyles({
|
|
394
|
+
name: "Spotlight",
|
|
395
|
+
classes: Spotlight_module_default,
|
|
396
|
+
props,
|
|
397
|
+
className,
|
|
398
|
+
style,
|
|
399
|
+
classNames,
|
|
400
|
+
styles,
|
|
401
|
+
unstyled,
|
|
402
|
+
attributes
|
|
403
|
+
});
|
|
404
|
+
const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi({
|
|
405
|
+
classNames,
|
|
406
|
+
styles,
|
|
407
|
+
props
|
|
408
|
+
});
|
|
409
|
+
useHotkeys(getHotkeys(shortcut, store), tagsToIgnore, triggerOnContentEditable);
|
|
410
|
+
useDidUpdate(() => {
|
|
411
|
+
opened ? onSpotlightOpen?.() : onSpotlightClose?.();
|
|
412
|
+
}, [opened]);
|
|
413
|
+
if (disabled)
|
|
414
|
+
return null;
|
|
415
|
+
return /* @__PURE__ */ jsx6(SpotlightProvider, {
|
|
416
|
+
value: {
|
|
417
|
+
getStyles,
|
|
418
|
+
query: _query,
|
|
419
|
+
setQuery: setQuery2,
|
|
420
|
+
store,
|
|
421
|
+
closeOnActionTrigger
|
|
422
|
+
},
|
|
423
|
+
children: /* @__PURE__ */ jsx6(Modal, {
|
|
424
|
+
...others,
|
|
425
|
+
withCloseButton: false,
|
|
426
|
+
opened: opened || !!forceOpened,
|
|
427
|
+
padding: 0,
|
|
428
|
+
onClose: () => spotlightActions.close(store),
|
|
429
|
+
className,
|
|
430
|
+
style,
|
|
431
|
+
classNames: resolvedClassNames,
|
|
432
|
+
styles: resolvedStyles,
|
|
433
|
+
attributes,
|
|
434
|
+
transitionProps: {
|
|
435
|
+
...transitionProps,
|
|
436
|
+
onExited: () => {
|
|
437
|
+
clearQueryOnClose && setQuery2("");
|
|
438
|
+
spotlightActions.clearSpotlightState({ clearQuery: clearQueryOnClose }, store);
|
|
439
|
+
transitionProps?.onExited?.();
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
__vars: { "--spotlight-max-height": scrollable ? rem(maxHeight) : undefined },
|
|
443
|
+
__staticSelector: "Spotlight",
|
|
444
|
+
"data-scrollable": scrollable || undefined,
|
|
445
|
+
children
|
|
446
|
+
})
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
SpotlightRoot.classes = Spotlight_module_default;
|
|
450
|
+
SpotlightRoot.displayName = "@mantine/spotlight/SpotlightRoot";
|
|
451
|
+
|
|
452
|
+
// node_modules/@mantine/spotlight/esm/SpotlightSearch.mjs
|
|
453
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
454
|
+
import { useState } from "react";
|
|
455
|
+
|
|
456
|
+
var defaultProps3 = { size: "lg" };
|
|
457
|
+
var SpotlightSearch = factory((props) => {
|
|
458
|
+
const { classNames, styles, onKeyDown, onChange, vars, value, attributes, ...others } = useProps("SpotlightSearch", defaultProps3, props);
|
|
459
|
+
const ctx = useSpotlightContext();
|
|
460
|
+
const inputStyles = ctx.getStyles("search");
|
|
461
|
+
const [isComposing, setIsComposing] = useState(false);
|
|
462
|
+
const handleKeyDown = (event) => {
|
|
463
|
+
onKeyDown?.(event);
|
|
464
|
+
if (isComposing)
|
|
465
|
+
return;
|
|
466
|
+
if (event.nativeEvent.code === "ArrowDown") {
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
spotlightActions.selectNextAction(ctx.store);
|
|
469
|
+
}
|
|
470
|
+
if (event.nativeEvent.code === "ArrowUp") {
|
|
471
|
+
event.preventDefault();
|
|
472
|
+
spotlightActions.selectPreviousAction(ctx.store);
|
|
473
|
+
}
|
|
474
|
+
if (event.nativeEvent.code === "Enter" || event.nativeEvent.code === "NumpadEnter") {
|
|
475
|
+
event.preventDefault();
|
|
476
|
+
spotlightActions.triggerSelectedAction(ctx.store);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
return /* @__PURE__ */ jsx7(Input, {
|
|
480
|
+
...inputStyles,
|
|
481
|
+
classNames: [{ input: inputStyles.className }, classNames],
|
|
482
|
+
styles: [{ input: inputStyles.style }, styles],
|
|
483
|
+
...others,
|
|
484
|
+
value: value ?? ctx.query,
|
|
485
|
+
onChange: (event) => {
|
|
486
|
+
ctx.setQuery(event.currentTarget.value);
|
|
487
|
+
onChange?.(event);
|
|
488
|
+
},
|
|
489
|
+
onKeyDown: handleKeyDown,
|
|
490
|
+
onCompositionStart: () => setIsComposing(true),
|
|
491
|
+
onCompositionEnd: () => setIsComposing(false)
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
SpotlightSearch.classes = Spotlight_module_default;
|
|
495
|
+
SpotlightSearch.displayName = "@mantine/spotlight/SpotlightSearch";
|
|
496
|
+
|
|
497
|
+
// node_modules/@mantine/spotlight/esm/default-spotlight-filter.mjs
|
|
498
|
+
|
|
499
|
+
function getKeywords(keywords) {
|
|
500
|
+
if (Array.isArray(keywords))
|
|
501
|
+
return keywords.map((keyword) => keyword.trim()).join(",").toLowerCase().trim();
|
|
502
|
+
if (typeof keywords === "string")
|
|
503
|
+
return keywords.toLowerCase().trim();
|
|
504
|
+
return "";
|
|
505
|
+
}
|
|
506
|
+
function getFlatActions(data) {
|
|
507
|
+
return data.reduce((acc, item) => {
|
|
508
|
+
if ("actions" in item)
|
|
509
|
+
return [...acc, ...item.actions.map((action) => ({
|
|
510
|
+
...action,
|
|
511
|
+
group: item.group
|
|
512
|
+
}))];
|
|
513
|
+
return [...acc, item];
|
|
514
|
+
}, []);
|
|
515
|
+
}
|
|
516
|
+
function flatActionsToGroups(data) {
|
|
517
|
+
const groups = {};
|
|
518
|
+
const result = [];
|
|
519
|
+
data.forEach((action) => {
|
|
520
|
+
if (action.group) {
|
|
521
|
+
if (!groups[action.group])
|
|
522
|
+
groups[action.group] = {
|
|
523
|
+
pushed: false,
|
|
524
|
+
data: {
|
|
525
|
+
group: action.group,
|
|
526
|
+
actions: []
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
groups[action.group].data.actions.push(action);
|
|
530
|
+
if (!groups[action.group].pushed) {
|
|
531
|
+
groups[action.group].pushed = true;
|
|
532
|
+
result.push(groups[action.group].data);
|
|
533
|
+
}
|
|
534
|
+
} else
|
|
535
|
+
result.push(action);
|
|
536
|
+
});
|
|
537
|
+
return result;
|
|
538
|
+
}
|
|
539
|
+
var defaultSpotlightFilter = (_query, data) => {
|
|
540
|
+
const query = _query.trim().toLowerCase();
|
|
541
|
+
const priorityMatrix = [[], []];
|
|
542
|
+
getFlatActions(data).forEach((item) => {
|
|
543
|
+
if (item.label?.toLowerCase().includes(query))
|
|
544
|
+
priorityMatrix[0].push(item);
|
|
545
|
+
else if (item.description?.toLowerCase().includes(query) || getKeywords(item.keywords).includes(query))
|
|
546
|
+
priorityMatrix[1].push(item);
|
|
547
|
+
});
|
|
548
|
+
return flatActionsToGroups(priorityMatrix.flat());
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// node_modules/@mantine/spotlight/esm/limit-actions.mjs
|
|
552
|
+
|
|
553
|
+
function limitActions(actions, limit) {
|
|
554
|
+
if (!Array.isArray(actions))
|
|
555
|
+
return [];
|
|
556
|
+
let count = 0;
|
|
557
|
+
return actions.reduce((acc, item) => {
|
|
558
|
+
if (count >= limit)
|
|
559
|
+
return acc;
|
|
560
|
+
if (isActionsGroup(item)) {
|
|
561
|
+
const groupActions = limitActions(item.actions, limit - count);
|
|
562
|
+
acc.push({
|
|
563
|
+
group: item.group,
|
|
564
|
+
actions: groupActions
|
|
565
|
+
});
|
|
566
|
+
count += groupActions.length;
|
|
567
|
+
} else {
|
|
568
|
+
acc.push(item);
|
|
569
|
+
count += 1;
|
|
570
|
+
}
|
|
571
|
+
return acc;
|
|
572
|
+
}, []);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// node_modules/@mantine/spotlight/esm/Spotlight.mjs
|
|
576
|
+
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
577
|
+
|
|
578
|
+
var defaultProps4 = {
|
|
579
|
+
size: 600,
|
|
580
|
+
yOffset: 80,
|
|
581
|
+
limit: Infinity,
|
|
582
|
+
zIndex: getDefaultZIndex("max"),
|
|
583
|
+
overlayProps: {
|
|
584
|
+
backgroundOpacity: 0.35,
|
|
585
|
+
blur: 7
|
|
586
|
+
},
|
|
587
|
+
transitionProps: {
|
|
588
|
+
duration: 200,
|
|
589
|
+
transition: "pop"
|
|
590
|
+
},
|
|
591
|
+
store: spotlightStore,
|
|
592
|
+
filter: defaultSpotlightFilter,
|
|
593
|
+
clearQueryOnClose: true,
|
|
594
|
+
closeOnActionTrigger: true,
|
|
595
|
+
shortcut: "mod + K"
|
|
596
|
+
};
|
|
597
|
+
var Spotlight = factory((_props) => {
|
|
598
|
+
const { searchProps, filter, query, onQueryChange, actions, nothingFound, highlightQuery, limit, scrollAreaProps, ...others } = useProps("Spotlight", defaultProps4, _props);
|
|
599
|
+
const [_query, setQuery2] = useUncontrolled({
|
|
600
|
+
value: query,
|
|
601
|
+
defaultValue: "",
|
|
602
|
+
finalValue: "",
|
|
603
|
+
onChange: onQueryChange
|
|
604
|
+
});
|
|
605
|
+
const filteredActions = limitActions(filter(_query, actions), limit).map((item) => {
|
|
606
|
+
if (isActionsGroup(item)) {
|
|
607
|
+
const items = item.actions.map(({ id, ...actionData }) => /* @__PURE__ */ jsx8(SpotlightAction, {
|
|
608
|
+
highlightQuery,
|
|
609
|
+
...actionData
|
|
610
|
+
}, id));
|
|
611
|
+
return /* @__PURE__ */ jsx8(SpotlightActionsGroup, {
|
|
612
|
+
label: item.group,
|
|
613
|
+
children: items
|
|
614
|
+
}, item.group);
|
|
615
|
+
}
|
|
616
|
+
return /* @__PURE__ */ jsx8(SpotlightAction, {
|
|
617
|
+
highlightQuery,
|
|
618
|
+
...item
|
|
619
|
+
}, item.id);
|
|
620
|
+
});
|
|
621
|
+
return /* @__PURE__ */ jsxs2(SpotlightRoot, {
|
|
622
|
+
...others,
|
|
623
|
+
query: _query,
|
|
624
|
+
onQueryChange: setQuery2,
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ jsx8(SpotlightSearch, { ...searchProps }),
|
|
627
|
+
filteredActions.length > 0 && /* @__PURE__ */ jsx8(SpotlightActionsList, {
|
|
628
|
+
...scrollAreaProps,
|
|
629
|
+
children: filteredActions
|
|
630
|
+
}),
|
|
631
|
+
filteredActions.length === 0 && nothingFound && /* @__PURE__ */ jsx8(SpotlightEmpty, { children: nothingFound })
|
|
632
|
+
]
|
|
633
|
+
});
|
|
634
|
+
});
|
|
635
|
+
Spotlight.classes = Spotlight_module_default;
|
|
636
|
+
Spotlight.displayName = "@mantine/spotlight/Spotlight";
|
|
637
|
+
Spotlight.Search = SpotlightSearch;
|
|
638
|
+
Spotlight.ActionsList = SpotlightActionsList;
|
|
639
|
+
Spotlight.Action = SpotlightAction;
|
|
640
|
+
Spotlight.Empty = SpotlightEmpty;
|
|
641
|
+
Spotlight.ActionsGroup = SpotlightActionsGroup;
|
|
642
|
+
Spotlight.Footer = SpotlightFooter;
|
|
643
|
+
Spotlight.Root = SpotlightRoot;
|
|
644
|
+
Spotlight.open = spotlight.open;
|
|
645
|
+
Spotlight.close = spotlight.close;
|
|
646
|
+
Spotlight.toggle = spotlight.toggle;
|
|
647
|
+
export {
|
|
648
|
+
useSpotlight,
|
|
649
|
+
toggleSpotlight,
|
|
650
|
+
spotlight,
|
|
651
|
+
openSpotlight,
|
|
652
|
+
isActionsGroup,
|
|
653
|
+
createSpotlightStore,
|
|
654
|
+
createSpotlight,
|
|
655
|
+
closeSpotlight,
|
|
656
|
+
SpotlightSearch,
|
|
657
|
+
SpotlightRoot,
|
|
658
|
+
SpotlightFooter,
|
|
659
|
+
SpotlightEmpty,
|
|
660
|
+
SpotlightActionsList,
|
|
661
|
+
SpotlightActionsGroup,
|
|
662
|
+
SpotlightAction,
|
|
663
|
+
Spotlight
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
//# debugId=7666DF655BCFCA5564756E2164756E21
|