@app-studio/web 0.1.5 → 0.1.6

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 (283) hide show
  1. package/package.json +2 -3
  2. package/src/components/Button/Button/Button.props.ts +0 -79
  3. package/src/components/Button/Button/Button.state.ts +0 -7
  4. package/src/components/Button/Button/Button.style.ts +0 -95
  5. package/src/components/Button/Button/Button.type.d.ts +0 -11
  6. package/src/components/Button/Button/Button.view.tsx +0 -113
  7. package/src/components/Button/Button.md +0 -165
  8. package/src/components/Button/Button.tsx +0 -24
  9. package/src/components/Button/examples/AutoFocusButton.tsx +0 -13
  10. package/src/components/Button/examples/BorderedButtons.tsx +0 -14
  11. package/src/components/Button/examples/ColoredButtons.tsx +0 -12
  12. package/src/components/Button/examples/DefaultButton.tsx +0 -4
  13. package/src/components/Button/examples/DisabledButton.tsx +0 -13
  14. package/src/components/Button/examples/IconButtons.tsx +0 -23
  15. package/src/components/Button/examples/LoadingButtons.tsx +0 -32
  16. package/src/components/Button/examples/ShadowButton.tsx +0 -6
  17. package/src/components/Button/examples/SizeButtons.tsx +0 -16
  18. package/src/components/Button/examples/VariantButtons.tsx +0 -20
  19. package/src/components/Button/examples/index.ts +0 -9
  20. package/src/components/Form/Checkbox/Checkbox/Checkbox.props.ts +0 -118
  21. package/src/components/Form/Checkbox/Checkbox/Checkbox.state.ts +0 -15
  22. package/src/components/Form/Checkbox/Checkbox/Checkbox.style.ts +0 -29
  23. package/src/components/Form/Checkbox/Checkbox/Checkbox.type.d.ts +0 -8
  24. package/src/components/Form/Checkbox/Checkbox/Checkbox.view.tsx +0 -98
  25. package/src/components/Form/Checkbox/Checkbox.md +0 -128
  26. package/src/components/Form/Checkbox/Checkbox.tsx +0 -15
  27. package/src/components/Form/Checkbox/examples/ColorScheme.tsx +0 -12
  28. package/src/components/Form/Checkbox/examples/Default.tsx +0 -5
  29. package/src/components/Form/Checkbox/examples/DisabledInput.tsx +0 -5
  30. package/src/components/Form/Checkbox/examples/ErrorCheckbox.tsx +0 -5
  31. package/src/components/Form/Checkbox/examples/FormCheckout.tsx +0 -46
  32. package/src/components/Form/Checkbox/examples/IconCheckbox.tsx +0 -8
  33. package/src/components/Form/Checkbox/examples/IndeterminateCheckbox.tsx +0 -5
  34. package/src/components/Form/Checkbox/examples/ReadOnlyInput.tsx +0 -5
  35. package/src/components/Form/Checkbox/examples/Shadow.tsx +0 -11
  36. package/src/components/Form/Checkbox/examples/SizeInput.tsx +0 -18
  37. package/src/components/Form/Checkbox/examples/StylesInput.tsx +0 -22
  38. package/src/components/Form/Checkbox/examples/index.ts +0 -11
  39. package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.props.ts +0 -187
  40. package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.state.ts +0 -28
  41. package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.style.ts +0 -17
  42. package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.type.d.ts +0 -22
  43. package/src/components/Form/CountryPicker/CountryPicker/CountryPicker.view.tsx +0 -234
  44. package/src/components/Form/CountryPicker/CountryPicker.md +0 -206
  45. package/src/components/Form/CountryPicker/CountryPicker.tsx +0 -16
  46. package/src/components/Form/CountryPicker/countries.json +0 -1453
  47. package/src/components/Form/CountryPicker/examples/Color.tsx +0 -12
  48. package/src/components/Form/CountryPicker/examples/Default.tsx +0 -4
  49. package/src/components/Form/CountryPicker/examples/Disabled.tsx +0 -5
  50. package/src/components/Form/CountryPicker/examples/Error.tsx +0 -4
  51. package/src/components/Form/CountryPicker/examples/Form.tsx +0 -23
  52. package/src/components/Form/CountryPicker/examples/Formik.tsx +0 -39
  53. package/src/components/Form/CountryPicker/examples/HelperText.tsx +0 -5
  54. package/src/components/Form/CountryPicker/examples/ReadOnlyInput.tsx +0 -5
  55. package/src/components/Form/CountryPicker/examples/Shadow.tsx +0 -4
  56. package/src/components/Form/CountryPicker/examples/Shape.tsx +0 -13
  57. package/src/components/Form/CountryPicker/examples/SizeInput.tsx +0 -16
  58. package/src/components/Form/CountryPicker/examples/StylesInput.tsx +0 -17
  59. package/src/components/Form/CountryPicker/examples/Variant.tsx +0 -13
  60. package/src/components/Form/CountryPicker/examples/index.ts +0 -12
  61. package/src/components/Form/CountryPicker/styles.css +0 -7
  62. package/src/components/Form/DatePicker/DatePicker/DatePicker.props.ts +0 -113
  63. package/src/components/Form/DatePicker/DatePicker/DatePicker.state.ts +0 -17
  64. package/src/components/Form/DatePicker/DatePicker/DatePicker.style.ts +0 -17
  65. package/src/components/Form/DatePicker/DatePicker/DatePicker.type.d.ts +0 -15
  66. package/src/components/Form/DatePicker/DatePicker/DatePicker.view.tsx +0 -118
  67. package/src/components/Form/DatePicker/DatePicker.md +0 -115
  68. package/src/components/Form/DatePicker/DatePicker.tsx +0 -15
  69. package/src/components/Form/DatePicker/examples/ColorScheme.tsx +0 -12
  70. package/src/components/Form/DatePicker/examples/Default.tsx +0 -4
  71. package/src/components/Form/DatePicker/examples/DisabledInput.tsx +0 -5
  72. package/src/components/Form/DatePicker/examples/ErrorCheckbox.tsx +0 -4
  73. package/src/components/Form/DatePicker/examples/FormCheckout.tsx +0 -23
  74. package/src/components/Form/DatePicker/examples/Formik.tsx +0 -35
  75. package/src/components/Form/DatePicker/examples/ReadOnlyInput.tsx +0 -5
  76. package/src/components/Form/DatePicker/examples/Shadow.tsx +0 -10
  77. package/src/components/Form/DatePicker/examples/SizeInput.tsx +0 -16
  78. package/src/components/Form/DatePicker/examples/StylesInput.tsx +0 -14
  79. package/src/components/Form/DatePicker/examples/helperTextDatePicker.tsx +0 -6
  80. package/src/components/Form/DatePicker/examples/index.ts +0 -11
  81. package/src/components/Form/Label/Label/Label.props.ts +0 -36
  82. package/src/components/Form/Label/Label/Label.style.ts +0 -34
  83. package/src/components/Form/Label/Label/Label.type.ts +0 -14
  84. package/src/components/Form/Label/Label/Label.view.tsx +0 -35
  85. package/src/components/Form/Label/Label.tsx +0 -8
  86. package/src/components/Form/Password/Password/Password.props.ts +0 -36
  87. package/src/components/Form/Password/Password/Password.state.ts +0 -6
  88. package/src/components/Form/Password/Password/Password.type.d.ts +0 -14
  89. package/src/components/Form/Password/Password/Password.view.tsx +0 -32
  90. package/src/components/Form/Password/Password.md +0 -108
  91. package/src/components/Form/Password/Password.tsx +0 -15
  92. package/src/components/Form/Password/example/Default.tsx +0 -9
  93. package/src/components/Form/Password/example/DisabledInput.tsx +0 -17
  94. package/src/components/Form/Password/example/ErrorInput.tsx +0 -66
  95. package/src/components/Form/Password/example/FormikErrorInput.tsx +0 -67
  96. package/src/components/Form/Password/example/FormikHelperText.tsx +0 -65
  97. package/src/components/Form/Password/example/HelperText.tsx +0 -65
  98. package/src/components/Form/Select/Select/Select.props.ts +0 -262
  99. package/src/components/Form/Select/Select/Select.state.ts +0 -19
  100. package/src/components/Form/Select/Select/Select.style.ts +0 -19
  101. package/src/components/Form/Select/Select/Select.type.d.ts +0 -15
  102. package/src/components/Form/Select/Select/Select.view.tsx +0 -337
  103. package/src/components/Form/Select/Select.md +0 -165
  104. package/src/components/Form/Select/Select.tsx +0 -16
  105. package/src/components/Form/Select/examples/Color.tsx +0 -12
  106. package/src/components/Form/Select/examples/Default.tsx +0 -4
  107. package/src/components/Form/Select/examples/Disabled.tsx +0 -5
  108. package/src/components/Form/Select/examples/Error.tsx +0 -4
  109. package/src/components/Form/Select/examples/Form.tsx +0 -23
  110. package/src/components/Form/Select/examples/Formik.tsx +0 -41
  111. package/src/components/Form/Select/examples/HelperText.tsx +0 -7
  112. package/src/components/Form/Select/examples/Multiple.tsx +0 -6
  113. package/src/components/Form/Select/examples/ReadOnlyInput.tsx +0 -5
  114. package/src/components/Form/Select/examples/Shadow.tsx +0 -11
  115. package/src/components/Form/Select/examples/SizeInput.tsx +0 -16
  116. package/src/components/Form/Select/examples/StylesInput.tsx +0 -15
  117. package/src/components/Form/Switch/Switch/Switch.props.ts +0 -91
  118. package/src/components/Form/Switch/Switch/Switch.state.ts +0 -11
  119. package/src/components/Form/Switch/Switch/Switch.style.ts +0 -72
  120. package/src/components/Form/Switch/Switch/Switch.type.d.ts +0 -6
  121. package/src/components/Form/Switch/Switch/Switch.view.tsx +0 -78
  122. package/src/components/Form/Switch/Switch.md +0 -148
  123. package/src/components/Form/Switch/Switch.tsx +0 -12
  124. package/src/components/Form/Switch/examples/ChildSwitch.tsx +0 -20
  125. package/src/components/Form/Switch/examples/ColorScheme.tsx +0 -5
  126. package/src/components/Form/Switch/examples/Default.tsx +0 -4
  127. package/src/components/Form/Switch/examples/DisabledInput.tsx +0 -7
  128. package/src/components/Form/Switch/examples/FormSwitch.tsx +0 -22
  129. package/src/components/Form/Switch/examples/Formik.tsx +0 -30
  130. package/src/components/Form/Switch/examples/ReadOnlyInput.tsx +0 -7
  131. package/src/components/Form/Switch/examples/Shadow.tsx +0 -11
  132. package/src/components/Form/Switch/examples/SizeInput.tsx +0 -21
  133. package/src/components/Form/Switch/examples/StylesInput.tsx +0 -32
  134. package/src/components/Form/TextArea/TextArea/TextArea.props.ts +0 -154
  135. package/src/components/Form/TextArea/TextArea/TextArea.state.ts +0 -21
  136. package/src/components/Form/TextArea/TextArea/TextArea.type.ts +0 -15
  137. package/src/components/Form/TextArea/TextArea/TextArea.view.tsx +0 -143
  138. package/src/components/Form/TextArea/TextArea.md +0 -169
  139. package/src/components/Form/TextArea/TextArea.tsx +0 -15
  140. package/src/components/Form/TextArea/examples/ColorScheme.tsx +0 -13
  141. package/src/components/Form/TextArea/examples/Default.tsx +0 -5
  142. package/src/components/Form/TextArea/examples/DisabledInput.tsx +0 -7
  143. package/src/components/Form/TextArea/examples/ErrorInput.tsx +0 -50
  144. package/src/components/Form/TextArea/examples/FormikErrorInput.tsx +0 -52
  145. package/src/components/Form/TextArea/examples/FormikHelperText.tsx +0 -51
  146. package/src/components/Form/TextArea/examples/HelperText.tsx +0 -49
  147. package/src/components/Form/TextArea/examples/LabelInput.tsx +0 -23
  148. package/src/components/Form/TextArea/examples/MaxRowCol.tsx +0 -7
  149. package/src/components/Form/TextArea/examples/Placeholder.tsx +0 -23
  150. package/src/components/Form/TextArea/examples/ReadOnlyInput.tsx +0 -7
  151. package/src/components/Form/TextArea/examples/ShadowArea.tsx +0 -28
  152. package/src/components/Form/TextArea/examples/ShapeInput.tsx +0 -15
  153. package/src/components/Form/TextArea/examples/SizeInput.tsx +0 -16
  154. package/src/components/Form/TextArea/examples/StylesInput.tsx +0 -32
  155. package/src/components/Form/TextArea/examples/VariantsInputs.tsx +0 -15
  156. package/src/components/Form/TextArea/examples/index.ts +0 -15
  157. package/src/components/Form/TextArea/styles.css +0 -7
  158. package/src/components/Form/TextField/TextField/TextField.props.ts +0 -134
  159. package/src/components/Form/TextField/TextField/TextField.state.ts +0 -21
  160. package/src/components/Form/TextField/TextField/TextField.type.d.ts +0 -15
  161. package/src/components/Form/TextField/TextField/TextField.view.tsx +0 -170
  162. package/src/components/Form/TextField/TextField.md +0 -193
  163. package/src/components/Form/TextField/TextField.tsx +0 -14
  164. package/src/components/Form/TextField/examples/ClearInput.tsx +0 -13
  165. package/src/components/Form/TextField/examples/ColorScheme.tsx +0 -13
  166. package/src/components/Form/TextField/examples/Default.tsx +0 -23
  167. package/src/components/Form/TextField/examples/DisabledInput.tsx +0 -7
  168. package/src/components/Form/TextField/examples/ErrorInput.tsx +0 -74
  169. package/src/components/Form/TextField/examples/FormikErrorInput.tsx +0 -76
  170. package/src/components/Form/TextField/examples/FormikHelperText.tsx +0 -62
  171. package/src/components/Form/TextField/examples/HelperText.tsx +0 -60
  172. package/src/components/Form/TextField/examples/LabelInput.tsx +0 -23
  173. package/src/components/Form/TextField/examples/LeftChild.tsx +0 -8
  174. package/src/components/Form/TextField/examples/Placeholder.tsx +0 -23
  175. package/src/components/Form/TextField/examples/ReadOnlyInput.tsx +0 -7
  176. package/src/components/Form/TextField/examples/RightChild.tsx +0 -8
  177. package/src/components/Form/TextField/examples/ShapeInput.tsx +0 -15
  178. package/src/components/Form/TextField/examples/SizeInput.tsx +0 -16
  179. package/src/components/Form/TextField/examples/StylesInput.tsx +0 -33
  180. package/src/components/Form/TextField/examples/VariantsInputs.tsx +0 -15
  181. package/src/components/Form/TextField/examples/index.ts +0 -17
  182. package/src/components/Form/TextField/styles.css +0 -7
  183. package/src/components/Layout/Center/Center/Center.props.ts +0 -18
  184. package/src/components/Layout/Center/Center/Center.view.tsx +0 -12
  185. package/src/components/Layout/Center/Center.md +0 -17
  186. package/src/components/Layout/Center/Center.tsx +0 -11
  187. package/src/components/Layout/Horizontal/Horizontal/Horizontal.props.ts +0 -26
  188. package/src/components/Layout/Horizontal/Horizontal/Horizontal.view.tsx +0 -24
  189. package/src/components/Layout/Horizontal/Horizontal.md +0 -107
  190. package/src/components/Layout/Horizontal/Horizontal.tsx +0 -11
  191. package/src/components/Layout/Horizontal/examples/Default.tsx +0 -11
  192. package/src/components/Layout/Horizontal/examples/Justify.tsx +0 -25
  193. package/src/components/Layout/Horizontal/examples/Reversed.tsx +0 -11
  194. package/src/components/Layout/Horizontal/examples/Wrap.tsx +0 -29
  195. package/src/components/Layout/Horizontal/examples/index.ts +0 -4
  196. package/src/components/Layout/Input/FieldContainer/FieldContainer/FieldContainer.props.ts +0 -25
  197. package/src/components/Layout/Input/FieldContainer/FieldContainer.tsx +0 -17
  198. package/src/components/Layout/Input/FieldContent/FieldContent/FieldContent.props.ts +0 -75
  199. package/src/components/Layout/Input/FieldContent/FieldContent.tsx +0 -55
  200. package/src/components/Layout/Input/FieldIcons/FieldIcons/FieldIcons.props.ts +0 -12
  201. package/src/components/Layout/Input/FieldIcons/FieldIcons.tsx +0 -19
  202. package/src/components/Layout/Input/FieldLabel/FieldLabel/FieldLabel.props.ts +0 -31
  203. package/src/components/Layout/Input/FieldLabel/FieldLabel.tsx +0 -30
  204. package/src/components/Layout/Input/FieldLayout/FieldLayout/FieldLayout.props.ts +0 -29
  205. package/src/components/Layout/Input/FieldLayout/FieldLayout.tsx +0 -33
  206. package/src/components/Layout/Input/FieldWrapper/FieldWrapper.props.ts +0 -12
  207. package/src/components/Layout/Input/FieldWrapper/FieldWrapper.tsx +0 -11
  208. package/src/components/Layout/Input/HelperText/HelperText.props.ts +0 -21
  209. package/src/components/Layout/Input/HelperText/HelperText.tsx +0 -22
  210. package/src/components/Layout/Input/index.ts +0 -7
  211. package/src/components/Layout/Vertical/Vertical/Vertical.props.ts +0 -26
  212. package/src/components/Layout/Vertical/Vertical/Vertical.type.ts +0 -3
  213. package/src/components/Layout/Vertical/Vertical/Vertical.view.tsx +0 -23
  214. package/src/components/Layout/Vertical/Vertical.md +0 -120
  215. package/src/components/Layout/Vertical/Vertical.tsx +0 -12
  216. package/src/components/Layout/Vertical/examples/Default.tsx +0 -11
  217. package/src/components/Layout/Vertical/examples/Justify.tsx +0 -26
  218. package/src/components/Layout/Vertical/examples/Reversed.tsx +0 -11
  219. package/src/components/Layout/Vertical/examples/Wrap.tsx +0 -30
  220. package/src/components/Layout/Vertical/examples/index.tsx +0 -5
  221. package/src/components/Layout/View/View.tsx +0 -2
  222. package/src/components/Layout/configs/Input.style.ts +0 -45
  223. package/src/components/Layout/configs/Input.type.ts +0 -18
  224. package/src/components/Link/Link/Link.props.ts +0 -50
  225. package/src/components/Link/Link/Link.state.ts +0 -6
  226. package/src/components/Link/Link/Link.style.ts +0 -14
  227. package/src/components/Link/Link/Link.type.d.ts +0 -8
  228. package/src/components/Link/Link/Link.view.tsx +0 -44
  229. package/src/components/Link/Link.md +0 -61
  230. package/src/components/Link/Link.tsx +0 -15
  231. package/src/components/Link/examples/Default.tsx +0 -5
  232. package/src/components/Link/examples/IsExternal.tsx +0 -10
  233. package/src/components/Link/examples/Underline.tsx +0 -23
  234. package/src/components/Loader/Loader/Loader.props.ts +0 -105
  235. package/src/components/Loader/Loader/Loader.style.ts +0 -25
  236. package/src/components/Loader/Loader/Loader.type.d.ts +0 -4
  237. package/src/components/Loader/Loader/Loader.view.tsx +0 -138
  238. package/src/components/Loader/Loader.md +0 -111
  239. package/src/components/Loader/Loader.tsx +0 -11
  240. package/src/components/Loader/examples/ColorLoader.tsx +0 -13
  241. package/src/components/Loader/examples/DefaultLoader.tsx +0 -4
  242. package/src/components/Loader/examples/PositionLoader.tsx +0 -19
  243. package/src/components/Loader/examples/SizeLoader.tsx +0 -12
  244. package/src/components/Loader/examples/SpeedLoader.tsx +0 -12
  245. package/src/components/Loader/examples/TextLoader.tsx +0 -8
  246. package/src/components/Loader/examples/VariantLoader.tsx +0 -12
  247. package/src/components/Loader/examples/index.ts +0 -7
  248. package/src/components/Modal/Examples/BlurModal.tsx +0 -38
  249. package/src/components/Modal/Examples/CloseButtonModal.tsx +0 -44
  250. package/src/components/Modal/Examples/DefaultModal.tsx +0 -38
  251. package/src/components/Modal/Examples/FullScreenModal.tsx +0 -28
  252. package/src/components/Modal/Examples/ModalPosition.tsx +0 -61
  253. package/src/components/Modal/Examples/PreventCloseModal.tsx +0 -27
  254. package/src/components/Modal/Examples/ScrollModal.tsx +0 -41
  255. package/src/components/Modal/Examples/ShadowModal.tsx +0 -29
  256. package/src/components/Modal/Examples/VariantModal.tsx +0 -48
  257. package/src/components/Modal/Examples/index.ts +0 -9
  258. package/src/components/Modal/Modal/Modal.props.ts +0 -202
  259. package/src/components/Modal/Modal/Modal.style.ts +0 -23
  260. package/src/components/Modal/Modal/Modal.type.d.ts +0 -7
  261. package/src/components/Modal/Modal/Modal.view.tsx +0 -169
  262. package/src/components/Modal/Modal.md +0 -509
  263. package/src/components/Modal/Modal.tsx +0 -18
  264. package/src/components/Svg/ArrowDown.tsx +0 -32
  265. package/src/components/Svg/ArrowUp.tsx +0 -32
  266. package/src/components/Svg/Check.tsx +0 -28
  267. package/src/components/Svg/Close.tsx +0 -31
  268. package/src/components/Svg/CloseEye.tsx +0 -26
  269. package/src/components/Svg/DustBin.tsx +0 -29
  270. package/src/components/Svg/Edit.tsx +0 -34
  271. package/src/components/Svg/ExternalLink.tsx +0 -31
  272. package/src/components/Svg/Indeterminate.tsx +0 -21
  273. package/src/components/Svg/OpenEye.tsx +0 -26
  274. package/src/components/Svg/Profile.tsx +0 -40
  275. package/src/components/Svg/RightArrow.tsx +0 -44
  276. package/src/components/Svg/index.tsx +0 -12
  277. package/src/components/Text/Text/Text.props.ts +0 -84
  278. package/src/components/Text/Text/Text.style.ts +0 -34
  279. package/src/components/Text/Text/Text.type.d.ts +0 -14
  280. package/src/components/Text/Text/Text.view.tsx +0 -96
  281. package/src/components/Text/Text.md +0 -163
  282. package/src/components/Text/Text.tsx +0 -13
  283. package/src/components/index.tsx +0 -18
