ferns-ui 0.2.0 → 0.2.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.
Files changed (342) hide show
  1. package/dist/ActionSheet.js.map +1 -1
  2. package/dist/Button.js +1 -2
  3. package/dist/Button.js.map +1 -1
  4. package/dist/CheckBox.js +1 -1
  5. package/dist/CheckBox.js.map +1 -1
  6. package/dist/Common.d.ts +3 -3
  7. package/dist/Common.js.map +1 -1
  8. package/dist/DateTimeActionSheet.js.map +1 -1
  9. package/dist/DecimalRangeActionSheet.js.map +1 -1
  10. package/dist/ErrorBoundary.d.ts +1 -1
  11. package/dist/Field.d.ts +12 -14
  12. package/dist/Field.js +95 -98
  13. package/dist/Field.js.map +1 -1
  14. package/dist/HeightActionSheet.js.map +1 -1
  15. package/dist/Icon.d.ts +0 -3
  16. package/dist/Icon.js +4 -112
  17. package/dist/Icon.js.map +1 -1
  18. package/dist/IconButton.js +1 -1
  19. package/dist/IconButton.js.map +1 -1
  20. package/dist/NumberPickerActionSheet.js.map +1 -1
  21. package/dist/PickerSelect.d.ts +4 -4
  22. package/dist/Pog.js +1 -1
  23. package/dist/Pog.js.map +1 -1
  24. package/dist/SplitPage.js.map +1 -1
  25. package/dist/TapToEdit.js +1 -1
  26. package/dist/TapToEdit.js.map +1 -1
  27. package/dist/TextField.js +1 -1
  28. package/dist/TextField.js.map +1 -1
  29. package/dist/TextFieldNumberActionSheet.js.map +1 -1
  30. package/dist/Unifier.js +1 -9
  31. package/dist/Unifier.js.map +1 -1
  32. package/package.json +31 -30
  33. package/src/Button.tsx +1 -1
  34. package/src/CheckBox.tsx +1 -1
  35. package/src/Common.ts +3 -2
  36. package/src/Field.tsx +91 -98
  37. package/src/Icon.tsx +3 -122
  38. package/src/IconButton.tsx +1 -1
  39. package/src/Pog.tsx +2 -2
  40. package/src/TapToEdit.tsx +1 -1
  41. package/src/TextField.tsx +1 -1
  42. package/src/TextFieldNumberActionSheet.tsx +1 -1
  43. package/dist/Banner.stories.d.ts +0 -1
  44. package/dist/Banner.stories.js +0 -13
  45. package/dist/Banner.stories.js.map +0 -1
  46. package/dist/Box.stories.d.ts +0 -1
  47. package/dist/Box.stories.js +0 -45
  48. package/dist/Box.stories.js.map +0 -1
  49. package/dist/Button.stories.d.ts +0 -1
  50. package/dist/Button.stories.js +0 -41
  51. package/dist/Button.stories.js.map +0 -1
  52. package/dist/Card.stories.d.ts +0 -6
  53. package/dist/Card.stories.js +0 -18
  54. package/dist/Card.stories.js.map +0 -1
  55. package/dist/CheckBox.stories.d.ts +0 -1
  56. package/dist/CheckBox.stories.js +0 -28
  57. package/dist/CheckBox.stories.js.map +0 -1
  58. package/dist/Field.stories.d.ts +0 -6
  59. package/dist/Field.stories.js +0 -38
  60. package/dist/Field.stories.js.map +0 -1
  61. package/dist/Form.stories.d.ts +0 -6
  62. package/dist/Form.stories.js +0 -36
  63. package/dist/Form.stories.js.map +0 -1
  64. package/dist/HeaderButtons.stories.d.ts +0 -6
  65. package/dist/HeaderButtons.stories.js +0 -6
  66. package/dist/HeaderButtons.stories.js.map +0 -1
  67. package/dist/Heading.stories.d.ts +0 -1
  68. package/dist/Heading.stories.js +0 -22
  69. package/dist/Heading.stories.js.map +0 -1
  70. package/dist/Icon.stories.d.ts +0 -1
  71. package/dist/Icon.stories.js +0 -30
  72. package/dist/Icon.stories.js.map +0 -1
  73. package/dist/IconButton.stories.d.ts +0 -1
  74. package/dist/IconButton.stories.js +0 -16
  75. package/dist/IconButton.stories.js.map +0 -1
  76. package/dist/Link.stories.d.ts +0 -1
  77. package/dist/Link.stories.js +0 -18
  78. package/dist/Link.stories.js.map +0 -1
  79. package/dist/Mask.stories.d.ts +0 -1
  80. package/dist/Mask.stories.js +0 -28
  81. package/dist/Mask.stories.js.map +0 -1
  82. package/dist/Pill.stories.d.ts +0 -1
  83. package/dist/Pill.stories.js +0 -38
  84. package/dist/Pill.stories.js.map +0 -1
  85. package/dist/SegmentedControl.stories.d.ts +0 -1
  86. package/dist/SegmentedControl.stories.js +0 -31
  87. package/dist/SegmentedControl.stories.js.map +0 -1
  88. package/dist/SelectList.stories.d.ts +0 -1
  89. package/dist/SelectList.stories.js +0 -26
  90. package/dist/SelectList.stories.js.map +0 -1
  91. package/dist/Spinner.stories.d.ts +0 -1
  92. package/dist/Spinner.stories.js +0 -12
  93. package/dist/Spinner.stories.js.map +0 -1
  94. package/dist/SplitPage.stories.d.ts +0 -1
  95. package/dist/SplitPage.stories.js +0 -15
  96. package/dist/SplitPage.stories.js.map +0 -1
  97. package/dist/StorybookContainer.d.ts +0 -4
  98. package/dist/StorybookContainer.js +0 -8
  99. package/dist/StorybookContainer.js.map +0 -1
  100. package/dist/Switch.stories.d.ts +0 -1
  101. package/dist/Switch.stories.js +0 -34
  102. package/dist/Switch.stories.js.map +0 -1
  103. package/dist/Text.stories.d.ts +0 -1
  104. package/dist/Text.stories.js +0 -37
  105. package/dist/Text.stories.js.map +0 -1
  106. package/dist/TextArea.stories.d.ts +0 -10
  107. package/dist/TextArea.stories.js +0 -24
  108. package/dist/TextArea.stories.js.map +0 -1
  109. package/dist/TextField.stories.d.ts +0 -6
  110. package/dist/TextField.stories.js +0 -18
  111. package/dist/TextField.stories.js.map +0 -1
  112. package/dist/dist/ActionSheet.d.ts +0 -139
  113. package/dist/dist/ActionSheet.js +0 -637
  114. package/dist/dist/ActionSheet.js.map +0 -1
  115. package/dist/dist/Banner.d.ts +0 -12
  116. package/dist/dist/Banner.js +0 -49
  117. package/dist/dist/Banner.js.map +0 -1
  118. package/dist/dist/Banner.stories.d.ts +0 -1
  119. package/dist/dist/Banner.stories.js +0 -9
  120. package/dist/dist/Banner.stories.js.map +0 -1
  121. package/dist/dist/BlurBox.d.ts +0 -7
  122. package/dist/dist/BlurBox.js +0 -29
  123. package/dist/dist/BlurBox.js.map +0 -1
  124. package/dist/dist/BlurBox.native.d.ts +0 -9
  125. package/dist/dist/BlurBox.native.js +0 -32
  126. package/dist/dist/BlurBox.native.js.map +0 -1
  127. package/dist/dist/Body.d.ts +0 -12
  128. package/dist/dist/Body.js +0 -19
  129. package/dist/dist/Body.js.map +0 -1
  130. package/dist/dist/Box.d.ts +0 -205
  131. package/dist/dist/Box.js +0 -229
  132. package/dist/dist/Box.js.map +0 -1
  133. package/dist/dist/Box.stories.d.ts +0 -1
  134. package/dist/dist/Box.stories.js +0 -37
  135. package/dist/dist/Box.stories.js.map +0 -1
  136. package/dist/dist/Button.d.ts +0 -16
  137. package/dist/dist/Button.js +0 -98
  138. package/dist/dist/Button.js.map +0 -1
  139. package/dist/dist/Button.stories.d.ts +0 -13
  140. package/dist/dist/Button.stories.js +0 -26
  141. package/dist/dist/Button.stories.js.map +0 -1
  142. package/dist/dist/Card.d.ts +0 -6
  143. package/dist/dist/Card.js +0 -9
  144. package/dist/dist/Card.js.map +0 -1
  145. package/dist/dist/Card.stories.d.ts +0 -6
  146. package/dist/dist/Card.stories.js +0 -11
  147. package/dist/dist/Card.stories.js.map +0 -1
  148. package/dist/dist/CheckBox.d.ts +0 -8
  149. package/dist/dist/CheckBox.js +0 -23
  150. package/dist/dist/CheckBox.js.map +0 -1
  151. package/dist/dist/CheckBox.stories.d.ts +0 -1
  152. package/dist/dist/CheckBox.stories.js +0 -22
  153. package/dist/dist/CheckBox.stories.js.map +0 -1
  154. package/dist/dist/Common.d.ts +0 -5
  155. package/dist/dist/Common.js +0 -47
  156. package/dist/dist/Common.js.map +0 -1
  157. package/dist/dist/DateTimeActionSheet.d.ts +0 -5
  158. package/dist/dist/DateTimeActionSheet.js +0 -24
  159. package/dist/dist/DateTimeActionSheet.js.map +0 -1
  160. package/dist/dist/DecimalRangeActionSheet.d.ts +0 -9
  161. package/dist/dist/DecimalRangeActionSheet.js +0 -57
  162. package/dist/dist/DecimalRangeActionSheet.js.map +0 -1
  163. package/dist/dist/ErrorBoundary.d.ts +0 -12
  164. package/dist/dist/ErrorBoundary.js +0 -32
  165. package/dist/dist/ErrorBoundary.js.map +0 -1
  166. package/dist/dist/ErrorPage.d.ts +0 -7
  167. package/dist/dist/ErrorPage.js +0 -15
  168. package/dist/dist/ErrorPage.js.map +0 -1
  169. package/dist/dist/Field.d.ts +0 -17
  170. package/dist/dist/Field.js +0 -136
  171. package/dist/dist/Field.js.map +0 -1
  172. package/dist/dist/Field.stories.d.ts +0 -6
  173. package/dist/dist/Field.stories.js +0 -25
  174. package/dist/dist/Field.stories.js.map +0 -1
  175. package/dist/dist/FieldWithLabels.d.ts +0 -10
  176. package/dist/dist/FieldWithLabels.js +0 -7
  177. package/dist/dist/FieldWithLabels.js.map +0 -1
  178. package/dist/dist/FlatList.d.ts +0 -1
  179. package/dist/dist/FlatList.js +0 -4
  180. package/dist/dist/FlatList.js.map +0 -1
  181. package/dist/dist/Form.d.ts +0 -15
  182. package/dist/dist/Form.js +0 -56
  183. package/dist/dist/Form.js.map +0 -1
  184. package/dist/dist/Form.stories.d.ts +0 -6
  185. package/dist/dist/Form.stories.js +0 -27
  186. package/dist/dist/Form.stories.js.map +0 -1
  187. package/dist/dist/HeaderButtons.d.ts +0 -39
  188. package/dist/dist/HeaderButtons.js +0 -50
  189. package/dist/dist/HeaderButtons.js.map +0 -1
  190. package/dist/dist/HeaderButtons.stories.d.ts +0 -6
  191. package/dist/dist/HeaderButtons.stories.js +0 -7
  192. package/dist/dist/HeaderButtons.stories.js.map +0 -1
  193. package/dist/dist/Heading.d.ts +0 -32
  194. package/dist/dist/Heading.js +0 -47
  195. package/dist/dist/Heading.js.map +0 -1
  196. package/dist/dist/Heading.stories.d.ts +0 -1
  197. package/dist/dist/Heading.stories.js +0 -11
  198. package/dist/dist/Heading.stories.js.map +0 -1
  199. package/dist/dist/HeightActionSheet.d.ts +0 -9
  200. package/dist/dist/HeightActionSheet.js +0 -50
  201. package/dist/dist/HeightActionSheet.js.map +0 -1
  202. package/dist/dist/Icon.d.ts +0 -12
  203. package/dist/dist/Icon.js +0 -126
  204. package/dist/dist/Icon.js.map +0 -1
  205. package/dist/dist/Icon.stories.d.ts +0 -1
  206. package/dist/dist/Icon.stories.js +0 -11
  207. package/dist/dist/Icon.stories.js.map +0 -1
  208. package/dist/dist/IconButton.d.ts +0 -42
  209. package/dist/dist/IconButton.js +0 -41
  210. package/dist/dist/IconButton.js.map +0 -1
  211. package/dist/dist/IconButton.stories.d.ts +0 -1
  212. package/dist/dist/IconButton.stories.js +0 -8
  213. package/dist/dist/IconButton.stories.js.map +0 -1
  214. package/dist/dist/Image.d.ts +0 -9
  215. package/dist/dist/Image.js +0 -37
  216. package/dist/dist/Image.js.map +0 -1
  217. package/dist/dist/ImageBackground.d.ts +0 -6
  218. package/dist/dist/ImageBackground.js +0 -9
  219. package/dist/dist/ImageBackground.js.map +0 -1
  220. package/dist/dist/Layer.d.ts +0 -5
  221. package/dist/dist/Layer.js +0 -13
  222. package/dist/dist/Layer.js.map +0 -1
  223. package/dist/dist/Link.d.ts +0 -7
  224. package/dist/dist/Link.js +0 -13
  225. package/dist/dist/Link.js.map +0 -1
  226. package/dist/dist/Link.stories.d.ts +0 -1
  227. package/dist/dist/Link.stories.js +0 -8
  228. package/dist/dist/Link.stories.js.map +0 -1
  229. package/dist/dist/Mask.d.ts +0 -5
  230. package/dist/dist/Mask.js +0 -23
  231. package/dist/dist/Mask.js.map +0 -1
  232. package/dist/dist/Mask.stories.d.ts +0 -1
  233. package/dist/dist/Mask.stories.js +0 -13
  234. package/dist/dist/Mask.stories.js.map +0 -1
  235. package/dist/dist/MediaQuery.d.ts +0 -2
  236. package/dist/dist/MediaQuery.js +0 -34
  237. package/dist/dist/MediaQuery.js.map +0 -1
  238. package/dist/dist/Meta.d.ts +0 -6
  239. package/dist/dist/Meta.js +0 -8
  240. package/dist/dist/Meta.js.map +0 -1
  241. package/dist/dist/ModalSheet.d.ts +0 -3
  242. package/dist/dist/ModalSheet.js +0 -43
  243. package/dist/dist/ModalSheet.js.map +0 -1
  244. package/dist/dist/NumberPickerActionSheet.d.ts +0 -5
  245. package/dist/dist/NumberPickerActionSheet.js +0 -25
  246. package/dist/dist/NumberPickerActionSheet.js.map +0 -1
  247. package/dist/dist/Page.d.ts +0 -9
  248. package/dist/dist/Page.js +0 -26
  249. package/dist/dist/Page.js.map +0 -1
  250. package/dist/dist/Permissions.d.ts +0 -1
  251. package/dist/dist/Permissions.js +0 -36
  252. package/dist/dist/Permissions.js.map +0 -1
  253. package/dist/dist/PickerSelect.d.ts +0 -172
  254. package/dist/dist/PickerSelect.js +0 -403
  255. package/dist/dist/PickerSelect.js.map +0 -1
  256. package/dist/dist/Pill.d.ts +0 -7
  257. package/dist/dist/Pill.js +0 -10
  258. package/dist/dist/Pill.js.map +0 -1
  259. package/dist/dist/Pill.stories.d.ts +0 -1
  260. package/dist/dist/Pill.stories.js +0 -36
  261. package/dist/dist/Pill.stories.js.map +0 -1
  262. package/dist/dist/Pog.d.ts +0 -7
  263. package/dist/dist/Pog.js +0 -144
  264. package/dist/dist/Pog.js.map +0 -1
  265. package/dist/dist/ProgressBar.d.ts +0 -16
  266. package/dist/dist/ProgressBar.js +0 -40
  267. package/dist/dist/ProgressBar.js.map +0 -1
  268. package/dist/dist/ScrollView.d.ts +0 -1
  269. package/dist/dist/ScrollView.js +0 -4
  270. package/dist/dist/ScrollView.js.map +0 -1
  271. package/dist/dist/SegmentedControl.d.ts +0 -9
  272. package/dist/dist/SegmentedControl.js +0 -18
  273. package/dist/dist/SegmentedControl.js.map +0 -1
  274. package/dist/dist/SegmentedControl.stories.d.ts +0 -1
  275. package/dist/dist/SegmentedControl.stories.js +0 -32
  276. package/dist/dist/SegmentedControl.stories.js.map +0 -1
  277. package/dist/dist/SelectList.d.ts +0 -9
  278. package/dist/dist/SelectList.js +0 -29
  279. package/dist/dist/SelectList.js.map +0 -1
  280. package/dist/dist/SelectList.stories.d.ts +0 -1
  281. package/dist/dist/SelectList.stories.js +0 -24
  282. package/dist/dist/SelectList.stories.js.map +0 -1
  283. package/dist/dist/Spinner.d.ts +0 -44
  284. package/dist/dist/Spinner.js +0 -58
  285. package/dist/dist/Spinner.js.map +0 -1
  286. package/dist/dist/Spinner.stories.d.ts +0 -1
  287. package/dist/dist/Spinner.stories.js +0 -10
  288. package/dist/dist/Spinner.stories.js.map +0 -1
  289. package/dist/dist/SplitPage.d.ts +0 -7
  290. package/dist/dist/SplitPage.js +0 -20
  291. package/dist/dist/SplitPage.js.map +0 -1
  292. package/dist/dist/SplitPage.stories.d.ts +0 -1
  293. package/dist/dist/SplitPage.stories.js +0 -7
  294. package/dist/dist/SplitPage.stories.js.map +0 -1
  295. package/dist/dist/StorybookContainer.d.ts +0 -7
  296. package/dist/dist/StorybookContainer.js +0 -9
  297. package/dist/dist/StorybookContainer.js.map +0 -1
  298. package/dist/dist/Switch.d.ts +0 -6
  299. package/dist/dist/Switch.js +0 -10
  300. package/dist/dist/Switch.js.map +0 -1
  301. package/dist/dist/Switch.stories.d.ts +0 -1
  302. package/dist/dist/Switch.stories.js +0 -27
  303. package/dist/dist/Switch.stories.js.map +0 -1
  304. package/dist/dist/TapToEdit.d.ts +0 -9
  305. package/dist/dist/TapToEdit.js +0 -27
  306. package/dist/dist/TapToEdit.js.map +0 -1
  307. package/dist/dist/Text.d.ts +0 -36
  308. package/dist/dist/Text.js +0 -86
  309. package/dist/dist/Text.js.map +0 -1
  310. package/dist/dist/Text.stories.d.ts +0 -1
  311. package/dist/dist/Text.stories.js +0 -13
  312. package/dist/dist/Text.stories.js.map +0 -1
  313. package/dist/dist/TextArea.d.ts +0 -6
  314. package/dist/dist/TextArea.js +0 -13
  315. package/dist/dist/TextArea.js.map +0 -1
  316. package/dist/dist/TextArea.stories.d.ts +0 -12
  317. package/dist/dist/TextArea.stories.js +0 -21
  318. package/dist/dist/TextArea.stories.js.map +0 -1
  319. package/dist/dist/TextField.d.ts +0 -47
  320. package/dist/dist/TextField.js +0 -199
  321. package/dist/dist/TextField.js.map +0 -1
  322. package/dist/dist/TextField.stories.d.ts +0 -6
  323. package/dist/dist/TextField.stories.js +0 -15
  324. package/dist/dist/TextField.stories.js.map +0 -1
  325. package/dist/dist/TextFieldNumberActionSheet.d.ts +0 -5
  326. package/dist/dist/TextFieldNumberActionSheet.js +0 -24
  327. package/dist/dist/TextFieldNumberActionSheet.js.map +0 -1
  328. package/dist/dist/UnifiedScreens.d.ts +0 -2
  329. package/dist/dist/UnifiedScreens.js +0 -26
  330. package/dist/dist/UnifiedScreens.js.map +0 -1
  331. package/dist/dist/Unifier.d.ts +0 -131
  332. package/dist/dist/Unifier.js +0 -198
  333. package/dist/dist/Unifier.js.map +0 -1
  334. package/dist/dist/Utilities.d.ts +0 -51
  335. package/dist/dist/Utilities.js +0 -77
  336. package/dist/dist/Utilities.js.map +0 -1
  337. package/dist/dist/WithLabel.d.ts +0 -6
  338. package/dist/dist/WithLabel.js +0 -23
  339. package/dist/dist/WithLabel.js.map +0 -1
  340. package/dist/dist/index.d.ts +0 -43
  341. package/dist/dist/index.js +0 -49
  342. package/dist/dist/index.js.map +0 -1
