@react-spectrum/checkbox 3.0.0-nightly.2519 → 3.0.0-nightly.2534
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/dist/import.mjs +79 -41
- package/dist/main.js +77 -39
- package/dist/main.js.map +1 -1
- package/dist/module.js +79 -41
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/Checkbox.tsx +4 -4
- package/src/CheckboxGroup.tsx +3 -5
package/dist/import.mjs
CHANGED
|
@@ -5,19 +5,84 @@ import $gpy1V$spectrumiconsuiDashSmall from "@spectrum-icons/ui/DashSmall";
|
|
|
5
5
|
import {FocusRing as $gpy1V$FocusRing} from "@react-aria/focus";
|
|
6
6
|
import $gpy1V$react, {useRef as $gpy1V$useRef, useContext as $gpy1V$useContext, forwardRef as $gpy1V$forwardRef} from "react";
|
|
7
7
|
import {useCheckboxGroupItem as $gpy1V$useCheckboxGroupItem, useCheckbox as $gpy1V$useCheckbox, useCheckboxGroup as $gpy1V$useCheckboxGroup} from "@react-aria/checkbox";
|
|
8
|
+
import {useFormProps as $gpy1V$useFormProps} from "@react-spectrum/form";
|
|
8
9
|
import {useHover as $gpy1V$useHover} from "@react-aria/interactions";
|
|
9
10
|
import {useProviderProps as $gpy1V$useProviderProps, Provider as $gpy1V$Provider} from "@react-spectrum/provider";
|
|
10
11
|
import {useToggleState as $gpy1V$useToggleState} from "@react-stately/toggle";
|
|
11
12
|
import {Field as $gpy1V$Field} from "@react-spectrum/label";
|
|
12
13
|
import {useCheckboxGroupState as $gpy1V$useCheckboxGroupState} from "@react-stately/checkbox";
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function $parcel$export(e, n, v, s) {
|
|
17
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
function $parcel$interopDefault(a) {
|
|
16
21
|
return a && a.__esModule ? a.default : a;
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
var $parcel$global = globalThis;
|
|
25
|
+
|
|
26
|
+
var $parcel$modules = {};
|
|
27
|
+
var $parcel$inits = {};
|
|
28
|
+
|
|
29
|
+
var parcelRequire = $parcel$global["parcelRequire7f0c"];
|
|
30
|
+
|
|
31
|
+
if (parcelRequire == null) {
|
|
32
|
+
parcelRequire = function(id) {
|
|
33
|
+
if (id in $parcel$modules) {
|
|
34
|
+
return $parcel$modules[id].exports;
|
|
35
|
+
}
|
|
36
|
+
if (id in $parcel$inits) {
|
|
37
|
+
var init = $parcel$inits[id];
|
|
38
|
+
delete $parcel$inits[id];
|
|
39
|
+
var module = {id: id, exports: {}};
|
|
40
|
+
$parcel$modules[id] = module;
|
|
41
|
+
init.call(module.exports, module, module.exports);
|
|
42
|
+
return module.exports;
|
|
43
|
+
}
|
|
44
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
45
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
46
|
+
throw err;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
parcelRequire.register = function register(id, init) {
|
|
50
|
+
$parcel$inits[id] = init;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
$parcel$global["parcelRequire7f0c"] = parcelRequire;
|
|
20
54
|
}
|
|
55
|
+
|
|
56
|
+
var parcelRegister = parcelRequire.register;
|
|
57
|
+
parcelRegister("6Agev", function(module, exports) {
|
|
58
|
+
|
|
59
|
+
$parcel$export(module.exports, "focus-ring", () => $4cb2b26710154c56$export$f39a09f249340e2a, (v) => $4cb2b26710154c56$export$f39a09f249340e2a = v);
|
|
60
|
+
$parcel$export(module.exports, "i18nFontFamily", () => $4cb2b26710154c56$export$8c4ee2c50c22c514, (v) => $4cb2b26710154c56$export$8c4ee2c50c22c514 = v);
|
|
61
|
+
$parcel$export(module.exports, "spectrum-FieldGroup", () => $4cb2b26710154c56$export$75eb16cbfc18279c, (v) => $4cb2b26710154c56$export$75eb16cbfc18279c = v);
|
|
62
|
+
$parcel$export(module.exports, "spectrum-FieldGroup-group", () => $4cb2b26710154c56$export$984c7bbbfc7ddffc, (v) => $4cb2b26710154c56$export$984c7bbbfc7ddffc = v);
|
|
63
|
+
$parcel$export(module.exports, "spectrum-FieldGroup-group--horizontal", () => $4cb2b26710154c56$export$1ad8646bcba21c0e, (v) => $4cb2b26710154c56$export$1ad8646bcba21c0e = v);
|
|
64
|
+
$parcel$export(module.exports, "spectrum-FocusRing-ring", () => $4cb2b26710154c56$export$4109102f950813a6, (v) => $4cb2b26710154c56$export$4109102f950813a6 = v);
|
|
65
|
+
$parcel$export(module.exports, "spectrum-FocusRing", () => $4cb2b26710154c56$export$24c7f46a6e3605dd, (v) => $4cb2b26710154c56$export$24c7f46a6e3605dd = v);
|
|
66
|
+
$parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $4cb2b26710154c56$export$2927016961429360, (v) => $4cb2b26710154c56$export$2927016961429360 = v);
|
|
67
|
+
var $4cb2b26710154c56$export$f39a09f249340e2a;
|
|
68
|
+
var $4cb2b26710154c56$export$8c4ee2c50c22c514;
|
|
69
|
+
var $4cb2b26710154c56$export$75eb16cbfc18279c;
|
|
70
|
+
var $4cb2b26710154c56$export$984c7bbbfc7ddffc;
|
|
71
|
+
var $4cb2b26710154c56$export$1ad8646bcba21c0e;
|
|
72
|
+
var $4cb2b26710154c56$export$4109102f950813a6;
|
|
73
|
+
var $4cb2b26710154c56$export$24c7f46a6e3605dd;
|
|
74
|
+
var $4cb2b26710154c56$export$2927016961429360;
|
|
75
|
+
$4cb2b26710154c56$export$f39a09f249340e2a = `hyn22G_focus-ring`;
|
|
76
|
+
$4cb2b26710154c56$export$8c4ee2c50c22c514 = `hyn22G_i18nFontFamily`;
|
|
77
|
+
$4cb2b26710154c56$export$75eb16cbfc18279c = `hyn22G_spectrum-FieldGroup`;
|
|
78
|
+
$4cb2b26710154c56$export$984c7bbbfc7ddffc = `hyn22G_spectrum-FieldGroup-group`;
|
|
79
|
+
$4cb2b26710154c56$export$1ad8646bcba21c0e = `hyn22G_spectrum-FieldGroup-group--horizontal`;
|
|
80
|
+
$4cb2b26710154c56$export$4109102f950813a6 = `hyn22G_spectrum-FocusRing-ring`;
|
|
81
|
+
$4cb2b26710154c56$export$24c7f46a6e3605dd = `hyn22G_spectrum-FocusRing ${$4cb2b26710154c56$export$4109102f950813a6}`;
|
|
82
|
+
$4cb2b26710154c56$export$2927016961429360 = `hyn22G_spectrum-FocusRing--quiet`;
|
|
83
|
+
|
|
84
|
+
});
|
|
85
|
+
|
|
21
86
|
/*
|
|
22
87
|
* Copyright 2020 Adobe. All rights reserved.
|
|
23
88
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -117,10 +182,12 @@ $fe1a56c62936037c$export$2927016961429360 = `ISsn1a_spectrum-FocusRing--quiet`;
|
|
|
117
182
|
|
|
118
183
|
|
|
119
184
|
|
|
185
|
+
|
|
120
186
|
function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
121
187
|
let originalProps = props;
|
|
122
188
|
props = (0, $gpy1V$useProviderProps)(props);
|
|
123
|
-
|
|
189
|
+
props = (0, $gpy1V$useFormProps)(props);
|
|
190
|
+
let { isIndeterminate: isIndeterminate = false, isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
124
191
|
let { styleProps: styleProps } = (0, $gpy1V$useStyleProps)(otherProps);
|
|
125
192
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $gpy1V$useHover)({
|
|
126
193
|
isDisabled: isDisabled
|
|
@@ -131,7 +198,7 @@ function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
|
131
198
|
// This is a bit unorthodox. Typically, hooks cannot be called in a conditional,
|
|
132
199
|
// but since the checkbox won't move in and out of a group, it should be safe.
|
|
133
200
|
let groupState = (0, $gpy1V$useContext)((0, $8c8ab388b155237e$export$baf37c4be89255b8));
|
|
134
|
-
let { inputProps: inputProps } = groupState ? (0, $gpy1V$useCheckboxGroupItem)({
|
|
201
|
+
let { inputProps: inputProps, isInvalid: isInvalid } = groupState ? (0, $gpy1V$useCheckboxGroupItem)({
|
|
135
202
|
...props,
|
|
136
203
|
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
137
204
|
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
@@ -164,7 +231,7 @@ function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
|
164
231
|
"is-checked": inputProps.checked,
|
|
165
232
|
"is-indeterminate": isIndeterminate,
|
|
166
233
|
"spectrum-Checkbox--quiet": !isEmphasized,
|
|
167
|
-
"is-invalid": isInvalid
|
|
234
|
+
"is-invalid": isInvalid,
|
|
168
235
|
"is-disabled": isDisabled,
|
|
169
236
|
"is-hovered": isHovered
|
|
170
237
|
}, styleProps.className)
|
|
@@ -202,34 +269,8 @@ function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
|
202
269
|
|
|
203
270
|
|
|
204
271
|
|
|
205
|
-
var $4cb2b26710154c56$exports = {};
|
|
206
|
-
|
|
207
|
-
$parcel$export($4cb2b26710154c56$exports, "focus-ring", () => $4cb2b26710154c56$export$f39a09f249340e2a, (v) => $4cb2b26710154c56$export$f39a09f249340e2a = v);
|
|
208
|
-
$parcel$export($4cb2b26710154c56$exports, "i18nFontFamily", () => $4cb2b26710154c56$export$8c4ee2c50c22c514, (v) => $4cb2b26710154c56$export$8c4ee2c50c22c514 = v);
|
|
209
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FieldGroup", () => $4cb2b26710154c56$export$75eb16cbfc18279c, (v) => $4cb2b26710154c56$export$75eb16cbfc18279c = v);
|
|
210
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FieldGroup-group", () => $4cb2b26710154c56$export$984c7bbbfc7ddffc, (v) => $4cb2b26710154c56$export$984c7bbbfc7ddffc = v);
|
|
211
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FieldGroup-group--horizontal", () => $4cb2b26710154c56$export$1ad8646bcba21c0e, (v) => $4cb2b26710154c56$export$1ad8646bcba21c0e = v);
|
|
212
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FocusRing-ring", () => $4cb2b26710154c56$export$4109102f950813a6, (v) => $4cb2b26710154c56$export$4109102f950813a6 = v);
|
|
213
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FocusRing", () => $4cb2b26710154c56$export$24c7f46a6e3605dd, (v) => $4cb2b26710154c56$export$24c7f46a6e3605dd = v);
|
|
214
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FocusRing--quiet", () => $4cb2b26710154c56$export$2927016961429360, (v) => $4cb2b26710154c56$export$2927016961429360 = v);
|
|
215
|
-
var $4cb2b26710154c56$export$f39a09f249340e2a;
|
|
216
|
-
var $4cb2b26710154c56$export$8c4ee2c50c22c514;
|
|
217
|
-
var $4cb2b26710154c56$export$75eb16cbfc18279c;
|
|
218
|
-
var $4cb2b26710154c56$export$984c7bbbfc7ddffc;
|
|
219
|
-
var $4cb2b26710154c56$export$1ad8646bcba21c0e;
|
|
220
|
-
var $4cb2b26710154c56$export$4109102f950813a6;
|
|
221
|
-
var $4cb2b26710154c56$export$24c7f46a6e3605dd;
|
|
222
|
-
var $4cb2b26710154c56$export$2927016961429360;
|
|
223
|
-
$4cb2b26710154c56$export$f39a09f249340e2a = `hyn22G_focus-ring`;
|
|
224
|
-
$4cb2b26710154c56$export$8c4ee2c50c22c514 = `hyn22G_i18nFontFamily`;
|
|
225
|
-
$4cb2b26710154c56$export$75eb16cbfc18279c = `hyn22G_spectrum-FieldGroup`;
|
|
226
|
-
$4cb2b26710154c56$export$984c7bbbfc7ddffc = `hyn22G_spectrum-FieldGroup-group`;
|
|
227
|
-
$4cb2b26710154c56$export$1ad8646bcba21c0e = `hyn22G_spectrum-FieldGroup-group--horizontal`;
|
|
228
|
-
$4cb2b26710154c56$export$4109102f950813a6 = `hyn22G_spectrum-FocusRing-ring`;
|
|
229
|
-
$4cb2b26710154c56$export$24c7f46a6e3605dd = `hyn22G_spectrum-FocusRing ${$4cb2b26710154c56$export$4109102f950813a6}`;
|
|
230
|
-
$4cb2b26710154c56$export$2927016961429360 = `hyn22G_spectrum-FocusRing--quiet`;
|
|
231
|
-
|
|
232
272
|
|
|
273
|
+
var $6Agev = parcelRequire("6Agev");
|
|
233
274
|
|
|
234
275
|
|
|
235
276
|
|
|
@@ -239,24 +280,21 @@ function $73f43ce9d441cc69$var$CheckboxGroup(props, ref) {
|
|
|
239
280
|
let { isEmphasized: isEmphasized, children: children, orientation: orientation = "vertical" } = props;
|
|
240
281
|
let domRef = (0, $gpy1V$useDOMRef)(ref);
|
|
241
282
|
let state = (0, $gpy1V$useCheckboxGroupState)(props);
|
|
242
|
-
let {
|
|
283
|
+
let { groupProps: groupProps, ...otherProps } = (0, $gpy1V$useCheckboxGroup)(props, state);
|
|
243
284
|
return /*#__PURE__*/ (0, $gpy1V$react).createElement((0, $gpy1V$Field), {
|
|
244
285
|
...props,
|
|
286
|
+
...otherProps,
|
|
245
287
|
ref: domRef,
|
|
246
|
-
wrapperClassName: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
247
|
-
labelProps: labelProps,
|
|
248
|
-
descriptionProps: descriptionProps,
|
|
249
|
-
errorMessageProps: errorMessageProps,
|
|
288
|
+
wrapperClassName: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($6Agev))), "spectrum-FieldGroup"),
|
|
250
289
|
elementType: "span",
|
|
251
290
|
includeNecessityIndicatorInAccessibilityName: true
|
|
252
291
|
}, /*#__PURE__*/ (0, $gpy1V$react).createElement("div", {
|
|
253
292
|
...groupProps,
|
|
254
|
-
className: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
293
|
+
className: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($6Agev))), "spectrum-FieldGroup-group", {
|
|
255
294
|
"spectrum-FieldGroup-group--horizontal": orientation === "horizontal"
|
|
256
295
|
})
|
|
257
296
|
}, /*#__PURE__*/ (0, $gpy1V$react).createElement((0, $gpy1V$Provider), {
|
|
258
|
-
isEmphasized: isEmphasized
|
|
259
|
-
validationState: state.isInvalid ? "invalid" : undefined
|
|
297
|
+
isEmphasized: isEmphasized
|
|
260
298
|
}, /*#__PURE__*/ (0, $gpy1V$react).createElement((0, $8c8ab388b155237e$export$baf37c4be89255b8).Provider, {
|
|
261
299
|
value: state
|
|
262
300
|
}, children))));
|
package/dist/main.js
CHANGED
|
@@ -5,20 +5,85 @@ var $5Ft2u$spectrumiconsuiDashSmall = require("@spectrum-icons/ui/DashSmall");
|
|
|
5
5
|
var $5Ft2u$reactariafocus = require("@react-aria/focus");
|
|
6
6
|
var $5Ft2u$react = require("react");
|
|
7
7
|
var $5Ft2u$reactariacheckbox = require("@react-aria/checkbox");
|
|
8
|
+
var $5Ft2u$reactspectrumform = require("@react-spectrum/form");
|
|
8
9
|
var $5Ft2u$reactariainteractions = require("@react-aria/interactions");
|
|
9
10
|
var $5Ft2u$reactspectrumprovider = require("@react-spectrum/provider");
|
|
10
11
|
var $5Ft2u$reactstatelytoggle = require("@react-stately/toggle");
|
|
11
12
|
var $5Ft2u$reactspectrumlabel = require("@react-spectrum/label");
|
|
12
13
|
var $5Ft2u$reactstatelycheckbox = require("@react-stately/checkbox");
|
|
13
|
-
|
|
14
|
+
|
|
14
15
|
|
|
15
16
|
function $parcel$export(e, n, v, s) {
|
|
16
17
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
function $parcel$interopDefault(a) {
|
|
19
21
|
return a && a.__esModule ? a.default : a;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
var $parcel$global = globalThis;
|
|
25
|
+
|
|
26
|
+
var $parcel$modules = {};
|
|
27
|
+
var $parcel$inits = {};
|
|
28
|
+
|
|
29
|
+
var parcelRequire = $parcel$global["parcelRequire7f0c"];
|
|
30
|
+
|
|
31
|
+
if (parcelRequire == null) {
|
|
32
|
+
parcelRequire = function(id) {
|
|
33
|
+
if (id in $parcel$modules) {
|
|
34
|
+
return $parcel$modules[id].exports;
|
|
35
|
+
}
|
|
36
|
+
if (id in $parcel$inits) {
|
|
37
|
+
var init = $parcel$inits[id];
|
|
38
|
+
delete $parcel$inits[id];
|
|
39
|
+
var module = {id: id, exports: {}};
|
|
40
|
+
$parcel$modules[id] = module;
|
|
41
|
+
init.call(module.exports, module, module.exports);
|
|
42
|
+
return module.exports;
|
|
43
|
+
}
|
|
44
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
45
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
46
|
+
throw err;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
parcelRequire.register = function register(id, init) {
|
|
50
|
+
$parcel$inits[id] = init;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
$parcel$global["parcelRequire7f0c"] = parcelRequire;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var parcelRegister = parcelRequire.register;
|
|
57
|
+
parcelRegister("78bCb", function(module, exports) {
|
|
58
|
+
|
|
59
|
+
$parcel$export(module.exports, "focus-ring", () => $53124a3a0fd56fca$export$f39a09f249340e2a, (v) => $53124a3a0fd56fca$export$f39a09f249340e2a = v);
|
|
60
|
+
$parcel$export(module.exports, "i18nFontFamily", () => $53124a3a0fd56fca$export$8c4ee2c50c22c514, (v) => $53124a3a0fd56fca$export$8c4ee2c50c22c514 = v);
|
|
61
|
+
$parcel$export(module.exports, "spectrum-FieldGroup", () => $53124a3a0fd56fca$export$75eb16cbfc18279c, (v) => $53124a3a0fd56fca$export$75eb16cbfc18279c = v);
|
|
62
|
+
$parcel$export(module.exports, "spectrum-FieldGroup-group", () => $53124a3a0fd56fca$export$984c7bbbfc7ddffc, (v) => $53124a3a0fd56fca$export$984c7bbbfc7ddffc = v);
|
|
63
|
+
$parcel$export(module.exports, "spectrum-FieldGroup-group--horizontal", () => $53124a3a0fd56fca$export$1ad8646bcba21c0e, (v) => $53124a3a0fd56fca$export$1ad8646bcba21c0e = v);
|
|
64
|
+
$parcel$export(module.exports, "spectrum-FocusRing-ring", () => $53124a3a0fd56fca$export$4109102f950813a6, (v) => $53124a3a0fd56fca$export$4109102f950813a6 = v);
|
|
65
|
+
$parcel$export(module.exports, "spectrum-FocusRing", () => $53124a3a0fd56fca$export$24c7f46a6e3605dd, (v) => $53124a3a0fd56fca$export$24c7f46a6e3605dd = v);
|
|
66
|
+
$parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $53124a3a0fd56fca$export$2927016961429360, (v) => $53124a3a0fd56fca$export$2927016961429360 = v);
|
|
67
|
+
var $53124a3a0fd56fca$export$f39a09f249340e2a;
|
|
68
|
+
var $53124a3a0fd56fca$export$8c4ee2c50c22c514;
|
|
69
|
+
var $53124a3a0fd56fca$export$75eb16cbfc18279c;
|
|
70
|
+
var $53124a3a0fd56fca$export$984c7bbbfc7ddffc;
|
|
71
|
+
var $53124a3a0fd56fca$export$1ad8646bcba21c0e;
|
|
72
|
+
var $53124a3a0fd56fca$export$4109102f950813a6;
|
|
73
|
+
var $53124a3a0fd56fca$export$24c7f46a6e3605dd;
|
|
74
|
+
var $53124a3a0fd56fca$export$2927016961429360;
|
|
75
|
+
$53124a3a0fd56fca$export$f39a09f249340e2a = `hyn22G_focus-ring`;
|
|
76
|
+
$53124a3a0fd56fca$export$8c4ee2c50c22c514 = `hyn22G_i18nFontFamily`;
|
|
77
|
+
$53124a3a0fd56fca$export$75eb16cbfc18279c = `hyn22G_spectrum-FieldGroup`;
|
|
78
|
+
$53124a3a0fd56fca$export$984c7bbbfc7ddffc = `hyn22G_spectrum-FieldGroup-group`;
|
|
79
|
+
$53124a3a0fd56fca$export$1ad8646bcba21c0e = `hyn22G_spectrum-FieldGroup-group--horizontal`;
|
|
80
|
+
$53124a3a0fd56fca$export$4109102f950813a6 = `hyn22G_spectrum-FocusRing-ring`;
|
|
81
|
+
$53124a3a0fd56fca$export$24c7f46a6e3605dd = `hyn22G_spectrum-FocusRing ${$53124a3a0fd56fca$export$4109102f950813a6}`;
|
|
82
|
+
$53124a3a0fd56fca$export$2927016961429360 = `hyn22G_spectrum-FocusRing--quiet`;
|
|
83
|
+
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
|
|
22
87
|
$parcel$export(module.exports, "Checkbox", () => $096ccd12d23dd6cc$export$48513f6b9f8ce62d);
|
|
23
88
|
$parcel$export(module.exports, "CheckboxGroup", () => $1151290755e16c44$export$4aa08d5625cb8ead);
|
|
24
89
|
/*
|
|
@@ -120,10 +185,12 @@ $591f3ccba6339bdb$export$2927016961429360 = `ISsn1a_spectrum-FocusRing--quiet`;
|
|
|
120
185
|
|
|
121
186
|
|
|
122
187
|
|
|
188
|
+
|
|
123
189
|
function $096ccd12d23dd6cc$var$Checkbox(props, ref) {
|
|
124
190
|
let originalProps = props;
|
|
125
191
|
props = (0, $5Ft2u$reactspectrumprovider.useProviderProps)(props);
|
|
126
|
-
|
|
192
|
+
props = (0, $5Ft2u$reactspectrumform.useFormProps)(props);
|
|
193
|
+
let { isIndeterminate: isIndeterminate = false, isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
127
194
|
let { styleProps: styleProps } = (0, $5Ft2u$reactspectrumutils.useStyleProps)(otherProps);
|
|
128
195
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $5Ft2u$reactariainteractions.useHover)({
|
|
129
196
|
isDisabled: isDisabled
|
|
@@ -134,7 +201,7 @@ function $096ccd12d23dd6cc$var$Checkbox(props, ref) {
|
|
|
134
201
|
// This is a bit unorthodox. Typically, hooks cannot be called in a conditional,
|
|
135
202
|
// but since the checkbox won't move in and out of a group, it should be safe.
|
|
136
203
|
let groupState = (0, $5Ft2u$react.useContext)((0, $bdf3bf7fe71fe120$export$baf37c4be89255b8));
|
|
137
|
-
let { inputProps: inputProps } = groupState ? (0, $5Ft2u$reactariacheckbox.useCheckboxGroupItem)({
|
|
204
|
+
let { inputProps: inputProps, isInvalid: isInvalid } = groupState ? (0, $5Ft2u$reactariacheckbox.useCheckboxGroupItem)({
|
|
138
205
|
...props,
|
|
139
206
|
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
140
207
|
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
@@ -167,7 +234,7 @@ function $096ccd12d23dd6cc$var$Checkbox(props, ref) {
|
|
|
167
234
|
"is-checked": inputProps.checked,
|
|
168
235
|
"is-indeterminate": isIndeterminate,
|
|
169
236
|
"spectrum-Checkbox--quiet": !isEmphasized,
|
|
170
|
-
"is-invalid": isInvalid
|
|
237
|
+
"is-invalid": isInvalid,
|
|
171
238
|
"is-disabled": isDisabled,
|
|
172
239
|
"is-hovered": isHovered
|
|
173
240
|
}, styleProps.className)
|
|
@@ -205,34 +272,8 @@ function $096ccd12d23dd6cc$var$Checkbox(props, ref) {
|
|
|
205
272
|
|
|
206
273
|
|
|
207
274
|
|
|
208
|
-
var $53124a3a0fd56fca$exports = {};
|
|
209
|
-
|
|
210
|
-
$parcel$export($53124a3a0fd56fca$exports, "focus-ring", () => $53124a3a0fd56fca$export$f39a09f249340e2a, (v) => $53124a3a0fd56fca$export$f39a09f249340e2a = v);
|
|
211
|
-
$parcel$export($53124a3a0fd56fca$exports, "i18nFontFamily", () => $53124a3a0fd56fca$export$8c4ee2c50c22c514, (v) => $53124a3a0fd56fca$export$8c4ee2c50c22c514 = v);
|
|
212
|
-
$parcel$export($53124a3a0fd56fca$exports, "spectrum-FieldGroup", () => $53124a3a0fd56fca$export$75eb16cbfc18279c, (v) => $53124a3a0fd56fca$export$75eb16cbfc18279c = v);
|
|
213
|
-
$parcel$export($53124a3a0fd56fca$exports, "spectrum-FieldGroup-group", () => $53124a3a0fd56fca$export$984c7bbbfc7ddffc, (v) => $53124a3a0fd56fca$export$984c7bbbfc7ddffc = v);
|
|
214
|
-
$parcel$export($53124a3a0fd56fca$exports, "spectrum-FieldGroup-group--horizontal", () => $53124a3a0fd56fca$export$1ad8646bcba21c0e, (v) => $53124a3a0fd56fca$export$1ad8646bcba21c0e = v);
|
|
215
|
-
$parcel$export($53124a3a0fd56fca$exports, "spectrum-FocusRing-ring", () => $53124a3a0fd56fca$export$4109102f950813a6, (v) => $53124a3a0fd56fca$export$4109102f950813a6 = v);
|
|
216
|
-
$parcel$export($53124a3a0fd56fca$exports, "spectrum-FocusRing", () => $53124a3a0fd56fca$export$24c7f46a6e3605dd, (v) => $53124a3a0fd56fca$export$24c7f46a6e3605dd = v);
|
|
217
|
-
$parcel$export($53124a3a0fd56fca$exports, "spectrum-FocusRing--quiet", () => $53124a3a0fd56fca$export$2927016961429360, (v) => $53124a3a0fd56fca$export$2927016961429360 = v);
|
|
218
|
-
var $53124a3a0fd56fca$export$f39a09f249340e2a;
|
|
219
|
-
var $53124a3a0fd56fca$export$8c4ee2c50c22c514;
|
|
220
|
-
var $53124a3a0fd56fca$export$75eb16cbfc18279c;
|
|
221
|
-
var $53124a3a0fd56fca$export$984c7bbbfc7ddffc;
|
|
222
|
-
var $53124a3a0fd56fca$export$1ad8646bcba21c0e;
|
|
223
|
-
var $53124a3a0fd56fca$export$4109102f950813a6;
|
|
224
|
-
var $53124a3a0fd56fca$export$24c7f46a6e3605dd;
|
|
225
|
-
var $53124a3a0fd56fca$export$2927016961429360;
|
|
226
|
-
$53124a3a0fd56fca$export$f39a09f249340e2a = `hyn22G_focus-ring`;
|
|
227
|
-
$53124a3a0fd56fca$export$8c4ee2c50c22c514 = `hyn22G_i18nFontFamily`;
|
|
228
|
-
$53124a3a0fd56fca$export$75eb16cbfc18279c = `hyn22G_spectrum-FieldGroup`;
|
|
229
|
-
$53124a3a0fd56fca$export$984c7bbbfc7ddffc = `hyn22G_spectrum-FieldGroup-group`;
|
|
230
|
-
$53124a3a0fd56fca$export$1ad8646bcba21c0e = `hyn22G_spectrum-FieldGroup-group--horizontal`;
|
|
231
|
-
$53124a3a0fd56fca$export$4109102f950813a6 = `hyn22G_spectrum-FocusRing-ring`;
|
|
232
|
-
$53124a3a0fd56fca$export$24c7f46a6e3605dd = `hyn22G_spectrum-FocusRing ${$53124a3a0fd56fca$export$4109102f950813a6}`;
|
|
233
|
-
$53124a3a0fd56fca$export$2927016961429360 = `hyn22G_spectrum-FocusRing--quiet`;
|
|
234
|
-
|
|
235
275
|
|
|
276
|
+
var $78bCb = parcelRequire("78bCb");
|
|
236
277
|
|
|
237
278
|
|
|
238
279
|
|
|
@@ -242,24 +283,21 @@ function $1151290755e16c44$var$CheckboxGroup(props, ref) {
|
|
|
242
283
|
let { isEmphasized: isEmphasized, children: children, orientation: orientation = "vertical" } = props;
|
|
243
284
|
let domRef = (0, $5Ft2u$reactspectrumutils.useDOMRef)(ref);
|
|
244
285
|
let state = (0, $5Ft2u$reactstatelycheckbox.useCheckboxGroupState)(props);
|
|
245
|
-
let {
|
|
286
|
+
let { groupProps: groupProps, ...otherProps } = (0, $5Ft2u$reactariacheckbox.useCheckboxGroup)(props, state);
|
|
246
287
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($5Ft2u$react))).createElement((0, $5Ft2u$reactspectrumlabel.Field), {
|
|
247
288
|
...props,
|
|
289
|
+
...otherProps,
|
|
248
290
|
ref: domRef,
|
|
249
|
-
wrapperClassName: (0, $5Ft2u$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
250
|
-
labelProps: labelProps,
|
|
251
|
-
descriptionProps: descriptionProps,
|
|
252
|
-
errorMessageProps: errorMessageProps,
|
|
291
|
+
wrapperClassName: (0, $5Ft2u$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($78bCb))), "spectrum-FieldGroup"),
|
|
253
292
|
elementType: "span",
|
|
254
293
|
includeNecessityIndicatorInAccessibilityName: true
|
|
255
294
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5Ft2u$react))).createElement("div", {
|
|
256
295
|
...groupProps,
|
|
257
|
-
className: (0, $5Ft2u$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
296
|
+
className: (0, $5Ft2u$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($78bCb))), "spectrum-FieldGroup-group", {
|
|
258
297
|
"spectrum-FieldGroup-group--horizontal": orientation === "horizontal"
|
|
259
298
|
})
|
|
260
299
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5Ft2u$react))).createElement((0, $5Ft2u$reactspectrumprovider.Provider), {
|
|
261
|
-
isEmphasized: isEmphasized
|
|
262
|
-
validationState: state.isInvalid ? "invalid" : undefined
|
|
300
|
+
isEmphasized: isEmphasized
|
|
263
301
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5Ft2u$react))).createElement((0, $bdf3bf7fe71fe120$export$baf37c4be89255b8).Provider, {
|
|
264
302
|
value: state
|
|
265
303
|
}, children))));
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C;ACX1C;;;;;;;;;;ACAA;;;;;;;;;;CAUC;AAKM,MAAM,4CAAuB,CAAA,GAAA,sCAAI,EAAE,cAAyC;;CDLlF;;;;;;;;;;;;;;;;;;;;;;;;;AEVD,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAhBA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,2CAAqC,CAAC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mB,EAAE;QAAS,OAAO;OACnC;AAMb;AAEA;;CAEC,GACD,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,WAAW;;","sources":["packages/@react-spectrum/checkbox/src/index.ts","packages/@react-spectrum/checkbox/src/Checkbox.tsx","packages/@react-spectrum/checkbox/src/context.ts","packages/@adobe/spectrum-css-temp/components/checkbox/vars.css","packages/@react-spectrum/checkbox/src/CheckboxGroup.tsx","packages/@adobe/spectrum-css-temp/components/fieldgroup/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Checkbox} from './Checkbox';\nexport {CheckboxGroup} from './CheckboxGroup';\nexport type {SpectrumCheckboxProps, SpectrumCheckboxGroupProps} from '@react-types/checkbox';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport CheckmarkSmall from '@spectrum-icons/ui/CheckmarkSmall';\nimport {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport DashSmall from '@spectrum-icons/ui/DashSmall';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useContext, useRef} from 'react';\nimport {SpectrumCheckboxProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/checkbox/vars.css';\nimport {useCheckbox, useCheckboxGroupItem} from '@react-aria/checkbox';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useToggleState} from '@react-stately/toggle';\n\nfunction Checkbox(props: SpectrumCheckboxProps, ref: FocusableRef<HTMLLabelElement>) {\n let originalProps = props;\n props = useProviderProps(props);\n let {\n isIndeterminate = false,\n isEmphasized = false,\n isDisabled = false,\n autoFocus,\n children,\n validationState,\n isInvalid,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n // Swap hooks depending on whether this checkbox is inside a CheckboxGroup.\n // This is a bit unorthodox. Typically, hooks cannot be called in a conditional,\n // but since the checkbox won't move in and out of a group, it should be safe.\n let groupState = useContext(CheckboxGroupContext);\n let {inputProps} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...props,\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // Only pass isRequired and validationState to react-aria if they came from\n // the props for this individual checkbox, and not from the group via context.\n isRequired: originalProps.isRequired,\n validationState: originalProps.validationState,\n isInvalid: originalProps.isInvalid\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox(props, useToggleState(props), inputRef);\n\n let markIcon = isIndeterminate\n ? <DashSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-partialCheckmark')} />\n : <CheckmarkSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-checkmark')} />;\n\n if (groupState) {\n for (let key of ['isSelected', 'defaultSelected', 'isEmphasized']) {\n if (originalProps[key] != null) {\n console.warn(`${key} is unsupported on individual <Checkbox> elements within a <CheckboxGroup>. Please apply these props to the group instead.`);\n }\n }\n if (props.value == null) {\n console.warn('A <Checkbox> element within a <CheckboxGroup> requires a `value` property.');\n }\n }\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Checkbox',\n {\n 'is-checked': inputProps.checked,\n 'is-indeterminate': isIndeterminate,\n 'spectrum-Checkbox--quiet': !isEmphasized,\n 'is-invalid': isInvalid || validationState === 'invalid',\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Checkbox-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Checkbox-box')}>{markIcon}</span>\n {children && (\n <span className={classNames(styles, 'spectrum-Checkbox-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n/**\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n */\nlet _Checkbox = forwardRef(Checkbox);\nexport {_Checkbox as Checkbox};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport React from 'react';\n\nexport const CheckboxGroupContext = React.createContext<CheckboxGroupState | null>(null);\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {Provider, useProviderProps} from '@react-spectrum/provider';\nimport React from 'react';\nimport {SpectrumCheckboxGroupProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useCheckboxGroup} from '@react-aria/checkbox';\nimport {useCheckboxGroupState} from '@react-stately/checkbox';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction CheckboxGroup(props: SpectrumCheckboxGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n children,\n orientation = 'vertical'\n } = props;\n let domRef = useDOMRef(ref);\n let state = useCheckboxGroupState(props);\n let {labelProps, groupProps, descriptionProps, errorMessageProps} = useCheckboxGroup(props, state);\n\n return (\n <Field\n {...props}\n ref={domRef}\n wrapperClassName={classNames(styles, 'spectrum-FieldGroup')}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n elementType=\"span\"\n includeNecessityIndicatorInAccessibilityName>\n <div\n {...groupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <Provider isEmphasized={isEmphasized} validationState={state.isInvalid ? 'invalid' : undefined}>\n <CheckboxGroupContext.Provider value={state}>\n {children}\n </CheckboxGroupContext.Provider>\n </Provider>\n </div>\n </Field>\n );\n}\n\n/**\n * A CheckboxGroup allows users to select one or more items from a list of choices.\n */\nconst _CheckboxGroup = React.forwardRef(CheckboxGroup);\nexport {_CheckboxGroup as CheckboxGroup};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAPA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0D,CAAC,4CAA4C,CAAC;AACxG,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BAA0B,EAAE,0CAA0C,CAAC;AAC/G,4CAA8C,CAAC,gCAAgC,CAAC;;;;;;;ACPhF;;;;;;;;;;CAUC,GACD,0CAA0C;ACX1C;;;;;;;;;;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;qBAGJ,0DAAC,CAAA,GAAA,qCAAO;QAAE,cAAc;qBACtB,0DAAC,CAAA,GAAA,yCAAmB,EAAE,QAAQ;QAAC,OAAO;OACnC;AAMb;AAEA;;CAEC,GACD,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;;","sources":["packages/@adobe/spectrum-css-temp/components/fieldgroup/vars.css","packages/@react-spectrum/checkbox/src/index.ts","packages/@react-spectrum/checkbox/src/Checkbox.tsx","packages/@react-spectrum/checkbox/src/context.ts","packages/@adobe/spectrum-css-temp/components/checkbox/vars.css","packages/@react-spectrum/checkbox/src/CheckboxGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Checkbox} from './Checkbox';\nexport {CheckboxGroup} from './CheckboxGroup';\nexport type {SpectrumCheckboxProps, SpectrumCheckboxGroupProps} from '@react-types/checkbox';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport CheckmarkSmall from '@spectrum-icons/ui/CheckmarkSmall';\nimport {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport DashSmall from '@spectrum-icons/ui/DashSmall';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useContext, useRef} from 'react';\nimport {SpectrumCheckboxProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/checkbox/vars.css';\nimport {useCheckbox, useCheckboxGroupItem} from '@react-aria/checkbox';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useToggleState} from '@react-stately/toggle';\n\nfunction Checkbox(props: SpectrumCheckboxProps, ref: FocusableRef<HTMLLabelElement>) {\n let originalProps = props;\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isIndeterminate = false,\n isEmphasized = false,\n isDisabled = false,\n autoFocus,\n children,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n // Swap hooks depending on whether this checkbox is inside a CheckboxGroup.\n // This is a bit unorthodox. Typically, hooks cannot be called in a conditional,\n // but since the checkbox won't move in and out of a group, it should be safe.\n let groupState = useContext(CheckboxGroupContext);\n let {inputProps, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...props,\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // Only pass isRequired and validationState to react-aria if they came from\n // the props for this individual checkbox, and not from the group via context.\n isRequired: originalProps.isRequired,\n validationState: originalProps.validationState,\n isInvalid: originalProps.isInvalid\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox(props, useToggleState(props), inputRef);\n\n let markIcon = isIndeterminate\n ? <DashSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-partialCheckmark')} />\n : <CheckmarkSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-checkmark')} />;\n\n if (groupState) {\n for (let key of ['isSelected', 'defaultSelected', 'isEmphasized']) {\n if (originalProps[key] != null) {\n console.warn(`${key} is unsupported on individual <Checkbox> elements within a <CheckboxGroup>. Please apply these props to the group instead.`);\n }\n }\n if (props.value == null) {\n console.warn('A <Checkbox> element within a <CheckboxGroup> requires a `value` property.');\n }\n }\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Checkbox',\n {\n 'is-checked': inputProps.checked,\n 'is-indeterminate': isIndeterminate,\n 'spectrum-Checkbox--quiet': !isEmphasized,\n 'is-invalid': isInvalid,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Checkbox-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Checkbox-box')}>{markIcon}</span>\n {children && (\n <span className={classNames(styles, 'spectrum-Checkbox-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n/**\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n */\nlet _Checkbox = forwardRef(Checkbox);\nexport {_Checkbox as Checkbox};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport React from 'react';\n\nexport const CheckboxGroupContext = React.createContext<CheckboxGroupState | null>(null);\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {Provider, useProviderProps} from '@react-spectrum/provider';\nimport React from 'react';\nimport {SpectrumCheckboxGroupProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useCheckboxGroup} from '@react-aria/checkbox';\nimport {useCheckboxGroupState} from '@react-stately/checkbox';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction CheckboxGroup(props: SpectrumCheckboxGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n children,\n orientation = 'vertical'\n } = props;\n let domRef = useDOMRef(ref);\n let state = useCheckboxGroupState(props);\n let {groupProps, ...otherProps} = useCheckboxGroup(props, state);\n\n return (\n <Field\n {...props}\n {...otherProps}\n ref={domRef}\n wrapperClassName={classNames(styles, 'spectrum-FieldGroup')}\n elementType=\"span\"\n includeNecessityIndicatorInAccessibilityName>\n <div\n {...groupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <Provider isEmphasized={isEmphasized}>\n <CheckboxGroupContext.Provider value={state}>\n {children}\n </CheckboxGroupContext.Provider>\n </Provider>\n </div>\n </Field>\n );\n}\n\n/**\n * A CheckboxGroup allows users to select one or more items from a list of choices.\n */\nconst _CheckboxGroup = React.forwardRef(CheckboxGroup);\nexport {_CheckboxGroup as CheckboxGroup};\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -5,19 +5,84 @@ import $gpy1V$spectrumiconsuiDashSmall from "@spectrum-icons/ui/DashSmall";
|
|
|
5
5
|
import {FocusRing as $gpy1V$FocusRing} from "@react-aria/focus";
|
|
6
6
|
import $gpy1V$react, {useRef as $gpy1V$useRef, useContext as $gpy1V$useContext, forwardRef as $gpy1V$forwardRef} from "react";
|
|
7
7
|
import {useCheckboxGroupItem as $gpy1V$useCheckboxGroupItem, useCheckbox as $gpy1V$useCheckbox, useCheckboxGroup as $gpy1V$useCheckboxGroup} from "@react-aria/checkbox";
|
|
8
|
+
import {useFormProps as $gpy1V$useFormProps} from "@react-spectrum/form";
|
|
8
9
|
import {useHover as $gpy1V$useHover} from "@react-aria/interactions";
|
|
9
10
|
import {useProviderProps as $gpy1V$useProviderProps, Provider as $gpy1V$Provider} from "@react-spectrum/provider";
|
|
10
11
|
import {useToggleState as $gpy1V$useToggleState} from "@react-stately/toggle";
|
|
11
12
|
import {Field as $gpy1V$Field} from "@react-spectrum/label";
|
|
12
13
|
import {useCheckboxGroupState as $gpy1V$useCheckboxGroupState} from "@react-stately/checkbox";
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function $parcel$export(e, n, v, s) {
|
|
17
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
function $parcel$interopDefault(a) {
|
|
16
21
|
return a && a.__esModule ? a.default : a;
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
var $parcel$global = globalThis;
|
|
25
|
+
|
|
26
|
+
var $parcel$modules = {};
|
|
27
|
+
var $parcel$inits = {};
|
|
28
|
+
|
|
29
|
+
var parcelRequire = $parcel$global["parcelRequire7f0c"];
|
|
30
|
+
|
|
31
|
+
if (parcelRequire == null) {
|
|
32
|
+
parcelRequire = function(id) {
|
|
33
|
+
if (id in $parcel$modules) {
|
|
34
|
+
return $parcel$modules[id].exports;
|
|
35
|
+
}
|
|
36
|
+
if (id in $parcel$inits) {
|
|
37
|
+
var init = $parcel$inits[id];
|
|
38
|
+
delete $parcel$inits[id];
|
|
39
|
+
var module = {id: id, exports: {}};
|
|
40
|
+
$parcel$modules[id] = module;
|
|
41
|
+
init.call(module.exports, module, module.exports);
|
|
42
|
+
return module.exports;
|
|
43
|
+
}
|
|
44
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
45
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
46
|
+
throw err;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
parcelRequire.register = function register(id, init) {
|
|
50
|
+
$parcel$inits[id] = init;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
$parcel$global["parcelRequire7f0c"] = parcelRequire;
|
|
20
54
|
}
|
|
55
|
+
|
|
56
|
+
var parcelRegister = parcelRequire.register;
|
|
57
|
+
parcelRegister("6Agev", function(module, exports) {
|
|
58
|
+
|
|
59
|
+
$parcel$export(module.exports, "focus-ring", () => $4cb2b26710154c56$export$f39a09f249340e2a, (v) => $4cb2b26710154c56$export$f39a09f249340e2a = v);
|
|
60
|
+
$parcel$export(module.exports, "i18nFontFamily", () => $4cb2b26710154c56$export$8c4ee2c50c22c514, (v) => $4cb2b26710154c56$export$8c4ee2c50c22c514 = v);
|
|
61
|
+
$parcel$export(module.exports, "spectrum-FieldGroup", () => $4cb2b26710154c56$export$75eb16cbfc18279c, (v) => $4cb2b26710154c56$export$75eb16cbfc18279c = v);
|
|
62
|
+
$parcel$export(module.exports, "spectrum-FieldGroup-group", () => $4cb2b26710154c56$export$984c7bbbfc7ddffc, (v) => $4cb2b26710154c56$export$984c7bbbfc7ddffc = v);
|
|
63
|
+
$parcel$export(module.exports, "spectrum-FieldGroup-group--horizontal", () => $4cb2b26710154c56$export$1ad8646bcba21c0e, (v) => $4cb2b26710154c56$export$1ad8646bcba21c0e = v);
|
|
64
|
+
$parcel$export(module.exports, "spectrum-FocusRing-ring", () => $4cb2b26710154c56$export$4109102f950813a6, (v) => $4cb2b26710154c56$export$4109102f950813a6 = v);
|
|
65
|
+
$parcel$export(module.exports, "spectrum-FocusRing", () => $4cb2b26710154c56$export$24c7f46a6e3605dd, (v) => $4cb2b26710154c56$export$24c7f46a6e3605dd = v);
|
|
66
|
+
$parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $4cb2b26710154c56$export$2927016961429360, (v) => $4cb2b26710154c56$export$2927016961429360 = v);
|
|
67
|
+
var $4cb2b26710154c56$export$f39a09f249340e2a;
|
|
68
|
+
var $4cb2b26710154c56$export$8c4ee2c50c22c514;
|
|
69
|
+
var $4cb2b26710154c56$export$75eb16cbfc18279c;
|
|
70
|
+
var $4cb2b26710154c56$export$984c7bbbfc7ddffc;
|
|
71
|
+
var $4cb2b26710154c56$export$1ad8646bcba21c0e;
|
|
72
|
+
var $4cb2b26710154c56$export$4109102f950813a6;
|
|
73
|
+
var $4cb2b26710154c56$export$24c7f46a6e3605dd;
|
|
74
|
+
var $4cb2b26710154c56$export$2927016961429360;
|
|
75
|
+
$4cb2b26710154c56$export$f39a09f249340e2a = `hyn22G_focus-ring`;
|
|
76
|
+
$4cb2b26710154c56$export$8c4ee2c50c22c514 = `hyn22G_i18nFontFamily`;
|
|
77
|
+
$4cb2b26710154c56$export$75eb16cbfc18279c = `hyn22G_spectrum-FieldGroup`;
|
|
78
|
+
$4cb2b26710154c56$export$984c7bbbfc7ddffc = `hyn22G_spectrum-FieldGroup-group`;
|
|
79
|
+
$4cb2b26710154c56$export$1ad8646bcba21c0e = `hyn22G_spectrum-FieldGroup-group--horizontal`;
|
|
80
|
+
$4cb2b26710154c56$export$4109102f950813a6 = `hyn22G_spectrum-FocusRing-ring`;
|
|
81
|
+
$4cb2b26710154c56$export$24c7f46a6e3605dd = `hyn22G_spectrum-FocusRing ${$4cb2b26710154c56$export$4109102f950813a6}`;
|
|
82
|
+
$4cb2b26710154c56$export$2927016961429360 = `hyn22G_spectrum-FocusRing--quiet`;
|
|
83
|
+
|
|
84
|
+
});
|
|
85
|
+
|
|
21
86
|
/*
|
|
22
87
|
* Copyright 2020 Adobe. All rights reserved.
|
|
23
88
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -117,10 +182,12 @@ $fe1a56c62936037c$export$2927016961429360 = `ISsn1a_spectrum-FocusRing--quiet`;
|
|
|
117
182
|
|
|
118
183
|
|
|
119
184
|
|
|
185
|
+
|
|
120
186
|
function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
121
187
|
let originalProps = props;
|
|
122
188
|
props = (0, $gpy1V$useProviderProps)(props);
|
|
123
|
-
|
|
189
|
+
props = (0, $gpy1V$useFormProps)(props);
|
|
190
|
+
let { isIndeterminate: isIndeterminate = false, isEmphasized: isEmphasized = false, isDisabled: isDisabled = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
124
191
|
let { styleProps: styleProps } = (0, $gpy1V$useStyleProps)(otherProps);
|
|
125
192
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $gpy1V$useHover)({
|
|
126
193
|
isDisabled: isDisabled
|
|
@@ -131,7 +198,7 @@ function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
|
131
198
|
// This is a bit unorthodox. Typically, hooks cannot be called in a conditional,
|
|
132
199
|
// but since the checkbox won't move in and out of a group, it should be safe.
|
|
133
200
|
let groupState = (0, $gpy1V$useContext)((0, $8c8ab388b155237e$export$baf37c4be89255b8));
|
|
134
|
-
let { inputProps: inputProps } = groupState ? (0, $gpy1V$useCheckboxGroupItem)({
|
|
201
|
+
let { inputProps: inputProps, isInvalid: isInvalid } = groupState ? (0, $gpy1V$useCheckboxGroupItem)({
|
|
135
202
|
...props,
|
|
136
203
|
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
137
204
|
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
@@ -164,7 +231,7 @@ function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
|
164
231
|
"is-checked": inputProps.checked,
|
|
165
232
|
"is-indeterminate": isIndeterminate,
|
|
166
233
|
"spectrum-Checkbox--quiet": !isEmphasized,
|
|
167
|
-
"is-invalid": isInvalid
|
|
234
|
+
"is-invalid": isInvalid,
|
|
168
235
|
"is-disabled": isDisabled,
|
|
169
236
|
"is-hovered": isHovered
|
|
170
237
|
}, styleProps.className)
|
|
@@ -202,34 +269,8 @@ function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
|
202
269
|
|
|
203
270
|
|
|
204
271
|
|
|
205
|
-
var $4cb2b26710154c56$exports = {};
|
|
206
|
-
|
|
207
|
-
$parcel$export($4cb2b26710154c56$exports, "focus-ring", () => $4cb2b26710154c56$export$f39a09f249340e2a, (v) => $4cb2b26710154c56$export$f39a09f249340e2a = v);
|
|
208
|
-
$parcel$export($4cb2b26710154c56$exports, "i18nFontFamily", () => $4cb2b26710154c56$export$8c4ee2c50c22c514, (v) => $4cb2b26710154c56$export$8c4ee2c50c22c514 = v);
|
|
209
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FieldGroup", () => $4cb2b26710154c56$export$75eb16cbfc18279c, (v) => $4cb2b26710154c56$export$75eb16cbfc18279c = v);
|
|
210
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FieldGroup-group", () => $4cb2b26710154c56$export$984c7bbbfc7ddffc, (v) => $4cb2b26710154c56$export$984c7bbbfc7ddffc = v);
|
|
211
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FieldGroup-group--horizontal", () => $4cb2b26710154c56$export$1ad8646bcba21c0e, (v) => $4cb2b26710154c56$export$1ad8646bcba21c0e = v);
|
|
212
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FocusRing-ring", () => $4cb2b26710154c56$export$4109102f950813a6, (v) => $4cb2b26710154c56$export$4109102f950813a6 = v);
|
|
213
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FocusRing", () => $4cb2b26710154c56$export$24c7f46a6e3605dd, (v) => $4cb2b26710154c56$export$24c7f46a6e3605dd = v);
|
|
214
|
-
$parcel$export($4cb2b26710154c56$exports, "spectrum-FocusRing--quiet", () => $4cb2b26710154c56$export$2927016961429360, (v) => $4cb2b26710154c56$export$2927016961429360 = v);
|
|
215
|
-
var $4cb2b26710154c56$export$f39a09f249340e2a;
|
|
216
|
-
var $4cb2b26710154c56$export$8c4ee2c50c22c514;
|
|
217
|
-
var $4cb2b26710154c56$export$75eb16cbfc18279c;
|
|
218
|
-
var $4cb2b26710154c56$export$984c7bbbfc7ddffc;
|
|
219
|
-
var $4cb2b26710154c56$export$1ad8646bcba21c0e;
|
|
220
|
-
var $4cb2b26710154c56$export$4109102f950813a6;
|
|
221
|
-
var $4cb2b26710154c56$export$24c7f46a6e3605dd;
|
|
222
|
-
var $4cb2b26710154c56$export$2927016961429360;
|
|
223
|
-
$4cb2b26710154c56$export$f39a09f249340e2a = `hyn22G_focus-ring`;
|
|
224
|
-
$4cb2b26710154c56$export$8c4ee2c50c22c514 = `hyn22G_i18nFontFamily`;
|
|
225
|
-
$4cb2b26710154c56$export$75eb16cbfc18279c = `hyn22G_spectrum-FieldGroup`;
|
|
226
|
-
$4cb2b26710154c56$export$984c7bbbfc7ddffc = `hyn22G_spectrum-FieldGroup-group`;
|
|
227
|
-
$4cb2b26710154c56$export$1ad8646bcba21c0e = `hyn22G_spectrum-FieldGroup-group--horizontal`;
|
|
228
|
-
$4cb2b26710154c56$export$4109102f950813a6 = `hyn22G_spectrum-FocusRing-ring`;
|
|
229
|
-
$4cb2b26710154c56$export$24c7f46a6e3605dd = `hyn22G_spectrum-FocusRing ${$4cb2b26710154c56$export$4109102f950813a6}`;
|
|
230
|
-
$4cb2b26710154c56$export$2927016961429360 = `hyn22G_spectrum-FocusRing--quiet`;
|
|
231
|
-
|
|
232
272
|
|
|
273
|
+
var $6Agev = parcelRequire("6Agev");
|
|
233
274
|
|
|
234
275
|
|
|
235
276
|
|
|
@@ -239,24 +280,21 @@ function $73f43ce9d441cc69$var$CheckboxGroup(props, ref) {
|
|
|
239
280
|
let { isEmphasized: isEmphasized, children: children, orientation: orientation = "vertical" } = props;
|
|
240
281
|
let domRef = (0, $gpy1V$useDOMRef)(ref);
|
|
241
282
|
let state = (0, $gpy1V$useCheckboxGroupState)(props);
|
|
242
|
-
let {
|
|
283
|
+
let { groupProps: groupProps, ...otherProps } = (0, $gpy1V$useCheckboxGroup)(props, state);
|
|
243
284
|
return /*#__PURE__*/ (0, $gpy1V$react).createElement((0, $gpy1V$Field), {
|
|
244
285
|
...props,
|
|
286
|
+
...otherProps,
|
|
245
287
|
ref: domRef,
|
|
246
|
-
wrapperClassName: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
247
|
-
labelProps: labelProps,
|
|
248
|
-
descriptionProps: descriptionProps,
|
|
249
|
-
errorMessageProps: errorMessageProps,
|
|
288
|
+
wrapperClassName: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($6Agev))), "spectrum-FieldGroup"),
|
|
250
289
|
elementType: "span",
|
|
251
290
|
includeNecessityIndicatorInAccessibilityName: true
|
|
252
291
|
}, /*#__PURE__*/ (0, $gpy1V$react).createElement("div", {
|
|
253
292
|
...groupProps,
|
|
254
|
-
className: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
293
|
+
className: (0, $gpy1V$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($6Agev))), "spectrum-FieldGroup-group", {
|
|
255
294
|
"spectrum-FieldGroup-group--horizontal": orientation === "horizontal"
|
|
256
295
|
})
|
|
257
296
|
}, /*#__PURE__*/ (0, $gpy1V$react).createElement((0, $gpy1V$Provider), {
|
|
258
|
-
isEmphasized: isEmphasized
|
|
259
|
-
validationState: state.isInvalid ? "invalid" : undefined
|
|
297
|
+
isEmphasized: isEmphasized
|
|
260
298
|
}, /*#__PURE__*/ (0, $gpy1V$react).createElement((0, $8c8ab388b155237e$export$baf37c4be89255b8).Provider, {
|
|
261
299
|
value: state
|
|
262
300
|
}, children))));
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C;ACX1C;;;;;;;;;;ACAA;;;;;;;;;;CAUC;AAKM,MAAM,4CAAuB,CAAA,GAAA,YAAI,EAAE,cAAyC;;CDLlF;;;;;;;;;;;;;;;;;;;;;;;;;AEVD,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAhBA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,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,gBAAgB;QAC3D;qBAGJ,gCAAC,CAAA,GAAA,eAAO;QAAE,cAAc;QAAc,iBAAiB,MAAM,YAAY,YAAY;qBACnF,gCAAC,CAAA,GAAA,yCAAmB,EAAE;QAAS,OAAO;OACnC;AAMb;AAEA;;CAEC,GACD,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,WAAW;;","sources":["packages/@react-spectrum/checkbox/src/index.ts","packages/@react-spectrum/checkbox/src/Checkbox.tsx","packages/@react-spectrum/checkbox/src/context.ts","packages/@adobe/spectrum-css-temp/components/checkbox/vars.css","packages/@react-spectrum/checkbox/src/CheckboxGroup.tsx","packages/@adobe/spectrum-css-temp/components/fieldgroup/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Checkbox} from './Checkbox';\nexport {CheckboxGroup} from './CheckboxGroup';\nexport type {SpectrumCheckboxProps, SpectrumCheckboxGroupProps} from '@react-types/checkbox';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport CheckmarkSmall from '@spectrum-icons/ui/CheckmarkSmall';\nimport {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport DashSmall from '@spectrum-icons/ui/DashSmall';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useContext, useRef} from 'react';\nimport {SpectrumCheckboxProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/checkbox/vars.css';\nimport {useCheckbox, useCheckboxGroupItem} from '@react-aria/checkbox';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useToggleState} from '@react-stately/toggle';\n\nfunction Checkbox(props: SpectrumCheckboxProps, ref: FocusableRef<HTMLLabelElement>) {\n let originalProps = props;\n props = useProviderProps(props);\n let {\n isIndeterminate = false,\n isEmphasized = false,\n isDisabled = false,\n autoFocus,\n children,\n validationState,\n isInvalid,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n // Swap hooks depending on whether this checkbox is inside a CheckboxGroup.\n // This is a bit unorthodox. Typically, hooks cannot be called in a conditional,\n // but since the checkbox won't move in and out of a group, it should be safe.\n let groupState = useContext(CheckboxGroupContext);\n let {inputProps} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...props,\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // Only pass isRequired and validationState to react-aria if they came from\n // the props for this individual checkbox, and not from the group via context.\n isRequired: originalProps.isRequired,\n validationState: originalProps.validationState,\n isInvalid: originalProps.isInvalid\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox(props, useToggleState(props), inputRef);\n\n let markIcon = isIndeterminate\n ? <DashSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-partialCheckmark')} />\n : <CheckmarkSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-checkmark')} />;\n\n if (groupState) {\n for (let key of ['isSelected', 'defaultSelected', 'isEmphasized']) {\n if (originalProps[key] != null) {\n console.warn(`${key} is unsupported on individual <Checkbox> elements within a <CheckboxGroup>. Please apply these props to the group instead.`);\n }\n }\n if (props.value == null) {\n console.warn('A <Checkbox> element within a <CheckboxGroup> requires a `value` property.');\n }\n }\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Checkbox',\n {\n 'is-checked': inputProps.checked,\n 'is-indeterminate': isIndeterminate,\n 'spectrum-Checkbox--quiet': !isEmphasized,\n 'is-invalid': isInvalid || validationState === 'invalid',\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Checkbox-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Checkbox-box')}>{markIcon}</span>\n {children && (\n <span className={classNames(styles, 'spectrum-Checkbox-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n/**\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n */\nlet _Checkbox = forwardRef(Checkbox);\nexport {_Checkbox as Checkbox};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport React from 'react';\n\nexport const CheckboxGroupContext = React.createContext<CheckboxGroupState | null>(null);\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {Provider, useProviderProps} from '@react-spectrum/provider';\nimport React from 'react';\nimport {SpectrumCheckboxGroupProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useCheckboxGroup} from '@react-aria/checkbox';\nimport {useCheckboxGroupState} from '@react-stately/checkbox';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction CheckboxGroup(props: SpectrumCheckboxGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n children,\n orientation = 'vertical'\n } = props;\n let domRef = useDOMRef(ref);\n let state = useCheckboxGroupState(props);\n let {labelProps, groupProps, descriptionProps, errorMessageProps} = useCheckboxGroup(props, state);\n\n return (\n <Field\n {...props}\n ref={domRef}\n wrapperClassName={classNames(styles, 'spectrum-FieldGroup')}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n elementType=\"span\"\n includeNecessityIndicatorInAccessibilityName>\n <div\n {...groupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <Provider isEmphasized={isEmphasized} validationState={state.isInvalid ? 'invalid' : undefined}>\n <CheckboxGroupContext.Provider value={state}>\n {children}\n </CheckboxGroupContext.Provider>\n </Provider>\n </div>\n </Field>\n );\n}\n\n/**\n * A CheckboxGroup allows users to select one or more items from a list of choices.\n */\nconst _CheckboxGroup = React.forwardRef(CheckboxGroup);\nexport {_CheckboxGroup as CheckboxGroup};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAPA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0D,CAAC,4CAA4C,CAAC;AACxG,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BA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,gCAAC;QACE,GAAG,UAAU;QACd,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,6CAAK,GACL,6BACA;YACE,yCAAyC,gBAAgB;QAC3D;qBAGJ,gCAAC,CAAA,GAAA,eAAO;QAAE,cAAc;qBACtB,gCAAC,CAAA,GAAA,yCAAmB,EAAE,QAAQ;QAAC,OAAO;OACnC;AAMb;AAEA;;CAEC,GACD,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;;","sources":["packages/@adobe/spectrum-css-temp/components/fieldgroup/vars.css","packages/@react-spectrum/checkbox/src/index.ts","packages/@react-spectrum/checkbox/src/Checkbox.tsx","packages/@react-spectrum/checkbox/src/context.ts","packages/@adobe/spectrum-css-temp/components/checkbox/vars.css","packages/@react-spectrum/checkbox/src/CheckboxGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Checkbox} from './Checkbox';\nexport {CheckboxGroup} from './CheckboxGroup';\nexport type {SpectrumCheckboxProps, SpectrumCheckboxGroupProps} from '@react-types/checkbox';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport CheckmarkSmall from '@spectrum-icons/ui/CheckmarkSmall';\nimport {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport DashSmall from '@spectrum-icons/ui/DashSmall';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useContext, useRef} from 'react';\nimport {SpectrumCheckboxProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/checkbox/vars.css';\nimport {useCheckbox, useCheckboxGroupItem} from '@react-aria/checkbox';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useToggleState} from '@react-stately/toggle';\n\nfunction Checkbox(props: SpectrumCheckboxProps, ref: FocusableRef<HTMLLabelElement>) {\n let originalProps = props;\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isIndeterminate = false,\n isEmphasized = false,\n isDisabled = false,\n autoFocus,\n children,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n // Swap hooks depending on whether this checkbox is inside a CheckboxGroup.\n // This is a bit unorthodox. Typically, hooks cannot be called in a conditional,\n // but since the checkbox won't move in and out of a group, it should be safe.\n let groupState = useContext(CheckboxGroupContext);\n let {inputProps, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...props,\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // Only pass isRequired and validationState to react-aria if they came from\n // the props for this individual checkbox, and not from the group via context.\n isRequired: originalProps.isRequired,\n validationState: originalProps.validationState,\n isInvalid: originalProps.isInvalid\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox(props, useToggleState(props), inputRef);\n\n let markIcon = isIndeterminate\n ? <DashSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-partialCheckmark')} />\n : <CheckmarkSmall UNSAFE_className={classNames(styles, 'spectrum-Checkbox-checkmark')} />;\n\n if (groupState) {\n for (let key of ['isSelected', 'defaultSelected', 'isEmphasized']) {\n if (originalProps[key] != null) {\n console.warn(`${key} is unsupported on individual <Checkbox> elements within a <CheckboxGroup>. Please apply these props to the group instead.`);\n }\n }\n if (props.value == null) {\n console.warn('A <Checkbox> element within a <CheckboxGroup> requires a `value` property.');\n }\n }\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Checkbox',\n {\n 'is-checked': inputProps.checked,\n 'is-indeterminate': isIndeterminate,\n 'spectrum-Checkbox--quiet': !isEmphasized,\n 'is-invalid': isInvalid,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Checkbox-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Checkbox-box')}>{markIcon}</span>\n {children && (\n <span className={classNames(styles, 'spectrum-Checkbox-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n/**\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n */\nlet _Checkbox = forwardRef(Checkbox);\nexport {_Checkbox as Checkbox};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport React from 'react';\n\nexport const CheckboxGroupContext = React.createContext<CheckboxGroupState | null>(null);\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CheckboxGroupContext} from './context';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {Provider, useProviderProps} from '@react-spectrum/provider';\nimport React from 'react';\nimport {SpectrumCheckboxGroupProps} from '@react-types/checkbox';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useCheckboxGroup} from '@react-aria/checkbox';\nimport {useCheckboxGroupState} from '@react-stately/checkbox';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction CheckboxGroup(props: SpectrumCheckboxGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n children,\n orientation = 'vertical'\n } = props;\n let domRef = useDOMRef(ref);\n let state = useCheckboxGroupState(props);\n let {groupProps, ...otherProps} = useCheckboxGroup(props, state);\n\n return (\n <Field\n {...props}\n {...otherProps}\n ref={domRef}\n wrapperClassName={classNames(styles, 'spectrum-FieldGroup')}\n elementType=\"span\"\n includeNecessityIndicatorInAccessibilityName>\n <div\n {...groupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <Provider isEmphasized={isEmphasized}>\n <CheckboxGroupContext.Provider value={state}>\n {children}\n </CheckboxGroupContext.Provider>\n </Provider>\n </div>\n </Field>\n );\n}\n\n/**\n * A CheckboxGroup allows users to select one or more items from a list of choices.\n */\nconst _CheckboxGroup = React.forwardRef(CheckboxGroup);\nexport {_CheckboxGroup as CheckboxGroup};\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;ACoHA;;;GAGG;AACH,OAAA,IAAI,2KAAgC,CAAC;
|
|
1
|
+
{"mappings":";;ACoHA;;;GAGG;AACH,OAAA,IAAI,2KAAgC,CAAC;ACvDrC;;GAEG;AACH,OAAA,MAAM,2JAAgD,CAAC;ACtDvD,YAAY,EAAC,qBAAqB,EAAE,0BAA0B,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-spectrum/checkbox/src/packages/@react-spectrum/checkbox/src/context.ts","packages/@react-spectrum/checkbox/src/packages/@react-spectrum/checkbox/src/Checkbox.tsx","packages/@react-spectrum/checkbox/src/packages/@react-spectrum/checkbox/src/CheckboxGroup.tsx","packages/@react-spectrum/checkbox/src/packages/@react-spectrum/checkbox/src/index.ts","packages/@react-spectrum/checkbox/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Checkbox} from './Checkbox';\nexport {CheckboxGroup} from './CheckboxGroup';\nexport type {SpectrumCheckboxProps, SpectrumCheckboxGroupProps} from '@react-types/checkbox';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/checkbox",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.2534+403ec27bf",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/checkbox": "3.0.0-nightly.
|
|
40
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
41
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
42
|
-
"@react-spectrum/form": "3.0.0-nightly.
|
|
43
|
-
"@react-spectrum/label": "3.15.2-nightly.
|
|
44
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
|
45
|
-
"@react-stately/checkbox": "3.5.2-nightly.
|
|
46
|
-
"@react-stately/toggle": "3.0.0-nightly.
|
|
47
|
-
"@react-types/checkbox": "3.0.0-nightly.
|
|
48
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
49
|
-
"@spectrum-icons/ui": "3.0.0-nightly.
|
|
39
|
+
"@react-aria/checkbox": "3.0.0-nightly.2534+403ec27bf",
|
|
40
|
+
"@react-aria/focus": "3.0.0-nightly.2534+403ec27bf",
|
|
41
|
+
"@react-aria/interactions": "3.0.0-nightly.2534+403ec27bf",
|
|
42
|
+
"@react-spectrum/form": "3.0.0-nightly.2534+403ec27bf",
|
|
43
|
+
"@react-spectrum/label": "3.15.2-nightly.4245+403ec27bf",
|
|
44
|
+
"@react-spectrum/utils": "3.0.0-nightly.2534+403ec27bf",
|
|
45
|
+
"@react-stately/checkbox": "3.5.2-nightly.4245+403ec27bf",
|
|
46
|
+
"@react-stately/toggle": "3.0.0-nightly.2534+403ec27bf",
|
|
47
|
+
"@react-types/checkbox": "3.0.0-nightly.2534+403ec27bf",
|
|
48
|
+
"@react-types/shared": "3.0.0-nightly.2534+403ec27bf",
|
|
49
|
+
"@spectrum-icons/ui": "3.0.0-nightly.2534+403ec27bf",
|
|
50
50
|
"@swc/helpers": "^0.5.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
|
53
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.2534+403ec27bf"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@react-spectrum/provider": "^3.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "403ec27bf8f5af6e19529b78782526f680c171ca"
|
|
63
63
|
}
|
package/src/Checkbox.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import React, {forwardRef, useContext, useRef} from 'react';
|
|
|
20
20
|
import {SpectrumCheckboxProps} from '@react-types/checkbox';
|
|
21
21
|
import styles from '@adobe/spectrum-css-temp/components/checkbox/vars.css';
|
|
22
22
|
import {useCheckbox, useCheckboxGroupItem} from '@react-aria/checkbox';
|
|
23
|
+
import {useFormProps} from '@react-spectrum/form';
|
|
23
24
|
import {useHover} from '@react-aria/interactions';
|
|
24
25
|
import {useProviderProps} from '@react-spectrum/provider';
|
|
25
26
|
import {useToggleState} from '@react-stately/toggle';
|
|
@@ -27,14 +28,13 @@ import {useToggleState} from '@react-stately/toggle';
|
|
|
27
28
|
function Checkbox(props: SpectrumCheckboxProps, ref: FocusableRef<HTMLLabelElement>) {
|
|
28
29
|
let originalProps = props;
|
|
29
30
|
props = useProviderProps(props);
|
|
31
|
+
props = useFormProps(props);
|
|
30
32
|
let {
|
|
31
33
|
isIndeterminate = false,
|
|
32
34
|
isEmphasized = false,
|
|
33
35
|
isDisabled = false,
|
|
34
36
|
autoFocus,
|
|
35
37
|
children,
|
|
36
|
-
validationState,
|
|
37
|
-
isInvalid,
|
|
38
38
|
...otherProps
|
|
39
39
|
} = props;
|
|
40
40
|
let {styleProps} = useStyleProps(otherProps);
|
|
@@ -47,7 +47,7 @@ function Checkbox(props: SpectrumCheckboxProps, ref: FocusableRef<HTMLLabelEleme
|
|
|
47
47
|
// This is a bit unorthodox. Typically, hooks cannot be called in a conditional,
|
|
48
48
|
// but since the checkbox won't move in and out of a group, it should be safe.
|
|
49
49
|
let groupState = useContext(CheckboxGroupContext);
|
|
50
|
-
let {inputProps} = groupState
|
|
50
|
+
let {inputProps, isInvalid} = groupState
|
|
51
51
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
52
52
|
? useCheckboxGroupItem({
|
|
53
53
|
...props,
|
|
@@ -92,7 +92,7 @@ function Checkbox(props: SpectrumCheckboxProps, ref: FocusableRef<HTMLLabelEleme
|
|
|
92
92
|
'is-checked': inputProps.checked,
|
|
93
93
|
'is-indeterminate': isIndeterminate,
|
|
94
94
|
'spectrum-Checkbox--quiet': !isEmphasized,
|
|
95
|
-
'is-invalid': isInvalid
|
|
95
|
+
'is-invalid': isInvalid,
|
|
96
96
|
'is-disabled': isDisabled,
|
|
97
97
|
'is-hovered': isHovered
|
|
98
98
|
},
|
package/src/CheckboxGroup.tsx
CHANGED
|
@@ -32,16 +32,14 @@ function CheckboxGroup(props: SpectrumCheckboxGroupProps, ref: DOMRef<HTMLDivEle
|
|
|
32
32
|
} = props;
|
|
33
33
|
let domRef = useDOMRef(ref);
|
|
34
34
|
let state = useCheckboxGroupState(props);
|
|
35
|
-
let {
|
|
35
|
+
let {groupProps, ...otherProps} = useCheckboxGroup(props, state);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<Field
|
|
39
39
|
{...props}
|
|
40
|
+
{...otherProps}
|
|
40
41
|
ref={domRef}
|
|
41
42
|
wrapperClassName={classNames(styles, 'spectrum-FieldGroup')}
|
|
42
|
-
labelProps={labelProps}
|
|
43
|
-
descriptionProps={descriptionProps}
|
|
44
|
-
errorMessageProps={errorMessageProps}
|
|
45
43
|
elementType="span"
|
|
46
44
|
includeNecessityIndicatorInAccessibilityName>
|
|
47
45
|
<div
|
|
@@ -55,7 +53,7 @@ function CheckboxGroup(props: SpectrumCheckboxGroupProps, ref: DOMRef<HTMLDivEle
|
|
|
55
53
|
}
|
|
56
54
|
)
|
|
57
55
|
}>
|
|
58
|
-
<Provider isEmphasized={isEmphasized}
|
|
56
|
+
<Provider isEmphasized={isEmphasized}>
|
|
59
57
|
<CheckboxGroupContext.Provider value={state}>
|
|
60
58
|
{children}
|
|
61
59
|
</CheckboxGroupContext.Provider>
|