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,673 @@
|
|
|
1
|
+
// MIT License
|
|
2
|
+
|
|
3
|
+
// Copyright (c) LawnStarter
|
|
4
|
+
|
|
5
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
// in the Software without restriction, including without limitation the rights
|
|
8
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
// furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
// copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
// SOFTWARE.
|
|
22
|
+
|
|
23
|
+
// Forked 2021/11/26 by Josh Gachnang <josh@nang.io> from version 8.0.3 because it conflicted
|
|
24
|
+
// with react-native-picker in Expo, then converted to TS.
|
|
25
|
+
|
|
26
|
+
import {Picker} from "@react-native-picker/picker";
|
|
27
|
+
import isEqual from "lodash/isEqual";
|
|
28
|
+
import PropTypes from "prop-types";
|
|
29
|
+
import React, {PureComponent} from "react";
|
|
30
|
+
import {
|
|
31
|
+
Keyboard,
|
|
32
|
+
Modal,
|
|
33
|
+
Platform,
|
|
34
|
+
StyleSheet,
|
|
35
|
+
Text,
|
|
36
|
+
TextInput,
|
|
37
|
+
TouchableOpacity,
|
|
38
|
+
View,
|
|
39
|
+
} from "react-native";
|
|
40
|
+
|
|
41
|
+
const defaultStyles = StyleSheet.create({
|
|
42
|
+
viewContainer: {
|
|
43
|
+
alignSelf: "stretch",
|
|
44
|
+
},
|
|
45
|
+
iconContainer: {
|
|
46
|
+
position: "absolute",
|
|
47
|
+
right: 0,
|
|
48
|
+
},
|
|
49
|
+
modalViewTop: {
|
|
50
|
+
flex: 1,
|
|
51
|
+
},
|
|
52
|
+
modalViewMiddle: {
|
|
53
|
+
height: 45,
|
|
54
|
+
flexDirection: "row",
|
|
55
|
+
justifyContent: "space-between",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
paddingHorizontal: 10,
|
|
58
|
+
backgroundColor: "#f8f8f8",
|
|
59
|
+
borderTopWidth: 1,
|
|
60
|
+
borderTopColor: "#dedede",
|
|
61
|
+
zIndex: 2,
|
|
62
|
+
},
|
|
63
|
+
chevronContainer: {
|
|
64
|
+
flexDirection: "row",
|
|
65
|
+
},
|
|
66
|
+
chevron: {
|
|
67
|
+
width: 15,
|
|
68
|
+
height: 15,
|
|
69
|
+
backgroundColor: "transparent",
|
|
70
|
+
borderColor: "#a1a1a1",
|
|
71
|
+
borderTopWidth: 1.5,
|
|
72
|
+
borderRightWidth: 1.5,
|
|
73
|
+
},
|
|
74
|
+
chevronUp: {
|
|
75
|
+
marginLeft: 11,
|
|
76
|
+
transform: [{translateY: 4}, {rotate: "-45deg"}],
|
|
77
|
+
},
|
|
78
|
+
chevronDown: {
|
|
79
|
+
marginLeft: 22,
|
|
80
|
+
transform: [{translateY: -5}, {rotate: "135deg"}],
|
|
81
|
+
},
|
|
82
|
+
chevronActive: {
|
|
83
|
+
borderColor: "#007aff",
|
|
84
|
+
},
|
|
85
|
+
done: {
|
|
86
|
+
color: "#007aff",
|
|
87
|
+
fontWeight: "600",
|
|
88
|
+
fontSize: 17,
|
|
89
|
+
paddingTop: 1,
|
|
90
|
+
paddingRight: 11,
|
|
91
|
+
},
|
|
92
|
+
doneDepressed: {
|
|
93
|
+
fontSize: 19,
|
|
94
|
+
},
|
|
95
|
+
modalViewBottom: {
|
|
96
|
+
justifyContent: "center",
|
|
97
|
+
backgroundColor: "#d0d4da",
|
|
98
|
+
},
|
|
99
|
+
placeholder: {
|
|
100
|
+
color: "#c7c7cd",
|
|
101
|
+
},
|
|
102
|
+
headlessAndroidPicker: {
|
|
103
|
+
position: "absolute",
|
|
104
|
+
width: "100%",
|
|
105
|
+
height: "100%",
|
|
106
|
+
color: "transparent",
|
|
107
|
+
opacity: 0,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export default class RNPickerSelect extends PureComponent<any, any> {
|
|
112
|
+
static propTypes = {
|
|
113
|
+
onValueChange: PropTypes.func.isRequired,
|
|
114
|
+
items: PropTypes.arrayOf(
|
|
115
|
+
PropTypes.shape({
|
|
116
|
+
label: PropTypes.string.isRequired,
|
|
117
|
+
value: PropTypes.any.isRequired,
|
|
118
|
+
inputLabel: PropTypes.string,
|
|
119
|
+
key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
120
|
+
color: PropTypes.string,
|
|
121
|
+
})
|
|
122
|
+
).isRequired,
|
|
123
|
+
value: PropTypes.any, // eslint-disable-line react/forbid-prop-types
|
|
124
|
+
placeholder: PropTypes.shape({
|
|
125
|
+
label: PropTypes.string,
|
|
126
|
+
value: PropTypes.any,
|
|
127
|
+
key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
128
|
+
color: PropTypes.string,
|
|
129
|
+
}),
|
|
130
|
+
disabled: PropTypes.bool,
|
|
131
|
+
itemKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
132
|
+
style: PropTypes.shape({}),
|
|
133
|
+
children: PropTypes.any, // eslint-disable-line react/forbid-prop-types
|
|
134
|
+
onOpen: PropTypes.func,
|
|
135
|
+
useNativeAndroidPickerStyle: PropTypes.bool,
|
|
136
|
+
fixAndroidTouchableBug: PropTypes.bool,
|
|
137
|
+
|
|
138
|
+
// Custom Modal props (iOS only)
|
|
139
|
+
doneText: PropTypes.string,
|
|
140
|
+
onDonePress: PropTypes.func,
|
|
141
|
+
onUpArrow: PropTypes.func,
|
|
142
|
+
onDownArrow: PropTypes.func,
|
|
143
|
+
onClose: PropTypes.func,
|
|
144
|
+
|
|
145
|
+
// Modal props (iOS only)
|
|
146
|
+
modalProps: PropTypes.shape({}),
|
|
147
|
+
|
|
148
|
+
// TextInput props
|
|
149
|
+
textInputProps: PropTypes.shape({}),
|
|
150
|
+
|
|
151
|
+
// Picker props
|
|
152
|
+
pickerProps: PropTypes.shape({}),
|
|
153
|
+
|
|
154
|
+
// Touchable Done props (iOS only)
|
|
155
|
+
touchableDoneProps: PropTypes.shape({}),
|
|
156
|
+
|
|
157
|
+
// Touchable wrapper props
|
|
158
|
+
touchableWrapperProps: PropTypes.shape({}),
|
|
159
|
+
|
|
160
|
+
// Custom Icon
|
|
161
|
+
Icon: PropTypes.func,
|
|
162
|
+
InputAccessoryView: PropTypes.func,
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
static defaultProps = {
|
|
166
|
+
value: undefined,
|
|
167
|
+
placeholder: {
|
|
168
|
+
label: "Select an item...",
|
|
169
|
+
value: null,
|
|
170
|
+
color: "#9EA0A4",
|
|
171
|
+
},
|
|
172
|
+
disabled: false,
|
|
173
|
+
itemKey: null,
|
|
174
|
+
style: {},
|
|
175
|
+
children: null,
|
|
176
|
+
useNativeAndroidPickerStyle: true,
|
|
177
|
+
fixAndroidTouchableBug: false,
|
|
178
|
+
doneText: "Done",
|
|
179
|
+
onDonePress: null,
|
|
180
|
+
onUpArrow: null,
|
|
181
|
+
onDownArrow: null,
|
|
182
|
+
onOpen: null,
|
|
183
|
+
onClose: null,
|
|
184
|
+
modalProps: {},
|
|
185
|
+
textInputProps: {},
|
|
186
|
+
pickerProps: {},
|
|
187
|
+
touchableDoneProps: {},
|
|
188
|
+
touchableWrapperProps: {},
|
|
189
|
+
Icon: null,
|
|
190
|
+
InputAccessoryView: null,
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
inputRef: any;
|
|
194
|
+
|
|
195
|
+
static handlePlaceholder({placeholder}: any) {
|
|
196
|
+
if (isEqual(placeholder, {})) {
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
return [placeholder];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
static getSelectedItem({items, key, value}: any) {
|
|
203
|
+
let idx = items.findIndex((item: any) => {
|
|
204
|
+
if (item.key && key) {
|
|
205
|
+
return isEqual(item.key, key);
|
|
206
|
+
}
|
|
207
|
+
return isEqual(item.value, value);
|
|
208
|
+
});
|
|
209
|
+
if (idx === -1) {
|
|
210
|
+
idx = 0;
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
selectedItem: items[idx] || {},
|
|
214
|
+
idx,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
constructor(props: any) {
|
|
219
|
+
super(props);
|
|
220
|
+
|
|
221
|
+
const items = RNPickerSelect.handlePlaceholder({
|
|
222
|
+
placeholder: props.placeholder,
|
|
223
|
+
}).concat(props.items);
|
|
224
|
+
|
|
225
|
+
const {selectedItem} = RNPickerSelect.getSelectedItem({
|
|
226
|
+
items,
|
|
227
|
+
key: props.itemKey,
|
|
228
|
+
value: props.value,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
this.state = {
|
|
232
|
+
items,
|
|
233
|
+
selectedItem,
|
|
234
|
+
showPicker: false,
|
|
235
|
+
animationType: undefined,
|
|
236
|
+
orientation: "portrait",
|
|
237
|
+
doneDepressed: false,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
this.onUpArrow = this.onUpArrow.bind(this);
|
|
241
|
+
this.onDownArrow = this.onDownArrow.bind(this);
|
|
242
|
+
this.onValueChange = this.onValueChange.bind(this);
|
|
243
|
+
this.onOrientationChange = this.onOrientationChange.bind(this);
|
|
244
|
+
this.setInputRef = this.setInputRef.bind(this);
|
|
245
|
+
this.togglePicker = this.togglePicker.bind(this);
|
|
246
|
+
this.renderInputAccessoryView = this.renderInputAccessoryView.bind(this);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
componentDidUpdate(prevProps: Readonly<any>, prevState: Readonly<any>) {
|
|
250
|
+
// update items if items or placeholder prop changes
|
|
251
|
+
const items = RNPickerSelect.handlePlaceholder({
|
|
252
|
+
placeholder: this.props.placeholder,
|
|
253
|
+
}).concat(this.props.items);
|
|
254
|
+
const itemsChanged = !isEqual(prevState.items, items);
|
|
255
|
+
|
|
256
|
+
// update selectedItem if value prop is defined and differs from currently selected item
|
|
257
|
+
const {selectedItem, idx} = RNPickerSelect.getSelectedItem({
|
|
258
|
+
items,
|
|
259
|
+
key: this.props.itemKey,
|
|
260
|
+
value: this.props.value,
|
|
261
|
+
});
|
|
262
|
+
const selectedItemChanged =
|
|
263
|
+
!isEqual(this.props.value, undefined) && !isEqual(prevState.selectedItem, selectedItem);
|
|
264
|
+
|
|
265
|
+
if (itemsChanged || selectedItemChanged) {
|
|
266
|
+
this.props.onValueChange(selectedItem.value, idx);
|
|
267
|
+
|
|
268
|
+
this.setState({
|
|
269
|
+
...(itemsChanged ? {items} : {}),
|
|
270
|
+
...(selectedItemChanged ? {selectedItem} : {}),
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
onUpArrow() {
|
|
276
|
+
const {onUpArrow} = this.props;
|
|
277
|
+
|
|
278
|
+
this.togglePicker(false, onUpArrow);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
onDownArrow() {
|
|
282
|
+
const {onDownArrow} = this.props;
|
|
283
|
+
|
|
284
|
+
this.togglePicker(false, onDownArrow);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
onValueChange(value: any, index: any) {
|
|
288
|
+
const {onValueChange} = this.props;
|
|
289
|
+
|
|
290
|
+
onValueChange(value, index);
|
|
291
|
+
|
|
292
|
+
this.setState((prevState: any) => {
|
|
293
|
+
return {
|
|
294
|
+
selectedItem: prevState.items[index],
|
|
295
|
+
};
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
onOrientationChange({nativeEvent}: any) {
|
|
300
|
+
this.setState({
|
|
301
|
+
orientation: nativeEvent.orientation,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
setInputRef(ref: any) {
|
|
306
|
+
this.inputRef = ref;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
getPlaceholderStyle() {
|
|
310
|
+
const {placeholder, style} = this.props;
|
|
311
|
+
const {selectedItem} = this.state;
|
|
312
|
+
|
|
313
|
+
if (!isEqual(placeholder, {}) && selectedItem.label === placeholder.label) {
|
|
314
|
+
return {
|
|
315
|
+
...defaultStyles.placeholder,
|
|
316
|
+
...style.placeholder,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
return {};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
triggerOpenCloseCallbacks() {
|
|
323
|
+
const {onOpen, onClose} = this.props;
|
|
324
|
+
const {showPicker} = this.state;
|
|
325
|
+
|
|
326
|
+
if (!showPicker && onOpen) {
|
|
327
|
+
onOpen();
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (showPicker && onClose) {
|
|
331
|
+
onClose();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
togglePicker(animate = false, postToggleCallback?: any) {
|
|
336
|
+
const {modalProps, disabled} = this.props;
|
|
337
|
+
const {showPicker} = this.state;
|
|
338
|
+
|
|
339
|
+
if (disabled) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (!showPicker) {
|
|
344
|
+
Keyboard.dismiss();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const animationType =
|
|
348
|
+
modalProps && modalProps.animationType ? modalProps.animationType : "slide";
|
|
349
|
+
|
|
350
|
+
this.triggerOpenCloseCallbacks();
|
|
351
|
+
|
|
352
|
+
this.setState(
|
|
353
|
+
(prevState: any) => {
|
|
354
|
+
return {
|
|
355
|
+
animationType: animate ? animationType : undefined,
|
|
356
|
+
showPicker: !prevState.showPicker,
|
|
357
|
+
};
|
|
358
|
+
},
|
|
359
|
+
() => {
|
|
360
|
+
if (postToggleCallback) {
|
|
361
|
+
postToggleCallback();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
renderPickerItems() {
|
|
368
|
+
const {items} = this.state;
|
|
369
|
+
|
|
370
|
+
return items.map((item: any) => {
|
|
371
|
+
return (
|
|
372
|
+
<Picker.Item
|
|
373
|
+
key={item.key || item.label}
|
|
374
|
+
color={item.color}
|
|
375
|
+
label={item.label}
|
|
376
|
+
value={item.value}
|
|
377
|
+
/>
|
|
378
|
+
);
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
renderInputAccessoryView() {
|
|
383
|
+
const {
|
|
384
|
+
InputAccessoryView,
|
|
385
|
+
doneText,
|
|
386
|
+
onUpArrow,
|
|
387
|
+
onDownArrow,
|
|
388
|
+
onDonePress,
|
|
389
|
+
style,
|
|
390
|
+
touchableDoneProps,
|
|
391
|
+
} = this.props;
|
|
392
|
+
|
|
393
|
+
const {doneDepressed} = this.state;
|
|
394
|
+
|
|
395
|
+
if (InputAccessoryView) {
|
|
396
|
+
return <InputAccessoryView testID="custom_input_accessory_view" />;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return (
|
|
400
|
+
<View
|
|
401
|
+
style={[defaultStyles.modalViewMiddle, style.modalViewMiddle]}
|
|
402
|
+
testID="input_accessory_view"
|
|
403
|
+
>
|
|
404
|
+
<View style={[defaultStyles.chevronContainer, style.chevronContainer]}>
|
|
405
|
+
<TouchableOpacity
|
|
406
|
+
activeOpacity={onUpArrow ? 0.5 : 1}
|
|
407
|
+
onPress={onUpArrow ? this.onUpArrow : undefined}
|
|
408
|
+
>
|
|
409
|
+
<View
|
|
410
|
+
style={[
|
|
411
|
+
defaultStyles.chevron,
|
|
412
|
+
style.chevron,
|
|
413
|
+
defaultStyles.chevronUp,
|
|
414
|
+
style.chevronUp,
|
|
415
|
+
onUpArrow ? [defaultStyles.chevronActive, style.chevronActive] : {},
|
|
416
|
+
]}
|
|
417
|
+
/>
|
|
418
|
+
</TouchableOpacity>
|
|
419
|
+
<TouchableOpacity
|
|
420
|
+
activeOpacity={onDownArrow ? 0.5 : 1}
|
|
421
|
+
onPress={onDownArrow ? this.onDownArrow : undefined}
|
|
422
|
+
>
|
|
423
|
+
<View
|
|
424
|
+
style={[
|
|
425
|
+
defaultStyles.chevron,
|
|
426
|
+
style.chevron,
|
|
427
|
+
defaultStyles.chevronDown,
|
|
428
|
+
style.chevronDown,
|
|
429
|
+
onDownArrow ? [defaultStyles.chevronActive, style.chevronActive] : {},
|
|
430
|
+
]}
|
|
431
|
+
/>
|
|
432
|
+
</TouchableOpacity>
|
|
433
|
+
</View>
|
|
434
|
+
<TouchableOpacity
|
|
435
|
+
hitSlop={{top: 4, right: 4, bottom: 4, left: 4}}
|
|
436
|
+
testID="done_button"
|
|
437
|
+
onPress={() => {
|
|
438
|
+
this.togglePicker(true, onDonePress);
|
|
439
|
+
}}
|
|
440
|
+
onPressIn={() => {
|
|
441
|
+
this.setState({doneDepressed: true});
|
|
442
|
+
}}
|
|
443
|
+
onPressOut={() => {
|
|
444
|
+
this.setState({doneDepressed: false});
|
|
445
|
+
}}
|
|
446
|
+
{...touchableDoneProps}
|
|
447
|
+
>
|
|
448
|
+
<View testID="needed_for_touchable">
|
|
449
|
+
<Text
|
|
450
|
+
allowFontScaling={false}
|
|
451
|
+
style={[
|
|
452
|
+
defaultStyles.done,
|
|
453
|
+
style.done,
|
|
454
|
+
doneDepressed ? [defaultStyles.doneDepressed, style.doneDepressed] : {},
|
|
455
|
+
]}
|
|
456
|
+
testID="done_text"
|
|
457
|
+
>
|
|
458
|
+
{doneText}
|
|
459
|
+
</Text>
|
|
460
|
+
</View>
|
|
461
|
+
</TouchableOpacity>
|
|
462
|
+
</View>
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
renderIcon() {
|
|
467
|
+
const {style, Icon} = this.props;
|
|
468
|
+
|
|
469
|
+
if (!Icon) {
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return (
|
|
474
|
+
<View style={[defaultStyles.iconContainer, style.iconContainer]} testID="icon_container">
|
|
475
|
+
<Icon testID="icon" />
|
|
476
|
+
</View>
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
renderTextInputOrChildren() {
|
|
481
|
+
const {children, style, textInputProps} = this.props;
|
|
482
|
+
const {selectedItem} = this.state;
|
|
483
|
+
|
|
484
|
+
const containerStyle =
|
|
485
|
+
Platform.OS === "ios" ? style.inputIOSContainer : style.inputAndroidContainer;
|
|
486
|
+
|
|
487
|
+
if (children) {
|
|
488
|
+
return (
|
|
489
|
+
<View pointerEvents="box-only" style={containerStyle}>
|
|
490
|
+
{children}
|
|
491
|
+
</View>
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return (
|
|
496
|
+
<View pointerEvents="box-only" style={containerStyle}>
|
|
497
|
+
<TextInput
|
|
498
|
+
ref={this.setInputRef}
|
|
499
|
+
editable={false}
|
|
500
|
+
style={[
|
|
501
|
+
Platform.OS === "ios" ? style.inputIOS : style.inputAndroid,
|
|
502
|
+
this.getPlaceholderStyle(),
|
|
503
|
+
]}
|
|
504
|
+
testID="text_input"
|
|
505
|
+
value={selectedItem.inputLabel ? selectedItem.inputLabel : selectedItem.label}
|
|
506
|
+
{...textInputProps}
|
|
507
|
+
/>
|
|
508
|
+
{this.renderIcon()}
|
|
509
|
+
</View>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
renderIOS() {
|
|
514
|
+
const {style, modalProps, pickerProps, touchableWrapperProps} = this.props;
|
|
515
|
+
const {animationType, orientation, selectedItem, showPicker} = this.state;
|
|
516
|
+
|
|
517
|
+
return (
|
|
518
|
+
<View style={[defaultStyles.viewContainer, style.viewContainer]}>
|
|
519
|
+
<TouchableOpacity
|
|
520
|
+
activeOpacity={1}
|
|
521
|
+
testID="ios_touchable_wrapper"
|
|
522
|
+
onPress={() => {
|
|
523
|
+
this.togglePicker(true);
|
|
524
|
+
}}
|
|
525
|
+
{...touchableWrapperProps}
|
|
526
|
+
>
|
|
527
|
+
{this.renderTextInputOrChildren()}
|
|
528
|
+
</TouchableOpacity>
|
|
529
|
+
<Modal
|
|
530
|
+
animationType={animationType}
|
|
531
|
+
supportedOrientations={["portrait", "landscape"]}
|
|
532
|
+
testID="ios_modal"
|
|
533
|
+
transparent
|
|
534
|
+
visible={showPicker}
|
|
535
|
+
onOrientationChange={this.onOrientationChange}
|
|
536
|
+
{...modalProps}
|
|
537
|
+
>
|
|
538
|
+
<TouchableOpacity
|
|
539
|
+
style={[defaultStyles.modalViewTop, style.modalViewTop]}
|
|
540
|
+
testID="ios_modal_top"
|
|
541
|
+
onPress={() => {
|
|
542
|
+
this.togglePicker(true);
|
|
543
|
+
}}
|
|
544
|
+
/>
|
|
545
|
+
{this.renderInputAccessoryView()}
|
|
546
|
+
<View
|
|
547
|
+
style={[
|
|
548
|
+
defaultStyles.modalViewBottom,
|
|
549
|
+
{height: orientation === "portrait" ? 215 : 162},
|
|
550
|
+
style.modalViewBottom,
|
|
551
|
+
]}
|
|
552
|
+
>
|
|
553
|
+
<Picker
|
|
554
|
+
selectedValue={selectedItem.value}
|
|
555
|
+
testID="ios_picker"
|
|
556
|
+
onValueChange={this.onValueChange}
|
|
557
|
+
{...pickerProps}
|
|
558
|
+
>
|
|
559
|
+
{this.renderPickerItems()}
|
|
560
|
+
</Picker>
|
|
561
|
+
</View>
|
|
562
|
+
</Modal>
|
|
563
|
+
</View>
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
renderAndroidHeadless() {
|
|
568
|
+
const {
|
|
569
|
+
disabled,
|
|
570
|
+
Icon,
|
|
571
|
+
style,
|
|
572
|
+
pickerProps,
|
|
573
|
+
onOpen,
|
|
574
|
+
touchableWrapperProps,
|
|
575
|
+
fixAndroidTouchableBug,
|
|
576
|
+
} = this.props;
|
|
577
|
+
const {selectedItem} = this.state;
|
|
578
|
+
|
|
579
|
+
const Component: any = fixAndroidTouchableBug ? View : TouchableOpacity;
|
|
580
|
+
return (
|
|
581
|
+
<Component
|
|
582
|
+
activeOpacity={1}
|
|
583
|
+
testID="android_touchable_wrapper"
|
|
584
|
+
onPress={onOpen}
|
|
585
|
+
{...touchableWrapperProps}
|
|
586
|
+
>
|
|
587
|
+
<View style={style.headlessAndroidContainer}>
|
|
588
|
+
{this.renderTextInputOrChildren()}
|
|
589
|
+
<Picker
|
|
590
|
+
enabled={!disabled}
|
|
591
|
+
selectedValue={selectedItem.value}
|
|
592
|
+
style={[
|
|
593
|
+
Icon ? {backgroundColor: "transparent"} : {}, // to hide native icon
|
|
594
|
+
defaultStyles.headlessAndroidPicker,
|
|
595
|
+
style.headlessAndroidPicker,
|
|
596
|
+
]}
|
|
597
|
+
testID="android_picker_headless"
|
|
598
|
+
onValueChange={this.onValueChange}
|
|
599
|
+
{...pickerProps}
|
|
600
|
+
>
|
|
601
|
+
{this.renderPickerItems()}
|
|
602
|
+
</Picker>
|
|
603
|
+
</View>
|
|
604
|
+
</Component>
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
renderAndroidNativePickerStyle() {
|
|
609
|
+
const {disabled, Icon, style, pickerProps} = this.props;
|
|
610
|
+
const {selectedItem} = this.state;
|
|
611
|
+
|
|
612
|
+
return (
|
|
613
|
+
<View style={[defaultStyles.viewContainer, style.viewContainer]}>
|
|
614
|
+
<Picker
|
|
615
|
+
enabled={!disabled}
|
|
616
|
+
selectedValue={selectedItem.value}
|
|
617
|
+
style={[
|
|
618
|
+
Icon ? {backgroundColor: "transparent"} : {}, // to hide native icon
|
|
619
|
+
style.inputAndroid,
|
|
620
|
+
this.getPlaceholderStyle(),
|
|
621
|
+
]}
|
|
622
|
+
testID="android_picker"
|
|
623
|
+
onValueChange={this.onValueChange}
|
|
624
|
+
{...pickerProps}
|
|
625
|
+
>
|
|
626
|
+
{this.renderPickerItems()}
|
|
627
|
+
</Picker>
|
|
628
|
+
{this.renderIcon()}
|
|
629
|
+
</View>
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
renderWeb() {
|
|
634
|
+
const {disabled, style, pickerProps} = this.props;
|
|
635
|
+
const {selectedItem} = this.state;
|
|
636
|
+
|
|
637
|
+
return (
|
|
638
|
+
<View style={[defaultStyles.viewContainer, style.viewContainer]}>
|
|
639
|
+
<Picker
|
|
640
|
+
enabled={!disabled}
|
|
641
|
+
selectedValue={selectedItem.value}
|
|
642
|
+
style={style.inputWeb}
|
|
643
|
+
testID="web_picker"
|
|
644
|
+
onValueChange={this.onValueChange}
|
|
645
|
+
{...pickerProps}
|
|
646
|
+
>
|
|
647
|
+
{this.renderPickerItems()}
|
|
648
|
+
</Picker>
|
|
649
|
+
{this.renderIcon()}
|
|
650
|
+
</View>
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
render() {
|
|
655
|
+
const {children, useNativeAndroidPickerStyle} = this.props;
|
|
656
|
+
|
|
657
|
+
if (Platform.OS === "ios") {
|
|
658
|
+
return this.renderIOS();
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (Platform.OS === "web") {
|
|
662
|
+
return this.renderWeb();
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (children || !useNativeAndroidPickerStyle) {
|
|
666
|
+
return this.renderAndroidHeadless();
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return this.renderAndroidNativePickerStyle();
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export {defaultStyles};
|
package/src/Pill.tsx
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import {PillProps} from "./Common";
|
|
5
|
+
import {Text} from "./Text";
|
|
6
|
+
|
|
7
|
+
export class Pill extends React.Component<PillProps, {}> {
|
|
8
|
+
render() {
|
|
9
|
+
return (
|
|
10
|
+
<Box
|
|
11
|
+
border={this.props.color}
|
|
12
|
+
color={this.props.enabled ? this.props.color : "white"}
|
|
13
|
+
paddingX={4}
|
|
14
|
+
paddingY={2}
|
|
15
|
+
rounding="pill"
|
|
16
|
+
onClick={() => this.props.onClick(!this.props.enabled)}
|
|
17
|
+
>
|
|
18
|
+
<Text align="center" color={this.props.enabled ? "white" : this.props.color}>
|
|
19
|
+
{this.props.text}
|
|
20
|
+
</Text>
|
|
21
|
+
</Box>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|