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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import DateTimePicker from "@react-native-community/datetimepicker";
|
|
2
|
+
import moment from "moment-timezone";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
import {ActionSheet} from "./ActionSheet";
|
|
6
|
+
import {Box} from "./Box";
|
|
7
|
+
import {Button} from "./Button";
|
|
8
|
+
import {OnChangeCallback} from "./Common";
|
|
9
|
+
|
|
10
|
+
interface DateTimeActionSheetProps {
|
|
11
|
+
value?: string;
|
|
12
|
+
mode?: "date" | "time";
|
|
13
|
+
onChange: OnChangeCallback;
|
|
14
|
+
actionSheetRef: React.RefObject<any>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface DateTimeActionSheetState {}
|
|
18
|
+
|
|
19
|
+
export class DateTimeActionSheet extends React.Component<
|
|
20
|
+
DateTimeActionSheetProps,
|
|
21
|
+
DateTimeActionSheetState
|
|
22
|
+
> {
|
|
23
|
+
constructor(props: DateTimeActionSheetProps) {
|
|
24
|
+
super(props);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
render() {
|
|
28
|
+
return (
|
|
29
|
+
<ActionSheet ref={this.props.actionSheetRef} bounceOnOpen gestureEnabled>
|
|
30
|
+
<Box marginBottom={8} paddingX={4} width="100%">
|
|
31
|
+
<Box alignItems="end" display="flex" width="100%">
|
|
32
|
+
<Box width="33%">
|
|
33
|
+
<Button
|
|
34
|
+
color="blue"
|
|
35
|
+
size="lg"
|
|
36
|
+
text="Save"
|
|
37
|
+
type="ghost"
|
|
38
|
+
onClick={() => {
|
|
39
|
+
this.props.actionSheetRef?.current?.setModalVisible(false);
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</Box>
|
|
43
|
+
</Box>
|
|
44
|
+
<DateTimePicker
|
|
45
|
+
display="spinner"
|
|
46
|
+
is24Hour
|
|
47
|
+
mode={this.props.mode}
|
|
48
|
+
testID="dateTimePicker"
|
|
49
|
+
value={moment(this.props.value).toDate()}
|
|
50
|
+
onChange={(event: any, date: any) => {
|
|
51
|
+
if (!date) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.props.onChange({event, value: date.toString()});
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
</Box>
|
|
58
|
+
</ActionSheet>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {Picker} from "@react-native-picker/picker";
|
|
2
|
+
import range from "lodash/range";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
import {ActionSheet} from "./ActionSheet";
|
|
6
|
+
import {Box} from "./Box";
|
|
7
|
+
import {Button} from "./Button";
|
|
8
|
+
import {OnChangeCallback} from "./Common";
|
|
9
|
+
|
|
10
|
+
const PICKER_HEIGHT = 104;
|
|
11
|
+
|
|
12
|
+
interface DecimalRangeActionSheetProps {
|
|
13
|
+
value: string;
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
onChange: OnChangeCallback;
|
|
17
|
+
actionSheetRef: React.RefObject<any>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface DecimalRangeActionSheetState {
|
|
21
|
+
whole: string;
|
|
22
|
+
decimal: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class DecimalRangeActionSheet extends React.Component<
|
|
26
|
+
DecimalRangeActionSheetProps,
|
|
27
|
+
DecimalRangeActionSheetState
|
|
28
|
+
> {
|
|
29
|
+
constructor(props: DecimalRangeActionSheetProps) {
|
|
30
|
+
super(props);
|
|
31
|
+
this.state = {
|
|
32
|
+
whole: String(Math.floor(Number(props.value))),
|
|
33
|
+
decimal: String((Number(props.value) * 10) % 10),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
return (
|
|
39
|
+
<ActionSheet ref={this.props.actionSheetRef} bounceOnOpen gestureEnabled>
|
|
40
|
+
<Box marginBottom={8} paddingX={4} width="100%">
|
|
41
|
+
<Box alignItems="end" display="flex" width="100%">
|
|
42
|
+
<Box width="33%">
|
|
43
|
+
<Button
|
|
44
|
+
color="blue"
|
|
45
|
+
size="lg"
|
|
46
|
+
text="Close"
|
|
47
|
+
type="ghost"
|
|
48
|
+
onClick={() => {
|
|
49
|
+
this.props.actionSheetRef?.current?.setModalVisible(false);
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
</Box>
|
|
53
|
+
</Box>
|
|
54
|
+
<Box direction="row" width="100%">
|
|
55
|
+
<Box width="50%">
|
|
56
|
+
<Picker
|
|
57
|
+
itemStyle={{
|
|
58
|
+
height: PICKER_HEIGHT,
|
|
59
|
+
}}
|
|
60
|
+
selectedValue={this.state.whole}
|
|
61
|
+
style={{
|
|
62
|
+
height: PICKER_HEIGHT,
|
|
63
|
+
backgroundColor: "#FFFFFF",
|
|
64
|
+
}}
|
|
65
|
+
onValueChange={(whole) => {
|
|
66
|
+
this.setState({whole: String(whole)});
|
|
67
|
+
this.props.onChange({
|
|
68
|
+
value: String(Number(whole) + Number(this.state.decimal) * 0.1),
|
|
69
|
+
});
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{range(this.props.min, this.props.max + 1).map((n) => {
|
|
73
|
+
// console.log("FIRST", String(n));
|
|
74
|
+
return <Picker.Item key={String(n)} label={String(n)} value={String(n)} />;
|
|
75
|
+
})}
|
|
76
|
+
</Picker>
|
|
77
|
+
</Box>
|
|
78
|
+
<Box width="50%">
|
|
79
|
+
<Picker
|
|
80
|
+
itemStyle={{
|
|
81
|
+
height: PICKER_HEIGHT,
|
|
82
|
+
}}
|
|
83
|
+
selectedValue={this.state.decimal}
|
|
84
|
+
style={{
|
|
85
|
+
height: PICKER_HEIGHT,
|
|
86
|
+
backgroundColor: "#FFFFFF",
|
|
87
|
+
}}
|
|
88
|
+
onValueChange={(decimal) => {
|
|
89
|
+
// console.log(
|
|
90
|
+
// "DECIMAL",
|
|
91
|
+
// decimal,
|
|
92
|
+
// this.state.whole,
|
|
93
|
+
// Number(decimal.toString()) * 0.1,
|
|
94
|
+
// String(this.state.whole + Number(decimal) * 0.1)
|
|
95
|
+
// );
|
|
96
|
+
this.setState({decimal: String(decimal)});
|
|
97
|
+
this.props.onChange({
|
|
98
|
+
value: String(Number(this.state.whole) + Number(decimal) * 0.1),
|
|
99
|
+
});
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{range(0, 10).map((n) => {
|
|
103
|
+
// console.log("N", n);
|
|
104
|
+
return <Picker.Item key={String(n)} label={`.${String(n)}`} value={String(n)} />;
|
|
105
|
+
})}
|
|
106
|
+
</Picker>
|
|
107
|
+
</Box>
|
|
108
|
+
</Box>
|
|
109
|
+
</Box>
|
|
110
|
+
</ActionSheet>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import {ErrorBoundaryProps} from "./Common";
|
|
5
|
+
import {ErrorPage} from "./ErrorPage";
|
|
6
|
+
|
|
7
|
+
interface State {
|
|
8
|
+
error?: Error;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ErrorBoundary extends React.Component<ErrorBoundaryProps, State> {
|
|
12
|
+
state = {error: undefined};
|
|
13
|
+
|
|
14
|
+
static getDerivedStateFromError(error: Error) {
|
|
15
|
+
console.warn("[ErrorBoundary] Derived error", error);
|
|
16
|
+
return {error};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
componentDidCatch(error: Error, info: {componentStack: string}) {
|
|
20
|
+
console.warn("[ErrorBoundary] Caught error", error);
|
|
21
|
+
Sentry.captureException(error);
|
|
22
|
+
|
|
23
|
+
if (this.props.onError) {
|
|
24
|
+
this.props.onError(error, info.componentStack);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
resetError = () => {
|
|
29
|
+
this.setState({error: undefined});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
const error = this.state.error;
|
|
34
|
+
if (error) {
|
|
35
|
+
return <ErrorPage error={error} resetError={this.resetError} />;
|
|
36
|
+
}
|
|
37
|
+
return this.props.children;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import {Button} from "./Button";
|
|
5
|
+
import {Text} from "./Text";
|
|
6
|
+
interface ErrorPageProps {
|
|
7
|
+
error: Error;
|
|
8
|
+
resetError: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ErrorPage extends React.Component<ErrorPageProps, {}> {
|
|
12
|
+
constructor(props: ErrorPageProps) {
|
|
13
|
+
super(props);
|
|
14
|
+
this.state = {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
render() {
|
|
18
|
+
return (
|
|
19
|
+
<Box
|
|
20
|
+
alignItems="center"
|
|
21
|
+
direction="column"
|
|
22
|
+
display="flex"
|
|
23
|
+
height="100%"
|
|
24
|
+
justifyContent="center"
|
|
25
|
+
padding={6}
|
|
26
|
+
width="100%"
|
|
27
|
+
>
|
|
28
|
+
<Text align="center" color="red" size="lg" weight="bold">
|
|
29
|
+
Oops!
|
|
30
|
+
</Text>
|
|
31
|
+
<Box paddingY={3}>
|
|
32
|
+
<Text align="center">
|
|
33
|
+
There's an error. Sorry! Josh just got a notification about the error so he can fix
|
|
34
|
+
it as soon as possible!
|
|
35
|
+
</Text>
|
|
36
|
+
</Box>
|
|
37
|
+
<Box paddingY={3}>
|
|
38
|
+
<Text>{this.props.error.toString()}</Text>
|
|
39
|
+
</Box>
|
|
40
|
+
<Button color="blue" text="Try again" onClick={this.props.resetError} />
|
|
41
|
+
</Box>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/Field.tsx
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import isDate from "lodash/isDate";
|
|
2
|
+
import isNumber from "lodash/isNumber";
|
|
3
|
+
import moment from "moment-timezone";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {Box} from "./Box";
|
|
7
|
+
import {FieldProps, TextFieldType} from "./Common";
|
|
8
|
+
import {FieldWithLabels} from "./FieldWithLabels";
|
|
9
|
+
import {SelectList} from "./SelectList";
|
|
10
|
+
import {Switch} from "./Switch";
|
|
11
|
+
import {TextArea} from "./TextArea";
|
|
12
|
+
import {TextField} from "./TextField";
|
|
13
|
+
|
|
14
|
+
interface State {
|
|
15
|
+
value: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class Field extends React.Component<FieldProps, State> {
|
|
19
|
+
constructor(props: FieldProps) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.state = {value: props.initialValue || ""};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
UNSAFE_componentWillReceiveProps(nextProps: FieldProps) {
|
|
25
|
+
if (nextProps.initialValue !== this.state.value) {
|
|
26
|
+
this.setState({value: nextProps.initialValue});
|
|
27
|
+
}
|
|
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);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
handleSwitchChange = (value: boolean) => {
|
|
43
|
+
this.setState({value});
|
|
44
|
+
if (this.props.handleChange) {
|
|
45
|
+
this.props.handleChange(this.props.name, value);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
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)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
switch (this.props.type) {
|
|
55
|
+
case "boolean":
|
|
56
|
+
return true;
|
|
57
|
+
case "currency":
|
|
58
|
+
return true;
|
|
59
|
+
case "date":
|
|
60
|
+
return !this.state.value || isDate(this.state.value);
|
|
61
|
+
case "email":
|
|
62
|
+
return (
|
|
63
|
+
!this.state.value ||
|
|
64
|
+
(this.state.value.search("@") > -1 && this.state.value.search(".") > -1)
|
|
65
|
+
);
|
|
66
|
+
case "number":
|
|
67
|
+
return !this.state.value || isNumber(this.state.value);
|
|
68
|
+
case "password":
|
|
69
|
+
return true;
|
|
70
|
+
case "percent":
|
|
71
|
+
return !this.state.value || isNumber(this.state.value.replace("%", ""));
|
|
72
|
+
case "select":
|
|
73
|
+
return true;
|
|
74
|
+
case "text":
|
|
75
|
+
case undefined: // text is default
|
|
76
|
+
return true;
|
|
77
|
+
case "textarea":
|
|
78
|
+
return true;
|
|
79
|
+
case "url":
|
|
80
|
+
return true;
|
|
81
|
+
default:
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
renderField() {
|
|
87
|
+
if (this.props.type === "select") {
|
|
88
|
+
if (!this.props.options) {
|
|
89
|
+
console.error("Field with type=select require options");
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return (
|
|
93
|
+
<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}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
} else if (this.props.type === "textarea") {
|
|
102
|
+
return (
|
|
103
|
+
<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)}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
} else if (this.props.type === "boolean") {
|
|
113
|
+
return (
|
|
114
|
+
<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)}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
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);
|
|
126
|
+
return (
|
|
127
|
+
<TextField
|
|
128
|
+
disabled
|
|
129
|
+
id={this.props.name}
|
|
130
|
+
placeholder={this.props.placeholder}
|
|
131
|
+
type="text"
|
|
132
|
+
// TODO: allow editing with a date picker
|
|
133
|
+
value={value.format("MM/DD/YYYY HH:mmA")}
|
|
134
|
+
onChange={(result) => this.handleChange(result.value)}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
} else {
|
|
138
|
+
let type: TextFieldType = "text";
|
|
139
|
+
// Number is supported differently because we need fractional numbers and they don't work
|
|
140
|
+
// 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") {
|
|
144
|
+
type = "text";
|
|
145
|
+
}
|
|
146
|
+
let autoComplete: "on" | "current-password" | "username" = "on";
|
|
147
|
+
if (type === "password") {
|
|
148
|
+
autoComplete = "current-password";
|
|
149
|
+
} else if (type === "email") {
|
|
150
|
+
autoComplete = "username";
|
|
151
|
+
}
|
|
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") {
|
|
156
|
+
// value = `$${Number(value).toFixed(2)}`;
|
|
157
|
+
// }
|
|
158
|
+
// console.log("VAL", value);
|
|
159
|
+
return (
|
|
160
|
+
<TextField
|
|
161
|
+
autoComplete={autoComplete}
|
|
162
|
+
disabled={this.props.disabled}
|
|
163
|
+
id={this.props.name}
|
|
164
|
+
placeholder={this.props.placeholder}
|
|
165
|
+
type={type as "date" | "email" | "number" | "password" | "text" | "url"}
|
|
166
|
+
value={value}
|
|
167
|
+
onChange={(result) => this.handleChange(result.value)}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
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
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {FieldWithLabelsProps} from "./Common";
|
|
4
|
+
import {WithLabel} from "./WithLabel";
|
|
5
|
+
|
|
6
|
+
export const FieldWithLabels = ({
|
|
7
|
+
children,
|
|
8
|
+
errorMessage,
|
|
9
|
+
errorMessageColor = "red",
|
|
10
|
+
helperText,
|
|
11
|
+
helperTextColor = "darkGray",
|
|
12
|
+
label,
|
|
13
|
+
labelColor = "darkGray",
|
|
14
|
+
}: FieldWithLabelsProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<WithLabel
|
|
17
|
+
label={helperText}
|
|
18
|
+
labelColor={helperTextColor}
|
|
19
|
+
labelPlacement="after"
|
|
20
|
+
labelSize="sm"
|
|
21
|
+
show={Boolean(helperText)}
|
|
22
|
+
>
|
|
23
|
+
<WithLabel
|
|
24
|
+
label={errorMessage}
|
|
25
|
+
labelColor={errorMessageColor}
|
|
26
|
+
labelPlacement="after"
|
|
27
|
+
labelSize="md"
|
|
28
|
+
show={Boolean(errorMessage)}
|
|
29
|
+
>
|
|
30
|
+
<WithLabel label={label} labelColor={labelColor} show={Boolean(label)}>
|
|
31
|
+
{children}
|
|
32
|
+
</WithLabel>
|
|
33
|
+
</WithLabel>
|
|
34
|
+
</WithLabel>
|
|
35
|
+
);
|
|
36
|
+
};
|
package/src/FlatList.tsx
ADDED
package/src/Form.tsx
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import {Button} from "./Button";
|
|
5
|
+
import {IconButton} from "./IconButton";
|
|
6
|
+
import {SelectList} from "./SelectList";
|
|
7
|
+
import {Switch} from "./Switch";
|
|
8
|
+
import {Text} from "./Text";
|
|
9
|
+
import {TextArea} from "./TextArea";
|
|
10
|
+
import {TextField} from "./TextField";
|
|
11
|
+
|
|
12
|
+
function objToJoinedString(obj: any) {
|
|
13
|
+
return Object.keys(obj || {})
|
|
14
|
+
.map((k) => (obj[k] ? k : undefined))
|
|
15
|
+
.filter((v) => v)
|
|
16
|
+
.join(", ");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface FormLineProps {
|
|
20
|
+
name: string;
|
|
21
|
+
value: any;
|
|
22
|
+
onSave: (value: any) => void;
|
|
23
|
+
kind: "boolean" | "string" | "textarea" | "select" | "multiboolean";
|
|
24
|
+
options?: (string | undefined)[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface FormLineState {
|
|
28
|
+
editing: boolean;
|
|
29
|
+
value: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class FormLine extends React.Component<FormLineProps, FormLineState> {
|
|
33
|
+
constructor(props: FormLineProps) {
|
|
34
|
+
super(props);
|
|
35
|
+
this.state = {editing: false, value: ""};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
renderMultiBoolean() {
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<Box marginRight={2}>
|
|
42
|
+
<Text weight="bold">{this.props.name}</Text>
|
|
43
|
+
</Box>
|
|
44
|
+
<Box direction="column" display="flex">
|
|
45
|
+
{Object.keys(this.props.value).map((k) => (
|
|
46
|
+
<>
|
|
47
|
+
<Text weight="bold">{k}</Text>
|
|
48
|
+
<Switch
|
|
49
|
+
id={k}
|
|
50
|
+
switched={this.state.value[k]}
|
|
51
|
+
onChange={() => {
|
|
52
|
+
this.setState({value: {...this.state.value, [k]: !this.state.value[k]}});
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</>
|
|
56
|
+
))}
|
|
57
|
+
</Box>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
renderBooleanField() {
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<Box marginRight={2}>
|
|
66
|
+
<Text weight="bold">{this.props.name}</Text>
|
|
67
|
+
</Box>
|
|
68
|
+
<Switch
|
|
69
|
+
id={this.props.name}
|
|
70
|
+
switched={this.state.value}
|
|
71
|
+
onChange={() => this.setState({value: !this.state.value})}
|
|
72
|
+
/>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
renderTextField() {
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<Box marginRight={2}>
|
|
81
|
+
<Text weight="bold">{this.props.name}</Text>
|
|
82
|
+
</Box>
|
|
83
|
+
<TextField
|
|
84
|
+
id={this.props.name}
|
|
85
|
+
value={this.state.value}
|
|
86
|
+
onChange={(result) => this.setState({value: result.value})}
|
|
87
|
+
/>
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
renderTextArea() {
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
<Box marginRight={2}>
|
|
96
|
+
<Text weight="bold">{this.props.name}</Text>
|
|
97
|
+
</Box>
|
|
98
|
+
<TextArea
|
|
99
|
+
id={this.props.name}
|
|
100
|
+
value={this.state.value}
|
|
101
|
+
onChange={(result) => this.setState({value: result.value})}
|
|
102
|
+
/>
|
|
103
|
+
<Button size="sm" text="Save" onClick={() => this.props.onSave(this.state.value)} />
|
|
104
|
+
</>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
renderSelect() {
|
|
109
|
+
return (
|
|
110
|
+
<>
|
|
111
|
+
<Box marginRight={2}>
|
|
112
|
+
<Text weight="bold">{this.props.name}</Text>
|
|
113
|
+
</Box>
|
|
114
|
+
<SelectList
|
|
115
|
+
id={this.props.name}
|
|
116
|
+
options={(this.props.options || []).map((o) => ({label: o ?? "---", value: o}))}
|
|
117
|
+
value={this.state.value}
|
|
118
|
+
onChange={(result) => {
|
|
119
|
+
this.setState({value: result});
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
render() {
|
|
127
|
+
if (!this.state.editing) {
|
|
128
|
+
let text = this.props.value;
|
|
129
|
+
if (text === undefined) {
|
|
130
|
+
text = " - ";
|
|
131
|
+
}
|
|
132
|
+
if (typeof text === "object") {
|
|
133
|
+
text = objToJoinedString(text);
|
|
134
|
+
}
|
|
135
|
+
return (
|
|
136
|
+
<Box direction="row" display="flex">
|
|
137
|
+
<IconButton
|
|
138
|
+
accessibilityLabel="edit"
|
|
139
|
+
icon="edit"
|
|
140
|
+
iconColor="darkGray"
|
|
141
|
+
prefix="far"
|
|
142
|
+
size="xs"
|
|
143
|
+
onClick={() => this.setState({editing: true, value: this.props.value})}
|
|
144
|
+
/>
|
|
145
|
+
<Box marginRight={2}>
|
|
146
|
+
<Text weight="bold">{this.props.name}: </Text>
|
|
147
|
+
</Box>
|
|
148
|
+
<Text>{text}</Text>
|
|
149
|
+
</Box>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
return (
|
|
153
|
+
<Box direction="row" display="flex">
|
|
154
|
+
<IconButton
|
|
155
|
+
accessibilityLabel="edit"
|
|
156
|
+
icon="cancel"
|
|
157
|
+
iconColor="darkGray"
|
|
158
|
+
prefix="far"
|
|
159
|
+
size="xs"
|
|
160
|
+
onClick={() => this.setState({editing: false})}
|
|
161
|
+
/>
|
|
162
|
+
{this.props.kind === "boolean" && this.renderBooleanField()}
|
|
163
|
+
{this.props.kind === "multiboolean" && this.renderMultiBoolean()}
|
|
164
|
+
|
|
165
|
+
{this.props.kind === "string" && this.renderTextField()}
|
|
166
|
+
{this.props.kind === "textarea" && this.renderTextArea()}
|
|
167
|
+
{this.props.kind === "select" && this.renderSelect()}
|
|
168
|
+
<Box width={60}>
|
|
169
|
+
<Button
|
|
170
|
+
color="blue"
|
|
171
|
+
size="sm"
|
|
172
|
+
text="Save"
|
|
173
|
+
onClick={() => {
|
|
174
|
+
this.props.onSave(this.state.value);
|
|
175
|
+
this.setState({editing: false});
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
</Box>
|
|
179
|
+
</Box>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|