@auth0/quantum-product 2.10.2 → 2.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/command-palette/command-palette-classes.d.ts +5 -0
  2. package/command-palette/command-palette-classes.js +34 -0
  3. package/command-palette/command-palette-context.d.ts +8 -0
  4. package/command-palette/command-palette-context.js +93 -0
  5. package/command-palette/command-palette-dialog.d.ts +3 -0
  6. package/command-palette/command-palette-dialog.js +112 -0
  7. package/command-palette/command-palette-empty.d.ts +3 -0
  8. package/command-palette/command-palette-empty.js +90 -0
  9. package/command-palette/command-palette-footer.d.ts +4 -0
  10. package/command-palette/command-palette-footer.js +111 -0
  11. package/command-palette/command-palette-group.d.ts +3 -0
  12. package/command-palette/command-palette-group.js +119 -0
  13. package/command-palette/command-palette-input.d.ts +3 -0
  14. package/command-palette/command-palette-input.js +144 -0
  15. package/command-palette/command-palette-item.d.ts +3 -0
  16. package/command-palette/command-palette-item.js +243 -0
  17. package/command-palette/command-palette-list.d.ts +3 -0
  18. package/command-palette/command-palette-list.js +101 -0
  19. package/command-palette/command-palette-loading.d.ts +3 -0
  20. package/command-palette/command-palette-loading.js +89 -0
  21. package/command-palette/command-palette-score.d.ts +1 -0
  22. package/command-palette/command-palette-score.js +47 -0
  23. package/command-palette/command-palette-separator.d.ts +3 -0
  24. package/command-palette/command-palette-separator.js +86 -0
  25. package/command-palette/command-palette-tabs.d.ts +4 -0
  26. package/command-palette/command-palette-tabs.js +146 -0
  27. package/command-palette/command-palette-types.d.ts +121 -0
  28. package/command-palette/command-palette-types.js +2 -0
  29. package/command-palette/command-palette.d.ts +5 -0
  30. package/command-palette/command-palette.js +477 -0
  31. package/command-palette/index.d.ts +27 -0
  32. package/command-palette/index.js +36 -0
  33. package/command-palette/use-command-palette-shortcut.d.ts +6 -0
  34. package/command-palette/use-command-palette-shortcut.js +65 -0
  35. package/esm/command-palette/command-palette-classes.js +30 -0
  36. package/esm/command-palette/command-palette-context.js +54 -0
  37. package/esm/command-palette/command-palette-dialog.js +73 -0
  38. package/esm/command-palette/command-palette-empty.js +51 -0
  39. package/esm/command-palette/command-palette-footer.js +72 -0
  40. package/esm/command-palette/command-palette-group.js +80 -0
  41. package/esm/command-palette/command-palette-input.js +105 -0
  42. package/esm/command-palette/command-palette-item.js +204 -0
  43. package/esm/command-palette/command-palette-list.js +62 -0
  44. package/esm/command-palette/command-palette-loading.js +50 -0
  45. package/esm/command-palette/command-palette-score.js +44 -0
  46. package/esm/command-palette/command-palette-separator.js +47 -0
  47. package/esm/command-palette/command-palette-tabs.js +107 -0
  48. package/esm/command-palette/command-palette-types.js +1 -0
  49. package/esm/command-palette/command-palette.js +438 -0
  50. package/esm/command-palette/index.js +14 -0
  51. package/esm/command-palette/use-command-palette-shortcut.js +29 -0
  52. package/esm/index.js +1 -0
  53. package/index.d.ts +1 -0
  54. package/index.js +1 -0
  55. package/package.json +1 -1
