@auth0/quantum-product 2.10.3 → 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.
- package/command-palette/command-palette-context.js +33 -1
- package/command-palette/command-palette-group.js +2 -1
- package/command-palette/command-palette-item.js +10 -2
- package/command-palette/command-palette.js +10 -7
- package/esm/command-palette/command-palette-context.js +33 -1
- package/esm/command-palette/command-palette-group.js +2 -1
- package/esm/command-palette/command-palette-item.js +10 -2
- package/esm/command-palette/command-palette.js +10 -7
- package/package.json +1 -1
|
@@ -32,6 +32,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
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
|
+
};
|
|
35
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
52
|
exports.CommandPaletteGroupContext = exports.CommandPaletteStoreContext = exports.CommandPaletteContext = void 0;
|
|
37
53
|
exports.useCommandPaletteContext = useCommandPaletteContext;
|
|
@@ -57,5 +73,21 @@ function useCommandPaletteStore() {
|
|
|
57
73
|
}
|
|
58
74
|
function useCommandPaletteState(selector) {
|
|
59
75
|
var store = useCommandPaletteStore();
|
|
60
|
-
|
|
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;
|
|
61
93
|
}
|
|
@@ -62,6 +62,7 @@ exports.CommandPaletteGroup = void 0;
|
|
|
62
62
|
var React = __importStar(require("react"));
|
|
63
63
|
var styled_1 = require("../styled");
|
|
64
64
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
65
|
+
var use_id_1 = require("../utils/use-id");
|
|
65
66
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
66
67
|
var command_palette_context_1 = require("./command-palette-context");
|
|
67
68
|
var Root = (0, styled_1.styled)('div', {
|
|
@@ -97,7 +98,7 @@ var Items = (0, styled_1.styled)('div', {
|
|
|
97
98
|
}); });
|
|
98
99
|
exports.CommandPaletteGroup = React.forwardRef(function (props, ref) {
|
|
99
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"]);
|
|
100
|
-
var id =
|
|
101
|
+
var id = (0, use_id_1.useId)() || '';
|
|
101
102
|
var headingId = "".concat(id, "-heading");
|
|
102
103
|
var context = (0, command_palette_context_1.useCommandPaletteContext)();
|
|
103
104
|
React.useLayoutEffect(function () {
|
|
@@ -88,6 +88,7 @@ var React = __importStar(require("react"));
|
|
|
88
88
|
var useForkRef_1 = __importDefault(require("@mui/utils/useForkRef"));
|
|
89
89
|
var styled_1 = require("../styled");
|
|
90
90
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
91
|
+
var use_id_1 = require("../utils/use-id");
|
|
91
92
|
var command_palette_1 = require("./command-palette");
|
|
92
93
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
93
94
|
var command_palette_context_1 = require("./command-palette-context");
|
|
@@ -197,8 +198,15 @@ function useValue(id, ref, deps) {
|
|
|
197
198
|
}
|
|
198
199
|
exports.CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
199
200
|
var _a;
|
|
200
|
-
var
|
|
201
|
-
var
|
|
201
|
+
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 generatedId = (0, use_id_1.useId)();
|
|
204
|
+
var idRef = React.useRef();
|
|
205
|
+
if (!idRef.current) {
|
|
206
|
+
idRef.current =
|
|
207
|
+
(_c = (_b = itemProps.id) !== null && _b !== void 0 ? _b : generatedId) !== null && _c !== void 0 ? _c : "command-palette-item-".concat(Math.random().toString(36).slice(2));
|
|
208
|
+
}
|
|
209
|
+
var id = idRef.current;
|
|
202
210
|
var itemRef = React.useRef(null);
|
|
203
211
|
var context = (0, command_palette_context_1.useCommandPaletteContext)();
|
|
204
212
|
var store = (0, command_palette_context_1.useCommandPaletteStore)();
|
|
@@ -79,6 +79,7 @@ var React = __importStar(require("react"));
|
|
|
79
79
|
var styled_1 = require("../styled");
|
|
80
80
|
var classes_1 = require("../styles/classes");
|
|
81
81
|
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
82
|
+
var use_id_1 = require("../utils/use-id");
|
|
82
83
|
var command_palette_classes_1 = require("./command-palette-classes");
|
|
83
84
|
var command_palette_context_1 = require("./command-palette-context");
|
|
84
85
|
var command_palette_score_1 = require("./command-palette-score");
|
|
@@ -218,10 +219,12 @@ function useScheduleLayoutEffect() {
|
|
|
218
219
|
}, []);
|
|
219
220
|
}
|
|
220
221
|
exports.CommandPalette = React.forwardRef(function (props, ref) {
|
|
221
|
-
var _a
|
|
222
|
-
var
|
|
223
|
-
var
|
|
224
|
-
var
|
|
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"]);
|
|
224
|
+
var generatedId = (0, use_id_1.useId)();
|
|
225
|
+
var id = (_a = rootProps.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
226
|
+
var listId = id ? "".concat(id, "-list") : undefined;
|
|
227
|
+
var inputId = id ? "".concat(id, "-input") : undefined;
|
|
225
228
|
var listInnerRef = React.useRef(null);
|
|
226
229
|
var allItems = React.useRef(new Map());
|
|
227
230
|
var allGroups = React.useRef(new Map());
|
|
@@ -367,9 +370,9 @@ exports.CommandPalette = React.forwardRef(function (props, ref) {
|
|
|
367
370
|
};
|
|
368
371
|
},
|
|
369
372
|
filter: filter,
|
|
370
|
-
label: label,
|
|
371
|
-
listId: listId,
|
|
372
|
-
inputId: inputId,
|
|
373
|
+
label: label !== null && label !== void 0 ? label : '',
|
|
374
|
+
listId: listId !== null && listId !== void 0 ? listId : '',
|
|
375
|
+
inputId: inputId !== null && inputId !== void 0 ? inputId : '',
|
|
373
376
|
listInnerRef: listInnerRef,
|
|
374
377
|
}); },
|
|
375
378
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
1
17
|
import * as React from 'react';
|
|
2
18
|
export var CommandPaletteContext = React.createContext(undefined);
|
|
3
19
|
export var CommandPaletteStoreContext = React.createContext(undefined);
|
|
@@ -18,5 +34,21 @@ export function useCommandPaletteStore() {
|
|
|
18
34
|
}
|
|
19
35
|
export function useCommandPaletteState(selector) {
|
|
20
36
|
var store = useCommandPaletteStore();
|
|
21
|
-
|
|
37
|
+
var selectorRef = React.useRef(selector);
|
|
38
|
+
var _a = __read(React.useState(function () { return selector(store.snapshot()); }), 2), state = _a[0], setState = _a[1];
|
|
39
|
+
React.useEffect(function () {
|
|
40
|
+
selectorRef.current = selector;
|
|
41
|
+
setState(selector(store.snapshot()));
|
|
42
|
+
}, [selector, store]);
|
|
43
|
+
React.useLayoutEffect(function () {
|
|
44
|
+
var unsubscribe = store.subscribe(function () {
|
|
45
|
+
setState(function (prevSelected) {
|
|
46
|
+
var nextSelected = selectorRef.current(store.snapshot());
|
|
47
|
+
return Object.is(prevSelected, nextSelected) ? prevSelected : nextSelected;
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
return unsubscribe;
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, [store]);
|
|
53
|
+
return state;
|
|
22
54
|
}
|
|
@@ -23,6 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { styled } from '../styled';
|
|
25
25
|
import clsx from '../utils/clsx';
|
|
26
|
+
import { useId } from '../utils/use-id';
|
|
26
27
|
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
27
28
|
import { CommandPaletteGroupContext, useCommandPaletteContext, useCommandPaletteState, } from './command-palette-context';
|
|
28
29
|
var Root = styled('div', {
|
|
@@ -58,7 +59,7 @@ var Items = styled('div', {
|
|
|
58
59
|
}); });
|
|
59
60
|
export var CommandPaletteGroup = React.forwardRef(function (props, ref) {
|
|
60
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"]);
|
|
61
|
-
var id =
|
|
62
|
+
var id = useId() || '';
|
|
62
63
|
var headingId = "".concat(id, "-heading");
|
|
63
64
|
var context = useCommandPaletteContext();
|
|
64
65
|
React.useLayoutEffect(function () {
|
|
@@ -49,6 +49,7 @@ import * as React from 'react';
|
|
|
49
49
|
import useForkRef from '@mui/utils/useForkRef';
|
|
50
50
|
import { styled } from '../styled';
|
|
51
51
|
import clsx from '../utils/clsx';
|
|
52
|
+
import { useId } from '../utils/use-id';
|
|
52
53
|
import { VALUE_ATTR } from './command-palette';
|
|
53
54
|
import { commandPaletteClasses, commandPaletteComponentName } from './command-palette-classes';
|
|
54
55
|
import { CommandPaletteGroupContext, useCommandPaletteContext, useCommandPaletteState, useCommandPaletteStore, } from './command-palette-context';
|
|
@@ -158,8 +159,15 @@ function useValue(id, ref, deps) {
|
|
|
158
159
|
}
|
|
159
160
|
export var CommandPaletteItem = React.forwardRef(function (props, ref) {
|
|
160
161
|
var _a;
|
|
161
|
-
var
|
|
162
|
-
var
|
|
162
|
+
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 generatedId = useId();
|
|
165
|
+
var idRef = React.useRef();
|
|
166
|
+
if (!idRef.current) {
|
|
167
|
+
idRef.current =
|
|
168
|
+
(_c = (_b = itemProps.id) !== null && _b !== void 0 ? _b : generatedId) !== null && _c !== void 0 ? _c : "command-palette-item-".concat(Math.random().toString(36).slice(2));
|
|
169
|
+
}
|
|
170
|
+
var id = idRef.current;
|
|
163
171
|
var itemRef = React.useRef(null);
|
|
164
172
|
var context = useCommandPaletteContext();
|
|
165
173
|
var store = useCommandPaletteStore();
|
|
@@ -40,6 +40,7 @@ import * as React from 'react';
|
|
|
40
40
|
import { styled } from '../styled';
|
|
41
41
|
import { useMergedClasses } from '../styles/classes';
|
|
42
42
|
import clsx from '../utils/clsx';
|
|
43
|
+
import { useId } from '../utils/use-id';
|
|
43
44
|
import { commandPaletteClasses, commandPaletteComponentName, getCommandPaletteUtilityClass, } from './command-palette-classes';
|
|
44
45
|
import { CommandPaletteContext, CommandPaletteStoreContext } from './command-palette-context';
|
|
45
46
|
import { commandScore } from './command-palette-score';
|
|
@@ -178,10 +179,12 @@ function useScheduleLayoutEffect() {
|
|
|
178
179
|
}, []);
|
|
179
180
|
}
|
|
180
181
|
export var CommandPalette = React.forwardRef(function (props, ref) {
|
|
181
|
-
var _a
|
|
182
|
-
var
|
|
183
|
-
var
|
|
184
|
-
var
|
|
182
|
+
var _a;
|
|
183
|
+
var _b = props.label, label = _b === void 0 ? 'Command palette' : _b, searchProp = props.search, _onSearchChange = props.onSearchChange, valueProp = props.value, _onValueChange = props.onValueChange, filterProp = props.filter, _c = props.shouldFilter, shouldFilter = _c === void 0 ? true : _c, _d = props.loop, loop = _d === void 0 ? false : _d, _onSelect = props.onSelect, children = props.children, className = props.className, rootProps = __rest(props, ["label", "search", "onSearchChange", "value", "onValueChange", "filter", "shouldFilter", "loop", "onSelect", "children", "className"]);
|
|
184
|
+
var generatedId = useId();
|
|
185
|
+
var id = (_a = rootProps.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
186
|
+
var listId = id ? "".concat(id, "-list") : undefined;
|
|
187
|
+
var inputId = id ? "".concat(id, "-input") : undefined;
|
|
185
188
|
var listInnerRef = React.useRef(null);
|
|
186
189
|
var allItems = React.useRef(new Map());
|
|
187
190
|
var allGroups = React.useRef(new Map());
|
|
@@ -327,9 +330,9 @@ export var CommandPalette = React.forwardRef(function (props, ref) {
|
|
|
327
330
|
};
|
|
328
331
|
},
|
|
329
332
|
filter: filter,
|
|
330
|
-
label: label,
|
|
331
|
-
listId: listId,
|
|
332
|
-
inputId: inputId,
|
|
333
|
+
label: label !== null && label !== void 0 ? label : '',
|
|
334
|
+
listId: listId !== null && listId !== void 0 ? listId : '',
|
|
335
|
+
inputId: inputId !== null && inputId !== void 0 ? inputId : '',
|
|
333
336
|
listInnerRef: listInnerRef,
|
|
334
337
|
}); },
|
|
335
338
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|