@splunk/react-ui 4.24.0 → 4.25.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/Button.js +8 -7
- package/ButtonSimple.js +40 -39
- package/CHANGELOG.md +11 -0
- package/Code.js +193 -100
- package/Color.js +18 -15
- package/JSONTree.js +1 -1
- package/Modal.js +55 -55
- package/RadioList.js +12 -11
- package/cypress/README.md +11 -0
- package/cypress/support/commands.ts +1 -0
- package/cypress/support/component.ts +0 -1
- package/cypress/tsconfig.cypress.json +14 -0
- package/package.json +12 -12
- package/types/src/Button/Button.d.ts +4 -2
- package/types/src/Button/docs/examples/Block.d.ts +2 -2
- package/types/src/Button/docs/examples/Dimmed.d.ts +2 -0
- package/types/src/Button/docs/examples/Disabled.d.ts +2 -2
- package/types/src/Button/docs/examples/Icons.d.ts +2 -2
- package/types/src/Button/docs/examples/Menus.d.ts +2 -2
- package/types/src/Button/docs/examples/To.d.ts +2 -2
- package/types/src/Button/docs/examples/Truncated.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Basic.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Block.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Dimmed.d.ts +2 -0
- package/types/src/Button/docs/examples/prisma/Disabled.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Menus.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/To.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Truncated.d.ts +2 -2
- package/types/src/ButtonSimple/ButtonSimple.d.ts +4 -2
- package/types/src/Color/Color.d.ts +5 -3
- package/types/src/JSONTree/JSONTree.d.ts +1 -1
- package/types/src/Modal/Header.d.ts +0 -2
- package/types/src/Modal/Modal.d.ts +1 -0
- package/types/src/Modal/ModalContext.d.ts +1 -0
- package/types/src/RadioList/RadioList.d.ts +27 -27
- package/types/src/RadioList/RadioListContext.d.ts +5 -4
- package/types/unit-test-setup-testing-library.d.ts +1 -0
- package/types/src/Modal/docs/examples/prisma/TypicalUsage.d.ts +0 -2
package/Color.js
CHANGED
|
@@ -668,6 +668,8 @@
|
|
|
668
668
|
palette: o().array,
|
|
669
669
|
prepend: o().bool,
|
|
670
670
|
/** @private */
|
|
671
|
+
required: o().bool,
|
|
672
|
+
/** @private */
|
|
671
673
|
splunkTheme: o().object,
|
|
672
674
|
value: o().string
|
|
673
675
|
};
|
|
@@ -957,17 +959,17 @@
|
|
|
957
959
|
key: "renderInput",
|
|
958
960
|
value: function e(t) {
|
|
959
961
|
var a = t.textAppend, o = t.textPrepend, l = t.textInline, i = t.inDropdown;
|
|
960
|
-
var s = this.props.splunkTheme;
|
|
961
|
-
var
|
|
962
|
-
var
|
|
963
|
-
var
|
|
964
|
-
var
|
|
965
|
-
var
|
|
966
|
-
if (!y()(
|
|
967
|
-
|
|
962
|
+
var s = this.props, u = s.splunkTheme, c = s.required;
|
|
963
|
+
var p = this.state.displayValue;
|
|
964
|
+
var d = u.isPrisma;
|
|
965
|
+
var f = r.hasTransparent(this.props.palette) && g()(p) === "transparent";
|
|
966
|
+
var v = g()(p) === Fe;
|
|
967
|
+
var h = p;
|
|
968
|
+
if (!y()(p, "#")) {
|
|
969
|
+
h = "#".concat(p);
|
|
968
970
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
+
h = f ? "transparent" : h;
|
|
972
|
+
h = v ? null : h;
|
|
971
973
|
|
|
972
974
|
return n().createElement(Y, {
|
|
973
975
|
$inDropdown: i
|
|
@@ -977,17 +979,18 @@
|
|
|
977
979
|
autoCapitalize: "off",
|
|
978
980
|
autoComplete: "off",
|
|
979
981
|
autoCorrect: "off",
|
|
980
|
-
spellCheck: false,
|
|
981
982
|
"aria-label": (0, _._)("Hexadecimal color value"),
|
|
982
|
-
prepend: o,
|
|
983
983
|
inline: l,
|
|
984
|
+
prepend: o,
|
|
984
985
|
onKeyDown: this.handleTextKeyDown,
|
|
985
986
|
onChange: this.handleTextChange,
|
|
986
|
-
|
|
987
|
-
|
|
987
|
+
required: c,
|
|
988
|
+
spellCheck: false,
|
|
989
|
+
value: p
|
|
990
|
+
}), !d && n().createElement(J, {
|
|
988
991
|
"data-test": "textbox-swatch",
|
|
989
992
|
onClick: this.handleButtonClick,
|
|
990
|
-
value:
|
|
993
|
+
value: h,
|
|
991
994
|
tabIndex: -1,
|
|
992
995
|
style: {
|
|
993
996
|
marginLeft: "1px"
|
package/JSONTree.js
CHANGED
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
var t = this;
|
|
420
420
|
var o = r.withTooltip;
|
|
421
421
|
var a = this.state.open ? "[-]" : "[+]";
|
|
422
|
-
var i = this.state.open ? (0, K._)("
|
|
422
|
+
var i = this.state.open ? (0, K._)("Collapse all") : (0, K._)("Shift click to expand all");
|
|
423
423
|
var l = n().createElement(D, {
|
|
424
424
|
onClick: function e(r) {
|
|
425
425
|
t.handleExpandClick(r);
|
package/Modal.js
CHANGED
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
var d = e.n(f);
|
|
87
87
|
// CONCATENATED MODULE: external "@splunk/react-ui/ModalLayer"
|
|
88
88
|
const y = require("@splunk/react-ui/ModalLayer");
|
|
89
|
-
var
|
|
89
|
+
var b = e.n(y);
|
|
90
90
|
// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
|
|
91
|
-
const
|
|
91
|
+
const m = require("@splunk/ui-utils/focus");
|
|
92
92
|
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
93
93
|
const v = require("@splunk/ui-utils/id");
|
|
94
94
|
// CONCATENATED MODULE: external "@splunk/react-ui/ScrollContainerContext"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
103
103
|
const w = require("@splunk/themes");
|
|
104
104
|
// CONCATENATED MODULE: ./src/Modal/BodyStyles.ts
|
|
105
|
-
var
|
|
105
|
+
var j = x()(S()).withConfig({
|
|
106
106
|
displayName: "BodyStyles__StyledBox",
|
|
107
107
|
componentId: "lv54z7-0"
|
|
108
108
|
})([ "background-color:", ";", " flex:0 1 auto;overflow:auto;@media all and (-ms-high-contrast:none){*::-ms-backdrop,&{max-height:calc(100vh - 180px);}}" ], (0,
|
|
@@ -120,8 +120,8 @@
|
|
|
120
120
|
}
|
|
121
121
|
}));
|
|
122
122
|
// CONCATENATED MODULE: ./src/Modal/Body.tsx
|
|
123
|
-
function
|
|
124
|
-
|
|
123
|
+
function k() {
|
|
124
|
+
k = Object.assign || function(e) {
|
|
125
125
|
for (var t = 1; t < arguments.length; t++) {
|
|
126
126
|
var r = arguments[t];
|
|
127
127
|
for (var n in r) {
|
|
@@ -132,12 +132,12 @@
|
|
|
132
132
|
}
|
|
133
133
|
return e;
|
|
134
134
|
};
|
|
135
|
-
return
|
|
135
|
+
return k.apply(this, arguments);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return M(e) || E(e, t) || P(e, t) ||
|
|
137
|
+
function I(e, t) {
|
|
138
|
+
return M(e) || E(e, t) || P(e, t) || C();
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function C() {
|
|
141
141
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
142
142
|
}
|
|
143
143
|
function P(e, t) {
|
|
@@ -208,20 +208,20 @@
|
|
|
208
208
|
}
|
|
209
209
|
return r;
|
|
210
210
|
}
|
|
211
|
-
var
|
|
211
|
+
var D = {
|
|
212
212
|
children: i().node
|
|
213
213
|
};
|
|
214
214
|
/**
|
|
215
215
|
* A styled container for `Modal` body content.
|
|
216
|
-
*/ function
|
|
216
|
+
*/ function F(e) {
|
|
217
217
|
var t = e.children, o = T(e, [ "children" ]);
|
|
218
218
|
// @docs-props-type BodyPropsBase
|
|
219
|
-
var i = (0, r.useState)(), a =
|
|
219
|
+
var i = (0, r.useState)(), a = I(i, 2), l = a[0], c = a[1];
|
|
220
220
|
var s = (0, r.useCallback)((function(e) {
|
|
221
221
|
c(e);
|
|
222
222
|
}), []);
|
|
223
223
|
|
|
224
|
-
return n().createElement(
|
|
224
|
+
return n().createElement(j, k({
|
|
225
225
|
"data-test": "body"
|
|
226
226
|
}, o, {
|
|
227
227
|
elementRef: s
|
|
@@ -229,8 +229,8 @@
|
|
|
229
229
|
value: l
|
|
230
230
|
}, t));
|
|
231
231
|
}
|
|
232
|
-
|
|
233
|
-
/* harmony default export */ const R =
|
|
232
|
+
F.propTypes = D;
|
|
233
|
+
/* harmony default export */ const R = F;
|
|
234
234
|
// CONCATENATED MODULE: external "@splunk/react-ui/Divider"
|
|
235
235
|
const A = require("@splunk/react-ui/Divider");
|
|
236
236
|
var B = e.n(A);
|
|
@@ -353,10 +353,8 @@
|
|
|
353
353
|
var Y = x().div.withConfig({
|
|
354
354
|
displayName: "HeaderStyles__StyledIcon",
|
|
355
355
|
componentId: "sc-1y722ut-2"
|
|
356
|
-
})([ "", ";align-items:center;justify-content:center;margin-right:", ";", "
|
|
356
|
+
})([ "", ";align-items:center;justify-content:center;margin-right:", ";background-color:", ";width:", ";height:", ";flex-shrink:0;" ], w.mixins.reset("inline-flex"), w.variables.spacingLarge, w.variables.transparent, (0,
|
|
357
357
|
w.pick)({
|
|
358
|
-
prisma: (0, g.css)([ "background-color:", ";" ], w.variables.transparent)
|
|
359
|
-
}), (0, w.pick)({
|
|
360
358
|
comfortable: "40px",
|
|
361
359
|
compact: "32px"
|
|
362
360
|
}), (0, w.pick)({
|
|
@@ -366,19 +364,15 @@
|
|
|
366
364
|
var Z = x().div.withConfig({
|
|
367
365
|
displayName: "HeaderStyles__StyledTitle",
|
|
368
366
|
componentId: "sc-1y722ut-3"
|
|
369
|
-
})([ "", ";font-size:20px;margin:0;overflow-wrap:break-word;font-weight:", ";", "" ], w.mixins.reset("block"), w.variables.fontWeightSemiBold, (0,
|
|
367
|
+
})([ "", ";font-size:20px;margin:0;overflow-wrap:break-word;font-weight:", ";color:", ";", "" ], w.mixins.reset("block"), w.variables.fontWeightSemiBold, w.variables.contentColorActive, (0,
|
|
370
368
|
w.pick)({
|
|
371
369
|
enterprise: (0, g.css)([ "line-height:22px;" ]),
|
|
372
|
-
prisma: (0, g.css)([ "
|
|
370
|
+
prisma: (0, g.css)([ "line-height:24px;" ])
|
|
373
371
|
}));
|
|
374
372
|
var ee = x().div.withConfig({
|
|
375
373
|
displayName: "HeaderStyles__StyledSubtitle",
|
|
376
374
|
componentId: "sc-1y722ut-4"
|
|
377
|
-
})([ "", ";font-size:14px;overflow-wrap:break-word;line-height:", ";" ], w.mixins.reset("block"),
|
|
378
|
-
w.pick)({
|
|
379
|
-
enterprise: w.variables.lineHeight,
|
|
380
|
-
prisma: "20px"
|
|
381
|
-
}));
|
|
375
|
+
})([ "", ";font-size:14px;overflow-wrap:break-word;line-height:", ";" ], w.mixins.reset("block"), w.variables.lineHeight);
|
|
382
376
|
var te = x().div.withConfig({
|
|
383
377
|
displayName: "HeaderStyles__StyledButtonsWrapper",
|
|
384
378
|
componentId: "sc-1y722ut-5"
|
|
@@ -459,8 +453,8 @@
|
|
|
459
453
|
*/ function le(e) {
|
|
460
454
|
var t = e.children, o = e.icon, i = e.onRequestClose, a = e.subtitle, l = e.title, c = oe(e, [ "children", "icon", "onRequestClose", "subtitle", "title" ]);
|
|
461
455
|
// @docs-props-type StepPropsBase
|
|
462
|
-
var s = (0, r.useContext)(z), u = s.titleId, p = s.divider;
|
|
463
|
-
var
|
|
456
|
+
var s = (0, r.useContext)(z), u = s.titleId, p = s.subtitleId, f = s.divider;
|
|
457
|
+
var d = f === "both" || f === "header";
|
|
464
458
|
|
|
465
459
|
return n().createElement(n().Fragment, null, n().createElement(J, ne({
|
|
466
460
|
$close: !!i,
|
|
@@ -469,11 +463,12 @@
|
|
|
469
463
|
id: u,
|
|
470
464
|
"data-test": "title"
|
|
471
465
|
}, l), a && n().createElement(ee, {
|
|
466
|
+
id: p,
|
|
472
467
|
"data-test": "subtitle"
|
|
473
468
|
}, a)) : t, i && n().createElement(te, null, i && n().createElement(re, null, n().createElement(G(), {
|
|
474
469
|
onClick: i,
|
|
475
470
|
"data-test": "close"
|
|
476
|
-
})))),
|
|
471
|
+
})))), d && n().createElement(B(), {
|
|
477
472
|
"aria-hidden": true
|
|
478
473
|
}));
|
|
479
474
|
}
|
|
@@ -525,12 +520,12 @@
|
|
|
525
520
|
return fe.apply(this, arguments);
|
|
526
521
|
}
|
|
527
522
|
function de(e) {
|
|
528
|
-
return ve(e) ||
|
|
523
|
+
return ve(e) || me(e) || be(e) || ye();
|
|
529
524
|
}
|
|
530
525
|
function ye() {
|
|
531
526
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
532
527
|
}
|
|
533
|
-
function
|
|
528
|
+
function be(e, t) {
|
|
534
529
|
if (!e) return;
|
|
535
530
|
if (typeof e === "string") return he(e, t);
|
|
536
531
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
@@ -538,7 +533,7 @@
|
|
|
538
533
|
if (r === "Map" || r === "Set") return Array.from(e);
|
|
539
534
|
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return he(e, t);
|
|
540
535
|
}
|
|
541
|
-
function
|
|
536
|
+
function me(e) {
|
|
542
537
|
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
|
|
543
538
|
}
|
|
544
539
|
function ve(e) {
|
|
@@ -606,12 +601,12 @@
|
|
|
606
601
|
Object.defineProperty(e, n.key, n);
|
|
607
602
|
}
|
|
608
603
|
}
|
|
609
|
-
function
|
|
604
|
+
function je(e, t, r) {
|
|
610
605
|
if (t) we(e.prototype, t);
|
|
611
606
|
if (r) we(e, r);
|
|
612
607
|
return e;
|
|
613
608
|
}
|
|
614
|
-
function
|
|
609
|
+
function ke(e, t) {
|
|
615
610
|
if (typeof t !== "function" && t !== null) {
|
|
616
611
|
throw new TypeError("Super expression must either be null or a function");
|
|
617
612
|
}
|
|
@@ -622,16 +617,16 @@
|
|
|
622
617
|
configurable: true
|
|
623
618
|
}
|
|
624
619
|
});
|
|
625
|
-
if (t)
|
|
620
|
+
if (t) Ie(e, t);
|
|
626
621
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
622
|
+
function Ie(e, t) {
|
|
623
|
+
Ie = Object.setPrototypeOf || function e(t, r) {
|
|
629
624
|
t.__proto__ = r;
|
|
630
625
|
return t;
|
|
631
626
|
};
|
|
632
|
-
return
|
|
627
|
+
return Ie(e, t);
|
|
633
628
|
}
|
|
634
|
-
function
|
|
629
|
+
function Ce(e) {
|
|
635
630
|
var t = Ee();
|
|
636
631
|
return function r() {
|
|
637
632
|
var n = Me(e), o;
|
|
@@ -694,14 +689,14 @@
|
|
|
694
689
|
onRequestClose: i().func,
|
|
695
690
|
open: i().bool
|
|
696
691
|
};
|
|
697
|
-
var
|
|
692
|
+
var De = {
|
|
698
693
|
divider: "both",
|
|
699
694
|
initialFocus: "first",
|
|
700
695
|
open: false
|
|
701
696
|
};
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
var t =
|
|
697
|
+
var Fe = function(e) {
|
|
698
|
+
ke(o, e);
|
|
699
|
+
var t = Ce(o);
|
|
705
700
|
// @docs-props-type ModalPropsBase
|
|
706
701
|
// this timeout ensures that the Modal is finished rendering before setting the focus
|
|
707
702
|
function o(e) {
|
|
@@ -712,6 +707,7 @@
|
|
|
712
707
|
Te(_e(i), "initialFocusTimeoutId", undefined);
|
|
713
708
|
Te(_e(i), "initialFocus", null);
|
|
714
709
|
Te(_e(i), "headerTitleId", void 0);
|
|
710
|
+
Te(_e(i), "headerSubtitleId", void 0);
|
|
715
711
|
Te(_e(i), "getDefaultMotionStyle", (function() {
|
|
716
712
|
return {
|
|
717
713
|
top: 0
|
|
@@ -740,7 +736,7 @@
|
|
|
740
736
|
if (i.el) {
|
|
741
737
|
/* eslint-disable prefer-destructuring */
|
|
742
738
|
/* prefer-desturucting leads to harder-to-read syntax in this case */
|
|
743
|
-
e = (0,
|
|
739
|
+
e = (0, m.getSortedTabbableElements)(i.el)[0];
|
|
744
740
|
/* eslint-enable prefer-destructuring */ }
|
|
745
741
|
} else if (t === "container") {
|
|
746
742
|
e = i.el;
|
|
@@ -765,7 +761,7 @@
|
|
|
765
761
|
}));
|
|
766
762
|
Te(_e(i), "handleModalKeyDown", (function(e) {
|
|
767
763
|
if (i.el !== null) {
|
|
768
|
-
(0,
|
|
764
|
+
(0, m.handleTab)(i.el, e.nativeEvent);
|
|
769
765
|
}
|
|
770
766
|
}));
|
|
771
767
|
Te(_e(i), "handleRequestClose", (function(e) {
|
|
@@ -774,10 +770,11 @@
|
|
|
774
770
|
(t = (r = i.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(r, e);
|
|
775
771
|
}));
|
|
776
772
|
Te(_e(i), "getProviderValue", p()((function(e) {
|
|
777
|
-
var t = e.titleId, r = e.divider;
|
|
773
|
+
var t = e.titleId, r = e.subtitleId, n = e.divider;
|
|
778
774
|
return {
|
|
779
775
|
titleId: t,
|
|
780
|
-
|
|
776
|
+
subtitleId: r,
|
|
777
|
+
divider: n
|
|
781
778
|
};
|
|
782
779
|
})));
|
|
783
780
|
Te(_e(i), "getModalStyles", p()((function(e) {
|
|
@@ -803,18 +800,21 @@
|
|
|
803
800
|
tabIndex: -1,
|
|
804
801
|
onKeyDown: i.handleModalKeyDown,
|
|
805
802
|
role: "dialog",
|
|
806
|
-
"aria-labelledby": i.headerTitleId
|
|
803
|
+
"aria-labelledby": i.headerTitleId,
|
|
804
|
+
"aria-describedby": i.headerSubtitleId
|
|
807
805
|
}, d()(i.props, [].concat(de(s()(o.propTypes)), [ "style" ]))), n().createElement(z.Provider, {
|
|
808
806
|
value: i.getProviderValue({
|
|
809
807
|
titleId: i.headerTitleId,
|
|
808
|
+
subtitleId: i.headerSubtitleId,
|
|
810
809
|
divider: l
|
|
811
810
|
})
|
|
812
811
|
}, f));
|
|
813
812
|
}));
|
|
814
813
|
i.headerTitleId = (0, v.createDOMID)("titleId");
|
|
814
|
+
i.headerSubtitleId = (0, v.createDOMID)("subtitleId");
|
|
815
815
|
return i;
|
|
816
816
|
}
|
|
817
|
-
|
|
817
|
+
je(o, [ {
|
|
818
818
|
key: "componentDidMount",
|
|
819
819
|
value: function e() {
|
|
820
820
|
this.handleInitialFocus();
|
|
@@ -834,7 +834,7 @@
|
|
|
834
834
|
key: "render",
|
|
835
835
|
value: function e() {
|
|
836
836
|
|
|
837
|
-
return n().createElement(
|
|
837
|
+
return n().createElement(b(), {
|
|
838
838
|
open: this.props.open,
|
|
839
839
|
getDefaultMotionStyle: this.getDefaultMotionStyle,
|
|
840
840
|
renderModal: this.renderModal,
|
|
@@ -845,12 +845,12 @@
|
|
|
845
845
|
} ]);
|
|
846
846
|
return o;
|
|
847
847
|
}(r.Component);
|
|
848
|
-
Te(
|
|
849
|
-
Te(
|
|
850
|
-
Te(
|
|
851
|
-
Te(
|
|
852
|
-
Te(
|
|
853
|
-
/* harmony default export */ const Re =
|
|
848
|
+
Te(Fe, "propTypes", qe);
|
|
849
|
+
Te(Fe, "defaultProps", De);
|
|
850
|
+
Te(Fe, "Header", ce);
|
|
851
|
+
Te(Fe, "Body", R);
|
|
852
|
+
Te(Fe, "Footer", V);
|
|
853
|
+
/* harmony default export */ const Re = Fe;
|
|
854
854
|
// CONCATENATED MODULE: ./src/Modal/index.ts
|
|
855
855
|
module.exports = t;
|
|
856
856
|
/******/})();
|
package/RadioList.js
CHANGED
|
@@ -303,7 +303,8 @@
|
|
|
303
303
|
value: b.toString(),
|
|
304
304
|
checked: O,
|
|
305
305
|
onChange: C,
|
|
306
|
-
"data-test": "input"
|
|
306
|
+
"data-test": "input",
|
|
307
|
+
required: x.required
|
|
307
308
|
}), o().createElement(f, {
|
|
308
309
|
htmlFor: k,
|
|
309
310
|
"data-test": "label"
|
|
@@ -413,19 +414,19 @@
|
|
|
413
414
|
return a;
|
|
414
415
|
}
|
|
415
416
|
var N = {
|
|
416
|
-
direction: t().oneOf([ "row", "column" ]),
|
|
417
417
|
children: t().node,
|
|
418
418
|
defaultValue: t().any,
|
|
419
|
+
describedBy: t().string,
|
|
420
|
+
direction: t().oneOf([ "row", "column" ]),
|
|
419
421
|
disabled: t().bool,
|
|
420
422
|
elementRef: t().oneOfType([ t().func, t().object ]),
|
|
421
423
|
error: t().bool,
|
|
424
|
+
labelledBy: t().string,
|
|
422
425
|
name: t().string,
|
|
423
426
|
onChange: t().func,
|
|
424
427
|
/** @private. */
|
|
425
428
|
required: t().bool,
|
|
426
|
-
value: t().any
|
|
427
|
-
labelledBy: t().string,
|
|
428
|
-
describedBy: t().string
|
|
429
|
+
value: t().any
|
|
429
430
|
};
|
|
430
431
|
function R(e) {
|
|
431
432
|
var r = e.children, i = e.defaultValue, t = e.describedBy, n = e.direction, c = n === void 0 ? "column" : n, u = e.disabled, b = u === void 0 ? false : u, p = e.error, v = p === void 0 ? false : p, f = e.labelledBy, y = e.name, g = e.onChange, m = e.required, h = e.value, k = B(e, [ "children", "defaultValue", "describedBy", "direction", "disabled", "error", "labelledBy", "name", "onChange", "required", "value" ]);
|
|
@@ -459,11 +460,12 @@
|
|
|
459
460
|
|
|
460
461
|
return o().createElement(d.Provider, {
|
|
461
462
|
value: {
|
|
462
|
-
|
|
463
|
-
name: E,
|
|
464
|
-
onChange: D,
|
|
463
|
+
disabled: b,
|
|
465
464
|
error: v,
|
|
466
|
-
|
|
465
|
+
onChange: D,
|
|
466
|
+
name: E,
|
|
467
|
+
required: m,
|
|
468
|
+
value: _
|
|
467
469
|
}
|
|
468
470
|
}, o().createElement(S, j({
|
|
469
471
|
flex: true,
|
|
@@ -473,8 +475,7 @@
|
|
|
473
475
|
"data-test-value": _
|
|
474
476
|
}, l()(k, [ "aria-labelledby", "aria-describedby" ]), {
|
|
475
477
|
"aria-labelledby": M ? "".concat(M, " ").concat(f) : f,
|
|
476
|
-
"aria-describedby": T ? "".concat(T, " ").concat(t) : t
|
|
477
|
-
"aria-required": m
|
|
478
|
+
"aria-describedby": T ? "".concat(T, " ").concat(t) : t
|
|
478
479
|
}), r));
|
|
479
480
|
}
|
|
480
481
|
R.propTypes = N;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#TS Configuration
|
|
2
|
+
|
|
3
|
+
Cypress' expect type clashes with Jest's: see https://docs.cypress.io/guides/tooling/typescript-support#Clashing-types-with-Jest.
|
|
4
|
+
To get around this we use separate tsconfigs to check src files from Cypress tests (.spec.tsx) files, following [cypress' example](https://github.com/cypress-io/cypress-and-jest-typescript-example)
|
|
5
|
+
|
|
6
|
+
There are some notable specifics in the cypress config that need to be maintained:
|
|
7
|
+
* Cypress tests only need to be compiled but do not have public types, so this config sets `"noEmit": true,`
|
|
8
|
+
* When types are specified they must be relative paths to the tsconfig, hence the `../node_modules`.
|
|
9
|
+
* The inheritance method when using `extends` means that `include` and `exclude` entries need to be explicitly listed or repeated. This affects:
|
|
10
|
+
* Common types, jest and cypress types.
|
|
11
|
+
* `include` must be repeated in `cypress.tsconfig` so that `.spec` files are not excluded
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Cypress tests (.spec.tsx files) need a separate config to avoid clashing types with jest, see README for more details
|
|
2
|
+
{
|
|
3
|
+
"extends": "../tsconfig.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
"types": [
|
|
7
|
+
"../../../node_modules/@testing-library/cypress",
|
|
8
|
+
"../../../node_modules/cypress",
|
|
9
|
+
"../../../node_modules/cypress-real-events"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"include": ["../stubs-*.d.ts", "../src/**/tests/*.spec.tsx", "../src/**/tests/*.spec.ts"],
|
|
13
|
+
"exclude": ["../src/docs/*"]
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/react-ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.25.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.",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"test:watch": "jest --watch",
|
|
30
30
|
"test:cypress": "yarn cypress open --component",
|
|
31
31
|
"test:cypress:ci": "yarn cypress run --component",
|
|
32
|
-
"types:build": "tsc --emitDeclarationOnly --declaration --declarationDir ./types && node ./scripts/pruneTypes.js",
|
|
32
|
+
"types:build": "yarn types:build:cypress && tsc --emitDeclarationOnly --declaration --declarationDir ./types && node ./scripts/pruneTypes.js",
|
|
33
|
+
"types:build:cypress": "tsc --p cypress/tsconfig.cypress.json",
|
|
33
34
|
"types:start": "yarn types:build --watch"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
@@ -44,13 +45,6 @@
|
|
|
44
45
|
"@splunk/react-icons": "^4.2.0",
|
|
45
46
|
"@splunk/themes": "^0.16.4",
|
|
46
47
|
"@splunk/ui-utils": "^1.6.0",
|
|
47
|
-
"@types/commonmark": "^0.27.6",
|
|
48
|
-
"@types/lodash": "^4.14.156",
|
|
49
|
-
"@types/react": "^16.9.38",
|
|
50
|
-
"@types/react-dom": "^16.9.8",
|
|
51
|
-
"@types/react-resize-detector": "^3.1.1",
|
|
52
|
-
"@types/styled-components": "^5.1.0",
|
|
53
|
-
"@types/tinycolor2": "^1.4.2",
|
|
54
48
|
"commonmark": "^0.30.0",
|
|
55
49
|
"commonmark-react-renderer": "^4.3.2",
|
|
56
50
|
"decimal.js-light": "^2.2.3",
|
|
@@ -86,11 +80,17 @@
|
|
|
86
80
|
"@testing-library/react": "^12.1.2",
|
|
87
81
|
"@testing-library/react-hooks": "^7.0.2",
|
|
88
82
|
"@testing-library/user-event": "^14.4.3",
|
|
83
|
+
"@types/commonmark": "^0.27.6",
|
|
89
84
|
"@types/jest": "^26.0.0",
|
|
90
|
-
"@types/
|
|
85
|
+
"@types/lodash": "^4.14.156",
|
|
91
86
|
"@types/node": "^10.17.26",
|
|
92
|
-
"@types/prismjs": "^1.
|
|
87
|
+
"@types/prismjs": "^1.26.3",
|
|
88
|
+
"@types/react": "^16.9.38",
|
|
89
|
+
"@types/react-dom": "^16.9.8",
|
|
90
|
+
"@types/react-resize-detector": "^3.1.1",
|
|
93
91
|
"@types/sinon": "^4.3.3",
|
|
92
|
+
"@types/styled-components": "^5.1.0",
|
|
93
|
+
"@types/tinycolor2": "^1.4.2",
|
|
94
94
|
"@types/webdriverio": "^5.0.0",
|
|
95
95
|
"@types/webpack-env": "^1.15.2",
|
|
96
96
|
"@typescript-eslint/eslint-plugin": "^4.8.2",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"jest-stare": "^2.4.1",
|
|
127
127
|
"mkdirp": "^0.5.1",
|
|
128
128
|
"playwright": "^1.23.3",
|
|
129
|
-
"prismjs": "^1.
|
|
129
|
+
"prismjs": "^1.29.0",
|
|
130
130
|
"prompt": "^1.0.0",
|
|
131
131
|
"raw-loader": "^4.0.2",
|
|
132
132
|
"react": "^16.12.0",
|
|
@@ -21,8 +21,10 @@ interface ButtonPropsBase {
|
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
/** @private An additional className to add to the button. */
|
|
23
23
|
classNamePrivate?: string;
|
|
24
|
-
/** Prevents user from clicking the button.
|
|
25
|
-
|
|
24
|
+
/** Prevents user from clicking the button. If set to `dimmed`, the button
|
|
25
|
+
* does not respond to mouse events but can still receive focus, and
|
|
26
|
+
* `aria-disabled` is set to `true`. */
|
|
27
|
+
disabled?: boolean | 'dimmed';
|
|
26
28
|
/**
|
|
27
29
|
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
28
30
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Block(): JSX.Element;
|
|
2
|
+
export default Block;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Disabled(): JSX.Element;
|
|
2
|
+
export default Disabled;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Icons(): JSX.Element;
|
|
2
|
+
export default Icons;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Menus(): JSX.Element;
|
|
2
|
+
export default Menus;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function To(): JSX.Element;
|
|
2
|
+
export default To;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Truncated(): JSX.Element;
|
|
2
|
+
export default Truncated;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Basic(): JSX.Element;
|
|
2
|
+
export default Basic;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Block(): JSX.Element;
|
|
2
|
+
export default Block;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Disabled(): JSX.Element;
|
|
2
|
+
export default Disabled;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Menus(): JSX.Element;
|
|
2
|
+
export default Menus;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function To(): JSX.Element;
|
|
2
|
+
export default To;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
export default
|
|
1
|
+
declare function Truncated(): JSX.Element;
|
|
2
|
+
export default Truncated;
|
|
@@ -14,8 +14,10 @@ interface ButtonSimplePropsBase {
|
|
|
14
14
|
* append things to it. */
|
|
15
15
|
append?: boolean;
|
|
16
16
|
children?: React.ReactNode;
|
|
17
|
-
/** Add a disabled attribute and prevent clicking.
|
|
18
|
-
|
|
17
|
+
/** Add a disabled attribute and prevent clicking. If set to `dimmed`,
|
|
18
|
+
* the button does not respond to mouse events but can still receive
|
|
19
|
+
* focus, and `aria-disabled` is set to `true`. */
|
|
20
|
+
disabled?: boolean | 'dimmed';
|
|
19
21
|
/**
|
|
20
22
|
* Adds error styling to the button and applies `aria-invalid`.
|
|
21
23
|
*/
|