@splunk/react-ui 4.40.0 → 4.42.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/ButtonGroup.js +1 -3
- package/CHANGELOG.md +43 -0
- package/Calendar.js +548 -744
- package/Date.js +158 -161
- package/Dropdown.js +33 -32
- package/FormRows.js +93 -97
- package/Layer.js +115 -97
- package/MIGRATION.mdx +24 -3
- package/Menu.js +10 -9
- package/MessageBar.js +5 -5
- package/Multiselect.js +1498 -1599
- package/Number.js +51 -48
- package/Popover.js +481 -479
- package/RadioBar.js +19 -15
- package/Resize.js +61 -61
- package/ResultsMenu.js +1208 -1028
- package/Scroll.js +482 -475
- package/Select.js +949 -1030
- package/Slider.js +346 -300
- package/SlidingPanels.js +166 -148
- package/TabBar.js +187 -172
- package/TabLayout.js +8 -8
- package/Table.js +1518 -1432
- package/Text.js +29 -17
- package/TextArea.js +37 -37
- package/Tooltip.js +300 -207
- package/TransitionOpen.js +44 -65
- package/package.json +4 -4
- package/types/src/ButtonGroup/ButtonGroup.d.ts +0 -4
- package/types/src/ButtonSimple/ButtonSimple.d.ts +1 -1
- package/types/src/Calendar/Calendar.d.ts +28 -30
- package/types/src/Calendar/MonthHeader.d.ts +12 -22
- package/types/src/Color/Color.d.ts +2 -2
- package/types/src/Date/Date.d.ts +18 -19
- package/types/src/Dropdown/Dropdown.d.ts +2 -1
- package/types/src/File/File.d.ts +1 -1
- package/types/src/FormRows/FormRows.d.ts +5 -60
- package/types/src/FormRows/Row.d.ts +1 -1
- package/types/src/Layer/Layer.d.ts +2 -1
- package/types/src/Link/Link.d.ts +5 -0
- package/types/src/Link/index.d.ts +1 -0
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -1
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Number/Number.d.ts +10 -2
- package/types/src/Popover/Popover.d.ts +1 -4
- package/types/src/RadioBar/RadioBar.d.ts +2 -2
- package/types/src/Resize/Resize.d.ts +0 -11
- package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +1 -1
- package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +2 -0
- package/types/src/Scroll/Inner.d.ts +17 -19
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +5 -1
- package/types/src/Select/OptionBase.d.ts +41 -23
- package/types/src/Select/SelectAllOption.d.ts +6 -2
- package/types/src/Select/SelectBase.d.ts +8 -34
- package/types/src/Slider/Slider.d.ts +7 -16
- package/types/src/SlidingPanels/SlidingPanels.d.ts +4 -3
- package/types/src/TabBar/TabBar.d.ts +10 -2
- package/types/src/TabBar/TabBarContext.d.ts +1 -0
- package/types/src/TabBar/docs/examples/IconsAbove.d.ts +2 -0
- package/types/src/TabBar/docs/examples/IconsLeft.d.ts +2 -0
- package/types/src/TabBar/docs/examples/VerticalIconsAbove.d.ts +2 -0
- package/types/src/TabBar/docs/examples/VerticalIconsLeft.d.ts +2 -0
- package/types/src/TabLayout/TabLayout.d.ts +4 -2
- package/types/src/Table/ExpandButton.d.ts +8 -0
- package/types/src/Table/HeadDropdownCell.d.ts +2 -0
- package/types/src/Table/HeadInner.d.ts +5 -1
- package/types/src/Table/Row.d.ts +8 -4
- package/types/src/Table/Table.d.ts +0 -2
- package/types/src/Table/docs/examples/Complex.d.ts +14 -3
- package/types/src/Text/Text.d.ts +2 -2
- package/types/src/TextArea/TextArea.d.ts +2 -2
- package/types/src/Tooltip/Tooltip.d.ts +38 -5
- package/types/src/Tooltip/docs/examples/CustomProps.d.ts +2 -0
- package/types/src/Tooltip/docs/examples/Toggletip.d.ts +2 -0
- package/types/src/Typography/Typography.d.ts +4 -2
- package/types/src/useControlled/useControlled.d.ts +5 -4
- package/useControlled.js +37 -15
- package/usePrevious.js +62 -30
- package/useRovingFocus.js +5 -4
- package/types/src/TabBar/docs/examples/IconsInline.d.ts +0 -2
- package/types/src/TabBar/docs/examples/IconsSmall.d.ts +0 -2
- package/types/src/TabBar/docs/examples/VerticalSmallIcons.d.ts +0 -2
- package/types/src/Table/docs/examples/prisma/Complex.d.ts +0 -48
- package/types/src/Table/icons/ExpansionRow.d.ts +0 -6
- package/types/src/Tooltip/docs/examples/CustomContent.d.ts +0 -2
- /package/types/src/Table/docs/examples/{prisma/RowActions.d.ts → RowActions.d.ts} +0 -0
package/FormRows.js
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
// EXPORTS
|
|
63
63
|
e.d(t, {
|
|
64
64
|
Row: () => /* reexport */ Oe,
|
|
65
|
-
default: () => /* reexport */
|
|
65
|
+
default: () => /* reexport */ Ue
|
|
66
66
|
});
|
|
67
67
|
// CONCATENATED MODULE: external "react"
|
|
68
68
|
const r = require("react");
|
|
@@ -737,13 +737,90 @@
|
|
|
737
737
|
disabled: false,
|
|
738
738
|
header: null
|
|
739
739
|
};
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
740
|
+
/**
|
|
741
|
+
* Static function for adding a row.
|
|
742
|
+
*
|
|
743
|
+
* Example Use:
|
|
744
|
+
*
|
|
745
|
+
* onRequestAdd() => {
|
|
746
|
+
* this.setState(state => ({
|
|
747
|
+
* items: FormRows.addRow(
|
|
748
|
+
* <FormRows.Row
|
|
749
|
+
* index={state.items.length}
|
|
750
|
+
* key={createDOMID()}
|
|
751
|
+
* onRequestRemove={this.handleRequestRemove}
|
|
752
|
+
* >
|
|
753
|
+
* <Text />
|
|
754
|
+
* </FormRows.Row>,
|
|
755
|
+
* state.items
|
|
756
|
+
* ),
|
|
757
|
+
* }));
|
|
758
|
+
* };
|
|
759
|
+
*
|
|
760
|
+
* @param element Row element to add.
|
|
761
|
+
* @param items Array of current FormRows to add to.
|
|
762
|
+
* @return New array of FormRows with new Row added.
|
|
763
|
+
*/ var Ve = function e(t, r) {
|
|
764
|
+
return r.concat(t);
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Static function for moving a row.
|
|
768
|
+
*
|
|
769
|
+
* Example Use:
|
|
770
|
+
*
|
|
771
|
+
* onRequestMove({ fromIndex, toIndex }) => {
|
|
772
|
+
* this.setState(state => ({
|
|
773
|
+
* items: FormRows.moveRow(fromIndex, toIndex, state.items),
|
|
774
|
+
* }));
|
|
775
|
+
* };
|
|
776
|
+
*
|
|
777
|
+
* @param fromIndex Current index of row to move.
|
|
778
|
+
* @param toIndex New index to move row to.
|
|
779
|
+
* @param items Array of current FormRows.
|
|
780
|
+
* @return New array of FormRows arranged in new order.
|
|
781
|
+
*/ var Ge = function e(t, n, o) {
|
|
782
|
+
var i = o.filter((function(e, r) {
|
|
783
|
+
return r !== t;
|
|
784
|
+
}));
|
|
785
|
+
i.splice(n, 0, o[t]);
|
|
786
|
+
return i.map((function(e, t) {
|
|
787
|
+
|
|
788
|
+
return (0, r.cloneElement)(e, {
|
|
789
|
+
index: t
|
|
790
|
+
});
|
|
791
|
+
}));
|
|
792
|
+
};
|
|
793
|
+
/**
|
|
794
|
+
* Static function for removing a row.
|
|
795
|
+
*
|
|
796
|
+
* Example Use:
|
|
797
|
+
*
|
|
798
|
+
* onRequestRemove(e, { index }) => {
|
|
799
|
+
* this.setState(state => ({
|
|
800
|
+
* items: FormRows.removeRow(index, state.items),
|
|
801
|
+
* }));
|
|
802
|
+
* };
|
|
803
|
+
*
|
|
804
|
+
* @param index Index of Row to delete.
|
|
805
|
+
* @param items Array of current FormRows.
|
|
806
|
+
* @return New array of FormRows with Row of given index deleted.
|
|
807
|
+
*/ var Je = function e(t, n) {
|
|
808
|
+
return n.filter((function(e, r) {
|
|
809
|
+
return r !== t;
|
|
810
|
+
})).map((function(e, t) {
|
|
811
|
+
|
|
812
|
+
return (0, r.cloneElement)(e, {
|
|
813
|
+
index: t
|
|
814
|
+
});
|
|
815
|
+
}));
|
|
816
|
+
};
|
|
817
|
+
var Qe = function(e) {
|
|
818
|
+
De(r, e);
|
|
819
|
+
var t = Be(r);
|
|
820
|
+
function r() {
|
|
744
821
|
var e;
|
|
745
|
-
qe(this,
|
|
746
|
-
for (var
|
|
822
|
+
qe(this, r);
|
|
823
|
+
for (var o = arguments.length, i = new Array(o), a = 0; a < o; a++) {
|
|
747
824
|
i[a] = arguments[a];
|
|
748
825
|
}
|
|
749
826
|
e = t.call.apply(t, [ this ].concat(i));
|
|
@@ -783,7 +860,7 @@
|
|
|
783
860
|
return e;
|
|
784
861
|
}
|
|
785
862
|
// @docs-props-type FormRowsPropsBase
|
|
786
|
-
Te(
|
|
863
|
+
Te(r, [ {
|
|
787
864
|
key: "render",
|
|
788
865
|
value: function e() {
|
|
789
866
|
var t = this.props, r = t.addLabel, o = t.children, i = t.disabled, a = t.header, l = t.menu, u = t.onRequestAdd, s = t.onRequestMove, p = ke(t, [ "addLabel", "children", "disabled", "header", "menu", "onRequestAdd", "onRequestMove" ]);
|
|
@@ -813,97 +890,16 @@
|
|
|
813
890
|
$sortable: f
|
|
814
891
|
})));
|
|
815
892
|
}
|
|
816
|
-
} ], [ {
|
|
817
|
-
key: "addRow",
|
|
818
|
-
/**
|
|
819
|
-
* Static function for adding a row.
|
|
820
|
-
*
|
|
821
|
-
* Example Use:
|
|
822
|
-
*
|
|
823
|
-
* onRequestAdd() => {
|
|
824
|
-
* this.setState(state => ({
|
|
825
|
-
* items: FormRows.addRow(
|
|
826
|
-
* <FormRows.Row
|
|
827
|
-
* index={state.items.length}
|
|
828
|
-
* key={createDOMID()}
|
|
829
|
-
* onRequestRemove={this.handleRequestRemove}
|
|
830
|
-
* >
|
|
831
|
-
* <Text />
|
|
832
|
-
* </FormRows.Row>,
|
|
833
|
-
* state.items
|
|
834
|
-
* ),
|
|
835
|
-
* }));
|
|
836
|
-
* };
|
|
837
|
-
*
|
|
838
|
-
* @param element Row element to add.
|
|
839
|
-
* @param items Array of current FormRows to add to.
|
|
840
|
-
* @return New array of FormRows with new Row added.
|
|
841
|
-
*/
|
|
842
|
-
value: function e(t, r) {
|
|
843
|
-
return r.concat(t);
|
|
844
|
-
}
|
|
845
|
-
/**
|
|
846
|
-
* Static function for moving a row.
|
|
847
|
-
*
|
|
848
|
-
* Example Use:
|
|
849
|
-
*
|
|
850
|
-
* onRequestMove({ fromIndex, toIndex }) => {
|
|
851
|
-
* this.setState(state => ({
|
|
852
|
-
* items: FormRows.moveRow(fromIndex, toIndex, state.items),
|
|
853
|
-
* }));
|
|
854
|
-
* };
|
|
855
|
-
*
|
|
856
|
-
* @param fromIndex Current index of row to move.
|
|
857
|
-
* @param toIndex New index to move row to.
|
|
858
|
-
* @param items Array of current FormRows.
|
|
859
|
-
* @return New array of FormRows arranged in new order.
|
|
860
|
-
*/ }, {
|
|
861
|
-
key: "moveRow",
|
|
862
|
-
value: function e(t, n, o) {
|
|
863
|
-
var i = o.filter((function(e, r) {
|
|
864
|
-
return r !== t;
|
|
865
|
-
}));
|
|
866
|
-
i.splice(n, 0, o[t]);
|
|
867
|
-
return i.map((function(e, t) {
|
|
868
|
-
|
|
869
|
-
return (0, r.cloneElement)(e, {
|
|
870
|
-
index: t
|
|
871
|
-
});
|
|
872
|
-
}));
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* Static function for removing a row.
|
|
876
|
-
*
|
|
877
|
-
* Example Use:
|
|
878
|
-
*
|
|
879
|
-
* onRequestRemove(e, { index }) => {
|
|
880
|
-
* this.setState(state => ({
|
|
881
|
-
* items: FormRows.removeRow(index, state.items),
|
|
882
|
-
* }));
|
|
883
|
-
* };
|
|
884
|
-
*
|
|
885
|
-
* @param index Index of Row to delete.
|
|
886
|
-
* @param items Array of current FormRows.
|
|
887
|
-
* @return New array of FormRows with Row of given index deleted.
|
|
888
|
-
*/ }, {
|
|
889
|
-
key: "removeRow",
|
|
890
|
-
value: function e(t, n) {
|
|
891
|
-
return n.filter((function(e, r) {
|
|
892
|
-
return r !== t;
|
|
893
|
-
})).map((function(e, t) {
|
|
894
|
-
|
|
895
|
-
return (0, r.cloneElement)(e, {
|
|
896
|
-
index: t
|
|
897
|
-
});
|
|
898
|
-
}));
|
|
899
|
-
}
|
|
900
893
|
} ]);
|
|
901
|
-
return
|
|
894
|
+
return r;
|
|
902
895
|
}(r.Component);
|
|
903
|
-
Fe(
|
|
904
|
-
Fe(
|
|
905
|
-
Fe(
|
|
906
|
-
|
|
896
|
+
Fe(Qe, "propTypes", $e);
|
|
897
|
+
Fe(Qe, "defaultProps", ze);
|
|
898
|
+
Fe(Qe, "Row", Oe);
|
|
899
|
+
Fe(Qe, "addRow", Ve);
|
|
900
|
+
Fe(Qe, "moveRow", Ge);
|
|
901
|
+
Fe(Qe, "removeRow", Je);
|
|
902
|
+
/* harmony default export */ const Ue = Qe;
|
|
907
903
|
// CONCATENATED MODULE: ./src/FormRows/index.ts
|
|
908
904
|
module.exports = t;
|
|
909
905
|
/******/})();
|
package/Layer.js
CHANGED
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
e.r(t);
|
|
74
74
|
// EXPORTS
|
|
75
75
|
e.d(t, {
|
|
76
|
-
LayerContext: () => /* reexport */
|
|
77
|
-
LayerStackContext: () => /* reexport */
|
|
78
|
-
LayerStackGlobalProvider: () => /* reexport */
|
|
79
|
-
default: () => /* reexport */
|
|
76
|
+
LayerContext: () => /* reexport */ h,
|
|
77
|
+
LayerStackContext: () => /* reexport */ v,
|
|
78
|
+
LayerStackGlobalProvider: () => /* reexport */ b,
|
|
79
|
+
default: () => /* reexport */ I
|
|
80
80
|
});
|
|
81
81
|
// CONCATENATED MODULE: external "react"
|
|
82
82
|
const n = require("react");
|
|
@@ -87,27 +87,25 @@
|
|
|
87
87
|
const i = require("prop-types");
|
|
88
88
|
var a = e.n(i);
|
|
89
89
|
// CONCATENATED MODULE: external "lodash/includes"
|
|
90
|
-
const
|
|
91
|
-
var
|
|
90
|
+
const l = require("lodash/includes");
|
|
91
|
+
var c = e.n(l);
|
|
92
92
|
// CONCATENATED MODULE: external "lodash/last"
|
|
93
|
-
const
|
|
94
|
-
var s = e.n(
|
|
93
|
+
const u = require("lodash/last");
|
|
94
|
+
var s = e.n(u);
|
|
95
95
|
// CONCATENATED MODULE: external "lodash/pull"
|
|
96
96
|
const p = require("lodash/pull");
|
|
97
97
|
var f = e.n(p);
|
|
98
|
-
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
99
|
-
const y = require("@splunk/ui-utils/keyboard");
|
|
100
98
|
// CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
|
|
101
|
-
const
|
|
102
|
-
var
|
|
99
|
+
const y = require("@splunk/react-ui/EventListener");
|
|
100
|
+
var d = e.n(y);
|
|
103
101
|
// CONCATENATED MODULE: ./src/Layer/LayerStack.tsx
|
|
104
102
|
/**
|
|
105
103
|
* `LayerStackContext` is used to manage the array that `Layer` (and components that
|
|
106
104
|
* depend on it, such as `Modal`) uses to determine the order of open layers.
|
|
107
105
|
* @public
|
|
108
106
|
*/
|
|
109
|
-
var
|
|
110
|
-
var
|
|
107
|
+
var v = r().createContext([]);
|
|
108
|
+
var h = r().createContext({});
|
|
111
109
|
var m = {
|
|
112
110
|
children: a().node,
|
|
113
111
|
name: a().string,
|
|
@@ -119,10 +117,10 @@
|
|
|
119
117
|
* A `LayerStackContext` provider that stores a shared layer stack using a global variable.
|
|
120
118
|
* Applications should only use this provider if there's a known need to support multiple
|
|
121
119
|
* instances of this library on the same page.
|
|
122
|
-
*/ function
|
|
123
|
-
var o = t.children, i = t.name, a = i === void 0 ? "__splunkui_layer_instances__" : i,
|
|
124
|
-
if (!
|
|
125
|
-
|
|
120
|
+
*/ function b(t) {
|
|
121
|
+
var o = t.children, i = t.name, a = i === void 0 ? "__splunkui_layer_instances__" : i, l = t.scope, c = l === void 0 ? typeof window !== "undefined" ? window : e.g : l, u = t.separateStackingContexts, s = u === void 0 ? false : u;
|
|
122
|
+
if (!c[a]) {
|
|
123
|
+
c[a] = [];
|
|
126
124
|
// eslint-disable-line no-param-reassign
|
|
127
125
|
}
|
|
128
126
|
var p = (0, n.useMemo)((function() {
|
|
@@ -131,29 +129,29 @@
|
|
|
131
129
|
};
|
|
132
130
|
}), [ s ]);
|
|
133
131
|
|
|
134
|
-
return r().createElement(
|
|
135
|
-
value:
|
|
136
|
-
}, r().createElement(
|
|
132
|
+
return r().createElement(v.Provider, {
|
|
133
|
+
value: c[a]
|
|
134
|
+
}, r().createElement(h.Provider, {
|
|
137
135
|
value: p
|
|
138
136
|
}, o));
|
|
139
137
|
}
|
|
140
|
-
|
|
138
|
+
b.propTypes = m;
|
|
141
139
|
// CONCATENATED MODULE: external "styled-components"
|
|
142
|
-
const
|
|
143
|
-
var g = e.n(
|
|
140
|
+
const w = require("styled-components");
|
|
141
|
+
var g = e.n(w);
|
|
144
142
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
145
143
|
const C = require("@splunk/themes");
|
|
146
144
|
// CONCATENATED MODULE: ./src/Layer/LayerStyles.ts
|
|
147
|
-
var
|
|
145
|
+
var k = g().div.withConfig({
|
|
148
146
|
displayName: "LayerStyles__StyledLayer",
|
|
149
147
|
componentId: "ii6psl-0"
|
|
150
148
|
})([ "", "" ], (function(e) {
|
|
151
149
|
var t = e.$separateStackingContexts;
|
|
152
|
-
return t && (0,
|
|
150
|
+
return t && (0, w.css)([ "isolation:isolate;z-index:", ";" ], C.variables.zindexLayer);
|
|
153
151
|
}));
|
|
154
152
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
155
153
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
156
|
-
var
|
|
154
|
+
var S = {
|
|
157
155
|
body: {
|
|
158
156
|
appendChild: function e() {
|
|
159
157
|
return [];
|
|
@@ -208,34 +206,34 @@
|
|
|
208
206
|
}
|
|
209
207
|
};
|
|
210
208
|
function E() {
|
|
211
|
-
var e = typeof document !== "undefined" ? document :
|
|
209
|
+
var e = typeof document !== "undefined" ? document : S;
|
|
212
210
|
return e;
|
|
213
211
|
}
|
|
214
212
|
// CONCATENATED MODULE: ./src/Layer/Layer.tsx
|
|
215
|
-
function
|
|
213
|
+
function O(e) {
|
|
216
214
|
"@babel/helpers - typeof";
|
|
217
|
-
return
|
|
215
|
+
return O = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
218
216
|
return typeof e;
|
|
219
217
|
} : function(e) {
|
|
220
218
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
221
|
-
},
|
|
219
|
+
}, O(e);
|
|
222
220
|
}
|
|
223
|
-
function
|
|
221
|
+
function j(e, t) {
|
|
224
222
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
225
223
|
}
|
|
226
|
-
function
|
|
224
|
+
function L(e, t) {
|
|
227
225
|
for (var n = 0; n < t.length; n++) {
|
|
228
226
|
var r = t[n];
|
|
229
227
|
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
|
|
230
|
-
Object.defineProperty(e,
|
|
228
|
+
Object.defineProperty(e, A(r.key), r);
|
|
231
229
|
}
|
|
232
230
|
}
|
|
233
|
-
function
|
|
234
|
-
return t &&
|
|
231
|
+
function P(e, t, n) {
|
|
232
|
+
return t && L(e.prototype, t), n && L(e, n), Object.defineProperty(e, "prototype", {
|
|
235
233
|
writable: !1
|
|
236
234
|
}), e;
|
|
237
235
|
}
|
|
238
|
-
function
|
|
236
|
+
function _(e, t) {
|
|
239
237
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
240
238
|
e.prototype = Object.create(t && t.prototype, {
|
|
241
239
|
constructor: {
|
|
@@ -245,103 +243,101 @@
|
|
|
245
243
|
}
|
|
246
244
|
}), Object.defineProperty(e, "prototype", {
|
|
247
245
|
writable: !1
|
|
248
|
-
}), t &&
|
|
246
|
+
}), t && T(e, t);
|
|
249
247
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
248
|
+
function T(e, t) {
|
|
249
|
+
return T = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
|
|
252
250
|
return e.__proto__ = t, e;
|
|
253
|
-
},
|
|
251
|
+
}, T(e, t);
|
|
254
252
|
}
|
|
255
|
-
function
|
|
256
|
-
var t =
|
|
253
|
+
function x(e) {
|
|
254
|
+
var t = D();
|
|
257
255
|
return function() {
|
|
258
|
-
var n, r =
|
|
256
|
+
var n, r = M(e);
|
|
259
257
|
if (t) {
|
|
260
|
-
var o =
|
|
258
|
+
var o = M(this).constructor;
|
|
261
259
|
n = Reflect.construct(r, arguments, o);
|
|
262
260
|
} else n = r.apply(this, arguments);
|
|
263
|
-
return
|
|
261
|
+
return q(this, n);
|
|
264
262
|
};
|
|
265
263
|
}
|
|
266
|
-
function
|
|
267
|
-
if (t && ("object" ==
|
|
264
|
+
function q(e, t) {
|
|
265
|
+
if (t && ("object" == O(t) || "function" == typeof t)) return t;
|
|
268
266
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
269
|
-
return
|
|
267
|
+
return R(e);
|
|
270
268
|
}
|
|
271
|
-
function
|
|
269
|
+
function R(e) {
|
|
272
270
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
273
271
|
return e;
|
|
274
272
|
}
|
|
275
|
-
function
|
|
273
|
+
function D() {
|
|
276
274
|
try {
|
|
277
275
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
278
276
|
} catch (e) {}
|
|
279
|
-
return (
|
|
277
|
+
return (D = function t() {
|
|
280
278
|
return !!e;
|
|
281
279
|
})();
|
|
282
280
|
}
|
|
283
|
-
function
|
|
284
|
-
return
|
|
281
|
+
function M(e) {
|
|
282
|
+
return M = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
|
|
285
283
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
286
|
-
},
|
|
284
|
+
}, M(e);
|
|
287
285
|
}
|
|
288
|
-
function
|
|
289
|
-
return (t =
|
|
286
|
+
function N(e, t, n) {
|
|
287
|
+
return (t = A(t)) in e ? Object.defineProperty(e, t, {
|
|
290
288
|
value: n,
|
|
291
289
|
enumerable: !0,
|
|
292
290
|
configurable: !0,
|
|
293
291
|
writable: !0
|
|
294
292
|
}) : e[t] = n, e;
|
|
295
293
|
}
|
|
296
|
-
function
|
|
297
|
-
var t =
|
|
298
|
-
return "symbol" ==
|
|
294
|
+
function A(e) {
|
|
295
|
+
var t = K(e, "string");
|
|
296
|
+
return "symbol" == O(t) ? t : t + "";
|
|
299
297
|
}
|
|
300
|
-
function
|
|
301
|
-
if ("object" !=
|
|
298
|
+
function K(e, t) {
|
|
299
|
+
if ("object" != O(e) || !e) return e;
|
|
302
300
|
var n = e[Symbol.toPrimitive];
|
|
303
301
|
if (void 0 !== n) {
|
|
304
302
|
var r = n.call(e, t || "default");
|
|
305
|
-
if ("object" !=
|
|
303
|
+
if ("object" != O(r)) return r;
|
|
306
304
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
307
305
|
}
|
|
308
306
|
return ("string" === t ? String : Number)(e);
|
|
309
307
|
}
|
|
310
308
|
/** @public */
|
|
311
|
-
/** @public */ var
|
|
312
|
-
var
|
|
309
|
+
/** @public */ var W = [ "clickAway", "escapeKey" ];
|
|
310
|
+
var F = {
|
|
313
311
|
children: a().node,
|
|
314
|
-
closeReasons: a().arrayOf(a().oneOf(
|
|
312
|
+
closeReasons: a().arrayOf(a().oneOf(W)),
|
|
315
313
|
onRequestClose: a().func,
|
|
316
314
|
open: a().bool
|
|
317
315
|
};
|
|
318
|
-
var
|
|
319
|
-
closeReasons:
|
|
316
|
+
var B = {
|
|
317
|
+
closeReasons: W,
|
|
320
318
|
open: false
|
|
321
319
|
};
|
|
322
|
-
var
|
|
323
|
-
|
|
324
|
-
var t =
|
|
320
|
+
var z = function(e) {
|
|
321
|
+
_(n, e);
|
|
322
|
+
var t = x(n);
|
|
325
323
|
// @docs-props-type LayerPropsBase
|
|
326
324
|
// eslint-disable-next-line react/sort-comp
|
|
327
325
|
// LayerStackContext (an array) keeps track of the current instances of Layer. This is
|
|
328
326
|
// used by Layer#handleKeyDown to determine if the escapeKey event should be handled by
|
|
329
327
|
// the current instance. Only the topmost Layer instance should honor the escapeKey.
|
|
330
|
-
// TODO: enable once this is sorted out within the babel/ts ecosystem
|
|
331
|
-
// declare context: React.ContextType<typeof LayerStackContext>;
|
|
332
328
|
function n(e) {
|
|
333
329
|
var r;
|
|
334
|
-
|
|
330
|
+
j(this, n);
|
|
335
331
|
r = t.call(this, e);
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
N(R(r), "layerClickEvent", null);
|
|
333
|
+
N(R(r), "handleClickOnLayer", (function(e) {
|
|
338
334
|
var t = e.nativeEvent;
|
|
339
335
|
r.layerClickEvent = t;
|
|
340
336
|
}));
|
|
341
|
-
|
|
337
|
+
N(R(r), "handleClickOnWindow", (function(e) {
|
|
342
338
|
var t, n;
|
|
343
339
|
// clicks inside the layer should not be considered clickAways
|
|
344
|
-
if (!r.props.open || !
|
|
340
|
+
if (!r.props.open || !c()(r.props.closeReasons, "clickAway") || r.layerClickEvent === e) {
|
|
345
341
|
return;
|
|
346
342
|
}
|
|
347
343
|
(t = (n = r.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
|
|
@@ -349,8 +345,8 @@
|
|
|
349
345
|
reason: "clickAway"
|
|
350
346
|
});
|
|
351
347
|
}));
|
|
352
|
-
|
|
353
|
-
if (r.props.open &&
|
|
348
|
+
N(R(r), "handleKeyDownOnWindow", (function(e) {
|
|
349
|
+
if (r.props.open && e.key === "Escape" && s()(r.getLayerStack()) === R(r) && c()(r.props.closeReasons, "escapeKey")) {
|
|
354
350
|
var t, n;
|
|
355
351
|
(t = (n = r.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
|
|
356
352
|
event: e,
|
|
@@ -366,7 +362,7 @@
|
|
|
366
362
|
}
|
|
367
363
|
return r;
|
|
368
364
|
}
|
|
369
|
-
|
|
365
|
+
P(n, [ {
|
|
370
366
|
key: "componentDidMount",
|
|
371
367
|
value: function e() {
|
|
372
368
|
if (this.props.open) {
|
|
@@ -392,16 +388,25 @@
|
|
|
392
388
|
value: function e() {
|
|
393
389
|
return this.context;
|
|
394
390
|
}
|
|
395
|
-
|
|
391
|
+
// the fullscreen API does not render elements outside the fullscreen element
|
|
392
|
+
// Layer renders in document.body, which means that anything using Layer will not render in fullscreen
|
|
393
|
+
// this code moves the layer container into the fullscreen element, ensuring that it will render
|
|
394
|
+
}, {
|
|
396
395
|
key: "render",
|
|
397
396
|
value: function e() {
|
|
398
397
|
var t = this;
|
|
399
|
-
var i = this.props, a = i.children,
|
|
400
|
-
|
|
401
|
-
|
|
398
|
+
var i = this.props, a = i.children, l = i.open;
|
|
399
|
+
var c = r().createElement(d(), {
|
|
400
|
+
target: window,
|
|
401
|
+
eventType: "fullscreenchange",
|
|
402
|
+
listener: n.handleFullScreenChange,
|
|
403
|
+
key: "fullScreenChange"
|
|
404
|
+
});
|
|
405
|
+
if (l) {
|
|
406
|
+
var u = (0, o.createPortal)( r().createElement(h.Consumer, null, (function(e) {
|
|
402
407
|
var n = e.separateStackingContexts, o = n === void 0 ? false : n;
|
|
403
408
|
|
|
404
|
-
return r().createElement(
|
|
409
|
+
return r().createElement(k, {
|
|
405
410
|
$separateStackingContexts: o,
|
|
406
411
|
"data-test": "layer",
|
|
407
412
|
onMouseDown: t.handleClickOnLayer,
|
|
@@ -409,17 +414,17 @@
|
|
|
409
414
|
}, a);
|
|
410
415
|
})), n.layerContainer);
|
|
411
416
|
|
|
412
|
-
return r().createElement(r().Fragment, null, r().createElement(
|
|
417
|
+
return r().createElement(r().Fragment, null, r().createElement(d(), {
|
|
413
418
|
target: window,
|
|
414
419
|
eventType: "keydown",
|
|
415
420
|
listener: this.handleKeyDownOnWindow,
|
|
416
421
|
key: "eventListenerKeydown"
|
|
417
|
-
}), r().createElement(
|
|
422
|
+
}), r().createElement(d(), {
|
|
418
423
|
target: window,
|
|
419
424
|
eventType: "mousedown",
|
|
420
425
|
listener: this.handleClickOnWindow,
|
|
421
426
|
key: "eventListenerMouseDown"
|
|
422
|
-
}), r().createElement(
|
|
427
|
+
}), r().createElement(d(), {
|
|
423
428
|
target: window,
|
|
424
429
|
eventType: "touchstart",
|
|
425
430
|
listener: this.handleClickOnWindow,
|
|
@@ -427,19 +432,32 @@
|
|
|
427
432
|
options: {
|
|
428
433
|
passive: true
|
|
429
434
|
}
|
|
430
|
-
}), u);
|
|
435
|
+
}), c, u);
|
|
431
436
|
}
|
|
432
|
-
|
|
437
|
+
// the fragment has to be present to avoid type issues with React 18
|
|
438
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
439
|
+
|
|
440
|
+
return r().createElement(r().Fragment, null, c);
|
|
433
441
|
}
|
|
434
442
|
} ]);
|
|
435
443
|
return n;
|
|
436
444
|
}(n.Component);
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
445
|
+
N(z, "layerContainer", null);
|
|
446
|
+
N(z, "possibleCloseReasons", W);
|
|
447
|
+
N(z, "propTypes", F);
|
|
448
|
+
N(z, "defaultProps", B);
|
|
449
|
+
N(z, "contextType", v);
|
|
450
|
+
N(z, "handleFullScreenChange", (function() {
|
|
451
|
+
if (z.layerContainer) {
|
|
452
|
+
var e = E();
|
|
453
|
+
if (e.fullscreenElement != null) {
|
|
454
|
+
e.fullscreenElement.appendChild(z.layerContainer);
|
|
455
|
+
} else {
|
|
456
|
+
e.body.appendChild(z.layerContainer);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}));
|
|
460
|
+
/* harmony default export */ const I = z;
|
|
443
461
|
// CONCATENATED MODULE: ./src/Layer/index.ts
|
|
444
462
|
module.exports = t;
|
|
445
463
|
/******/})();
|
package/MIGRATION.mdx
CHANGED
|
@@ -15,7 +15,7 @@ This document lists migration guidance for new features and breaking changes.
|
|
|
15
15
|
|
|
16
16
|
#### Context
|
|
17
17
|
|
|
18
|
-
The `primary` appearance is no longer supported as primary actions are generally intended for tasks like submitting a form or page, whereas `Select` should be used to make a choice that then gets submitted with a primary `Button`.
|
|
18
|
+
The `primary` appearance is no longer supported as primary actions are generally intended for tasks like submitting a form or page, whereas `Select` should be used to make a choice that then gets submitted with a primary `Button`.
|
|
19
19
|
Including both a primary `Select` and `Button` conflicts with the visual importance and hierarchy of the page.
|
|
20
20
|
|
|
21
21
|
#### Migration steps
|
|
@@ -23,6 +23,27 @@ Including both a primary `Select` and `Button` conflicts with the visual importa
|
|
|
23
23
|
* If `Select` was being used as a primary action but there are some variants for how that primary action works (e.g. Save vs. Save As), use `SplitButton`.
|
|
24
24
|
* Otherwise use `Select` with the `default` appearance paired with a primary `Button` to submit.
|
|
25
25
|
|
|
26
|
+
### Deprecated `TabBar` and `TabLayout`'s `iconSize` prop
|
|
27
|
+
|
|
28
|
+
#### Context
|
|
29
|
+
|
|
30
|
+
The `iconSize` prop has two major issues:
|
|
31
|
+
|
|
32
|
+
* Despite its name, it controls both size and position, which is both confusing to users and makes it difficult to control those independently.
|
|
33
|
+
* It does not correctly set the icon size for the new icons introduced in `@splunk/react-icons@4`.
|
|
34
|
+
|
|
35
|
+
To eliminate these issues, we have deprecated the `iconSize` prop.
|
|
36
|
+
|
|
37
|
+
#### Migration steps
|
|
38
|
+
|
|
39
|
+
Remove usages of the `iconSize` prop.
|
|
40
|
+
|
|
41
|
+
* Icon position can now be controlled with the new `iconPosition` prop.
|
|
42
|
+
* Icon size can be set using `@splunk/react-icons` APIs.
|
|
43
|
+
* If you are using the new icons in `react-icons@4`, you can set size with the `height` and `width` props.
|
|
44
|
+
* If you are using `react-icons@3` or using the `/enterprise` path in `react-icons@4`,
|
|
45
|
+
the `size` prop can be set to `"18px"` to match `iconSize="small"` or `"36px"` to match `iconSize="large"`.
|
|
46
|
+
|
|
26
47
|
## 4.39.0
|
|
27
48
|
|
|
28
49
|
### Deprecated `TabBar` and `TabLayout`'s `appearance` prop
|
|
@@ -49,8 +70,8 @@ To eliminate these issues, we have deprecated the `appearance` prop.
|
|
|
49
70
|
|
|
50
71
|
Remove usages of the `appearance` prop:
|
|
51
72
|
|
|
52
|
-
|
|
53
|
-
|
|
73
|
+
* If you were using `appearance="navigation"`, that is the default appearance and removing the prop will have no effect.
|
|
74
|
+
* If you were using `appearance="context"`, the tabs will render with the default appearance.
|
|
54
75
|
|
|
55
76
|
### Deprecated `Button`'s `selected` prop
|
|
56
77
|
|