@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,5 @@
1
+ export declare const commandPaletteComponentName: "QuantumCommandPalette";
2
+ export declare function getCommandPaletteUtilityClass(slot: string): string;
3
+ export declare const commandPaletteClasses: Record<"dialog" | "footer" | "input" | "kbd" | "separator" | "tab" | "root" | "loading" | "list" | "item" | "group" | "inputWrapper" | "inputIcon" | "groupHeading" | "groupItems" | "itemSelected" | "itemIcon" | "itemLabel" | "itemShortcut" | "tabs" | "tabSelected" | "empty" | "dialogPaper", string>;
4
+ export type CommandPaletteClasses = typeof commandPaletteClasses;
5
+ export type CommandPaletteClassKey = keyof CommandPaletteClasses;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commandPaletteClasses = exports.commandPaletteComponentName = void 0;
4
+ exports.getCommandPaletteUtilityClass = getCommandPaletteUtilityClass;
5
+ var classes_1 = require("../styles/classes");
6
+ exports.commandPaletteComponentName = 'QuantumCommandPalette';
7
+ function getCommandPaletteUtilityClass(slot) {
8
+ return (0, classes_1.generateUtilityClass)(exports.commandPaletteComponentName, slot);
9
+ }
10
+ exports.commandPaletteClasses = (0, classes_1.generateUtilityClasses)(exports.commandPaletteComponentName, [
11
+ 'root',
12
+ 'input',
13
+ 'inputWrapper',
14
+ 'inputIcon',
15
+ 'list',
16
+ 'group',
17
+ 'groupHeading',
18
+ 'groupItems',
19
+ 'item',
20
+ 'itemSelected',
21
+ 'itemIcon',
22
+ 'itemLabel',
23
+ 'itemShortcut',
24
+ 'tabs',
25
+ 'tab',
26
+ 'tabSelected',
27
+ 'separator',
28
+ 'empty',
29
+ 'loading',
30
+ 'dialog',
31
+ 'dialogPaper',
32
+ 'footer',
33
+ 'kbd',
34
+ ]);
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import type { ICommandPaletteContextValue, ICommandPaletteState, ICommandPaletteStore } from './command-palette-types';
3
+ export declare const CommandPaletteContext: React.Context<ICommandPaletteContextValue | undefined>;
4
+ export declare const CommandPaletteStoreContext: React.Context<ICommandPaletteStore | undefined>;
5
+ export declare const CommandPaletteGroupContext: React.Context<string | undefined>;
6
+ export declare function useCommandPaletteContext(): ICommandPaletteContextValue;
7
+ export declare function useCommandPaletteStore(): ICommandPaletteStore;
8
+ export declare function useCommandPaletteState<T>(selector: (state: ICommandPaletteState) => T): T;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __read = (this && this.__read) || function (o, n) {
36
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
37
+ if (!m) return o;
38
+ var i = m.call(o), r, ar = [], e;
39
+ try {
40
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
41
+ }
42
+ catch (error) { e = { error: error }; }
43
+ finally {
44
+ try {
45
+ if (r && !r.done && (m = i["return"])) m.call(i);
46
+ }
47
+ finally { if (e) throw e.error; }
48
+ }
49
+ return ar;
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.CommandPaletteGroupContext = exports.CommandPaletteStoreContext = exports.CommandPaletteContext = void 0;
53
+ exports.useCommandPaletteContext = useCommandPaletteContext;
54
+ exports.useCommandPaletteStore = useCommandPaletteStore;
55
+ exports.useCommandPaletteState = useCommandPaletteState;
56
+ var React = __importStar(require("react"));
57
+ exports.CommandPaletteContext = React.createContext(undefined);
58
+ exports.CommandPaletteStoreContext = React.createContext(undefined);
59
+ exports.CommandPaletteGroupContext = React.createContext(undefined);
60
+ function useCommandPaletteContext() {
61
+ var context = React.useContext(exports.CommandPaletteContext);
62
+ if (!context) {
63
+ throw new Error('useCommandPaletteContext must be used within a CommandPalette');
64
+ }
65
+ return context;
66
+ }
67
+ function useCommandPaletteStore() {
68
+ var store = React.useContext(exports.CommandPaletteStoreContext);
69
+ if (!store) {
70
+ throw new Error('useCommandPaletteStore must be used within a CommandPalette');
71
+ }
72
+ return store;
73
+ }
74
+ function useCommandPaletteState(selector) {
75
+ var store = useCommandPaletteStore();
76
+ var selectorRef = React.useRef(selector);
77
+ var _a = __read(React.useState(function () { return selector(store.snapshot()); }), 2), state = _a[0], setState = _a[1];
78
+ React.useEffect(function () {
79
+ selectorRef.current = selector;
80
+ setState(selector(store.snapshot()));
81
+ }, [selector, store]);
82
+ React.useLayoutEffect(function () {
83
+ var unsubscribe = store.subscribe(function () {
84
+ setState(function (prevSelected) {
85
+ var nextSelected = selectorRef.current(store.snapshot());
86
+ return Object.is(prevSelected, nextSelected) ? prevSelected : nextSelected;
87
+ });
88
+ });
89
+ return unsubscribe;
90
+ // eslint-disable-next-line react-hooks/exhaustive-deps
91
+ }, [store]);
92
+ return state;
93
+ }
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { ICommandPaletteDialogProps } from './command-palette-types';
3
+ export declare const CommandPaletteDialog: React.ForwardRefExoticComponent<ICommandPaletteDialogProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __rest = (this && this.__rest) || function (s, e) {
47
+ var t = {};
48
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
+ t[p] = s[p];
50
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
+ t[p[i]] = s[p[i]];
54
+ }
55
+ return t;
56
+ };
57
+ var __importDefault = (this && this.__importDefault) || function (mod) {
58
+ return (mod && mod.__esModule) ? mod : { "default": mod };
59
+ };
60
+ Object.defineProperty(exports, "__esModule", { value: true });
61
+ exports.CommandPaletteDialog = void 0;
62
+ var React = __importStar(require("react"));
63
+ var Dialog_1 = __importDefault(require("@mui/material/Dialog"));
64
+ var useForkRef_1 = __importDefault(require("@mui/utils/useForkRef"));
65
+ var styled_1 = require("../styled");
66
+ var clsx_1 = __importDefault(require("../utils/clsx"));
67
+ var command_palette_1 = require("./command-palette");
68
+ var command_palette_classes_1 = require("./command-palette-classes");
69
+ var StyledDialog = (0, styled_1.styled)(Dialog_1.default, {
70
+ name: command_palette_classes_1.commandPaletteComponentName,
71
+ slot: 'Dialog',
72
+ })(function (_a) {
73
+ var theme = _a.theme;
74
+ return ({
75
+ '& .MuiDialog-container': {
76
+ alignItems: 'flex-start',
77
+ paddingTop: '15vh',
78
+ },
79
+ '& .MuiDialog-paper': {
80
+ margin: 0,
81
+ maxWidth: 640,
82
+ width: '100%',
83
+ borderRadius: theme.spacing(2),
84
+ overflow: 'hidden',
85
+ backgroundColor: theme.tokens.color_bg_layer_elevated,
86
+ border: "1px solid ".concat(theme.tokens.color_border_default),
87
+ boxShadow: "0px 33px 80px rgba(0, 0, 0, 0.12),\n 0px 13.7866px 33.4221px rgba(0, 0, 0, 0.086),\n 0px 7.37098px 17.869px rgba(0, 0, 0, 0.07),\n 0px 4.13211px 10.0172px rgba(0, 0, 0, 0.06),\n 0px 2.19453px 5.32008px rgba(0, 0, 0, 0.048),\n 0px 0.913195px 2.21381px rgba(0, 0, 0, 0.034)",
88
+ },
89
+ '& .MuiBackdrop-root': {
90
+ backgroundColor: 'rgba(0, 0, 0, 0.4)',
91
+ backdropFilter: 'blur(4px)',
92
+ },
93
+ });
94
+ });
95
+ exports.CommandPaletteDialog = React.forwardRef(function (props, ref) {
96
+ var _a = props.open, open = _a === void 0 ? false : _a, onOpenChange = props.onOpenChange, overlayProps = props.overlayProps, contentProps = props.contentProps, children = props.children, className = props.className, commandPaletteProps = __rest(props, ["open", "onOpenChange", "overlayProps", "contentProps", "children", "className"]);
97
+ var paletteRef = React.useRef(null);
98
+ var handleRef = (0, useForkRef_1.default)(ref, paletteRef);
99
+ var handleEntered = React.useCallback(function () {
100
+ requestAnimationFrame(function () {
101
+ var _a;
102
+ var input = (_a = paletteRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(".".concat(command_palette_classes_1.commandPaletteClasses.input));
103
+ input === null || input === void 0 ? void 0 : input.focus();
104
+ });
105
+ }, []);
106
+ var handleClose = React.useCallback(function () {
107
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
108
+ }, [onOpenChange]);
109
+ return (React.createElement(StyledDialog, { open: open, onClose: handleClose, TransitionProps: { onEntered: handleEntered }, className: (0, clsx_1.default)(command_palette_classes_1.commandPaletteClasses.dialog, className), maxWidth: false, BackdropProps: overlayProps, PaperProps: contentProps },
110
+ React.createElement(command_palette_1.CommandPalette, __assign({ ref: handleRef }, commandPaletteProps), children)));
111
+ });
112
+ exports.CommandPaletteDialog.displayName = 'CommandPaletteDialog';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { ICommandPaletteEmptyProps } from './command-palette-types';
3
+ export declare const CommandPaletteEmpty: React.ForwardRefExoticComponent<ICommandPaletteEmptyProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __rest = (this && this.__rest) || function (s, e) {
47
+ var t = {};
48
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
+ t[p] = s[p];
50
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
+ t[p[i]] = s[p[i]];
54
+ }
55
+ return t;
56
+ };
57
+ var __importDefault = (this && this.__importDefault) || function (mod) {
58
+ return (mod && mod.__esModule) ? mod : { "default": mod };
59
+ };
60
+ Object.defineProperty(exports, "__esModule", { value: true });
61
+ exports.CommandPaletteEmpty = void 0;
62
+ var React = __importStar(require("react"));
63
+ var styled_1 = require("../styled");
64
+ var clsx_1 = __importDefault(require("../utils/clsx"));
65
+ var command_palette_classes_1 = require("./command-palette-classes");
66
+ var command_palette_context_1 = require("./command-palette-context");
67
+ var Root = (0, styled_1.styled)('div', {
68
+ name: command_palette_classes_1.commandPaletteComponentName,
69
+ slot: 'Empty',
70
+ })(function (_a) {
71
+ var theme = _a.theme;
72
+ return ({
73
+ display: 'flex',
74
+ alignItems: 'center',
75
+ justifyContent: 'center',
76
+ padding: theme.spacing(6, 2),
77
+ color: theme.tokens.color_fg_disabled,
78
+ fontSize: theme.typography.body2.fontSize,
79
+ userSelect: 'none',
80
+ });
81
+ });
82
+ exports.CommandPaletteEmpty = React.forwardRef(function (props, ref) {
83
+ var _a = props.children, children = _a === void 0 ? 'No results found.' : _a, className = props.className, emptyProps = __rest(props, ["children", "className"]);
84
+ var filteredCount = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.filtered.count; });
85
+ var isSearching = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.search.length > 0; });
86
+ if (!isSearching || filteredCount > 0)
87
+ return null;
88
+ return (React.createElement(Root, __assign({ ref: ref, role: "presentation", className: (0, clsx_1.default)(command_palette_classes_1.commandPaletteClasses.empty, className) }, emptyProps), children));
89
+ });
90
+ exports.CommandPaletteEmpty.displayName = 'CommandPaletteEmpty';
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import type { ICommandPaletteFooterProps, ICommandPaletteShortcutKeyProps } from './command-palette-types';
3
+ export declare const CommandPaletteFooter: React.ForwardRefExoticComponent<ICommandPaletteFooterProps & React.RefAttributes<HTMLDivElement>>;
4
+ export declare const CommandPaletteShortcutKey: React.ForwardRefExoticComponent<ICommandPaletteShortcutKeyProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __rest = (this && this.__rest) || function (s, e) {
47
+ var t = {};
48
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
+ t[p] = s[p];
50
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
+ t[p[i]] = s[p[i]];
54
+ }
55
+ return t;
56
+ };
57
+ var __importDefault = (this && this.__importDefault) || function (mod) {
58
+ return (mod && mod.__esModule) ? mod : { "default": mod };
59
+ };
60
+ Object.defineProperty(exports, "__esModule", { value: true });
61
+ exports.CommandPaletteShortcutKey = exports.CommandPaletteFooter = void 0;
62
+ var React = __importStar(require("react"));
63
+ var styled_1 = require("../styled");
64
+ var clsx_1 = __importDefault(require("../utils/clsx"));
65
+ var command_palette_classes_1 = require("./command-palette-classes");
66
+ var Root = (0, styled_1.styled)('div', {
67
+ name: command_palette_classes_1.commandPaletteComponentName,
68
+ slot: 'Footer',
69
+ })(function (_a) {
70
+ var theme = _a.theme;
71
+ return ({
72
+ display: 'flex',
73
+ alignItems: 'center',
74
+ justifyContent: 'flex-end',
75
+ gap: theme.spacing(2),
76
+ padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(2)),
77
+ color: theme.tokens.color_fg_disabled,
78
+ fontSize: theme.typography.caption.fontSize,
79
+ });
80
+ });
81
+ var Kbd = (0, styled_1.styled)('kbd', {
82
+ name: command_palette_classes_1.commandPaletteComponentName,
83
+ slot: 'FooterKbd',
84
+ })(function (_a) {
85
+ var theme = _a.theme;
86
+ return ({
87
+ display: 'inline-flex',
88
+ alignItems: 'center',
89
+ justifyContent: 'center',
90
+ minWidth: theme.typography.pxToRem(20),
91
+ height: theme.typography.pxToRem(20),
92
+ padding: "0 ".concat(theme.spacing(0.5)),
93
+ borderRadius: theme.spacing(0.5),
94
+ backgroundColor: theme.tokens.color_bg_state_neutral_subtle,
95
+ border: "1px solid ".concat(theme.tokens.color_border_default),
96
+ color: theme.tokens.color_fg_disabled,
97
+ fontSize: theme.typography.caption.fontSize,
98
+ fontFamily: theme.typography.caption.fontFamily,
99
+ lineHeight: theme.typography.caption.lineHeight,
100
+ });
101
+ });
102
+ exports.CommandPaletteFooter = React.forwardRef(function (props, ref) {
103
+ var children = props.children, className = props.className, footerProps = __rest(props, ["children", "className"]);
104
+ return (React.createElement(Root, __assign({ ref: ref, className: (0, clsx_1.default)(command_palette_classes_1.commandPaletteClasses.footer, className) }, footerProps), children));
105
+ });
106
+ exports.CommandPaletteFooter.displayName = 'CommandPaletteFooter';
107
+ exports.CommandPaletteShortcutKey = React.forwardRef(function (props, ref) {
108
+ var children = props.children, className = props.className, kbdProps = __rest(props, ["children", "className"]);
109
+ return (React.createElement(Kbd, __assign({ ref: ref, className: (0, clsx_1.default)(command_palette_classes_1.commandPaletteClasses.kbd, className) }, kbdProps), children));
110
+ });
111
+ exports.CommandPaletteShortcutKey.displayName = 'CommandPaletteShortcutKey';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { ICommandPaletteGroupProps } from './command-palette-types';
3
+ export declare const CommandPaletteGroup: React.ForwardRefExoticComponent<ICommandPaletteGroupProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __rest = (this && this.__rest) || function (s, e) {
47
+ var t = {};
48
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
+ t[p] = s[p];
50
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
+ t[p[i]] = s[p[i]];
54
+ }
55
+ return t;
56
+ };
57
+ var __importDefault = (this && this.__importDefault) || function (mod) {
58
+ return (mod && mod.__esModule) ? mod : { "default": mod };
59
+ };
60
+ Object.defineProperty(exports, "__esModule", { value: true });
61
+ exports.CommandPaletteGroup = void 0;
62
+ var React = __importStar(require("react"));
63
+ var styled_1 = require("../styled");
64
+ var clsx_1 = __importDefault(require("../utils/clsx"));
65
+ var use_id_1 = require("../utils/use-id");
66
+ var command_palette_classes_1 = require("./command-palette-classes");
67
+ var command_palette_context_1 = require("./command-palette-context");
68
+ var Root = (0, styled_1.styled)('div', {
69
+ name: command_palette_classes_1.commandPaletteComponentName,
70
+ slot: 'Group',
71
+ })(function (_a) {
72
+ var theme = _a.theme;
73
+ return ({
74
+ padding: theme.spacing(0.5, 1),
75
+ outline: 'none',
76
+ });
77
+ });
78
+ var Heading = (0, styled_1.styled)('div', {
79
+ name: command_palette_classes_1.commandPaletteComponentName,
80
+ slot: 'GroupHeading',
81
+ })(function (_a) {
82
+ var theme = _a.theme;
83
+ return ({
84
+ padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(1.5)),
85
+ fontSize: theme.typography.overline.fontSize,
86
+ fontWeight: theme.typography.fontWeightMedium,
87
+ color: theme.tokens.color_fg_disabled,
88
+ textTransform: 'uppercase',
89
+ letterSpacing: '0.05em',
90
+ userSelect: 'none',
91
+ });
92
+ });
93
+ var Items = (0, styled_1.styled)('div', {
94
+ name: command_palette_classes_1.commandPaletteComponentName,
95
+ slot: 'GroupItems',
96
+ })(function () { return ({
97
+ outline: 'none',
98
+ }); });
99
+ exports.CommandPaletteGroup = React.forwardRef(function (props, ref) {
100
+ var heading = props.heading, _a = props.forceMount, forceMount = _a === void 0 ? false : _a, children = props.children, className = props.className, groupProps = __rest(props, ["heading", "forceMount", "children", "className"]);
101
+ var id = (0, use_id_1.useId)() || '';
102
+ var headingId = "".concat(id, "-heading");
103
+ var context = (0, command_palette_context_1.useCommandPaletteContext)();
104
+ React.useLayoutEffect(function () {
105
+ var cleanup = context.group(id);
106
+ return cleanup;
107
+ }, [context, id]);
108
+ var filteredState = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.filtered; });
109
+ var search = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.search; });
110
+ var groupCount = filteredState.groups.get(id);
111
+ var isVisible = forceMount || context.filter === false || !search || (groupCount !== undefined && groupCount > 0);
112
+ if (!isVisible)
113
+ return null;
114
+ return (React.createElement(Root, __assign({ ref: ref, className: (0, clsx_1.default)(command_palette_classes_1.commandPaletteClasses.group, className), role: "presentation" }, groupProps),
115
+ heading && (React.createElement(Heading, { id: headingId, className: command_palette_classes_1.commandPaletteClasses.groupHeading, "aria-hidden": true }, heading)),
116
+ React.createElement(command_palette_context_1.CommandPaletteGroupContext.Provider, { value: id },
117
+ React.createElement(Items, { role: "group", className: command_palette_classes_1.commandPaletteClasses.groupItems, "aria-labelledby": heading ? headingId : undefined }, children))));
118
+ });
119
+ exports.CommandPaletteGroup.displayName = 'CommandPaletteGroup';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { ICommandPaletteInputProps } from './command-palette-types';
3
+ export declare const CommandPaletteInput: React.ForwardRefExoticComponent<ICommandPaletteInputProps & React.RefAttributes<HTMLInputElement>>;