@splunk/react-ui 5.2.0 → 5.3.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/Avatar.js +57 -52
- package/Box.js +2 -1
- package/CHANGELOG.md +31 -0
- package/Calendar.js +8 -4
- package/Checkbox.d.ts +2 -0
- package/Checkbox.js +350 -0
- package/Code.js +151 -132
- package/CollapsiblePanel.js +184 -210
- package/Color.js +4 -2
- package/ControlGroup.js +2 -1
- package/Date.js +123 -119
- package/DefinitionList.js +100 -77
- package/Dropdown.js +2 -2
- package/DualListbox.js +409 -353
- package/File.js +102 -99
- package/JSONTree.js +317 -303
- package/Link.js +11 -11
- package/MIGRATION.md +27 -0
- package/Markdown.js +162 -151
- package/Menu.js +44 -42
- package/Modal.js +3 -3
- package/Multiselect.js +454 -435
- package/Paginator.js +2 -1
- package/ResultsMenu.js +2 -1
- package/Scroll.js +2 -1
- package/Search.js +131 -127
- package/Select.js +3 -2
- package/Switch.js +197 -229
- package/Table.js +24 -16
- package/Text.js +180 -206
- package/TextArea.js +233 -224
- package/Tooltip.js +144 -139
- package/package.json +9 -10
- package/tsconfig.check-docs.json +8 -0
- package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
- package/types/src/Checkbox/Checkbox.d.ts +90 -0
- package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
- package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
- package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
- package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
- package/types/src/Checkbox/index.d.ts +2 -0
- package/types/src/Code/Code.d.ts +4 -1
- package/types/src/Code/LineHighlights.d.ts +1 -0
- package/types/src/Code/LineNumbers.d.ts +2 -1
- package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
- package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
- package/types/src/Date/Date.d.ts +7 -1
- package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
- package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
- package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
- package/types/src/DualListbox/DualListbox.d.ts +1 -1
- package/types/src/DualListbox/Label.d.ts +7 -7
- package/types/src/DualListbox/Listbox.d.ts +2 -2
- package/types/src/DualListbox/ListboxContext.d.ts +1 -1
- package/types/src/File/File.d.ts +7 -1
- package/types/src/JSONTree/JSONTreeItem.d.ts +4 -2
- package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
- package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
- package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
- package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
- package/types/src/Multiselect/Compact.d.ts +7 -1
- package/types/src/Multiselect/Multiselect.d.ts +7 -1
- package/types/src/Multiselect/Normal.d.ts +7 -1
- package/types/src/Search/Search.d.ts +5 -1
- package/types/src/Switch/Switch.d.ts +7 -1
- package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
- package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
- package/types/src/Table/ExpandButton.d.ts +1 -1
- package/types/src/Tooltip/Tooltip.d.ts +14 -1
- package/NonInteractiveCheckbox.js +0 -101
- package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
- package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
- package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
- package/types/src/Switch/docs/examples/Error.d.ts +0 -6
- package/types/src/Text/IconOutlinedHide.d.ts +0 -3
- package/types/src/Text/IconOutlinedView.d.ts +0 -3
- /package/cypress/{tsconfig.cypress.json → tsconfig.check-cypress.json} +0 -0
package/Checkbox.js
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/******/ (() => {
|
|
2
|
+
// webpackBootstrap
|
|
3
|
+
/******/ "use strict";
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
9
|
+
/******/ (() => {
|
|
10
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
|
+
/******/ e.n = r => {
|
|
12
|
+
/******/ var o = r && r.__esModule ?
|
|
13
|
+
/******/ () => r["default"]
|
|
14
|
+
/******/ : () => r
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(o, {
|
|
17
|
+
a: o
|
|
18
|
+
});
|
|
19
|
+
/******/ return o;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (r, o) => {
|
|
27
|
+
/******/ for (var t in o) {
|
|
28
|
+
/******/ if (e.o(o, t) && !e.o(r, t)) {
|
|
29
|
+
/******/ Object.defineProperty(r, t, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: o[t]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
41
|
+
/******/;
|
|
42
|
+
})();
|
|
43
|
+
/******/
|
|
44
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
45
|
+
/******/ (() => {
|
|
46
|
+
/******/ // define __esModule on exports
|
|
47
|
+
/******/ e.r = e => {
|
|
48
|
+
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
49
|
+
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
50
|
+
value: "Module"
|
|
51
|
+
});
|
|
52
|
+
/******/ }
|
|
53
|
+
/******/ Object.defineProperty(e, "__esModule", {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
56
|
+
/******/ };
|
|
57
|
+
/******/ })();
|
|
58
|
+
/******/
|
|
59
|
+
/************************************************************************/ var r = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(r);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(r, {
|
|
64
|
+
default: () => /* reexport */ T
|
|
65
|
+
});
|
|
66
|
+
// CONCATENATED MODULE: external "react"
|
|
67
|
+
const o = require("react");
|
|
68
|
+
var t = e.n(o);
|
|
69
|
+
// CONCATENATED MODULE: external "lodash/pickBy"
|
|
70
|
+
const n = require("lodash/pickBy");
|
|
71
|
+
var a = e.n(n);
|
|
72
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
73
|
+
const i = require("prop-types");
|
|
74
|
+
var l = e.n(i);
|
|
75
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
76
|
+
const c = require("@splunk/ui-utils/id");
|
|
77
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
78
|
+
const s = require("styled-components");
|
|
79
|
+
var d = e.n(s);
|
|
80
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/CheckBoxCompleted"
|
|
81
|
+
const u = require("@splunk/react-icons/CheckBoxCompleted");
|
|
82
|
+
var b = e.n(u);
|
|
83
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/CheckBoxIndeterminate"
|
|
84
|
+
const v = require("@splunk/react-icons/CheckBoxIndeterminate");
|
|
85
|
+
var f = e.n(v);
|
|
86
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
87
|
+
const p = require("@splunk/themes");
|
|
88
|
+
// CONCATENATED MODULE: ./src/Checkbox/CheckboxStyles.ts
|
|
89
|
+
var y = "5 5 16 16";
|
|
90
|
+
var h = "20px";
|
|
91
|
+
var m = d().input.attrs({
|
|
92
|
+
type: "checkbox"
|
|
93
|
+
}).withConfig({
|
|
94
|
+
displayName: "CheckboxStyles__StyledCheckbox",
|
|
95
|
+
componentId: "sc-1yo50j-0"
|
|
96
|
+
})([ "height:100%;margin:0;opacity:0;position:absolute;width:100%;cursor:pointer;&:disabled{cursor:not-allowed;}" ]);
|
|
97
|
+
var g = (0, s.css)([ "display:none;height:", ";width:", ";" ], h, h);
|
|
98
|
+
var k = d()(b()).attrs({
|
|
99
|
+
viewBox: y
|
|
100
|
+
}).withConfig({
|
|
101
|
+
displayName: "CheckboxStyles__StyledCheckIcon",
|
|
102
|
+
componentId: "sc-1yo50j-1"
|
|
103
|
+
})([ "", "" ], g);
|
|
104
|
+
var C = d()(f()).attrs({
|
|
105
|
+
viewBox: y
|
|
106
|
+
}).withConfig({
|
|
107
|
+
displayName: "CheckboxStyles__StyledIndeterminateIcon",
|
|
108
|
+
componentId: "sc-1yo50j-2"
|
|
109
|
+
})([ "", "" ], g);
|
|
110
|
+
var O = d().div.withConfig({
|
|
111
|
+
displayName: "CheckboxStyles__StyledCheckboxWrapper",
|
|
112
|
+
componentId: "sc-1yo50j-3"
|
|
113
|
+
})([ "display:inline-block;box-sizing:border-box;position:relative;width:", ";height:", ";line-height:", ";border-radius:", ";border:", " solid ", ";background-color:", ";cursor:pointer;flex:0 0 auto;&:has(", ":checked){", "{display:block;}}&:has(", ":indeterminate){", "{display:block;}}&:has(", ":focus){box-shadow:", ";}color:", ";", " &:has(", ":disabled){border-color:", ";background-color:", ";color:", ";cursor:not-allowed;&:has(", ":where(:checked,:indeterminate)){background-color:", ";border-color:", ";}}" ], h, h, h, p.variables.borderRadius, p.variables.inputBorderWidth, p.variables.interactiveColorBorder, p.variables.interactiveColorBackground, m, k, m, C, m, p.variables.focusShadow, (0,
|
|
114
|
+
p.pick)({
|
|
115
|
+
light: p.variables.white,
|
|
116
|
+
dark: p.variables.black
|
|
117
|
+
}), (function(e) {
|
|
118
|
+
var r = e.$error;
|
|
119
|
+
if (r) {
|
|
120
|
+
return (0, s.css)([ "border-color:", ";&:has(", ":where(:checked,:indeterminate)){background-color:", ";}" ], p.variables.interactiveColorAccentError, m, p.variables.interactiveColorAccentError);
|
|
121
|
+
}
|
|
122
|
+
return (0, s.css)([ "&:has(", ":where(:checked,:indeterminate)){background-color:", ";border-color:", ";}" ], m, p.variables.interactiveColorAccent, p.variables.interactiveColorAccent);
|
|
123
|
+
}), m, p.variables.interactiveColorBorderDisabled, p.variables.interactiveColorBackgroundDisabled, p.variables.contentColorDisabled, m, p.variables.neutral100, p.variables.interactiveColorBackgroundDisabled);
|
|
124
|
+
var w = d().label.withConfig({
|
|
125
|
+
displayName: "CheckboxStyles__StyledLabel",
|
|
126
|
+
componentId: "sc-1yo50j-4"
|
|
127
|
+
})([ "cursor:inherit;" ]);
|
|
128
|
+
var x = d().div.withConfig({
|
|
129
|
+
displayName: "CheckboxStyles__StyledWrapper",
|
|
130
|
+
componentId: "sc-1yo50j-5"
|
|
131
|
+
})([ "", ";position:relative;flex-shrink:0;gap:", ";min-height:", ";align-items:center;color:", ";cursor:pointer;:has(", ":disabled){color:", ";cursor:not-allowed;}&:not(:has(", ":disabled)){&:hover ", "{", "}}" ], p.mixins.reset("flex"), p.variables.spacingSmall, p.variables.inputHeight, p.variables.contentColorActive, m, p.variables.contentColorDisabled, m, O, (function(e) {
|
|
132
|
+
var r = e.$error;
|
|
133
|
+
if (r) {
|
|
134
|
+
return (0, s.css)([ ":has(", ":where(:checked,:indeterminate)){background-color:", ";border-color:", ";}border-color:", ";background-color:", ";" ], m, p.variables.interactiveColorAccentError, p.variables.interactiveColorAccentError, p.mixins.overlayColors(p.variables.interactiveColorAccentError, p.variables.interactiveColorBorderHover), p.mixins.overlayColors(p.variables.interactiveColorBackground, p.variables.interactiveColorOverlayHover));
|
|
135
|
+
}
|
|
136
|
+
return (0, s.css)([ ":has(", ":where(:checked,:indeterminate)){background-color:", ";border-color:", ";}border-color:", ";background-color:", ";" ], m, p.mixins.overlayColors(p.variables.interactiveColorAccent, p.variables.interactiveColorOverlayHover), p.variables.interactiveColorAccent, p.variables.interactiveColorBorderHover, p.mixins.overlayColors(p.variables.interactiveColorBackground, p.variables.interactiveColorOverlayHover));
|
|
137
|
+
}));
|
|
138
|
+
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
139
|
+
/**
|
|
140
|
+
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
141
|
+
*
|
|
142
|
+
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
143
|
+
* @param current - The new value of the ref.
|
|
144
|
+
*/
|
|
145
|
+
function j(e, r) {
|
|
146
|
+
if (e) {
|
|
147
|
+
if (typeof e === "function") {
|
|
148
|
+
e(r);
|
|
149
|
+
} else {
|
|
150
|
+
// the public signature of this util uses React.Ref<T> to mirror the way React types refs.
|
|
151
|
+
// the intention here is to signal "we will take care of setting 'current', not you".
|
|
152
|
+
e.current = r;
|
|
153
|
+
// eslint-disable-line no-param-reassign
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// CONCATENATED MODULE: ./src/Checkbox/Checkbox.tsx
|
|
158
|
+
function S(e) {
|
|
159
|
+
"@babel/helpers - typeof";
|
|
160
|
+
return S = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
161
|
+
return typeof e;
|
|
162
|
+
} : function(e) {
|
|
163
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
164
|
+
}, S(e);
|
|
165
|
+
}
|
|
166
|
+
function B() {
|
|
167
|
+
return B = Object.assign ? Object.assign.bind() : function(e) {
|
|
168
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
169
|
+
var o = arguments[r];
|
|
170
|
+
for (var t in o) {
|
|
171
|
+
({}).hasOwnProperty.call(o, t) && (e[t] = o[t]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return e;
|
|
175
|
+
}, B.apply(null, arguments);
|
|
176
|
+
}
|
|
177
|
+
function P(e, r) {
|
|
178
|
+
var o = Object.keys(e);
|
|
179
|
+
if (Object.getOwnPropertySymbols) {
|
|
180
|
+
var t = Object.getOwnPropertySymbols(e);
|
|
181
|
+
r && (t = t.filter((function(r) {
|
|
182
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
183
|
+
}))), o.push.apply(o, t);
|
|
184
|
+
}
|
|
185
|
+
return o;
|
|
186
|
+
}
|
|
187
|
+
function E(e) {
|
|
188
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
189
|
+
var o = null != arguments[r] ? arguments[r] : {};
|
|
190
|
+
r % 2 ? P(Object(o), !0).forEach((function(r) {
|
|
191
|
+
I(e, r, o[r]);
|
|
192
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : P(Object(o)).forEach((function(r) {
|
|
193
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(o, r));
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
return e;
|
|
197
|
+
}
|
|
198
|
+
function I(e, r, o) {
|
|
199
|
+
return (r = _(r)) in e ? Object.defineProperty(e, r, {
|
|
200
|
+
value: o,
|
|
201
|
+
enumerable: !0,
|
|
202
|
+
configurable: !0,
|
|
203
|
+
writable: !0
|
|
204
|
+
}) : e[r] = o, e;
|
|
205
|
+
}
|
|
206
|
+
function _(e) {
|
|
207
|
+
var r = D(e, "string");
|
|
208
|
+
return "symbol" == S(r) ? r : r + "";
|
|
209
|
+
}
|
|
210
|
+
function D(e, r) {
|
|
211
|
+
if ("object" != S(e) || !e) return e;
|
|
212
|
+
var o = e[Symbol.toPrimitive];
|
|
213
|
+
if (void 0 !== o) {
|
|
214
|
+
var t = o.call(e, r || "default");
|
|
215
|
+
if ("object" != S(t)) return t;
|
|
216
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
217
|
+
}
|
|
218
|
+
return ("string" === r ? String : Number)(e);
|
|
219
|
+
}
|
|
220
|
+
function q(e, r) {
|
|
221
|
+
if (null == e) return {};
|
|
222
|
+
var o, t, n = A(e, r);
|
|
223
|
+
if (Object.getOwnPropertySymbols) {
|
|
224
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
225
|
+
for (t = 0; t < a.length; t++) {
|
|
226
|
+
o = a[t], -1 === r.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (n[o] = e[o]);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return n;
|
|
230
|
+
}
|
|
231
|
+
function A(e, r) {
|
|
232
|
+
if (null == e) return {};
|
|
233
|
+
var o = {};
|
|
234
|
+
for (var t in e) {
|
|
235
|
+
if ({}.hasOwnProperty.call(e, t)) {
|
|
236
|
+
if (-1 !== r.indexOf(t)) continue;
|
|
237
|
+
o[t] = e[t];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return o;
|
|
241
|
+
}
|
|
242
|
+
/** @public */ var M = {
|
|
243
|
+
checked: l().oneOf([ true, false, "indeterminate" ]),
|
|
244
|
+
children: l().node,
|
|
245
|
+
defaultChecked: l().bool,
|
|
246
|
+
describedBy: l().string,
|
|
247
|
+
disabled: l().bool,
|
|
248
|
+
elementRef: l().oneOfType([ l().func, l().object ]),
|
|
249
|
+
error: l().bool,
|
|
250
|
+
inert: l().bool,
|
|
251
|
+
inputRef: l().oneOfType([ l().func, l().object ]),
|
|
252
|
+
labelledBy: l().string,
|
|
253
|
+
name: l().string,
|
|
254
|
+
onChange: l().func,
|
|
255
|
+
/** @private. */
|
|
256
|
+
required: l().bool
|
|
257
|
+
};
|
|
258
|
+
var R = function e(r) {
|
|
259
|
+
var n = r.checked, i = r.children, l = r.defaultChecked, s = r.describedBy, d = r.disabled, u = r.elementRef, b = r.error, v = r.id, f = r.inert, p = r.inputRef, y = r.labelledBy, h = r.name, g = r.onChange, S = r.required, P = r.role, I = r.tabIndex, _ = r.value, D = q(r, [ "checked", "children", "defaultChecked", "describedBy", "disabled", "elementRef", "error", "id", "inert", "inputRef", "labelledBy", "name", "onChange", "required", "role", "tabIndex", "value" ]);
|
|
260
|
+
// @docs-props-type CheckboxPropsBase
|
|
261
|
+
// this component intentionally does not use useControlled because it uses React's checked/defaultChecked built-in instead
|
|
262
|
+
// https://react.dev/reference/react-dom/components/input#providing-an-initial-value-for-an-input
|
|
263
|
+
var A = (0, o.useCallback)((function(e) {
|
|
264
|
+
g === null || g === void 0 ? void 0 : g(e, {
|
|
265
|
+
checked: e.currentTarget.checked,
|
|
266
|
+
name: h,
|
|
267
|
+
value: e.currentTarget.value
|
|
268
|
+
});
|
|
269
|
+
}), [ h, g ]);
|
|
270
|
+
// If has internal label defined with children, must have an id and must use generated labelId.
|
|
271
|
+
// Otherwise, use customer defined id and external label.
|
|
272
|
+
var M = (0, o.useMemo)((function() {
|
|
273
|
+
return i && v == null ? (0, c.createDOMID)("checkbox-input") : v;
|
|
274
|
+
}), [ i, v ]);
|
|
275
|
+
var R = (0, o.useMemo)((function() {
|
|
276
|
+
return i ? (0, c.createDOMID)("checkbox-label") : y;
|
|
277
|
+
}), [ i, y ]);
|
|
278
|
+
var T = (0, o.useRef)(null);
|
|
279
|
+
var N = (0, o.useCallback)((function(e) {
|
|
280
|
+
j(T, e);
|
|
281
|
+
j(p, e);
|
|
282
|
+
}), [ p, T ]);
|
|
283
|
+
// useLayoutEffect is necessary to ensure that the checkbox is set to indeterminate before the browser paints
|
|
284
|
+
(0, o.useLayoutEffect)((function() {
|
|
285
|
+
if (T.current) {
|
|
286
|
+
// input type="checkbox" does not support indeterminate directly on the value prop - it needs to be set via JS
|
|
287
|
+
T.current.indeterminate = n === "indeterminate";
|
|
288
|
+
}
|
|
289
|
+
}), [ n ]);
|
|
290
|
+
var H = (0, o.useMemo)((function() {
|
|
291
|
+
return E(E({}, a()(D, (function(e, r) {
|
|
292
|
+
return r === "role" || r.indexOf("aria-") === 0;
|
|
293
|
+
}))), {}, {
|
|
294
|
+
"aria-describedby": s,
|
|
295
|
+
"aria-labelledby": R,
|
|
296
|
+
"aria-invalid": b || undefined
|
|
297
|
+
});
|
|
298
|
+
}), [ s, b, R, D ]);
|
|
299
|
+
var $ = {};
|
|
300
|
+
// a checkbox's value defaults to "on" if no value is passed
|
|
301
|
+
// so we cannot pass a value attribute if it is not specified
|
|
302
|
+
// to avoid overwriting the default when value is not set
|
|
303
|
+
if (_ != null) {
|
|
304
|
+
$.value = _;
|
|
305
|
+
}
|
|
306
|
+
// using React's checked/defaultChecked built-in, we cannot pass both props at once
|
|
307
|
+
if (n != null) {
|
|
308
|
+
// checked="indeterminate" is not a value Checkbox supports so handle it here
|
|
309
|
+
// specifically avoiding !!checked because Firefox will match :checked against an indeterminate checkbox with checked={true}
|
|
310
|
+
// this appears incorrect according to the spec: https://html.spec.whatwg.org/multipage/input.html#checkbox-state-(type=checkbox)
|
|
311
|
+
// which says: "If the element's indeterminate IDL attribute is set to true,
|
|
312
|
+
// then the control's selection should be obscured as if the control was in a third, indeterminate, state."
|
|
313
|
+
$.checked = n === true;
|
|
314
|
+
} else if (l != null) {
|
|
315
|
+
$.defaultChecked = l;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return t().createElement(x, B({
|
|
319
|
+
"data-test": "checkbox",
|
|
320
|
+
"data-test-checked": n,
|
|
321
|
+
"data-test-disabled": d ? "disabled" : undefined,
|
|
322
|
+
"data-test-error": b ? true : undefined,
|
|
323
|
+
"data-test-value": _,
|
|
324
|
+
$error: b,
|
|
325
|
+
ref: u
|
|
326
|
+
}, D), t().createElement(O, {
|
|
327
|
+
$error: b
|
|
328
|
+
}, t().createElement(m, B({
|
|
329
|
+
disabled: d,
|
|
330
|
+
"data-test": f ? "presentation-toggle" : "toggle",
|
|
331
|
+
id: M,
|
|
332
|
+
inert: f ? "true" : undefined,
|
|
333
|
+
name: h,
|
|
334
|
+
onChange: A,
|
|
335
|
+
ref: N,
|
|
336
|
+
required: S,
|
|
337
|
+
role: f ? "presentation" : P,
|
|
338
|
+
tabIndex: I,
|
|
339
|
+
type: "checkbox"
|
|
340
|
+
}, H, $)), t().createElement(k, null), t().createElement(C, null)), i && t().createElement(w, {
|
|
341
|
+
"data-test": "label",
|
|
342
|
+
htmlFor: M,
|
|
343
|
+
id: R
|
|
344
|
+
}, i));
|
|
345
|
+
};
|
|
346
|
+
R.propTypes = M;
|
|
347
|
+
/* harmony default export */ const T = R;
|
|
348
|
+
// CONCATENATED MODULE: ./src/Checkbox/index.ts
|
|
349
|
+
module.exports = r;
|
|
350
|
+
/******/})();
|