@react-native-aria/switch 0.2.2-alpha.1 → 0.2.4-alpha.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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # `checkbox`
1
+ ## Installation
2
2
 
3
- > TODO: description
3
+ ```js
4
+ yarn add @react-native-aria/switch
5
+ ```
4
6
 
5
7
  ## Usage
6
8
 
7
- ```
8
- const checkbox = require('checkbox');
9
-
10
- // TODO: DEMONSTRATE API
9
+ ```js
10
+ import { useSwitch } from '@react-native-aria/switch';
11
11
  ```
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: ['module:metro-react-native-babel-preset'],
3
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useSwitch", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _useSwitch.useSwitch;
10
+ }
11
+ });
12
+
13
+ var _useSwitch = require("./useSwitch");
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { useSwitch } from \"./useSwitch\";\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useSwitch", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _useSwitch.useSwitch;
10
+ }
11
+ });
12
+
13
+ var _useSwitch = require("./useSwitch.web");
14
+ //# sourceMappingURL=index.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.web.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { useSwitch } from \"./useSwitch.web\";\n"]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSwitch = useSwitch;
7
+
8
+ var _toggle = require("@react-native-aria/toggle");
9
+
10
+ var _utils = require("@react-aria/utils");
11
+
12
+ /*
13
+ * Copyright 2020 Adobe. All rights reserved.
14
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License. You may obtain a copy
16
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software distributed under
19
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
+ * OF ANY KIND, either express or implied. See the License for the specific language
21
+ * governing permissions and limitations under the License.
22
+ */
23
+
24
+ /**
25
+ * Provides the behavior and accessibility implementation for a switch component.
26
+ * A switch is similar to a checkbox, but represents on/off values as opposed to selection.
27
+ * @param props - Props for the switch.
28
+ * @param state - State for the switch, as returned by `useToggleState`.
29
+ * @param ref - Ref to the HTML input element.
30
+ */
31
+ function useSwitch(props, state, ref) {
32
+ let {
33
+ inputProps
34
+ } = (0, _toggle.useToggle)(props, state, ref);
35
+ let {
36
+ isSelected
37
+ } = state;
38
+ return {
39
+ inputProps: (0, _utils.mergeProps)(inputProps, {
40
+ 'role': 'switch',
41
+ 'checked': isSelected,
42
+ 'accessible': true,
43
+ 'aria-checked': isSelected,
44
+ 'aria-disabled': props.isDisabled,
45
+ 'aria-readonly': props.isReadOnly
46
+ })
47
+ };
48
+ }
49
+ //# sourceMappingURL=useSwitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSwitch.ts"],"names":["useSwitch","props","state","ref","inputProps","isSelected","isDisabled","isReadOnly"],"mappings":";;;;;;;AAeA;;AAEA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,SAAT,CACLC,KADK,EAELC,KAFK,EAGLC,GAHK,EAIO;AACZ,MAAI;AAAEC,IAAAA;AAAF,MAAiB,uBAAUH,KAAV,EAAiBC,KAAjB,EAAwBC,GAAxB,CAArB;AACA,MAAI;AAAEE,IAAAA;AAAF,MAAiBH,KAArB;AAEA,SAAO;AACLE,IAAAA,UAAU,EAAE,uBAAWA,UAAX,EAAuB;AACjC,cAAQ,QADyB;AAEjC,iBAAWC,UAFsB;AAGjC,oBAAc,IAHmB;AAIjC,sBAAgBA,UAJiB;AAKjC,uBAAiBJ,KAAK,CAACK,UALU;AAMjC,uBAAiBL,KAAK,CAACM;AANU,KAAvB;AADP,GAAP;AAUD","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 type { AriaSwitchProps } from '@react-types/switch';\nimport type { RefObject } from 'react';\nimport type { ToggleState } from '@react-stately/toggle';\nimport { useToggle } from '@react-native-aria/toggle';\nimport type { AccessibilityProps, AccessibilityRole } from 'react-native';\nimport { mergeProps } from '@react-aria/utils';\n\nexport interface SwitchAria {\n /** Props for the input element. */\n inputProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n * @param props - Props for the switch.\n * @param state - State for the switch, as returned by `useToggleState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useSwitch(\n props: AriaSwitchProps & AccessibilityProps,\n state: ToggleState,\n ref: RefObject<HTMLInputElement>\n): SwitchAria {\n let { inputProps } = useToggle(props, state, ref);\n let { isSelected } = state;\n\n return {\n inputProps: mergeProps(inputProps, {\n 'role': 'switch' as AccessibilityRole,\n 'checked': isSelected,\n 'accessible': true,\n 'aria-checked': isSelected,\n 'aria-disabled': props.isDisabled,\n 'aria-readonly': props.isReadOnly,\n }),\n };\n}\n"]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSwitch = useSwitch;
7
+
8
+ var _switch = require("@react-aria/switch");
9
+
10
+ /**
11
+ * Provides the behavior and accessibility implementation for a switch component.
12
+ * A switch is similar to a checkbox, but represents on/off values as opposed to selection.
13
+ * @param props - Props for the switch.
14
+ * @param state - State for the switch, as returned by `useToggleState`.
15
+ * @param ref - Ref to the HTML input element.
16
+ */
17
+ function useSwitch(props, state, ref) {
18
+ const label = props.accessibilityLabel;
19
+ let temp = (0, _switch.useSwitch)({ ...props,
20
+ "aria-label": label
21
+ }, state, ref);
22
+ return temp;
23
+ }
24
+ //# sourceMappingURL=useSwitch.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSwitch.web.ts"],"names":["useSwitch","props","state","ref","label","accessibilityLabel","temp"],"mappings":";;;;;;;AAGA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,SAAT,CACLC,KADK,EAELC,KAFK,EAGLC,GAHK,EAIO;AACZ,QAAMC,KAAK,GAAGH,KAAK,CAACI,kBAApB;AACA,MAAIC,IAAI,GAAG,uBAAa,EAAE,GAAGL,KAAL;AAAY,kBAAcG;AAA1B,GAAb,EAAgDF,KAAhD,EAAuDC,GAAvD,CAAX;AAEA,SAAOG,IAAP;AACD","sourcesContent":["import type { AriaSwitchProps } from \"@react-types/switch\";\nimport type { RefObject } from \"react\";\nimport type { ToggleState } from \"@react-stately/toggle\";\nimport { useSwitch as useSwitchWeb } from \"@react-aria/switch\";\n\nexport interface SwitchAria {\n /** Props for the input element. */\n inputProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n * @param props - Props for the switch.\n * @param state - State for the switch, as returned by `useToggleState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useSwitch(\n props: AriaSwitchProps & { accessibilityLabel?: string },\n state: ToggleState,\n ref: RefObject<HTMLInputElement>\n): SwitchAria {\n const label = props.accessibilityLabel;\n let temp = useSwitchWeb({ ...props, \"aria-label\": label }, state, ref);\n\n return temp;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":["useSwitch"],"mappings":"AAAA,SAASA,SAAT,QAA0B,aAA1B","sourcesContent":["export { useSwitch } from \"./useSwitch\";\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.web.ts"],"names":["useSwitch"],"mappings":"AAAA,SAASA,SAAT,QAA0B,iBAA1B","sourcesContent":["export { useSwitch } from \"./useSwitch.web\";\n"]}
@@ -0,0 +1,40 @@
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
+ import { useToggle } from '@react-native-aria/toggle';
13
+ import { mergeProps } from '@react-aria/utils';
14
+
15
+ /**
16
+ * Provides the behavior and accessibility implementation for a switch component.
17
+ * A switch is similar to a checkbox, but represents on/off values as opposed to selection.
18
+ * @param props - Props for the switch.
19
+ * @param state - State for the switch, as returned by `useToggleState`.
20
+ * @param ref - Ref to the HTML input element.
21
+ */
22
+ export function useSwitch(props, state, ref) {
23
+ let {
24
+ inputProps
25
+ } = useToggle(props, state, ref);
26
+ let {
27
+ isSelected
28
+ } = state;
29
+ return {
30
+ inputProps: mergeProps(inputProps, {
31
+ 'role': 'switch',
32
+ 'checked': isSelected,
33
+ 'accessible': true,
34
+ 'aria-checked': isSelected,
35
+ 'aria-disabled': props.isDisabled,
36
+ 'aria-readonly': props.isReadOnly
37
+ })
38
+ };
39
+ }
40
+ //# sourceMappingURL=useSwitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSwitch.ts"],"names":["useToggle","mergeProps","useSwitch","props","state","ref","inputProps","isSelected","isDisabled","isReadOnly"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,SAASA,SAAT,QAA0B,2BAA1B;AAEA,SAASC,UAAT,QAA2B,mBAA3B;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAAT,CACLC,KADK,EAELC,KAFK,EAGLC,GAHK,EAIO;AACZ,MAAI;AAAEC,IAAAA;AAAF,MAAiBN,SAAS,CAACG,KAAD,EAAQC,KAAR,EAAeC,GAAf,CAA9B;AACA,MAAI;AAAEE,IAAAA;AAAF,MAAiBH,KAArB;AAEA,SAAO;AACLE,IAAAA,UAAU,EAAEL,UAAU,CAACK,UAAD,EAAa;AACjC,cAAQ,QADyB;AAEjC,iBAAWC,UAFsB;AAGjC,oBAAc,IAHmB;AAIjC,sBAAgBA,UAJiB;AAKjC,uBAAiBJ,KAAK,CAACK,UALU;AAMjC,uBAAiBL,KAAK,CAACM;AANU,KAAb;AADjB,GAAP;AAUD","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 type { AriaSwitchProps } from '@react-types/switch';\nimport type { RefObject } from 'react';\nimport type { ToggleState } from '@react-stately/toggle';\nimport { useToggle } from '@react-native-aria/toggle';\nimport type { AccessibilityProps, AccessibilityRole } from 'react-native';\nimport { mergeProps } from '@react-aria/utils';\n\nexport interface SwitchAria {\n /** Props for the input element. */\n inputProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n * @param props - Props for the switch.\n * @param state - State for the switch, as returned by `useToggleState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useSwitch(\n props: AriaSwitchProps & AccessibilityProps,\n state: ToggleState,\n ref: RefObject<HTMLInputElement>\n): SwitchAria {\n let { inputProps } = useToggle(props, state, ref);\n let { isSelected } = state;\n\n return {\n inputProps: mergeProps(inputProps, {\n 'role': 'switch' as AccessibilityRole,\n 'checked': isSelected,\n 'accessible': true,\n 'aria-checked': isSelected,\n 'aria-disabled': props.isDisabled,\n 'aria-readonly': props.isReadOnly,\n }),\n };\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { useSwitch as useSwitchWeb } from "@react-aria/switch";
2
+
3
+ /**
4
+ * Provides the behavior and accessibility implementation for a switch component.
5
+ * A switch is similar to a checkbox, but represents on/off values as opposed to selection.
6
+ * @param props - Props for the switch.
7
+ * @param state - State for the switch, as returned by `useToggleState`.
8
+ * @param ref - Ref to the HTML input element.
9
+ */
10
+ export function useSwitch(props, state, ref) {
11
+ const label = props.accessibilityLabel;
12
+ let temp = useSwitchWeb({ ...props,
13
+ "aria-label": label
14
+ }, state, ref);
15
+ return temp;
16
+ }
17
+ //# sourceMappingURL=useSwitch.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSwitch.web.ts"],"names":["useSwitch","useSwitchWeb","props","state","ref","label","accessibilityLabel","temp"],"mappings":"AAGA,SAASA,SAAS,IAAIC,YAAtB,QAA0C,oBAA1C;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASD,SAAT,CACLE,KADK,EAELC,KAFK,EAGLC,GAHK,EAIO;AACZ,QAAMC,KAAK,GAAGH,KAAK,CAACI,kBAApB;AACA,MAAIC,IAAI,GAAGN,YAAY,CAAC,EAAE,GAAGC,KAAL;AAAY,kBAAcG;AAA1B,GAAD,EAAoCF,KAApC,EAA2CC,GAA3C,CAAvB;AAEA,SAAOG,IAAP;AACD","sourcesContent":["import type { AriaSwitchProps } from \"@react-types/switch\";\nimport type { RefObject } from \"react\";\nimport type { ToggleState } from \"@react-stately/toggle\";\nimport { useSwitch as useSwitchWeb } from \"@react-aria/switch\";\n\nexport interface SwitchAria {\n /** Props for the input element. */\n inputProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n * @param props - Props for the switch.\n * @param state - State for the switch, as returned by `useToggleState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useSwitch(\n props: AriaSwitchProps & { accessibilityLabel?: string },\n state: ToggleState,\n ref: RefObject<HTMLInputElement>\n): SwitchAria {\n const label = props.accessibilityLabel;\n let temp = useSwitchWeb({ ...props, \"aria-label\": label }, state, ref);\n\n return temp;\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { AriaSwitchProps } from '@react-types/switch';
2
+ import type { RefObject } from 'react';
3
+ import type { ToggleState } from '@react-stately/toggle';
4
+ import type { AccessibilityProps } from 'react-native';
5
+ export interface SwitchAria {
6
+ /** Props for the input element. */
7
+ inputProps: any;
8
+ }
9
+ /**
10
+ * Provides the behavior and accessibility implementation for a switch component.
11
+ * A switch is similar to a checkbox, but represents on/off values as opposed to selection.
12
+ * @param props - Props for the switch.
13
+ * @param state - State for the switch, as returned by `useToggleState`.
14
+ * @param ref - Ref to the HTML input element.
15
+ */
16
+ export declare function useSwitch(props: AriaSwitchProps & AccessibilityProps, state: ToggleState, ref: RefObject<HTMLInputElement>): SwitchAria;
@@ -0,0 +1,17 @@
1
+ import type { AriaSwitchProps } from "@react-types/switch";
2
+ import type { RefObject } from "react";
3
+ import type { ToggleState } from "@react-stately/toggle";
4
+ export interface SwitchAria {
5
+ /** Props for the input element. */
6
+ inputProps: any;
7
+ }
8
+ /**
9
+ * Provides the behavior and accessibility implementation for a switch component.
10
+ * A switch is similar to a checkbox, but represents on/off values as opposed to selection.
11
+ * @param props - Props for the switch.
12
+ * @param state - State for the switch, as returned by `useToggleState`.
13
+ * @param ref - Ref to the HTML input element.
14
+ */
15
+ export declare function useSwitch(props: AriaSwitchProps & {
16
+ accessibilityLabel?: string;
17
+ }, state: ToggleState, ref: RefObject<HTMLInputElement>): SwitchAria;
package/package.json CHANGED
@@ -1,39 +1,139 @@
1
1
  {
2
2
  "name": "@react-native-aria/switch",
3
- "version": "0.2.2-alpha.1",
4
- "description": "> TODO: description",
5
- "author": "nishan <nishanbende@gmail.com>",
6
- "homepage": "",
7
- "license": "ISC",
8
- "main": "lib",
9
- "module": "lib",
3
+ "version": "0.2.4-alpha.0",
4
+ "description": "mono repo setup with bob",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "typings": "lib/typescript/index.d.ts",
10
8
  "react-native": "src/index",
11
9
  "source": "src/index",
12
- "typings": "lib/index.d.ts",
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "directories": {
17
- "lib": "lib",
18
- "src": "src",
19
- "test": "__tests__"
20
- },
21
10
  "files": [
11
+ "src",
22
12
  "lib",
23
- "src"
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "react-native-bob-mono.podspec",
17
+ "!lib/typescript/example",
18
+ "!android/build",
19
+ "!ios/build",
20
+ "!**/__tests__",
21
+ "!**/__fixtures__",
22
+ "!**/__mocks__"
24
23
  ],
25
- "scripts": {
26
- "tsc": "tsc",
27
- "start": "tsc --watch",
28
- "test": "echo \"Error: run tests from root\" && exit 1",
29
- "prepare": "tsc"
30
- },
31
24
  "dependencies": {
32
25
  "@react-aria/switch": "^3.1.1",
33
- "@react-aria/utils": "^3.5.0",
34
- "@react-native-aria/toggle": "^0.2.2-alpha.0",
26
+ "@react-aria/utils": "^3.6.0",
27
+ "@react-native-aria/toggle": "^0.2.3",
35
28
  "@react-stately/toggle": "^3.2.1",
36
29
  "@react-types/switch": "^3.1.1"
37
30
  },
38
- "gitHead": "091cbc746b5d80a8b8735638a756e8a4b36f608e"
31
+ "scripts": {
32
+ "test": "jest",
33
+ "typescript": "tsc --noEmit",
34
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
35
+ "prepare": "bob build",
36
+ "release": "release-it",
37
+ "example": "yarn --cwd example",
38
+ "pods": "cd example && pod-install --quiet",
39
+ "bootstrap": "yarn example && yarn && yarn pods"
40
+ },
41
+ "keywords": [
42
+ "react-native",
43
+ "ios",
44
+ "android"
45
+ ],
46
+ "repository": "https://github.com/intergalacticspacehighway/react-native-bob-mono",
47
+ "author": "nishan <nishanbende@gmail.com> (https://github.com/intergalacticspacehighway)",
48
+ "license": "MIT",
49
+ "bugs": {
50
+ "url": "https://github.com/intergalacticspacehighway/react-native-bob-mono/issues"
51
+ },
52
+ "homepage": "https://github.com/intergalacticspacehighway/react-native-bob-mono#readme",
53
+ "publishConfig": {
54
+ "registry": "https://registry.npmjs.org/"
55
+ },
56
+ "peerDependencies": {
57
+ "react": "*",
58
+ "react-native": "*"
59
+ },
60
+ "jest": {
61
+ "preset": "react-native",
62
+ "modulePathIgnorePatterns": [
63
+ "<rootDir>/example/node_modules",
64
+ "<rootDir>/lib/"
65
+ ]
66
+ },
67
+ "husky": {
68
+ "hooks": {
69
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
70
+ "pre-commit": "yarn lint && yarn typescript"
71
+ }
72
+ },
73
+ "commitlint": {
74
+ "extends": [
75
+ "@commitlint/config-conventional"
76
+ ]
77
+ },
78
+ "release-it": {
79
+ "git": {
80
+ "commitMessage": "chore: release ${version}",
81
+ "tagName": "v${version}"
82
+ },
83
+ "npm": {
84
+ "publish": true
85
+ },
86
+ "github": {
87
+ "release": true
88
+ },
89
+ "plugins": {
90
+ "@release-it/conventional-changelog": {
91
+ "preset": "angular"
92
+ }
93
+ }
94
+ },
95
+ "eslintConfig": {
96
+ "root": true,
97
+ "extends": [
98
+ "@react-native-community",
99
+ "prettier"
100
+ ],
101
+ "rules": {
102
+ "prettier/prettier": [
103
+ "error",
104
+ {
105
+ "quoteProps": "consistent",
106
+ "singleQuote": true,
107
+ "tabWidth": 2,
108
+ "trailingComma": "es5",
109
+ "useTabs": false
110
+ }
111
+ ]
112
+ }
113
+ },
114
+ "eslintIgnore": [
115
+ "node_modules/",
116
+ "lib/"
117
+ ],
118
+ "prettier": {
119
+ "quoteProps": "consistent",
120
+ "singleQuote": true,
121
+ "tabWidth": 2,
122
+ "trailingComma": "es5",
123
+ "useTabs": false
124
+ },
125
+ "react-native-builder-bob": {
126
+ "source": "src",
127
+ "output": "lib",
128
+ "targets": [
129
+ "commonjs",
130
+ "module",
131
+ [
132
+ "typescript",
133
+ {
134
+ "project": "tsconfig.build.json"
135
+ }
136
+ ]
137
+ ]
138
+ }
39
139
  }
