@react-stately/checkbox 3.1.2-nightly.3373 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;SC6CgB,yCAAqB,CAAC,KAAyB,GAAG,CAAC;AAAA,CAAC,EAAsB,CAAC;IACzF,GAAG,EAAE,cAAc,EAAE,QAAQ,IAAI,2CAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ;IAEzG,KAAK,CAAC,KAAK,GAAuB,CAAC;QACjC,KAAK,EAAE,cAAc;QACrB,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAGR,QAAQ,CAAC,KAAK;QAChB,CAAC;QACD,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAC,KAAK,EAAE,CAAC;YACjB,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK;QACtC,CAAC;QACD,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,GAChC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;QAE3E,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;iBAEvE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/useCheckboxGroupState.ts"],"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 */\nexport type {CheckboxGroupState} from './useCheckboxGroupState';\nexport {useCheckboxGroupState} from './useCheckboxGroupState';\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 {CheckboxGroupProps} from '@react-types/checkbox';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface CheckboxGroupState {\n /** Current selected values. */\n readonly value: readonly string[],\n\n /** Whether the checkbox group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the checkbox group is read only. */\n readonly isReadOnly: boolean,\n\n /** Returns whether the given value is selected. */\n isSelected(value: string): boolean,\n\n /** Sets the selected values. */\n setValue(value: string[]): void,\n\n /** Adds a value to the set of selected values. */\n addValue(value: string): void,\n\n /** Removes a value from the set of selected values. */\n removeValue(value: string): void,\n\n /** Toggles a value in the set of selected values. */\n toggleValue(value: string): void\n}\n\n/**\n * Provides state management for a checkbox group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useCheckboxGroupState(props: CheckboxGroupProps = {}): CheckboxGroupState {\n let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);\n\n const state: CheckboxGroupState = {\n value: selectedValues,\n setValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n\n setValue(value);\n },\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n isSelected(value) {\n return selectedValues.includes(value);\n },\n addValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (!selectedValues.includes(value)) {\n setValue(selectedValues.concat(value));\n }\n },\n removeValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n }\n },\n toggleValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n } else {\n setValue(selectedValues.concat(value));\n }\n }\n };\n\n return state;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;SC6CgB,yCAAqB,CAAC,KAAyB,GAAG,CAAC;AAAA,CAAC,EAAsB,CAAC;IACzF,GAAG,EAAE,cAAc,EAAE,QAAQ,IAAI,2CAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ;IAEzG,KAAK,CAAC,KAAK,GAAuB,CAAC;QACjC,KAAK,EAAE,cAAc;QACrB,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAGR,QAAQ,CAAC,KAAK;QAChB,CAAC;QACD,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAC,KAAK,EAAE,CAAC;YACjB,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK;QACtC,CAAC;QACD,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,GAChC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;QAE3E,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;iBAEvE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/useCheckboxGroupState.ts"],"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\nexport {useCheckboxGroupState} from './useCheckboxGroupState';\n\nexport type {CheckboxGroupProps} from '@react-types/checkbox';\nexport type {CheckboxGroupState} from './useCheckboxGroupState';\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 {CheckboxGroupProps} from '@react-types/checkbox';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface CheckboxGroupState {\n /** Current selected values. */\n readonly value: readonly string[],\n\n /** Whether the checkbox group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the checkbox group is read only. */\n readonly isReadOnly: boolean,\n\n /** Returns whether the given value is selected. */\n isSelected(value: string): boolean,\n\n /** Sets the selected values. */\n setValue(value: string[]): void,\n\n /** Adds a value to the set of selected values. */\n addValue(value: string): void,\n\n /** Removes a value from the set of selected values. */\n removeValue(value: string): void,\n\n /** Toggles a value in the set of selected values. */\n toggleValue(value: string): void\n}\n\n/**\n * Provides state management for a checkbox group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useCheckboxGroupState(props: CheckboxGroupProps = {}): CheckboxGroupState {\n let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);\n\n const state: CheckboxGroupState = {\n value: selectedValues,\n setValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n\n setValue(value);\n },\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n isSelected(value) {\n return selectedValues.includes(value);\n },\n addValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (!selectedValues.includes(value)) {\n setValue(selectedValues.concat(value));\n }\n },\n removeValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n }\n },\n toggleValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n } else {\n setValue(selectedValues.concat(value));\n }\n }\n };\n\n return state;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;SC6CgB,yCAAqB,CAAC,KAAyB,GAAG,CAAC;AAAA,CAAC,EAAsB,CAAC;IACzF,GAAG,EAAE,cAAc,EAAE,QAAQ,IAAI,yBAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ;IAEzG,KAAK,CAAC,KAAK,GAAuB,CAAC;QACjC,KAAK,EAAE,cAAc;QACrB,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAGR,QAAQ,CAAC,KAAK;QAChB,CAAC;QACD,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAC,KAAK,EAAE,CAAC;YACjB,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK;QACtC,CAAC;QACD,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,GAChC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;QAE3E,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;iBAEvE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/useCheckboxGroupState.ts"],"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 */\nexport type {CheckboxGroupState} from './useCheckboxGroupState';\nexport {useCheckboxGroupState} from './useCheckboxGroupState';\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 {CheckboxGroupProps} from '@react-types/checkbox';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface CheckboxGroupState {\n /** Current selected values. */\n readonly value: readonly string[],\n\n /** Whether the checkbox group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the checkbox group is read only. */\n readonly isReadOnly: boolean,\n\n /** Returns whether the given value is selected. */\n isSelected(value: string): boolean,\n\n /** Sets the selected values. */\n setValue(value: string[]): void,\n\n /** Adds a value to the set of selected values. */\n addValue(value: string): void,\n\n /** Removes a value from the set of selected values. */\n removeValue(value: string): void,\n\n /** Toggles a value in the set of selected values. */\n toggleValue(value: string): void\n}\n\n/**\n * Provides state management for a checkbox group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useCheckboxGroupState(props: CheckboxGroupProps = {}): CheckboxGroupState {\n let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);\n\n const state: CheckboxGroupState = {\n value: selectedValues,\n setValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n\n setValue(value);\n },\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n isSelected(value) {\n return selectedValues.includes(value);\n },\n addValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (!selectedValues.includes(value)) {\n setValue(selectedValues.concat(value));\n }\n },\n removeValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n }\n },\n toggleValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n } else {\n setValue(selectedValues.concat(value));\n }\n }\n };\n\n return state;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;SC6CgB,yCAAqB,CAAC,KAAyB,GAAG,CAAC;AAAA,CAAC,EAAsB,CAAC;IACzF,GAAG,EAAE,cAAc,EAAE,QAAQ,IAAI,yBAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ;IAEzG,KAAK,CAAC,KAAK,GAAuB,CAAC;QACjC,KAAK,EAAE,cAAc;QACrB,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAGR,QAAQ,CAAC,KAAK;QAChB,CAAC;QACD,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAC,KAAK,EAAE,CAAC;YACjB,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK;QACtC,CAAC;QACD,QAAQ,EAAC,KAAK,EAAE,CAAC;YACf,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,GAChC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;QAE3E,CAAC;QACD,WAAW,EAAC,KAAK,EAAE,CAAC;YAClB,EAAE,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EACtC,MAAM;YAER,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,GAC/B,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;iBAEvE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK;QAExC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/useCheckboxGroupState.ts"],"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\nexport {useCheckboxGroupState} from './useCheckboxGroupState';\n\nexport type {CheckboxGroupProps} from '@react-types/checkbox';\nexport type {CheckboxGroupState} from './useCheckboxGroupState';\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 {CheckboxGroupProps} from '@react-types/checkbox';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface CheckboxGroupState {\n /** Current selected values. */\n readonly value: readonly string[],\n\n /** Whether the checkbox group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the checkbox group is read only. */\n readonly isReadOnly: boolean,\n\n /** Returns whether the given value is selected. */\n isSelected(value: string): boolean,\n\n /** Sets the selected values. */\n setValue(value: string[]): void,\n\n /** Adds a value to the set of selected values. */\n addValue(value: string): void,\n\n /** Removes a value from the set of selected values. */\n removeValue(value: string): void,\n\n /** Toggles a value in the set of selected values. */\n toggleValue(value: string): void\n}\n\n/**\n * Provides state management for a checkbox group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useCheckboxGroupState(props: CheckboxGroupProps = {}): CheckboxGroupState {\n let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);\n\n const state: CheckboxGroupState = {\n value: selectedValues,\n setValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n\n setValue(value);\n },\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n isSelected(value) {\n return selectedValues.includes(value);\n },\n addValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (!selectedValues.includes(value)) {\n setValue(selectedValues.concat(value));\n }\n },\n removeValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n }\n },\n toggleValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n if (selectedValues.includes(value)) {\n setValue(selectedValues.filter(existingValue => existingValue !== value));\n } else {\n setValue(selectedValues.concat(value));\n }\n }\n };\n\n return state;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -22,5 +22,6 @@ export interface CheckboxGroupState {
22
22
  * and manages selection and focus state.
23
23
  */
