@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/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 m = require("styled-components");
86
- var b = e.n(m);
85
+ const p = require("styled-components");
86
+ var m = e.n(p);
87
87
  // CONCATENATED MODULE: external "@splunk/themes"
88
- const p = require("@splunk/themes");
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, m.css)([ "background:", ";" ], l.map((function(e, r) {
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, m.css)([ "radial-gradient(circle,", " 0%,", " 3px,transparent 3px) calc(", "% - 1.5px) center no-repeat ", "" ], u, u, o, s);
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 S = 24;
111
- var x = b().div.withConfig({
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%;", "" ], p.mixins.reset("flex"), p.variables.spacingLarge, (function(e) {
114
+ })([ "", ";gap:", ";width:100%;", "" ], b.mixins.reset("flex"), b.variables.spacingLarge, (function(e) {
115
115
  var t = e.$inline;
116
- return t && (0, m.css)([ "width:300px;" ]);
116
+ return t && (0, p.css)([ "width:300px;" ]);
117
117
  }));
118
- var C = b().div.withConfig({
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
- p.pickVariant)("$state", {
123
- default: p.variables.neutral300,
124
- error: p.variables.neutral300,
125
- disabled: p.variables.neutral200
126
- }), w, (0, p.pickVariant)("$state", {
127
- default: p.variables.interactiveColorBorder,
128
- error: p.variables.interactiveColorBorder,
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, m.css)([ "&::before{position:absolute;border-radius:", ";content:'';height:calc( ", "px + ", "px );top:-", "px;left:-", "px;width:", "%;background-color:", ";}" ], p.variables.borderRadius, g, w * 2, w, w, t, (0,
133
- p.pickVariant)("$state", {
134
- default: p.variables.interactiveColorAccent,
135
- error: p.variables.interactiveColorAccentError,
136
- disabled: p.variables.neutral300
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, m.css)([ "&::after{position:absolute;top:0;left:0;width:100%;height:100%;", ";background-size:8px 8px;}" ], y({
141
- beforeThumbStepColor: (0, p.pickVariant)("$state", {
142
- default: p.variables.contentColorAccentWeak,
143
- error: p.variables.contentColorNegativeWeak,
144
- disabled: p.variables.contentColorDisabled
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, p.pickVariant)("$state", {
147
- default: p.variables.contentColorDefault,
148
- error: p.variables.contentColorDefault,
149
- disabled: p.variables.contentColorDisabled
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
- var k = b().button.withConfig({
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 ", ";left:", "%;margin-left:-", "px;", ";", " ", "" ], S, S, (0,
159
- p.pickVariant)("$state", {
160
- default: p.variables.white,
161
- error: p.variables.interactiveColorAccentError,
162
- disabled: p.variables.neutral300
163
- }), (0, p.pickVariant)("$state", {
164
- default: p.variables.borderColorStrong,
165
- error: p.variables.interactiveColorAccentErrorStrong,
166
- disabled: p.variables.neutral300
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, m.css)([ "&:hover,&:focus,&:active{box-shadow:", ";}" ], p.variables.focusShadow);
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, m.css)([ "cursor:not-allowed;" ]);
216
+ return t === "disabled" && (0, p.css)([ "cursor:not-allowed;" ]);
179
217
  }));
180
- var E = b().div.withConfig({
218
+ var E = m().div.withConfig({
181
219
  displayName: "SliderStyles__StyledPopoverContent",
182
220
  componentId: "sc-16ooit4-3"
183
- })([ "padding:", ";" ], p.variables.spacingMedium);
184
- var $ = b().span.withConfig({
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 ? p.variables.contentColorDisabled : p.variables.contentColorActive;
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, m.css)([ "", "{&::after{content:'';}}" ], /* sc-sel */ C);
195
- var O = b().div.withConfig({
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:", ";}}", "" ], p.variables.inputHeight, (function(e) {
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, m.css)([ "cursor:not-allowed;" ]);
201
- }), /* sc-sel */ C, (0, p.pickVariant)("$state", {
202
- default: p.variables.interactiveColorBorderHover,
203
- error: p.variables.interactiveColorBorderHover,
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, p.pickVariant)("$stepAppearance", {
206
- focus: (0, m.css)([ "&:focus-within{", "}" ], A),
207
- always: (0, m.css)([ "", "" ], A)
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 V = {
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 P() {
266
- var e = typeof document !== "undefined" ? document : V;
303
+ function T() {
304
+ var e = typeof document !== "undefined" ? document : P;
267
305
  return e;
268
306
  }
269
- var T = P();
270
- /* harmony default export */ const B = /* unused pure expression or super */ null && T;
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: V,
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 j() {
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 q = j();
333
- /* harmony default export */ const L = q;
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 M(e, t) {
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 N() {
355
- return N = Object.assign ? Object.assign.bind() : function(e) {
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
- }, N.apply(null, arguments);
401
+ }, M.apply(null, arguments);
364
402
  }
365
- function I(e, t) {
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 > S / 2 ? s : undefined;
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, p = e.maxLabel, h = e.min, y = h === void 0 ? 1 : h, g = e.minLabel, w = e.name, S = e.onChange, A = e.required, V = e.step, P = V === void 0 ? 1 : V, T = e.stepMarks, B = T === void 0 ? "focus" : T, _ = e.thumbRef, j = e.value, q = U(e, [ "defaultValue", "describedBy", "disabled", "displayValue", "elementRef", "error", "inline", "labelledBy", "max", "maxLabel", "min", "minLabel", "name", "onChange", "required", "step", "stepMarks", "thumbRef", "value" ]);
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 D = v()({
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 R = (0, r.useState)(false), W = I(R, 2), F = W[0], H = W[1];
535
- var z = (0, r.useState)(false), K = I(z, 2), te = K[0], re = K[1];
536
- var ne = (0, r.useState)(null), ae = I(ne, 2), ie = ae[0], oe = ae[1];
537
- var le = (0, r.useState)(null), ue = I(le, 2), se = ue[0], ce = ue[1];
538
- var de = (0, r.useMemo)((function() {
539
- return D ? Q({
540
- value: (b - y) / 2,
541
- min: y,
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: P
582
+ step: V
544
583
  }) : t;
545
- }), [ D, t, b, y, P ]);
546
- var fe = (0, r.useState)(D ? j : de), ve = I(fe, 2), me = ve[0], be = ve[1];
547
- var pe = (0, r.useCallback)((function(e, t) {
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
- S === null || S === void 0 ? void 0 : S(e, {
589
+ A === null || A === void 0 ? void 0 : A(e, {
551
590
  value: r,
552
- name: w
591
+ name: C
553
592
  });
554
- if (!D) {
593
+ if (!R) {
555
594
  be(r);
556
595
  }
557
596
  }
558
- }), [ D, w, S, me ]);
597
+ }), [ R, C, A, me ]);
559
598
  // handlers
560
- var he = (0, r.useCallback)((function() {
561
- re(false);
599
+ var ye = (0, r.useCallback)((function() {
600
+ ne(false);
562
601
  }), []);
563
- var ye = (0, r.useCallback)((function() {
564
- re(true);
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
- ce(e);
571
- M(_, e);
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, ie);
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: y,
580
- step: P
618
+ min: g,
619
+ step: V
581
620
  });
582
- pe(e, {
621
+ he(e, {
583
622
  newValue: r
584
623
  });
585
624
  }
586
- }), [ b, y, pe, ie, P ]);
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: y,
595
- step: P,
633
+ min: g,
634
+ step: V,
596
635
  value: t
597
636
  });
598
637
  var i = G({
599
638
  direction: "backward",
600
- min: y,
601
- step: P,
639
+ min: g,
640
+ step: V,
602
641
  value: t
603
642
  });
604
643
  if (r === "ArrowRight") {
@@ -616,131 +655,145 @@
616
655
  }
617
656
  t = X({
618
657
  max: b,
619
- min: y,
658
+ min: g,
620
659
  value: n
621
660
  });
622
661
  t = Q({
623
662
  max: b,
624
- min: y,
625
- step: P,
663
+ min: g,
664
+ step: V,
626
665
  value: t
627
666
  });
628
- pe(e, {
667
+ he(e, {
629
668
  newValue: t
630
669
  });
631
670
  }
632
- }), [ b, y, pe, P, me ]);
633
- var Ce = (0, r.useCallback)((function(e) {
671
+ }), [ b, g, he, V, me ]);
672
+ var ke = (0, r.useCallback)((function(e) {
634
673
  e.preventDefault();
635
- se === null || se === void 0 ? void 0 : se.focus();
636
- H(true);
637
- re(true);
638
- }), [ se ]);
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
- if (!F) {
644
- re(false);
679
+ ne(true);
680
+ }), []);
681
+ var $e = (0, r.useCallback)((function() {
682
+ if (!H) {
683
+ ne(false);
645
684
  }
646
- }), [ F ]);
647
- var $e = (0, r.useCallback)((function(e) {
648
- if (F) {
649
- var t = J(e, ie);
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: y,
692
+ min: g,
654
693
  max: b,
655
- step: P
694
+ step: V
656
695
  });
657
- pe(e, {
696
+ he(e, {
658
697
  newValue: r
659
698
  });
660
699
  }
661
700
  }
662
- }), [ F, b, y, pe, ie, P ]);
663
- var Ae = (0, r.useCallback)((function() {
664
- H(false);
665
- re(false);
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, y ]);
719
+ }), [ b, g ]);
670
720
  (0, r.useEffect)((function() {
671
721
  // keep valueState in sync with value prop when controlled
672
- if (D) {
673
- be(j);
722
+ if (R) {
723
+ be(_);
674
724
  }
675
- }), [ D, j ]);
676
- var Oe = i && "disabled" || u && "error" || "default";
725
+ }), [ R, _ ]);
726
+ var Te = i && "disabled" || u && "error" || "default";
677
727
  var Ve = ee({
678
728
  value: me,
679
- min: y,
729
+ min: g,
680
730
  max: b
681
731
  });
682
- var Pe = P ? Z({
732
+ var Be = V ? Z({
683
733
  max: b,
684
- min: y,
685
- sliderBar: ie,
686
- step: P
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(x, N({
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
- }, q), F && n().createElement(n().Fragment, null, n().createElement(s(), {
696
- target: L,
745
+ }, D), H && n().createElement(n().Fragment, null, n().createElement(s(), {
746
+ target: j,
697
747
  eventType: "mouseup",
698
- listener: Ae
748
+ listener: Oe
699
749
  }), n().createElement(s(), {
700
- target: L,
750
+ target: j,
701
751
  eventType: "mousemove",
702
- listener: $e
703
- })), g !== null && n().createElement($, {
752
+ listener: Ae
753
+ })), w !== null && n().createElement($, {
704
754
  "data-test": "min-label",
705
755
  $disabled: i
706
- }, g || y), n().createElement(O, {
756
+ }, w || g), n().createElement(O, {
707
757
  onClick: i ? undefined : Se,
708
- $state: Oe,
709
- $stepAppearance: B
710
- }, n().createElement(C, {
711
- "aria-required": A,
758
+ $state: Te,
759
+ $stepAppearance: I
760
+ }, n().createElement(x, {
761
+ "aria-required": P,
712
762
  "data-test": "bar",
713
- ref: ge,
763
+ ref: we,
714
764
  $thumbPosition: Ve,
715
- $stepWidth: Pe,
716
- $state: Oe
765
+ $stepWidth: Be,
766
+ $state: Te
717
767
  }), n().createElement(k, {
768
+ id: f,
718
769
  "aria-describedby": a,
719
- "aria-labelledby": f,
770
+ "aria-labelledby": p,
720
771
  "aria-invalid": u,
721
772
  "aria-valuemax": b,
722
- "aria-valuemin": y,
773
+ "aria-valuemin": g,
723
774
  "aria-valuenow": me,
724
775
  "data-test": "thumb",
725
- onBlur: he,
726
- onMouseEnter: ke,
727
- onMouseLeave: Ee,
776
+ onBlur: ye,
777
+ onClick: i ? undefined : Pe,
778
+ onMouseEnter: Ee,
779
+ onMouseLeave: $e,
728
780
  onKeyDown: i ? undefined : xe,
729
- onMouseDown: i ? undefined : Ce,
730
- onFocus: ye,
731
- ref: we,
781
+ onMouseDown: i ? undefined : ke,
782
+ onFocus: ge,
783
+ ref: Ce,
732
784
  role: "slider",
733
785
  disabled: i,
734
786
  $thumbPosition: Ve,
735
- $state: Oe
787
+ $stepWidth: Be,
788
+ $state: Te
736
789
  }), n().createElement(d(), {
737
- open: te,
738
- anchor: se,
790
+ open: re,
791
+ anchor: ce,
739
792
  align: "center"
740
- }, n().createElement(E, null, o || me))), p !== null && n().createElement($, {
793
+ }, n().createElement(E, null, o || me))), h !== null && n().createElement($, {
741
794
  "data-test": "max-label",
742
795
  $disabled: i
743
- }, p || b));
796
+ }, h || b));
744
797
  }
745
798
  te.propTypes = K;
746
799
  /* harmony default export */ const re = te;