@splunk/react-ui 4.21.1 → 4.22.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/CHANGELOG.md +17 -1
- package/Code.js +0 -1
- package/Color.js +238 -235
- package/ComboBox.js +195 -183
- package/Menu.js +100 -101
- package/Multiselect.js +655 -641
- package/RadioBar.js +91 -67
- package/ResultsMenu.js +107 -122
- package/Search.js +258 -246
- package/Select.js +461 -457
- package/Slider.js +87 -76
- package/TabBar.js +99 -84
- package/Table.js +805 -673
- package/package.json +5 -5
- package/types/src/Color/Color.d.ts +0 -1
- package/types/src/RadioBar/RadioBar.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
- package/types/src/Select/docs/examples/Icons.d.ts +1 -9
- package/types/src/Slider/Slider.d.ts +1 -0
- package/types/src/TabBar/Tab.d.ts +10 -1
- package/types/src/TabBar/TabBar.d.ts +4 -2
- package/types/src/Table/Head.d.ts +7 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Table/TableContext.d.ts +2 -0
- package/Code.js.LICENSE.txt +0 -8
package/Slider.js
CHANGED
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
var n = e.n(r);
|
|
69
69
|
// CONCATENATED MODULE: external "prop-types"
|
|
70
70
|
const i = require("prop-types");
|
|
71
|
-
var
|
|
71
|
+
var a = e.n(i);
|
|
72
72
|
// CONCATENATED MODULE: external "decimal.js-light"
|
|
73
|
-
const
|
|
74
|
-
var s = e.n(
|
|
73
|
+
const o = require("decimal.js-light");
|
|
74
|
+
var s = e.n(o);
|
|
75
75
|
// CONCATENATED MODULE: external "lodash/has"
|
|
76
76
|
const l = require("lodash/has");
|
|
77
77
|
var u = e.n(l);
|
|
@@ -105,44 +105,44 @@
|
|
|
105
105
|
displayName: "SliderStyles__StyledBox",
|
|
106
106
|
componentId: "sc-16ooit4-0"
|
|
107
107
|
})([ "", ";flex:1 1 auto;&[data-inline]{width:300px;}" ], h.mixins.reset("block"));
|
|
108
|
-
var
|
|
108
|
+
var V = x().div.withConfig({
|
|
109
109
|
displayName: "SliderStyles__StyledInput",
|
|
110
110
|
componentId: "sc-16ooit4-1"
|
|
111
111
|
})([ "flex:1 0 0;vertical-align:middle;position:relative;cursor:default;height:", ";max-width:100%;" ], h.variables.inputHeight);
|
|
112
|
-
var
|
|
113
|
-
var
|
|
112
|
+
var E = "1px";
|
|
113
|
+
var O = function e(t) {
|
|
114
114
|
var r = t.$error;
|
|
115
115
|
return (0, h.pick)({
|
|
116
116
|
enterprise: h.variables.gray45,
|
|
117
117
|
prisma: r ? h.variables.accentColorNegative : h.variables.contentColorActive
|
|
118
118
|
});
|
|
119
119
|
};
|
|
120
|
-
var
|
|
120
|
+
var B = (0, h.pick)({
|
|
121
121
|
enterprise: {
|
|
122
122
|
dark: h.variables.gray20,
|
|
123
123
|
light: h.variables.gray96
|
|
124
124
|
},
|
|
125
125
|
prisma: h.variables.neutral100
|
|
126
126
|
});
|
|
127
|
-
var
|
|
127
|
+
var $ = (0, h.pick)({
|
|
128
128
|
enterprise: h.variables.gray80,
|
|
129
129
|
prisma: h.variables.interactiveColorBorder
|
|
130
130
|
});
|
|
131
|
-
var
|
|
131
|
+
var _ = function e(t) {
|
|
132
132
|
var r = t.$error, n = t.$position, i = t.$stepMarksWidth;
|
|
133
|
-
/* stylelint-disable indentation */ return i !== undefined ? (0, k.css)([ "background-image:linear-gradient( to right,", ",", " ", ",transparent ", ",transparent 100% ),repeating-linear-gradient( to right,", ",", " ", ",transparent ", ",transparent ", "% ),linear-gradient( to right,", ",", " ", "%,", " ", "%,", " );" ],
|
|
133
|
+
/* stylelint-disable indentation */ return i !== undefined ? (0, k.css)([ "background-image:linear-gradient( to right,", ",", " ", ",transparent ", ",transparent 100% ),repeating-linear-gradient( to right,", ",", " ", ",transparent ", ",transparent ", "% ),linear-gradient( to right,", ",", " ", "%,", " ", "%,", " );" ], O({
|
|
134
134
|
$error: r
|
|
135
|
-
}),
|
|
135
|
+
}), O({
|
|
136
136
|
$error: r
|
|
137
|
-
}),
|
|
137
|
+
}), E, E, B, B, E, E, i, O({
|
|
138
138
|
$error: r
|
|
139
|
-
}),
|
|
139
|
+
}), O({
|
|
140
140
|
$error: r
|
|
141
|
-
}), n,
|
|
141
|
+
}), n, $, n, $) : (0, k.css)([ "background-image:linear-gradient( to right,", ",", " ", "%,", " ", "%,", " );" ], O({
|
|
142
142
|
$error: r
|
|
143
|
-
}),
|
|
143
|
+
}), O({
|
|
144
144
|
$error: r
|
|
145
|
-
}), n,
|
|
145
|
+
}), n, $, n, $);
|
|
146
146
|
/* stylelint-enable indentation */ };
|
|
147
147
|
var P = x().div.withConfig({
|
|
148
148
|
displayName: "SliderStyles__StyledSliderBar",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
return t ? (0, k.css)([ "background-color:", ";" ], (0, h.pick)({
|
|
160
160
|
enterprise: h.variables.gray92,
|
|
161
161
|
prisma: h.variables.contentColorDisabled
|
|
162
|
-
})) :
|
|
162
|
+
})) : _({
|
|
163
163
|
$error: r,
|
|
164
164
|
$position: n,
|
|
165
165
|
$stepMarksWidth: i
|
|
@@ -307,8 +307,8 @@
|
|
|
307
307
|
return function r() {
|
|
308
308
|
var n = Q(e), i;
|
|
309
309
|
if (t) {
|
|
310
|
-
var
|
|
311
|
-
i = Reflect.construct(n, arguments,
|
|
310
|
+
var a = Q(this).constructor;
|
|
311
|
+
i = Reflect.construct(n, arguments, a);
|
|
312
312
|
} else {
|
|
313
313
|
i = n.apply(this, arguments);
|
|
314
314
|
}
|
|
@@ -358,27 +358,27 @@
|
|
|
358
358
|
return e;
|
|
359
359
|
}
|
|
360
360
|
var Z = {
|
|
361
|
-
defaultValue:
|
|
362
|
-
describedBy:
|
|
363
|
-
disabled:
|
|
364
|
-
displayValue:
|
|
365
|
-
elementRef:
|
|
366
|
-
error:
|
|
367
|
-
inline:
|
|
368
|
-
labelledBy:
|
|
369
|
-
max:
|
|
370
|
-
maxLabel:
|
|
371
|
-
min:
|
|
372
|
-
minLabel:
|
|
373
|
-
name:
|
|
374
|
-
onChange:
|
|
361
|
+
defaultValue: a().number,
|
|
362
|
+
describedBy: a().string,
|
|
363
|
+
disabled: a().bool,
|
|
364
|
+
displayValue: a().string,
|
|
365
|
+
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
366
|
+
error: a().bool,
|
|
367
|
+
inline: a().bool,
|
|
368
|
+
labelledBy: a().string,
|
|
369
|
+
max: a().number,
|
|
370
|
+
maxLabel: a().node,
|
|
371
|
+
min: a().number,
|
|
372
|
+
minLabel: a().node,
|
|
373
|
+
name: a().string,
|
|
374
|
+
onChange: a().func,
|
|
375
375
|
/** @private. */
|
|
376
|
-
required:
|
|
377
|
-
step:
|
|
378
|
-
stepMarks:
|
|
376
|
+
required: a().bool,
|
|
377
|
+
step: a().number,
|
|
378
|
+
stepMarks: a().oneOf([ "focus", "always", "never" ]),
|
|
379
379
|
/** @private */
|
|
380
|
-
splunkTheme:
|
|
381
|
-
value:
|
|
380
|
+
splunkTheme: a().object,
|
|
381
|
+
value: a().number
|
|
382
382
|
};
|
|
383
383
|
var ee = {
|
|
384
384
|
disabled: false,
|
|
@@ -438,20 +438,27 @@
|
|
|
438
438
|
showTooltip: true
|
|
439
439
|
});
|
|
440
440
|
}));
|
|
441
|
+
Y(G(n), "getValueOffset", (function(e, t) {
|
|
442
|
+
var r = n.props, i = r.min, a = r.step;
|
|
443
|
+
var o = new (s())(e).minus(i).modulo(a).toNumber();
|
|
444
|
+
if (o > 0) {
|
|
445
|
+
return t === "forward" ? a - o : o;
|
|
446
|
+
}
|
|
447
|
+
return a;
|
|
448
|
+
}));
|
|
441
449
|
Y(G(n), "handleKeyDown", (function(e) {
|
|
442
450
|
var t = n.getValue();
|
|
443
451
|
if (t !== undefined) {
|
|
444
|
-
var r = n.props.step;
|
|
445
452
|
if ((0, v.keycode)(e.nativeEvent) === "right") {
|
|
446
|
-
t = n.checkValueBounds(t +
|
|
453
|
+
t = n.checkValueBounds(t + n.getValueOffset(t, "forward"));
|
|
447
454
|
} else if ((0, v.keycode)(e.nativeEvent) === "left") {
|
|
448
|
-
t = n.checkValueBounds(t -
|
|
455
|
+
t = n.checkValueBounds(t - n.getValueOffset(t, "backward"));
|
|
449
456
|
} else if ((0, v.keycode)(e.nativeEvent) === "up") {
|
|
450
457
|
e.preventDefault();
|
|
451
|
-
t = n.checkValueBounds(t +
|
|
458
|
+
t = n.checkValueBounds(t + n.getValueOffset(t, "forward"));
|
|
452
459
|
} else if ((0, v.keycode)(e.nativeEvent) === "down") {
|
|
453
460
|
e.preventDefault();
|
|
454
|
-
t = n.checkValueBounds(t -
|
|
461
|
+
t = n.checkValueBounds(t - n.getValueOffset(t, "backward"));
|
|
455
462
|
} else {
|
|
456
463
|
return;
|
|
457
464
|
}
|
|
@@ -516,8 +523,12 @@
|
|
|
516
523
|
return e / 100 * t + n.props.min;
|
|
517
524
|
}));
|
|
518
525
|
Y(G(n), "roundValueToStep", (function(e) {
|
|
519
|
-
var t = n.props.step;
|
|
520
|
-
|
|
526
|
+
var t = n.props, r = t.step, i = t.min, a = t.max;
|
|
527
|
+
// Handles if the max is in between steps but val is larger than the halfway point between last step mark and max
|
|
528
|
+
if (e > a - (a - i) % r / 2) {
|
|
529
|
+
return a;
|
|
530
|
+
}
|
|
531
|
+
return new (s())(e).minus(i).div(r).todp(0).mul(r).add(i).toNumber();
|
|
521
532
|
}));
|
|
522
533
|
Y(G(n), "valueToPosition", (function(e) {
|
|
523
534
|
if (e === undefined) {
|
|
@@ -555,12 +566,12 @@
|
|
|
555
566
|
value: function e(t, r) {
|
|
556
567
|
var n = r.value;
|
|
557
568
|
var i = this.getValue();
|
|
558
|
-
var
|
|
569
|
+
var a = this.props.name;
|
|
559
570
|
if (i !== n) {
|
|
560
|
-
var
|
|
561
|
-
(
|
|
571
|
+
var o, s;
|
|
572
|
+
(o = (s = this.props).onChange) === null || o === void 0 ? void 0 : o.call(s, t, {
|
|
562
573
|
value: n,
|
|
563
|
-
name:
|
|
574
|
+
name: a
|
|
564
575
|
});
|
|
565
576
|
if (!this.isControlled()) {
|
|
566
577
|
this.setState({
|
|
@@ -588,14 +599,14 @@
|
|
|
588
599
|
value: function e() {
|
|
589
600
|
// don't render stepMarks if they are too small i.e. stepWidth is less than SliderThumb divided by 2
|
|
590
601
|
// in that case, undefined is returned
|
|
591
|
-
var t = this.props, r = t.max, n = t.min, i = t.step,
|
|
592
|
-
var
|
|
593
|
-
if (
|
|
602
|
+
var t = this.props, r = t.max, n = t.min, i = t.step, a = t.splunkTheme;
|
|
603
|
+
var o = this.state.sliderBar;
|
|
604
|
+
if (o === null) {
|
|
594
605
|
return undefined;
|
|
595
606
|
}
|
|
596
607
|
var s = Math.round((r - n) / i);
|
|
597
|
-
var l =
|
|
598
|
-
var u = j(
|
|
608
|
+
var l = o.getBoundingClientRect();
|
|
609
|
+
var u = j(a);
|
|
599
610
|
return l.width / s > u / 2 ? this.stepWidthInPercentage() : undefined;
|
|
600
611
|
}
|
|
601
612
|
}, {
|
|
@@ -607,21 +618,21 @@
|
|
|
607
618
|
key: "render",
|
|
608
619
|
value: function e() {
|
|
609
620
|
var t = this;
|
|
610
|
-
var i = this.props,
|
|
621
|
+
var i = this.props, a = i.describedBy, o = i.disabled, s = i.displayValue, l = i.elementRef, u = i.error, c = i.inline, d = i.labelledBy, v = i.max, h = i.maxLabel, m = i.min, y = i.minLabel, k = i.required, x = i.stepMarks;
|
|
611
622
|
var w = this.state, S = w.isFocused, T = w.selected, C = w.sliderBar;
|
|
612
|
-
var
|
|
613
|
-
var
|
|
614
|
-
var
|
|
615
|
-
var
|
|
616
|
-
var
|
|
623
|
+
var E = this.getValue();
|
|
624
|
+
var O = this.valueToPosition(E);
|
|
625
|
+
var B = x === "focus" && S || x === "always";
|
|
626
|
+
var $ = B && C ? this.stepMarksWidth() : undefined;
|
|
627
|
+
var _ = f()(this.props, p()(r.propTypes));
|
|
617
628
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
618
629
|
return n().createElement(M, L({
|
|
619
630
|
"data-test": "slider",
|
|
620
|
-
"data-test-value":
|
|
631
|
+
"data-test-value": E,
|
|
621
632
|
elementRef: l,
|
|
622
633
|
flex: true,
|
|
623
634
|
inline: c
|
|
624
|
-
},
|
|
635
|
+
}, _), T && n().createElement(n().Fragment, null, n().createElement(b(), {
|
|
625
636
|
target: window,
|
|
626
637
|
eventType: "mouseup",
|
|
627
638
|
listener: this.handleMouseUp
|
|
@@ -631,46 +642,46 @@
|
|
|
631
642
|
listener: this.handleMouseMove
|
|
632
643
|
})), y !== null && n().createElement(R, {
|
|
633
644
|
"data-test": "min-label",
|
|
634
|
-
$disabled:
|
|
635
|
-
}, y || m), n().createElement(
|
|
636
|
-
onClick:
|
|
645
|
+
$disabled: o
|
|
646
|
+
}, y || m), n().createElement(V, {
|
|
647
|
+
onClick: o ? undefined : this.handleClick
|
|
637
648
|
}, n().createElement(P, {
|
|
638
649
|
"aria-required": k,
|
|
639
650
|
"data-test": "bar",
|
|
640
|
-
$disabled:
|
|
651
|
+
$disabled: o,
|
|
641
652
|
ref: this.handleMount,
|
|
642
653
|
$error: u,
|
|
643
|
-
$position:
|
|
644
|
-
$stepMarksWidth:
|
|
654
|
+
$position: O,
|
|
655
|
+
$stepMarksWidth: $
|
|
645
656
|
}), n().createElement(q, {
|
|
646
|
-
"aria-describedby":
|
|
657
|
+
"aria-describedby": a,
|
|
647
658
|
"aria-labelledby": d,
|
|
648
659
|
"aria-invalid": u,
|
|
649
660
|
"aria-valuemax": v,
|
|
650
661
|
"aria-valuemin": m,
|
|
651
|
-
"aria-valuenow":
|
|
662
|
+
"aria-valuenow": E,
|
|
652
663
|
"data-test": "handle",
|
|
653
664
|
onBlur: this.handleBlur,
|
|
654
665
|
onMouseEnter: this.handleMouseEnter,
|
|
655
666
|
onMouseLeave: this.handleMouseLeave,
|
|
656
|
-
onKeyDown:
|
|
657
|
-
onMouseDown:
|
|
667
|
+
onKeyDown: o ? undefined : this.handleKeyDown,
|
|
668
|
+
onMouseDown: o ? undefined : this.handleMouseDown,
|
|
658
669
|
onFocus: this.handleFocus,
|
|
659
670
|
ref: function e(r) {
|
|
660
671
|
t.sliderThumb = r;
|
|
661
672
|
},
|
|
662
673
|
role: "slider",
|
|
663
|
-
disabled:
|
|
674
|
+
disabled: o,
|
|
664
675
|
$error: u,
|
|
665
|
-
$position:
|
|
676
|
+
$position: O
|
|
666
677
|
}), n().createElement(g(), {
|
|
667
678
|
open: this.state.showTooltip,
|
|
668
679
|
anchor: this.sliderThumb,
|
|
669
680
|
appearance: "inverted",
|
|
670
681
|
align: "center"
|
|
671
|
-
}, n().createElement(D, null, s ||
|
|
682
|
+
}, n().createElement(D, null, s || E))), h !== null && n().createElement(F, {
|
|
672
683
|
"data-test": "max-label",
|
|
673
|
-
$disabled:
|
|
684
|
+
$disabled: o
|
|
674
685
|
}, h || v));
|
|
675
686
|
/* eslint-enable jsx-a11y/no-static-element-interactions */ }
|
|
676
687
|
} ]);
|