ferns-ui 0.2.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/LICENSE +203 -0
- package/README.md +22 -0
- package/dist/ActionSheet.d.ts +490 -0
- package/dist/ActionSheet.js +647 -0
- package/dist/ActionSheet.js.map +1 -0
- package/dist/Banner.d.ts +27 -0
- package/dist/Banner.js +56 -0
- package/dist/Banner.js.map +1 -0
- package/dist/Banner.stories.d.ts +1 -0
- package/dist/Banner.stories.js +13 -0
- package/dist/Banner.stories.js.map +1 -0
- package/dist/BlurBox.d.ts +5 -0
- package/dist/BlurBox.js +28 -0
- package/dist/BlurBox.js.map +1 -0
- package/dist/BlurBox.native.d.ts +6 -0
- package/dist/BlurBox.native.js +30 -0
- package/dist/BlurBox.native.js.map +1 -0
- package/dist/Body.d.ts +6 -0
- package/dist/Body.js +21 -0
- package/dist/Body.js.map +1 -0
- package/dist/Box.d.ts +18 -0
- package/dist/Box.js +228 -0
- package/dist/Box.js.map +1 -0
- package/dist/Box.stories.d.ts +1 -0
- package/dist/Box.stories.js +45 -0
- package/dist/Box.stories.js.map +1 -0
- package/dist/Button.d.ts +20 -0
- package/dist/Button.js +103 -0
- package/dist/Button.js.map +1 -0
- package/dist/Button.stories.d.ts +1 -0
- package/dist/Button.stories.js +41 -0
- package/dist/Button.stories.js.map +1 -0
- package/dist/Card.d.ts +5 -0
- package/dist/Card.js +8 -0
- package/dist/Card.js.map +1 -0
- package/dist/Card.stories.d.ts +6 -0
- package/dist/Card.stories.js +18 -0
- package/dist/Card.stories.js.map +1 -0
- package/dist/CheckBox.d.ts +6 -0
- package/dist/CheckBox.js +27 -0
- package/dist/CheckBox.js.map +1 -0
- package/dist/CheckBox.stories.d.ts +1 -0
- package/dist/CheckBox.stories.js +28 -0
- package/dist/CheckBox.stories.js.map +1 -0
- package/dist/Common.d.ts +868 -0
- package/dist/Common.js +46 -0
- package/dist/Common.js.map +1 -0
- package/dist/DateTimeActionSheet.d.ts +15 -0
- package/dist/DateTimeActionSheet.js +28 -0
- package/dist/DateTimeActionSheet.js.map +1 -0
- package/dist/DecimalRangeActionSheet.d.ts +18 -0
- package/dist/DecimalRangeActionSheet.js +65 -0
- package/dist/DecimalRangeActionSheet.js.map +1 -0
- package/dist/ErrorBoundary.d.ts +19 -0
- package/dist/ErrorBoundary.js +31 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/ErrorPage.d.ts +10 -0
- package/dist/ErrorPage.js +20 -0
- package/dist/ErrorPage.js.map +1 -0
- package/dist/Field.d.ts +15 -0
- package/dist/Field.js +136 -0
- package/dist/Field.js.map +1 -0
- package/dist/Field.stories.d.ts +6 -0
- package/dist/Field.stories.js +38 -0
- package/dist/Field.stories.js.map +1 -0
- package/dist/FieldWithLabels.d.ts +3 -0
- package/dist/FieldWithLabels.js +8 -0
- package/dist/FieldWithLabels.js.map +1 -0
- package/dist/FlatList.d.ts +2 -0
- package/dist/FlatList.js +3 -0
- package/dist/FlatList.js.map +1 -0
- package/dist/Form.d.ts +22 -0
- package/dist/Form.js +89 -0
- package/dist/Form.js.map +1 -0
- package/dist/Form.stories.d.ts +6 -0
- package/dist/Form.stories.js +36 -0
- package/dist/Form.stories.js.map +1 -0
- package/dist/HeaderButtons.d.ts +31 -0
- package/dist/HeaderButtons.js +53 -0
- package/dist/HeaderButtons.js.map +1 -0
- package/dist/HeaderButtons.stories.d.ts +6 -0
- package/dist/HeaderButtons.stories.js +6 -0
- package/dist/HeaderButtons.stories.js.map +1 -0
- package/dist/Heading.d.ts +11 -0
- package/dist/Heading.js +46 -0
- package/dist/Heading.js.map +1 -0
- package/dist/Heading.stories.d.ts +1 -0
- package/dist/Heading.stories.js +22 -0
- package/dist/Heading.stories.js.map +1 -0
- package/dist/HeightActionSheet.d.ts +16 -0
- package/dist/HeightActionSheet.js +58 -0
- package/dist/HeightActionSheet.js.map +1 -0
- package/dist/Icon.d.ts +9 -0
- package/dist/Icon.js +125 -0
- package/dist/Icon.js.map +1 -0
- package/dist/Icon.stories.d.ts +1 -0
- package/dist/Icon.stories.js +30 -0
- package/dist/Icon.stories.js.map +1 -0
- package/dist/IconButton.d.ts +5 -0
- package/dist/IconButton.js +41 -0
- package/dist/IconButton.js.map +1 -0
- package/dist/IconButton.stories.d.ts +1 -0
- package/dist/IconButton.stories.js +16 -0
- package/dist/IconButton.stories.js.map +1 -0
- package/dist/Image.d.ts +8 -0
- package/dist/Image.js +37 -0
- package/dist/Image.js.map +1 -0
- package/dist/ImageBackground.d.ts +9 -0
- package/dist/ImageBackground.js +8 -0
- package/dist/ImageBackground.js.map +1 -0
- package/dist/Layer.d.ts +9 -0
- package/dist/Layer.js +12 -0
- package/dist/Layer.js.map +1 -0
- package/dist/Link.d.ts +9 -0
- package/dist/Link.js +12 -0
- package/dist/Link.js.map +1 -0
- package/dist/Link.stories.d.ts +1 -0
- package/dist/Link.stories.js +18 -0
- package/dist/Link.stories.js.map +1 -0
- package/dist/Mask.d.ts +5 -0
- package/dist/Mask.js +22 -0
- package/dist/Mask.js.map +1 -0
- package/dist/Mask.stories.d.ts +1 -0
- package/dist/Mask.stories.js +28 -0
- package/dist/Mask.stories.js.map +1 -0
- package/dist/MediaQuery.d.ts +2 -0
- package/dist/MediaQuery.js +33 -0
- package/dist/MediaQuery.js.map +1 -0
- package/dist/Meta.d.ts +5 -0
- package/dist/Meta.js +7 -0
- package/dist/Meta.js.map +1 -0
- package/dist/ModalSheet.d.ts +7 -0
- package/dist/ModalSheet.js +42 -0
- package/dist/ModalSheet.js.map +1 -0
- package/dist/NumberPickerActionSheet.d.ts +16 -0
- package/dist/NumberPickerActionSheet.js +29 -0
- package/dist/NumberPickerActionSheet.js.map +1 -0
- package/dist/Page.d.ts +26 -0
- package/dist/Page.js +38 -0
- package/dist/Page.js.map +1 -0
- package/dist/Permissions.d.ts +2 -0
- package/dist/Permissions.js +35 -0
- package/dist/Permissions.js.map +1 -0
- package/dist/PickerSelect.d.ts +174 -0
- package/dist/PickerSelect.js +426 -0
- package/dist/PickerSelect.js.map +1 -0
- package/dist/Pill.d.ts +5 -0
- package/dist/Pill.js +10 -0
- package/dist/Pill.js.map +1 -0
- package/dist/Pill.stories.d.ts +1 -0
- package/dist/Pill.stories.js +38 -0
- package/dist/Pill.stories.js.map +1 -0
- package/dist/Pog.d.ts +15 -0
- package/dist/Pog.js +144 -0
- package/dist/Pog.js.map +1 -0
- package/dist/ProgressBar.d.ts +9 -0
- package/dist/ProgressBar.js +41 -0
- package/dist/ProgressBar.js.map +1 -0
- package/dist/ScrollView.d.ts +2 -0
- package/dist/ScrollView.js +3 -0
- package/dist/ScrollView.js.map +1 -0
- package/dist/SegmentedControl.d.ts +6 -0
- package/dist/SegmentedControl.js +18 -0
- package/dist/SegmentedControl.js.map +1 -0
- package/dist/SegmentedControl.stories.d.ts +1 -0
- package/dist/SegmentedControl.stories.js +31 -0
- package/dist/SegmentedControl.stories.js.map +1 -0
- package/dist/SelectList.d.ts +22 -0
- package/dist/SelectList.js +28 -0
- package/dist/SelectList.js.map +1 -0
- package/dist/SelectList.stories.d.ts +1 -0
- package/dist/SelectList.stories.js +26 -0
- package/dist/SelectList.stories.js.map +1 -0
- package/dist/Spinner.d.ts +21 -0
- package/dist/Spinner.js +58 -0
- package/dist/Spinner.js.map +1 -0
- package/dist/Spinner.stories.d.ts +1 -0
- package/dist/Spinner.stories.js +12 -0
- package/dist/Spinner.stories.js.map +1 -0
- package/dist/SplitPage.d.ts +31 -0
- package/dist/SplitPage.js +51 -0
- package/dist/SplitPage.js.map +1 -0
- package/dist/SplitPage.stories.d.ts +1 -0
- package/dist/SplitPage.stories.js +15 -0
- package/dist/SplitPage.stories.js.map +1 -0
- package/dist/StorybookContainer.d.ts +4 -0
- package/dist/StorybookContainer.js +8 -0
- package/dist/StorybookContainer.js.map +1 -0
- package/dist/Switch.d.ts +5 -0
- package/dist/Switch.js +10 -0
- package/dist/Switch.js.map +1 -0
- package/dist/Switch.stories.d.ts +1 -0
- package/dist/Switch.stories.js +34 -0
- package/dist/Switch.stories.js.map +1 -0
- package/dist/TapToEdit.d.ts +12 -0
- package/dist/TapToEdit.js +32 -0
- package/dist/TapToEdit.js.map +1 -0
- package/dist/Text.d.ts +11 -0
- package/dist/Text.js +85 -0
- package/dist/Text.js.map +1 -0
- package/dist/Text.stories.d.ts +1 -0
- package/dist/Text.stories.js +37 -0
- package/dist/Text.stories.js.map +1 -0
- package/dist/TextArea.d.ts +6 -0
- package/dist/TextArea.js +12 -0
- package/dist/TextArea.js.map +1 -0
- package/dist/TextArea.stories.d.ts +10 -0
- package/dist/TextArea.stories.js +24 -0
- package/dist/TextArea.stories.js.map +1 -0
- package/dist/TextField.d.ts +48 -0
- package/dist/TextField.js +207 -0
- package/dist/TextField.js.map +1 -0
- package/dist/TextField.stories.d.ts +6 -0
- package/dist/TextField.stories.js +18 -0
- package/dist/TextField.stories.js.map +1 -0
- package/dist/TextFieldNumberActionSheet.d.ts +15 -0
- package/dist/TextFieldNumberActionSheet.js +28 -0
- package/dist/TextFieldNumberActionSheet.js.map +1 -0
- package/dist/UnifiedScreens.d.ts +9 -0
- package/dist/UnifiedScreens.js +25 -0
- package/dist/UnifiedScreens.js.map +1 -0
- package/dist/Unifier.d.ts +40 -0
- package/dist/Unifier.js +203 -0
- package/dist/Unifier.js.map +1 -0
- package/dist/Utilities.d.ts +31 -0
- package/dist/Utilities.js +74 -0
- package/dist/Utilities.js.map +1 -0
- package/dist/WithLabel.d.ts +5 -0
- package/dist/WithLabel.js +27 -0
- package/dist/WithLabel.js.map +1 -0
- package/dist/dist/ActionSheet.d.ts +139 -0
- package/dist/dist/ActionSheet.js +637 -0
- package/dist/dist/ActionSheet.js.map +1 -0
- package/dist/dist/Banner.d.ts +12 -0
- package/dist/dist/Banner.js +49 -0
- package/dist/dist/Banner.js.map +1 -0
- package/dist/dist/Banner.stories.d.ts +1 -0
- package/dist/dist/Banner.stories.js +9 -0
- package/dist/dist/Banner.stories.js.map +1 -0
- package/dist/dist/BlurBox.d.ts +7 -0
- package/dist/dist/BlurBox.js +29 -0
- package/dist/dist/BlurBox.js.map +1 -0
- package/dist/dist/BlurBox.native.d.ts +9 -0
- package/dist/dist/BlurBox.native.js +32 -0
- package/dist/dist/BlurBox.native.js.map +1 -0
- package/dist/dist/Body.d.ts +12 -0
- package/dist/dist/Body.js +19 -0
- package/dist/dist/Body.js.map +1 -0
- package/dist/dist/Box.d.ts +205 -0
- package/dist/dist/Box.js +229 -0
- package/dist/dist/Box.js.map +1 -0
- package/dist/dist/Box.stories.d.ts +1 -0
- package/dist/dist/Box.stories.js +37 -0
- package/dist/dist/Box.stories.js.map +1 -0
- package/dist/dist/Button.d.ts +16 -0
- package/dist/dist/Button.js +98 -0
- package/dist/dist/Button.js.map +1 -0
- package/dist/dist/Button.stories.d.ts +13 -0
- package/dist/dist/Button.stories.js +26 -0
- package/dist/dist/Button.stories.js.map +1 -0
- package/dist/dist/Card.d.ts +6 -0
- package/dist/dist/Card.js +9 -0
- package/dist/dist/Card.js.map +1 -0
- package/dist/dist/Card.stories.d.ts +6 -0
- package/dist/dist/Card.stories.js +11 -0
- package/dist/dist/Card.stories.js.map +1 -0
- package/dist/dist/CheckBox.d.ts +8 -0
- package/dist/dist/CheckBox.js +23 -0
- package/dist/dist/CheckBox.js.map +1 -0
- package/dist/dist/CheckBox.stories.d.ts +1 -0
- package/dist/dist/CheckBox.stories.js +22 -0
- package/dist/dist/CheckBox.stories.js.map +1 -0
- package/dist/dist/Common.d.ts +5 -0
- package/dist/dist/Common.js +47 -0
- package/dist/dist/Common.js.map +1 -0
- package/dist/dist/DateTimeActionSheet.d.ts +5 -0
- package/dist/dist/DateTimeActionSheet.js +24 -0
- package/dist/dist/DateTimeActionSheet.js.map +1 -0
- package/dist/dist/DecimalRangeActionSheet.d.ts +9 -0
- package/dist/dist/DecimalRangeActionSheet.js +57 -0
- package/dist/dist/DecimalRangeActionSheet.js.map +1 -0
- package/dist/dist/ErrorBoundary.d.ts +12 -0
- package/dist/dist/ErrorBoundary.js +32 -0
- package/dist/dist/ErrorBoundary.js.map +1 -0
- package/dist/dist/ErrorPage.d.ts +7 -0
- package/dist/dist/ErrorPage.js +15 -0
- package/dist/dist/ErrorPage.js.map +1 -0
- package/dist/dist/Field.d.ts +17 -0
- package/dist/dist/Field.js +136 -0
- package/dist/dist/Field.js.map +1 -0
- package/dist/dist/Field.stories.d.ts +6 -0
- package/dist/dist/Field.stories.js +25 -0
- package/dist/dist/Field.stories.js.map +1 -0
- package/dist/dist/FieldWithLabels.d.ts +10 -0
- package/dist/dist/FieldWithLabels.js +7 -0
- package/dist/dist/FieldWithLabels.js.map +1 -0
- package/dist/dist/FlatList.d.ts +1 -0
- package/dist/dist/FlatList.js +4 -0
- package/dist/dist/FlatList.js.map +1 -0
- package/dist/dist/Form.d.ts +15 -0
- package/dist/dist/Form.js +56 -0
- package/dist/dist/Form.js.map +1 -0
- package/dist/dist/Form.stories.d.ts +6 -0
- package/dist/dist/Form.stories.js +27 -0
- package/dist/dist/Form.stories.js.map +1 -0
- package/dist/dist/HeaderButtons.d.ts +39 -0
- package/dist/dist/HeaderButtons.js +50 -0
- package/dist/dist/HeaderButtons.js.map +1 -0
- package/dist/dist/HeaderButtons.stories.d.ts +6 -0
- package/dist/dist/HeaderButtons.stories.js +7 -0
- package/dist/dist/HeaderButtons.stories.js.map +1 -0
- package/dist/dist/Heading.d.ts +32 -0
- package/dist/dist/Heading.js +47 -0
- package/dist/dist/Heading.js.map +1 -0
- package/dist/dist/Heading.stories.d.ts +1 -0
- package/dist/dist/Heading.stories.js +11 -0
- package/dist/dist/Heading.stories.js.map +1 -0
- package/dist/dist/HeightActionSheet.d.ts +9 -0
- package/dist/dist/HeightActionSheet.js +50 -0
- package/dist/dist/HeightActionSheet.js.map +1 -0
- package/dist/dist/Icon.d.ts +12 -0
- package/dist/dist/Icon.js +126 -0
- package/dist/dist/Icon.js.map +1 -0
- package/dist/dist/Icon.stories.d.ts +1 -0
- package/dist/dist/Icon.stories.js +11 -0
- package/dist/dist/Icon.stories.js.map +1 -0
- package/dist/dist/IconButton.d.ts +42 -0
- package/dist/dist/IconButton.js +41 -0
- package/dist/dist/IconButton.js.map +1 -0
- package/dist/dist/IconButton.stories.d.ts +1 -0
- package/dist/dist/IconButton.stories.js +8 -0
- package/dist/dist/IconButton.stories.js.map +1 -0
- package/dist/dist/Image.d.ts +9 -0
- package/dist/dist/Image.js +37 -0
- package/dist/dist/Image.js.map +1 -0
- package/dist/dist/ImageBackground.d.ts +6 -0
- package/dist/dist/ImageBackground.js +9 -0
- package/dist/dist/ImageBackground.js.map +1 -0
- package/dist/dist/Layer.d.ts +5 -0
- package/dist/dist/Layer.js +13 -0
- package/dist/dist/Layer.js.map +1 -0
- package/dist/dist/Link.d.ts +7 -0
- package/dist/dist/Link.js +13 -0
- package/dist/dist/Link.js.map +1 -0
- package/dist/dist/Link.stories.d.ts +1 -0
- package/dist/dist/Link.stories.js +8 -0
- package/dist/dist/Link.stories.js.map +1 -0
- package/dist/dist/Mask.d.ts +5 -0
- package/dist/dist/Mask.js +23 -0
- package/dist/dist/Mask.js.map +1 -0
- package/dist/dist/Mask.stories.d.ts +1 -0
- package/dist/dist/Mask.stories.js +13 -0
- package/dist/dist/Mask.stories.js.map +1 -0
- package/dist/dist/MediaQuery.d.ts +2 -0
- package/dist/dist/MediaQuery.js +34 -0
- package/dist/dist/MediaQuery.js.map +1 -0
- package/dist/dist/Meta.d.ts +6 -0
- package/dist/dist/Meta.js +8 -0
- package/dist/dist/Meta.js.map +1 -0
- package/dist/dist/ModalSheet.d.ts +3 -0
- package/dist/dist/ModalSheet.js +43 -0
- package/dist/dist/ModalSheet.js.map +1 -0
- package/dist/dist/NumberPickerActionSheet.d.ts +5 -0
- package/dist/dist/NumberPickerActionSheet.js +25 -0
- package/dist/dist/NumberPickerActionSheet.js.map +1 -0
- package/dist/dist/Page.d.ts +9 -0
- package/dist/dist/Page.js +26 -0
- package/dist/dist/Page.js.map +1 -0
- package/dist/dist/Permissions.d.ts +1 -0
- package/dist/dist/Permissions.js +36 -0
- package/dist/dist/Permissions.js.map +1 -0
- package/dist/dist/PickerSelect.d.ts +172 -0
- package/dist/dist/PickerSelect.js +403 -0
- package/dist/dist/PickerSelect.js.map +1 -0
- package/dist/dist/Pill.d.ts +7 -0
- package/dist/dist/Pill.js +10 -0
- package/dist/dist/Pill.js.map +1 -0
- package/dist/dist/Pill.stories.d.ts +1 -0
- package/dist/dist/Pill.stories.js +36 -0
- package/dist/dist/Pill.stories.js.map +1 -0
- package/dist/dist/Pog.d.ts +7 -0
- package/dist/dist/Pog.js +144 -0
- package/dist/dist/Pog.js.map +1 -0
- package/dist/dist/ProgressBar.d.ts +16 -0
- package/dist/dist/ProgressBar.js +40 -0
- package/dist/dist/ProgressBar.js.map +1 -0
- package/dist/dist/ScrollView.d.ts +1 -0
- package/dist/dist/ScrollView.js +4 -0
- package/dist/dist/ScrollView.js.map +1 -0
- package/dist/dist/SegmentedControl.d.ts +9 -0
- package/dist/dist/SegmentedControl.js +18 -0
- package/dist/dist/SegmentedControl.js.map +1 -0
- package/dist/dist/SegmentedControl.stories.d.ts +1 -0
- package/dist/dist/SegmentedControl.stories.js +32 -0
- package/dist/dist/SegmentedControl.stories.js.map +1 -0
- package/dist/dist/SelectList.d.ts +9 -0
- package/dist/dist/SelectList.js +29 -0
- package/dist/dist/SelectList.js.map +1 -0
- package/dist/dist/SelectList.stories.d.ts +1 -0
- package/dist/dist/SelectList.stories.js +24 -0
- package/dist/dist/SelectList.stories.js.map +1 -0
- package/dist/dist/Spinner.d.ts +44 -0
- package/dist/dist/Spinner.js +58 -0
- package/dist/dist/Spinner.js.map +1 -0
- package/dist/dist/Spinner.stories.d.ts +1 -0
- package/dist/dist/Spinner.stories.js +10 -0
- package/dist/dist/Spinner.stories.js.map +1 -0
- package/dist/dist/SplitPage.d.ts +7 -0
- package/dist/dist/SplitPage.js +20 -0
- package/dist/dist/SplitPage.js.map +1 -0
- package/dist/dist/SplitPage.stories.d.ts +1 -0
- package/dist/dist/SplitPage.stories.js +7 -0
- package/dist/dist/SplitPage.stories.js.map +1 -0
- package/dist/dist/StorybookContainer.d.ts +7 -0
- package/dist/dist/StorybookContainer.js +9 -0
- package/dist/dist/StorybookContainer.js.map +1 -0
- package/dist/dist/Switch.d.ts +6 -0
- package/dist/dist/Switch.js +10 -0
- package/dist/dist/Switch.js.map +1 -0
- package/dist/dist/Switch.stories.d.ts +1 -0
- package/dist/dist/Switch.stories.js +27 -0
- package/dist/dist/Switch.stories.js.map +1 -0
- package/dist/dist/TapToEdit.d.ts +9 -0
- package/dist/dist/TapToEdit.js +27 -0
- package/dist/dist/TapToEdit.js.map +1 -0
- package/dist/dist/Text.d.ts +36 -0
- package/dist/dist/Text.js +86 -0
- package/dist/dist/Text.js.map +1 -0
- package/dist/dist/Text.stories.d.ts +1 -0
- package/dist/dist/Text.stories.js +13 -0
- package/dist/dist/Text.stories.js.map +1 -0
- package/dist/dist/TextArea.d.ts +6 -0
- package/dist/dist/TextArea.js +13 -0
- package/dist/dist/TextArea.js.map +1 -0
- package/dist/dist/TextArea.stories.d.ts +12 -0
- package/dist/dist/TextArea.stories.js +21 -0
- package/dist/dist/TextArea.stories.js.map +1 -0
- package/dist/dist/TextField.d.ts +47 -0
- package/dist/dist/TextField.js +199 -0
- package/dist/dist/TextField.js.map +1 -0
- package/dist/dist/TextField.stories.d.ts +6 -0
- package/dist/dist/TextField.stories.js +15 -0
- package/dist/dist/TextField.stories.js.map +1 -0
- package/dist/dist/TextFieldNumberActionSheet.d.ts +5 -0
- package/dist/dist/TextFieldNumberActionSheet.js +24 -0
- package/dist/dist/TextFieldNumberActionSheet.js.map +1 -0
- package/dist/dist/UnifiedScreens.d.ts +2 -0
- package/dist/dist/UnifiedScreens.js +26 -0
- package/dist/dist/UnifiedScreens.js.map +1 -0
- package/dist/dist/Unifier.d.ts +131 -0
- package/dist/dist/Unifier.js +198 -0
- package/dist/dist/Unifier.js.map +1 -0
- package/dist/dist/Utilities.d.ts +51 -0
- package/dist/dist/Utilities.js +77 -0
- package/dist/dist/Utilities.js.map +1 -0
- package/dist/dist/WithLabel.d.ts +6 -0
- package/dist/dist/WithLabel.js +23 -0
- package/dist/dist/WithLabel.js.map +1 -0
- package/dist/dist/index.d.ts +43 -0
- package/dist/dist/index.js +49 -0
- package/dist/dist/index.js.map +1 -0
- package/dist/index.d.ts +1284 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/package.json +197 -0
- package/src/ActionSheet.tsx +1234 -0
- package/src/Banner.tsx +124 -0
- package/src/BlurBox.native.tsx +40 -0
- package/src/BlurBox.tsx +31 -0
- package/src/Body.tsx +32 -0
- package/src/Box.tsx +277 -0
- package/src/Button.tsx +139 -0
- package/src/Card.tsx +23 -0
- package/src/CheckBox.tsx +93 -0
- package/src/Common.ts +1376 -0
- package/src/DateTimeActionSheet.tsx +61 -0
- package/src/DecimalRangeActionSheet.tsx +113 -0
- package/src/ErrorBoundary.tsx +39 -0
- package/src/ErrorPage.tsx +44 -0
- package/src/Field.tsx +194 -0
- package/src/FieldWithLabels.tsx +36 -0
- package/src/FlatList.tsx +2 -0
- package/src/Form.tsx +182 -0
- package/src/HeaderButtons.tsx +107 -0
- package/src/Heading.tsx +53 -0
- package/src/HeightActionSheet.tsx +104 -0
- package/src/Icon.tsx +139 -0
- package/src/IconButton.tsx +52 -0
- package/src/Image.tsx +50 -0
- package/src/ImageBackground.tsx +13 -0
- package/src/Layer.tsx +17 -0
- package/src/Link.tsx +17 -0
- package/src/Mask.tsx +24 -0
- package/src/MediaQuery.ts +28 -0
- package/src/Meta.tsx +9 -0
- package/src/ModalSheet.tsx +58 -0
- package/src/NumberPickerActionSheet.tsx +66 -0
- package/src/Page.tsx +134 -0
- package/src/Permissions.ts +44 -0
- package/src/PickerSelect.tsx +673 -0
- package/src/Pill.tsx +24 -0
- package/src/Pog.tsx +211 -0
- package/src/ProgressBar.tsx +55 -0
- package/src/ScrollView.tsx +2 -0
- package/src/SegmentedControl.tsx +51 -0
- package/src/SelectList.tsx +48 -0
- package/src/Spinner.tsx +69 -0
- package/src/SplitPage.tsx +115 -0
- package/src/Switch.tsx +19 -0
- package/src/TapToEdit.tsx +48 -0
- package/src/Text.tsx +92 -0
- package/src/TextArea.tsx +15 -0
- package/src/TextField.tsx +291 -0
- package/src/TextFieldNumberActionSheet.tsx +61 -0
- package/src/UnifiedScreens.ts +24 -0
- package/src/Unifier.ts +268 -0
- package/src/Utilities.tsx +161 -0
- package/src/WithLabel.tsx +46 -0
- package/src/index.tsx +1332 -0
- package/src/polyfill.d.ts +11 -0
- package/tsconfig.json +29 -0
package/src/Banner.tsx
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import {BoxColor, ButtonColor, Rounding, TextColor} from "./Common";
|
|
5
|
+
import {IconButton} from "./IconButton";
|
|
6
|
+
import {Text} from "./Text";
|
|
7
|
+
import {Unifier} from "./Unifier";
|
|
8
|
+
|
|
9
|
+
// import {faTimesCircle, faArrowRight} from "@fortawesome/free-solid-svg-icons";
|
|
10
|
+
|
|
11
|
+
export interface BannerProps {
|
|
12
|
+
id: string;
|
|
13
|
+
text: string;
|
|
14
|
+
subtext?: string;
|
|
15
|
+
color?: BoxColor;
|
|
16
|
+
textColor?: TextColor;
|
|
17
|
+
negativeXMargin?: number;
|
|
18
|
+
bold?: boolean;
|
|
19
|
+
shape?: Rounding;
|
|
20
|
+
type?: "dismiss" | "action";
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// library.add(faTimesCircle);
|
|
25
|
+
// library.add(faArrowRight);
|
|
26
|
+
|
|
27
|
+
interface BannerState {
|
|
28
|
+
show: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getKey(id: string) {
|
|
32
|
+
return `@ReactUnifier:${id}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const hideBanner = (id: string) => {
|
|
36
|
+
console.debug(`[banner] Hiding ${getKey(id)} `);
|
|
37
|
+
Unifier.storage.setItem(getKey(id), "true");
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export class Banner extends React.Component<BannerProps, BannerState> {
|
|
41
|
+
state = {show: false};
|
|
42
|
+
|
|
43
|
+
async componentDidMount() {
|
|
44
|
+
const seen = await Unifier.storage.getItem(getKey(this.props.id));
|
|
45
|
+
console.debug(`[banner] ${getKey(this.props.id)} seen? ${seen}`);
|
|
46
|
+
this.setState({show: !seen});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
dismiss = () => {
|
|
50
|
+
hideBanner(this.props.id);
|
|
51
|
+
this.setState({show: false});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
render() {
|
|
55
|
+
if (!this.state.show) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const type = this.props.type || "dismiss";
|
|
59
|
+
|
|
60
|
+
if (type === "action" && !this.props.onClick) {
|
|
61
|
+
console.warn("Banners with type action require an onClick property.");
|
|
62
|
+
}
|
|
63
|
+
const negativeMargin = (this.props.negativeXMargin || 0) * -4;
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Box
|
|
67
|
+
color={this.props.color || "secondaryDark"}
|
|
68
|
+
dangerouslySetInlineStyle={{
|
|
69
|
+
__style: {
|
|
70
|
+
marginLeft: negativeMargin,
|
|
71
|
+
marginRight: negativeMargin,
|
|
72
|
+
},
|
|
73
|
+
}}
|
|
74
|
+
direction="row"
|
|
75
|
+
justifyContent="between"
|
|
76
|
+
marginBottom={3}
|
|
77
|
+
marginTop={3}
|
|
78
|
+
paddingX={3}
|
|
79
|
+
paddingY={2}
|
|
80
|
+
rounding={this.props.shape}
|
|
81
|
+
shadow
|
|
82
|
+
width={Unifier.utils.dimensions().width || "100%"}
|
|
83
|
+
onClick={this.dismiss}
|
|
84
|
+
>
|
|
85
|
+
<Box alignItems="center" direction="column" flex="shrink" justifyContent="center">
|
|
86
|
+
<Box paddingY={1}>
|
|
87
|
+
<Text align="center" color={this.props.textColor || "white"} weight="bold">
|
|
88
|
+
{this.props.text}
|
|
89
|
+
</Text>
|
|
90
|
+
</Box>
|
|
91
|
+
{this.props.subtext && (
|
|
92
|
+
<Box paddingY={1}>
|
|
93
|
+
<Text align="center" color={this.props.textColor || "white"}>
|
|
94
|
+
{this.props.subtext}
|
|
95
|
+
</Text>
|
|
96
|
+
</Box>
|
|
97
|
+
)}
|
|
98
|
+
</Box>
|
|
99
|
+
<Box alignItems="center" display="block" justifyContent="center" width={40}>
|
|
100
|
+
{type === "dismiss" && (
|
|
101
|
+
<IconButton
|
|
102
|
+
accessibilityLabel=""
|
|
103
|
+
icon="times-circle"
|
|
104
|
+
// size="lg"
|
|
105
|
+
iconColor={(this.props.textColor || "white") as ButtonColor}
|
|
106
|
+
prefix="fas"
|
|
107
|
+
onClick={() => this.dismiss()}
|
|
108
|
+
/>
|
|
109
|
+
)}
|
|
110
|
+
{type === "action" && (
|
|
111
|
+
<IconButton
|
|
112
|
+
accessibilityLabel=""
|
|
113
|
+
icon="arrow-right"
|
|
114
|
+
// size="lg"
|
|
115
|
+
iconColor={(this.props.textColor || "white") as ButtonColor}
|
|
116
|
+
prefix="fas"
|
|
117
|
+
onClick={() => this.props.onClick && this.props.onClick()}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
</Box>
|
|
121
|
+
</Box>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {BlurView} from "@react-native-community/blur";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {Platform, View} from "react-native";
|
|
4
|
+
|
|
5
|
+
import {Box} from "./Box";
|
|
6
|
+
import {BlurBoxProps} from "./Common";
|
|
7
|
+
|
|
8
|
+
export class BlurBox extends React.Component<BlurBoxProps, {}> {
|
|
9
|
+
renderBlur(children: any) {
|
|
10
|
+
if (Platform.OS === "ios") {
|
|
11
|
+
return (
|
|
12
|
+
<BlurView blurType={this.props.blurType || "regular"} style={{borderRadius: 12}}>
|
|
13
|
+
{children}
|
|
14
|
+
</BlurView>
|
|
15
|
+
);
|
|
16
|
+
} else {
|
|
17
|
+
return (
|
|
18
|
+
<View style={{backgroundColor: "rgba(82, 82, 82, 0.7)", borderRadius: 10}}>{children}</View>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
const {marginBottom, marginTop, margin, ...props} = this.props;
|
|
25
|
+
return (
|
|
26
|
+
<Box
|
|
27
|
+
margin={margin || 0}
|
|
28
|
+
marginBottom={marginBottom || 4}
|
|
29
|
+
marginTop={marginTop || 0}
|
|
30
|
+
width="100%"
|
|
31
|
+
>
|
|
32
|
+
{this.renderBlur(
|
|
33
|
+
<Box paddingX={4} {...props}>
|
|
34
|
+
{this.props.children}
|
|
35
|
+
</Box>
|
|
36
|
+
)}
|
|
37
|
+
</Box>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/src/BlurBox.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import {BlurBoxProps} from "./Common";
|
|
5
|
+
import {mergeInlineStyles} from "./Utilities";
|
|
6
|
+
|
|
7
|
+
export class BlurBox extends React.Component<BlurBoxProps, {}> {
|
|
8
|
+
render() {
|
|
9
|
+
const {marginBottom, marginTop, margin, ...props} = this.props;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Box
|
|
13
|
+
{...this.props}
|
|
14
|
+
dangerouslySetInlineStyle={mergeInlineStyles(this.props.dangerouslySetInlineStyle, {
|
|
15
|
+
// filter: "blur(4px)",
|
|
16
|
+
backdropFilter: "blur(4px)",
|
|
17
|
+
backgroundColor: "#111",
|
|
18
|
+
opacity: 0.8,
|
|
19
|
+
borderRadius: 12,
|
|
20
|
+
})}
|
|
21
|
+
margin={margin || 0}
|
|
22
|
+
marginBottom={marginBottom || 4}
|
|
23
|
+
marginTop={marginTop || 0}
|
|
24
|
+
>
|
|
25
|
+
<Box paddingX={4} {...props}>
|
|
26
|
+
{this.props.children}
|
|
27
|
+
</Box>
|
|
28
|
+
</Box>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/Body.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {ActivityIndicator, KeyboardAvoidingView} from "react-native";
|
|
3
|
+
|
|
4
|
+
import {Box} from "./Box";
|
|
5
|
+
import {BodyProps} from "./Common";
|
|
6
|
+
import {Unifier} from "./Unifier";
|
|
7
|
+
|
|
8
|
+
export class Body extends React.Component<BodyProps, {}> {
|
|
9
|
+
renderBody() {
|
|
10
|
+
return (
|
|
11
|
+
<Box avoidKeyboard height="100%" scroll={this.props.scroll}>
|
|
12
|
+
<Box
|
|
13
|
+
height={this.props.height || "100%"}
|
|
14
|
+
padding={this.props.padding !== undefined ? this.props.padding : 5}
|
|
15
|
+
>
|
|
16
|
+
{this.props.loading === true && (
|
|
17
|
+
<ActivityIndicator color={Unifier.theme.darkGray} size="large" />
|
|
18
|
+
)}
|
|
19
|
+
{this.props.children}
|
|
20
|
+
</Box>
|
|
21
|
+
</Box>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
if (this.props.avoidKeyboard === false) {
|
|
27
|
+
return this.renderBody();
|
|
28
|
+
} else {
|
|
29
|
+
return <KeyboardAvoidingView behavior="position">{this.renderBody()}</KeyboardAvoidingView>;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/Box.tsx
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
KeyboardAvoidingView,
|
|
4
|
+
Platform,
|
|
5
|
+
SafeAreaView,
|
|
6
|
+
ScrollView,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
View,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
|
|
11
|
+
import {UnifiedTheme} from ".";
|
|
12
|
+
import {AlignContent, AlignItems, AlignSelf, BoxProps, JustifyContent, SPACING} from "./Common";
|
|
13
|
+
import {mediaQueryLargerThan} from "./MediaQuery";
|
|
14
|
+
import {Unifier} from "./Unifier";
|
|
15
|
+
|
|
16
|
+
const ALIGN_CONTENT = {
|
|
17
|
+
start: "flex-start",
|
|
18
|
+
end: "flex-end",
|
|
19
|
+
center: "center",
|
|
20
|
+
between: "space-between",
|
|
21
|
+
around: "space-around",
|
|
22
|
+
stretch: "stretch",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const ALIGN_ITEMS = {
|
|
26
|
+
start: "flex-start",
|
|
27
|
+
end: "flex-end",
|
|
28
|
+
center: "center",
|
|
29
|
+
baseline: "baseline",
|
|
30
|
+
stretch: "stretch",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const ALIGN_SELF = {
|
|
34
|
+
auto: "auto",
|
|
35
|
+
baseline: "baseline",
|
|
36
|
+
start: "flex-start",
|
|
37
|
+
end: "flex-end",
|
|
38
|
+
center: "center",
|
|
39
|
+
between: "space-between",
|
|
40
|
+
around: "space-around",
|
|
41
|
+
stretch: "stretch",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export class Box extends React.Component<BoxProps, {}> {
|
|
45
|
+
BOX_STYLE_MAP: {
|
|
46
|
+
[prop: string]: (
|
|
47
|
+
value: any,
|
|
48
|
+
all: {[prop: string]: any}
|
|
49
|
+
) => {[style: string]: string | number} | {};
|
|
50
|
+
} = {
|
|
51
|
+
alignItems: (value: AlignItems) => ({alignItems: ALIGN_ITEMS[value]}),
|
|
52
|
+
alignContent: (value: AlignContent) => ({alignContent: ALIGN_CONTENT[value]}),
|
|
53
|
+
alignSelf: (value: AlignSelf) => ({alignSelf: ALIGN_SELF[value]}),
|
|
54
|
+
color: (value: keyof UnifiedTheme) => ({backgroundColor: Unifier.theme[value]}),
|
|
55
|
+
direction: (value: any) => ({flexDirection: value, display: "flex"}),
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
|
+
smDirection: (value: any, all: any) =>
|
|
58
|
+
mediaQueryLargerThan("sm") ? {flexDirection: value, display: "flex"} : {},
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
60
|
+
mdDirection: (value: any, all: any) =>
|
|
61
|
+
mediaQueryLargerThan("md") ? {flexDirection: value, display: "flex"} : {},
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
63
|
+
lgDirection: (value: any, all: any) =>
|
|
64
|
+
mediaQueryLargerThan("lg") ? {flexDirection: value, display: "flex"} : {},
|
|
65
|
+
display: (value: any) => {
|
|
66
|
+
return value === "flex" ? {flex: undefined} : {flex: 0, flexDirection: "row"};
|
|
67
|
+
},
|
|
68
|
+
flex: (value: string) => {
|
|
69
|
+
if (value === "grow") {
|
|
70
|
+
return {flexGrow: 1, flexShrink: 1, display: "flex"};
|
|
71
|
+
} else if (value === "shrink") {
|
|
72
|
+
return {flexShrink: 1, display: "flex"};
|
|
73
|
+
} else {
|
|
74
|
+
return {flex: 0, display: "flex"};
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
justifyContent: (value: JustifyContent) => ({justifyContent: ALIGN_CONTENT[value]}),
|
|
78
|
+
height: (value) => {
|
|
79
|
+
if (this.props.border && !isNaN(Number(value))) {
|
|
80
|
+
return {height: Number(value) + 2 * 2};
|
|
81
|
+
} else {
|
|
82
|
+
return {height: value};
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
margin: (value) => ({margin: value * SPACING}),
|
|
86
|
+
marginRight: (value) => ({marginRight: value * SPACING}),
|
|
87
|
+
marginLeft: (value) => ({marginLeft: value * SPACING}),
|
|
88
|
+
marginTop: (value) => ({marginTop: value * SPACING}),
|
|
89
|
+
marginBottom: (value) => ({marginBottom: value * SPACING}),
|
|
90
|
+
paddingX: (value) => ({paddingLeft: value * SPACING, paddingRight: value * SPACING}),
|
|
91
|
+
paddingY: (value) => ({paddingTop: value * SPACING, paddingBottom: value * SPACING}),
|
|
92
|
+
padding: (value) => ({padding: value * SPACING}),
|
|
93
|
+
position: (value) => ({position: value}),
|
|
94
|
+
top: (top) => ({top: top ? 0 : undefined}),
|
|
95
|
+
bottom: (bottom) => ({bottom: bottom ? 0 : undefined}),
|
|
96
|
+
right: (right) => ({right: right ? 0 : undefined}),
|
|
97
|
+
left: (left) => ({left: left ? 0 : undefined}),
|
|
98
|
+
rounding: (rounding, allProps) => {
|
|
99
|
+
if (rounding === "circle") {
|
|
100
|
+
if (!allProps.height && !allProps.width) {
|
|
101
|
+
console.warn("Cannot use Box rounding='circle' without height or width.");
|
|
102
|
+
return {borderRadius: undefined};
|
|
103
|
+
}
|
|
104
|
+
return {borderRadius: allProps.height || allProps.width};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (rounding === "pill") {
|
|
108
|
+
return {borderRadius: 999};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (typeof rounding === "number") {
|
|
112
|
+
return {borderRadius: rounding * 4};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return {borderRadius: undefined};
|
|
116
|
+
},
|
|
117
|
+
overflow: (value) => {
|
|
118
|
+
if (value === "scrollY" || value === "scroll") {
|
|
119
|
+
return {overflow: "scroll"};
|
|
120
|
+
} else if (value === "scrollX") {
|
|
121
|
+
return {overflow: "scrollX"};
|
|
122
|
+
}
|
|
123
|
+
return {};
|
|
124
|
+
},
|
|
125
|
+
width: (value) => {
|
|
126
|
+
if (this.props.border && !isNaN(Number(value))) {
|
|
127
|
+
return {width: Number(value) + 2 * 2};
|
|
128
|
+
} else {
|
|
129
|
+
return {width: value};
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
wrap: (value) => ({flexWrap: value ? "wrap" : "nowrap", alignItems: "flex-start"}),
|
|
133
|
+
shadow: (value) => {
|
|
134
|
+
if (!value) {
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
if (Platform.OS === "ios" || Platform.OS === "web") {
|
|
138
|
+
return {
|
|
139
|
+
shadowColor: "#999",
|
|
140
|
+
shadowOffset: {
|
|
141
|
+
width: 2,
|
|
142
|
+
height: 2,
|
|
143
|
+
},
|
|
144
|
+
shadowRadius: 2,
|
|
145
|
+
shadowOpacity: 1.0,
|
|
146
|
+
};
|
|
147
|
+
} else {
|
|
148
|
+
return {elevation: 4};
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
border: (value: keyof UnifiedTheme) => {
|
|
152
|
+
if (!value) {
|
|
153
|
+
return {};
|
|
154
|
+
}
|
|
155
|
+
return {borderColor: Unifier.theme[value], borderWidth: 2};
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
scrollRef = React.createRef();
|
|
160
|
+
|
|
161
|
+
constructor(props: BoxProps) {
|
|
162
|
+
super(props);
|
|
163
|
+
if (props.scrollRef) {
|
|
164
|
+
this.scrollRef = props.scrollRef;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public scrollToEnd = () => {
|
|
169
|
+
if (this.scrollRef && this.scrollRef.current) {
|
|
170
|
+
// HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout to
|
|
171
|
+
// avoid this, but it works well enough.
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
this.scrollRef && this.scrollRef.current && (this.scrollRef.current as any).scrollToEnd();
|
|
174
|
+
}, 50);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
public scrollTo = (y: number) => {
|
|
179
|
+
if (this.scrollRef && this.scrollRef.current) {
|
|
180
|
+
// HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout to
|
|
181
|
+
// avoid this, but it works well enough.
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
this.scrollRef && this.scrollRef.current && (this.scrollRef.current as any).scrollTo({y});
|
|
184
|
+
}, 50);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
propsToStyle(): any {
|
|
189
|
+
let style: any = {};
|
|
190
|
+
for (const prop of Object.keys(this.props)) {
|
|
191
|
+
const value = (this.props as any)[prop];
|
|
192
|
+
if (this.BOX_STYLE_MAP[prop]) {
|
|
193
|
+
Object.assign(style, this.BOX_STYLE_MAP[prop](value, this.props));
|
|
194
|
+
} else if (prop !== "children" && prop !== "onClick") {
|
|
195
|
+
style[prop] = value;
|
|
196
|
+
// console.warn(`Box: unknown property ${prop}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (this.props.wrap && this.props.alignItems) {
|
|
201
|
+
console.warn("React Native doesn't support wrap and alignItems together.");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Finally, dangerously set overrides.
|
|
205
|
+
if (this.props.dangerouslySetInlineStyle) {
|
|
206
|
+
style = {...style, ...this.props.dangerouslySetInlineStyle.__style};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return style;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
renderBox() {
|
|
213
|
+
return (
|
|
214
|
+
<View style={!this.props.scroll && !this.props.overflow && this.propsToStyle()}>
|
|
215
|
+
{this.props.children}
|
|
216
|
+
</View>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
render() {
|
|
221
|
+
let box;
|
|
222
|
+
|
|
223
|
+
if (this.props.onClick) {
|
|
224
|
+
box = (
|
|
225
|
+
<TouchableOpacity
|
|
226
|
+
style={this.propsToStyle()}
|
|
227
|
+
// TODO: refactor this better..
|
|
228
|
+
onLayout={this.props.onLayout}
|
|
229
|
+
onPress={() => {
|
|
230
|
+
Unifier.utils.haptic();
|
|
231
|
+
this.props.onClick();
|
|
232
|
+
}}
|
|
233
|
+
>
|
|
234
|
+
{this.props.children}
|
|
235
|
+
{/* <View pointerEvents="none">{box}</View> */}
|
|
236
|
+
</TouchableOpacity>
|
|
237
|
+
);
|
|
238
|
+
} else {
|
|
239
|
+
box = <View style={this.propsToStyle()}>{this.props.children}</View>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (this.props.scroll) {
|
|
243
|
+
const {justifyContent, alignContent, alignItems, ...scrollStyle} = this.propsToStyle();
|
|
244
|
+
|
|
245
|
+
box = (
|
|
246
|
+
<ScrollView
|
|
247
|
+
ref={this.props.scrollRef || this.scrollRef}
|
|
248
|
+
contentContainerStyle={{justifyContent, alignContent, alignItems}}
|
|
249
|
+
horizontal={this.props.overflow === "scrollX"}
|
|
250
|
+
keyboardShouldPersistTaps="handled"
|
|
251
|
+
scrollEventThrottle={50}
|
|
252
|
+
style={scrollStyle}
|
|
253
|
+
onScroll={(event) => {
|
|
254
|
+
if (this.props.onScroll && event) {
|
|
255
|
+
this.props.onScroll(event.nativeEvent.contentOffset.y);
|
|
256
|
+
}
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
{box}
|
|
260
|
+
</ScrollView>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (this.props.avoidKeyboard) {
|
|
265
|
+
box = (
|
|
266
|
+
<KeyboardAvoidingView
|
|
267
|
+
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
|
268
|
+
keyboardVerticalOffset={this.props.keyboardOffset}
|
|
269
|
+
style={{flex: 1, display: "flex"}}
|
|
270
|
+
>
|
|
271
|
+
<SafeAreaView style={{flex: 1, display: "flex"}}>{box}</SafeAreaView>
|
|
272
|
+
</KeyboardAvoidingView>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return box;
|
|
276
|
+
}
|
|
277
|
+
}
|
package/src/Button.tsx
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import debounce from "lodash/debounce";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {ActivityIndicator, TouchableOpacity} from "react-native";
|
|
4
|
+
|
|
5
|
+
import {UnifiedTheme} from ".";
|
|
6
|
+
import {Box} from "./Box";
|
|
7
|
+
import {ButtonProps, Color, iconSizeToNumber} from "./Common";
|
|
8
|
+
import {Icon} from "./Icon";
|
|
9
|
+
// import {Icon} from "./Icon";
|
|
10
|
+
import {Text} from "./Text";
|
|
11
|
+
import {Unifier} from "./Unifier";
|
|
12
|
+
|
|
13
|
+
interface ButtonState {
|
|
14
|
+
loading: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const buttonTextColor: {[buttonColor: string]: "white" | "darkGray"} = {
|
|
18
|
+
blue: "white",
|
|
19
|
+
lightGray: "darkGray",
|
|
20
|
+
red: "white",
|
|
21
|
+
transparent: "white",
|
|
22
|
+
white: "darkGray",
|
|
23
|
+
primary: "white",
|
|
24
|
+
secondary: "white",
|
|
25
|
+
accent: "white",
|
|
26
|
+
tertiary: "white",
|
|
27
|
+
facebook: "white",
|
|
28
|
+
twitter: "white",
|
|
29
|
+
google: "white",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export class Button extends React.Component<ButtonProps, ButtonState> {
|
|
33
|
+
state = {loading: false};
|
|
34
|
+
|
|
35
|
+
HEIGHTS = {
|
|
36
|
+
sm: 36,
|
|
37
|
+
md: 40,
|
|
38
|
+
lg: 48,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
getBackgroundColor(color: string) {
|
|
42
|
+
if (this.props.type === "ghost" || this.props.type === "outline") {
|
|
43
|
+
return "transparent";
|
|
44
|
+
} else {
|
|
45
|
+
return Unifier.theme[color as keyof UnifiedTheme];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getTextColor(color: Color): Color {
|
|
50
|
+
if (this.props.type === "ghost" || this.props.type === "outline") {
|
|
51
|
+
return color;
|
|
52
|
+
} else if (color === undefined) {
|
|
53
|
+
return "darkGray";
|
|
54
|
+
} else {
|
|
55
|
+
return buttonTextColor[color] || "white";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getBorderColor(color: string) {
|
|
60
|
+
if (this.props.type === "outline") {
|
|
61
|
+
return Unifier.theme[this.getTextColor(color as Color)];
|
|
62
|
+
} else {
|
|
63
|
+
return "transparent";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
render() {
|
|
68
|
+
let color = this.props.color || "lightGray";
|
|
69
|
+
if (color === "gray") {
|
|
70
|
+
color = "lightGray";
|
|
71
|
+
}
|
|
72
|
+
return (
|
|
73
|
+
<TouchableOpacity
|
|
74
|
+
disabled={this.props.disabled || this.props.loading}
|
|
75
|
+
style={{
|
|
76
|
+
alignSelf: this.props.inline === true ? undefined : "stretch",
|
|
77
|
+
height: this.HEIGHTS[this.props.size || "md"],
|
|
78
|
+
backgroundColor: this.getBackgroundColor(color),
|
|
79
|
+
// width: this.props.inline === true ? undefined : "100%",
|
|
80
|
+
flexShrink: this.props.inline ? 1 : 0,
|
|
81
|
+
// flexGrow: this.props.inline ? 0 : 1,
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
justifyContent: "center",
|
|
84
|
+
borderRadius: 5,
|
|
85
|
+
borderColor: this.getBorderColor(color),
|
|
86
|
+
borderWidth: this.props.type === "outline" ? 2 : 0,
|
|
87
|
+
opacity: this.props.disabled ? 0.4 : 1,
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
paddingHorizontal: 4 * 2,
|
|
90
|
+
}}
|
|
91
|
+
onPress={debounce(
|
|
92
|
+
async () => {
|
|
93
|
+
Unifier.utils.haptic();
|
|
94
|
+
this.setState({loading: true});
|
|
95
|
+
try {
|
|
96
|
+
if (this.props.onClick) {
|
|
97
|
+
await this.props.onClick();
|
|
98
|
+
}
|
|
99
|
+
} catch (e) {
|
|
100
|
+
this.setState({loading: false});
|
|
101
|
+
throw e;
|
|
102
|
+
}
|
|
103
|
+
this.setState({loading: false});
|
|
104
|
+
},
|
|
105
|
+
500,
|
|
106
|
+
{leading: true}
|
|
107
|
+
)}
|
|
108
|
+
>
|
|
109
|
+
{this.props.icon !== undefined && (
|
|
110
|
+
<Box paddingX={2}>
|
|
111
|
+
<Icon
|
|
112
|
+
color={this.getTextColor(this.props.color as Color)}
|
|
113
|
+
name={this.props.icon}
|
|
114
|
+
prefix={this.props.iconPrefix || "far"}
|
|
115
|
+
size={iconSizeToNumber(this.props.size)}
|
|
116
|
+
/>
|
|
117
|
+
</Box>
|
|
118
|
+
)}
|
|
119
|
+
{Boolean(this.props.children) && this.props.children}
|
|
120
|
+
{Boolean(this.props.text) && (
|
|
121
|
+
<Text
|
|
122
|
+
color={this.getTextColor(color as Color)}
|
|
123
|
+
inline={this.props.inline}
|
|
124
|
+
size={this.props.size}
|
|
125
|
+
skipLinking
|
|
126
|
+
weight="bold"
|
|
127
|
+
>
|
|
128
|
+
{this.props.text}
|
|
129
|
+
</Text>
|
|
130
|
+
)}
|
|
131
|
+
{(this.state.loading || this.props.loading) && (
|
|
132
|
+
<Box marginLeft={2}>
|
|
133
|
+
<ActivityIndicator color={this.getTextColor(color as Color)} size="small" />
|
|
134
|
+
</Box>
|
|
135
|
+
)}
|
|
136
|
+
</TouchableOpacity>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
package/src/Card.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import {BoxProps} from "./Common";
|
|
5
|
+
|
|
6
|
+
export class Card extends React.Component<BoxProps, {}> {
|
|
7
|
+
render() {
|
|
8
|
+
return (
|
|
9
|
+
<Box
|
|
10
|
+
color={this.props.color || "white"}
|
|
11
|
+
direction="column"
|
|
12
|
+
display="flex"
|
|
13
|
+
padding={this.props.padding || 4}
|
|
14
|
+
rounding={3}
|
|
15
|
+
shadow
|
|
16
|
+
width={this.props.width}
|
|
17
|
+
{...this.props}
|
|
18
|
+
>
|
|
19
|
+
{this.props.children}
|
|
20
|
+
</Box>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|