react-native-directional-toggle 0.1.1 → 0.1.3
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.en.md +236 -38
- package/README.md +236 -37
- package/lib/commonjs/AnimatedSwitch.js +211 -0
- package/lib/commonjs/AnimatedSwitch.js.map +1 -0
- package/lib/commonjs/index.js +15 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/AnimatedSwitch.js +150 -134
- package/lib/module/AnimatedSwitch.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/AnimatedSwitch.d.ts +48 -0
- package/lib/typescript/commonjs/src/AnimatedSwitch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/AnimatedSwitch.d.ts +48 -0
- package/lib/typescript/module/src/AnimatedSwitch.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +43 -19
- package/src/AnimatedSwitch.tsx +243 -169
- package/src/index.tsx +2 -1
- package/lib/typescript/src/AnimatedSwitch.d.ts +0 -25
- package/lib/typescript/src/AnimatedSwitch.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -3
- package/lib/typescript/src/index.d.ts.map +0 -1
- /package/lib/typescript/{package.json → module/package.json} +0 -0
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AnimatedSwitch"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,
|
|
1
|
+
{"version":3,"names":["AnimatedSwitch"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,QAAkC,qBAAkB;AAE3E,eAAeA,cAAc;AAC7B,SAASA,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle, type TextStyle } from 'react-native';
|
|
2
|
+
import { type WithSpringConfig, type WithTimingConfig } from 'react-native-reanimated';
|
|
3
|
+
type Option = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string | number;
|
|
6
|
+
};
|
|
7
|
+
export type AnimatedSwitchProps = {
|
|
8
|
+
options: Option[];
|
|
9
|
+
value: string | number;
|
|
10
|
+
onChange: (value: string | number) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Direction of the switch.
|
|
13
|
+
* @default false (Horizontal)
|
|
14
|
+
*/
|
|
15
|
+
vertical?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Container style. Use this to set width/height.
|
|
18
|
+
*/
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
/**
|
|
21
|
+
* Style for the moving thumb.
|
|
22
|
+
*/
|
|
23
|
+
thumbStyle?: StyleProp<ViewStyle>;
|
|
24
|
+
/**
|
|
25
|
+
* Base style for option text.
|
|
26
|
+
*/
|
|
27
|
+
textStyle?: StyleProp<TextStyle>;
|
|
28
|
+
/**
|
|
29
|
+
* Style for the text when active.
|
|
30
|
+
*/
|
|
31
|
+
activeTextStyle?: StyleProp<TextStyle>;
|
|
32
|
+
/**
|
|
33
|
+
* Style for the text when inactive.
|
|
34
|
+
*/
|
|
35
|
+
inactiveTextStyle?: StyleProp<TextStyle>;
|
|
36
|
+
/**
|
|
37
|
+
* Animation configuration.
|
|
38
|
+
*/
|
|
39
|
+
animationConfig?: WithTimingConfig | WithSpringConfig;
|
|
40
|
+
/**
|
|
41
|
+
* When true, the switch does not respond to interactions.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export declare function AnimatedSwitch({ options, value, onChange, vertical, style, thumbStyle, textStyle, activeTextStyle, inactiveTextStyle, animationConfig, disabled, }: AnimatedSwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=AnimatedSwitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedSwitch.d.ts","sourceRoot":"","sources":["../../../../src/AnimatedSwitch.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,OAAiB,EAMf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAEtB,MAAM,yBAAyB,CAAC;AAEjC,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC;;OAEG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IACtD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAQF,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,KAAK,EACL,UAAU,EACV,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,eAAmC,EACnC,QAAgB,GACjB,EAAE,mBAAmB,2CA4IrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,eAAe,cAAc,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle, type TextStyle } from 'react-native';
|
|
2
|
+
import { type WithSpringConfig, type WithTimingConfig } from 'react-native-reanimated';
|
|
3
|
+
type Option = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string | number;
|
|
6
|
+
};
|
|
7
|
+
export type AnimatedSwitchProps = {
|
|
8
|
+
options: Option[];
|
|
9
|
+
value: string | number;
|
|
10
|
+
onChange: (value: string | number) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Direction of the switch.
|
|
13
|
+
* @default false (Horizontal)
|
|
14
|
+
*/
|
|
15
|
+
vertical?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Container style. Use this to set width/height.
|
|
18
|
+
*/
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
/**
|
|
21
|
+
* Style for the moving thumb.
|
|
22
|
+
*/
|
|
23
|
+
thumbStyle?: StyleProp<ViewStyle>;
|
|
24
|
+
/**
|
|
25
|
+
* Base style for option text.
|
|
26
|
+
*/
|
|
27
|
+
textStyle?: StyleProp<TextStyle>;
|
|
28
|
+
/**
|
|
29
|
+
* Style for the text when active.
|
|
30
|
+
*/
|
|
31
|
+
activeTextStyle?: StyleProp<TextStyle>;
|
|
32
|
+
/**
|
|
33
|
+
* Style for the text when inactive.
|
|
34
|
+
*/
|
|
35
|
+
inactiveTextStyle?: StyleProp<TextStyle>;
|
|
36
|
+
/**
|
|
37
|
+
* Animation configuration.
|
|
38
|
+
*/
|
|
39
|
+
animationConfig?: WithTimingConfig | WithSpringConfig;
|
|
40
|
+
/**
|
|
41
|
+
* When true, the switch does not respond to interactions.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export declare function AnimatedSwitch({ options, value, onChange, vertical, style, thumbStyle, textStyle, activeTextStyle, inactiveTextStyle, animationConfig, disabled, }: AnimatedSwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=AnimatedSwitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedSwitch.d.ts","sourceRoot":"","sources":["../../../../src/AnimatedSwitch.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,OAAiB,EAMf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAEtB,MAAM,yBAAyB,CAAC;AAEjC,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC;;OAEG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IACtD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAQF,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,KAAK,EACL,UAAU,EACV,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,eAAmC,EACnC,QAAgB,GACjB,EAAE,mBAAmB,2CA4IrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,eAAe,cAAc,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-directional-toggle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Multi-element toggle component for React Native and Expo with support for vertical and horizontal layouts and animations.",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
9
|
+
"react-native": "./src/index.tsx",
|
|
7
10
|
"exports": {
|
|
8
11
|
".": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
14
|
+
"default": "./lib/module/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
18
|
+
"default": "./lib/commonjs/index.js"
|
|
19
|
+
}
|
|
12
20
|
},
|
|
13
21
|
"./package.json": "./package.json"
|
|
14
22
|
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
15
27
|
"files": [
|
|
16
28
|
"src",
|
|
17
29
|
"lib",
|
|
18
|
-
"android",
|
|
19
|
-
"ios",
|
|
20
|
-
"cpp",
|
|
21
|
-
"*.podspec",
|
|
22
|
-
"react-native.config.js",
|
|
23
|
-
"!ios/build",
|
|
24
|
-
"!android/build",
|
|
25
|
-
"!android/gradle",
|
|
26
|
-
"!android/gradlew",
|
|
27
|
-
"!android/gradlew.bat",
|
|
28
|
-
"!android/local.properties",
|
|
29
30
|
"!**/__tests__",
|
|
30
31
|
"!**/__fixtures__",
|
|
31
32
|
"!**/__mocks__",
|
|
@@ -33,8 +34,19 @@
|
|
|
33
34
|
],
|
|
34
35
|
"keywords": [
|
|
35
36
|
"react-native",
|
|
37
|
+
"expo",
|
|
38
|
+
"toggle",
|
|
39
|
+
"switch",
|
|
40
|
+
"animated",
|
|
41
|
+
"gesture",
|
|
36
42
|
"ios",
|
|
37
|
-
"android"
|
|
43
|
+
"android",
|
|
44
|
+
"segmented-control",
|
|
45
|
+
"multi-switch",
|
|
46
|
+
"animated-switch",
|
|
47
|
+
"react-native-component",
|
|
48
|
+
"ui-component",
|
|
49
|
+
"typescript"
|
|
38
50
|
],
|
|
39
51
|
"repository": {
|
|
40
52
|
"type": "git",
|
|
@@ -69,6 +81,9 @@
|
|
|
69
81
|
"prettier": "^2.8.8",
|
|
70
82
|
"react": "19.1.0",
|
|
71
83
|
"react-native": "0.81.5",
|
|
84
|
+
"react-native-gesture-handler": "^2.30.0",
|
|
85
|
+
"react-native-reanimated": "^4.2.1",
|
|
86
|
+
"react-native-worklets": "0.7.1",
|
|
72
87
|
"react-native-builder-bob": "^0.40.17",
|
|
73
88
|
"release-it": "^19.0.4",
|
|
74
89
|
"typescript": "^5.9.2"
|
|
@@ -87,6 +102,9 @@
|
|
|
87
102
|
"source": "src",
|
|
88
103
|
"output": "lib",
|
|
89
104
|
"targets": [
|
|
105
|
+
[
|
|
106
|
+
"commonjs"
|
|
107
|
+
],
|
|
90
108
|
[
|
|
91
109
|
"module",
|
|
92
110
|
{
|
|
@@ -113,6 +131,9 @@
|
|
|
113
131
|
"modulePathIgnorePatterns": [
|
|
114
132
|
"<rootDir>/example/node_modules",
|
|
115
133
|
"<rootDir>/lib/"
|
|
134
|
+
],
|
|
135
|
+
"transformIgnorePatterns": [
|
|
136
|
+
"node_modules/(?!(\\.pnpm/.*)?(react-native|@react-native|@react-navigation)/)"
|
|
116
137
|
]
|
|
117
138
|
},
|
|
118
139
|
"commitlint": {
|
|
@@ -150,12 +171,15 @@
|
|
|
150
171
|
],
|
|
151
172
|
"version": "0.56.1"
|
|
152
173
|
},
|
|
174
|
+
"dependencies": {},
|
|
153
175
|
"scripts": {
|
|
154
176
|
"example": "pnpm --filter react-native-directional-toggle-example run start",
|
|
155
177
|
"clean": "del-cli lib",
|
|
156
178
|
"typecheck": "tsc",
|
|
157
179
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
158
180
|
"test": "jest",
|
|
159
|
-
"release": "release-it --only-version"
|
|
181
|
+
"release": "release-it --only-version",
|
|
182
|
+
"android": "expo run:android",
|
|
183
|
+
"ios": "expo run:ios"
|
|
160
184
|
}
|
|
161
185
|
}
|