@@ -0,0 +1,24 @@
1
+ const path = require('path');
2
+ const child_process = require('child_process');
3
+
4
+ const root = path.resolve(__dirname, '..');
5
+ const args = process.argv.slice(2);
6
+ const options = {
7
+ cwd: process.cwd(),
8
+ env: process.env,
9
+ stdio: 'inherit',
10
+ encoding: 'utf-8',
11
+ };
12
+
13
+ let result;
14
+
15
+ if (process.cwd() !== root || args.length) {
16
+ // We're not in the root of the project, or additional arguments were passed
17
+ // In this case, forward the command to `yarn`
18
+ result = child_process.spawnSync('yarn', args, options);
19
+ } else {
20
+ // If `yarn` is run without arguments, perform bootstrap
21
+ result = child_process.spawnSync('yarn', ['bootstrap'], options);
22
+ }
23
+
24
+ process.exitCode = result.status;
package/src/useSwitch.ts CHANGED
@@ -10,12 +10,12 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import type { AriaSwitchProps } from "@react-types/switch";
14
- import type { RefObject } from "react";
15
- import type { ToggleState } from "@react-stately/toggle";
16
- import { useToggle } from "@react-native-aria/toggle";
17
- import type { AccessibilityProps, AccessibilityRole } from "react-native";
18
- import { mergeProps } from "@react-aria/utils";
13
+ import type { AriaSwitchProps } from '@react-types/switch';
14
+ import type { RefObject } from 'react';
15
+ import type { ToggleState } from '@react-stately/toggle';
16
+ import { useToggle } from '@react-native-aria/toggle';
17
+ import type { AccessibilityProps, AccessibilityRole } from 'react-native';
18
+ import { mergeProps } from '@react-aria/utils';
19
19
 
20
20
  export interface SwitchAria {
21
21
  /** Props for the input element. */
@@ -39,13 +39,12 @@ export function useSwitch(
39
39
 
40
40
  return {
41
41
  inputProps: mergeProps(inputProps, {
42
- accessibilityRole: "switch" as AccessibilityRole,
43
- checked: isSelected,
44
- accessible: true,
45
- accessibilityState: {
46
- ...inputProps.accessibilityState,
47
- checked: isSelected,
48
- },
42
+ 'role': 'switch' as AccessibilityRole,
43
+ 'checked': isSelected,
44
+ 'accessible': true,
45
+ 'aria-checked': isSelected,
46
+ 'aria-disabled': props.isDisabled,
47
+ 'aria-readonly': props.isReadOnly,
49
48
  }),
50
49
  };
51
50
  }
@@ -0,0 +1,5 @@
1
+
2
+ {
3
+ "extends": "../tsconfig",
4
+ }
5
+
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 GeekyAnts
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.web.js","sourceRoot":"","sources":["../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { AriaSwitchProps } from "@react-types/switch";
2
- import type { RefObject } from "react";
3
- import type { ToggleState } from "@react-stately/toggle";
4
- import type { AccessibilityProps } from "react-native";
5
- export interface SwitchAria {
6
- inputProps: any;
7
- }
8
- export declare function useSwitch(props: AriaSwitchProps & AccessibilityProps, state: ToggleState, ref: RefObject<HTMLInputElement>): SwitchAria;
package/lib/useSwitch.js DELETED
@@ -1,15 +0,0 @@
1
- import { useToggle } from "@react-native-aria/toggle";
2
- import { mergeProps } from "@react-aria/utils";
3
- export function useSwitch(props, state, ref) {
4
- let { inputProps } = useToggle(props, state, ref);
5
- let { isSelected } = state;
6
- return {
7
- inputProps: mergeProps(inputProps, {
8
- accessibilityRole: "switch",
9
- checked: isSelected,
10
- accessible: true,
11
- accessibilityState: Object.assign(Object.assign({}, inputProps.accessibilityState), { checked: isSelected }),
12
- }),
13
- };
14
- }
15
- //# sourceMappingURL=useSwitch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSwitch.js","sourceRoot":"","sources":["../src/useSwitch.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc/C,MAAM,UAAU,SAAS,CACvB,KAA2C,EAC3C,KAAkB,EAClB,GAAgC;IAEhC,IAAI,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE3B,OAAO;QACL,UAAU,EAAE,UAAU,CAAC,UAAU,EAAE;YACjC,iBAAiB,EAAE,QAA6B;YAChD,OAAO,EAAE,UAAU;YACnB,UAAU,EAAE,IAAI;YAChB,kBAAkB,kCACb,UAAU,CAAC,kBAAkB,KAChC,OAAO,EAAE,UAAU,GACpB;SACF,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { AriaSwitchProps } from "@react-types/switch";
2
- import type { RefObject } from "react";
3
- import type { ToggleState } from "@react-stately/toggle";
4
- export interface SwitchAria {
5
- inputProps: any;
6
- }
7
- export declare function useSwitch(props: AriaSwitchProps & {
8
- accessibilityLabel?: string;
9
- }, state: ToggleState, ref: RefObject<HTMLInputElement>): SwitchAria;
@@ -1,7 +0,0 @@
1
- import { useSwitch as useSwitchWeb } from "@react-aria/switch";
2
- export function useSwitch(props, state, ref) {
3
- const label = props.accessibilityLabel;
4
- let temp = useSwitchWeb(Object.assign(Object.assign({}, props), { "aria-label": label }), state, ref);
5
- return temp;
6
- }
7
- //# sourceMappingURL=useSwitch.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSwitch.web.js","sourceRoot":"","sources":["../src/useSwitch.web.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAc/D,MAAM,UAAU,SAAS,CACvB,KAAwD,EACxD,KAAkB,EAClB,GAAgC;IAEhC,MAAM,KAAK,GAAG,KAAK,CAAC,kBAAkB,CAAC;IACvC,IAAI,IAAI,GAAG,YAAY,iCAAM,KAAK,KAAE,YAAY,EAAE,KAAK,KAAI,KAAK,EAAE,GAAG,CAAC,CAAC;IAEvE,OAAO,IAAI,CAAC;AACd,CAAC"}
File without changes
File without changes
File without changes