@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
|
@@ -22,8 +22,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { styled } from '../styled';
|
|
25
|
+
import { useMergedClasses } from '../styles/classes';
|
|
25
26
|
import clsx from '../utils/clsx';
|
|
26
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
27
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
27
28
|
import { useCommandPaletteState } from './command-palette-context';
|
|
28
29
|
var Root = styled('div', {
|
|
29
30
|
name: commandPaletteComponentName,
|
|
@@ -41,11 +42,12 @@ var Root = styled('div', {
|
|
|
41
42
|
});
|
|
42
43
|
});
|
|
43
44
|
export var CommandPaletteEmpty = React.forwardRef(function (props, ref) {
|
|
44
|
-
var _a = props.children, children = _a === void 0 ? 'No results found.' : _a, className = props.className, emptyProps = __rest(props, ["children", "className"]);
|
|
45
|
+
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"]);
|
|
45
46
|
var filteredCount = useCommandPaletteState(function (state) { return state.filtered.count; });
|
|
46
47
|
var isSearching = useCommandPaletteState(function (state) { return state.search.length > 0; });
|
|
48
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
47
49
|
if (!isSearching || filteredCount > 0)
|
|
48
50
|
return null;
|
|
49
|
-
return (React.createElement(Root, __assign({ ref: ref, role: "presentation", className: clsx(
|
|
51
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, role: "presentation", className: clsx(classes.empty, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), emptyProps), children));
|
|
50
52
|
});
|
|
51
53
|
CommandPaletteEmpty.displayName = 'CommandPaletteEmpty';
|
|
@@ -22,8 +22,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { styled } from '../styled';
|
|
25
|
+
import { useMergedClasses } from '../styles/classes';
|
|
25
26
|
import clsx from '../utils/clsx';
|
|
26
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
27
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
27
28
|
var Root = styled('div', {
|
|
28
29
|
name: commandPaletteComponentName,
|
|
29
30
|
slot: 'Footer',
|
|
@@ -41,7 +42,7 @@ var Root = styled('div', {
|
|
|
41
42
|
});
|
|
42
43
|
var Kbd = styled('kbd', {
|
|
43
44
|
name: commandPaletteComponentName,
|
|
44
|
-
slot: '
|
|
45
|
+
slot: 'Kbd',
|
|
45
46
|
})(function (_a) {
|
|
46
47
|
var theme = _a.theme;
|
|
47
48
|
return ({
|
|
@@ -61,12 +62,14 @@ var Kbd = styled('kbd', {
|
|
|
61
62
|
});
|
|
62
63
|
});
|
|
63
64
|
export var CommandPaletteFooter = React.forwardRef(function (props, ref) {
|
|
64
|
-
var children = props.children, className = props.className, footerProps = __rest(props, ["children", "className"]);
|
|
65
|
-
|
|
65
|
+
var children = props.children, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, footerProps = __rest(props, ["children", "analyticsId", "classes", "className", "sx"]);
|
|
66
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
67
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, className: clsx(classes.footer, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), footerProps), children));
|
|
66
68
|
});
|
|
67
69
|
CommandPaletteFooter.displayName = 'CommandPaletteFooter';
|
|
68
70
|
export var CommandPaletteShortcutKey = React.forwardRef(function (props, ref) {
|
|
69
|
-
var children = props.children, className = props.className, kbdProps = __rest(props, ["children", "className"]);
|
|
70
|
-
|
|
71
|
+
var children = props.children, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, kbdProps = __rest(props, ["children", "analyticsId", "classes", "className", "sx"]);
|
|
72
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
73
|
+
return (React.createElement(Kbd, __assign({ ref: ref, sx: sx, className: clsx(classes.kbd, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), kbdProps), children));
|
|
71
74
|
});
|
|
72
75
|
CommandPaletteShortcutKey.displayName = 'CommandPaletteShortcutKey';
|
|
@@ -22,9 +22,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { styled } from '../styled';
|
|
25
|
+
import { useMergedClasses } from '../styles/classes';
|
|
25
26
|
import clsx from '../utils/clsx';
|
|
26
27
|
import { useId } from '../utils/use-id';
|
|
27
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
28
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
28
29
|
import { CommandPaletteGroupContext, useCommandPaletteContext, useCommandPaletteState, } from './command-palette-context';
|
|
29
30
|
var Root = styled('div', {
|
|
30
31
|
name: commandPaletteComponentName,
|
|
@@ -58,23 +59,25 @@ var Items = styled('div', {
|
|
|
58
59
|
outline: 'none',
|
|
59
60
|
}); });
|
|
60
61
|
export var CommandPaletteGroup = React.forwardRef(function (props, ref) {
|
|
61
|
-
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"]);
|
|
62
|
-
var
|
|
63
|
-
var
|
|
62
|
+
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"]);
|
|
63
|
+
var generatedId = useId() || '';
|
|
64
|
+
var groupId = value || generatedId;
|
|
65
|
+
var headingId = generatedId ? "".concat(generatedId, "-heading") : undefined;
|
|
64
66
|
var context = useCommandPaletteContext();
|
|
67
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
65
68
|
React.useLayoutEffect(function () {
|
|
66
|
-
var cleanup = context.group(
|
|
69
|
+
var cleanup = context.group(groupId);
|
|
67
70
|
return cleanup;
|
|
68
|
-
}, [context,
|
|
71
|
+
}, [context, groupId]);
|
|
69
72
|
var filteredState = useCommandPaletteState(function (state) { return state.filtered; });
|
|
70
73
|
var search = useCommandPaletteState(function (state) { return state.search; });
|
|
71
|
-
var groupCount = filteredState.groups.get(
|
|
74
|
+
var groupCount = filteredState.groups.get(groupId);
|
|
72
75
|
var isVisible = forceMount || context.filter === false || !search || (groupCount !== undefined && groupCount > 0);
|
|
73
76
|
if (!isVisible)
|
|
74
77
|
return null;
|
|
75
|
-
return (React.createElement(Root, __assign({ ref: ref, className: clsx(
|
|
76
|
-
heading && (React.createElement(Heading, { id: headingId, className:
|
|
77
|
-
React.createElement(CommandPaletteGroupContext.Provider, { value:
|
|
78
|
-
React.createElement(Items, { role: "group", className:
|
|
78
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, className: clsx(classes.group, className), role: "presentation" }, (analyticsId && { 'data-analytics-id': analyticsId }), groupProps),
|
|
79
|
+
heading && (React.createElement(Heading, { id: headingId, className: classes.groupHeading, "aria-hidden": true }, heading)),
|
|
80
|
+
React.createElement(CommandPaletteGroupContext.Provider, { value: groupId },
|
|
81
|
+
React.createElement(Items, { role: "group", className: classes.groupItems, "aria-labelledby": heading ? headingId : undefined }, children))));
|
|
79
82
|
});
|
|
80
83
|
CommandPaletteGroup.displayName = 'CommandPaletteGroup';
|
|
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { SearchIcon } from '../icon';
|
|
25
25
|
import { styled } from '../styled';
|
|
26
|
+
import { useMergedClasses } from '../styles/classes';
|
|
26
27
|
import clsx from '../utils/clsx';
|
|
27
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
28
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
28
29
|
import { useCommandPaletteContext, useCommandPaletteState, useCommandPaletteStore } from './command-palette-context';
|
|
29
30
|
var Wrapper = styled('div', {
|
|
30
31
|
name: commandPaletteComponentName,
|
|
@@ -35,7 +36,7 @@ var Wrapper = styled('div', {
|
|
|
35
36
|
display: 'flex',
|
|
36
37
|
alignItems: 'center',
|
|
37
38
|
gap: theme.spacing(1.5),
|
|
38
|
-
padding: "".concat(theme.spacing(1.
|
|
39
|
+
padding: "".concat(theme.spacing(1.75), " ").concat(theme.spacing(2.5)),
|
|
39
40
|
});
|
|
40
41
|
});
|
|
41
42
|
var IconWrapper = styled('div', {
|
|
@@ -66,8 +67,9 @@ var InputElement = styled('input', {
|
|
|
66
67
|
outline: 'none',
|
|
67
68
|
backgroundColor: 'transparent',
|
|
68
69
|
color: theme.tokens.color_fg_default,
|
|
69
|
-
fontSize: theme.typography.
|
|
70
|
-
|
|
70
|
+
fontSize: theme.typography.body2.fontSize,
|
|
71
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
72
|
+
lineHeight: theme.typography.body2.lineHeight,
|
|
71
73
|
fontFamily: theme.typography.fontFamily,
|
|
72
74
|
caretColor: theme.tokens.color_fg_brand_primary,
|
|
73
75
|
'&::placeholder': {
|
|
@@ -79,7 +81,8 @@ var InputElement = styled('input', {
|
|
|
79
81
|
});
|
|
80
82
|
});
|
|
81
83
|
export var CommandPaletteInput = React.forwardRef(function (props, ref) {
|
|
82
|
-
var _a = props.icon, icon = _a === void 0 ? React.createElement(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"]);
|
|
84
|
+
var _a = props.icon, icon = _a === void 0 ? React.createElement(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"]);
|
|
85
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
83
86
|
var context = useCommandPaletteContext();
|
|
84
87
|
var store = useCommandPaletteStore();
|
|
85
88
|
var search = useCommandPaletteState(function (state) { return state.search; });
|
|
@@ -98,8 +101,8 @@ export var CommandPaletteInput = React.forwardRef(function (props, ref) {
|
|
|
98
101
|
store.setState('search', e.target.value);
|
|
99
102
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(e.target.value);
|
|
100
103
|
}, [store, onValueChange]);
|
|
101
|
-
return (React.createElement(Wrapper, { className: clsx(
|
|
102
|
-
icon && React.createElement(IconWrapper, { className:
|
|
103
|
-
React.createElement(InputElement, __assign({ ref: ref, id: context.inputId, className:
|
|
104
|
+
return (React.createElement(Wrapper, __assign({ sx: sx, className: clsx(classes.inputWrapper, className) }, (analyticsId && { 'data-analytics-id': analyticsId })),
|
|
105
|
+
icon && React.createElement(IconWrapper, { className: classes.inputIcon }, icon),
|
|
106
|
+
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))));
|
|
104
107
|
});
|
|
105
108
|
CommandPaletteInput.displayName = 'CommandPaletteInput';
|
|
@@ -48,17 +48,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
48
48
|
import * as React from 'react';
|
|
49
49
|
import useForkRef from '@mui/utils/useForkRef';
|
|
50
50
|
import { styled } from '../styled';
|
|
51
|
+
import { useMergedClasses } from '../styles/classes';
|
|
51
52
|
import clsx from '../utils/clsx';
|
|
52
53
|
import { useId } from '../utils/use-id';
|
|
53
54
|
import { VALUE_ATTR } from './command-palette';
|
|
54
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
55
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
55
56
|
import { CommandPaletteGroupContext, useCommandPaletteContext, useCommandPaletteState, useCommandPaletteStore, } from './command-palette-context';
|
|
56
57
|
var Root = styled('div', {
|
|
57
58
|
name: commandPaletteComponentName,
|
|
58
59
|
slot: 'Item',
|
|
59
60
|
})(function (_a) {
|
|
60
61
|
var theme = _a.theme, ownerState = _a.ownerState;
|
|
61
|
-
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(
|
|
62
|
+
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'], {
|
|
62
63
|
duration: theme.transitions.duration.shortest,
|
|
63
64
|
}) }, (ownerState.isSelected && {
|
|
64
65
|
backgroundColor: theme.tokens.color_bg_interactive_hover,
|
|
@@ -160,7 +161,7 @@ function useValue(id, ref, deps) {
|
|
|
160
161
|
export var CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
161
162
|
var _a;
|
|
162
163
|
var _b, _c;
|
|
163
|
-
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"]);
|
|
164
|
+
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"]);
|
|
164
165
|
var generatedId = useId();
|
|
165
166
|
var idRef = React.useRef();
|
|
166
167
|
if (!idRef.current) {
|
|
@@ -172,6 +173,7 @@ export var CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
|
172
173
|
var context = useCommandPaletteContext();
|
|
173
174
|
var store = useCommandPaletteStore();
|
|
174
175
|
var groupId = React.useContext(CommandPaletteGroupContext);
|
|
176
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
175
177
|
var itemValue = useValue(id, itemRef, [valueProp, keywords, children]);
|
|
176
178
|
var selectedValue = useCommandPaletteState(function (state) { return state.selectedValue; });
|
|
177
179
|
var isSelected = selectedValue === itemValue && itemValue !== '';
|
|
@@ -196,9 +198,9 @@ export var CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
|
196
198
|
var shortcutKeys = shortcut ? (Array.isArray(shortcut) ? shortcut : shortcut.split('+')) : null;
|
|
197
199
|
if (!isVisible)
|
|
198
200
|
return null;
|
|
199
|
-
return (React.createElement(Root, __assign((_a = { ref: mergedRef, ownerState: { isSelected: isSelected, disabled: disabled }, className: clsx(
|
|
200
|
-
icon && React.createElement(ItemIcon, { className:
|
|
201
|
-
React.createElement(ItemLabel, { className:
|
|
202
|
-
shortcutKeys && (React.createElement(ItemShortcut, { className:
|
|
201
|
+
return (React.createElement(Root, __assign((_a = { ref: mergedRef, sx: sx, ownerState: { isSelected: isSelected, disabled: disabled }, className: clsx(classes.item, isSelected && classes.itemSelected, className), role: "option", "aria-selected": isSelected, "aria-disabled": disabled, "data-disabled": disabled || undefined }, _a[VALUE_ATTR] = encodeURIComponent(itemValue), _a.onPointerMove = handlePointerMove, _a.onClick = handleClick, _a), (analyticsId && { 'data-analytics-id': analyticsId }), itemProps),
|
|
202
|
+
icon && React.createElement(ItemIcon, { className: classes.itemIcon }, icon),
|
|
203
|
+
React.createElement(ItemLabel, { className: classes.itemLabel }, children),
|
|
204
|
+
shortcutKeys && (React.createElement(ItemShortcut, { className: classes.itemShortcut }, shortcutKeys.map(function (key, i) { return (React.createElement(Kbd, { key: i, className: classes.kbd }, key)); })))));
|
|
203
205
|
});
|
|
204
206
|
CommandPaletteItem.displayName = 'CommandPaletteItem';
|
|
@@ -22,8 +22,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { styled } from '../styled';
|
|
25
|
+
import { useMergedClasses } from '../styles/classes';
|
|
25
26
|
import clsx from '../utils/clsx';
|
|
26
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
27
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
27
28
|
import { useCommandPaletteContext } from './command-palette-context';
|
|
28
29
|
var Root = styled('div', {
|
|
29
30
|
name: commandPaletteComponentName,
|
|
@@ -54,9 +55,10 @@ var Inner = styled('div', {
|
|
|
54
55
|
slot: 'ListInner',
|
|
55
56
|
})(function () { return ({}); });
|
|
56
57
|
export var CommandPaletteList = React.forwardRef(function (props, ref) {
|
|
57
|
-
var children = props.children, className = props.className, style = props.style, listProps = __rest(props, ["children", "className", "style"]);
|
|
58
|
+
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"]);
|
|
58
59
|
var context = useCommandPaletteContext();
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
61
|
+
return (React.createElement(Root, __assign({ ref: ref, id: context.listId, role: "listbox", "aria-label": "Suggestions", sx: sx, className: clsx(classes.list, className), style: style }, (analyticsId && { 'data-analytics-id': analyticsId }), listProps),
|
|
62
|
+
React.createElement(Inner, { ref: context.listInnerRef, className: classes.listInner }, children)));
|
|
61
63
|
});
|
|
62
64
|
CommandPaletteList.displayName = 'CommandPaletteList';
|
|
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { Spinner } from '../spinner';
|
|
25
25
|
import { styled } from '../styled';
|
|
26
|
+
import { useMergedClasses } from '../styles/classes';
|
|
26
27
|
import clsx from '../utils/clsx';
|
|
27
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
28
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
28
29
|
var Root = styled('div', {
|
|
29
30
|
name: commandPaletteComponentName,
|
|
30
31
|
slot: 'Loading',
|
|
@@ -42,8 +43,9 @@ var Root = styled('div', {
|
|
|
42
43
|
});
|
|
43
44
|
});
|
|
44
45
|
export var CommandPaletteLoading = React.forwardRef(function (props, ref) {
|
|
45
|
-
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"]);
|
|
46
|
-
|
|
46
|
+
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"]);
|
|
47
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
48
|
+
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: clsx(classes.loading, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), loadingProps),
|
|
47
49
|
React.createElement(Spinner, null),
|
|
48
50
|
children));
|
|
49
51
|
});
|
|
@@ -22,8 +22,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { styled } from '../styled';
|
|
25
|
+
import { useMergedClasses } from '../styles/classes';
|
|
25
26
|
import clsx from '../utils/clsx';
|
|
26
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
27
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
27
28
|
import { useCommandPaletteState } from './command-palette-context';
|
|
28
29
|
var Root = styled('div', {
|
|
29
30
|
name: commandPaletteComponentName,
|
|
@@ -37,11 +38,12 @@ var Root = styled('div', {
|
|
|
37
38
|
});
|
|
38
39
|
});
|
|
39
40
|
export var CommandPaletteSeparator = React.forwardRef(function (props, ref) {
|
|
40
|
-
var _a = props.alwaysRender, alwaysRender = _a === void 0 ? false : _a, className = props.className, separatorProps = __rest(props, ["alwaysRender", "className"]);
|
|
41
|
+
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"]);
|
|
41
42
|
var search = useCommandPaletteState(function (state) { return state.search; });
|
|
42
43
|
var isSearching = search.length > 0;
|
|
44
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
43
45
|
if (!alwaysRender && isSearching)
|
|
44
46
|
return null;
|
|
45
|
-
return (React.createElement(Root, __assign({ ref: ref, role: "separator", className: clsx(
|
|
47
|
+
return (React.createElement(Root, __assign({ ref: ref, sx: sx, role: "separator", className: clsx(classes.separator, className) }, (analyticsId && { 'data-analytics-id': analyticsId }), separatorProps)));
|
|
46
48
|
});
|
|
47
49
|
CommandPaletteSeparator.displayName = 'CommandPaletteSeparator';
|
|
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import useForkRef from '@mui/utils/useForkRef';
|
|
25
25
|
import { styled } from '../styled';
|
|
26
|
+
import { useMergedClasses } from '../styles/classes';
|
|
26
27
|
import clsx from '../utils/clsx';
|
|
27
|
-
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
28
|
+
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
28
29
|
var Root = styled('div', {
|
|
29
30
|
name: commandPaletteComponentName,
|
|
30
31
|
slot: 'Tabs',
|
|
@@ -34,7 +35,7 @@ var Root = styled('div', {
|
|
|
34
35
|
display: 'flex',
|
|
35
36
|
alignItems: 'center',
|
|
36
37
|
gap: theme.spacing(0.5),
|
|
37
|
-
padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(
|
|
38
|
+
padding: "".concat(theme.spacing(1), " ").concat(theme.spacing(1.25)),
|
|
38
39
|
overflowX: 'auto',
|
|
39
40
|
scrollbarWidth: 'none',
|
|
40
41
|
'&::-webkit-scrollbar': {
|
|
@@ -47,23 +48,24 @@ var TabButton = styled('button', {
|
|
|
47
48
|
slot: 'Tab',
|
|
48
49
|
})(function (_a) {
|
|
49
50
|
var theme = _a.theme, ownerState = _a.ownerState;
|
|
50
|
-
return (__assign(__assign(__assign({ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', padding: "".concat(theme.spacing(0.5), " ").concat(theme.spacing(1.
|
|
51
|
+
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'], {
|
|
51
52
|
duration: theme.transitions.duration.shortest,
|
|
52
53
|
}), color: theme.tokens.color_fg_disabled, backgroundColor: 'transparent' }, (ownerState.active && {
|
|
53
54
|
color: theme.tokens.color_fg_default,
|
|
54
|
-
backgroundColor: theme.tokens.
|
|
55
|
+
backgroundColor: theme.tokens.color_bg_layer_alternate_bold,
|
|
55
56
|
})), (!ownerState.active && {
|
|
56
57
|
'&:hover': {
|
|
57
58
|
backgroundColor: theme.tokens.color_bg_interactive_hover,
|
|
58
59
|
},
|
|
59
60
|
})), { '&:focus-visible': {
|
|
60
61
|
outline: 'none',
|
|
61
|
-
backgroundColor: theme.tokens.
|
|
62
|
+
backgroundColor: theme.tokens.color_bg_link_pressed,
|
|
62
63
|
} }));
|
|
63
64
|
});
|
|
64
65
|
export var CommandPaletteTabs = React.forwardRef(function (props, ref) {
|
|
65
|
-
var children = props.children, className = props.className, tabsProps = __rest(props, ["children", "className"]);
|
|
66
|
+
var children = props.children, analyticsId = props.analyticsId, propClasses = props.classes, className = props.className, sx = props.sx, tabsProps = __rest(props, ["children", "analyticsId", "classes", "className", "sx"]);
|
|
66
67
|
var tabsRef = React.useRef(null);
|
|
68
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
67
69
|
var handleKeyDown = React.useCallback(function (e) {
|
|
68
70
|
var tabs = tabsRef.current;
|
|
69
71
|
if (!tabs)
|
|
@@ -93,15 +95,16 @@ export var CommandPaletteTabs = React.forwardRef(function (props, ref) {
|
|
|
93
95
|
}
|
|
94
96
|
}, []);
|
|
95
97
|
var mergedRef = useForkRef(tabsRef, ref);
|
|
96
|
-
return (React.createElement(Root, __assign({ ref: mergedRef, role: "tablist", className: clsx(
|
|
98
|
+
return (React.createElement(Root, __assign({ ref: mergedRef, role: "tablist", sx: sx, className: clsx(classes.tabs, className), onKeyDown: handleKeyDown }, (analyticsId && { 'data-analytics-id': analyticsId }), tabsProps), children));
|
|
97
99
|
});
|
|
98
100
|
CommandPaletteTabs.displayName = 'CommandPaletteTabs';
|
|
99
101
|
export var CommandPaletteTab = React.forwardRef(function (props, ref) {
|
|
100
|
-
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"]);
|
|
102
|
+
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"]);
|
|
103
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
101
104
|
var handleClick = React.useCallback(function (e) {
|
|
102
105
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
103
106
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
104
107
|
}, [onSelect, onClick]);
|
|
105
|
-
return (React.createElement(TabButton, __assign({ ref: ref, role: "tab", type: "button", "aria-selected": active, tabIndex: active ? 0 : -1, ownerState: { active: active }, className: clsx(
|
|
108
|
+
return (React.createElement(TabButton, __assign({ ref: ref, role: "tab", type: "button", "aria-selected": active, tabIndex: active ? 0 : -1, sx: sx, ownerState: { active: active }, className: clsx(classes.tab, active && classes.tabSelected, className), onClick: handleClick }, (analyticsId && { 'data-analytics-id': analyticsId }), tabProps), children));
|
|
106
109
|
});
|
|
107
110
|
CommandPaletteTab.displayName = 'CommandPaletteTab';
|
|
@@ -180,7 +180,7 @@ function useScheduleLayoutEffect() {
|
|
|
180
180
|
}
|
|
181
181
|
export var CommandPalette = React.forwardRef(function (props, ref) {
|
|
182
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"]);
|
|
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, 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"]);
|
|
184
184
|
var generatedId = useId();
|
|
185
185
|
var id = (_a = rootProps.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
186
186
|
var listId = id ? "".concat(id, "-list") : undefined;
|
|
@@ -429,10 +429,10 @@ export var CommandPalette = React.forwardRef(function (props, ref) {
|
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
}, [loop, store, propsRef]);
|
|
432
|
-
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass,
|
|
432
|
+
var classes = useMergedClasses(commandPaletteClasses, getCommandPaletteUtilityClass, propClasses);
|
|
433
433
|
return (React.createElement(CommandPaletteStoreContext.Provider, { value: store.current },
|
|
434
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))));
|
|
435
|
+
React.createElement(Root, __assign({ ref: ref, sx: sx, className: clsx(classes.root, className), tabIndex: -1, onKeyDown: handleKeyDown, "aria-label": label }, (analyticsId && { 'data-analytics-id': analyticsId }), rootProps), children))));
|
|
436
436
|
});
|
|
437
437
|
CommandPalette.displayName = 'CommandPalette';
|
|
438
438
|
export { VALUE_ATTR };
|