@@ -0,0 +1,438 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ var __read = (this && this.__read) || function (o, n) {
24
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
25
+ if (!m) return o;
26
+ var i = m.call(o), r, ar = [], e;
27
+ try {
28
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
29
+ }
30
+ catch (error) { e = { error: error }; }
31
+ finally {
32
+ try {
33
+ if (r && !r.done && (m = i["return"])) m.call(i);
34
+ }
35
+ finally { if (e) throw e.error; }
36
+ }
37
+ return ar;
38
+ };
39
+ import * as React from 'react';
40
+ import { styled } from '../styled';
41
+ import { useMergedClasses } from '../styles/classes';
42
+ import clsx from '../utils/clsx';
43
+ import { useId } from '../utils/use-id';
44
+ import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
45
+ import { CommandPaletteContext, CommandPaletteStoreContext } from './command-palette-context';
46
+ import { commandScore } from './command-palette-score';
47
+ var VALUE_ATTR = 'data-value';
48
+ var ITEM_SELECTOR = ".".concat(commandPaletteClasses.item);
49
+ var GROUP_ITEMS_SELECTOR = ".".concat(commandPaletteClasses.groupItems);
50
+ var VALID_ITEM_SELECTOR = "".concat(ITEM_SELECTOR, ":not([aria-disabled=\"true\"])");
51
+ var Root = styled('div', {
52
+ name: commandPaletteComponentName,
53
+ slot: 'Root',
54
+ })(function (_a) {
55
+ var theme = _a.theme;
56
+ return ({
57
+ display: 'flex',
58
+ flexDirection: 'column',
59
+ width: '100%',
60
+ fontFamily: theme.typography.fontFamily,
61
+ overflow: 'hidden',
62
+ borderRadius: theme.typography.pxToRem(12),
63
+ backgroundColor: theme.tokens.color_bg_layer_elevated,
64
+ '&:focus-visible': {
65
+ outline: "none",
66
+ },
67
+ });
68
+ });
69
+ function defaultFilter(value, search, keywords) {
70
+ var allText = (keywords === null || keywords === void 0 ? void 0 : keywords.length) ? "".concat(value, " ").concat(keywords.join(' ')) : value;
71
+ return commandScore(allText, search);
72
+ }
73
+ function useAsRef(value) {
74
+ var ref = React.useRef(value);
75
+ ref.current = value;
76
+ return ref;
77
+ }
78
+ function useLazyRef(fn) {
79
+ var ref = React.useRef(undefined);
80
+ if (ref.current === undefined) {
81
+ ref.current = fn();
82
+ }
83
+ return ref;
84
+ }
85
+ function findNextItem(el, loop) {
86
+ var _a, _b, _c;
87
+ var next = el.nextElementSibling;
88
+ while (next) {
89
+ if (next.matches(VALID_ITEM_SELECTOR))
90
+ return next;
91
+ next = next.nextElementSibling;
92
+ }
93
+ var group = el.closest(GROUP_ITEMS_SELECTOR);
94
+ while (group) {
95
+ var nextGroup = (_a = group.parentElement) === null || _a === void 0 ? void 0 : _a.nextElementSibling;
96
+ if (nextGroup) {
97
+ var items = nextGroup.querySelector(GROUP_ITEMS_SELECTOR);
98
+ if (items) {
99
+ var firstItem = items.querySelector(VALID_ITEM_SELECTOR);
100
+ if (firstItem)
101
+ return firstItem;
102
+ }
103
+ group = nextGroup.querySelector(GROUP_ITEMS_SELECTOR);
104
+ }
105
+ else {
106
+ group = null;
107
+ }
108
+ }
109
+ if (!el.closest(GROUP_ITEMS_SELECTOR)) {
110
+ var sibling = (_b = el.parentElement) === null || _b === void 0 ? void 0 : _b.nextElementSibling;
111
+ while (sibling) {
112
+ var item = ((_c = sibling.matches) === null || _c === void 0 ? void 0 : _c.call(sibling, VALID_ITEM_SELECTOR)) ? sibling : sibling.querySelector(VALID_ITEM_SELECTOR);
113
+ if (item)
114
+ return item;
115
+ sibling = sibling.nextElementSibling;
116
+ }
117
+ }
118
+ if (loop) {
119
+ var list = el.closest(".".concat(commandPaletteClasses.list));
120
+ if (list) {
121
+ return list.querySelector(VALID_ITEM_SELECTOR) || undefined;
122
+ }
123
+ }
124
+ return undefined;
125
+ }
126
+ function findPrevItem(el, loop) {
127
+ var _a;
128
+ var prev = el.previousElementSibling;
129
+ while (prev) {
130
+ if (prev.matches(VALID_ITEM_SELECTOR))
131
+ return prev;
132
+ prev = prev.previousElementSibling;
133
+ }
134
+ var group = el.closest(GROUP_ITEMS_SELECTOR);
135
+ while (group) {
136
+ var prevGroup = (_a = group.parentElement) === null || _a === void 0 ? void 0 : _a.previousElementSibling;
137
+ if (prevGroup) {
138
+ var items = prevGroup.querySelector(GROUP_ITEMS_SELECTOR);
139
+ if (items) {
140
+ var allItems = items.querySelectorAll(VALID_ITEM_SELECTOR);
141
+ if (allItems.length)
142
+ return allItems[allItems.length - 1];
143
+ }
144
+ group = prevGroup.querySelector(GROUP_ITEMS_SELECTOR);
145
+ }
146
+ else {
147
+ group = null;
148
+ }
149
+ }
150
+ if (loop) {
151
+ var list = el.closest(".".concat(commandPaletteClasses.list));
152
+ if (list) {
153
+ var allItems = list.querySelectorAll(VALID_ITEM_SELECTOR);
154
+ return allItems.length ? allItems[allItems.length - 1] : undefined;
155
+ }
156
+ }
157
+ return undefined;
158
+ }
159
+ function getSelectedItem(listInnerRef, value) {
160
+ var _a;
161
+ return ((_a = listInnerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("".concat(ITEM_SELECTOR, "[").concat(VALUE_ATTR, "=\"").concat(encodeURIComponent(value), "\"]"))) || null;
162
+ }
163
+ function getValidItems(listInnerRef) {
164
+ var _a;
165
+ return Array.from(((_a = listInnerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(VALID_ITEM_SELECTOR)) || []);
166
+ }
167
+ function useScheduleLayoutEffect() {
168
+ var _a = __read(React.useState(0), 2), count = _a[0], setCount = _a[1];
169
+ var callbackRef = React.useRef(null);
170
+ React.useLayoutEffect(function () {
171
+ if (callbackRef.current) {
172
+ callbackRef.current();
173
+ callbackRef.current = null;
174
+ }
175
+ }, [count]);
176
+ return React.useCallback(function (callback) {
177
+ callbackRef.current = callback;
178
+ setCount(function (c) { return c + 1; });
179
+ }, []);
180
+ }
181
+ export var CommandPalette = React.forwardRef(function (props, ref) {
182
+ var _a;
183
+ var _b = props.label, label = _b === void 0 ? 'Command palette' : _b, searchProp = props.search, _onSearchChange = props.onSearchChange, valueProp = props.value, _onValueChange = props.onValueChange, filterProp = props.filter, _c = props.shouldFilter, shouldFilter = _c === void 0 ? true : _c, _d = props.loop, loop = _d === void 0 ? false : _d, _onSelect = props.onSelect, children = props.children, className = props.className, rootProps = __rest(props, ["label", "search", "onSearchChange", "value", "onValueChange", "filter", "shouldFilter", "loop", "onSelect", "children", "className"]);
184
+ var generatedId = useId();
185
+ var id = (_a = rootProps.id) !== null && _a !== void 0 ? _a : generatedId;
186
+ var listId = id ? "".concat(id, "-list") : undefined;
187
+ var inputId = id ? "".concat(id, "-input") : undefined;
188
+ var listInnerRef = React.useRef(null);
189
+ var allItems = React.useRef(new Map());
190
+ var allGroups = React.useRef(new Map());
191
+ var filter = shouldFilter ? filterProp !== null && filterProp !== void 0 ? filterProp : defaultFilter : false;
192
+ var propsRef = useAsRef(props);
193
+ var schedule = useScheduleLayoutEffect();
194
+ var store = useLazyRef(function () {
195
+ var listeners = new Set();
196
+ var state = {
197
+ search: searchProp || '',
198
+ selectedValue: valueProp || '',
199
+ filtered: { count: 0, items: new Map(), groups: new Map() },
200
+ };
201
+ return {
202
+ subscribe: function (callback) {
203
+ listeners.add(callback);
204
+ return function () { return listeners.delete(callback); };
205
+ },
206
+ snapshot: function () {
207
+ return state;
208
+ },
209
+ setState: function (key, value, shouldEmit) {
210
+ var _a;
211
+ var _b, _c;
212
+ if (Object.is(state[key], value))
213
+ return;
214
+ state = __assign(__assign({}, state), (_a = {}, _a[key] = value, _a));
215
+ if (key === 'search') {
216
+ filterItems();
217
+ schedule(function () { return selectFirstItem(); });
218
+ (_c = (_b = propsRef.current).onSearchChange) === null || _c === void 0 ? void 0 : _c.call(_b, value);
219
+ }
220
+ if (shouldEmit !== false) {
221
+ this.emit();
222
+ }
223
+ },
224
+ emit: function () {
225
+ listeners.forEach(function (l) { return l(); });
226
+ },
227
+ };
228
+ });
229
+ var filterItems = React.useCallback(function () {
230
+ if (!filter) {
231
+ store.current.setState('filtered', {
232
+ count: allItems.current.size,
233
+ items: new Map(),
234
+ groups: new Map(),
235
+ });
236
+ return;
237
+ }
238
+ var search = store.current.snapshot().search;
239
+ var items = new Map();
240
+ var groups = new Map();
241
+ var count = 0;
242
+ allItems.current.forEach(function (itemMeta, id) {
243
+ var score = filter(itemMeta.value, search, itemMeta.keywords);
244
+ items.set(id, score);
245
+ if (score > 0)
246
+ count++;
247
+ });
248
+ allGroups.current.forEach(function (groupItems, groupId) {
249
+ var groupCount = 0;
250
+ groupItems.forEach(function (itemId) {
251
+ var score = items.get(itemId) || 0;
252
+ if (score > 0)
253
+ groupCount++;
254
+ });
255
+ groups.set(groupId, groupCount);
256
+ });
257
+ store.current.setState('filtered', { count: count, items: items, groups: groups }, false);
258
+ // eslint-disable-next-line react-hooks/exhaustive-deps
259
+ }, []);
260
+ var selectFirstItem = React.useCallback(function () {
261
+ var _a, _b;
262
+ var items = getValidItems(listInnerRef);
263
+ var item = items.find(function (el) { return el.getAttribute('aria-disabled') !== 'true'; });
264
+ if (item) {
265
+ var value = item.getAttribute(VALUE_ATTR);
266
+ if (value) {
267
+ var decoded = decodeURIComponent(value);
268
+ store.current.setState('selectedValue', decoded);
269
+ (_b = (_a = propsRef.current).onValueChange) === null || _b === void 0 ? void 0 : _b.call(_a, decoded);
270
+ }
271
+ }
272
+ // eslint-disable-next-line react-hooks/exhaustive-deps
273
+ }, []);
274
+ React.useEffect(function () {
275
+ if (searchProp !== undefined) {
276
+ store.current.setState('search', searchProp);
277
+ }
278
+ }, [searchProp, store]);
279
+ React.useEffect(function () {
280
+ if (valueProp !== undefined) {
281
+ store.current.setState('selectedValue', valueProp);
282
+ }
283
+ }, [valueProp, store]);
284
+ var context = React.useMemo(function () { return ({
285
+ value: function (id, value, keywords) {
286
+ var existing = allItems.current.get(id);
287
+ if (existing && existing.value === value && existing.keywords === keywords)
288
+ return;
289
+ allItems.current.set(id, { value: value, keywords: keywords });
290
+ filterItems();
291
+ schedule(function () {
292
+ var state = store.current.snapshot();
293
+ var validItems = getValidItems(listInnerRef);
294
+ var selectedEl = getSelectedItem(listInnerRef, state.selectedValue);
295
+ if (!selectedEl && validItems.length > 0) {
296
+ selectFirstItem();
297
+ }
298
+ store.current.emit();
299
+ });
300
+ },
301
+ item: function (id, groupId) {
302
+ if (groupId) {
303
+ if (!allGroups.current.has(groupId)) {
304
+ allGroups.current.set(groupId, new Set());
305
+ }
306
+ allGroups.current.get(groupId).add(id);
307
+ }
308
+ filterItems();
309
+ store.current.emit();
310
+ return function () {
311
+ var _a;
312
+ allItems.current.delete(id);
313
+ if (groupId) {
314
+ (_a = allGroups.current.get(groupId)) === null || _a === void 0 ? void 0 : _a.delete(id);
315
+ }
316
+ filterItems();
317
+ schedule(function () {
318
+ selectFirstItem();
319
+ store.current.emit();
320
+ });
321
+ };
322
+ },
323
+ group: function (id) {
324
+ if (!allGroups.current.has(id)) {
325
+ allGroups.current.set(id, new Set());
326
+ }
327
+ return function () {
328
+ allGroups.current.delete(id);
329
+ store.current.emit();
330
+ };
331
+ },
332
+ filter: filter,
333
+ label: label !== null && label !== void 0 ? label : '',
334
+ listId: listId !== null && listId !== void 0 ? listId : '',
335
+ inputId: inputId !== null && inputId !== void 0 ? inputId : '',
336
+ listInnerRef: listInnerRef,
337
+ }); },
338
+ // eslint-disable-next-line react-hooks/exhaustive-deps
339
+ [label, listId, inputId]);
340
+ var handleKeyDown = React.useCallback(function (e) {
341
+ var _a, _b, _c, _d, _e, _f;
342
+ var state = store.current.snapshot();
343
+ var updateSelectedByChange = function (change) {
344
+ var _a, _b;
345
+ var selected = getSelectedItem(listInnerRef, state.selectedValue);
346
+ var nextItem;
347
+ if (selected) {
348
+ nextItem = change === 1 ? findNextItem(selected, loop) : findPrevItem(selected, loop);
349
+ }
350
+ else {
351
+ var items = getValidItems(listInnerRef);
352
+ nextItem = change === 1 ? items[0] : items[items.length - 1];
353
+ }
354
+ if (nextItem) {
355
+ var value = nextItem.getAttribute(VALUE_ATTR);
356
+ if (value) {
357
+ var decoded = decodeURIComponent(value);
358
+ store.current.setState('selectedValue', decoded);
359
+ (_b = (_a = propsRef.current).onValueChange) === null || _b === void 0 ? void 0 : _b.call(_a, decoded);
360
+ nextItem.scrollIntoView({ block: 'nearest' });
361
+ }
362
+ }
363
+ };
364
+ switch (e.key) {
365
+ case 'ArrowDown': {
366
+ e.preventDefault();
367
+ updateSelectedByChange(1);
368
+ break;
369
+ }
370
+ case 'ArrowUp': {
371
+ e.preventDefault();
372
+ updateSelectedByChange(-1);
373
+ break;
374
+ }
375
+ case 'Home': {
376
+ e.preventDefault();
377
+ var items = getValidItems(listInnerRef);
378
+ var first = items[0];
379
+ if (first) {
380
+ var value = first.getAttribute(VALUE_ATTR);
381
+ if (value) {
382
+ var decoded = decodeURIComponent(value);
383
+ store.current.setState('selectedValue', decoded);
384
+ (_b = (_a = propsRef.current).onValueChange) === null || _b === void 0 ? void 0 : _b.call(_a, decoded);
385
+ first.scrollIntoView({ block: 'nearest' });
386
+ }
387
+ }
388
+ break;
389
+ }
390
+ case 'End': {
391
+ e.preventDefault();
392
+ var items = getValidItems(listInnerRef);
393
+ var last = items[items.length - 1];
394
+ if (last) {
395
+ var value = last.getAttribute(VALUE_ATTR);
396
+ if (value) {
397
+ var decoded = decodeURIComponent(value);
398
+ store.current.setState('selectedValue', decoded);
399
+ (_d = (_c = propsRef.current).onValueChange) === null || _d === void 0 ? void 0 : _d.call(_c, decoded);
400
+ last.scrollIntoView({ block: 'nearest' });
401
+ }
402
+ }
403
+ break;
404
+ }
405
+ case 'Enter': {
406
+ e.preventDefault();
407
+ var selected = getSelectedItem(listInnerRef, state.selectedValue);
408
+ if (selected) {
409
+ selected.click();
410
+ (_f = (_e = propsRef.current).onSelect) === null || _f === void 0 ? void 0 : _f.call(_e, state.selectedValue);
411
+ }
412
+ break;
413
+ }
414
+ case 'n':
415
+ case 'j': {
416
+ if (e.ctrlKey) {
417
+ e.preventDefault();
418
+ updateSelectedByChange(1);
419
+ }
420
+ break;
421
+ }
422
+ case 'p':
423
+ case 'k': {
424
+ if (e.ctrlKey) {
425
+ e.preventDefault();
426
+ updateSelectedByChange(-1);
427
+ }
428
+ break;
429
+ }
430
+ }
431
+ }, [loop, store, propsRef]);
432
+ var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, undefined);
433
+ return (React.createElement(CommandPaletteStoreContext.Provider, { value: store.current },
434
+ React.createElement(CommandPaletteContext.Provider, { value: context },
435
+ React.createElement(Root, __assign({ ref: ref, className: clsx(classes.root, className), tabIndex: -1, onKeyDown: handleKeyDown, "aria-label": label }, rootProps), children))));
436
+ });
437
+ CommandPalette.displayName = 'CommandPalette';
438
+ export { VALUE_ATTR };
@@ -0,0 +1,14 @@
1
+ export { CommandPalette } from './command-palette';
2
+ export { CommandPaletteInput } from './command-palette-input';
3
+ export { CommandPaletteList } from './command-palette-list';
4
+ export { CommandPaletteGroup } from './command-palette-group';
5
+ export { CommandPaletteItem } from './command-palette-item';
6
+ export { CommandPaletteTab, CommandPaletteTabs } from './command-palette-tabs';
7
+ export { CommandPaletteSeparator } from './command-palette-separator';
8
+ export { CommandPaletteEmpty } from './command-palette-empty';
9
+ export { CommandPaletteLoading } from './command-palette-loading';
10
+ export { CommandPaletteDialog } from './command-palette-dialog';
11
+ export { CommandPaletteFooter, CommandPaletteShortcutKey } from './command-palette-footer';
12
+ export { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
13
+ export { useCommandPaletteShortcut } from './use-command-palette-shortcut';
14
+ export { CommandPaletteContext, useCommandPaletteContext, useCommandPaletteState } from './command-palette-context';
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ export function useCommandPaletteShortcut(setOpen, shortcut) {
3
+ if (shortcut === void 0) { shortcut = { key: 'k', metaKey: true }; }
4
+ var setOpenRef = React.useRef(setOpen);
5
+ setOpenRef.current = setOpen;
6
+ var shortcutRef = React.useRef(shortcut);
7
+ shortcutRef.current = shortcut;
8
+ React.useEffect(function () {
9
+ var handleKeyDown = function (e) {
10
+ var target = e.target;
11
+ if (target.tagName === 'INPUT' ||
12
+ target.tagName === 'TEXTAREA' ||
13
+ target.tagName === 'SELECT' ||
14
+ target.isContentEditable) {
15
+ return;
16
+ }
17
+ var s = shortcutRef.current;
18
+ var matchesMeta = e.metaKey === !!s.metaKey;
19
+ var matchesCtrl = e.ctrlKey === !!s.ctrlKey;
20
+ var matchesKey = e.key.toLowerCase() === s.key.toLowerCase();
21
+ if (matchesMeta && matchesCtrl && matchesKey) {
22
+ e.preventDefault();
23
+ setOpenRef.current(function (prev) { return !prev; });
24
+ }
25
+ };
26
+ document.addEventListener('keydown', handleKeyDown);
27
+ return function () { return document.removeEventListener('keydown', handleKeyDown); };
28
+ }, []);
29
+ }
package/esm/index.js CHANGED
@@ -18,6 +18,7 @@ export * from './chip';
18
18
  export * from './code';
19
19
  export * from './collapse';
20
20
  export * from './color-text-field';
21
+ export * from './command-palette';
21
22
  export * from './column-layout';
22
23
  export * from './config-block';
23
24
  export * from './content';
package/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './chip';
18
18
  export * from './code';
19
19
  export * from './collapse';
20
20
  export * from './color-text-field';
21
+ export * from './command-palette';
21
22
  export * from './column-layout';
22
23
  export * from './config-block';
23
24
  export * from './content';
package/index.js CHANGED
@@ -34,6 +34,7 @@ __exportStar(require("./chip"), exports);
34
34
  __exportStar(require("./code"), exports);
35
35
  __exportStar(require("./collapse"), exports);
36
36
  __exportStar(require("./color-text-field"), exports);
37
+ __exportStar(require("./command-palette"), exports);
37
38
  __exportStar(require("./column-layout"), exports);
38
39
  __exportStar(require("./config-block"), exports);
39
40
  __exportStar(require("./content"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/quantum-product",
3
- "version": "2.10.2",
3
+ "version": "2.10.4",
4
4
  "sideEffects": false,
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {