@splunk/react-ui 5.5.0 → 5.7.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 +290 -0
- package/Badge.d.ts +2 -0
- package/ButtonSimple.js +165 -101
- package/CHANGELOG.md +31 -0
- package/Card.js +147 -137
- package/Menu.js +12 -12
- package/Multiselect.js +87 -78
- package/SelectBase.js +932 -899
- package/Slider.js +235 -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/Button/Button.d.ts +4 -4
- package/types/src/ButtonSimple/ButtonSimple.d.ts +1 -3
- package/types/src/Card/Header.d.ts +6 -1
- package/types/src/Card/docs/examples/Icon.d.ts +7 -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/Multiselect/Option.d.ts +4 -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/Slider.js
CHANGED
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
const f = require("@splunk/react-ui/useControlled");
|
|
83
83
|
var v = e.n(f);
|
|
84
84
|
// CONCATENATED MODULE: external "styled-components"
|
|
85
|
-
const
|
|
86
|
-
var
|
|
85
|
+
const p = require("styled-components");
|
|
86
|
+
var m = e.n(p);
|
|
87
87
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
88
|
-
const
|
|
88
|
+
const b = require("@splunk/themes");
|
|
89
89
|
// CONCATENATED MODULE: ./src/Slider/getStepMarksBackground.ts
|
|
90
90
|
/* this file is being ignored by stylelint via .stylelintignore */
|
|
91
91
|
/* the radial-gradient returned in the map below needs `css` before backticks
|
|
@@ -96,119 +96,157 @@
|
|
|
96
96
|
var t = e.stepWidth, r = e.thumbPosition, n = r === void 0 ? 0 : r, a = e.beforeThumbStepColor, i = e.afterThumbStepColor;
|
|
97
97
|
/* need to subtract 1 to avoid extra step at the end */ var o = Math.floor(100 / t) - 1;
|
|
98
98
|
var l = new Array(o).fill(false);
|
|
99
|
-
return (0,
|
|
99
|
+
return (0, p.css)([ "background:", ";" ], l.map((function(e, r) {
|
|
100
100
|
var o = (r + 1) * t;
|
|
101
101
|
var u = o <= n ? a : i;
|
|
102
102
|
/* css doesn't allow trailing comma */ var s = r < l.length - 1 ? "," : "";
|
|
103
|
-
return (0,
|
|
103
|
+
return (0, p.css)([ "radial-gradient(circle,", " 0%,", " 3px,transparent 3px) calc(", "% - 1.5px) center no-repeat ", "" ], u, u, o, s);
|
|
104
104
|
})));
|
|
105
105
|
}
|
|
106
106
|
/* harmony default export */ const y = h;
|
|
107
107
|
// CONCATENATED MODULE: ./src/Slider/SliderStyles.ts
|
|
108
108
|
var g = 8;
|
|
109
109
|
var w = 1;
|
|
110
|
-
var
|
|
111
|
-
var
|
|
110
|
+
var C = 24;
|
|
111
|
+
var S = m().div.withConfig({
|
|
112
112
|
displayName: "SliderStyles__StyledSliderWrapper",
|
|
113
113
|
componentId: "sc-16ooit4-0"
|
|
114
|
-
})([ "", ";gap:", ";width:100%;", "" ],
|
|
114
|
+
})([ "", ";gap:", ";width:100%;", "" ], b.mixins.reset("flex"), b.variables.spacingLarge, (function(e) {
|
|
115
115
|
var t = e.$inline;
|
|
116
|
-
return t && (0,
|
|
116
|
+
return t && (0, p.css)([ "width:300px;" ]);
|
|
117
117
|
}));
|
|
118
|
-
|
|
118
|
+
// Use .attrs() to set CSS variable via style attribute to avoid styled-components class regeneration.
|
|
119
|
+
// The ::before pseudo-element reads this variable, which is the only way to style pseudo-elements dynamically
|
|
120
|
+
// without regenerating CSS classes on every position change.
|
|
121
|
+
var x = m().div.attrs((function(e) {
|
|
122
|
+
var t = e.$thumbPosition;
|
|
123
|
+
return {
|
|
124
|
+
style: t !== undefined ? {
|
|
125
|
+
"--slider-fill-width": "".concat(t, "%")
|
|
126
|
+
} : undefined
|
|
127
|
+
};
|
|
128
|
+
})).withConfig({
|
|
119
129
|
displayName: "SliderStyles__StyledSliderBar",
|
|
120
130
|
componentId: "sc-16ooit4-1"
|
|
121
131
|
})([ "position:relative;left:0;height:", "px;width:100%;border-radius:10px;background-color:", ";border:", "px solid;border-color:", ";", " ", "" ], g, (0,
|
|
122
|
-
|
|
123
|
-
default:
|
|
124
|
-
error:
|
|
125
|
-
disabled:
|
|
126
|
-
}), w, (0,
|
|
127
|
-
default:
|
|
128
|
-
error:
|
|
132
|
+
b.pickVariant)("$state", {
|
|
133
|
+
default: b.variables.neutral300,
|
|
134
|
+
error: b.variables.neutral300,
|
|
135
|
+
disabled: b.variables.neutral200
|
|
136
|
+
}), w, (0, b.pickVariant)("$state", {
|
|
137
|
+
default: b.variables.interactiveColorBorder,
|
|
138
|
+
error: b.variables.interactiveColorBorder,
|
|
129
139
|
disabled: "transparent"
|
|
130
140
|
}), (function(e) {
|
|
131
141
|
var t = e.$thumbPosition;
|
|
132
|
-
return (t || t === 0) && (0,
|
|
133
|
-
|
|
134
|
-
default:
|
|
135
|
-
error:
|
|
136
|
-
disabled:
|
|
142
|
+
return (t || t === 0) && (0, p.css)([ "&::before{position:absolute;border-radius:", ";content:'';height:calc( ", "px + ", "px );top:-", "px;left:-", "px;width:var(--slider-fill-width,0%);background-color:", ";}" ], b.variables.borderRadius, g, w * 2, w, w, (0,
|
|
143
|
+
b.pickVariant)("$state", {
|
|
144
|
+
default: b.variables.interactiveColorAccent,
|
|
145
|
+
error: b.variables.interactiveColorAccentError,
|
|
146
|
+
disabled: b.variables.neutral300
|
|
137
147
|
}));
|
|
138
148
|
}), (function(e) {
|
|
139
149
|
var t = e.$stepWidth, r = e.$thumbPosition;
|
|
140
|
-
return t && (0,
|
|
141
|
-
beforeThumbStepColor: (0,
|
|
142
|
-
default:
|
|
143
|
-
error:
|
|
144
|
-
disabled:
|
|
150
|
+
return t && (0, p.css)([ "&::after{position:absolute;top:0;left:0;width:100%;height:100%;", ";background-size:8px 8px;}" ], y({
|
|
151
|
+
beforeThumbStepColor: (0, b.pickVariant)("$state", {
|
|
152
|
+
default: b.variables.contentColorAccentWeak,
|
|
153
|
+
error: b.variables.contentColorNegativeWeak,
|
|
154
|
+
disabled: b.variables.contentColorDisabled
|
|
145
155
|
}),
|
|
146
|
-
afterThumbStepColor: (0,
|
|
147
|
-
default:
|
|
148
|
-
error:
|
|
149
|
-
disabled:
|
|
156
|
+
afterThumbStepColor: (0, b.pickVariant)("$state", {
|
|
157
|
+
default: b.variables.contentColorDefault,
|
|
158
|
+
error: b.variables.contentColorDefault,
|
|
159
|
+
disabled: b.variables.contentColorDisabled
|
|
150
160
|
}),
|
|
151
161
|
stepWidth: t,
|
|
152
162
|
thumbPosition: r
|
|
153
163
|
}));
|
|
154
164
|
}));
|
|
155
|
-
|
|
165
|
+
// Use .attrs() to compute positioning styles and set them via style attribute.
|
|
166
|
+
// This avoids styled-components class regeneration during drag operations, significantly
|
|
167
|
+
// improving performance when the thumb moves continuously.
|
|
168
|
+
var k = m().button.attrs((function(e) {
|
|
169
|
+
var t = e.$thumbPosition, r = e.$stepWidth;
|
|
170
|
+
if (t === undefined) {
|
|
171
|
+
return {
|
|
172
|
+
style: undefined
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (r) {
|
|
176
|
+
// With step marks
|
|
177
|
+
var n = -C / 2;
|
|
178
|
+
/* used to align thumb center with position */ if (t === 0) {
|
|
179
|
+
/* used to align thumb at start of bar (without going out of bar bounds) */
|
|
180
|
+
n = 0;
|
|
181
|
+
} else if (t === 100) {
|
|
182
|
+
/* used to align thumb at end of bar (without going out of bar bounds) */
|
|
183
|
+
n = -C;
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
style: {
|
|
187
|
+
left: "".concat(t, "%"),
|
|
188
|
+
marginLeft: "".concat(n, "px")
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/* Smoothly position thumb center at the min/max step position while keeping it
|
|
193
|
+
within bounds. This calculation doesn't match exactly with step marks so it is
|
|
194
|
+
only used when stepMarks are too small to be rendered. */ return {
|
|
195
|
+
style: {
|
|
196
|
+
left: "calc(".concat(t, "% - ").concat(t / 100 * C, "px)")
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
})).withConfig({
|
|
156
200
|
displayName: "SliderStyles__StyledSliderThumb",
|
|
157
201
|
componentId: "sc-16ooit4-2"
|
|
158
|
-
})([ "display:block;position:absolute;cursor:pointer;width:", "px;height:", "px;border-radius:50%;background-color:", ";border:2px solid ", ";
|
|
159
|
-
|
|
160
|
-
default:
|
|
161
|
-
error:
|
|
162
|
-
disabled:
|
|
163
|
-
}), (0,
|
|
164
|
-
default:
|
|
165
|
-
error:
|
|
166
|
-
disabled:
|
|
167
|
-
}), (function(e) {
|
|
168
|
-
var t = e.$thumbPosition;
|
|
169
|
-
return t;
|
|
170
|
-
}), S / 2, (0, p.pickVariant)("$thumbPosition", {
|
|
171
|
-
0: (0, m.css)([ "margin-left:0;" ]),
|
|
172
|
-
100: (0, m.css)([ "margin-left:-", "px;" ], S)
|
|
202
|
+
})([ "display:block;position:absolute;cursor:pointer;width:", "px;height:", "px;border-radius:50%;background-color:", ";border:2px solid ", ";", " ", "" ], C, C, (0,
|
|
203
|
+
b.pickVariant)("$state", {
|
|
204
|
+
default: b.variables.white,
|
|
205
|
+
error: b.variables.interactiveColorAccentError,
|
|
206
|
+
disabled: b.variables.neutral300
|
|
207
|
+
}), (0, b.pickVariant)("$state", {
|
|
208
|
+
default: b.variables.borderColorStrong,
|
|
209
|
+
error: b.variables.interactiveColorAccentErrorStrong,
|
|
210
|
+
disabled: b.variables.neutral300
|
|
173
211
|
}), (function(e) {
|
|
174
212
|
var t = e.$state;
|
|
175
|
-
return t !== "disabled" && (0,
|
|
213
|
+
return t !== "disabled" && (0, p.css)([ "&:hover,&:focus,&:active{box-shadow:", ";}" ], b.variables.focusShadow);
|
|
176
214
|
}), (function(e) {
|
|
177
215
|
var t = e.$state;
|
|
178
|
-
return t === "disabled" && (0,
|
|
216
|
+
return t === "disabled" && (0, p.css)([ "cursor:not-allowed;" ]);
|
|
179
217
|
}));
|
|
180
|
-
var E =
|
|
218
|
+
var E = m().div.withConfig({
|
|
181
219
|
displayName: "SliderStyles__StyledPopoverContent",
|
|
182
220
|
componentId: "sc-16ooit4-3"
|
|
183
|
-
})([ "padding:", ";" ],
|
|
184
|
-
var $ =
|
|
221
|
+
})([ "padding:", ";" ], b.variables.spacingMedium);
|
|
222
|
+
var $ = m().span.withConfig({
|
|
185
223
|
displayName: "SliderStyles__StyledLabel",
|
|
186
224
|
componentId: "sc-16ooit4-4"
|
|
187
225
|
})([ "align-self:center;color:", ";" ], (function(e) {
|
|
188
226
|
var t = e.$disabled;
|
|
189
|
-
return t ?
|
|
227
|
+
return t ? b.variables.contentColorDisabled : b.variables.contentColorActive;
|
|
190
228
|
}));
|
|
191
229
|
/* using content: '' to control if step marks should be shown
|
|
192
230
|
* to avoid further issues with variable interpolation given the
|
|
193
231
|
* complexity of the multiple radial gradient backgrounds. This also
|
|
194
|
-
* allows us not to pass in StyledSliderTypes to StyledInput */ var A = (0,
|
|
195
|
-
var O =
|
|
232
|
+
* allows us not to pass in StyledSliderTypes to StyledInput */ var A = (0, p.css)([ "", "{&::after{content:'';}}" ], /* sc-sel */ x);
|
|
233
|
+
var O = m().div.withConfig({
|
|
196
234
|
displayName: "SliderStyles__StyledInput",
|
|
197
235
|
componentId: "sc-16ooit4-5"
|
|
198
|
-
})([ "width:100%;min-width:200px;display:flex;align-items:center;flex:1 0 0;position:relative;cursor:default;height:", ";max-width:100%;", " &:hover{", "{border-color:", ";}}", "" ],
|
|
236
|
+
})([ "width:100%;min-width:200px;display:flex;align-items:center;flex:1 0 0;position:relative;cursor:default;height:", ";max-width:100%;", " &:hover{", "{border-color:", ";}}", "" ], b.variables.inputHeight, (function(e) {
|
|
199
237
|
var t = e.$state;
|
|
200
|
-
return t === "disabled" && (0,
|
|
201
|
-
}), /* sc-sel */
|
|
202
|
-
default:
|
|
203
|
-
error:
|
|
238
|
+
return t === "disabled" && (0, p.css)([ "cursor:not-allowed;" ]);
|
|
239
|
+
}), /* sc-sel */ x, (0, b.pickVariant)("$state", {
|
|
240
|
+
default: b.variables.interactiveColorBorderHover,
|
|
241
|
+
error: b.variables.interactiveColorBorderHover,
|
|
204
242
|
disabled: "transparent"
|
|
205
|
-
}), (0,
|
|
206
|
-
focus: (0,
|
|
207
|
-
always: (0,
|
|
243
|
+
}), (0, b.pickVariant)("$stepAppearance", {
|
|
244
|
+
focus: (0, p.css)([ "&:focus-within{", "}" ], A),
|
|
245
|
+
always: (0, p.css)([ "", "" ], A)
|
|
208
246
|
}));
|
|
209
247
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
210
248
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
211
|
-
var
|
|
249
|
+
var P = {
|
|
212
250
|
body: {
|
|
213
251
|
appendChild: function e() {
|
|
214
252
|
return [];
|
|
@@ -262,16 +300,16 @@
|
|
|
262
300
|
search: ""
|
|
263
301
|
}
|
|
264
302
|
};
|
|
265
|
-
function
|
|
266
|
-
var e = typeof document !== "undefined" ? document :
|
|
303
|
+
function T() {
|
|
304
|
+
var e = typeof document !== "undefined" ? document : P;
|
|
267
305
|
return e;
|
|
268
306
|
}
|
|
269
|
-
var
|
|
270
|
-
/* harmony default export */ const B = /* unused pure expression or super */ null &&
|
|
307
|
+
var V = T();
|
|
308
|
+
/* harmony default export */ const B = /* unused pure expression or super */ null && V;
|
|
271
309
|
// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
272
310
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
273
|
-
var
|
|
274
|
-
document:
|
|
311
|
+
var I = {
|
|
312
|
+
document: P,
|
|
275
313
|
navigator: {
|
|
276
314
|
userAgent: ""
|
|
277
315
|
},
|
|
@@ -325,12 +363,12 @@
|
|
|
325
363
|
clearTimeout(t);
|
|
326
364
|
}
|
|
327
365
|
};
|
|
328
|
-
function
|
|
329
|
-
var e = typeof window !== "undefined" ? window :
|
|
366
|
+
function L() {
|
|
367
|
+
var e = typeof window !== "undefined" ? window : I;
|
|
330
368
|
return e;
|
|
331
369
|
}
|
|
332
|
-
var
|
|
333
|
-
/* harmony default export */ const
|
|
370
|
+
var _ = L();
|
|
371
|
+
/* harmony default export */ const j = _;
|
|
334
372
|
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
335
373
|
/**
|
|
336
374
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
@@ -338,7 +376,7 @@
|
|
|
338
376
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
339
377
|
* @param current - The new value of the ref.
|
|
340
378
|
*/
|
|
341
|
-
function
|
|
379
|
+
function q(e, t) {
|
|
342
380
|
if (e) {
|
|
343
381
|
if (typeof e === "function") {
|
|
344
382
|
e(t);
|
|
@@ -351,8 +389,8 @@
|
|
|
351
389
|
}
|
|
352
390
|
}
|
|
353
391
|
// CONCATENATED MODULE: ./src/Slider/Slider.tsx
|
|
354
|
-
function
|
|
355
|
-
return
|
|
392
|
+
function M() {
|
|
393
|
+
return M = Object.assign ? Object.assign.bind() : function(e) {
|
|
356
394
|
for (var t = 1; t < arguments.length; t++) {
|
|
357
395
|
var r = arguments[t];
|
|
358
396
|
for (var n in r) {
|
|
@@ -360,9 +398,9 @@
|
|
|
360
398
|
}
|
|
361
399
|
}
|
|
362
400
|
return e;
|
|
363
|
-
},
|
|
401
|
+
}, M.apply(null, arguments);
|
|
364
402
|
}
|
|
365
|
-
function
|
|
403
|
+
function N(e, t) {
|
|
366
404
|
return H(e) || F(e, t) || R(e, t) || D();
|
|
367
405
|
}
|
|
368
406
|
function D() {
|
|
@@ -437,6 +475,7 @@
|
|
|
437
475
|
elementRef: l().oneOfType([ l().func, l().object ]),
|
|
438
476
|
error: l().bool,
|
|
439
477
|
inline: l().bool,
|
|
478
|
+
inputId: l().string,
|
|
440
479
|
labelledBy: l().string,
|
|
441
480
|
max: l().number,
|
|
442
481
|
maxLabel: l().node,
|
|
@@ -513,7 +552,7 @@
|
|
|
513
552
|
var l = Math.round(o / i);
|
|
514
553
|
var u = a.getBoundingClientRect();
|
|
515
554
|
var s = i * 100 / o;
|
|
516
|
-
return u.width / l >
|
|
555
|
+
return u.width / l > C / 2 ? s : undefined;
|
|
517
556
|
};
|
|
518
557
|
var ee = function e(t) {
|
|
519
558
|
var r = t.max, n = t.min, a = t.value;
|
|
@@ -524,66 +563,66 @@
|
|
|
524
563
|
return (a - n) / i * 100;
|
|
525
564
|
};
|
|
526
565
|
function te(e) {
|
|
527
|
-
var t = e.defaultValue, a = e.describedBy, i = e.disabled, o = e.displayValue, l = e.elementRef, u = e.error, c = e.inline, f = e.labelledBy, m = e.max, b = m === void 0 ? 5 : m,
|
|
566
|
+
var t = e.defaultValue, a = e.describedBy, i = e.disabled, o = e.displayValue, l = e.elementRef, u = e.error, c = e.inline, f = e.inputId, p = e.labelledBy, m = e.max, b = m === void 0 ? 5 : m, h = e.maxLabel, y = e.min, g = y === void 0 ? 1 : y, w = e.minLabel, C = e.name, A = e.onChange, P = e.required, T = e.step, V = T === void 0 ? 1 : T, B = e.stepMarks, I = B === void 0 ? "focus" : B, L = e.thumbRef, _ = e.value, D = U(e, [ "defaultValue", "describedBy", "disabled", "displayValue", "elementRef", "error", "inline", "inputId", "labelledBy", "max", "maxLabel", "min", "minLabel", "name", "onChange", "required", "step", "stepMarks", "thumbRef", "value" ]);
|
|
528
567
|
// @docs-props-type SliderPropsBase
|
|
529
|
-
var
|
|
568
|
+
var R = v()({
|
|
530
569
|
componentName: "Slider",
|
|
531
570
|
/* eslint-disable-next-line prefer-rest-params */
|
|
532
571
|
componentProps: arguments[0]
|
|
533
572
|
});
|
|
534
|
-
var
|
|
535
|
-
var
|
|
536
|
-
var
|
|
537
|
-
var
|
|
538
|
-
var
|
|
539
|
-
return
|
|
540
|
-
value: (b -
|
|
541
|
-
min:
|
|
573
|
+
var W = (0, r.useState)(false), F = N(W, 2), H = F[0], z = F[1];
|
|
574
|
+
var K = (0, r.useState)(false), te = N(K, 2), re = te[0], ne = te[1];
|
|
575
|
+
var ae = (0, r.useState)(null), ie = N(ae, 2), oe = ie[0], le = ie[1];
|
|
576
|
+
var ue = (0, r.useState)(null), se = N(ue, 2), ce = se[0], de = se[1];
|
|
577
|
+
var fe = (0, r.useMemo)((function() {
|
|
578
|
+
return R ? Q({
|
|
579
|
+
value: (b - g) / 2,
|
|
580
|
+
min: g,
|
|
542
581
|
max: b,
|
|
543
|
-
step:
|
|
582
|
+
step: V
|
|
544
583
|
}) : t;
|
|
545
|
-
}), [
|
|
546
|
-
var
|
|
547
|
-
var
|
|
584
|
+
}), [ R, t, b, g, V ]);
|
|
585
|
+
var ve = (0, r.useState)(R ? _ : fe), pe = N(ve, 2), me = pe[0], be = pe[1];
|
|
586
|
+
var he = (0, r.useCallback)((function(e, t) {
|
|
548
587
|
var r = t.newValue;
|
|
549
588
|
if (me !== r) {
|
|
550
|
-
|
|
589
|
+
A === null || A === void 0 ? void 0 : A(e, {
|
|
551
590
|
value: r,
|
|
552
|
-
name:
|
|
591
|
+
name: C
|
|
553
592
|
});
|
|
554
|
-
if (!
|
|
593
|
+
if (!R) {
|
|
555
594
|
be(r);
|
|
556
595
|
}
|
|
557
596
|
}
|
|
558
|
-
}), [
|
|
597
|
+
}), [ R, C, A, me ]);
|
|
559
598
|
// handlers
|
|
560
|
-
var
|
|
561
|
-
|
|
599
|
+
var ye = (0, r.useCallback)((function() {
|
|
600
|
+
ne(false);
|
|
562
601
|
}), []);
|
|
563
|
-
var
|
|
564
|
-
|
|
565
|
-
}), []);
|
|
566
|
-
var ge = (0, r.useCallback)((function(e) {
|
|
567
|
-
oe(e);
|
|
602
|
+
var ge = (0, r.useCallback)((function() {
|
|
603
|
+
ne(true);
|
|
568
604
|
}), []);
|
|
569
605
|
var we = (0, r.useCallback)((function(e) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
606
|
+
le(e);
|
|
607
|
+
}), []);
|
|
608
|
+
var Ce = (0, r.useCallback)((function(e) {
|
|
609
|
+
de(e);
|
|
610
|
+
q(L, e);
|
|
611
|
+
}), [ L ]);
|
|
573
612
|
var Se = (0, r.useCallback)((function(e) {
|
|
574
|
-
var t = J(e,
|
|
613
|
+
var t = J(e, oe);
|
|
575
614
|
if (t !== undefined) {
|
|
576
615
|
var r = Y({
|
|
577
616
|
position: t,
|
|
578
617
|
max: b,
|
|
579
|
-
min:
|
|
580
|
-
step:
|
|
618
|
+
min: g,
|
|
619
|
+
step: V
|
|
581
620
|
});
|
|
582
|
-
|
|
621
|
+
he(e, {
|
|
583
622
|
newValue: r
|
|
584
623
|
});
|
|
585
624
|
}
|
|
586
|
-
}), [ b,
|
|
625
|
+
}), [ b, g, he, oe, V ]);
|
|
587
626
|
var xe = (0, r.useCallback)((function(e) {
|
|
588
627
|
var t = me;
|
|
589
628
|
if (t !== undefined) {
|
|
@@ -591,14 +630,14 @@
|
|
|
591
630
|
var n;
|
|
592
631
|
var a = G({
|
|
593
632
|
direction: "forward",
|
|
594
|
-
min:
|
|
595
|
-
step:
|
|
633
|
+
min: g,
|
|
634
|
+
step: V,
|
|
596
635
|
value: t
|
|
597
636
|
});
|
|
598
637
|
var i = G({
|
|
599
638
|
direction: "backward",
|
|
600
|
-
min:
|
|
601
|
-
step:
|
|
639
|
+
min: g,
|
|
640
|
+
step: V,
|
|
602
641
|
value: t
|
|
603
642
|
});
|
|
604
643
|
if (r === "ArrowRight") {
|
|
@@ -616,131 +655,146 @@
|
|
|
616
655
|
}
|
|
617
656
|
t = X({
|
|
618
657
|
max: b,
|
|
619
|
-
min:
|
|
658
|
+
min: g,
|
|
620
659
|
value: n
|
|
621
660
|
});
|
|
622
661
|
t = Q({
|
|
623
662
|
max: b,
|
|
624
|
-
min:
|
|
625
|
-
step:
|
|
663
|
+
min: g,
|
|
664
|
+
step: V,
|
|
626
665
|
value: t
|
|
627
666
|
});
|
|
628
|
-
|
|
667
|
+
he(e, {
|
|
629
668
|
newValue: t
|
|
630
669
|
});
|
|
631
670
|
}
|
|
632
|
-
}), [ b,
|
|
633
|
-
var
|
|
671
|
+
}), [ b, g, he, V, me ]);
|
|
672
|
+
var ke = (0, r.useCallback)((function(e) {
|
|
634
673
|
e.preventDefault();
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}), [
|
|
639
|
-
var ke = (0, r.useCallback)((function() {
|
|
640
|
-
re(true);
|
|
641
|
-
}), []);
|
|
674
|
+
ce === null || ce === void 0 ? void 0 : ce.focus();
|
|
675
|
+
z(true);
|
|
676
|
+
ne(true);
|
|
677
|
+
}), [ ce ]);
|
|
642
678
|
var Ee = (0, r.useCallback)((function() {
|
|
643
|
-
|
|
644
|
-
|
|
679
|
+
ne(true);
|
|
680
|
+
}), []);
|
|
681
|
+
var $e = (0, r.useCallback)((function() {
|
|
682
|
+
if (!H) {
|
|
683
|
+
ne(false);
|
|
645
684
|
}
|
|
646
|
-
}), [
|
|
647
|
-
var
|
|
648
|
-
if (
|
|
649
|
-
var t = J(e,
|
|
685
|
+
}), [ H ]);
|
|
686
|
+
var Ae = (0, r.useCallback)((function(e) {
|
|
687
|
+
if (H) {
|
|
688
|
+
var t = J(e, oe);
|
|
650
689
|
if (t !== undefined) {
|
|
651
690
|
var r = Y({
|
|
652
691
|
position: t,
|
|
653
|
-
min:
|
|
692
|
+
min: g,
|
|
654
693
|
max: b,
|
|
655
|
-
step:
|
|
694
|
+
step: V
|
|
656
695
|
});
|
|
657
|
-
|
|
696
|
+
he(e, {
|
|
658
697
|
newValue: r
|
|
659
698
|
});
|
|
660
699
|
}
|
|
661
700
|
}
|
|
662
|
-
}), [
|
|
663
|
-
var
|
|
664
|
-
|
|
665
|
-
|
|
701
|
+
}), [ H, b, g, he, oe, V ]);
|
|
702
|
+
var Oe = (0, r.useCallback)((function() {
|
|
703
|
+
z(false);
|
|
704
|
+
ne(false);
|
|
666
705
|
}), []);
|
|
706
|
+
var Pe = (0, r.useCallback)((function(e) {
|
|
707
|
+
// When a label is clicked, it triggers a synthetic click event on the associated control.
|
|
708
|
+
// For Slider, we only want to focus the thumb, not trigger any other behavior.
|
|
709
|
+
// We can detect label-initiated clicks because they have a detail of 0 (synthetic)
|
|
710
|
+
// and the button wasn't the actual click target.
|
|
711
|
+
if (e.detail === 0) {
|
|
712
|
+
e.preventDefault();
|
|
713
|
+
e.stopPropagation();
|
|
714
|
+
ce === null || ce === void 0 ? void 0 : ce.focus();
|
|
715
|
+
}
|
|
716
|
+
}), [ ce ]);
|
|
667
717
|
(0, r.useEffect)((function() {
|
|
668
718
|
if (false) {}
|
|
669
|
-
}), [ b,
|
|
719
|
+
}), [ b, g ]);
|
|
670
720
|
(0, r.useEffect)((function() {
|
|
671
721
|
// keep valueState in sync with value prop when controlled
|
|
672
|
-
if (
|
|
673
|
-
be(
|
|
722
|
+
if (R) {
|
|
723
|
+
be(_);
|
|
674
724
|
}
|
|
675
|
-
}), [
|
|
676
|
-
var
|
|
725
|
+
}), [ R, _ ]);
|
|
726
|
+
var Te = i && "disabled" || u && "error" || "default";
|
|
677
727
|
var Ve = ee({
|
|
678
728
|
value: me,
|
|
679
|
-
min:
|
|
729
|
+
min: g,
|
|
680
730
|
max: b
|
|
681
731
|
});
|
|
682
|
-
var
|
|
732
|
+
var Be = V ? Z({
|
|
683
733
|
max: b,
|
|
684
|
-
min:
|
|
685
|
-
sliderBar:
|
|
686
|
-
step:
|
|
734
|
+
min: g,
|
|
735
|
+
sliderBar: oe,
|
|
736
|
+
step: V
|
|
687
737
|
}) : undefined;
|
|
688
738
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
689
|
-
return n().createElement(
|
|
739
|
+
return n().createElement(S, M({
|
|
690
740
|
"data-test": "slider",
|
|
691
741
|
"data-test-disabled": i ? "disabled" : undefined,
|
|
692
742
|
"data-test-value": me,
|
|
693
743
|
ref: l,
|
|
694
744
|
$inline: c
|
|
695
|
-
},
|
|
696
|
-
target:
|
|
745
|
+
}, D), H && n().createElement(n().Fragment, null, n().createElement(s(), {
|
|
746
|
+
target: j,
|
|
697
747
|
eventType: "mouseup",
|
|
698
|
-
listener:
|
|
748
|
+
listener: Oe
|
|
699
749
|
}), n().createElement(s(), {
|
|
700
|
-
target:
|
|
750
|
+
target: j,
|
|
701
751
|
eventType: "mousemove",
|
|
702
|
-
listener:
|
|
703
|
-
})),
|
|
752
|
+
listener: Ae
|
|
753
|
+
})), w !== null && n().createElement($, {
|
|
704
754
|
"data-test": "min-label",
|
|
705
755
|
$disabled: i
|
|
706
|
-
},
|
|
756
|
+
}, w || g), n().createElement(O, {
|
|
707
757
|
onClick: i ? undefined : Se,
|
|
708
|
-
$state:
|
|
709
|
-
$stepAppearance:
|
|
710
|
-
}, n().createElement(
|
|
711
|
-
"aria-required":
|
|
758
|
+
$state: Te,
|
|
759
|
+
$stepAppearance: I
|
|
760
|
+
}, n().createElement(x, {
|
|
761
|
+
"aria-required": P,
|
|
712
762
|
"data-test": "bar",
|
|
713
|
-
ref:
|
|
763
|
+
ref: we,
|
|
714
764
|
$thumbPosition: Ve,
|
|
715
|
-
$stepWidth:
|
|
716
|
-
$state:
|
|
765
|
+
$stepWidth: Be,
|
|
766
|
+
$state: Te
|
|
717
767
|
}), n().createElement(k, {
|
|
768
|
+
id: f,
|
|
718
769
|
"aria-describedby": a,
|
|
719
|
-
"aria-labelledby":
|
|
770
|
+
"aria-labelledby": p,
|
|
720
771
|
"aria-invalid": u,
|
|
721
772
|
"aria-valuemax": b,
|
|
722
|
-
"aria-valuemin":
|
|
773
|
+
"aria-valuemin": g,
|
|
723
774
|
"aria-valuenow": me,
|
|
724
775
|
"data-test": "thumb",
|
|
725
|
-
onBlur:
|
|
726
|
-
|
|
727
|
-
|
|
776
|
+
onBlur: ye,
|
|
777
|
+
onClick: i ? undefined : Pe,
|
|
778
|
+
onMouseEnter: Ee,
|
|
779
|
+
onMouseLeave: $e,
|
|
728
780
|
onKeyDown: i ? undefined : xe,
|
|
729
|
-
onMouseDown: i ? undefined :
|
|
730
|
-
onFocus:
|
|
731
|
-
ref:
|
|
781
|
+
onMouseDown: i ? undefined : ke,
|
|
782
|
+
onFocus: ge,
|
|
783
|
+
ref: Ce,
|
|
732
784
|
role: "slider",
|
|
785
|
+
type: "button",
|
|
733
786
|
disabled: i,
|
|
734
787
|
$thumbPosition: Ve,
|
|
735
|
-
$
|
|
788
|
+
$stepWidth: Be,
|
|
789
|
+
$state: Te
|
|
736
790
|
}), n().createElement(d(), {
|
|
737
|
-
open:
|
|
738
|
-
anchor:
|
|
791
|
+
open: re,
|
|
792
|
+
anchor: ce,
|
|
739
793
|
align: "center"
|
|
740
|
-
}, n().createElement(E, null, o || me))),
|
|
794
|
+
}, n().createElement(E, null, o || me))), h !== null && n().createElement($, {
|
|
741
795
|
"data-test": "max-label",
|
|
742
796
|
$disabled: i
|
|
743
|
-
},
|
|
797
|
+
}, h || b));
|
|
744
798
|
}
|
|
745
799
|
te.propTypes = K;
|
|
746
800
|
/* harmony default export */ const re = te;
|