@react-types/checkbox 3.0.0-nightly-641446f65-240905

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/package.json +21 -0
  3. package/src/index.d.ts +112 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @react-types/checkbox
2
+
3
+ This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@react-types/checkbox",
3
+ "version": "3.0.0-nightly-641446f65-240905",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "types": "src/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/adobe/react-spectrum"
10
+ },
11
+ "dependencies": {
12
+ "@react-types/shared": "^3.0.0-nightly-641446f65-240905"
13
+ },
14
+ "peerDependencies": {
15
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "stableVersion": "3.8.3"
21
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,112 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {
14
+ AriaLabelingProps,
15
+ AriaValidationProps,
16
+ DOMProps,
17
+ FocusableDOMProps,
18
+ FocusableProps,
19
+ FocusEvents,
20
+ HelpTextProps,
21
+ InputBase,
22
+ InputDOMProps,
23
+ LabelableProps,
24
+ Orientation,
25
+ SpectrumHelpTextProps,
26
+ SpectrumLabelableProps,
27
+ StyleProps,
28
+ Validation,
29
+ ValueBase
30
+ } from '@react-types/shared';
31
+ import {ReactElement, ReactNode} from 'react';
32
+
33
+ export interface ToggleStateOptions extends InputBase {
34
+ /**
35
+ * Whether the element should be selected (uncontrolled).
36
+ */
37
+ defaultSelected?: boolean,
38
+ /**
39
+ * Whether the element should be selected (controlled).
40
+ */
41
+ isSelected?: boolean,
42
+ /**
43
+ * Handler that is called when the element's selection state changes.
44
+ */
45
+ onChange?: (isSelected: boolean) => void
46
+ }
47
+
48
+ export interface ToggleProps extends ToggleStateOptions, Validation, FocusableProps {
49
+ /**
50
+ * The label for the element.
51
+ */
52
+ children?: ReactNode,
53
+ /**
54
+ * The value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue).
55
+ */
56
+ value?: string
57
+ }
58
+
59
+ export interface AriaToggleProps extends ToggleProps, FocusableDOMProps, AriaLabelingProps, AriaValidationProps, InputDOMProps {
60
+ /**
61
+ * Identifies the element (or elements) whose contents or presence are controlled by the current element.
62
+ */
63
+ 'aria-controls'?: string
64
+ }
65
+
66
+ export interface CheckboxGroupProps extends ValueBase<string[]>, InputBase, InputDOMProps, LabelableProps, HelpTextProps, Validation<string[]> {}
67
+
68
+ export interface CheckboxProps extends ToggleProps {
69
+ /**
70
+ * Indeterminism is presentational only.
71
+ * The indeterminate visual representation remains regardless of user interaction.
72
+ */
73
+ isIndeterminate?: boolean
74
+ }
75
+
76
+ export interface AriaCheckboxProps extends CheckboxProps, AriaToggleProps {}
77
+
78
+ export interface AriaCheckboxGroupProps extends CheckboxGroupProps, DOMProps, AriaLabelingProps, AriaValidationProps, FocusEvents {}
79
+
80
+ export interface AriaCheckboxGroupItemProps extends Omit<AriaCheckboxProps, 'isSelected' | 'defaultSelected'> {
81
+ value: string
82
+ }
83
+
84
+ export interface SpectrumCheckboxProps extends AriaCheckboxProps, StyleProps {
85
+ /**
86
+ * This prop sets the emphasized style which provides visual prominence.
87
+ */
88
+ isEmphasized?: boolean,
89
+ /**
90
+ * A slot name for the component. Slots allow the component to receive props from a parent component.
91
+ * An explicit `null` value indicates that the local props completely override all props received from a parent.
92
+ * @private
93
+ */
94
+ slot?: string | null
95
+ }
96
+
97
+ export interface SpectrumCheckboxGroupProps extends AriaCheckboxGroupProps, SpectrumLabelableProps, Validation<string[]>, StyleProps, SpectrumHelpTextProps {
98
+ /**
99
+ * The Checkboxes contained within the CheckboxGroup.
100
+ */
101
+ children: ReactElement<CheckboxProps> | ReactElement<CheckboxProps>[],
102
+ /**
103
+ * The axis the checkboxes should align with.
104
+ * @default 'vertical'
105
+ */
106
+ orientation?: Orientation,
107
+ /**
108
+ * By default, checkboxes are not emphasized (gray).
109
+ * The emphasized (blue) version provides visual prominence.
110
+ */
111
+ isEmphasized?: boolean
112
+ }