24
24
  export function useCheckboxGroupState(props?: CheckboxGroupProps): CheckboxGroupState;
25
+ export type { CheckboxGroupProps } from '@react-types/checkbox';
25
26
 
26
27
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"mappings":";AAeA;IACE,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAElC,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,mDAAmD;IACnD,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnC,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEhC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,uDAAuD;IACvD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,qDAAqD;IACrD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED;;;GAGG;AACH,sCAAsC,KAAK,GAAE,kBAAuB,GAAG,kBAAkB,CA8CxF","sources":["packages/@react-stately/checkbox/src/packages/@react-stately/checkbox/src/useCheckboxGroupState.ts","packages/@react-stately/checkbox/src/packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/index.ts"],"sourcesContent":[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 */\nexport type {CheckboxGroupState} from './useCheckboxGroupState';\nexport {useCheckboxGroupState} from './useCheckboxGroupState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";AAeA;IACE,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAElC,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,mDAAmD;IACnD,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnC,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEhC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,uDAAuD;IACvD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,qDAAqD;IACrD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED;;;GAGG;AACH,sCAAsC,KAAK,GAAE,kBAAuB,GAAG,kBAAkB,CA8CxF;AC7ED,YAAY,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-stately/checkbox/src/packages/@react-stately/checkbox/src/useCheckboxGroupState.ts","packages/@react-stately/checkbox/src/packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/index.ts"],"sourcesContent":[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\nexport {useCheckboxGroupState} from './useCheckboxGroupState';\n\nexport type {CheckboxGroupProps} from '@react-types/checkbox';\nexport type {CheckboxGroupState} from './useCheckboxGroupState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/checkbox",
3
- "version": "3.1.2-nightly.3373+8defd74c9",
3
+ "version": "3.2.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-stately/toggle": "3.0.0-nightly.1673+8defd74c9",
22
- "@react-stately/utils": "3.0.0-nightly.1673+8defd74c9",
23
- "@react-types/checkbox": "3.0.0-nightly.1673+8defd74c9"
21
+ "@react-stately/toggle": "^3.4.0",
22
+ "@react-stately/utils": "^3.5.1",
23
+ "@react-types/checkbox": "^3.3.2"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "8defd74c9698b4dda32fd20bcfc579b123cd98e7"
31
+ "gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
32
32
  }
package/src/index.ts CHANGED
@@ -9,5 +9,8 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- export type {CheckboxGroupState} from './useCheckboxGroupState';
12
+
13
13
  export {useCheckboxGroupState} from './useCheckboxGroupState';
14
+
15
+ export type {CheckboxGroupProps} from '@react-types/checkbox';
16
+ export type {CheckboxGroupState} from './useCheckboxGroupState';