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/Unifier.ts
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
3
|
+
|
|
4
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
5
|
+
import {Clipboard, Dimensions, Keyboard, Linking, Vibration} from "react-native";
|
|
6
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
7
|
+
|
|
8
|
+
import {PermissionKind, UnifiedTheme} from "./Common";
|
|
9
|
+
import {requestPermissions} from "./Permissions";
|
|
10
|
+
|
|
11
|
+
const DEFAULT_FONT = "Cochin";
|
|
12
|
+
const DEFAULT_BOLD_FONT = "Cochin";
|
|
13
|
+
|
|
14
|
+
const DefaultTheme: UnifiedTheme = {
|
|
15
|
+
// Primary colors
|
|
16
|
+
red: "#bd081c",
|
|
17
|
+
white: "#fdfdfd",
|
|
18
|
+
lightGray: "#efefef",
|
|
19
|
+
gray: "#8e8e8e",
|
|
20
|
+
darkGray: "#111",
|
|
21
|
+
// secondary colors
|
|
22
|
+
green: "#0fa573",
|
|
23
|
+
pine: "#0a6955",
|
|
24
|
+
olive: "#364a4c",
|
|
25
|
+
blue: "#4a90e2",
|
|
26
|
+
navy: "#004b91",
|
|
27
|
+
midnight: "#133a5e",
|
|
28
|
+
purple: "#b469eb",
|
|
29
|
+
orchid: "#8046a5",
|
|
30
|
+
eggplant: "#5b2677",
|
|
31
|
+
maroon: "#6e0f3c",
|
|
32
|
+
watermelon: "#f13535",
|
|
33
|
+
orange: "#e3780c",
|
|
34
|
+
black: "#000000",
|
|
35
|
+
|
|
36
|
+
primaryLighter: "#4ED456",
|
|
37
|
+
primaryLight: "#28CA32",
|
|
38
|
+
primary: "#00BD0C",
|
|
39
|
+
primaryDark: "#00960A",
|
|
40
|
+
primaryDarker: "#007508",
|
|
41
|
+
|
|
42
|
+
secondaryLighter: "#41AAAE",
|
|
43
|
+
secondaryLight: "#20989D",
|
|
44
|
+
secondary: "#018B91",
|
|
45
|
+
secondaryDark: "#016E73",
|
|
46
|
+
secondaryDarker: "#00565A",
|
|
47
|
+
|
|
48
|
+
accentLighter: "#FF625D",
|
|
49
|
+
accentLight: "#FF3732",
|
|
50
|
+
accent: "#F00600",
|
|
51
|
+
accentDark: "#BE0500",
|
|
52
|
+
accentDarker: "#950400",
|
|
53
|
+
|
|
54
|
+
tertiaryLighter: "#FFCF67",
|
|
55
|
+
tertiaryLight: "#FFC23E",
|
|
56
|
+
tertiary: "#FFB109",
|
|
57
|
+
tertiaryDark: "#CA8A00",
|
|
58
|
+
tertiaryDarker: "#9F6D00",
|
|
59
|
+
|
|
60
|
+
// From the Atlassian templates
|
|
61
|
+
neutral900: "#091E42",
|
|
62
|
+
neutral800: "#172B4D",
|
|
63
|
+
neutral700: "#253858",
|
|
64
|
+
neutral600: "#344563",
|
|
65
|
+
neutral500: "#42526E",
|
|
66
|
+
neutral400: "#505F79",
|
|
67
|
+
neutral300: "#5E6C84",
|
|
68
|
+
neutral200: "#6B778C",
|
|
69
|
+
neutral100: "#7A869A",
|
|
70
|
+
neutral90: "#8993A4",
|
|
71
|
+
neutral80: "#97A0AF",
|
|
72
|
+
neutral70: "#A5ADBA",
|
|
73
|
+
neutral60: "#B3BAC5",
|
|
74
|
+
neutral50: "#C1C7D0",
|
|
75
|
+
neutral40: "#DFE1E6",
|
|
76
|
+
neutral30: "#EBECF0",
|
|
77
|
+
neutral20: "#F4F5F7",
|
|
78
|
+
neutral10: "#FAFBFC",
|
|
79
|
+
|
|
80
|
+
primaryFont: DEFAULT_FONT,
|
|
81
|
+
primaryBoldFont: DEFAULT_BOLD_FONT,
|
|
82
|
+
|
|
83
|
+
secondaryFont: DEFAULT_FONT,
|
|
84
|
+
secondaryBoldFont: DEFAULT_BOLD_FONT,
|
|
85
|
+
|
|
86
|
+
accentFont: DEFAULT_FONT,
|
|
87
|
+
accentBoldFont: DEFAULT_BOLD_FONT,
|
|
88
|
+
|
|
89
|
+
buttonFont: DEFAULT_FONT,
|
|
90
|
+
titleFont: DEFAULT_FONT,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type PlatformOS = "ios" | "android" | "web";
|
|
94
|
+
|
|
95
|
+
class UnifierClass {
|
|
96
|
+
private _theme?: Partial<UnifiedTheme>;
|
|
97
|
+
|
|
98
|
+
private _web = false;
|
|
99
|
+
|
|
100
|
+
private _dev = false;
|
|
101
|
+
|
|
102
|
+
get web(): boolean {
|
|
103
|
+
return this._web;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
get dev(): boolean {
|
|
107
|
+
return this._dev;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
setTheme(theme: Partial<UnifiedTheme>) {
|
|
111
|
+
this._theme = theme;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
get theme(): UnifiedTheme {
|
|
115
|
+
return {
|
|
116
|
+
...DefaultTheme,
|
|
117
|
+
// Custom per project
|
|
118
|
+
primaryLighter: this._theme?.primaryLighter || this._theme?.primary || DefaultTheme.primary,
|
|
119
|
+
primaryLight: this._theme?.primaryLight || this._theme?.primary || DefaultTheme.primary,
|
|
120
|
+
primary: this._theme?.primary || this._theme?.primary || DefaultTheme.primary,
|
|
121
|
+
primaryDark: this._theme?.primaryDark || this._theme?.primary || DefaultTheme.primary,
|
|
122
|
+
primaryDarker: this._theme?.primaryDarker || this._theme?.primary || DefaultTheme.primary,
|
|
123
|
+
|
|
124
|
+
secondaryLighter:
|
|
125
|
+
this._theme?.secondaryLighter || this._theme?.secondary || DefaultTheme.secondary,
|
|
126
|
+
secondaryLight:
|
|
127
|
+
this._theme?.secondaryLight || this._theme?.secondary || DefaultTheme.secondary,
|
|
128
|
+
secondary: this._theme?.secondary || this._theme?.secondary || DefaultTheme.secondary,
|
|
129
|
+
secondaryDark: this._theme?.secondaryDark || this._theme?.secondary || DefaultTheme.secondary,
|
|
130
|
+
secondaryDarker:
|
|
131
|
+
this._theme?.secondaryDarker || this._theme?.secondary || DefaultTheme.secondary,
|
|
132
|
+
|
|
133
|
+
accentLighter: this._theme?.accentLighter || this._theme?.accent || DefaultTheme.accent,
|
|
134
|
+
accentLight: this._theme?.accentLight || this._theme?.accent || DefaultTheme.accent,
|
|
135
|
+
accent: this._theme?.accent || this._theme?.accent || DefaultTheme.accent,
|
|
136
|
+
accentDark: this._theme?.accentDark || this._theme?.accent || DefaultTheme.accent,
|
|
137
|
+
accentDarker: this._theme?.accentDarker || this._theme?.accent || DefaultTheme.accent,
|
|
138
|
+
|
|
139
|
+
tertiaryLighter: this._theme?.tertiaryLighter || this._theme?.accent || DefaultTheme.accent,
|
|
140
|
+
tertiaryLight: this._theme?.tertiaryLight || this._theme?.accent || DefaultTheme.accent,
|
|
141
|
+
tertiary: this._theme?.tertiary || this._theme?.accent || DefaultTheme.accent,
|
|
142
|
+
tertiaryDark: this._theme?.tertiaryDark || this._theme?.accent || DefaultTheme.accent,
|
|
143
|
+
tertiaryDarker: this._theme?.tertiaryDarker || this._theme?.accent || DefaultTheme.accent,
|
|
144
|
+
|
|
145
|
+
primaryFont: this._theme?.primaryFont || DefaultTheme.primaryFont,
|
|
146
|
+
primaryBoldFont:
|
|
147
|
+
this._theme?.primaryBoldFont || this._theme?.primaryFont || DefaultTheme.primaryBoldFont,
|
|
148
|
+
secondaryFont:
|
|
149
|
+
this._theme?.secondaryFont || this._theme?.primaryFont || DefaultTheme.secondaryFont,
|
|
150
|
+
secondaryBoldFont:
|
|
151
|
+
this._theme?.secondaryBoldFont ||
|
|
152
|
+
this._theme?.primaryFont ||
|
|
153
|
+
DefaultTheme.secondaryBoldFont,
|
|
154
|
+
buttonFont: this._theme?.buttonFont || this._theme?.primaryFont || DefaultTheme.buttonFont,
|
|
155
|
+
accentFont: this._theme?.accentFont || this._theme?.primaryFont || DefaultTheme.accentFont,
|
|
156
|
+
accentBoldFont:
|
|
157
|
+
this._theme?.accentBoldFont || this._theme?.primaryFont || DefaultTheme.accentBoldFont,
|
|
158
|
+
titleFont: this._theme?.titleFont || this._theme?.primaryFont || DefaultTheme.titleFont,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
constructor() {
|
|
163
|
+
console.debug("[unifier] Setting up Unifier");
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
navigation = {
|
|
167
|
+
dismissOverlay: () => {
|
|
168
|
+
console.warn("Dismiss overlay not supported.");
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// tracking: Tracking,
|
|
173
|
+
utils = {
|
|
174
|
+
dismissKeyboard: () => {
|
|
175
|
+
Keyboard.dismiss();
|
|
176
|
+
},
|
|
177
|
+
dimensions: () => ({
|
|
178
|
+
width: Dimensions.get("window").width,
|
|
179
|
+
height: Dimensions.get("window").height,
|
|
180
|
+
}),
|
|
181
|
+
copyToClipboard: (text: string) => {
|
|
182
|
+
Clipboard.setString(text);
|
|
183
|
+
},
|
|
184
|
+
orientationChange: (callback: (orentation: "portrait" | "landscape") => void) => {
|
|
185
|
+
Dimensions.addEventListener("change", () => {
|
|
186
|
+
const screen = Dimensions.get("screen");
|
|
187
|
+
const isPortrait = screen.width < screen.height;
|
|
188
|
+
callback(isPortrait ? "portrait" : "landscape");
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
requestPermissions: async (_perm: PermissionKind) => {
|
|
192
|
+
return requestPermissions(_perm);
|
|
193
|
+
// return requestPermissions(perm);
|
|
194
|
+
},
|
|
195
|
+
makePurchase: () => {
|
|
196
|
+
console.warn("Make purchase not supported yet.");
|
|
197
|
+
},
|
|
198
|
+
PaymentService: () => {
|
|
199
|
+
console.warn("Make purchase not supported yet.");
|
|
200
|
+
},
|
|
201
|
+
vibrate: (pattern?: number[]) => {
|
|
202
|
+
Vibration.vibrate(pattern || [100], false);
|
|
203
|
+
},
|
|
204
|
+
haptic: () => {
|
|
205
|
+
const options = {
|
|
206
|
+
enableVibrateFallback: true,
|
|
207
|
+
ignoreAndroidSystemSettings: false,
|
|
208
|
+
};
|
|
209
|
+
ReactNativeHapticFeedback.trigger("impactLight", options);
|
|
210
|
+
},
|
|
211
|
+
openUrl: async (url: string) => {
|
|
212
|
+
return Linking.openURL(url);
|
|
213
|
+
},
|
|
214
|
+
// keepAwake: (activate: boolean) => {
|
|
215
|
+
// if (activate) {
|
|
216
|
+
// activateKeepAwake();
|
|
217
|
+
// } else {
|
|
218
|
+
// deactivateKeepAwake();
|
|
219
|
+
// }
|
|
220
|
+
// },
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
storage = {
|
|
224
|
+
getItem: async (key: string, defaultValue?: any) => {
|
|
225
|
+
try {
|
|
226
|
+
const jsonValue = await AsyncStorage.getItem(key);
|
|
227
|
+
if (jsonValue) {
|
|
228
|
+
const value = JSON.parse(jsonValue);
|
|
229
|
+
if (value === null || value === undefined) {
|
|
230
|
+
return defaultValue;
|
|
231
|
+
} else {
|
|
232
|
+
return value;
|
|
233
|
+
}
|
|
234
|
+
} else if (defaultValue !== undefined) {
|
|
235
|
+
return defaultValue;
|
|
236
|
+
} else {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
} catch (e) {
|
|
240
|
+
console.error(`[storage] Error reading ${key}`, e);
|
|
241
|
+
return defaultValue || null;
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
setItem: async (key: string, item: any) => {
|
|
245
|
+
try {
|
|
246
|
+
const jsonValue = JSON.stringify(item);
|
|
247
|
+
await AsyncStorage.setItem(key, jsonValue);
|
|
248
|
+
} catch (e) {
|
|
249
|
+
console.error(`[storage] Error storing ${key}`, item, e);
|
|
250
|
+
throw new Error(e as any);
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
tracking = {
|
|
256
|
+
log: (message: string) => {
|
|
257
|
+
console.info(message);
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
initIcons = () => {
|
|
262
|
+
console.debug("[unifier] Initializing icons");
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const NOTIFICATION_TAB_KEY = "@unifier/tabNotifications";
|
|
267
|
+
|
|
268
|
+
export const Unifier = new UnifierClass();
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// Originally based on https://github.com/pinterest/gestalt
|
|
2
|
+
// Forked, updated to Typescript, and added features.
|
|
3
|
+
import get from "lodash/get";
|
|
4
|
+
|
|
5
|
+
export function mergeInlineStyles(inlineStyle?: any, newStyle?: any) {
|
|
6
|
+
const inline = get(inlineStyle, "__style");
|
|
7
|
+
const dangerouslySetInlineStyle = {
|
|
8
|
+
__style: {
|
|
9
|
+
...inline,
|
|
10
|
+
...newStyle,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return dangerouslySetInlineStyle;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
|
|
19
|
+
Style is a monoid that capture the "to-be-applied" styles (inline and classes)
|
|
20
|
+
for a Box. It's basically set that is closed under an associative binary
|
|
21
|
+
operation and has an identity element such that for all HA HA HA. Yes, it's a
|
|
22
|
+
monoid, which sounds scary but it's not really and actually super useful. All
|
|
23
|
+
that means is that basically you can do two things with it:
|
|
24
|
+
|
|
25
|
+
1. concat(concat(a, b), c) === concat(a, concat(b, c));
|
|
26
|
+
2. concat(identity(), a) === concat(a, identity()) === a;
|
|
27
|
+
|
|
28
|
+
What that means is that it's really easy to compose styles together and the
|
|
29
|
+
order in which you do so doesn't really matter.
|
|
30
|
+
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
interface InlineStyle {
|
|
34
|
+
[key: string]: string | number | void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// TODO: This type should be opaque, however the Babel parser doesn't support
|
|
38
|
+
// the opaque syntax yet.
|
|
39
|
+
export interface Style {
|
|
40
|
+
className: Set<string>;
|
|
41
|
+
inlineStyle: InlineStyle;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const identity = (): Style => ({
|
|
45
|
+
className: new Set(),
|
|
46
|
+
inlineStyle: {},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const fromClassName = (...classNames: string[]): Style => ({
|
|
50
|
+
className: new Set(classNames),
|
|
51
|
+
inlineStyle: {},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const fromInlineStyle = (inlineStyle: InlineStyle): Style => ({
|
|
55
|
+
className: new Set(),
|
|
56
|
+
inlineStyle,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const concat = (styles: Style[]): Style =>
|
|
60
|
+
styles.reduce(
|
|
61
|
+
(
|
|
62
|
+
{className: classNameA, inlineStyle: inlineStyleA},
|
|
63
|
+
{className: classNameB, inlineStyle: inlineStyleB}
|
|
64
|
+
) => ({
|
|
65
|
+
className: new Set([...classNameA, ...classNameB]),
|
|
66
|
+
inlineStyle: {...inlineStyleA, ...inlineStyleB},
|
|
67
|
+
}),
|
|
68
|
+
identity()
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
export const mapClassName =
|
|
72
|
+
(fn: (x: string) => string) =>
|
|
73
|
+
({className, inlineStyle}: Style): Style => ({
|
|
74
|
+
className: new Set(Array.from(className).map(fn)),
|
|
75
|
+
inlineStyle,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const toProps = ({
|
|
79
|
+
className,
|
|
80
|
+
inlineStyle,
|
|
81
|
+
}: Style): {className: string; style: InlineStyle} => {
|
|
82
|
+
const props: any = {};
|
|
83
|
+
|
|
84
|
+
if (className.size > 0) {
|
|
85
|
+
// Sorting here ensures that classNames are always stable, reducing diff
|
|
86
|
+
// churn. Box usually has a small number of properties so it's not a perf
|
|
87
|
+
// concern.
|
|
88
|
+
props.className = Array.from(className).sort().join(" ");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (Object.keys(inlineStyle).length > 0) {
|
|
92
|
+
props.style = inlineStyle;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return props;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
|
|
100
|
+
Transforms
|
|
101
|
+
|
|
102
|
+
These are a collection of a few functors that take values and returns Style's. OMG, I used the word functor - it's really just a fancy word for function.
|
|
103
|
+
|
|
104
|
+
*/
|
|
105
|
+
type Functor<T> = (n: T) => Style;
|
|
106
|
+
|
|
107
|
+
// Adds a classname when a property is present.
|
|
108
|
+
//
|
|
109
|
+
// <Box top />
|
|
110
|
+
//
|
|
111
|
+
export const toggle =
|
|
112
|
+
(...classNames: string[]) =>
|
|
113
|
+
(val?: boolean) =>
|
|
114
|
+
val ? fromClassName(...classNames) : identity();
|
|
115
|
+
|
|
116
|
+
// Maps string values to classes
|
|
117
|
+
//
|
|
118
|
+
// <Box alignItems="center" />
|
|
119
|
+
//
|
|
120
|
+
export const mapping = (map: {[key: string]: string}) => (val: string) =>
|
|
121
|
+
Object.prototype.hasOwnProperty.call(map, val) ? fromClassName(map[val]) : identity();
|
|
122
|
+
|
|
123
|
+
// Maps a range of integers to a range of classnames
|
|
124
|
+
//
|
|
125
|
+
// <Box padding={1} />
|
|
126
|
+
//
|
|
127
|
+
export const range =
|
|
128
|
+
(scale: string) =>
|
|
129
|
+
(n: number): Style =>
|
|
130
|
+
fromClassName(`${scale}${n < 0 ? `N${Math.abs(n)}` : n}`);
|
|
131
|
+
|
|
132
|
+
// Like `range`, maps a range of integers to a range of classnames, excluding
|
|
133
|
+
// zero values.
|
|
134
|
+
//
|
|
135
|
+
// <Box padding={0} />
|
|
136
|
+
export const rangeWithoutZero =
|
|
137
|
+
(scale: string) =>
|
|
138
|
+
(n: number): Style =>
|
|
139
|
+
n === 0 ? identity() : range(scale)(n);
|
|
140
|
+
|
|
141
|
+
// Binds a string classname to the value in an object. Useful when interacting
|
|
142
|
+
// with ranges that need to come dynamically from a style object. This is
|
|
143
|
+
// similar to the NPM package 'classnames/bind'.
|
|
144
|
+
export function bind<T>(
|
|
145
|
+
fn: Functor<T>,
|
|
146
|
+
scope:
|
|
147
|
+
| {
|
|
148
|
+
readonly [key: string]: string;
|
|
149
|
+
}
|
|
150
|
+
| any
|
|
151
|
+
): (val: T) => Style {
|
|
152
|
+
const map = mapClassName((name) => scope[name]);
|
|
153
|
+
return (val: T): Style => map(fn(val));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// This takes a series of the previously defined functors, runs them all
|
|
157
|
+
// against a value and returns the set of their classnames.
|
|
158
|
+
export const union =
|
|
159
|
+
<T,>(...fns: Functor<T>[]) =>
|
|
160
|
+
(val: T) =>
|
|
161
|
+
concat(fns.map((fn) => fn(val)));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import {WithLabelProps} from "./Common";
|
|
5
|
+
import {Text} from "./Text";
|
|
6
|
+
|
|
7
|
+
export class WithLabel extends React.Component<WithLabelProps, {}> {
|
|
8
|
+
render() {
|
|
9
|
+
const {label, labelInline, labelColor, children} = this.props;
|
|
10
|
+
// If show is undefined or true, show, only hide for actual false for simplicity.
|
|
11
|
+
if (this.props.show === false) {
|
|
12
|
+
return children;
|
|
13
|
+
}
|
|
14
|
+
if (!children) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (label) {
|
|
19
|
+
return (
|
|
20
|
+
<Box
|
|
21
|
+
direction={labelInline ? "row" : "column"}
|
|
22
|
+
justifyContent={this.props.labelJustifyContent}
|
|
23
|
+
width="100%"
|
|
24
|
+
>
|
|
25
|
+
{this.props.labelPlacement !== "after" && (
|
|
26
|
+
<Box paddingY={1}>
|
|
27
|
+
<Text color={labelColor || "darkGray"} size={this.props.labelSize} weight="bold">
|
|
28
|
+
{label}
|
|
29
|
+
</Text>
|
|
30
|
+
</Box>
|
|
31
|
+
)}
|
|
32
|
+
{children}
|
|
33
|
+
{this.props.labelPlacement === "after" && (
|
|
34
|
+
<Box paddingY={1}>
|
|
35
|
+
<Text color={labelColor || "darkGray"} size={this.props.labelSize}>
|
|
36
|
+
{label}
|
|
37
|
+
</Text>
|
|
38
|
+
</Box>
|
|
39
|
+
)}
|
|
40
|
+
</Box>
|
|
41
|
+
);
|
|
42
|
+
} else {
|
|
43
|
+
return children;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|