@react-types/switch 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.
- package/README.md +3 -0
- package/package.json +21 -0
- package/src/index.d.ts +52 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-types/switch",
|
|
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.5.5"
|
|
21
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
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 {AriaLabelingProps, FocusableDOMProps, FocusableProps, InputBase, InputDOMProps, StyleProps} from '@react-types/shared';
|
|
14
|
+
import {ReactNode} from 'react';
|
|
15
|
+
|
|
16
|
+
interface SwitchBase extends InputBase, FocusableProps {
|
|
17
|
+
/**
|
|
18
|
+
* The content to render as the Switch's label.
|
|
19
|
+
*/
|
|
20
|
+
children?: ReactNode,
|
|
21
|
+
/**
|
|
22
|
+
* Whether the Switch should be selected (uncontrolled).
|
|
23
|
+
*/
|
|
24
|
+
defaultSelected?: boolean,
|
|
25
|
+
/**
|
|
26
|
+
* Whether the Switch should be selected (controlled).
|
|
27
|
+
*/
|
|
28
|
+
isSelected?: boolean,
|
|
29
|
+
/**
|
|
30
|
+
* Handler that is called when the Switch's selection state changes.
|
|
31
|
+
*/
|
|
32
|
+
onChange?: (isSelected: boolean) => void,
|
|
33
|
+
/**
|
|
34
|
+
* 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).
|
|
35
|
+
*/
|
|
36
|
+
value?: string
|
|
37
|
+
}
|
|
38
|
+
export interface SwitchProps extends SwitchBase {}
|
|
39
|
+
export interface AriaSwitchBase extends SwitchBase, FocusableDOMProps, InputDOMProps, AriaLabelingProps {
|
|
40
|
+
/**
|
|
41
|
+
* Identifies the element (or elements) whose contents or presence are controlled by the current element.
|
|
42
|
+
*/
|
|
43
|
+
'aria-controls'?: string
|
|
44
|
+
}
|
|
45
|
+
export interface AriaSwitchProps extends SwitchProps, AriaSwitchBase {}
|
|
46
|
+
|
|
47
|
+
export interface SpectrumSwitchProps extends AriaSwitchProps, StyleProps {
|
|
48
|
+
/**
|
|
49
|
+
* This prop sets the emphasized style which provides visual prominence.
|
|
50
|
+
*/
|
|
51
|
+
isEmphasized?: boolean
|
|
52
|
+
}
|