@splunk/react-ui 5.5.0 → 5.6.0
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/AnchorMenu.d.ts +2 -0
- package/AnchorMenu.js +286 -0
- package/Badge.d.ts +2 -0
- package/CHANGELOG.md +15 -0
- package/Multiselect.js +84 -78
- package/SelectBase.js +932 -899
- package/Slider.js +234 -181
- package/TransitionOpen.js +46 -47
- package/cypress/support/commands.ts +40 -0
- package/cypress/support/component.ts +1 -1
- package/cypress/support/index.d.ts +22 -0
- package/package.json +3 -3
- package/types/src/AnchorMenu/AnchorMenu.d.ts +36 -0
- package/types/src/AnchorMenu/AnchorMenuContext.d.ts +6 -0
- package/types/src/AnchorMenu/Item.d.ts +35 -0
- package/types/src/AnchorMenu/docs/examples/Basic.d.ts +6 -0
- package/types/src/AnchorMenu/index.d.ts +3 -0
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Multiselect/Compact.d.ts +7 -0
- package/types/src/Multiselect/Multiselect.d.ts +7 -0
- package/types/src/SelectBase/SelectBase.d.ts +8 -1
- package/types/src/Slider/Slider.d.ts +7 -1
- package/types/src/Switch/Switch.d.ts +1 -1
package/TransitionOpen.js
CHANGED
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
// CONCATENATED MODULE: external "@splunk/react-ui/Animation"
|
|
73
73
|
const a = require("@splunk/react-ui/Animation");
|
|
74
74
|
// CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
|
|
75
|
-
const
|
|
76
|
-
var
|
|
75
|
+
const u = require("@splunk/react-ui/usePrevious");
|
|
76
|
+
var l = e.n(u);
|
|
77
77
|
// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
|
|
78
78
|
const s = require("@splunk/ui-utils/focus");
|
|
79
79
|
// CONCATENATED MODULE: external "@splunk/ui-utils/style"
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
}, g.apply(null, arguments);
|
|
138
138
|
}
|
|
139
139
|
function O(e, t) {
|
|
140
|
-
return
|
|
140
|
+
return k(e) || P(e, t) || j(e, t) || S();
|
|
141
141
|
}
|
|
142
142
|
function S() {
|
|
143
143
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
@@ -156,32 +156,32 @@
|
|
|
156
156
|
}
|
|
157
157
|
return n;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function P(e, t) {
|
|
160
160
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
161
161
|
if (null != r) {
|
|
162
|
-
var n, o, i, a,
|
|
162
|
+
var n, o, i, a, u = [], l = !0, s = !1;
|
|
163
163
|
try {
|
|
164
164
|
if (i = (r = r.call(e)).next, 0 === t) {
|
|
165
165
|
if (Object(r) !== r) return;
|
|
166
|
-
|
|
167
|
-
} else for (;!(
|
|
166
|
+
l = !1;
|
|
167
|
+
} else for (;!(l = (n = i.call(r)).done) && (u.push(n.value), u.length !== t); l = !0) {
|
|
168
168
|
}
|
|
169
169
|
} catch (e) {
|
|
170
170
|
s = !0, o = e;
|
|
171
171
|
} finally {
|
|
172
172
|
try {
|
|
173
|
-
if (!
|
|
173
|
+
if (!l && null != r["return"] && (a = r["return"](), Object(a) !== a)) return;
|
|
174
174
|
} finally {
|
|
175
175
|
if (s) throw o;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
return
|
|
178
|
+
return u;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function k(e) {
|
|
182
182
|
if (Array.isArray(e)) return e;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function F(e, t) {
|
|
185
185
|
if (null == e) return {};
|
|
186
186
|
var r, n, o = x(e, t);
|
|
187
187
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
var a = {
|
|
295
295
|
value: n ? 0 : o
|
|
296
296
|
};
|
|
297
|
-
var
|
|
297
|
+
var u = {
|
|
298
298
|
precision: 1
|
|
299
299
|
};
|
|
300
300
|
// Only use precision when not using transform, otherwise transform animation will break
|
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
if (r === "expandWidth" || r === "expandHeight" || r === "none") {
|
|
303
303
|
return {
|
|
304
304
|
to: i,
|
|
305
|
-
config:
|
|
305
|
+
config: u
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
308
|
// Slide transitions require a valid value, render without transition first.
|
|
@@ -314,14 +314,14 @@
|
|
|
314
314
|
return {
|
|
315
315
|
to: i,
|
|
316
316
|
from: a,
|
|
317
|
-
config:
|
|
317
|
+
config: u
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
// The top and left directions require an additional transform of their inner content to match the outer dimension animation.
|
|
321
321
|
// This is needed to achieve a clipping effect from the outer div, rather than the consumer providing their own.
|
|
322
|
-
var
|
|
323
|
-
var s = "translate".concat(
|
|
324
|
-
var c = "translate".concat(
|
|
322
|
+
var l = r === "slideFromTop" ? "Y" : "X";
|
|
323
|
+
var s = "translate".concat(l, "(").concat(n ? 0 : -o, "px)");
|
|
324
|
+
var c = "translate".concat(l, "(").concat(n ? -o : 0, "px)");
|
|
325
325
|
return {
|
|
326
326
|
to: N({
|
|
327
327
|
transform: s
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
}, a)
|
|
332
332
|
};
|
|
333
333
|
};
|
|
334
|
-
var
|
|
334
|
+
var W = function e(t) {
|
|
335
335
|
var r = t.animation, n = t.el, o = t.takeFocusProp;
|
|
336
336
|
var i = 0;
|
|
337
337
|
if (n) {
|
|
@@ -355,33 +355,33 @@
|
|
|
355
355
|
return i;
|
|
356
356
|
};
|
|
357
357
|
var _ = {};
|
|
358
|
-
var
|
|
358
|
+
var R = {};
|
|
359
359
|
function D(e) {
|
|
360
|
-
var t = e.animation, o = t === void 0 ? "expandHeight" : t, i = e.animateOnMount,
|
|
360
|
+
var t = e.animation, o = t === void 0 ? "expandHeight" : t, i = e.animateOnMount, u = e.children, f = e.className, d = e.elementRef, m = e.id, p = e.innerClassName, h = e.innerStyle, S = h === void 0 ? _ : h, j = e.onAnimationEnd, w = e.onAnimationStart, P = e.open, k = e.outerClassName, x = e.outerId, C = e.outerStyle, T = C === void 0 ? R : C, E = e.renderChildrenWhenCollapsed, I = e.retainFocus, D = e.takeFocus, H = F(e, [ "animation", "animateOnMount", "children", "className", "elementRef", "id", "innerClassName", "innerStyle", "onAnimationEnd", "onAnimationStart", "open", "outerClassName", "outerId", "outerStyle", "renderChildrenWhenCollapsed", "retainFocus", "takeFocus" ]);
|
|
361
361
|
// @docs-props-type TransitionOpenPropsBase
|
|
362
|
-
var L =
|
|
363
|
-
var
|
|
364
|
-
var
|
|
362
|
+
var L = l()(P);
|
|
363
|
+
var $ = (0, r.useRef)(true);
|
|
364
|
+
var B = (0, r.useState)(i ? P : false), K = O(B, 2), U = K[0], X = K[1];
|
|
365
365
|
var Y = (0, r.useState)(null), z = O(Y, 2), G = z[0], J = z[1];
|
|
366
366
|
var Q = (0, r.useState)(0), V = O(Q, 2), Z = V[0], ee = V[1];
|
|
367
367
|
(0, r.useEffect)((function() {
|
|
368
368
|
// prevOpen starts undefined, and we don't want to make the comparison in that situation
|
|
369
|
-
if (L !== undefined &&
|
|
369
|
+
if (L !== undefined && P !== L) {
|
|
370
370
|
X(true);
|
|
371
371
|
}
|
|
372
|
-
}), [
|
|
372
|
+
}), [ P, L ]);
|
|
373
373
|
// equivalent to componentDidMount and componentWillUnmount
|
|
374
374
|
(0, r.useEffect)((function() {
|
|
375
375
|
// we need to set this to true on every mount because React.StrictMode will call the effect twice
|
|
376
376
|
// and we need to ensure that allowAnimationUpdates is true while the component is mounted
|
|
377
|
-
|
|
377
|
+
$.current = true;
|
|
378
378
|
return function() {
|
|
379
|
-
|
|
379
|
+
$.current = false;
|
|
380
380
|
};
|
|
381
381
|
}), []);
|
|
382
382
|
var te = (0, r.useCallback)((function(e) {
|
|
383
383
|
J(e);
|
|
384
|
-
ee(
|
|
384
|
+
ee(W({
|
|
385
385
|
animation: o,
|
|
386
386
|
el: e,
|
|
387
387
|
takeFocusProp: D
|
|
@@ -392,7 +392,7 @@
|
|
|
392
392
|
w === null || w === void 0 ? void 0 : w();
|
|
393
393
|
}), [ w ]);
|
|
394
394
|
var ne = (0, r.useCallback)((function() {
|
|
395
|
-
if (
|
|
395
|
+
if ($.current) {
|
|
396
396
|
X(false);
|
|
397
397
|
}
|
|
398
398
|
j === null || j === void 0 ? void 0 : j();
|
|
@@ -404,38 +404,37 @@
|
|
|
404
404
|
}), [ G ]);
|
|
405
405
|
var ie = (0, a.useAnimation)(N(N({}, M({
|
|
406
406
|
animation: o,
|
|
407
|
-
open:
|
|
407
|
+
open: P,
|
|
408
408
|
value: Z
|
|
409
409
|
})), {}, {
|
|
410
410
|
immediate: o === "none",
|
|
411
411
|
onRest: ne,
|
|
412
412
|
onStart: re
|
|
413
|
-
})), ae = ie.value,
|
|
414
|
-
var
|
|
415
|
-
var se = [ "slideFromTop", "slideFromRight", "slideFromBottom", "slideFromLeft" ].includes(o);
|
|
413
|
+
})), ae = ie.value, ue = ie.transform;
|
|
414
|
+
var le;
|
|
416
415
|
/* to avoid setting and unsetting dimension which causes flickering
|
|
417
416
|
we always set the dimension if it is a slide animation
|
|
418
|
-
else only set it when animating || renderChildrenWhenCollapsed */ if (
|
|
419
|
-
|
|
417
|
+
else only set it when animating || renderChildrenWhenCollapsed */ if (o.startsWith("slideFrom") || U || E) {
|
|
418
|
+
le = q(o);
|
|
420
419
|
}
|
|
421
420
|
// if renderChildrenWhenCollapsed is true, we hide the content by setting the height of the wrapper to 0
|
|
422
|
-
var
|
|
421
|
+
var se = E && !P && !U ? 0 : ae;
|
|
422
|
+
var ce = (0, r.useMemo)((function() {
|
|
423
|
+
return N(N({}, T), le && A({}, le, se));
|
|
424
|
+
}), [ le, se, T ]);
|
|
423
425
|
var fe = (0, r.useMemo)((function() {
|
|
424
|
-
return N(N({}, T), ue && A({}, ue, ce));
|
|
425
|
-
}), [ ue, ce, T ]);
|
|
426
|
-
var de = (0, r.useMemo)((function() {
|
|
427
426
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
428
427
|
return N(N({}, S), {}, {
|
|
429
|
-
transform:
|
|
428
|
+
transform: ue
|
|
430
429
|
});
|
|
431
|
-
}), [ S,
|
|
430
|
+
}), [ S, ue ]);
|
|
432
431
|
|
|
433
432
|
return n().createElement(v, {
|
|
434
|
-
$hideOverflow: !
|
|
435
|
-
className: (0, c.toClassName)(f,
|
|
436
|
-
style:
|
|
433
|
+
$hideOverflow: !P || U || false,
|
|
434
|
+
className: (0, c.toClassName)(f, k),
|
|
435
|
+
style: ce,
|
|
437
436
|
id: x
|
|
438
|
-
}, (
|
|
437
|
+
}, (P || U || E) && n().createElement(y, g({
|
|
439
438
|
"data-test": "transition-open"
|
|
440
439
|
}, H, {
|
|
441
440
|
ref: te,
|
|
@@ -443,8 +442,8 @@
|
|
|
443
442
|
className: p,
|
|
444
443
|
id: m,
|
|
445
444
|
onKeyDown: I ? oe : undefined,
|
|
446
|
-
style:
|
|
447
|
-
}),
|
|
445
|
+
style: fe
|
|
446
|
+
}), u));
|
|
448
447
|
}
|
|
449
448
|
D.propTypes = I;
|
|
450
449
|
/* harmony default export */ const H = D;
|
|
@@ -19,3 +19,43 @@ Cypress.Commands.add('hover', (selector: string) => {
|
|
|
19
19
|
return cy.wrap($el).trigger('mouseover', { force: true });
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
+
|
|
23
|
+
const calcDiffPct = (target: number, actual: number) => {
|
|
24
|
+
try {
|
|
25
|
+
const diff = (200 * Math.abs(target - actual)) / (target + actual);
|
|
26
|
+
const side = actual > target ? 'ABOVE' : 'BELOW';
|
|
27
|
+
|
|
28
|
+
return { diff: Math.round(diff * 100) / 100, side };
|
|
29
|
+
} catch {
|
|
30
|
+
return { diff: 0, side: '' };
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
Cypress.Commands.add(
|
|
35
|
+
'verifyPerformance',
|
|
36
|
+
({ testName, execute, threshold = 0.5, expectedRenderDurationInMs = 100 }) => {
|
|
37
|
+
let startTime = 0;
|
|
38
|
+
|
|
39
|
+
const allowableDurationInMs = expectedRenderDurationInMs * (1 + threshold);
|
|
40
|
+
cy.wrap(null)
|
|
41
|
+
.then(() => {
|
|
42
|
+
startTime = performance.now();
|
|
43
|
+
cy.log(`[${Math.round(startTime)}ms] Starting validation`);
|
|
44
|
+
})
|
|
45
|
+
.then(() => execute())
|
|
46
|
+
.then(() => {
|
|
47
|
+
const endTime = performance.now();
|
|
48
|
+
const durationInMs = Math.round(endTime - startTime);
|
|
49
|
+
|
|
50
|
+
const { diff, side } = calcDiffPct(expectedRenderDurationInMs, durationInMs);
|
|
51
|
+
const logMsg = `Test "${testName}" took ${durationInMs}ms to render (${diff}% ${side} ${expectedRenderDurationInMs}ms expectation)`;
|
|
52
|
+
|
|
53
|
+
cy.log(`[${Math.round(endTime)}ms] ${logMsg}`);
|
|
54
|
+
|
|
55
|
+
assert(
|
|
56
|
+
allowableDurationInMs >= durationInMs,
|
|
57
|
+
`${logMsg}, but should take less than ${allowableDurationInMs}ms`
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { mount } from 'cypress/react';
|
|
2
1
|
import { setProjectAnnotations } from '@storybook/react';
|
|
3
2
|
import { configure } from '@testing-library/cypress';
|
|
3
|
+
import { mount } from 'cypress/react';
|
|
4
4
|
|
|
5
5
|
import * as sbPreview from '../../.storybook/preview';
|
|
6
6
|
import './commands';
|
|
@@ -2,5 +2,27 @@
|
|
|
2
2
|
declare namespace Cypress {
|
|
3
3
|
interface Chainable {
|
|
4
4
|
hover(selector: string): Chainable; // to support hover custom command
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Runs the custom 'profile' task and verifies the returned value is within the allowable threshold.
|
|
8
|
+
* Threshold of .5 and expectedRenderDurationInMs === 100 would allow the render to take up to 50% more, i.e 150ms
|
|
9
|
+
* @param args - The arguments for the performance verification.
|
|
10
|
+
* @param args.testName - The name of the test to be used in the profiling
|
|
11
|
+
* @param args.threshold - The threshold percentage for the performance test (default is 0.5, meaning 50% more than expected)
|
|
12
|
+
* @param args.expectedRenderDurationInMs - The expected render duration in milliseconds (default is 100ms)
|
|
13
|
+
* @example
|
|
14
|
+
* // Verify that the render duration for 'my-test' is within the threshold
|
|
15
|
+
* cy.verifyPerformance({
|
|
16
|
+
* testName: 'my-test',
|
|
17
|
+
* threshold: 0.5,
|
|
18
|
+
* expectedRenderDurationInMs: 100
|
|
19
|
+
* });
|
|
20
|
+
*/
|
|
21
|
+
verifyPerformance(args: {
|
|
22
|
+
testName: string;
|
|
23
|
+
execute: () => Chainable | void;
|
|
24
|
+
threshold?: number;
|
|
25
|
+
expectedRenderDurationInMs?: number;
|
|
26
|
+
}): void;
|
|
5
27
|
}
|
|
6
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/react-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Library of React components that implement the Splunk design language",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Splunk Inc.",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@dnd-kit/sortable": "^8.0.0",
|
|
46
46
|
"@dnd-kit/utilities": "^3.2.2",
|
|
47
47
|
"@react-spring/web": "^9.7.5",
|
|
48
|
-
"@splunk/react-icons": "^5.
|
|
49
|
-
"@splunk/themes": "^1.4.
|
|
48
|
+
"@splunk/react-icons": "^5.6.0",
|
|
49
|
+
"@splunk/themes": "^1.4.1",
|
|
50
50
|
"@splunk/ui-utils": "^1.12.0",
|
|
51
51
|
"decimal.js-light": "^2.5.1",
|
|
52
52
|
"intl-tel-input": "^25.3.2",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
interface AnchorMenuPropsBase {
|
|
5
|
+
/**
|
|
6
|
+
* The `itemId` prop of the currently active item.
|
|
7
|
+
*/
|
|
8
|
+
activeItemId?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
12
|
+
*/
|
|
13
|
+
elementRef?: React.Ref<HTMLElement>;
|
|
14
|
+
/**
|
|
15
|
+
* Hides the side border spine. Useful when the AnchorMenu is placed inside a container with its own border.
|
|
16
|
+
*/
|
|
17
|
+
hideSpine?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Label text to display above the menu items. Set to `null` to disable the label.
|
|
20
|
+
*/
|
|
21
|
+
label?: string | null;
|
|
22
|
+
}
|
|
23
|
+
type AnchorMenuProps = ComponentProps<AnchorMenuPropsBase, 'nav'>;
|
|
24
|
+
declare function AnchorMenu({ activeItemId, children, elementRef, hideSpine, label, ...otherProps }: AnchorMenuProps): React.JSX.Element;
|
|
25
|
+
declare namespace AnchorMenu {
|
|
26
|
+
var propTypes: {
|
|
27
|
+
activeItemId: PropTypes.Requireable<string>;
|
|
28
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
29
|
+
elementRef: PropTypes.Requireable<object>;
|
|
30
|
+
hideSpine: PropTypes.Requireable<boolean>;
|
|
31
|
+
label: PropTypes.Requireable<string>;
|
|
32
|
+
};
|
|
33
|
+
var Item: typeof import("./Item").default;
|
|
34
|
+
}
|
|
35
|
+
export type { AnchorMenuProps, AnchorMenuPropsBase };
|
|
36
|
+
export default AnchorMenu;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
interface AnchorMenuItemPropsBase {
|
|
5
|
+
/**
|
|
6
|
+
* Content to render inside the anchor link menu item.
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
11
|
+
*/
|
|
12
|
+
elementRef?: React.Ref<HTMLLIElement>;
|
|
13
|
+
/**
|
|
14
|
+
* A unique id for the item, used with the `AnchorMenu's` activeItemId prop.
|
|
15
|
+
* If not set, defaults to the `to` prop if present.
|
|
16
|
+
*/
|
|
17
|
+
itemId?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
20
|
+
to?: string;
|
|
21
|
+
}
|
|
22
|
+
type AnchorMenuItemProps = ComponentProps<AnchorMenuItemPropsBase, 'li'>;
|
|
23
|
+
declare function Item({ children, elementRef, itemId: itemIdProp, label, onClick, to, ...otherProps }: AnchorMenuItemProps): React.JSX.Element;
|
|
24
|
+
declare namespace Item {
|
|
25
|
+
var propTypes: {
|
|
26
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
27
|
+
elementRef: PropTypes.Requireable<object>;
|
|
28
|
+
itemId: PropTypes.Requireable<string>;
|
|
29
|
+
label: PropTypes.Requireable<string>;
|
|
30
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
|
+
to: PropTypes.Requireable<string>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export type { AnchorMenuItemProps, AnchorMenuItemPropsBase };
|
|
35
|
+
export default Item;
|
package/types/src/Menu/Item.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ interface ItemPropsBase {
|
|
|
72
72
|
* `selectableAppearance` of 'checkbox' defaults to `menuitemcheckbox`. Otherwise, the role defaults
|
|
73
73
|
* to `menuitem`.
|
|
74
74
|
*/
|
|
75
|
-
role?: 'menuitem' | 'menuitemradio' | 'menuitemcheckbox' | 'listboxitem' | 'option';
|
|
75
|
+
role?: 'menuitem' | 'menuitemradio' | 'menuitemcheckbox' | 'listboxitem' | 'link' | 'option';
|
|
76
76
|
/**
|
|
77
77
|
* Enables selection for this item and reserves space for the control.
|
|
78
78
|
* Required when using `selected` or `selectableAppearance`.
|
|
@@ -74,6 +74,11 @@ interface CompactPropsBase {
|
|
|
74
74
|
/**
|
|
75
75
|
* The loading message to show when isLoadingOptions. */
|
|
76
76
|
loadingMessage?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* @private
|
|
79
|
+
* Escape hatch override of the maximum number of values before the toggle label will truncate to `X items selected`
|
|
80
|
+
*/
|
|
81
|
+
maxLabelItems?: number;
|
|
77
82
|
/**
|
|
78
83
|
* Style properties to apply to the Menu. */
|
|
79
84
|
menuStyle?: React.CSSProperties;
|
|
@@ -177,6 +182,8 @@ declare namespace Compact {
|
|
|
177
182
|
isLoadingOptions: PropTypes.Requireable<boolean>;
|
|
178
183
|
labelledBy: PropTypes.Requireable<string>;
|
|
179
184
|
loadingMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
185
|
+
/** @private. */
|
|
186
|
+
maxLabelItems: PropTypes.Requireable<number>;
|
|
180
187
|
menuStyle: PropTypes.Requireable<object>;
|
|
181
188
|
name: PropTypes.Requireable<string>;
|
|
182
189
|
noOptionsMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -95,6 +95,11 @@ interface MultiselectPropsBase {
|
|
|
95
95
|
/**
|
|
96
96
|
* The loading message to show when isLoadingOptions. */
|
|
97
97
|
loadingMessage?: React.ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* @private
|
|
100
|
+
* Escape hatch override of the maximum number of values before the toggle label will truncate to `X items selected`
|
|
101
|
+
*/
|
|
102
|
+
maxLabelItems?: number;
|
|
98
103
|
/**
|
|
99
104
|
* Style properties to apply to the Menu. This is primarily used to override the width of
|
|
100
105
|
* the menu should it need to be wider than the toggle Button. */
|
|
@@ -229,6 +234,8 @@ declare namespace Multiselect {
|
|
|
229
234
|
isLoadingOptions: PropTypes.Requireable<boolean>;
|
|
230
235
|
labelledBy: PropTypes.Requireable<string>;
|
|
231
236
|
loadingMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
237
|
+
/** @private. */
|
|
238
|
+
maxLabelItems: PropTypes.Requireable<number>;
|
|
232
239
|
menuStyle: PropTypes.Requireable<object>;
|
|
233
240
|
name: PropTypes.Requireable<string>;
|
|
234
241
|
noOptionsMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -98,6 +98,11 @@ interface SelectBasePropsBase {
|
|
|
98
98
|
/**
|
|
99
99
|
* The loading message to show when isLoadingOptions. */
|
|
100
100
|
loadingMessage?: React.ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* @private
|
|
103
|
+
* Escape hatch override of the maximum number of values before the toggle label will truncate to `X items selected`
|
|
104
|
+
*/
|
|
105
|
+
maxLabelItems?: number;
|
|
101
106
|
/**
|
|
102
107
|
* Style properties to apply to the Menu. */
|
|
103
108
|
menuStyle?: React.CSSProperties;
|
|
@@ -231,7 +236,7 @@ interface ControlsProps extends Pick<SelectBaseProps, 'inputId' | 'inputRef' | '
|
|
|
231
236
|
textHasFocus: boolean;
|
|
232
237
|
}
|
|
233
238
|
declare const Controls: ({ activeItemId, filterA11yId, filterKeyword, hasChildren, inputId, inputRef, menuListboxId, multiple, onClearAll, onSelectAll, onTextBlur, onTextChange, onTextFocus, onTextKeyDown, optionSelection, placement, selectAllAppearance, textHasFocus, }: ControlsProps) => React.JSX.Element;
|
|
234
|
-
declare function SelectBase({ allowKeyMatching, animateLoading, appearance, append, allowNewValues, children, defaultPlacement, defaultValues, describedBy, disabled, elementRef, error, filter, footerMessage, inline, inputId, inputRef, isLoadingOptions, labelledBy, labelText, loadingMessage, menuStyle, multiple, name, noOptionsMessage, onChange, onScroll, onScrollBottom, onFilterChange, onClick, onClose, onOpen, required, placeholder, prefixLabel, prepend, repositionMode, selectAllAppearance, showSelectedValuesFirst, suffixLabel, tabConfirmsNewValue, values, virtualization, toggle, toggleContent, ...otherProps }: SelectBaseProps): React.JSX.Element;
|
|
239
|
+
declare function SelectBase({ allowKeyMatching, animateLoading, appearance, append, allowNewValues, children, defaultPlacement, defaultValues, describedBy, disabled, elementRef, error, filter, footerMessage, inline, inputId, inputRef, isLoadingOptions, labelledBy, labelText, loadingMessage, menuStyle, multiple, name, noOptionsMessage, onChange, onScroll, onScrollBottom, onFilterChange, onClick, onClose, onOpen, required, placeholder, prefixLabel, prepend, repositionMode, selectAllAppearance, showSelectedValuesFirst, suffixLabel, tabConfirmsNewValue, values, virtualization, toggle, toggleContent, maxLabelItems, ...otherProps }: SelectBaseProps): React.JSX.Element;
|
|
235
240
|
declare namespace SelectBase {
|
|
236
241
|
var propTypes: {
|
|
237
242
|
allowKeyMatching: PropTypes.Requireable<boolean>;
|
|
@@ -255,6 +260,8 @@ declare namespace SelectBase {
|
|
|
255
260
|
labelledBy: PropTypes.Requireable<string>;
|
|
256
261
|
labelText: PropTypes.Requireable<string>;
|
|
257
262
|
loadingMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
263
|
+
/** @private. */
|
|
264
|
+
maxLabelItems: PropTypes.Requireable<number>;
|
|
258
265
|
menuStyle: PropTypes.Requireable<object>;
|
|
259
266
|
multiple: PropTypes.Requireable<boolean>;
|
|
260
267
|
name: PropTypes.Requireable<string>;
|
|
@@ -28,6 +28,11 @@ interface SliderPropsBase {
|
|
|
28
28
|
error?: boolean;
|
|
29
29
|
/** When false, display as inline-block with the default width. */
|
|
30
30
|
inline?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* An id for the input, which may be necessary for accessibility, such as for aria
|
|
33
|
+
* attributes.
|
|
34
|
+
*/
|
|
35
|
+
inputId?: string;
|
|
31
36
|
/**
|
|
32
37
|
* The id of the label. When placed in a ControlGroup, this is automatically set to the
|
|
33
38
|
* ControlGroup's label.
|
|
@@ -80,7 +85,7 @@ interface SliderPropsBaseUncontrolled extends SliderPropsBase {
|
|
|
80
85
|
value?: never;
|
|
81
86
|
}
|
|
82
87
|
type SliderProps = ComponentProps<SliderPropsBaseControlled | SliderPropsBaseUncontrolled, 'div'>;
|
|
83
|
-
declare function Slider({ defaultValue, describedBy, disabled, displayValue, elementRef, error, inline, labelledBy, max, maxLabel, min, minLabel, name, onChange, required, step, stepMarks, thumbRef, value, ...otherProps }: SliderProps): React.JSX.Element;
|
|
88
|
+
declare function Slider({ defaultValue, describedBy, disabled, displayValue, elementRef, error, inline, inputId, labelledBy, max, maxLabel, min, minLabel, name, onChange, required, step, stepMarks, thumbRef, value, ...otherProps }: SliderProps): React.JSX.Element;
|
|
84
89
|
declare namespace Slider {
|
|
85
90
|
var propTypes: {
|
|
86
91
|
defaultValue: PropTypes.Requireable<number>;
|
|
@@ -90,6 +95,7 @@ declare namespace Slider {
|
|
|
90
95
|
elementRef: PropTypes.Requireable<object>;
|
|
91
96
|
error: PropTypes.Requireable<boolean>;
|
|
92
97
|
inline: PropTypes.Requireable<boolean>;
|
|
98
|
+
inputId: PropTypes.Requireable<string>;
|
|
93
99
|
labelledBy: PropTypes.Requireable<string>;
|
|
94
100
|
max: PropTypes.Requireable<number>;
|
|
95
101
|
maxLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -15,7 +15,7 @@ interface SwitchPropsBase {
|
|
|
15
15
|
/**
|
|
16
16
|
* Determines if the component renders as a checkbox or toggle.
|
|
17
17
|
*
|
|
18
|
-
* @deprecatedValue 'checkbox'
|
|
18
|
+
* @deprecatedValue 'checkbox'. Consider using the `Checkbox` component instead.
|
|
19
19
|
* The 'checkbox' value is deprecated and will be removed in a future major version.
|
|
20
20
|
*/
|
|
21
21
|
appearance?: 'checkbox' | 'toggle';
|