@@ -1,91 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- import { Elevation } from 'src/utils/elevation';
3
- import { Shadow } from 'app-studio';
4
-
5
- import { Size, SwitchStyles } from './Switch.type';
6
-
7
- export interface SwitchProps {
8
- /**
9
- * The content to be rendered when the switch is active.
10
- */
11
- activeChild?: React.ReactNode;
12
-
13
- /**
14
- * Specifies the color scheme for the switch's background.
15
- */
16
- colorScheme?: string;
17
-
18
- /**
19
- * Specifies the unique identifier of the switch.
20
- */
21
- id?: string;
22
-
23
- /**
24
- * Indicates the initial value of the switch.
25
- */
26
- isChecked?: boolean;
27
-
28
- /**
29
- * If set to true, the switch is disabled and cannot be interacted with.
30
- */
31
- isDisabled?: boolean;
32
-
33
- /**
34
- * If set to true, the switch cannot be turned on or off and is in read-only mode.
35
- */
36
- isReadOnly?: boolean;
37
-
38
- /**
39
- * A callback function that is invoked when the switch's value changes.
40
- */
41
- onChange?: Function;
42
-
43
- /**
44
- * A callback function that is invoked when the switch's value changes on iOS and Android devices.
45
- */
46
- onValueChange?: (event: any) => void;
47
-
48
- /**
49
- * The name of the switch.
50
- */
51
- name?: string;
52
-
53
- /**
54
- * The content to be rendered when the switch is inactive.
55
- */
56
- inActiveChild?: React.ReactNode;
57
-
58
- /**
59
- * Custom CSS styles for the switch container and its components.
60
- */
61
- styles?: SwitchStyles;
62
-
63
- /**
64
- * Adds a shadow effect to the switch.
65
- */
66
- shadow?: Shadow | Elevation | CSSProperties;
67
-
68
- /**
69
- * Specifies the size of the switch, affecting its height and width.
70
- */
71
- size?: Size;
72
-
73
- /**
74
- * Additional properties and attributes.
75
- */
76
- [x: string]: any;
77
- }
78
-
79
- export interface SwitchViewProps extends SwitchProps {
80
- /** Prop indicating if the switch is being hovered */
81
- isHovered: boolean;
82
-
83
- /** Callback prop to update the hover state of the switch */
84
- setIsHovered: Function;
85
-
86
- /** Prop indicating the current state of the switch */
87
- on?: boolean;
88
-
89
- /** Callback prop to update the state of the switch */
90
- setOn?: Function;
91
- }
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
-
3
- import { SwitchProps } from './Switch.props';
4
-
5
- export const useSwitchState = ({ isDisabled, isChecked }: SwitchProps) => {
6
- const [isHovered, setIsHovered] = React.useState(false);
7
-
8
- const [on, setOn] = React.useState(isDisabled ? !isDisabled : isChecked);
9
-
10
- return { isHovered, setIsHovered, on, setOn };
11
- };
@@ -1,72 +0,0 @@
1
- import { CSSProperties } from 'react';
2
-
3
- import { Size } from './Switch.type';
4
-
5
- export const KnobSizes: Record<Size, CSSProperties> = {
6
- xs: { height: 6, width: 6 },
7
- sm: { height: 9, width: 9 },
8
- md: { height: 12, width: 12 },
9
- lg: { height: 15, width: 15 },
10
- xl: { height: 18, width: 18 },
11
- '2xl': { height: 21, width: 21 },
12
- '3xl': { height: 24, width: 24 },
13
- '4xl': { height: 27, width: 27 },
14
- '5xl': { height: 30, width: 30 },
15
- '6xl': { height: 33, width: 33 },
16
- };
17
-
18
- export const SliderSizes: Record<Size, CSSProperties> = {
19
- xs: {
20
- height: 16,
21
- width: 28,
22
- },
23
- sm: {
24
- height: 20,
25
- width: 36,
26
- },
27
- md: {
28
- height: 24,
29
- width: 44,
30
- },
31
- lg: {
32
- height: 28,
33
- width: 52,
34
- },
35
- xl: {
36
- height: 32,
37
- width: 60,
38
- },
39
- '2xl': {
40
- height: 36,
41
- width: 68,
42
- },
43
- '3xl': {
44
- height: 40,
45
- width: 76,
46
- },
47
- '4xl': {
48
- height: 44,
49
- width: 84,
50
- },
51
- '5xl': {
52
- height: 48,
53
- width: 92,
54
- },
55
- '6xl': {
56
- height: 52,
57
- width: 100,
58
- },
59
- };
60
-
61
- export const SliderPadding: Record<Size, Record<string, number>> = {
62
- xs: { paddingVertical: 0, paddingHorizontal: 2 },
63
- sm: { paddingVertical: 0, paddingHorizontal: 3 },
64
- md: { paddingVertical: 0, paddingHorizontal: 5 },
65
- lg: { paddingVertical: 0, paddingHorizontal: 6 },
66
- xl: { paddingVertical: 0, paddingHorizontal: 8 },
67
- '2xl': { paddingVertical: 0, paddingHorizontal: 9 },
68
- '3xl': { paddingVertical: 0, paddingHorizontal: 10 },
69
- '4xl': { paddingVertical: 0, paddingHorizontal: 13 },
70
- '5xl': { paddingVertical: 0, paddingHorizontal: 15 },
71
- '6xl': { paddingVertical: 0, paddingHorizontal: 16 },
72
- };
@@ -1,6 +0,0 @@
1
- export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl';
2
-
3
- export type SwitchStyles = {
4
- slider?: CSSProperties;
5
- circle?: CSSProperties;
6
- };
@@ -1,78 +0,0 @@
1
- import React from 'react';
2
- import { Input } from 'app-studio';
3
- import { Label } from 'src/components/Form/Label/Label';
4
- import { View } from 'src/components/Layout/View/View';
5
-
6
- import { SwitchViewProps } from './Switch.props';
7
- import { KnobSizes, SliderPadding, SliderSizes } from './Switch.style';
8
-
9
- const SwitchContent = (props: any) => <Input type="checkbox" {...props} />;
10
-
11
- const SwitchView: React.FC<SwitchViewProps> = ({
12
- id,
13
- name,
14
- inActiveChild,
15
- activeChild,
16
- shadow = {},
17
- size = 'sm',
18
- colorScheme = 'theme.primary',
19
- on = false,
20
- isHovered = false,
21
- isChecked = false,
22
- isDisabled = false,
23
- isReadOnly = false,
24
- onChange,
25
- onValueChange,
26
- setOn = () => {},
27
- setIsHovered = () => {},
28
- styles = { slider: {}, circle: {} },
29
- ...props
30
- }) => {
31
- const handleToggle = (event: any) => {
32
- if (!isReadOnly) {
33
- setOn(!on);
34
- if (onChange) onChange(event);
35
- }
36
- };
37
-
38
- const handleHover = () => setIsHovered(!isHovered);
39
-
40
- return (
41
- <Label htmlFor={id} onMouseEnter={handleHover} onMouseLeave={handleHover}>
42
- <SwitchContent
43
- id={id}
44
- name={name}
45
- opacity={0}
46
- width={0}
47
- height={0}
48
- checked={on}
49
- onChange={handleToggle}
50
- disabled={isDisabled}
51
- readOnly={isReadOnly}
52
- {...(onValueChange && { onValueChange: handleToggle })}
53
- {...props}
54
- />
55
- {/* Slide */}
56
- <View
57
- display="flex"
58
- cursor="pointer"
59
- alignItems="center"
60
- borderRadius={24}
61
- filter={isHovered && on ? 'brightness(0.9)' : 'brightness(1)'}
62
- transition="justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
63
- backgroundColor={isDisabled ? 'disabled' : on ? colorScheme : 'lightgray'}
64
- justifyContent={activeChild ? 'space-between' : on ? 'flex-end' : 'flex-start'}
65
- {...shadow}
66
- {...SliderPadding[size]}
67
- {...SliderSizes[size]}
68
- {...styles['slider']}
69
- >
70
- {activeChild && on && <View>{activeChild}</View>}
71
- <View borderRadius="50%" backgroundColor="white" {...KnobSizes[size]} {...styles['circle']} />
72
- {inActiveChild && !on && <View>{inActiveChild}</View>}
73
- </View>
74
- </Label>
75
- );
76
- };
77
-
78
- export default SwitchView;
@@ -1,148 +0,0 @@
1
- ### **Import**
2
-
3
- ```tsx static
4
- import { Switch } from 'app-studio';
5
- ```
6
-
7
- ### **Default**
8
-
9
- ```tsx
10
- <Switch />
11
- ```
12
-
13
- ### **Checked**
14
-
15
- “**_isChecked_**” is the toggle's initial state. It has a default value of false.
16
-
17
- ```tsx
18
- <Switch name="checked" isChecked />
19
- ```
20
-
21
- ### **Disabled**
22
-
23
- “**_isDisabled_**” makes the toggle unusable.
24
-
25
- ```tsx
26
- <Switch name="disabled" isDisabled />
27
- ```
28
-
29
- ### **Read Only**
30
-
31
- “**_isReadOnly_**” makes the toggle only readable. The user will be unable to change the state of the toggle.
32
-
33
- ```tsx
34
- <Switch name="readOnly" isReadOnly isChecked />
35
- ```
36
-
37
- ### **Sizes**
38
-
39
- “**_size_**” changes the toggle size. It has a default value of “sm”.
40
-
41
- ```tsx
42
- import { Vertical } from '../../Layout/Vertical/Vertical';
43
-
44
- <Vertical gap={10}>
45
- <Switch name="xs" size="xs" isChecked />
46
- <Switch name="sm" size="sm" isChecked />
47
- <Switch name="md" size="md" isChecked />
48
- <Switch name="lg" size="lg" isChecked />
49
- <Switch name="xl" size="xl" isChecked />
50
- </Vertical>;
51
- ```
52
-
53
- ### **Shadow**
54
-
55
- “**_shadow_**” adds a shadow effect to the toggle.
56
-
57
- ```tsx
58
- <Switch id="checkbox" name="shadow" shadow={{ boxShadow: 'rgb(249, 115, 22) 0px 4px 14px 0px' }} isChecked />
59
- ```
60
-
61
- ### **Child**
62
-
63
- “**_activeChild_**” and “**_inActiveChild_**” add a child to the toggle for each state. It includes the "activeChild" when it is active and the "inActiveChild" when it is not.
64
-
65
- ```tsx
66
- import { Text } from '../../Text/Text';
67
-
68
- <Switch
69
- activeChild={
70
- <Text color="white" size="sm">
71
- On
72
- </Text>
73
- }
74
- inActiveChild={
75
- <Text color="white" size="xs">
76
- Off
77
- </Text>
78
- }
79
- />;
80
- ```
81
-
82
- ### **ColorScheme**
83
-
84
- “**_colorScheme_**” modifies the toggle's background color.
85
-
86
- ```tsx
87
- <Switch name="name" colorScheme="theme.primary" isChecked />
88
- ```
89
-
90
- ## **Types**
91
-
92
- ```tsx static
93
- type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
94
- ```
95
-
96
- ```tsx static
97
- type SwitchStyles = {
98
- slider?: CSSProperties;
99
- circle?: CSSProperties;
100
- };
101
- ```
102
-
103
- ## **Default Values**
104
-
105
- ```tsx static
106
- const KnobSizes: Record<Size, CSSProperties> = {
107
- xs: { height: 6, width: 6 },
108
- sm: { height: 9, width: 9 },
109
- md: { height: 12, width: 12 },
110
- lg: { height: 15, width: 15 },
111
- xl: { height: 18, width: 18 },
112
- };
113
- ```
114
-
115
- ```tsx static
116
- const SliderPadding: Record<Size, string> = {
117
- xs: '0 2px',
118
- sm: '0 3px',
119
- md: '0 5px',
120
- lg: '0 6px',
121
- xl: '0 8px',
122
- };
123
- ```
124
-
125
- ```tsx static
126
- const SliderSizes: Record<Size, CSSProperties> = {
127
- xs: {
128
- height: 16,
129
- width: 28,
130
- },
131
- sm: {
132
- height: 20,
133
- width: 36,
134
- },
135
- md: {
136
- height: 24,
137
- width: 44,
138
- },
139
- lg: {
140
- height: 28,
141
- width: 52,
142
- },
143
- xl: {
144
- height: 32,
145
- width: 60,
146
- },
147
- };
148
- ```
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
-
3
- import { SwitchProps } from './Switch/Switch.props';
4
- import { useSwitchState } from './Switch/Switch.state';
5
- import SwitchView from './Switch/Switch.view';
6
-
7
- const SwitchComponent: React.FC<SwitchProps> = (props) => {
8
- const switchStates = useSwitchState(props);
9
- return <SwitchView {...switchStates} {...props} />;
10
- };
11
-
12
- export const Switch = SwitchComponent;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { Switch } from 'src/components';
3
- import { Text } from 'src/components';
4
-
5
- export const ChildSwitch = () => (
6
- <Switch
7
- id="child"
8
- name="child"
9
- activeChild={
10
- <Text color="white" size="xs">
11
- On
12
- </Text>
13
- }
14
- inActiveChild={
15
- <Text color="white" size="xs">
16
- Off
17
- </Text>
18
- }
19
- />
20
- );
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Switch } from '../Switch';
4
-
5
- export const ColorSwitch = () => <Switch name="name" colorScheme="theme.primary" isChecked />;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { Switch } from 'src/components';
3
-
4
- export const DefaultSwitch = () => <Switch id="check" name="checkbox" />;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Switch } from '../Switch';
4
-
5
- export const DisabledSwitch = () => {
6
- return <Switch name="disabled" isDisabled />;
7
- };
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { Button } from 'src/components';
3
- import { Vertical } from 'src/components/Layout/Vertical/examples';
4
-
5
- import { Label } from '../../Label/Label';
6
- import { Switch } from '../Switch';
7
-
8
- export const FormSwitch = () => {
9
- const handleSubmit = (event: any) => {
10
- event.preventDefault();
11
- alert(event.target.elements.toggleFormik.checked);
12
- };
13
- return (
14
- <form onSubmit={handleSubmit}>
15
- <Vertical gap={10}>
16
- <Label> Without Formik</Label>
17
- <Switch id="toggleFormik" name="toggleFormik" />
18
- <Button type="submit">Submit</Button>
19
- </Vertical>
20
- </form>
21
- );
22
- };
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { Field, Form, Formik } from 'formik';
3
- import { Button } from 'src/components';
4
- import { Vertical } from 'src/components/Layout/Vertical/examples';
5
-
6
- import { Label } from '../../Label/Label';
7
- import { Switch } from '../Switch';
8
-
9
- export const FormikSwitch = () => {
10
- const initialValues = {
11
- toggle: false,
12
- };
13
-
14
- const onSubmit = (values: any) => {
15
- alert(values.toggle);
16
- };
17
- return (
18
- <Formik initialValues={initialValues} onSubmit={onSubmit}>
19
- {({ values, handleChange }) => (
20
- <Form>
21
- <Vertical gap={10}>
22
- <Label>Formik</Label>
23
- <Field id="toggle" name="toggle" as={Switch} isChecked={values.toggle} onChange={handleChange} />
24
- <Button type="submit">Submit</Button>
25
- </Vertical>
26
- </Form>
27
- )}
28
- </Formik>
29
- );
30
- };
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Switch } from '../Switch';
4
-
5
- export const ReadOnlySwitch = () => {
6
- return <Switch name="disabled" value="Sarah Jane" isChecked isReadOnly />;
7
- };
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { Switch } from 'src/components';
3
-
4
- export const ShadowSwitch = () => (
5
- <Switch
6
- id="shadowCheckbox"
7
- name="shadowCheckbox"
8
- shadow={{ boxShadow: 'rgb(249, 115, 22) 0px 4px 14px 0px' }}
9
- isChecked
10
- />
11
- );
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { Vertical } from 'src/components/Layout/Vertical/examples';
3
-
4
- import { Switch } from '../Switch';
5
-
6
- export const SizeSwitch = () => {
7
- return (
8
- <Vertical gap={10}>
9
- <Switch name="xs" size="xs" isChecked />
10
- <Switch name="sm" size="sm" isChecked />
11
- <Switch name="md" size="md" isChecked />
12
- <Switch name="lg" size="lg" isChecked />
13
- <Switch name="xl" size="xl" isChecked />
14
- <Switch name="2xl" size="2xl" isChecked />
15
- <Switch name="3xl" size="3xl" isChecked />
16
- <Switch name="4xl" size="4xl" isChecked />
17
- <Switch name="5xl" size="5xl" isChecked />
18
- <Switch name="6xl" size="6xl" isChecked />
19
- </Vertical>
20
- );
21
- };
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { Button } from 'src/components';
3
- import { Horizontal } from 'src/components';
4
-
5
- import { Switch } from '../Switch';
6
-
7
- export const StyledSwitch = () => {
8
- const handleSubmit = (event: any) => {
9
- event.preventDefault();
10
- const formData = new FormData(event.target);
11
- alert(`Hello, ${formData.get('surname')}`);
12
- };
13
- return (
14
- <form onSubmit={handleSubmit}>
15
- <Horizontal gap={10} alignItems="center" wrap="nowrap">
16
- <Switch
17
- name="surname"
18
- label="Surname"
19
- variant="unStyled"
20
- shadow={{ boxShadow: 'rgba(0, 0, 0, 0.20) 0px 3px 8px' }}
21
- styles={{
22
- slider: { borderRadius: 8, borderColor: 'theme.primary', borderStyle: 'solid', borderWidth: 1 },
23
- circle: { backgroundColor: 'theme.primary' },
24
- }}
25
- />
26
- <Button type="submit" height="40px" colorScheme="theme.primary" isAuto>
27
- Submit
28
- </Button>
29
- </Horizontal>
30
- </form>
31
- );
32
- };