@react-spectrum/checkbox 3.9.3 → 3.9.5
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/Checkbox.main.js +121 -0
- package/dist/Checkbox.main.js.map +1 -0
- package/dist/Checkbox.mjs +116 -0
- package/dist/Checkbox.module.js +116 -0
- package/dist/Checkbox.module.js.map +1 -0
- package/dist/CheckboxGroup.main.js +71 -0
- package/dist/CheckboxGroup.main.js.map +1 -0
- package/dist/CheckboxGroup.mjs +66 -0
- package/dist/CheckboxGroup.module.js +66 -0
- package/dist/CheckboxGroup.module.js.map +1 -0
- package/dist/checkbox_vars_css.main.js +59 -0
- package/dist/checkbox_vars_css.main.js.map +1 -0
- package/dist/checkbox_vars_css.mjs +61 -0
- package/dist/checkbox_vars_css.module.js +61 -0
- package/dist/checkbox_vars_css.module.js.map +1 -0
- package/dist/context.main.js +27 -0
- package/dist/context.main.js.map +1 -0
- package/dist/context.mjs +18 -0
- package/dist/context.module.js +18 -0
- package/dist/context.module.js.map +1 -0
- package/dist/fieldgroup_vars_css.main.js +32 -0
- package/dist/fieldgroup_vars_css.main.js.map +1 -0
- package/dist/fieldgroup_vars_css.mjs +34 -0
- package/dist/fieldgroup_vars_css.module.js +34 -0
- package/dist/fieldgroup_vars_css.module.js.map +1 -0
- package/dist/import.mjs +2 -255
- package/dist/main.js +4 -253
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -255
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vars.880c6573.css +94 -0
- package/dist/vars.880c6573.css.map +1 -0
- package/dist/vars.fe746eae.css +487 -0
- package/dist/vars.fe746eae.css.map +1 -0
- package/package.json +15 -14
- package/src/Checkbox.tsx +5 -3
- package/dist/main.css +0 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var $bdf3bf7fe71fe120$exports = require("./context.main.js");
|
|
2
|
+
require("./vars.fe746eae.css");
|
|
3
|
+
var $591f3ccba6339bdb$exports = require("./checkbox_vars_css.main.js");
|
|
4
|
+
var $lfSyy$reactariacomponents = require("react-aria-components");
|
|
5
|
+
var $lfSyy$spectrumiconsuiCheckmarkSmall = require("@spectrum-icons/ui/CheckmarkSmall");
|
|
6
|
+
var $lfSyy$reactspectrumutils = require("@react-spectrum/utils");
|
|
7
|
+
var $lfSyy$spectrumiconsuiDashSmall = require("@spectrum-icons/ui/DashSmall");
|
|
8
|
+
var $lfSyy$reactariafocus = require("@react-aria/focus");
|
|
9
|
+
var $lfSyy$react = require("react");
|
|
10
|
+
var $lfSyy$reactariacheckbox = require("@react-aria/checkbox");
|
|
11
|
+
var $lfSyy$reactspectrumform = require("@react-spectrum/form");
|
|
12
|
+
var $lfSyy$reactariainteractions = require("@react-aria/interactions");
|
|
13
|
+
var $lfSyy$reactspectrumprovider = require("@react-spectrum/provider");
|
|
14
|
+
var $lfSyy$reactstatelytoggle = require("@react-stately/toggle");
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function $parcel$interopDefault(a) {
|
|
18
|
+
return a && a.__esModule ? a.default : a;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function $parcel$export(e, n, v, s) {
|
|
22
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
$parcel$export(module.exports, "Checkbox", () => $096ccd12d23dd6cc$export$48513f6b9f8ce62d);
|
|
26
|
+
/*
|
|
27
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
28
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
29
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
30
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
31
|
+
*
|
|
32
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
33
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
34
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
35
|
+
* governing permissions and limitations under the License.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
function $096ccd12d23dd6cc$var$Checkbox(props, ref) {
|
|
50
|
+
let originalProps = props;
|
|
51
|
+
let inputRef = (0, $lfSyy$react.useRef)(null);
|
|
52
|
+
let domRef = (0, $lfSyy$reactspectrumutils.useFocusableRef)(ref, inputRef);
|
|
53
|
+
[props, domRef] = (0, $lfSyy$reactariacomponents.useContextProps)(props, domRef, (0, $lfSyy$reactariacomponents.CheckboxContext));
|
|
54
|
+
props = (0, $lfSyy$reactspectrumprovider.useProviderProps)(props);
|
|
55
|
+
props = (0, $lfSyy$reactspectrumform.useFormProps)(props);
|
|
56
|
+
let { isIndeterminate: isIndeterminate = false, isEmphasized: isEmphasized = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
57
|
+
let { styleProps: styleProps } = (0, $lfSyy$reactspectrumutils.useStyleProps)(otherProps);
|
|
58
|
+
// Swap hooks depending on whether this checkbox is inside a CheckboxGroup.
|
|
59
|
+
// This is a bit unorthodox. Typically, hooks cannot be called in a conditional,
|
|
60
|
+
// but since the checkbox won't move in and out of a group, it should be safe.
|
|
61
|
+
let groupState = (0, $lfSyy$react.useContext)((0, $bdf3bf7fe71fe120$exports.CheckboxGroupContext));
|
|
62
|
+
let { inputProps: inputProps, isInvalid: isInvalid, isDisabled: isDisabled } = groupState ? (0, $lfSyy$reactariacheckbox.useCheckboxGroupItem)({
|
|
63
|
+
...props,
|
|
64
|
+
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
65
|
+
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
value: props.value,
|
|
68
|
+
// Only pass isRequired and validationState to react-aria if they came from
|
|
69
|
+
// the props for this individual checkbox, and not from the group via context.
|
|
70
|
+
isRequired: originalProps.isRequired,
|
|
71
|
+
validationState: originalProps.validationState,
|
|
72
|
+
isInvalid: originalProps.isInvalid
|
|
73
|
+
}, groupState, inputRef) : (0, $lfSyy$reactariacheckbox.useCheckbox)(props, (0, $lfSyy$reactstatelytoggle.useToggleState)(props), inputRef);
|
|
74
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $lfSyy$reactariainteractions.useHover)({
|
|
75
|
+
isDisabled: isDisabled
|
|
76
|
+
});
|
|
77
|
+
let markIcon = isIndeterminate ? /*#__PURE__*/ (0, ($parcel$interopDefault($lfSyy$react))).createElement((0, ($parcel$interopDefault($lfSyy$spectrumiconsuiDashSmall))), {
|
|
78
|
+
UNSAFE_className: (0, $lfSyy$reactspectrumutils.classNames)((0, ($parcel$interopDefault($591f3ccba6339bdb$exports))), "spectrum-Checkbox-partialCheckmark")
|
|
79
|
+
}) : /*#__PURE__*/ (0, ($parcel$interopDefault($lfSyy$react))).createElement((0, ($parcel$interopDefault($lfSyy$spectrumiconsuiCheckmarkSmall))), {
|
|
80
|
+
UNSAFE_className: (0, $lfSyy$reactspectrumutils.classNames)((0, ($parcel$interopDefault($591f3ccba6339bdb$exports))), "spectrum-Checkbox-checkmark")
|
|
81
|
+
});
|
|
82
|
+
if (groupState) {
|
|
83
|
+
for (let key of [
|
|
84
|
+
"isSelected",
|
|
85
|
+
"defaultSelected",
|
|
86
|
+
"isEmphasized"
|
|
87
|
+
])if (originalProps[key] != null) console.warn(`${key} is unsupported on individual <Checkbox> elements within a <CheckboxGroup>. Please apply these props to the group instead.`);
|
|
88
|
+
if (props.value == null) console.warn("A <Checkbox> element within a <CheckboxGroup> requires a `value` property.");
|
|
89
|
+
}
|
|
90
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($lfSyy$react))).createElement("label", {
|
|
91
|
+
...styleProps,
|
|
92
|
+
...hoverProps,
|
|
93
|
+
ref: domRef,
|
|
94
|
+
className: (0, $lfSyy$reactspectrumutils.classNames)((0, ($parcel$interopDefault($591f3ccba6339bdb$exports))), "spectrum-Checkbox", {
|
|
95
|
+
"is-checked": inputProps.checked,
|
|
96
|
+
"is-indeterminate": isIndeterminate,
|
|
97
|
+
"spectrum-Checkbox--quiet": !isEmphasized,
|
|
98
|
+
"is-invalid": isInvalid,
|
|
99
|
+
"is-disabled": isDisabled,
|
|
100
|
+
"is-hovered": isHovered
|
|
101
|
+
}, styleProps.className)
|
|
102
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($lfSyy$react))).createElement((0, $lfSyy$reactariafocus.FocusRing), {
|
|
103
|
+
focusRingClass: (0, $lfSyy$reactspectrumutils.classNames)((0, ($parcel$interopDefault($591f3ccba6339bdb$exports))), "focus-ring"),
|
|
104
|
+
autoFocus: autoFocus
|
|
105
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($lfSyy$react))).createElement("input", {
|
|
106
|
+
...inputProps,
|
|
107
|
+
ref: inputRef,
|
|
108
|
+
className: (0, $lfSyy$reactspectrumutils.classNames)((0, ($parcel$interopDefault($591f3ccba6339bdb$exports))), "spectrum-Checkbox-input")
|
|
109
|
+
})), /*#__PURE__*/ (0, ($parcel$interopDefault($lfSyy$react))).createElement("span", {
|
|
110
|
+
className: (0, $lfSyy$reactspectrumutils.classNames)((0, ($parcel$interopDefault($591f3ccba6339bdb$exports))), "spectrum-Checkbox-box")
|
|
111
|
+
}, markIcon), children && /*#__PURE__*/ (0, ($parcel$interopDefault($lfSyy$react))).createElement("span", {
|
|
112
|
+
className: (0, $lfSyy$reactspectrumutils.classNames)((0, ($parcel$interopDefault($591f3ccba6339bdb$exports))), "spectrum-Checkbox-label")
|
|
113
|
+
}, children));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Checkboxes allow users to select multiple items from a list of individual items,
|
|
117
|
+
* or to mark one individual item as selected.
|
|
118
|
+
*/ let $096ccd12d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ox/src/Checkbox.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\nimport {CheckboxContext, useContextProps} from 'react-aria-components';\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 let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n [props, domRef] = useContextProps(props, domRef, CheckboxContext);\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isIndeterminate = false,\n isEmphasized = false,\n autoFocus,\n children,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\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, isDisabled} = 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 {hoverProps, isHovered} = useHover({isDisabled});\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"],"names":[],"version":3,"file":"Checkbox.main.js.map"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {CheckboxGroupContext as $8c8ab388b155237e$export$baf37c4be89255b8} from "./context.mjs";
|
|
2
|
+
import "./vars.fe746eae.css";
|
|
3
|
+
import $cvQES$checkbox_vars_cssmodulejs from "./checkbox_vars_css.mjs";
|
|
4
|
+
import {useContextProps as $cvQES$useContextProps, CheckboxContext as $cvQES$CheckboxContext} from "react-aria-components";
|
|
5
|
+
import $cvQES$spectrumiconsuiCheckmarkSmall from "@spectrum-icons/ui/CheckmarkSmall";
|
|
6
|
+
import {useFocusableRef as $cvQES$useFocusableRef, useStyleProps as $cvQES$useStyleProps, classNames as $cvQES$classNames} from "@react-spectrum/utils";
|
|
7
|
+
import $cvQES$spectrumiconsuiDashSmall from "@spectrum-icons/ui/DashSmall";
|
|
8
|
+
import {FocusRing as $cvQES$FocusRing} from "@react-aria/focus";
|
|
9
|
+
import $cvQES$react, {useRef as $cvQES$useRef, useContext as $cvQES$useContext, forwardRef as $cvQES$forwardRef} from "react";
|
|
10
|
+
import {useCheckboxGroupItem as $cvQES$useCheckboxGroupItem, useCheckbox as $cvQES$useCheckbox} from "@react-aria/checkbox";
|
|
11
|
+
import {useFormProps as $cvQES$useFormProps} from "@react-spectrum/form";
|
|
12
|
+
import {useHover as $cvQES$useHover} from "@react-aria/interactions";
|
|
13
|
+
import {useProviderProps as $cvQES$useProviderProps} from "@react-spectrum/provider";
|
|
14
|
+
import {useToggleState as $cvQES$useToggleState} from "@react-stately/toggle";
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function $parcel$interopDefault(a) {
|
|
18
|
+
return a && a.__esModule ? a.default : a;
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
22
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
24
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
27
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
|
+
* governing permissions and limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
44
|
+
let originalProps = props;
|
|
45
|
+
let inputRef = (0, $cvQES$useRef)(null);
|
|
46
|
+
let domRef = (0, $cvQES$useFocusableRef)(ref, inputRef);
|
|
47
|
+
[props, domRef] = (0, $cvQES$useContextProps)(props, domRef, (0, $cvQES$CheckboxContext));
|
|
48
|
+
props = (0, $cvQES$useProviderProps)(props);
|
|
49
|
+
props = (0, $cvQES$useFormProps)(props);
|
|
50
|
+
let { isIndeterminate: isIndeterminate = false, isEmphasized: isEmphasized = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
51
|
+
let { styleProps: styleProps } = (0, $cvQES$useStyleProps)(otherProps);
|
|
52
|
+
// Swap hooks depending on whether this checkbox is inside a CheckboxGroup.
|
|
53
|
+
// This is a bit unorthodox. Typically, hooks cannot be called in a conditional,
|
|
54
|
+
// but since the checkbox won't move in and out of a group, it should be safe.
|
|
55
|
+
let groupState = (0, $cvQES$useContext)((0, $8c8ab388b155237e$export$baf37c4be89255b8));
|
|
56
|
+
let { inputProps: inputProps, isInvalid: isInvalid, isDisabled: isDisabled } = groupState ? (0, $cvQES$useCheckboxGroupItem)({
|
|
57
|
+
...props,
|
|
58
|
+
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
59
|
+
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
value: props.value,
|
|
62
|
+
// Only pass isRequired and validationState to react-aria if they came from
|
|
63
|
+
// the props for this individual checkbox, and not from the group via context.
|
|
64
|
+
isRequired: originalProps.isRequired,
|
|
65
|
+
validationState: originalProps.validationState,
|
|
66
|
+
isInvalid: originalProps.isInvalid
|
|
67
|
+
}, groupState, inputRef) : (0, $cvQES$useCheckbox)(props, (0, $cvQES$useToggleState)(props), inputRef);
|
|
68
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $cvQES$useHover)({
|
|
69
|
+
isDisabled: isDisabled
|
|
70
|
+
});
|
|
71
|
+
let markIcon = isIndeterminate ? /*#__PURE__*/ (0, $cvQES$react).createElement((0, $cvQES$spectrumiconsuiDashSmall), {
|
|
72
|
+
UNSAFE_className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-partialCheckmark")
|
|
73
|
+
}) : /*#__PURE__*/ (0, $cvQES$react).createElement((0, $cvQES$spectrumiconsuiCheckmarkSmall), {
|
|
74
|
+
UNSAFE_className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-checkmark")
|
|
75
|
+
});
|
|
76
|
+
if (groupState) {
|
|
77
|
+
for (let key of [
|
|
78
|
+
"isSelected",
|
|
79
|
+
"defaultSelected",
|
|
80
|
+
"isEmphasized"
|
|
81
|
+
])if (originalProps[key] != null) console.warn(`${key} is unsupported on individual <Checkbox> elements within a <CheckboxGroup>. Please apply these props to the group instead.`);
|
|
82
|
+
if (props.value == null) console.warn("A <Checkbox> element within a <CheckboxGroup> requires a `value` property.");
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/ (0, $cvQES$react).createElement("label", {
|
|
85
|
+
...styleProps,
|
|
86
|
+
...hoverProps,
|
|
87
|
+
ref: domRef,
|
|
88
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox", {
|
|
89
|
+
"is-checked": inputProps.checked,
|
|
90
|
+
"is-indeterminate": isIndeterminate,
|
|
91
|
+
"spectrum-Checkbox--quiet": !isEmphasized,
|
|
92
|
+
"is-invalid": isInvalid,
|
|
93
|
+
"is-disabled": isDisabled,
|
|
94
|
+
"is-hovered": isHovered
|
|
95
|
+
}, styleProps.className)
|
|
96
|
+
}, /*#__PURE__*/ (0, $cvQES$react).createElement((0, $cvQES$FocusRing), {
|
|
97
|
+
focusRingClass: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "focus-ring"),
|
|
98
|
+
autoFocus: autoFocus
|
|
99
|
+
}, /*#__PURE__*/ (0, $cvQES$react).createElement("input", {
|
|
100
|
+
...inputProps,
|
|
101
|
+
ref: inputRef,
|
|
102
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-input")
|
|
103
|
+
})), /*#__PURE__*/ (0, $cvQES$react).createElement("span", {
|
|
104
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-box")
|
|
105
|
+
}, markIcon), children && /*#__PURE__*/ (0, $cvQES$react).createElement("span", {
|
|
106
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-label")
|
|
107
|
+
}, children));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Checkboxes allow users to select multiple items from a list of individual items,
|
|
111
|
+
* or to mark one individual item as selected.
|
|
112
|
+
*/ let $25b6292d81af2844$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $cvQES$forwardRef)($25b6292d81af2844$var$Checkbox);
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export {$25b6292d81af2844$export$48513f6b9f8ce62d as Checkbox};
|
|
116
|
+
//# sourceMappingURL=Checkbox.mjs.map
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {CheckboxGroupContext as $8c8ab388b155237e$export$baf37c4be89255b8} from "./context.module.js";
|
|
2
|
+
import "./vars.fe746eae.css";
|
|
3
|
+
import $cvQES$checkbox_vars_cssmodulejs from "./checkbox_vars_css.module.js";
|
|
4
|
+
import {useContextProps as $cvQES$useContextProps, CheckboxContext as $cvQES$CheckboxContext} from "react-aria-components";
|
|
5
|
+
import $cvQES$spectrumiconsuiCheckmarkSmall from "@spectrum-icons/ui/CheckmarkSmall";
|
|
6
|
+
import {useFocusableRef as $cvQES$useFocusableRef, useStyleProps as $cvQES$useStyleProps, classNames as $cvQES$classNames} from "@react-spectrum/utils";
|
|
7
|
+
import $cvQES$spectrumiconsuiDashSmall from "@spectrum-icons/ui/DashSmall";
|
|
8
|
+
import {FocusRing as $cvQES$FocusRing} from "@react-aria/focus";
|
|
9
|
+
import $cvQES$react, {useRef as $cvQES$useRef, useContext as $cvQES$useContext, forwardRef as $cvQES$forwardRef} from "react";
|
|
10
|
+
import {useCheckboxGroupItem as $cvQES$useCheckboxGroupItem, useCheckbox as $cvQES$useCheckbox} from "@react-aria/checkbox";
|
|
11
|
+
import {useFormProps as $cvQES$useFormProps} from "@react-spectrum/form";
|
|
12
|
+
import {useHover as $cvQES$useHover} from "@react-aria/interactions";
|
|
13
|
+
import {useProviderProps as $cvQES$useProviderProps} from "@react-spectrum/provider";
|
|
14
|
+
import {useToggleState as $cvQES$useToggleState} from "@react-stately/toggle";
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function $parcel$interopDefault(a) {
|
|
18
|
+
return a && a.__esModule ? a.default : a;
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
22
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
24
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
27
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
|
+
* governing permissions and limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function $25b6292d81af2844$var$Checkbox(props, ref) {
|
|
44
|
+
let originalProps = props;
|
|
45
|
+
let inputRef = (0, $cvQES$useRef)(null);
|
|
46
|
+
let domRef = (0, $cvQES$useFocusableRef)(ref, inputRef);
|
|
47
|
+
[props, domRef] = (0, $cvQES$useContextProps)(props, domRef, (0, $cvQES$CheckboxContext));
|
|
48
|
+
props = (0, $cvQES$useProviderProps)(props);
|
|
49
|
+
props = (0, $cvQES$useFormProps)(props);
|
|
50
|
+
let { isIndeterminate: isIndeterminate = false, isEmphasized: isEmphasized = false, autoFocus: autoFocus, children: children, ...otherProps } = props;
|
|
51
|
+
let { styleProps: styleProps } = (0, $cvQES$useStyleProps)(otherProps);
|
|
52
|
+
// Swap hooks depending on whether this checkbox is inside a CheckboxGroup.
|
|
53
|
+
// This is a bit unorthodox. Typically, hooks cannot be called in a conditional,
|
|
54
|
+
// but since the checkbox won't move in and out of a group, it should be safe.
|
|
55
|
+
let groupState = (0, $cvQES$useContext)((0, $8c8ab388b155237e$export$baf37c4be89255b8));
|
|
56
|
+
let { inputProps: inputProps, isInvalid: isInvalid, isDisabled: isDisabled } = groupState ? (0, $cvQES$useCheckboxGroupItem)({
|
|
57
|
+
...props,
|
|
58
|
+
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
59
|
+
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
value: props.value,
|
|
62
|
+
// Only pass isRequired and validationState to react-aria if they came from
|
|
63
|
+
// the props for this individual checkbox, and not from the group via context.
|
|
64
|
+
isRequired: originalProps.isRequired,
|
|
65
|
+
validationState: originalProps.validationState,
|
|
66
|
+
isInvalid: originalProps.isInvalid
|
|
67
|
+
}, groupState, inputRef) : (0, $cvQES$useCheckbox)(props, (0, $cvQES$useToggleState)(props), inputRef);
|
|
68
|
+
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $cvQES$useHover)({
|
|
69
|
+
isDisabled: isDisabled
|
|
70
|
+
});
|
|
71
|
+
let markIcon = isIndeterminate ? /*#__PURE__*/ (0, $cvQES$react).createElement((0, $cvQES$spectrumiconsuiDashSmall), {
|
|
72
|
+
UNSAFE_className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-partialCheckmark")
|
|
73
|
+
}) : /*#__PURE__*/ (0, $cvQES$react).createElement((0, $cvQES$spectrumiconsuiCheckmarkSmall), {
|
|
74
|
+
UNSAFE_className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-checkmark")
|
|
75
|
+
});
|
|
76
|
+
if (groupState) {
|
|
77
|
+
for (let key of [
|
|
78
|
+
"isSelected",
|
|
79
|
+
"defaultSelected",
|
|
80
|
+
"isEmphasized"
|
|
81
|
+
])if (originalProps[key] != null) console.warn(`${key} is unsupported on individual <Checkbox> elements within a <CheckboxGroup>. Please apply these props to the group instead.`);
|
|
82
|
+
if (props.value == null) console.warn("A <Checkbox> element within a <CheckboxGroup> requires a `value` property.");
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/ (0, $cvQES$react).createElement("label", {
|
|
85
|
+
...styleProps,
|
|
86
|
+
...hoverProps,
|
|
87
|
+
ref: domRef,
|
|
88
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox", {
|
|
89
|
+
"is-checked": inputProps.checked,
|
|
90
|
+
"is-indeterminate": isIndeterminate,
|
|
91
|
+
"spectrum-Checkbox--quiet": !isEmphasized,
|
|
92
|
+
"is-invalid": isInvalid,
|
|
93
|
+
"is-disabled": isDisabled,
|
|
94
|
+
"is-hovered": isHovered
|
|
95
|
+
}, styleProps.className)
|
|
96
|
+
}, /*#__PURE__*/ (0, $cvQES$react).createElement((0, $cvQES$FocusRing), {
|
|
97
|
+
focusRingClass: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "focus-ring"),
|
|
98
|
+
autoFocus: autoFocus
|
|
99
|
+
}, /*#__PURE__*/ (0, $cvQES$react).createElement("input", {
|
|
100
|
+
...inputProps,
|
|
101
|
+
ref: inputRef,
|
|
102
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-input")
|
|
103
|
+
})), /*#__PURE__*/ (0, $cvQES$react).createElement("span", {
|
|
104
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-box")
|
|
105
|
+
}, markIcon), children && /*#__PURE__*/ (0, $cvQES$react).createElement("span", {
|
|
106
|
+
className: (0, $cvQES$classNames)((0, ($parcel$interopDefault($cvQES$checkbox_vars_cssmodulejs))), "spectrum-Checkbox-label")
|
|
107
|
+
}, children));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Checkboxes allow users to select multiple items from a list of individual items,
|
|
111
|
+
* or to mark one individual item as selected.
|
|
112
|
+
*/ let $25b6292d81af2844$export$48513f6b9f8ce62d = /*#__PURE__*/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/src/Checkbox.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\nimport {CheckboxContext, useContextProps} from 'react-aria-components';\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 let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n [props, domRef] = useContextProps(props, domRef, CheckboxContext);\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isIndeterminate = false,\n isEmphasized = false,\n autoFocus,\n children,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\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, isDisabled} = 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 {hoverProps, isHovered} = useHover({isDisabled});\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"],"names":[],"version":3,"file":"Checkbox.module.js.map"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var $bdf3bf7fe71fe120$exports = require("./context.main.js");
|
|
2
|
+
require("./vars.880c6573.css");
|
|
3
|
+
var $53124a3a0fd56fca$exports = require("./fieldgroup_vars_css.main.js");
|
|
4
|
+
var $5yQLk$reactspectrumutils = require("@react-spectrum/utils");
|
|
5
|
+
var $5yQLk$reactspectrumlabel = require("@react-spectrum/label");
|
|
6
|
+
var $5yQLk$reactspectrumprovider = require("@react-spectrum/provider");
|
|
7
|
+
var $5yQLk$react = require("react");
|
|
8
|
+
var $5yQLk$reactariacheckbox = require("@react-aria/checkbox");
|
|
9
|
+
var $5yQLk$reactstatelycheckbox = require("@react-stately/checkbox");
|
|
10
|
+
var $5yQLk$reactspectrumform = require("@react-spectrum/form");
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function $parcel$export(e, n, v, s) {
|
|
18
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
$parcel$export(module.exports, "CheckboxGroup", () => $1151290755e16c44$export$4aa08d5625cb8ead);
|
|
22
|
+
/*
|
|
23
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
24
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
*
|
|
28
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
+
* governing permissions and limitations under the License.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
function $1151290755e16c44$var$CheckboxGroup(props, ref) {
|
|
42
|
+
props = (0, $5yQLk$reactspectrumprovider.useProviderProps)(props);
|
|
43
|
+
props = (0, $5yQLk$reactspectrumform.useFormProps)(props);
|
|
44
|
+
let { isEmphasized: isEmphasized, children: children, orientation: orientation = "vertical" } = props;
|
|
45
|
+
let domRef = (0, $5yQLk$reactspectrumutils.useDOMRef)(ref);
|
|
46
|
+
let state = (0, $5yQLk$reactstatelycheckbox.useCheckboxGroupState)(props);
|
|
47
|
+
let { groupProps: groupProps, ...otherProps } = (0, $5yQLk$reactariacheckbox.useCheckboxGroup)(props, state);
|
|
48
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($5yQLk$react))).createElement((0, $5yQLk$reactspectrumlabel.Field), {
|
|
49
|
+
...props,
|
|
50
|
+
...otherProps,
|
|
51
|
+
ref: domRef,
|
|
52
|
+
wrapperClassName: (0, $5yQLk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($53124a3a0fd56fca$exports))), "spectrum-FieldGroup"),
|
|
53
|
+
elementType: "span",
|
|
54
|
+
includeNecessityIndicatorInAccessibilityName: true
|
|
55
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5yQLk$react))).createElement("div", {
|
|
56
|
+
...groupProps,
|
|
57
|
+
className: (0, $5yQLk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($53124a3a0fd56fca$exports))), "spectrum-FieldGroup-group", {
|
|
58
|
+
"spectrum-FieldGroup-group--horizontal": orientation === "horizontal"
|
|
59
|
+
})
|
|
60
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5yQLk$react))).createElement((0, $5yQLk$reactspectrumprovider.Provider), {
|
|
61
|
+
isEmphasized: isEmphasized
|
|
62
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5yQLk$react))).createElement((0, $bdf3bf7fe71fe120$exports.CheckboxGroupContext).Provider, {
|
|
63
|
+
value: state
|
|
64
|
+
}, children))));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A CheckboxGroup allows users to select one or more items from a list of choices.
|
|
68
|
+
*/ const $1151290755e16c44$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, ($parcel$interopDefault($5yQLk$react))).forwardRef($1151290755e16c44$var$CheckboxGroup);
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=CheckboxGroup.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcD,SAAS,oCAAc,KAAiC,EAAE,GAA2B;IACnF,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,gBACF,YAAY,YACZ,QAAQ,eACR,cAAc,YACf,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,QAAQ,CAAA,GAAA,iDAAoB,EAAE;IAClC,IAAI,cAAC,UAAU,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,yCAAe,EAAE,OAAO;IAE1D,qBACE,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,KAAK;QACR,GAAG,UAAU;QACd,KAAK;QACL,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QACrC,aAAY;QACZ,8CAAA;qBACA,0DAAC;QACE,GAAG,UAAU;QACd,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,6BACA;YACE,yCAAyC,gBAAgB;QAC3D;qBAGJ,0DAAC,CAAA,GAAA,qCAAO;QAAE,cAAc;qBACtB,0DAAC,CAAA,GAAA,8CAAmB,EAAE,QAAQ;QAAC,OAAO;OACnC;AAMb;AAEA;;CAEC,GACD,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["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\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":"CheckboxGroup.main.js.map"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {CheckboxGroupContext as $8c8ab388b155237e$export$baf37c4be89255b8} from "./context.mjs";
|
|
2
|
+
import "./vars.880c6573.css";
|
|
3
|
+
import $8sUxO$fieldgroup_vars_cssmodulejs from "./fieldgroup_vars_css.mjs";
|
|
4
|
+
import {useDOMRef as $8sUxO$useDOMRef, classNames as $8sUxO$classNames} from "@react-spectrum/utils";
|
|
5
|
+
import {Field as $8sUxO$Field} from "@react-spectrum/label";
|
|
6
|
+
import {useProviderProps as $8sUxO$useProviderProps, Provider as $8sUxO$Provider} from "@react-spectrum/provider";
|
|
7
|
+
import $8sUxO$react from "react";
|
|
8
|
+
import {useCheckboxGroup as $8sUxO$useCheckboxGroup} from "@react-aria/checkbox";
|
|
9
|
+
import {useCheckboxGroupState as $8sUxO$useCheckboxGroupState} from "@react-stately/checkbox";
|
|
10
|
+
import {useFormProps as $8sUxO$useFormProps} from "@react-spectrum/form";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function $73f43ce9d441cc69$var$CheckboxGroup(props, ref) {
|
|
36
|
+
props = (0, $8sUxO$useProviderProps)(props);
|
|
37
|
+
props = (0, $8sUxO$useFormProps)(props);
|
|
38
|
+
let { isEmphasized: isEmphasized, children: children, orientation: orientation = "vertical" } = props;
|
|
39
|
+
let domRef = (0, $8sUxO$useDOMRef)(ref);
|
|
40
|
+
let state = (0, $8sUxO$useCheckboxGroupState)(props);
|
|
41
|
+
let { groupProps: groupProps, ...otherProps } = (0, $8sUxO$useCheckboxGroup)(props, state);
|
|
42
|
+
return /*#__PURE__*/ (0, $8sUxO$react).createElement((0, $8sUxO$Field), {
|
|
43
|
+
...props,
|
|
44
|
+
...otherProps,
|
|
45
|
+
ref: domRef,
|
|
46
|
+
wrapperClassName: (0, $8sUxO$classNames)((0, ($parcel$interopDefault($8sUxO$fieldgroup_vars_cssmodulejs))), "spectrum-FieldGroup"),
|
|
47
|
+
elementType: "span",
|
|
48
|
+
includeNecessityIndicatorInAccessibilityName: true
|
|
49
|
+
}, /*#__PURE__*/ (0, $8sUxO$react).createElement("div", {
|
|
50
|
+
...groupProps,
|
|
51
|
+
className: (0, $8sUxO$classNames)((0, ($parcel$interopDefault($8sUxO$fieldgroup_vars_cssmodulejs))), "spectrum-FieldGroup-group", {
|
|
52
|
+
"spectrum-FieldGroup-group--horizontal": orientation === "horizontal"
|
|
53
|
+
})
|
|
54
|
+
}, /*#__PURE__*/ (0, $8sUxO$react).createElement((0, $8sUxO$Provider), {
|
|
55
|
+
isEmphasized: isEmphasized
|
|
56
|
+
}, /*#__PURE__*/ (0, $8sUxO$react).createElement((0, $8c8ab388b155237e$export$baf37c4be89255b8).Provider, {
|
|
57
|
+
value: state
|
|
58
|
+
}, children))));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A CheckboxGroup allows users to select one or more items from a list of choices.
|
|
62
|
+
*/ const $73f43ce9d441cc69$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $8sUxO$react).forwardRef($73f43ce9d441cc69$var$CheckboxGroup);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export {$73f43ce9d441cc69$export$4aa08d5625cb8ead as CheckboxGroup};
|
|
66
|
+
//# sourceMappingURL=CheckboxGroup.mjs.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {CheckboxGroupContext as $8c8ab388b155237e$export$baf37c4be89255b8} from "./context.module.js";
|
|
2
|
+
import "./vars.880c6573.css";
|
|
3
|
+
import $8sUxO$fieldgroup_vars_cssmodulejs from "./fieldgroup_vars_css.module.js";
|
|
4
|
+
import {useDOMRef as $8sUxO$useDOMRef, classNames as $8sUxO$classNames} from "@react-spectrum/utils";
|
|
5
|
+
import {Field as $8sUxO$Field} from "@react-spectrum/label";
|
|
6
|
+
import {useProviderProps as $8sUxO$useProviderProps, Provider as $8sUxO$Provider} from "@react-spectrum/provider";
|
|
7
|
+
import $8sUxO$react from "react";
|
|
8
|
+
import {useCheckboxGroup as $8sUxO$useCheckboxGroup} from "@react-aria/checkbox";
|
|
9
|
+
import {useCheckboxGroupState as $8sUxO$useCheckboxGroupState} from "@react-stately/checkbox";
|
|
10
|
+
import {useFormProps as $8sUxO$useFormProps} from "@react-spectrum/form";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function $73f43ce9d441cc69$var$CheckboxGroup(props, ref) {
|
|
36
|
+
props = (0, $8sUxO$useProviderProps)(props);
|
|
37
|
+
props = (0, $8sUxO$useFormProps)(props);
|
|
38
|
+
let { isEmphasized: isEmphasized, children: children, orientation: orientation = "vertical" } = props;
|
|
39
|
+
let domRef = (0, $8sUxO$useDOMRef)(ref);
|
|
40
|
+
let state = (0, $8sUxO$useCheckboxGroupState)(props);
|
|
41
|
+
let { groupProps: groupProps, ...otherProps } = (0, $8sUxO$useCheckboxGroup)(props, state);
|
|
42
|
+
return /*#__PURE__*/ (0, $8sUxO$react).createElement((0, $8sUxO$Field), {
|
|
43
|
+
...props,
|
|
44
|
+
...otherProps,
|
|
45
|
+
ref: domRef,
|
|
46
|
+
wrapperClassName: (0, $8sUxO$classNames)((0, ($parcel$interopDefault($8sUxO$fieldgroup_vars_cssmodulejs))), "spectrum-FieldGroup"),
|
|
47
|
+
elementType: "span",
|
|
48
|
+
includeNecessityIndicatorInAccessibilityName: true
|
|
49
|
+
}, /*#__PURE__*/ (0, $8sUxO$react).createElement("div", {
|
|
50
|
+
...groupProps,
|
|
51
|
+
className: (0, $8sUxO$classNames)((0, ($parcel$interopDefault($8sUxO$fieldgroup_vars_cssmodulejs))), "spectrum-FieldGroup-group", {
|
|
52
|
+
"spectrum-FieldGroup-group--horizontal": orientation === "horizontal"
|
|
53
|
+
})
|
|
54
|
+
}, /*#__PURE__*/ (0, $8sUxO$react).createElement((0, $8sUxO$Provider), {
|
|
55
|
+
isEmphasized: isEmphasized
|
|
56
|
+
}, /*#__PURE__*/ (0, $8sUxO$react).createElement((0, $8c8ab388b155237e$export$baf37c4be89255b8).Provider, {
|
|
57
|
+
value: state
|
|
58
|
+
}, children))));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A CheckboxGroup allows users to select one or more items from a list of choices.
|
|
62
|
+
*/ const $73f43ce9d441cc69$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $8sUxO$react).forwardRef($73f43ce9d441cc69$var$CheckboxGroup);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export {$73f43ce9d441cc69$export$4aa08d5625cb8ead as CheckboxGroup};
|
|
66
|
+
//# sourceMappingURL=CheckboxGroup.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcD,SAAS,oCAAc,KAAiC,EAAE,GAA2B;IACnF,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,IAAI,gBACF,YAAY,YACZ,QAAQ,eACR,cAAc,YACf,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,QAAQ,CAAA,GAAA,4BAAoB,EAAE;IAClC,IAAI,cAAC,UAAU,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,uBAAe,EAAE,OAAO;IAE1D,qBACE,gCAAC,CAAA,GAAA,YAAI;QACF,GAAG,KAAK;QACR,GAAG,UAAU;QACd,KAAK;QACL,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAK,GAAG;QACrC,aAAY;QACZ,8CAAA;qBACA,gCAAC;QACE,GAAG,UAAU;QACd,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,4DAAK,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/@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\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":"CheckboxGroup.module.js.map"}
|