package/src/Field.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import isDate from "lodash/isDate";
2
2
  import isNumber from "lodash/isNumber";
3
3
  import moment from "moment-timezone";
4
- import React from "react";
4
+ import React, {useState} from "react";
5
5
 
6
6
  import {Box} from "./Box";
7
7
  import {FieldProps, TextFieldType} from "./Common";
@@ -15,60 +15,58 @@ interface State {
15
15
  value: any;
16
16
  }
17
17
 
18
- export class Field extends React.Component<FieldProps, State> {
19
- constructor(props: FieldProps) {
20
- super(props);
21
- this.state = {value: props.initialValue || ""};
22
- }
18
+ /**
19
+ * Field is a fully uncontrolled component for creating various inputs. Fully uncontrolled means Field manages its own
20
+ * state for the TextFields/Switches/etc, not the parent component. When values are updated, Field will pass the data to
21
+ * the parent through the handleChange prop. You can set an initialValue, but you should not update initialValue
22
+ * this prop with the result of handleChange.
23
+ *
24
+ * Note: You MUST set a key={} prop for this component, otherwise you may wind up with stale data. Just changing
25
+ * initialValue will not work.
26
+ *
27
+ */
28
+ export function Field(props: FieldProps) {
29
+ const [value, setValue] = useState(props.initialValue || "");
23
30
 
24
- UNSAFE_componentWillReceiveProps(nextProps: FieldProps) {
25
- if (nextProps.initialValue !== this.state.value) {
26
- this.setState({value: nextProps.initialValue});
31
+ const handleChange = (newValue: string) => {
32
+ if (props.type === "currency") {
33
+ newValue = newValue.replace("$", "");
34
+ } else if (props.type === "percent") {
35
+ newValue = newValue.replace("%", "");
27
36
  }
28
- }
29
-
30
- handleChange = (value: string) => {
31
- if (this.props.type === "currency") {
32
- value = value.replace("$", "");
33
- } else if (this.props.type === "percent") {
34
- value = value.replace("%", "");
35
- }
36
- this.setState({value});
37
- if (this.props.handleChange) {
38
- this.props.handleChange(this.props.name, value);
37
+ setValue(newValue);
38
+ if (props.handleChange) {
39
+ props.handleChange(props.name, newValue);
39
40
  }
40
41
  };
41
42
 
42
- handleSwitchChange = (value: boolean) => {
43
- this.setState({value});
44
- if (this.props.handleChange) {
45
- this.props.handleChange(this.props.name, value);
43
+ const handleSwitchChange = (switchValue: boolean) => {
44
+ setValue(switchValue);
45
+ if (props.handleChange) {
46
+ props.handleChange(props.name, switchValue);
46
47
  }
47
48
  };
48
49
 
49
- validate = () => {
50
- // console.log("VALIDATE", this.props.validate && this.props.validate(this.state.value));
51
- if (this.props.validate && !this.props.validate(this.state.value)) {
50
+ const validate = () => {
51
+ // console.log("VALIDATE", props.validate && props.validate(value));
52
+ if (props.validate && !props.validate(value)) {
52
53
  return false;
53
54
  }
54
- switch (this.props.type) {
55
+ switch (props.type) {
55
56
  case "boolean":
56
57
  return true;
57
58
  case "currency":
58
59
  return true;
59
60
  case "date":
60
- return !this.state.value || isDate(this.state.value);
61
+ return !value || isDate(value);
61
62
  case "email":
62
- return (
63
- !this.state.value ||
64
- (this.state.value.search("@") > -1 && this.state.value.search(".") > -1)
65
- );
63
+ return !value || (value.search("@") > -1 && value.search(".") > -1);
66
64
  case "number":
67
- return !this.state.value || isNumber(this.state.value);
65
+ return !value || isNumber(value);
68
66
  case "password":
69
67
  return true;
70
68
  case "percent":
71
- return !this.state.value || isNumber(this.state.value.replace("%", ""));
69
+ return !value || isNumber(value.replace("%", ""));
72
70
  case "select":
73
71
  return true;
74
72
  case "text":
@@ -83,64 +81,62 @@ export class Field extends React.Component<FieldProps, State> {
83
81
  }
84
82
  };
85
83
 
86
- renderField() {
87
- if (this.props.type === "select") {
88
- if (!this.props.options) {
84
+ const renderField = () => {
85
+ if (props.type === "select") {
86
+ if (!props.options) {
89
87
  console.error("Field with type=select require options");
90
88
  return null;
91
89
  }
92
90
  return (
93
91
  <SelectList
94
- disabled={this.props.disabled}
95
- id={this.props.name}
96
- options={this.props.options}
97
- value={this.state.value}
98
- onChange={this.handleChange}
92
+ disabled={props.disabled}
93
+ id={props.name}
94
+ options={props.options}
95
+ value={value}
96
+ onChange={handleChange}
99
97
  />
100
98
  );
101
- } else if (this.props.type === "textarea") {
99
+ } else if (props.type === "textarea") {
102
100
  return (
103
101
  <TextArea
104
- disabled={this.props.disabled}
105
- id={this.props.name}
106
- placeholder={this.props.placeholder}
107
- rows={this.props.rows}
108
- value={String(this.state.value)}
109
- onChange={({value}) => this.handleChange(value)}
102
+ disabled={props.disabled}
103
+ id={props.name}
104
+ placeholder={props.placeholder}
105
+ rows={props.rows}
106
+ value={String(value)}
107
+ onChange={(result) => handleChange(result.value)}
110
108
  />
111
109
  );
112
- } else if (this.props.type === "boolean") {
110
+ } else if (props.type === "boolean") {
113
111
  return (
114
112
  <Switch
115
- disabled={this.props.disabled}
116
- id={this.props.name}
117
- name={this.props.name}
118
- switched={Boolean(this.state.value)}
119
- onChange={(result) => this.handleSwitchChange(result)}
113
+ disabled={props.disabled}
114
+ id={props.name}
115
+ name={props.name}
116
+ switched={Boolean(value)}
117
+ onChange={(result) => handleSwitchChange(result)}
120
118
  />
121
119
  );
122
- } else if (this.props.type === "date") {
123
- const value = this.state.value.seconds
124
- ? moment(this.state.value.seconds * 1000)
125
- : moment(this.state.value);
120
+ } else if (props.type === "date") {
121
+ const date = value.seconds ? moment(value.seconds * 1000) : moment(value);
126
122
  return (
127
123
  <TextField
128
124
  disabled
129
- id={this.props.name}
130
- placeholder={this.props.placeholder}
125
+ id={props.name}
126
+ placeholder={props.placeholder}
131
127
  type="text"
132
128
  // TODO: allow editing with a date picker
133
- value={value.format("MM/DD/YYYY HH:mmA")}
134
- onChange={(result) => this.handleChange(result.value)}
129
+ value={date.format("MM/DD/YYYY HH:mmA")}
130
+ onChange={(result) => handleChange(result.value)}
135
131
  />
136
132
  );
137
133
  } else {
138
134
  let type: TextFieldType = "text";
139
135
  // Number is supported differently because we need fractional numbers and they don't work
140
136
  // well on iOS.
141
- if (this.props.type && ["date", "email", "password", "url"].indexOf(this.props.type) > -1) {
142
- type = this.props.type as TextFieldType;
143
- } else if (this.props.type === "percent" || this.props.type === "currency") {
137
+ if (props.type && ["date", "email", "password", "url"].indexOf(props.type) > -1) {
138
+ type = props.type as TextFieldType;
139
+ } else if (props.type === "percent" || props.type === "currency") {
144
140
  type = "text";
145
141
  }
146
142
  let autoComplete: "on" | "current-password" | "username" = "on";
@@ -149,46 +145,43 @@ export class Field extends React.Component<FieldProps, State> {
149
145
  } else if (type === "email") {
150
146
  autoComplete = "username";
151
147
  }
152
- const value = String(this.state.value);
153
- // if (this.props.type === "percent") {
154
- // value = `${Number(this.state.value).toFixed(0)}%`;
155
- // } else if (this.props.type === "currency") {
148
+ const stringValue = String(value);
149
+ // if (props.type === "percent") {
150
+ // value = `${Number(value).toFixed(0)}%`;
151
+ // } else if (props.type === "currency") {
156
152
  // value = `$${Number(value).toFixed(2)}`;
157
153
  // }
158
154
  // console.log("VAL", value);
159
155
  return (
160
156
  <TextField
161
157
  autoComplete={autoComplete}
162
- disabled={this.props.disabled}
163
- id={this.props.name}
164
- placeholder={this.props.placeholder}
158
+ disabled={props.disabled}
159
+ id={props.name}
160
+ placeholder={props.placeholder}
165
161
  type={type as "date" | "email" | "number" | "password" | "text" | "url"}
166
- value={value}
167
- onChange={(result) => this.handleChange(result.value)}
162
+ value={stringValue}
163
+ onChange={(result) => handleChange(result.value)}
168
164
  />
169
165
  );
170
166
  }
171
- }
167
+ };
172
168
 
173
- render() {
174
- const children = this.renderField();
175
- const {errorMessage, errorMessageColor, helperText, helperTextColor, label, labelColor} =
176
- this.props;
177
- return (
178
- <Box marginBottom={5}>
179
- <FieldWithLabels
180
- {...{
181
- errorMessage,
182
- errorMessageColor,
183
- helperText,
184
- helperTextColor,
185
- label,
186
- labelColor,
187
- }}
188
- >
189
- {children}
190
- </FieldWithLabels>
191
- </Box>
192
- );
193
- }
169
+ const children = renderField();
170
+ const {errorMessage, errorMessageColor, helperText, helperTextColor, label, labelColor} = props;
171
+ return (
172
+ <Box marginBottom={5}>
173
+ <FieldWithLabels
174
+ {...{
175
+ errorMessage,
176
+ errorMessageColor,
177
+ helperText,
178
+ helperTextColor,
179
+ label,
180
+ labelColor,
181
+ }}
182
+ >
183
+ {children}
184
+ </FieldWithLabels>
185
+ </Box>
186
+ );
194
187
  }
package/src/Icon.tsx CHANGED
@@ -2,55 +2,7 @@ import {FontAwesome} from "@expo/vector-icons";
2
2
  import React from "react";
3
3
 
4
4
  import {iconNumberToSize, IconProps, iconSizeToNumber} from "./Common";
5
- // import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
6
- // // import {library} from "@fortawesome/fontawesome-svg-core";
7
- // import {library} from "@fortawesome/fontawesome-svg-core";
8
- // // import {fal as proFal} from "@fortawesome/pro-light-svg-icons";
9
- // import {
10
- // faHeart as farHeart,
11
- // // faPlus as farPlus,
12
- // faEdit as farEdit,
13
- // faNewspaper as farNewspaper,
14
- // } from "@fortawesome/free-regular-svg-icons";
15
- // import {
16
- // faChevronLeft,
17
- // faEnvelopeOpen,
18
- // faCarrot,
19
- // faComment,
20
- // faUserCircle,
21
- // faSearch,
22
- // faChevronRight,
23
- // faEllipsisV,
24
- // faPaperPlane,
25
- // faExclamationCircle,
26
- // faMailBulk,
27
- // faTrashAlt,
28
- // faTrashRestoreAlt,
29
- // faEnvelope,
30
- // faSpinner,
31
- // } from "@fortawesome/free-solid-svg-icons";
32
5
  import {Unifier} from "./Unifier";
33
- // library.add(
34
- // farHeart,
35
- // // farPlus,
36
- // farEdit,
37
- // farNewspaper,
38
- // faChevronLeft,
39
- // faCarrot,
40
- // faComment,
41
- // faUserCircle,
42
- // faEnvelopeOpen,
43
- // faSearch,
44
- // faChevronRight,
45
- // faEllipsisV,
46
- // faPaperPlane,
47
- // faExclamationCircle,
48
- // faMailBulk,
49
- // faTrashAlt,
50
- // faTrashRestoreAlt,
51
- // faEnvelope,
52
- // faSpinner
53
- // );
54
6
 
55
7
  export function initIcons() {
56
8
  console.debug("Initializing icons");
@@ -58,82 +10,11 @@ export function initIcons() {
58
10
 
59
11
  const iconSet = new Set();
60
12
 
61
- function addIcon(icon: string, prefix = "far") {
62
- const prev = new Set(iconSet);
63
- iconSet.add(`${prefix}-${icon}`);
64
- if (
65
- prev.size !== iconSet.size &&
66
- (!process.env.NODE_ENV || process.env.NODE_ENV === "development")
67
- ) {
68
- console.debug("[Icon] current icon set:", iconSet);
69
- }
70
- }
71
-
13
+ // TODO: Update <Icon /> to be closer to Expo's Vector Icon, letting multiple icon packs be used, etc.
72
14
  export class Icon extends React.Component<IconProps, {}> {
73
- render() {
74
- addIcon(this.props.name, this.props.prefix);
75
- const color = Unifier.theme[this.props.color || "primary"];
76
- let size: string = iconNumberToSize(this.props.size);
77
- if (size === "xl") {
78
- size = "2x";
79
- } else if (size === "md") {
80
- size = "1x";
81
- }
82
- return <FontAwesome color={color} icon={this.props.name as any} size={size as any} />;
83
- }
84
- }
85
-
86
- export class IconExpo extends React.Component<IconProps, {}> {
87
15
  render() {
88
16
  const color = Unifier.theme[this.props.color || "primary"];
89
- // Standardize the size (pretty hacky..)
90
- const size = iconSizeToNumber(iconNumberToSize(this.props.size));
91
- return (
92
- <FontAwesome
93
- color={color}
94
- icon={[this.props.prefix || "far", this.props.name as any]}
95
- size={size}
96
- />
97
- );
98
- // const {name, prefix} = this.props;
99
- // const color = Unifier.theme[this.props.color || "primary"];
100
- // const size = this.props.size;
101
-
102
- // const map = {
103
- // fapro: FAPro,
104
- // fas: FAIcon,
105
- // fa: FAIcon,
106
- // fal: FAIcon,
107
- // "fa-brand": FAIcon,
108
- // ant: AntDesignIcon,
109
- // entypo: EntypoIcon,
110
- // evil: EvilIcons,
111
- // material: MaterialIcons,
112
- // "material-community": MaterialCommunityIcons,
113
- // ionicon: Ionicons,
114
- // octicon: Octicons,
115
- // zocial: Zocial,
116
- // "simple-line": SimpleLineIcons,
117
- // feather: Feather,
118
- // };
119
- // const Component: any = map[prefix];
120
- // if (!Component) {
121
- // console.warn(`[icons] could not find icon: ${prefix}:${name}`);
122
- // return null;
123
- // }
124
-
125
- // if (["fapro", "fal", "fa", "fas", "fa-brand"].indexOf(this.props.prefix) > -1) {
126
- // return (
127
- // <Component
128
- // solid={this.props.prefix === "fas"}
129
- // light={this.props.prefix === "fal"}
130
- // brand={this.props.prefix === "fa-brand"}
131
- // name={name}
132
- // color={color}
133
- // size={size}
134
- // />
135
- // );
136
- // }
137
- // return <Component name={name} color={color} size={size} />;
17
+ const size = iconSizeToNumber(this.props.size);
18
+ return <FontAwesome color={color} name={this.props.name as any} size={size} />;
138
19
  }
139
20
  }
@@ -44,7 +44,7 @@ export class IconButton extends React.Component<IconButtonProps, {}> {
44
44
  color={this.props.iconColor}
45
45
  name={this.props.icon}
46
46
  prefix={this.props.prefix || "fas"}
47
- size={iconSizeToNumber(this.props.size)}
47
+ size={this.props.size}
48
48
  />
49
49
  </TouchableOpacity>
50
50
  );
package/src/Pog.tsx CHANGED
@@ -5,7 +5,7 @@ import {Box} from "./Box";
5
5
  import {AllColors, IconPrefix, IconSize} from "./Common";
6
6
  import {Icon} from "./Icon";
7
7
 
8
- /*
8
+ /*
9
9
  Originally based on https://github.com/pinterest/gestalt
10
10
  Forked, added type definitions, and added features.
11
11
  */
@@ -203,7 +203,7 @@ export default function Pog(props: Props) {
203
203
  // dangerouslySetSvgPath={dangerouslySetSvgPath}
204
204
  name={icon}
205
205
  prefix={iconPrefix}
206
- size={iconSize}
206
+ size={size}
207
207
  />
208
208
  </Box>
209
209
  </div>
package/src/TapToEdit.tsx CHANGED
@@ -19,7 +19,7 @@ export class TapToEdit extends React.Component<TextFieldProps, TapToEditState> {
19
19
  return (
20
20
  <Box direction="row" display="flex" onClick={() => this.setState({showEdit: true})}>
21
21
  <Box marginRight={2}>
22
- <Icon color="primaryDark" name="edit" prefix="far" size={20} />
22
+ <Icon color="primaryDark" name="edit" prefix="far" size="lg" />
23
23
  </Box>
24
24
  <Text>{this.props.children}</Text>
25
25
  </Box>
package/src/TextField.tsx CHANGED
@@ -79,7 +79,7 @@ export class TextField extends React.Component<TextFieldProps, TextFieldState> {
79
79
  } else {
80
80
  return (
81
81
  <Box marginRight={2}>
82
- <Icon name="search" prefix="far" size={14} />
82
+ <Icon name="search" prefix="far" size="md" />
83
83
  </Box>
84
84
  );
85
85
  }
@@ -1,6 +1,6 @@
1
1
  import DateTimePicker from "@react-native-community/datetimepicker";
2
2
  import moment from "moment-timezone";
3
- import React, {SyntheticEvent} from "react";
3
+ import React from "react";
4
4
 
5
5
  import {ActionSheet} from "./ActionSheet";
6
6
  import {Box} from "./Box";
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import { Box } from "./Box";
2
- import { Banner } from "./Banner";
3
- import React from "react";
4
- import { storiesOf } from "@storybook/react-native";
5
- storiesOf("Banner", module)
6
- .add("Plain banner", () => (React.createElement(Box, { width: "100%", height: "100%", display: "flex", direction: "column" },
7
- React.createElement(Banner, { id: "banner", text: "When you click this banner, it dismisses", subtext: "And in a real app, it would stay dismissed", color: "primary", textColor: "white" }))))
8
- .add("Shape banner", () => (React.createElement(Box, { width: "100%", height: "100%", display: "flex", direction: "column" },
9
- React.createElement(Box, { paddingY: 2, width: "100%" },
10
- React.createElement(Banner, { id: "banner", text: "Banners can have multiple shapes like Boxes", subtext: "Here's a pill.", color: "primary", textColor: "white", shape: "pill" })),
11
- React.createElement(Box, { paddingY: 2, width: "100%" },
12
- React.createElement(Banner, { id: "banner", text: "And a rounded banner", color: "secondary", textColor: "white", shape: 3 })))));
13
- //# sourceMappingURL=Banner.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Banner.stories.js","sourceRoot":"","sources":["../unifier/Banner.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAElD,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;KACxB,GAAG,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CACzB,oBAAC,GAAG,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ;IAC/D,oBAAC,MAAM,IACL,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,0CAA0C,EAC/C,OAAO,EAAC,4CAA4C,EACpD,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,OAAO,GACjB,CACE,CACP,CAAC;KACD,GAAG,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CACzB,oBAAC,GAAG,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ;IAC/D,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM;QAC5B,oBAAC,MAAM,IACL,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,6CAA6C,EAClD,OAAO,EAAC,gBAAgB,EACxB,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,OAAO,EACjB,KAAK,EAAC,MAAM,GACZ,CACE;IACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM;QAC5B,oBAAC,MAAM,IACL,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,sBAAsB,EAC3B,KAAK,EAAC,WAAW,EACjB,SAAS,EAAC,OAAO,EACjB,KAAK,EAAE,CAAC,GACR,CACE,CACF,CACP,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,45 +0,0 @@
1
- import React from "react";
2
- import { Box } from "./Box";
3
- import { storiesOf } from "@storybook/react-native";
4
- import { Text } from "./Text";
5
- import { StorybookContainer } from "./StorybookContainer";
6
- const colors = [
7
- "primary",
8
- "secondary",
9
- "tertiary",
10
- "accent",
11
- "blue",
12
- "darkGray",
13
- "eggplant",
14
- "gray",
15
- "green",
16
- "lightGray",
17
- "maroon",
18
- "midnight",
19
- "navy",
20
- "olive",
21
- "orange",
22
- "orchid",
23
- "pine",
24
- "purple",
25
- "red",
26
- "watermelon",
27
- "white",
28
- "neutral900",
29
- "neutral200",
30
- "neutral70",
31
- "neutral10",
32
- ];
33
- storiesOf("Box", module)
34
- .add("FlexBox", () => (React.createElement(StorybookContainer, null,
35
- React.createElement(Box, { display: "flex", justifyContent: "center", alignItems: "center", width: 50, height: 50, rounding: "circle", color: "blue", marginRight: 2 },
36
- React.createElement(Text, { size: "lg" }, "JG")),
37
- React.createElement(Box, { paddingX: 2, direction: "column" },
38
- React.createElement(Text, { weight: "bold" }, "Josh Gachnang"),
39
- React.createElement(Text, null, "joined 2 years ago")))))
40
- .add("Box Colors", () => (React.createElement(StorybookContainer, null, colors.map((c) => (React.createElement(Box, { key: c, display: "flex", direction: "column" },
41
- React.createElement(Box, { marginBottom: 2 },
42
- React.createElement(Text, { align: "center" }, c)),
43
- React.createElement(Box, { key: c, color: c, rounding: "circle", height: 50, width: 50 },
44
- React.createElement(Text, null, " "))))))));
45
- //# sourceMappingURL=Box.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Box.stories.js","sourceRoot":"","sources":["../unifier/Box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,GAAgB;IAC1B,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;IACN,OAAO;IACP,WAAW;IACX,QAAQ;IACR,UAAU;IACV,MAAM;IACN,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;CACZ,CAAC;AAEF,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;KACrB,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CACpB,oBAAC,kBAAkB;IACjB,oBAAC,GAAG,IACF,OAAO,EAAC,MAAM,EACd,cAAc,EAAC,QAAQ,EACvB,UAAU,EAAC,QAAQ,EACnB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,QAAQ,EAAC,QAAQ,EACjB,KAAK,EAAC,MAAM,EACZ,WAAW,EAAE,CAAC;QAEd,oBAAC,IAAI,IAAC,IAAI,EAAC,IAAI,SAAU,CACrB;IACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAC,QAAQ;QAClC,oBAAC,IAAI,IAAC,MAAM,EAAC,MAAM,oBAAqB;QACxC,oBAAC,IAAI,6BAA0B,CAC3B,CACa,CACtB,CAAC;KACD,GAAG,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,CACvB,oBAAC,kBAAkB,QAChB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACjB,oBAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ;IAC5C,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC;QAClB,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,IAAE,CAAC,CAAQ,CAC3B;IACN,oBAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAC,QAAQ,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE;QAC5D,oBAAC,IAAI,YAAS,CACV,CACF,CACP,CAAC,CACiB,CACtB,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const Primary: any;
@@ -1,41 +0,0 @@
1
- import { action } from "@storybook/addon-actions";
2
- import React from "react";
3
- import { Button } from "./Button";
4
- import { storiesOf } from "@storybook/react-native";
5
- import { Box } from "./Box";
6
- import { StorybookContainer } from "./StorybookContainer";
7
- function allColorButtons(props) {
8
- return (React.createElement(StorybookContainer, null,
9
- React.createElement(Box, { paddingY: 1 },
10
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Default" }, props))),
11
- React.createElement(Box, { paddingY: 1 },
12
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Primary", color: "primary" }, props))),
13
- React.createElement(Box, { paddingY: 1 },
14
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Secondary", color: "secondary" }, props))),
15
- React.createElement(Box, { paddingY: 1 },
16
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Tertiary", color: "tertiary" }, props))),
17
- React.createElement(Box, { paddingY: 1 },
18
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Accent", color: "accent" }, props))),
19
- React.createElement(Box, { paddingY: 1 },
20
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Red", color: "red" }, props))),
21
- React.createElement(Box, { paddingY: 1 },
22
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Dark Gray", color: "darkGray" }, props))),
23
- React.createElement(Box, { paddingY: 1 },
24
- React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Gray", color: "gray" }, props)))));
25
- }
26
- storiesOf("Button", module)
27
- .add("Colors", () => allColorButtons({}))
28
- .add("Loading", () => allColorButtons({ loading: true }))
29
- .add("Ghost", () => allColorButtons({ type: "ghost" }))
30
- .add("Outline", () => allColorButtons({ type: "outline" }));
31
- const Template = (args) => React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Button" }, args));
32
- export const Primary = Template.bind({});
33
- Primary.args = {
34
- size: "md",
35
- color: "primary",
36
- text: "PRIMARY",
37
- type: "solid",
38
- inline: false,
39
- disabled: false,
40
- };
41
- //# sourceMappingURL=Button.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.stories.js","sourceRoot":"","sources":["../unifier/Button.stories.tsx"],"names":[],"mappings":"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"}
@@ -1,6 +0,0 @@
1
- import { Card } from "./Card";
2
- declare const _default: {
3
- title: string;
4
- component: typeof Card;
5
- };
6
- export default _default;
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import { Box } from "./Box";
3
- import { Card } from "./Card";
4
- import { storiesOf } from "@storybook/react-native";
5
- export default {
6
- title: "Card",
7
- component: Card,
8
- };
9
- storiesOf("Card", module).add("Plain", () => (React.createElement(Box, { width: "100%", height: "100%", display: "flex", direction: "column", color: "lightGray", padding: 12 },
10
- React.createElement(Card, null,
11
- React.createElement(Box, { display: "flex", direction: "row", alignItems: "center" },
12
- React.createElement(Box, { display: "flex", justifyContent: "center", alignItems: "center", width: 50, height: 50, rounding: "circle", color: "blue", marginRight: 2 },
13
- React.createElement("h2", null, "JG")),
14
- React.createElement(Box, { paddingX: 2, direction: "column" },
15
- React.createElement("div", null,
16
- React.createElement("b", null, "Josh Gachnang")),
17
- React.createElement("div", null, "joined 2 years ago")))))));
18
- //# sourceMappingURL=Card.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Card.stories.js","sourceRoot":"","sources":["../unifier/Card.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAElD,eAAe;IACb,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAC3C,oBAAC,GAAG,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ,EAAC,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,EAAE;IAC7F,oBAAC,IAAI;QACH,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ;YACrD,oBAAC,GAAG,IACF,OAAO,EAAC,MAAM,EACd,cAAc,EAAC,QAAQ,EACvB,UAAU,EAAC,QAAQ,EACnB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,QAAQ,EAAC,QAAQ,EACjB,KAAK,EAAC,MAAM,EACZ,WAAW,EAAE,CAAC;gBAEd,qCAAW,CACP;YACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAC,QAAQ;gBAClC;oBACE,+CAAoB,CAChB;gBACN,sDAA6B,CACzB,CACF,CACD,CACH,CACP,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};