@splunk/react-ui 5.8.0 → 5.9.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/Anchor.js +2 -1
- package/CHANGELOG.md +22 -0
- package/Calendar.js +134 -134
- package/Clickable.js +131 -94
- package/CollapsiblePanel.js +173 -135
- package/ComboBox.js +1 -0
- package/Dropdown.js +27 -18
- package/File.js +35 -35
- package/Menu.js +259 -215
- package/Modal.js +174 -181
- package/Monogram.js +2 -2
- package/Multiselect.js +401 -321
- package/Number.js +2 -1
- package/Search.js +15 -14
- package/SelectBase.js +777 -719
- package/Table.js +116 -119
- package/Text.js +26 -26
- package/docs-llm/Avatar.md +2 -8
- package/docs-llm/Multiselect.md +5 -3
- package/docs-llm/Notifications.md +46 -0
- package/docs-llm/Tree.md +7 -2
- package/docs-llm/llms.txt +6 -2
- package/package.json +4 -4
- package/types/src/Multiselect/Compact.d.ts +8 -3
- package/types/src/Multiselect/Multiselect.d.ts +8 -3
- package/types/src/Multiselect/Normal.d.ts +8 -3
- package/types/src/Multiselect/Option.d.ts +6 -3
- package/types/src/Multiselect/docs/examples/Disabled.d.ts +1 -0
- package/types/src/SelectBase/SelectBase.d.ts +1 -1
package/Clickable.js
CHANGED
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
e.d(n, {
|
|
64
64
|
NavigationContext: () => /* reexport */ m,
|
|
65
65
|
NavigationProvider: () => /* reexport */ y,
|
|
66
|
-
default: () => /* reexport */
|
|
67
|
-
isInternalLink: () => /* reexport */
|
|
68
|
-
isRootRelativeLink: () => /* reexport */
|
|
66
|
+
default: () => /* reexport */ T,
|
|
67
|
+
isInternalLink: () => /* reexport */ j,
|
|
68
|
+
isRootRelativeLink: () => /* reexport */ S
|
|
69
69
|
});
|
|
70
70
|
// CONCATENATED MODULE: external "react"
|
|
71
71
|
const r = require("react");
|
|
@@ -74,51 +74,93 @@
|
|
|
74
74
|
const i = require("lodash/has");
|
|
75
75
|
// CONCATENATED MODULE: external "lodash/isString"
|
|
76
76
|
const a = require("lodash/isString");
|
|
77
|
-
var
|
|
77
|
+
var l = e.n(a);
|
|
78
78
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
79
|
-
const
|
|
80
|
-
var d = e.n(
|
|
79
|
+
const o = require("lodash/omit");
|
|
80
|
+
var d = e.n(o);
|
|
81
81
|
// CONCATENATED MODULE: external "prop-types"
|
|
82
82
|
const u = require("prop-types");
|
|
83
|
-
var
|
|
83
|
+
var s = e.n(u);
|
|
84
84
|
// CONCATENATED MODULE: external "styled-components"
|
|
85
|
-
const
|
|
86
|
-
var
|
|
85
|
+
const f = require("styled-components");
|
|
86
|
+
var c = e.n(f);
|
|
87
87
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
88
|
-
const
|
|
88
|
+
const b = require("@splunk/themes");
|
|
89
89
|
// CONCATENATED MODULE: ./src/Clickable/ClickableStyles.ts
|
|
90
|
-
var
|
|
90
|
+
var v = c().a.withConfig({
|
|
91
91
|
displayName: "ClickableStyles__StyledA",
|
|
92
92
|
componentId: "sc-7al1vw-0"
|
|
93
|
-
})([ "", " cursor:pointer;&[disabled],&[aria-disabled='true']{cursor:not-allowed;color:", ";}&::-moz-focus-inner{border:0;padding:0;}" ],
|
|
93
|
+
})([ "", " cursor:pointer;&[disabled],&[aria-disabled='true']{cursor:not-allowed;color:", ";}&::-moz-focus-inner{border:0;padding:0;}" ], b.mixins.reset("inline"), b.variables.contentColorDisabled);
|
|
94
94
|
// CONCATENATED MODULE: ./src/Clickable/NavigationProvider.tsx
|
|
95
95
|
/** @public */
|
|
96
96
|
var p = {
|
|
97
|
-
children:
|
|
98
|
-
onClick:
|
|
99
|
-
onLinkClick:
|
|
100
|
-
transformUrl:
|
|
97
|
+
children: s().node,
|
|
98
|
+
onClick: s().func,
|
|
99
|
+
onLinkClick: s().func,
|
|
100
|
+
transformUrl: s().func
|
|
101
101
|
};
|
|
102
102
|
var m = t().createContext({});
|
|
103
103
|
/**
|
|
104
104
|
* Used to provide an override for the `onClick` for links for single page applications so that
|
|
105
105
|
* internal links can navigate without a page reload.
|
|
106
106
|
*/ function y(e) {
|
|
107
|
-
var n = e.children, i = e.onClick, a = e.onLinkClick,
|
|
107
|
+
var n = e.children, i = e.onClick, a = e.onLinkClick, l = e.transformUrl;
|
|
108
108
|
// @docs-props-type NavigationProviderProps
|
|
109
|
-
var
|
|
109
|
+
var o = (0, r.useMemo)((function() {
|
|
110
110
|
return {
|
|
111
111
|
onClick: i,
|
|
112
112
|
onLinkClick: a,
|
|
113
|
-
transformUrl:
|
|
113
|
+
transformUrl: l
|
|
114
114
|
};
|
|
115
|
-
}), [ i, a,
|
|
115
|
+
}), [ i, a, l ]);
|
|
116
116
|
|
|
117
117
|
return t().createElement(m.Provider, {
|
|
118
|
-
value:
|
|
118
|
+
value: o
|
|
119
119
|
}, n);
|
|
120
120
|
}
|
|
121
121
|
y.propTypes = p;
|
|
122
|
+
// CONCATENATED MODULE: ./src/utils/disabled.ts
|
|
123
|
+
/**
|
|
124
|
+
* Normalizes the disabled prop and returns both the boolean state and normalized string value.
|
|
125
|
+
* Use this function to ensure consistent handling of disabled prop across components.
|
|
126
|
+
*
|
|
127
|
+
* @param disabled - The disabled prop value
|
|
128
|
+
* @param defaultWhenBooleanTrue - Optional normalization override for disabled={true}
|
|
129
|
+
* @returns Object with isDisabled boolean|undefined and disabledValue string
|
|
130
|
+
*
|
|
131
|
+
* TODO (SUI-8600): `disabled` prop should default to 'dimmed' for data entry components
|
|
132
|
+
*/
|
|
133
|
+
function k(e) {
|
|
134
|
+
var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "dimmed";
|
|
135
|
+
if (e === "dimmed") {
|
|
136
|
+
return {
|
|
137
|
+
isDisabled: true,
|
|
138
|
+
disabledValue: "dimmed"
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (e === true) {
|
|
142
|
+
return {
|
|
143
|
+
isDisabled: true,
|
|
144
|
+
disabledValue: n
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (e === "disabled") {
|
|
148
|
+
return {
|
|
149
|
+
isDisabled: true,
|
|
150
|
+
disabledValue: "disabled"
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (e === false) {
|
|
154
|
+
return {
|
|
155
|
+
isDisabled: false,
|
|
156
|
+
disabledValue: undefined
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
isDisabled: undefined,
|
|
161
|
+
disabledValue: undefined
|
|
162
|
+
};
|
|
163
|
+
}
|
|
122
164
|
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
123
165
|
/**
|
|
124
166
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
@@ -126,7 +168,7 @@
|
|
|
126
168
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
127
169
|
* @param current - The new value of the ref.
|
|
128
170
|
*/
|
|
129
|
-
function
|
|
171
|
+
function g(e, n) {
|
|
130
172
|
if (e) {
|
|
131
173
|
if (typeof e === "function") {
|
|
132
174
|
e(n);
|
|
@@ -150,9 +192,9 @@
|
|
|
150
192
|
return e;
|
|
151
193
|
}, C.apply(null, arguments);
|
|
152
194
|
}
|
|
153
|
-
function
|
|
195
|
+
function O(e, n) {
|
|
154
196
|
if (null == e) return {};
|
|
155
|
-
var r, t, i =
|
|
197
|
+
var r, t, i = h(e, n);
|
|
156
198
|
if (Object.getOwnPropertySymbols) {
|
|
157
199
|
var a = Object.getOwnPropertySymbols(e);
|
|
158
200
|
for (t = 0; t < a.length; t++) {
|
|
@@ -161,7 +203,7 @@
|
|
|
161
203
|
}
|
|
162
204
|
return i;
|
|
163
205
|
}
|
|
164
|
-
function
|
|
206
|
+
function h(e, n) {
|
|
165
207
|
if (null == e) return {};
|
|
166
208
|
var r = {};
|
|
167
209
|
for (var t in e) {
|
|
@@ -172,132 +214,127 @@
|
|
|
172
214
|
}
|
|
173
215
|
return r;
|
|
174
216
|
}
|
|
175
|
-
var
|
|
176
|
-
var
|
|
177
|
-
var
|
|
178
|
-
var P = function e(n) {
|
|
179
|
-
return n != null && x.test(n);
|
|
180
|
-
};
|
|
217
|
+
var w = /^[a-z0-9]+:/;
|
|
218
|
+
var x = /^\/\//;
|
|
219
|
+
var P = /^\//;
|
|
181
220
|
var S = function e(n) {
|
|
182
|
-
return n != null &&
|
|
221
|
+
return n != null && P.test(n);
|
|
222
|
+
};
|
|
223
|
+
var j = function e(n) {
|
|
224
|
+
return n != null && !w.test(n) && !x.test(n);
|
|
183
225
|
};
|
|
184
|
-
var
|
|
185
|
-
children:
|
|
186
|
-
disabled:
|
|
187
|
-
elementRef:
|
|
188
|
-
onClick:
|
|
189
|
-
openInNewContext:
|
|
190
|
-
navigationLabel:
|
|
191
|
-
to:
|
|
226
|
+
var L = {
|
|
227
|
+
children: s().node,
|
|
228
|
+
disabled: s().oneOfType([ s().bool, s().oneOf([ "dimmed", "disabled" ]) ]),
|
|
229
|
+
elementRef: s().oneOfType([ s().func, s().object ]),
|
|
230
|
+
onClick: s().func,
|
|
231
|
+
openInNewContext: s().bool,
|
|
232
|
+
navigationLabel: s().string,
|
|
233
|
+
to: s().oneOfType([ s().string, s().oneOf([ undefined ]) ])
|
|
192
234
|
};
|
|
193
|
-
function
|
|
235
|
+
function I(e, n) {
|
|
194
236
|
return e !== "button" && n !== undefined;
|
|
195
237
|
}
|
|
196
238
|
/**
|
|
197
239
|
* `Clickable` renders as a `button` element, or as an `a` element if the `to` prop is set
|
|
198
240
|
* and the `disabled` prop is `false`. This is called link mode.
|
|
199
|
-
*/ var
|
|
241
|
+
*/ var R = t().forwardRef((function(e,
|
|
200
242
|
// SUI-7623 - needs to be specified for react-docgen versions less than 7.1.0
|
|
201
243
|
n) {
|
|
202
|
-
var i = e.children, a = e.disabled,
|
|
244
|
+
var i = e.children, a = e.disabled, o = e.elementRef, u = e.navigationLabel, s = e.onClick, f = e.openInNewContext, c = e.tag, b = e.to, p = O(e, [ "children", "disabled", "elementRef", "navigationLabel", "onClick", "openInNewContext", "tag", "to" ]);
|
|
203
245
|
// @docs-props-type ClickablePropsBase
|
|
204
|
-
var y = (0, r.useContext)(m),
|
|
246
|
+
var y = (0, r.useContext)(m), h = y.onClick, w = y.onLinkClick, x = y.transformUrl;
|
|
205
247
|
(0, r.useEffect)((function() {
|
|
206
248
|
if (false) {}
|
|
207
249
|
// this effect only runs once
|
|
208
250
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
209
251
|
}), []);
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}), [
|
|
252
|
+
var P = (0, r.useCallback)((function(e) {
|
|
253
|
+
g(o, e);
|
|
254
|
+
g(n, e);
|
|
255
|
+
}), [ o, n ]);
|
|
214
256
|
// memoizing this result causes TS to lose track of the type guard established by isLinkCheck
|
|
215
|
-
var
|
|
257
|
+
var L = I(c, b);
|
|
216
258
|
// ideally we wouldn't need to pass "to" as "toValue" here
|
|
217
259
|
// but without doing that TS thinks the return value of this is
|
|
218
260
|
// string | undefined which doesn't work for usages of this function
|
|
219
|
-
var
|
|
220
|
-
return
|
|
221
|
-
isInternal:
|
|
222
|
-
isRootRelative:
|
|
261
|
+
var R = (0, r.useCallback)((function(e) {
|
|
262
|
+
return x != null ? x(e, {
|
|
263
|
+
isInternal: j(e),
|
|
264
|
+
isRootRelative: S(e)
|
|
223
265
|
}) : e;
|
|
224
|
-
}), [
|
|
225
|
-
var
|
|
226
|
-
if (
|
|
266
|
+
}), [ x ]);
|
|
267
|
+
var T = (0, r.useCallback)((function(e) {
|
|
268
|
+
if (L) {
|
|
227
269
|
// when user command-click on mac or ctrl-click on other platforms, and
|
|
228
270
|
// Tag is an <a>, let the click pass through, let the <a> to achieve user's
|
|
229
271
|
// intent of 'open in new context'
|
|
230
272
|
// on mac, ctrl-click will be caught and open option menu even before hitting
|
|
231
273
|
// the DOM, so we're safe to check both metaKey and ctrlKey here
|
|
232
274
|
// without platform sniffing
|
|
233
|
-
if ((e.metaKey || e.ctrlKey) &&
|
|
275
|
+
if ((e.metaKey || e.ctrlKey) && b) {
|
|
234
276
|
return;
|
|
235
277
|
}
|
|
236
278
|
}
|
|
237
|
-
|
|
238
|
-
var n =
|
|
239
|
-
if (
|
|
279
|
+
s === null || s === void 0 ? void 0 : s(e);
|
|
280
|
+
var n = s == null && h != null;
|
|
281
|
+
if (L && (n || w != null)) {
|
|
240
282
|
var r = u;
|
|
241
|
-
if (!r &&
|
|
283
|
+
if (!r && l()(i)) {
|
|
242
284
|
r = i;
|
|
243
285
|
}
|
|
244
286
|
var t = {
|
|
245
|
-
to:
|
|
246
|
-
originalTo:
|
|
247
|
-
openInNewContext:
|
|
287
|
+
to: R(b),
|
|
288
|
+
originalTo: b,
|
|
289
|
+
openInNewContext: f,
|
|
248
290
|
label: r
|
|
249
291
|
};
|
|
250
292
|
if (n) {
|
|
251
|
-
|
|
293
|
+
h(e, t);
|
|
252
294
|
}
|
|
253
|
-
|
|
295
|
+
w === null || w === void 0 ? void 0 : w(e, t);
|
|
254
296
|
}
|
|
255
|
-
}), [ i,
|
|
256
|
-
|
|
257
|
-
|
|
297
|
+
}), [ i, R, L, u, s, h, w, f, b ]);
|
|
298
|
+
var q = k(a), D = q.isDisabled, N = q.disabledValue;
|
|
299
|
+
if (L) {
|
|
300
|
+
if (D) {
|
|
258
301
|
|
|
259
|
-
return t().createElement(
|
|
302
|
+
return t().createElement(v, C({
|
|
260
303
|
"data-test": "clickable",
|
|
261
|
-
"data-test-disabled":
|
|
262
|
-
ref:
|
|
304
|
+
"data-test-disabled": N,
|
|
305
|
+
ref: P,
|
|
263
306
|
role: "link",
|
|
264
307
|
"aria-disabled": "true"
|
|
265
308
|
}, p), i);
|
|
266
309
|
}
|
|
267
|
-
var
|
|
268
|
-
var
|
|
310
|
+
var _ = f ? "_blank" : undefined;
|
|
311
|
+
var E = f && j(b) ? "noopener noreferrer" : undefined;
|
|
269
312
|
|
|
270
|
-
return t().createElement(
|
|
313
|
+
return t().createElement(v, C({
|
|
271
314
|
"data-test": "clickable",
|
|
272
|
-
ref:
|
|
273
|
-
href:
|
|
274
|
-
target:
|
|
275
|
-
rel:
|
|
276
|
-
onClick:
|
|
315
|
+
ref: P,
|
|
316
|
+
href: R(b),
|
|
317
|
+
target: _,
|
|
318
|
+
rel: E,
|
|
319
|
+
onClick: T
|
|
277
320
|
}, d()(p)), i);
|
|
278
321
|
}
|
|
279
322
|
// button variant
|
|
280
|
-
var
|
|
281
|
-
var _;
|
|
282
|
-
if (N) {
|
|
283
|
-
_ = "dimmed";
|
|
284
|
-
} else if (a === "disabled") {
|
|
285
|
-
_ = "disabled";
|
|
286
|
-
}
|
|
323
|
+
var V = a === true || a === "dimmed" || undefined;
|
|
287
324
|
|
|
288
|
-
return t().createElement(
|
|
325
|
+
return t().createElement(v, C({
|
|
289
326
|
as: "button",
|
|
290
|
-
"aria-disabled":
|
|
327
|
+
"aria-disabled": V,
|
|
291
328
|
"data-test": "clickable",
|
|
292
|
-
"data-test-disabled":
|
|
293
|
-
ref:
|
|
329
|
+
"data-test-disabled": N,
|
|
330
|
+
ref: P,
|
|
294
331
|
type: "button",
|
|
295
332
|
disabled: a === "disabled",
|
|
296
|
-
onClick:
|
|
333
|
+
onClick: D ? undefined : T
|
|
297
334
|
}, d()(p, "disabled")), i);
|
|
298
335
|
}));
|
|
299
|
-
|
|
300
|
-
/* harmony default export */ const
|
|
336
|
+
R.propTypes = L;
|
|
337
|
+
/* harmony default export */ const T = R;
|
|
301
338
|
// forwardRef appears to prevent TS from inferring ClickableProps in components that import Clickable
|
|
302
339
|
// so we need to export it separately to prevent the TS build from failing with:
|
|
303
340
|
// "... has or is using name 'ClickablePropsBase' from external module "...packages/react-ui/src/Clickable/Clickable" but cannot be named."
|