@auth0/quantum-product 2.10.6 → 2.10.8
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/command-palette/command-palette-classes.d.ts +1 -1
- package/command-palette/command-palette-classes.js +1 -0
- package/command-palette/command-palette-dialog.js +7 -5
- package/command-palette/command-palette-empty.js +4 -2
- package/command-palette/command-palette-footer.js +8 -5
- package/command-palette/command-palette-group.js +13 -10
- package/command-palette/command-palette-input.js +10 -7
- package/command-palette/command-palette-item.js +8 -6
- package/command-palette/command-palette-list.js +5 -3
- package/command-palette/command-palette-loading.js +4 -2
- package/command-palette/command-palette-separator.js +4 -2
- package/command-palette/command-palette-tabs.js +11 -8
- package/command-palette/command-palette-types.d.ts +23 -13
- package/command-palette/command-palette.js +3 -3
- package/esm/command-palette/command-palette-classes.js +1 -0
- package/esm/command-palette/command-palette-dialog.js +8 -6
- package/esm/command-palette/command-palette-empty.js +5 -3
- package/esm/command-palette/command-palette-footer.js +9 -6
- package/esm/command-palette/command-palette-group.js +14 -11
- package/esm/command-palette/command-palette-input.js +11 -8
- package/esm/command-palette/command-palette-item.js +9 -7
- package/esm/command-palette/command-palette-list.js +6 -4
- package/esm/command-palette/command-palette-loading.js +5 -3
- package/esm/command-palette/command-palette-separator.js +5 -3
- package/esm/command-palette/command-palette-tabs.js +12 -9
- package/esm/command-palette/command-palette.js +3 -3
- package/esm/icon/index.js +87 -69
- package/esm/input/input-label/input-label-overrides.js +1 -0
- package/icon/index.d.ts +81 -68
- package/icon/index.js +94 -76
- package/input/input-label/input-label-overrides.d.ts +1 -1
- package/input/input-label/input-label-overrides.js +1 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const commandPaletteComponentName: "QuantumCommandPalette";
|
|
2
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>;
|
|
3
|
+
export declare const commandPaletteClasses: Record<"dialog" | "footer" | "input" | "kbd" | "separator" | "tab" | "root" | "loading" | "list" | "item" | "group" | "inputWrapper" | "inputIcon" | "listInner" | "groupHeading" | "groupItems" | "itemSelected" | "itemIcon" | "itemLabel" | "itemShortcut" | "tabs" | "tabSelected" | "empty" | "dialogPaper", string>;
|
|
4
4
|
export type CommandPaletteClasses = typeof commandPaletteClasses;
|
|
5
5
|
export type CommandPaletteClassKey = keyof CommandPaletteClasses;
|
|
@@ -63,6 +63,7 @@ var React = __importStar(require("react"));
|
|
|
63
63
|
var Dialog_1 = __importDefault(require("@mui/material/Dialog"));
|
|
64
64
|
var useForkRef_1 = __importDefault(require("@mui/utils/useForkRef"));
|
|
65
65
|
var styled_1 = require("../styled");
|
|
66
|
+
var classes_1 = require("../styles/classes");
|
|
66
67
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
67
68
|
var command_palette_1 = require("./command-palette");
|
|
68
69
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
@@ -84,18 +85,19 @@ var StyledDialog = (0, styled_1.styled)(Dialog_1.default, {
|
|
|
84
85
|
overflow: 'hidden',
|
|
85
86
|
backgroundColor: theme.tokens.color_bg_layer_elevated,
|
|
86
87
|
border: "1px solid ".concat(theme.tokens.color_border_default),
|
|
87
|
-
boxShadow:
|
|
88
|
+
boxShadow: '0 -1px 0 -1px rgba(0,0,0,0.06), 0 1px 0 -1px rgba(0,0,0,0.06), 0 2px 24px -6px rgba(0,0,0,0.04), 0 4px 48px -12px rgba(0,0,0,0.04), 0 8px 80px -24px rgba(0,0,0,0.04)',
|
|
88
89
|
},
|
|
89
90
|
'& .MuiBackdrop-root': {
|
|
90
|
-
backgroundColor: 'rgba(0, 0, 0, 0.
|
|
91
|
-
backdropFilter: 'blur(
|
|
91
|
+
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
92
|
+
backdropFilter: 'blur(2px)',
|
|
92
93
|
},
|
|
93
94
|
});
|
|
94
95
|
});
|
|
95
96
|
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 _a = props.open, open = _a === void 0 ? false : _a, onOpenChange = props.onOpenChange, overlayProps = props.overlayProps, contentProps = props.contentProps, analyticsId = props.analyticsId, propClasses = props.classes, children = props.children, className = props.className, sx = props.sx, commandPaletteProps = __rest(props, ["open", "onOpenChange", "overlayProps", "contentProps", "analyticsId", "classes", "children", "className", "sx"]);
|
|
97
98
|
var paletteRef = React.useRef(null);
|
|
98
99
|
var handleRef = (0, useForkRef_1.default)(ref, paletteRef);
|
|
100
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
99
101
|
var handleEntered = React.useCallback(function () {
|
|
100
102
|
requestAnimationFrame(function () {
|
|
101
103
|
var _a;
|
|
@@ -106,7 +108,7 @@ exports.CommandPaletteDialog = React.forwardRef(function (props, ref) {
|
|
|
106
108
|
var handleClose = React.useCallback(function () {
|
|
107
109
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
|
|
108
110
|
}, [onOpenChange]);
|
|
109
|
-
return (React.createElement(StyledDialog, { open: open, onClose: handleClose, TransitionProps: { onEntered: handleEntered }, className: (0, clsx_1.default)(
|
|
111
|
+
return (React.createElement(StyledDialog, __assign({ open: open, onClose: handleClose, TransitionProps: { onEntered: handleEntered }, sx: sx, className: (0, clsx_1.default)(classes.dialog, className), maxWidth: false, BackdropProps: overlayProps, PaperProps: __assign(__assign({}, contentProps), { className: (0, clsx_1.default)(command_palette_classes_1.commandPaletteClasses.dialogPaper, classes.dialogPaper, contentProps === null || contentProps === void 0 ? void 0 : contentProps.className) }) }, (analyticsId && { 'data-analytics-id': analyticsId })),
|
|
110
112
|
React.createElement(command_palette_1.CommandPalette, __assign({ ref: handleRef }, commandPaletteProps), children)));
|
|
111
113
|
});
|
|
112
114
|
exports.CommandPaletteDialog.displayName = 'CommandPaletteDialog';
|
|
@@ -61,6 +61,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
61
61
|
exports.CommandPaletteEmpty = void 0;
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var styled_1 = require("../styled");
|
|
64
|
+
var classes_1 = require("../styles/classes");
|
|
64
65
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
65
66
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
66
67
|
var command_palette_context_1 = require("./command-palette-context");
|
|
@@ -80,11 +81,12 @@ var Root = (0, styled_1.styled)('div', {
|
|
|
80
81
|
});
|
|
81
82
|
});
|
|
82
83
|
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 _a = props.children, children = _a === void 0 ? 'No results found.' : _a, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, emptyProps = __rest(props, ["children", "analyticsId", "classes", "className", "sx"]);
|
|
84
85
|
var filteredCount = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.filtered.count; });
|
|
85
86
|
var isSearching = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.search.length > 0; });
|
|
87
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
86
88
|
if (!isSearching || filteredCount > 0)
|
|
87
89
|
return null;
|
|
88
|
-
return (React.createElement(Root, __assign({ ref: ref, role: "presentation", className: (0, clsx_1.default)(
|
|
90
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, role: "presentation", className: (0, clsx_1.default)(classes.empty, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), emptyProps), children));
|
|
89
91
|
});
|
|
90
92
|
exports.CommandPaletteEmpty.displayName = 'CommandPaletteEmpty';
|
|
@@ -61,6 +61,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
61
61
|
exports.CommandPaletteShortcutKey = exports.CommandPaletteFooter = void 0;
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var styled_1 = require("../styled");
|
|
64
|
+
var classes_1 = require("../styles/classes");
|
|
64
65
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
65
66
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
66
67
|
var Root = (0, styled_1.styled)('div', {
|
|
@@ -80,7 +81,7 @@ var Root = (0, styled_1.styled)('div', {
|
|
|
80
81
|
});
|
|
81
82
|
var Kbd = (0, styled_1.styled)('kbd', {
|
|
82
83
|
name: command_palette_classes_1.commandPaletteComponentName,
|
|
83
|
-
slot: '
|
|
84
|
+
slot: 'Kbd',
|
|
84
85
|
})(function (_a) {
|
|
85
86
|
var theme = _a.theme;
|
|
86
87
|
return ({
|
|
@@ -100,12 +101,14 @@ var Kbd = (0, styled_1.styled)('kbd', {
|
|
|
100
101
|
});
|
|
101
102
|
});
|
|
102
103
|
exports.CommandPaletteFooter = React.forwardRef(function (props, ref) {
|
|
103
|
-
var children = props.children, className = props.className, footerProps = __rest(props, ["children", "className"]);
|
|
104
|
-
|
|
104
|
+
var children = props.children, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, footerProps = __rest(props, ["children", "analyticsId", "classes", "className", "sx"]);
|
|
105
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
106
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, className: (0, clsx_1.default)(classes.footer, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), footerProps), children));
|
|
105
107
|
});
|
|
106
108
|
exports.CommandPaletteFooter.displayName = 'CommandPaletteFooter';
|
|
107
109
|
exports.CommandPaletteShortcutKey = React.forwardRef(function (props, ref) {
|
|
108
|
-
var children = props.children, className = props.className, kbdProps = __rest(props, ["children", "className"]);
|
|
109
|
-
|
|
110
|
+
var children = props.children, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, kbdProps = __rest(props, ["children", "analyticsId", "classes", "className", "sx"]);
|
|
111
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
112
|
+
return (React.createElement(Kbd, __assign({ ref: ref, sx: sx, className: (0, clsx_1.default)(classes.kbd, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), kbdProps), children));
|
|
110
113
|
});
|
|
111
114
|
exports.CommandPaletteShortcutKey.displayName = 'CommandPaletteShortcutKey';
|
|
@@ -61,6 +61,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
61
61
|
exports.CommandPaletteGroup = void 0;
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var styled_1 = require("../styled");
|
|
64
|
+
var classes_1 = require("../styles/classes");
|
|
64
65
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
65
66
|
var use_id_1 = require("../utils/use-id");
|
|
66
67
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
@@ -97,23 +98,25 @@ var Items = (0, styled_1.styled)('div', {
|
|
|
97
98
|
outline: 'none',
|
|
98
99
|
}); });
|
|
99
100
|
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
|
|
102
|
-
var
|
|
101
|
+
var heading = props.heading, _a = props.forceMount, forceMount = _a === void 0 ? false : _a, value = props.value, analyticsId = props.analyticsId, propClasses = props.classes, children = props.children, className = props.className, sx = props.sx, groupProps = __rest(props, ["heading", "forceMount", "value", "analyticsId", "classes", "children", "className", "sx"]);
|
|
102
|
+
var generatedId = (0, use_id_1.useId)() || '';
|
|
103
|
+
var groupId = value || generatedId;
|
|
104
|
+
var headingId = generatedId ? "".concat(generatedId, "-heading") : undefined;
|
|
103
105
|
var context = (0, command_palette_context_1.useCommandPaletteContext)();
|
|
106
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
104
107
|
React.useLayoutEffect(function () {
|
|
105
|
-
var cleanup = context.group(
|
|
108
|
+
var cleanup = context.group(groupId);
|
|
106
109
|
return cleanup;
|
|
107
|
-
}, [context,
|
|
110
|
+
}, [context, groupId]);
|
|
108
111
|
var filteredState = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.filtered; });
|
|
109
112
|
var search = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.search; });
|
|
110
|
-
var groupCount = filteredState.groups.get(
|
|
113
|
+
var groupCount = filteredState.groups.get(groupId);
|
|
111
114
|
var isVisible = forceMount || context.filter === false || !search || (groupCount !== undefined && groupCount > 0);
|
|
112
115
|
if (!isVisible)
|
|
113
116
|
return null;
|
|
114
|
-
return (React.createElement(Root, __assign({ ref: ref, className: (0, clsx_1.default)(
|
|
115
|
-
heading && (React.createElement(Heading, { id: headingId, className:
|
|
116
|
-
React.createElement(command_palette_context_1.CommandPaletteGroupContext.Provider, { value:
|
|
117
|
-
React.createElement(Items, { role: "group", className:
|
|
117
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, className: (0, clsx_1.default)(classes.group, className), role: "presentation" }, (analyticsId && { 'data-analytics-id': analyticsId }), groupProps),
|
|
118
|
+
heading && (React.createElement(Heading, { id: headingId, className: classes.groupHeading, "aria-hidden": true }, heading)),
|
|
119
|
+
React.createElement(command_palette_context_1.CommandPaletteGroupContext.Provider, { value: groupId },
|
|
120
|
+
React.createElement(Items, { role: "group", className: classes.groupItems, "aria-labelledby": heading ? headingId : undefined }, children))));
|
|
118
121
|
});
|
|
119
122
|
exports.CommandPaletteGroup.displayName = 'CommandPaletteGroup';
|
|
@@ -62,6 +62,7 @@ exports.CommandPaletteInput = void 0;
|
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var icon_1 = require("../icon");
|
|
64
64
|
var styled_1 = require("../styled");
|
|
65
|
+
var classes_1 = require("../styles/classes");
|
|
65
66
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
66
67
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
67
68
|
var command_palette_context_1 = require("./command-palette-context");
|
|
@@ -74,7 +75,7 @@ var Wrapper = (0, styled_1.styled)('div', {
|
|
|
74
75
|
display: 'flex',
|
|
75
76
|
alignItems: 'center',
|
|
76
77
|
gap: theme.spacing(1.5),
|
|
77
|
-
padding: "".concat(theme.spacing(1.
|
|
78
|
+
padding: "".concat(theme.spacing(1.75), " ").concat(theme.spacing(2.5)),
|
|
78
79
|
});
|
|
79
80
|
});
|
|
80
81
|
var IconWrapper = (0, styled_1.styled)('div', {
|
|
@@ -105,8 +106,9 @@ var InputElement = (0, styled_1.styled)('input', {
|
|
|
105
106
|
outline: 'none',
|
|
106
107
|
backgroundColor: 'transparent',
|
|
107
108
|
color: theme.tokens.color_fg_default,
|
|
108
|
-
fontSize: theme.typography.
|
|
109
|
-
|
|
109
|
+
fontSize: theme.typography.body2.fontSize,
|
|
110
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
111
|
+
lineHeight: theme.typography.body2.lineHeight,
|
|
110
112
|
fontFamily: theme.typography.fontFamily,
|
|
111
113
|
caretColor: theme.tokens.color_fg_brand_primary,
|
|
112
114
|
'&::placeholder': {
|
|
@@ -118,7 +120,8 @@ var InputElement = (0, styled_1.styled)('input', {
|
|
|
118
120
|
});
|
|
119
121
|
});
|
|
120
122
|
exports.CommandPaletteInput = React.forwardRef(function (props, ref) {
|
|
121
|
-
var _a = props.icon, icon = _a === void 0 ? React.createElement(icon_1.SearchIcon, { size: 20 }) : _a, _b = props.placeholder, placeholder = _b === void 0 ? 'Search for commands...' : _b, onValueChange = props.onValueChange, className = props.className, inputProps = __rest(props, ["icon", "placeholder", "onValueChange", "className"]);
|
|
123
|
+
var _a = props.icon, icon = _a === void 0 ? React.createElement(icon_1.SearchIcon, { size: 20 }) : _a, _b = props.placeholder, placeholder = _b === void 0 ? 'Search for commands...' : _b, onValueChange = props.onValueChange, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, inputProps = __rest(props, ["icon", "placeholder", "onValueChange", "analyticsId", "classes", "className", "sx"]);
|
|
124
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
122
125
|
var context = (0, command_palette_context_1.useCommandPaletteContext)();
|
|
123
126
|
var store = (0, command_palette_context_1.useCommandPaletteStore)();
|
|
124
127
|
var search = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.search; });
|
|
@@ -137,8 +140,8 @@ exports.CommandPaletteInput = React.forwardRef(function (props, ref) {
|
|
|
137
140
|
store.setState('search', e.target.value);
|
|
138
141
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(e.target.value);
|
|
139
142
|
}, [store, onValueChange]);
|
|
140
|
-
return (React.createElement(Wrapper, { className: (0, clsx_1.default)(
|
|
141
|
-
icon && React.createElement(IconWrapper, { className:
|
|
142
|
-
React.createElement(InputElement, __assign({ ref: ref, id: context.inputId, className:
|
|
143
|
+
return (React.createElement(Wrapper, __assign({ sx: sx, className: (0, clsx_1.default)(classes.inputWrapper, className) }, (analyticsId && { 'data-analytics-id': analyticsId })),
|
|
144
|
+
icon && React.createElement(IconWrapper, { className: classes.inputIcon }, icon),
|
|
145
|
+
React.createElement(InputElement, __assign({ ref: ref, id: context.inputId, className: classes.input, type: "text", role: "combobox", "aria-expanded": true, "aria-controls": context.listId, "aria-label": placeholder, "aria-autocomplete": "list", autoComplete: "off", autoCorrect: "off", spellCheck: false, placeholder: placeholder, value: search, onChange: handleChange, onCompositionStart: handleCompositionStart, onCompositionEnd: handleCompositionEnd }, inputProps))));
|
|
143
146
|
});
|
|
144
147
|
exports.CommandPaletteInput.displayName = 'CommandPaletteInput';
|
|
@@ -87,6 +87,7 @@ exports.CommandPaletteItem = void 0;
|
|
|
87
87
|
var React = __importStar(require("react"));
|
|
88
88
|
var useForkRef_1 = __importDefault(require("@mui/utils/useForkRef"));
|
|
89
89
|
var styled_1 = require("../styled");
|
|
90
|
+
var classes_1 = require("../styles/classes");
|
|
90
91
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
91
92
|
var use_id_1 = require("../utils/use-id");
|
|
92
93
|
var command_palette_1 = require("./command-palette");
|
|
@@ -97,7 +98,7 @@ var Root = (0, styled_1.styled)('div', {
|
|
|
97
98
|
slot: 'Item',
|
|
98
99
|
})(function (_a) {
|
|
99
100
|
var theme = _a.theme, ownerState = _a.ownerState;
|
|
100
|
-
return (__assign(__assign(__assign(__assign({ display: 'flex', alignItems: 'center', gap: theme.spacing(1.5), padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(1.5)), borderRadius: theme.spacing(
|
|
101
|
+
return (__assign(__assign(__assign(__assign({ display: 'flex', alignItems: 'center', gap: theme.spacing(1.5), padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(1.5)), borderRadius: theme.spacing(0.75), cursor: 'pointer', userSelect: 'none', fontSize: theme.typography.body2.fontSize, fontWeight: theme.typography.fontWeightMedium, lineHeight: theme.typography.body2.lineHeight, color: theme.tokens.color_fg_default, transition: theme.transitions.create(['background-color', 'color'], {
|
|
101
102
|
duration: theme.transitions.duration.shortest,
|
|
102
103
|
}) }, (ownerState.isSelected && {
|
|
103
104
|
backgroundColor: theme.tokens.color_bg_interactive_hover,
|
|
@@ -199,7 +200,7 @@ function useValue(id, ref, deps) {
|
|
|
199
200
|
exports.CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
200
201
|
var _a;
|
|
201
202
|
var _b, _c;
|
|
202
|
-
var valueProp = props.value, keywords = props.keywords, _d = props.disabled, disabled = _d === void 0 ? false : _d, onSelect = props.onSelect, _e = props.forceMount, forceMount = _e === void 0 ? false : _e, icon = props.icon, shortcut = props.shortcut, children = props.children, className = props.className, itemProps = __rest(props, ["value", "keywords", "disabled", "onSelect", "forceMount", "icon", "shortcut", "children", "className"]);
|
|
203
|
+
var valueProp = props.value, keywords = props.keywords, _d = props.disabled, disabled = _d === void 0 ? false : _d, onSelect = props.onSelect, _e = props.forceMount, forceMount = _e === void 0 ? false : _e, icon = props.icon, shortcut = props.shortcut, analyticsId = props.analyticsId, propClasses = props.classes, children = props.children, className = props.className, sx = props.sx, itemProps = __rest(props, ["value", "keywords", "disabled", "onSelect", "forceMount", "icon", "shortcut", "analyticsId", "classes", "children", "className", "sx"]);
|
|
203
204
|
var generatedId = (0, use_id_1.useId)();
|
|
204
205
|
var idRef = React.useRef();
|
|
205
206
|
if (!idRef.current) {
|
|
@@ -211,6 +212,7 @@ exports.CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
|
211
212
|
var context = (0, command_palette_context_1.useCommandPaletteContext)();
|
|
212
213
|
var store = (0, command_palette_context_1.useCommandPaletteStore)();
|
|
213
214
|
var groupId = React.useContext(command_palette_context_1.CommandPaletteGroupContext);
|
|
215
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
214
216
|
var itemValue = useValue(id, itemRef, [valueProp, keywords, children]);
|
|
215
217
|
var selectedValue = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.selectedValue; });
|
|
216
218
|
var isSelected = selectedValue === itemValue && itemValue !== '';
|
|
@@ -235,9 +237,9 @@ exports.CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
|
235
237
|
var shortcutKeys = shortcut ? (Array.isArray(shortcut) ? shortcut : shortcut.split('+')) : null;
|
|
236
238
|
if (!isVisible)
|
|
237
239
|
return null;
|
|
238
|
-
return (React.createElement(Root, __assign((_a = { ref: mergedRef, ownerState: { isSelected: isSelected, disabled: disabled }, className: (0, clsx_1.default)(
|
|
239
|
-
icon && React.createElement(ItemIcon, { className:
|
|
240
|
-
React.createElement(ItemLabel, { className:
|
|
241
|
-
shortcutKeys && (React.createElement(ItemShortcut, { className:
|
|
240
|
+
return (React.createElement(Root, __assign((_a = { ref: mergedRef, sx: sx, ownerState: { isSelected: isSelected, disabled: disabled }, className: (0, clsx_1.default)(classes.item, isSelected && classes.itemSelected, className), role: "option", "aria-selected": isSelected, "aria-disabled": disabled, "data-disabled": disabled || undefined }, _a[command_palette_1.VALUE_ATTR] = encodeURIComponent(itemValue), _a.onPointerMove = handlePointerMove, _a.onClick = handleClick, _a), (analyticsId && { 'data-analytics-id': analyticsId }), itemProps),
|
|
241
|
+
icon && React.createElement(ItemIcon, { className: classes.itemIcon }, icon),
|
|
242
|
+
React.createElement(ItemLabel, { className: classes.itemLabel }, children),
|
|
243
|
+
shortcutKeys && (React.createElement(ItemShortcut, { className: classes.itemShortcut }, shortcutKeys.map(function (key, i) { return (React.createElement(Kbd, { key: i, className: classes.kbd }, key)); })))));
|
|
242
244
|
});
|
|
243
245
|
exports.CommandPaletteItem.displayName = 'CommandPaletteItem';
|
|
@@ -61,6 +61,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
61
61
|
exports.CommandPaletteList = void 0;
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var styled_1 = require("../styled");
|
|
64
|
+
var classes_1 = require("../styles/classes");
|
|
64
65
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
65
66
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
66
67
|
var command_palette_context_1 = require("./command-palette-context");
|
|
@@ -93,9 +94,10 @@ var Inner = (0, styled_1.styled)('div', {
|
|
|
93
94
|
slot: 'ListInner',
|
|
94
95
|
})(function () { return ({}); });
|
|
95
96
|
exports.CommandPaletteList = React.forwardRef(function (props, ref) {
|
|
96
|
-
var children = props.children, className = props.className, style = props.style, listProps = __rest(props, ["children", "className", "style"]);
|
|
97
|
+
var children = props.children, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, style = props.style, sx = props.sx, listProps = __rest(props, ["children", "analyticsId", "classes", "className", "style", "sx"]);
|
|
97
98
|
var context = (0, command_palette_context_1.useCommandPaletteContext)();
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
100
|
+
return (React.createElement(Root, __assign({ ref: ref, id: context.listId, role: "listbox", "aria-label": "Suggestions", sx: sx, className: (0, clsx_1.default)(classes.list, className), style: style }, (analyticsId && { 'data-analytics-id': analyticsId }), listProps),
|
|
101
|
+
React.createElement(Inner, { ref: context.listInnerRef, className: classes.listInner }, children)));
|
|
100
102
|
});
|
|
101
103
|
exports.CommandPaletteList.displayName = 'CommandPaletteList';
|
|
@@ -62,6 +62,7 @@ exports.CommandPaletteLoading = void 0;
|
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var spinner_1 = require("../spinner");
|
|
64
64
|
var styled_1 = require("../styled");
|
|
65
|
+
var classes_1 = require("../styles/classes");
|
|
65
66
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
66
67
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
67
68
|
var Root = (0, styled_1.styled)('div', {
|
|
@@ -81,8 +82,9 @@ var Root = (0, styled_1.styled)('div', {
|
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
84
|
exports.CommandPaletteLoading = React.forwardRef(function (props, ref) {
|
|
84
|
-
var _a = props.progress, progress = _a === void 0 ? 0 : _a, _b = props.children, children = _b === void 0 ? 'Loading...' : _b, className = props.className, loadingProps = __rest(props, ["progress", "children", "className"]);
|
|
85
|
-
|
|
85
|
+
var _a = props.progress, progress = _a === void 0 ? 0 : _a, _b = props.children, children = _b === void 0 ? 'Loading...' : _b, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, loadingProps = __rest(props, ["progress", "children", "analyticsId", "classes", "className", "sx"]);
|
|
86
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
87
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, role: "progressbar", "aria-valuenow": progress, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": "Loading results", className: (0, clsx_1.default)(classes.loading, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), loadingProps),
|
|
86
88
|
React.createElement(spinner_1.Spinner, null),
|
|
87
89
|
children));
|
|
88
90
|
});
|
|
@@ -61,6 +61,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
61
61
|
exports.CommandPaletteSeparator = void 0;
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var styled_1 = require("../styled");
|
|
64
|
+
var classes_1 = require("../styles/classes");
|
|
64
65
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
65
66
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
66
67
|
var command_palette_context_1 = require("./command-palette-context");
|
|
@@ -76,11 +77,12 @@ var Root = (0, styled_1.styled)('div', {
|
|
|
76
77
|
});
|
|
77
78
|
});
|
|
78
79
|
exports.CommandPaletteSeparator = React.forwardRef(function (props, ref) {
|
|
79
|
-
var _a = props.alwaysRender, alwaysRender = _a === void 0 ? false : _a, className = props.className, separatorProps = __rest(props, ["alwaysRender", "className"]);
|
|
80
|
+
var _a = props.alwaysRender, alwaysRender = _a === void 0 ? false : _a, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, separatorProps = __rest(props, ["alwaysRender", "analyticsId", "classes", "className", "sx"]);
|
|
80
81
|
var search = (0, command_palette_context_1.useCommandPaletteState)(function (state) { return state.search; });
|
|
81
82
|
var isSearching = search.length > 0;
|
|
83
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
82
84
|
if (!alwaysRender && isSearching)
|
|
83
85
|
return null;
|
|
84
|
-
return (React.createElement(Root, __assign({ ref: ref, role: "separator", className: (0, clsx_1.default)(
|
|
86
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, role: "separator", className: (0, clsx_1.default)(classes.separator, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), separatorProps)));
|
|
85
87
|
});
|
|
86
88
|
exports.CommandPaletteSeparator.displayName = 'CommandPaletteSeparator';
|
|
@@ -62,6 +62,7 @@ exports.CommandPaletteTab = exports.CommandPaletteTabs = void 0;
|
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var useForkRef_1 = __importDefault(require("@mui/utils/useForkRef"));
|
|
64
64
|
var styled_1 = require("../styled");
|
|
65
|
+
var classes_1 = require("../styles/classes");
|
|
65
66
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
66
67
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
67
68
|
var Root = (0, styled_1.styled)('div', {
|
|
@@ -73,7 +74,7 @@ var Root = (0, styled_1.styled)('div', {
|
|
|
73
74
|
display: 'flex',
|
|
74
75
|
alignItems: 'center',
|
|
75
76
|
gap: theme.spacing(0.5),
|
|
76
|
-
padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(
|
|
77
|
+
padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(1.25)),
|
|
77
78
|
overflowX: 'auto',
|
|
78
79
|
scrollbarWidth: 'none',
|
|
79
80
|
'&::-webkit-scrollbar': {
|
|
@@ -86,23 +87,24 @@ var TabButton = (0, styled_1.styled)('button', {
|
|
|
86
87
|
slot: 'Tab',
|
|
87
88
|
})(function (_a) {
|
|
88
89
|
var theme = _a.theme, ownerState = _a.ownerState;
|
|
89
|
-
return (__assign(__assign(__assign({ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', padding: "".concat(theme.spacing(0.5), " ").concat(theme.spacing(1.
|
|
90
|
+
return (__assign(__assign(__assign({ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', padding: "".concat(theme.spacing(0.5), " ").concat(theme.spacing(1.25)), borderRadius: theme.spacing(0.75), border: 'none', cursor: 'pointer', fontSize: theme.typography.caption.fontSize, fontWeight: theme.typography.fontWeightSemibold, fontFamily: theme.typography.caption.fontFamily, lineHeight: theme.typography.caption.lineHeight, whiteSpace: 'nowrap', userSelect: 'none', transition: theme.transitions.create(['background-color', 'color'], {
|
|
90
91
|
duration: theme.transitions.duration.shortest,
|
|
91
92
|
}), color: theme.tokens.color_fg_disabled, backgroundColor: 'transparent' }, (ownerState.active && {
|
|
92
93
|
color: theme.tokens.color_fg_default,
|
|
93
|
-
backgroundColor: theme.tokens.
|
|
94
|
+
backgroundColor: theme.tokens.color_bg_layer_alternate_bold,
|
|
94
95
|
})), (!ownerState.active && {
|
|
95
96
|
'&:hover': {
|
|
96
97
|
backgroundColor: theme.tokens.color_bg_interactive_hover,
|
|
97
98
|
},
|
|
98
99
|
})), { '&:focus-visible': {
|
|
99
100
|
outline: 'none',
|
|
100
|
-
backgroundColor: theme.tokens.
|
|
101
|
+
backgroundColor: theme.tokens.color_bg_link_pressed,
|
|
101
102
|
} }));
|
|
102
103
|
});
|
|
103
104
|
exports.CommandPaletteTabs = React.forwardRef(function (props, ref) {
|
|
104
|
-
var children = props.children, className = props.className, tabsProps = __rest(props, ["children", "className"]);
|
|
105
|
+
var children = props.children, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, tabsProps = __rest(props, ["children", "analyticsId", "classes", "className", "sx"]);
|
|
105
106
|
var tabsRef = React.useRef(null);
|
|
107
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
106
108
|
var handleKeyDown = React.useCallback(function (e) {
|
|
107
109
|
var tabs = tabsRef.current;
|
|
108
110
|
if (!tabs)
|
|
@@ -132,15 +134,16 @@ exports.CommandPaletteTabs = React.forwardRef(function (props, ref) {
|
|
|
132
134
|
}
|
|
133
135
|
}, []);
|
|
134
136
|
var mergedRef = (0, useForkRef_1.default)(tabsRef, ref);
|
|
135
|
-
return (React.createElement(Root, __assign({ ref: mergedRef, role: "tablist", className: (0, clsx_1.default)(
|
|
137
|
+
return (React.createElement(Root, __assign({ ref: mergedRef, role: "tablist", sx: sx, className: (0, clsx_1.default)(classes.tabs, className), onKeyDown: handleKeyDown }, (analyticsId && { 'data-analytics-id': analyticsId }), tabsProps), children));
|
|
136
138
|
});
|
|
137
139
|
exports.CommandPaletteTabs.displayName = 'CommandPaletteTabs';
|
|
138
140
|
exports.CommandPaletteTab = React.forwardRef(function (props, ref) {
|
|
139
|
-
var _a = props.active, active = _a === void 0 ? false : _a, onSelect = props.onSelect, children = props.children, className = props.className, onClick = props.onClick, tabProps = __rest(props, ["active", "onSelect", "children", "className", "onClick"]);
|
|
141
|
+
var _a = props.active, active = _a === void 0 ? false : _a, onSelect = props.onSelect, analyticsId = props.analyticsId, propClasses = props.classes, children = props.children, className = props.className, onClick = props.onClick, sx = props.sx, tabProps = __rest(props, ["active", "onSelect", "analyticsId", "classes", "children", "className", "onClick", "sx"]);
|
|
142
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
140
143
|
var handleClick = React.useCallback(function (e) {
|
|
141
144
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
142
145
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
143
146
|
}, [onSelect, onClick]);
|
|
144
|
-
return (React.createElement(TabButton, __assign({ ref: ref, role: "tab", type: "button", "aria-selected": active, tabIndex: active ? 0 : -1, ownerState: { active: active }, className: (0, clsx_1.default)(
|
|
147
|
+
return (React.createElement(TabButton, __assign({ ref: ref, role: "tab", type: "button", "aria-selected": active, tabIndex: active ? 0 : -1, sx: sx, ownerState: { active: active }, className: (0, clsx_1.default)(classes.tab, active && classes.tabSelected, className), onClick: handleClick }, (analyticsId && { 'data-analytics-id': analyticsId }), tabProps), children));
|
|
145
148
|
});
|
|
146
149
|
exports.CommandPaletteTab.displayName = 'CommandPaletteTab';
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { SxProps } from '../styled';
|
|
3
|
+
import type { CommandPaletteClasses } from './command-palette-classes';
|
|
2
4
|
export type CommandPaletteFilterFn = (value: string, search: string, keywords?: string[]) => number;
|
|
5
|
+
export interface ICommandPaletteCommonProps {
|
|
6
|
+
/** Analytics identifier rendered as `data-analytics-id` */
|
|
7
|
+
analyticsId?: string;
|
|
8
|
+
/** Slot class overrides */
|
|
9
|
+
classes?: Partial<CommandPaletteClasses>;
|
|
10
|
+
/** Style overrides */
|
|
11
|
+
sx?: SxProps;
|
|
12
|
+
}
|
|
3
13
|
export interface ICommandPaletteState {
|
|
4
14
|
search: string;
|
|
5
15
|
selectedValue: string;
|
|
@@ -25,7 +35,7 @@ export interface ICommandPaletteContextValue {
|
|
|
25
35
|
inputId: string;
|
|
26
36
|
listInnerRef: React.RefObject<HTMLDivElement | null>;
|
|
27
37
|
}
|
|
28
|
-
export interface ICommandPaletteProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'
|
|
38
|
+
export interface ICommandPaletteProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'>, ICommandPaletteCommonProps {
|
|
29
39
|
/** Accessible label for the command palette */
|
|
30
40
|
label?: string;
|
|
31
41
|
/** Controlled search value */
|
|
@@ -46,25 +56,25 @@ export interface ICommandPaletteProps extends Omit<React.HTMLAttributes<HTMLDivE
|
|
|
46
56
|
onSelect?(value: string): void;
|
|
47
57
|
children?: React.ReactNode;
|
|
48
58
|
}
|
|
49
|
-
export interface ICommandPaletteInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
59
|
+
export interface ICommandPaletteInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'type'>, ICommandPaletteCommonProps {
|
|
50
60
|
/** Icon to show before the input */
|
|
51
61
|
icon?: React.ReactNode;
|
|
52
62
|
/** Callback when value changes */
|
|
53
63
|
onValueChange?(search: string): void;
|
|
54
64
|
}
|
|
55
|
-
export interface ICommandPaletteListProps extends React.HTMLAttributes<HTMLDivElement
|
|
65
|
+
export interface ICommandPaletteListProps extends React.HTMLAttributes<HTMLDivElement>, ICommandPaletteCommonProps {
|
|
56
66
|
children?: React.ReactNode;
|
|
57
67
|
}
|
|
58
|
-
export interface ICommandPaletteGroupProps extends React.HTMLAttributes<HTMLDivElement
|
|
68
|
+
export interface ICommandPaletteGroupProps extends React.HTMLAttributes<HTMLDivElement>, ICommandPaletteCommonProps {
|
|
59
69
|
/** Heading text for the group */
|
|
60
70
|
heading?: React.ReactNode;
|
|
61
71
|
/** Force render even when all items are filtered out */
|
|
62
72
|
forceMount?: boolean;
|
|
63
|
-
/**
|
|
73
|
+
/** Stable value used to identify the group in filtering state */
|
|
64
74
|
value?: string;
|
|
65
75
|
children?: React.ReactNode;
|
|
66
76
|
}
|
|
67
|
-
export interface ICommandPaletteItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'
|
|
77
|
+
export interface ICommandPaletteItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'>, ICommandPaletteCommonProps {
|
|
68
78
|
/** Unique value for the item (auto-derived from textContent if not provided) */
|
|
69
79
|
value?: string;
|
|
70
80
|
/** Additional keywords for filtering */
|
|
@@ -81,24 +91,24 @@ export interface ICommandPaletteItemProps extends Omit<React.HTMLAttributes<HTML
|
|
|
81
91
|
shortcut?: string | string[];
|
|
82
92
|
children?: React.ReactNode;
|
|
83
93
|
}
|
|
84
|
-
export interface ICommandPaletteTabsProps extends React.HTMLAttributes<HTMLDivElement
|
|
94
|
+
export interface ICommandPaletteTabsProps extends React.HTMLAttributes<HTMLDivElement>, ICommandPaletteCommonProps {
|
|
85
95
|
children?: React.ReactNode;
|
|
86
96
|
}
|
|
87
|
-
export interface ICommandPaletteTabProps extends React.
|
|
97
|
+
export interface ICommandPaletteTabProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, ICommandPaletteCommonProps {
|
|
88
98
|
/** Whether this tab is currently active */
|
|
89
99
|
active?: boolean;
|
|
90
100
|
/** Callback when tab is clicked */
|
|
91
101
|
onSelect?(): void;
|
|
92
102
|
children?: React.ReactNode;
|
|
93
103
|
}
|
|
94
|
-
export interface ICommandPaletteSeparatorProps extends React.HTMLAttributes<HTMLDivElement
|
|
104
|
+
export interface ICommandPaletteSeparatorProps extends React.HTMLAttributes<HTMLDivElement>, ICommandPaletteCommonProps {
|
|
95
105
|
/** Render even when search is active */
|
|
96
106
|
alwaysRender?: boolean;
|
|
97
107
|
}
|
|
98
|
-
export interface ICommandPaletteEmptyProps extends React.HTMLAttributes<HTMLDivElement
|
|
108
|
+
export interface ICommandPaletteEmptyProps extends React.HTMLAttributes<HTMLDivElement>, ICommandPaletteCommonProps {
|
|
99
109
|
children?: React.ReactNode;
|
|
100
110
|
}
|
|
101
|
-
export interface ICommandPaletteLoadingProps extends React.HTMLAttributes<HTMLDivElement
|
|
111
|
+
export interface ICommandPaletteLoadingProps extends React.HTMLAttributes<HTMLDivElement>, ICommandPaletteCommonProps {
|
|
102
112
|
/** Progress percentage (0-100) */
|
|
103
113
|
progress?: number;
|
|
104
114
|
children?: React.ReactNode;
|
|
@@ -113,9 +123,9 @@ export interface ICommandPaletteDialogProps extends ICommandPaletteProps {
|
|
|
113
123
|
/** Props to pass to the dialog content wrapper */
|
|
114
124
|
contentProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
115
125
|
}
|
|
116
|
-
export interface ICommandPaletteFooterProps extends React.HTMLAttributes<HTMLDivElement
|
|
126
|
+
export interface ICommandPaletteFooterProps extends React.HTMLAttributes<HTMLDivElement>, ICommandPaletteCommonProps {
|
|
117
127
|
children?: React.ReactNode;
|
|
118
128
|
}
|
|
119
|
-
export interface ICommandPaletteShortcutKeyProps extends React.HTMLAttributes<HTMLElement
|
|
129
|
+
export interface ICommandPaletteShortcutKeyProps extends React.HTMLAttributes<HTMLElement>, ICommandPaletteCommonProps {
|
|
120
130
|
children?: React.ReactNode;
|
|
121
131
|
}
|
|
@@ -220,7 +220,7 @@ function useScheduleLayoutEffect() {
|
|
|
220
220
|
}
|
|
221
221
|
exports.CommandPalette = React.forwardRef(function (props, ref) {
|
|
222
222
|
var _a;
|
|
223
|
-
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"]);
|
|
223
|
+
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, analyticsId = props.analyticsId, propClasses = props.classes, children = props.children, className = props.className, sx = props.sx, rootProps = __rest(props, ["label", "search", "onSearchChange", "value", "onValueChange", "filter", "shouldFilter", "loop", "onSelect", "analyticsId", "classes", "children", "className", "sx"]);
|
|
224
224
|
var generatedId = (0, use_id_1.useId)();
|
|
225
225
|
var id = (_a = rootProps.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
226
226
|
var listId = id ? "".concat(id, "-list") : undefined;
|
|
@@ -469,9 +469,9 @@ exports.CommandPalette = React.forwardRef(function (props, ref) {
|
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
}, [loop, store, propsRef]);
|
|
472
|
-
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass,
|
|
472
|
+
var classes = (0, classes_1.useMergedClasses)(command_palette_classes_1.commandPaletteClasses, command_palette_classes_1.getCommandPaletteUtilityClass, propClasses);
|
|
473
473
|
return (React.createElement(command_palette_context_1.CommandPaletteStoreContext.Provider, { value: store.current },
|
|
474
474
|
React.createElement(command_palette_context_1.CommandPaletteContext.Provider, { value: context },
|
|
475
|
-
React.createElement(Root, __assign({ ref: ref, className: (0, clsx_1.default)(classes.root, className), tabIndex: -1, onKeyDown: handleKeyDown, "aria-label": label }, rootProps), children))));
|
|
475
|
+
React.createElement(Root, __assign({ ref: ref, sx: sx, className: (0, clsx_1.default)(classes.root, className), tabIndex: -1, onKeyDown: handleKeyDown, "aria-label": label }, (analyticsId && { 'data-analytics-id': analyticsId }), rootProps), children))));
|
|
476
476
|
});
|
|
477
477
|
exports.CommandPalette.displayName = 'CommandPalette';
|
|
@@ -24,9 +24,10 @@ import * as React from 'react';
|
|
|
24
24
|
import MuiDialog from '@mui/material/Dialog';
|
|
25
25
|
import useForkRef from '@mui/utils/useForkRef';
|
|
26
26
|
import { styled } from '../styled';
|
|
27
|
+
import { useMergedClasses } from '../styles/classes';
|
|
27
28
|
import clsx from '../utils/clsx';
|
|
28
29
|
import { CommandPalette } from './command-palette';
|
|
29
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
30
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
30
31
|
var StyledDialog = styled(MuiDialog, {
|
|
31
32
|
name: commandPaletteComponentName,
|
|
32
33
|
slot: 'Dialog',
|
|
@@ -45,18 +46,19 @@ var StyledDialog = styled(MuiDialog, {
|
|
|
45
46
|
overflow: 'hidden',
|
|
46
47
|
backgroundColor: theme.tokens.color_bg_layer_elevated,
|
|
47
48
|
border: "1px solid ".concat(theme.tokens.color_border_default),
|
|
48
|
-
boxShadow:
|
|
49
|
+
boxShadow: '0 -1px 0 -1px rgba(0,0,0,0.06), 0 1px 0 -1px rgba(0,0,0,0.06), 0 2px 24px -6px rgba(0,0,0,0.04), 0 4px 48px -12px rgba(0,0,0,0.04), 0 8px 80px -24px rgba(0,0,0,0.04)',
|
|
49
50
|
},
|
|
50
51
|
'& .MuiBackdrop-root': {
|
|
51
|
-
backgroundColor: 'rgba(0, 0, 0, 0.
|
|
52
|
-
backdropFilter: 'blur(
|
|
52
|
+
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
53
|
+
backdropFilter: 'blur(2px)',
|
|
53
54
|
},
|
|
54
55
|
});
|
|
55
56
|
});
|
|
56
57
|
export var CommandPaletteDialog = React.forwardRef(function (props, ref) {
|
|
57
|
-
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"]);
|
|
58
|
+
var _a = props.open, open = _a === void 0 ? false : _a, onOpenChange = props.onOpenChange, overlayProps = props.overlayProps, contentProps = props.contentProps, analyticsId = props.analyticsId, propClasses = props.classes, children = props.children, className = props.className, sx = props.sx, commandPaletteProps = __rest(props, ["open", "onOpenChange", "overlayProps", "contentProps", "analyticsId", "classes", "children", "className", "sx"]);
|
|
58
59
|
var paletteRef = React.useRef(null);
|
|
59
60
|
var handleRef = useForkRef(ref, paletteRef);
|
|
61
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
60
62
|
var handleEntered = React.useCallback(function () {
|
|
61
63
|
requestAnimationFrame(function () {
|
|
62
64
|
var _a;
|
|
@@ -67,7 +69,7 @@ export var CommandPaletteDialog = React.forwardRef(function (props, ref) {
|
|
|
67
69
|
var handleClose = React.useCallback(function () {
|
|
68
70
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
|
|
69
71
|
}, [onOpenChange]);
|
|
70
|
-
return (React.createElement(StyledDialog, { open: open, onClose: handleClose, TransitionProps: { onEntered: handleEntered }, className: clsx(
|
|
72
|
+
return (React.createElement(StyledDialog, __assign({ open: open, onClose: handleClose, TransitionProps: { onEntered: handleEntered }, sx: sx, className: clsx(classes.dialog, className), maxWidth: false, BackdropProps: overlayProps, PaperProps: __assign(__assign({}, contentProps), { className: clsx(commandPaletteClasses.dialogPaper, classes.dialogPaper, contentProps === null || contentProps === void 0 ? void 0 : contentProps.className) }) }, (analyticsId && { 'data-analytics-id': analyticsId })),
|
|
71
73
|
React.createElement(CommandPalette, __assign({ ref: handleRef }, commandPaletteProps), children)));
|
|
72
74
|
});
|
|
73
75
|
CommandPaletteDialog.displayName = 'CommandPaletteDialog';
|