@terreno/ui 0.0.1
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 +160 -0
- package/dist/Accordion.d.ts +3 -0
- package/dist/Accordion.js +30 -0
- package/dist/Accordion.js.map +1 -0
- package/dist/ActionSheet.d.ts +169 -0
- package/dist/ActionSheet.js +637 -0
- package/dist/ActionSheet.js.map +1 -0
- package/dist/AddressField.d.ts +3 -0
- package/dist/AddressField.js +18 -0
- package/dist/AddressField.js.map +1 -0
- package/dist/Avatar.d.ts +3 -0
- package/dist/Avatar.js +189 -0
- package/dist/Avatar.js.map +1 -0
- package/dist/Badge.d.ts +3 -0
- package/dist/Badge.js +100 -0
- package/dist/Badge.js.map +1 -0
- package/dist/Banner.d.ts +4 -0
- package/dist/Banner.js +103 -0
- package/dist/Banner.js.map +1 -0
- package/dist/Body.d.ts +3 -0
- package/dist/Body.js +17 -0
- package/dist/Body.js.map +1 -0
- package/dist/BooleanField.d.ts +3 -0
- package/dist/BooleanField.js +89 -0
- package/dist/BooleanField.js.map +1 -0
- package/dist/Box.d.ts +3 -0
- package/dist/Box.js +289 -0
- package/dist/Box.js.map +1 -0
- package/dist/Button.d.ts +3 -0
- package/dist/Button.js +105 -0
- package/dist/Button.js.map +1 -0
- package/dist/Card.d.ts +2 -0
- package/dist/Card.js +18 -0
- package/dist/Card.js.map +1 -0
- package/dist/CheckBox.d.ts +3 -0
- package/dist/CheckBox.js +28 -0
- package/dist/CheckBox.js.map +1 -0
- package/dist/Common.d.ts +2325 -0
- package/dist/Common.js +47 -0
- package/dist/Common.js.map +1 -0
- package/dist/CommonIconTypes.d.ts +3 -0
- package/dist/CommonIconTypes.js +2 -0
- package/dist/CommonIconTypes.js.map +1 -0
- package/dist/Constants.d.ts +12685 -0
- package/dist/Constants.js +3310 -0
- package/dist/Constants.js.map +1 -0
- package/dist/CustomSelectField.d.ts +3 -0
- package/dist/CustomSelectField.js +59 -0
- package/dist/CustomSelectField.js.map +1 -0
- package/dist/DataTable.d.ts +3 -0
- package/dist/DataTable.js +190 -0
- package/dist/DataTable.js.map +1 -0
- package/dist/DateTimeActionSheet.d.ts +2 -0
- package/dist/DateTimeActionSheet.js +270 -0
- package/dist/DateTimeActionSheet.js.map +1 -0
- package/dist/DateTimeField.d.ts +3 -0
- package/dist/DateTimeField.js +514 -0
- package/dist/DateTimeField.js.map +1 -0
- package/dist/DateUtilities.d.ts +57 -0
- package/dist/DateUtilities.js +308 -0
- package/dist/DateUtilities.js.map +1 -0
- package/dist/DecimalRangeActionSheet.d.ts +6 -0
- package/dist/DecimalRangeActionSheet.js +45 -0
- package/dist/DecimalRangeActionSheet.js.map +1 -0
- package/dist/DismissButton.d.ts +3 -0
- package/dist/DismissButton.js +12 -0
- package/dist/DismissButton.js.map +1 -0
- package/dist/EmailField.d.ts +3 -0
- package/dist/EmailField.js +48 -0
- package/dist/EmailField.js.map +1 -0
- package/dist/EmojiSelector.d.ts +113 -0
- package/dist/EmojiSelector.js +322 -0
- package/dist/EmojiSelector.js.map +1 -0
- package/dist/ErrorBoundary.d.ts +19 -0
- package/dist/ErrorBoundary.js +30 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/ErrorPage.d.ts +6 -0
- package/dist/ErrorPage.js +15 -0
- package/dist/ErrorPage.js.map +1 -0
- package/dist/Field.d.ts +3 -0
- package/dist/Field.js +80 -0
- package/dist/Field.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/Heading.d.ts +3 -0
- package/dist/Heading.js +43 -0
- package/dist/Heading.js.map +1 -0
- package/dist/HeightActionSheet.d.ts +11 -0
- package/dist/HeightActionSheet.js +46 -0
- package/dist/HeightActionSheet.js.map +1 -0
- package/dist/Hyperlink.d.ts +30 -0
- package/dist/Hyperlink.js +144 -0
- package/dist/Hyperlink.js.map +1 -0
- package/dist/Icon.d.ts +3 -0
- package/dist/Icon.js +15 -0
- package/dist/Icon.js.map +1 -0
- package/dist/IconButton.d.ts +3 -0
- package/dist/IconButton.js +111 -0
- package/dist/IconButton.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 +10 -0
- package/dist/ImageBackground.js +9 -0
- package/dist/ImageBackground.js.map +1 -0
- package/dist/InfoModalIcon.d.ts +3 -0
- package/dist/InfoModalIcon.js +10 -0
- package/dist/InfoModalIcon.js.map +1 -0
- package/dist/InfoTooltipButton.d.ts +3 -0
- package/dist/InfoTooltipButton.js +6 -0
- package/dist/InfoTooltipButton.js.map +1 -0
- package/dist/Link.d.ts +3 -0
- package/dist/Link.js +10 -0
- package/dist/Link.js.map +1 -0
- package/dist/MarkdownView.d.ts +5 -0
- package/dist/MarkdownView.js +44 -0
- package/dist/MarkdownView.js.map +1 -0
- package/dist/MediaQuery.d.ts +4 -0
- package/dist/MediaQuery.js +52 -0
- package/dist/MediaQuery.js.map +1 -0
- package/dist/MobileAddressAutoComplete.d.ts +2 -0
- package/dist/MobileAddressAutoComplete.js +54 -0
- package/dist/MobileAddressAutoComplete.js.map +1 -0
- package/dist/Modal.d.ts +3 -0
- package/dist/Modal.js +127 -0
- package/dist/Modal.js.map +1 -0
- package/dist/ModalSheet.d.ts +6 -0
- package/dist/ModalSheet.js +42 -0
- package/dist/ModalSheet.js.map +1 -0
- package/dist/MultiselectField.d.ts +3 -0
- package/dist/MultiselectField.js +45 -0
- package/dist/MultiselectField.js.map +1 -0
- package/dist/NumberField.d.ts +3 -0
- package/dist/NumberField.js +60 -0
- package/dist/NumberField.js.map +1 -0
- package/dist/NumberPickerActionSheet.d.ts +7 -0
- package/dist/NumberPickerActionSheet.js +22 -0
- package/dist/NumberPickerActionSheet.js.map +1 -0
- package/dist/OpenAPIContext.d.ts +4 -0
- package/dist/OpenAPIContext.js +53 -0
- package/dist/OpenAPIContext.js.map +1 -0
- package/dist/Page.d.ts +7 -0
- package/dist/Page.js +24 -0
- package/dist/Page.js.map +1 -0
- package/dist/Pagination.d.ts +3 -0
- package/dist/Pagination.js +106 -0
- package/dist/Pagination.js.map +1 -0
- package/dist/PasswordField.d.ts +2 -0
- package/dist/PasswordField.js +6 -0
- package/dist/PasswordField.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/PhoneNumberField.d.ts +3 -0
- package/dist/PhoneNumberField.js +83 -0
- package/dist/PhoneNumberField.js.map +1 -0
- package/dist/PickerSelect.d.ts +46 -0
- package/dist/PickerSelect.js +306 -0
- package/dist/PickerSelect.js.map +1 -0
- package/dist/Radio.d.ts +3 -0
- package/dist/Radio.js +21 -0
- package/dist/Radio.js.map +1 -0
- package/dist/RadioField.d.ts +3 -0
- package/dist/RadioField.js +16 -0
- package/dist/RadioField.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/SectionDivider.d.ts +2 -0
- package/dist/SectionDivider.js +12 -0
- package/dist/SectionDivider.js.map +1 -0
- package/dist/SegmentedControl.d.ts +3 -0
- package/dist/SegmentedControl.js +65 -0
- package/dist/SegmentedControl.js.map +1 -0
- package/dist/SelectBadge.d.ts +3 -0
- package/dist/SelectBadge.js +166 -0
- package/dist/SelectBadge.js.map +1 -0
- package/dist/SelectField.d.ts +3 -0
- package/dist/SelectField.js +16 -0
- package/dist/SelectField.js.map +1 -0
- package/dist/SideDrawer.d.ts +3 -0
- package/dist/SideDrawer.js +32 -0
- package/dist/SideDrawer.js.map +1 -0
- package/dist/Signature.d.ts +8 -0
- package/dist/Signature.js +21 -0
- package/dist/Signature.js.map +1 -0
- package/dist/Signature.native.d.ts +8 -0
- package/dist/Signature.native.js +26 -0
- package/dist/Signature.native.js.map +1 -0
- package/dist/SignatureField.d.ts +3 -0
- package/dist/SignatureField.js +42 -0
- package/dist/SignatureField.js.map +1 -0
- package/dist/Slider.d.ts +3 -0
- package/dist/Slider.js +78 -0
- package/dist/Slider.js.map +1 -0
- package/dist/Spinner.d.ts +3 -0
- package/dist/Spinner.js +33 -0
- package/dist/Spinner.js.map +1 -0
- package/dist/SplitPage.d.ts +2 -0
- package/dist/SplitPage.js +139 -0
- package/dist/SplitPage.js.map +1 -0
- package/dist/SplitPage.native.d.ts +2 -0
- package/dist/SplitPage.native.js +75 -0
- package/dist/SplitPage.native.js.map +1 -0
- package/dist/TapToEdit.d.ts +4 -0
- package/dist/TapToEdit.js +170 -0
- package/dist/TapToEdit.js.map +1 -0
- package/dist/TerrenoProvider.d.ts +6 -0
- package/dist/TerrenoProvider.js +10 -0
- package/dist/TerrenoProvider.js.map +1 -0
- package/dist/Text.d.ts +3 -0
- package/dist/Text.js +95 -0
- package/dist/Text.js.map +1 -0
- package/dist/TextArea.d.ts +3 -0
- package/dist/TextArea.js +6 -0
- package/dist/TextArea.js.map +1 -0
- package/dist/TextField.d.ts +3 -0
- package/dist/TextField.js +144 -0
- package/dist/TextField.js.map +1 -0
- package/dist/TextFieldNumberActionSheet.d.ts +7 -0
- package/dist/TextFieldNumberActionSheet.js +20 -0
- package/dist/TextFieldNumberActionSheet.js.map +1 -0
- package/dist/Theme.d.ts +96 -0
- package/dist/Theme.js +213 -0
- package/dist/Theme.js.map +1 -0
- package/dist/TimezonePicker.d.ts +11 -0
- package/dist/TimezonePicker.js +27 -0
- package/dist/TimezonePicker.js.map +1 -0
- package/dist/Toast.d.ts +23 -0
- package/dist/Toast.js +157 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Tooltip.d.ts +3 -0
- package/dist/Tooltip.js +289 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/UnifiedAddressAutoComplete.d.ts +2 -0
- package/dist/UnifiedAddressAutoComplete.js +23 -0
- package/dist/UnifiedAddressAutoComplete.js.map +1 -0
- package/dist/Unifier.d.ts +43 -0
- package/dist/Unifier.js +154 -0
- package/dist/Unifier.js.map +1 -0
- package/dist/Utilities.d.ts +56 -0
- package/dist/Utilities.js +193 -0
- package/dist/Utilities.js.map +1 -0
- package/dist/WebAddressAutocomplete.d.ts +3 -0
- package/dist/WebAddressAutocomplete.js +61 -0
- package/dist/WebAddressAutocomplete.js.map +1 -0
- package/dist/fieldElements/FieldError.d.ts +6 -0
- package/dist/fieldElements/FieldError.js +9 -0
- package/dist/fieldElements/FieldError.js.map +1 -0
- package/dist/fieldElements/FieldHelperText.d.ts +6 -0
- package/dist/fieldElements/FieldHelperText.js +8 -0
- package/dist/fieldElements/FieldHelperText.js.map +1 -0
- package/dist/fieldElements/FieldTitle.d.ts +6 -0
- package/dist/fieldElements/FieldTitle.js +16 -0
- package/dist/fieldElements/FieldTitle.js.map +1 -0
- package/dist/fieldElements/index.d.ts +3 -0
- package/dist/fieldElements/index.js +4 -0
- package/dist/fieldElements/index.js.map +1 -0
- package/dist/icons/MobileIcon.d.ts +2 -0
- package/dist/icons/MobileIcon.js +18 -0
- package/dist/icons/MobileIcon.js.map +1 -0
- package/dist/icons/OfflineIcon.d.ts +2 -0
- package/dist/icons/OfflineIcon.js +18 -0
- package/dist/icons/OfflineIcon.js.map +1 -0
- package/dist/icons/OnlineIcon.d.ts +2 -0
- package/dist/icons/OnlineIcon.js +19 -0
- package/dist/icons/OnlineIcon.js.map +1 -0
- package/dist/icons/OutOfficeIcon.d.ts +2 -0
- package/dist/icons/OutOfficeIcon.js +18 -0
- package/dist/icons/OutOfficeIcon.js.map +1 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +5 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +1328 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/table/Table.d.ts +3 -0
- package/dist/table/Table.js +53 -0
- package/dist/table/Table.js.map +1 -0
- package/dist/table/TableBadge.d.ts +6 -0
- package/dist/table/TableBadge.js +23 -0
- package/dist/table/TableBadge.js.map +1 -0
- package/dist/table/TableBoolean.d.ts +6 -0
- package/dist/table/TableBoolean.js +37 -0
- package/dist/table/TableBoolean.js.map +1 -0
- package/dist/table/TableDate.d.ts +3 -0
- package/dist/table/TableDate.js +27 -0
- package/dist/table/TableDate.js.map +1 -0
- package/dist/table/TableHeader.d.ts +6 -0
- package/dist/table/TableHeader.js +10 -0
- package/dist/table/TableHeader.js.map +1 -0
- package/dist/table/TableHeaderCell.d.ts +6 -0
- package/dist/table/TableHeaderCell.js +54 -0
- package/dist/table/TableHeaderCell.js.map +1 -0
- package/dist/table/TableIconButton.d.ts +3 -0
- package/dist/table/TableIconButton.js +39 -0
- package/dist/table/TableIconButton.js.map +1 -0
- package/dist/table/TableNumber.d.ts +3 -0
- package/dist/table/TableNumber.js +18 -0
- package/dist/table/TableNumber.js.map +1 -0
- package/dist/table/TableRow.d.ts +6 -0
- package/dist/table/TableRow.js +22 -0
- package/dist/table/TableRow.js.map +1 -0
- package/dist/table/TableText.d.ts +3 -0
- package/dist/table/TableText.js +18 -0
- package/dist/table/TableText.js.map +1 -0
- package/dist/table/TableTitle.d.ts +3 -0
- package/dist/table/TableTitle.js +21 -0
- package/dist/table/TableTitle.js.map +1 -0
- package/dist/table/tableContext.d.ts +5 -0
- package/dist/table/tableContext.js +38 -0
- package/dist/table/tableContext.js.map +1 -0
- package/dist/useStoredState.d.ts +1 -0
- package/dist/useStoredState.js +49 -0
- package/dist/useStoredState.js.map +1 -0
- package/package.json +123 -0
- package/src/Accordion.test.tsx +104 -0
- package/src/Accordion.tsx +81 -0
- package/src/ActionSheet.tsx +881 -0
- package/src/AddressField.test.tsx +120 -0
- package/src/AddressField.tsx +122 -0
- package/src/Avatar.test.tsx +163 -0
- package/src/Avatar.tsx +298 -0
- package/src/Badge.test.tsx +116 -0
- package/src/Badge.tsx +136 -0
- package/src/Banner.tsx +200 -0
- package/src/Body.tsx +34 -0
- package/src/BooleanField.tsx +141 -0
- package/src/Box.test.tsx +662 -0
- package/src/Box.tsx +368 -0
- package/src/Button.tsx +196 -0
- package/src/Card.tsx +19 -0
- package/src/CheckBox.tsx +45 -0
- package/src/Common.ts +2787 -0
- package/src/CommonIconTypes.ts +2030 -0
- package/src/Constants.ts +3311 -0
- package/src/CustomSelectField.tsx +115 -0
- package/src/DataTable.tsx +674 -0
- package/src/DateTimeActionSheet.tsx +559 -0
- package/src/DateTimeField.test.tsx +393 -0
- package/src/DateTimeField.tsx +777 -0
- package/src/DateUtilities.test.ts +440 -0
- package/src/DateUtilities.tsx +370 -0
- package/src/DecimalRangeActionSheet.tsx +85 -0
- package/src/DismissButton.tsx +31 -0
- package/src/EmailField.tsx +66 -0
- package/src/EmojiSelector.test.tsx +61 -0
- package/src/EmojiSelector.tsx +510 -0
- package/src/ErrorBoundary.tsx +37 -0
- package/src/ErrorPage.tsx +41 -0
- package/src/Field.tsx +101 -0
- package/src/FlatList.tsx +2 -0
- package/src/Heading.tsx +66 -0
- package/src/HeightActionSheet.tsx +91 -0
- package/src/Hyperlink.tsx +179 -0
- package/src/Icon.tsx +36 -0
- package/src/IconButton.tsx +217 -0
- package/src/Image.tsx +51 -0
- package/src/ImageBackground.tsx +14 -0
- package/src/InfoModalIcon.tsx +42 -0
- package/src/InfoTooltipButton.tsx +16 -0
- package/src/Link.tsx +22 -0
- package/src/MarkdownView.tsx +67 -0
- package/src/MediaQuery.ts +46 -0
- package/src/MobileAddressAutoComplete.tsx +126 -0
- package/src/Modal.tsx +300 -0
- package/src/ModalSheet.tsx +58 -0
- package/src/MultiselectField.tsx +112 -0
- package/src/NumberField.tsx +67 -0
- package/src/NumberPickerActionSheet.tsx +51 -0
- package/src/OpenAPIContext.tsx +74 -0
- package/src/Page.tsx +105 -0
- package/src/Pagination.tsx +169 -0
- package/src/PasswordField.tsx +7 -0
- package/src/Permissions.ts +43 -0
- package/src/PhoneNumberField.tsx +109 -0
- package/src/PickerSelect.tsx +571 -0
- package/src/Radio.tsx +33 -0
- package/src/RadioField.tsx +43 -0
- package/src/ScrollView.tsx +2 -0
- package/src/SectionDivider.tsx +18 -0
- package/src/SegmentedControl.tsx +126 -0
- package/src/SelectBadge.tsx +280 -0
- package/src/SelectField.tsx +41 -0
- package/src/SideDrawer.tsx +56 -0
- package/src/Signature.native.tsx +57 -0
- package/src/Signature.tsx +44 -0
- package/src/SignatureField.tsx +92 -0
- package/src/Slider.tsx +199 -0
- package/src/Spinner.tsx +35 -0
- package/src/SplitPage.native.tsx +163 -0
- package/src/SplitPage.tsx +304 -0
- package/src/TapToEdit.tsx +292 -0
- package/src/TerrenoProvider.tsx +31 -0
- package/src/Text.tsx +123 -0
- package/src/TextArea.test.tsx +255 -0
- package/src/TextArea.tsx +8 -0
- package/src/TextField.test.tsx +487 -0
- package/src/TextField.tsx +260 -0
- package/src/TextFieldNumberActionSheet.tsx +46 -0
- package/src/Theme.tsx +248 -0
- package/src/TimezonePicker.tsx +45 -0
- package/src/Toast.tsx +234 -0
- package/src/Tooltip.tsx +407 -0
- package/src/UnifiedAddressAutoComplete.tsx +66 -0
- package/src/Unifier.ts +172 -0
- package/src/Utilities.tsx +329 -0
- package/src/WebAddressAutocomplete.tsx +84 -0
- package/src/__snapshots__/Accordion.test.tsx.snap +126 -0
- package/src/__snapshots__/AddressField.test.tsx.snap +1197 -0
- package/src/__snapshots__/Avatar.test.tsx.snap +57 -0
- package/src/__snapshots__/Badge.test.tsx.snap +55 -0
- package/src/__snapshots__/Box.test.tsx.snap +162 -0
- package/src/__snapshots__/EmojiSelector.test.tsx.snap +422 -0
- package/src/__snapshots__/TextArea.test.tsx.snap +521 -0
- package/src/__snapshots__/TextField.test.tsx.snap +569 -0
- package/src/bunSetup.ts +1235 -0
- package/src/fieldElements/FieldError.tsx +24 -0
- package/src/fieldElements/FieldHelperText.tsx +20 -0
- package/src/fieldElements/FieldTitle.tsx +31 -0
- package/src/fieldElements/index.tsx +3 -0
- package/src/icons/MobileIcon.tsx +40 -0
- package/src/icons/OfflineIcon.tsx +37 -0
- package/src/icons/OnlineIcon.tsx +39 -0
- package/src/icons/OutOfficeIcon.tsx +36 -0
- package/src/icons/index.ts +4 -0
- package/src/index.tsx +1375 -0
- package/src/polyfill.d.ts +11 -0
- package/src/table/Table.tsx +109 -0
- package/src/table/TableBadge.tsx +46 -0
- package/src/table/TableBoolean.tsx +70 -0
- package/src/table/TableDate.tsx +38 -0
- package/src/table/TableHeader.tsx +20 -0
- package/src/table/TableHeaderCell.tsx +94 -0
- package/src/table/TableIconButton.tsx +61 -0
- package/src/table/TableNumber.tsx +29 -0
- package/src/table/TableRow.tsx +67 -0
- package/src/table/TableText.tsx +29 -0
- package/src/table/TableTitle.tsx +31 -0
- package/src/table/tableContext.tsx +67 -0
- package/src/test-utils.tsx +27 -0
- package/src/types/react-native-swiper-flatlist.d.ts +56 -0
- package/src/useStoredState.test.tsx +143 -0
- package/src/useStoredState.ts +56 -0
package/src/Common.ts
ADDED
|
@@ -0,0 +1,2787 @@
|
|
|
1
|
+
import type {CountryCode} from "libphonenumber-js";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type {ReactElement, ReactNode} from "react";
|
|
4
|
+
import type {ListRenderItemInfo, StyleProp, TextStyle, ViewStyle} from "react-native";
|
|
5
|
+
import type {DimensionValue} from "react-native/Libraries/StyleSheet/StyleSheetTypes";
|
|
6
|
+
import type {Styles} from "react-native-google-places-autocomplete";
|
|
7
|
+
import type {SvgProps} from "react-native-svg";
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
FontAwesome6BrandNames,
|
|
11
|
+
FontAwesome6RegularNames,
|
|
12
|
+
FontAwesome6SolidNames,
|
|
13
|
+
} from "./CommonIconTypes";
|
|
14
|
+
|
|
15
|
+
export type PercentageString = `${number}%`;
|
|
16
|
+
|
|
17
|
+
export type NumberOrPercentage = number | PercentageString | string;
|
|
18
|
+
|
|
19
|
+
export interface InfoModalIconProps {
|
|
20
|
+
/**
|
|
21
|
+
* The content of the information modal.
|
|
22
|
+
*/
|
|
23
|
+
infoModalChildren?: ModalProps["children"];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The subtitle of the information modal.
|
|
27
|
+
*/
|
|
28
|
+
infoModalSubtitle?: ModalProps["subtitle"];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The text content of the information modal.
|
|
32
|
+
*/
|
|
33
|
+
infoModalText?: ModalProps["text"];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The title of the information modal.
|
|
37
|
+
*/
|
|
38
|
+
infoModalTitle?: ModalProps["title"];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface AccordionProps extends InfoModalIconProps {
|
|
42
|
+
/**
|
|
43
|
+
* The content to be displayed inside the accordion.
|
|
44
|
+
*/
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* If true, an information modal will be included.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
includeInfoModal?: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* If true, the accordion will be collapsed.
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
isCollapsed?: boolean;
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* The subtitle showed below the title of the accordion.
|
|
61
|
+
*/
|
|
62
|
+
subtitle?: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The title of the accordion.
|
|
66
|
+
*/
|
|
67
|
+
title: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* * Callback fired when the accordion is toggled.
|
|
71
|
+
* */
|
|
72
|
+
onToggle?: (isCollapse: boolean) => void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface BaseProfile {
|
|
76
|
+
email: string;
|
|
77
|
+
id: string;
|
|
78
|
+
backOffice: {
|
|
79
|
+
testUser?: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ThemePrimitiveColors {
|
|
84
|
+
neutral000: string;
|
|
85
|
+
neutral050: string;
|
|
86
|
+
neutral100: string;
|
|
87
|
+
neutral200: string;
|
|
88
|
+
neutral300: string;
|
|
89
|
+
neutral400: string;
|
|
90
|
+
neutral500: string;
|
|
91
|
+
neutral600: string;
|
|
92
|
+
neutral700: string;
|
|
93
|
+
neutral800: string;
|
|
94
|
+
neutral900: string;
|
|
95
|
+
|
|
96
|
+
primary000: string;
|
|
97
|
+
primary050: string;
|
|
98
|
+
primary100: string;
|
|
99
|
+
primary200: string;
|
|
100
|
+
primary300: string;
|
|
101
|
+
primary400: string;
|
|
102
|
+
primary500: string;
|
|
103
|
+
primary600: string;
|
|
104
|
+
primary700: string;
|
|
105
|
+
primary800: string;
|
|
106
|
+
primary900: string;
|
|
107
|
+
|
|
108
|
+
secondary000: string;
|
|
109
|
+
secondary050: string;
|
|
110
|
+
secondary100: string;
|
|
111
|
+
secondary200: string;
|
|
112
|
+
secondary300: string;
|
|
113
|
+
secondary400: string;
|
|
114
|
+
secondary500: string;
|
|
115
|
+
secondary600: string;
|
|
116
|
+
secondary700: string;
|
|
117
|
+
secondary800: string;
|
|
118
|
+
secondary900: string;
|
|
119
|
+
|
|
120
|
+
accent000: string;
|
|
121
|
+
accent050: string;
|
|
122
|
+
accent100: string;
|
|
123
|
+
accent200: string;
|
|
124
|
+
accent300: string;
|
|
125
|
+
accent400: string;
|
|
126
|
+
accent500: string;
|
|
127
|
+
accent600: string;
|
|
128
|
+
accent700: string;
|
|
129
|
+
accent800: string;
|
|
130
|
+
accent900: string;
|
|
131
|
+
|
|
132
|
+
error000: string;
|
|
133
|
+
error100: string;
|
|
134
|
+
error200: string;
|
|
135
|
+
|
|
136
|
+
warning000: string;
|
|
137
|
+
warning100: string;
|
|
138
|
+
warning200: string;
|
|
139
|
+
|
|
140
|
+
success000: string;
|
|
141
|
+
success100: string;
|
|
142
|
+
success200: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface ThemePrimitiveRadius {
|
|
146
|
+
radiusSm: number;
|
|
147
|
+
radiusMd: number;
|
|
148
|
+
radiusLg: number;
|
|
149
|
+
radiusXl: number;
|
|
150
|
+
radius2xl: number;
|
|
151
|
+
radius3xl: number;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface ThemePrimitiveSpacing {
|
|
155
|
+
spacing0: number;
|
|
156
|
+
spacing1: number;
|
|
157
|
+
spacing2: number;
|
|
158
|
+
spacing3: number;
|
|
159
|
+
spacing4: number;
|
|
160
|
+
spacing5: number;
|
|
161
|
+
spacing6: number;
|
|
162
|
+
spacing7: number;
|
|
163
|
+
spacing8: number;
|
|
164
|
+
spacing9: number;
|
|
165
|
+
spacing10: number;
|
|
166
|
+
spacing11: number;
|
|
167
|
+
spacing12: number;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type ThemePrimitives = ThemePrimitiveColors & ThemePrimitiveRadius & ThemePrimitiveSpacing;
|
|
171
|
+
|
|
172
|
+
export interface TextThemeConfig {
|
|
173
|
+
primary: keyof ThemePrimitiveColors;
|
|
174
|
+
inverted: keyof ThemePrimitiveColors;
|
|
175
|
+
secondaryLight: keyof ThemePrimitiveColors;
|
|
176
|
+
extraLight: keyof ThemePrimitiveColors;
|
|
177
|
+
secondaryDark: keyof ThemePrimitiveColors;
|
|
178
|
+
link: keyof ThemePrimitiveColors;
|
|
179
|
+
linkLight: keyof ThemePrimitiveColors;
|
|
180
|
+
accent: keyof ThemePrimitiveColors;
|
|
181
|
+
error: keyof ThemePrimitiveColors;
|
|
182
|
+
warning: keyof ThemePrimitiveColors;
|
|
183
|
+
success: keyof ThemePrimitiveColors;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface SurfaceThemeConfig {
|
|
187
|
+
base: keyof ThemePrimitiveColors;
|
|
188
|
+
primary: keyof ThemePrimitiveColors;
|
|
189
|
+
secondaryLight: keyof ThemePrimitiveColors;
|
|
190
|
+
secondaryDark: keyof ThemePrimitiveColors;
|
|
191
|
+
secondaryExtraDark: keyof ThemePrimitiveColors;
|
|
192
|
+
neutral: keyof ThemePrimitiveColors;
|
|
193
|
+
neutralLight: keyof ThemePrimitiveColors;
|
|
194
|
+
neutralDark: keyof ThemePrimitiveColors;
|
|
195
|
+
disabled: keyof ThemePrimitiveColors;
|
|
196
|
+
error: keyof ThemePrimitiveColors;
|
|
197
|
+
errorLight: keyof ThemePrimitiveColors;
|
|
198
|
+
success: keyof ThemePrimitiveColors;
|
|
199
|
+
successLight: keyof ThemePrimitiveColors;
|
|
200
|
+
warning: keyof ThemePrimitiveColors;
|
|
201
|
+
warningLight: keyof ThemePrimitiveColors;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface BorderThemeConfig {
|
|
205
|
+
default: keyof ThemePrimitiveColors;
|
|
206
|
+
dark: keyof ThemePrimitiveColors;
|
|
207
|
+
activeNeutral: keyof ThemePrimitiveColors;
|
|
208
|
+
activeAccent: keyof ThemePrimitiveColors;
|
|
209
|
+
hover: keyof ThemePrimitiveColors;
|
|
210
|
+
focus: keyof ThemePrimitiveColors;
|
|
211
|
+
error: keyof ThemePrimitiveColors;
|
|
212
|
+
success: keyof ThemePrimitiveColors;
|
|
213
|
+
warning: keyof ThemePrimitiveColors;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface StatusThemeConfig {
|
|
217
|
+
active: keyof ThemePrimitiveColors;
|
|
218
|
+
doNotDisturb: keyof ThemePrimitiveColors;
|
|
219
|
+
away: keyof ThemePrimitiveColors;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface RadiusThemeConfig {
|
|
223
|
+
minimal: keyof ThemePrimitiveRadius;
|
|
224
|
+
default: keyof ThemePrimitiveRadius;
|
|
225
|
+
full: keyof ThemePrimitiveRadius;
|
|
226
|
+
rounded: keyof ThemePrimitiveRadius;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface SpacingThemeConfig {
|
|
230
|
+
none: keyof ThemePrimitiveSpacing;
|
|
231
|
+
xs: keyof ThemePrimitiveSpacing;
|
|
232
|
+
sm: keyof ThemePrimitiveSpacing;
|
|
233
|
+
md: keyof ThemePrimitiveSpacing;
|
|
234
|
+
lg: keyof ThemePrimitiveSpacing;
|
|
235
|
+
xl: keyof ThemePrimitiveSpacing;
|
|
236
|
+
"2xl": keyof ThemePrimitiveSpacing;
|
|
237
|
+
"3xl": keyof ThemePrimitiveSpacing;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface TextTheme {
|
|
241
|
+
primary: string;
|
|
242
|
+
inverted: string;
|
|
243
|
+
secondaryLight: string;
|
|
244
|
+
extraLight: string;
|
|
245
|
+
secondaryDark: string;
|
|
246
|
+
link: string;
|
|
247
|
+
linkLight: string;
|
|
248
|
+
accent: string;
|
|
249
|
+
error: string;
|
|
250
|
+
warning: string;
|
|
251
|
+
success: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface SurfaceTheme {
|
|
255
|
+
base: string;
|
|
256
|
+
primary: string;
|
|
257
|
+
secondaryLight: string;
|
|
258
|
+
secondaryDark: string;
|
|
259
|
+
secondaryExtraDark: string;
|
|
260
|
+
neutral: string;
|
|
261
|
+
neutralLight: string;
|
|
262
|
+
neutralDark: string;
|
|
263
|
+
disabled: string;
|
|
264
|
+
error: string;
|
|
265
|
+
errorLight: string;
|
|
266
|
+
success: string;
|
|
267
|
+
successLight: string;
|
|
268
|
+
warning: string;
|
|
269
|
+
warningLight: string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface BorderTheme {
|
|
273
|
+
default: string;
|
|
274
|
+
dark: string;
|
|
275
|
+
activeNeutral: string;
|
|
276
|
+
activeAccent: string;
|
|
277
|
+
hover: string;
|
|
278
|
+
focus: string;
|
|
279
|
+
error: string;
|
|
280
|
+
success: string;
|
|
281
|
+
warning: string;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface StatusTheme {
|
|
285
|
+
active: string;
|
|
286
|
+
doNotDisturb: string;
|
|
287
|
+
away: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface RadiusTheme {
|
|
291
|
+
minimal: number;
|
|
292
|
+
default: number;
|
|
293
|
+
full: number;
|
|
294
|
+
rounded: number;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface SpacingTheme {
|
|
298
|
+
none: number;
|
|
299
|
+
xs: number;
|
|
300
|
+
sm: number;
|
|
301
|
+
md: number;
|
|
302
|
+
lg: number;
|
|
303
|
+
xl: number;
|
|
304
|
+
"2xl": number;
|
|
305
|
+
"3xl": number;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export type TextColor = keyof TextTheme;
|
|
309
|
+
export type SurfaceColor = keyof SurfaceTheme;
|
|
310
|
+
export type BorderColor = keyof BorderTheme;
|
|
311
|
+
export type StatusColor = keyof StatusTheme;
|
|
312
|
+
|
|
313
|
+
// TODO: we may want/need to expand icon color options from just text colors.
|
|
314
|
+
export type IconColor = TextColor;
|
|
315
|
+
|
|
316
|
+
export interface FontTheme {
|
|
317
|
+
primary: string;
|
|
318
|
+
title: string;
|
|
319
|
+
}
|
|
320
|
+
export type Font = keyof FontTheme;
|
|
321
|
+
|
|
322
|
+
// The computed theme object that is passed to the ThemeProvider.
|
|
323
|
+
export interface TerrenoTheme {
|
|
324
|
+
text: TextTheme;
|
|
325
|
+
surface: SurfaceTheme;
|
|
326
|
+
border: BorderTheme;
|
|
327
|
+
status: StatusTheme;
|
|
328
|
+
radius: RadiusTheme;
|
|
329
|
+
spacing: SpacingTheme;
|
|
330
|
+
font: FontTheme;
|
|
331
|
+
primitives: ThemePrimitives;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// A config for generating the theme object from primitives.
|
|
335
|
+
export interface TerrenoThemeConfig {
|
|
336
|
+
text: TextThemeConfig;
|
|
337
|
+
surface: SurfaceThemeConfig;
|
|
338
|
+
border: BorderThemeConfig;
|
|
339
|
+
status: StatusThemeConfig;
|
|
340
|
+
radius: RadiusThemeConfig;
|
|
341
|
+
spacing: SpacingThemeConfig;
|
|
342
|
+
font: FontTheme;
|
|
343
|
+
primitives: ThemePrimitives;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export type Direction = "up" | "right" | "down" | "left";
|
|
347
|
+
|
|
348
|
+
export type OnChangeCallback = (result: string) => void;
|
|
349
|
+
|
|
350
|
+
// Update if we start supporting more icon packs from Expo Icons.
|
|
351
|
+
export type IconName = FontAwesome6SolidNames | FontAwesome6BrandNames | FontAwesome6RegularNames;
|
|
352
|
+
|
|
353
|
+
export type AlignContent = "start" | "end" | "center" | "between" | "around" | "stretch";
|
|
354
|
+
export type AlignSelf = "auto" | "start" | "end" | "center" | "baseline" | "stretch";
|
|
355
|
+
export type AlignItems = "start" | "end" | "center" | "baseline" | "stretch";
|
|
356
|
+
export type JustifyContent = "start" | "end" | "center" | "between" | "around";
|
|
357
|
+
|
|
358
|
+
export type UnsignedUpTo12 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
359
|
+
export type SignedUpTo12 =
|
|
360
|
+
| -12
|
|
361
|
+
| -11
|
|
362
|
+
| -10
|
|
363
|
+
| -9
|
|
364
|
+
| -8
|
|
365
|
+
| -7
|
|
366
|
+
| -6
|
|
367
|
+
| -5
|
|
368
|
+
| -4
|
|
369
|
+
| -3
|
|
370
|
+
| -2
|
|
371
|
+
| -1
|
|
372
|
+
| UnsignedUpTo12;
|
|
373
|
+
export type Margin = SignedUpTo12 | "auto";
|
|
374
|
+
export const SPACING_MAP = {
|
|
375
|
+
0: 0,
|
|
376
|
+
1: 4,
|
|
377
|
+
2: 8,
|
|
378
|
+
3: 12,
|
|
379
|
+
4: 16,
|
|
380
|
+
5: 24,
|
|
381
|
+
6: 32,
|
|
382
|
+
7: 40,
|
|
383
|
+
8: 48,
|
|
384
|
+
9: 56,
|
|
385
|
+
10: 64,
|
|
386
|
+
11: 72,
|
|
387
|
+
12: 80,
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
export function getSpacing(spacing: SignedUpTo12) {
|
|
391
|
+
if (spacing < 0) {
|
|
392
|
+
return SPACING_MAP[Math.abs(spacing) as UnsignedUpTo12] * -1;
|
|
393
|
+
}
|
|
394
|
+
return SPACING_MAP[spacing as UnsignedUpTo12];
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export type TextFieldType =
|
|
398
|
+
| "date"
|
|
399
|
+
| "datetime"
|
|
400
|
+
| "decimal"
|
|
401
|
+
| "decimalRange"
|
|
402
|
+
| "email"
|
|
403
|
+
// | "height"
|
|
404
|
+
| "password"
|
|
405
|
+
| "phoneNumber"
|
|
406
|
+
| "number"
|
|
407
|
+
| "numberRange"
|
|
408
|
+
| "search"
|
|
409
|
+
| "text"
|
|
410
|
+
| "time"
|
|
411
|
+
| "url"
|
|
412
|
+
| "username";
|
|
413
|
+
|
|
414
|
+
export type IconSize = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
415
|
+
|
|
416
|
+
export const iconSizeToNumber = (size?: IconSize) => {
|
|
417
|
+
return {
|
|
418
|
+
"2xl": 28,
|
|
419
|
+
lg: 20,
|
|
420
|
+
md: 16,
|
|
421
|
+
sm: 12,
|
|
422
|
+
xl: 24,
|
|
423
|
+
xs: 8,
|
|
424
|
+
}[size || "md"];
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
export type TextSize = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
428
|
+
|
|
429
|
+
export interface ValueMappingItem {
|
|
430
|
+
value: number;
|
|
431
|
+
label: string;
|
|
432
|
+
size?: IconSize;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export type IconPrefix = "far" | "fas";
|
|
436
|
+
|
|
437
|
+
export interface LayerProps {
|
|
438
|
+
children: ReactChildren;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export interface AccessibilityProps {
|
|
442
|
+
accessibilityLabel: string;
|
|
443
|
+
accessibilityHint: string;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface BoxPropsBase {
|
|
447
|
+
alignContent?: AlignContent;
|
|
448
|
+
alignItems?: AlignItems;
|
|
449
|
+
alignSelf?: AlignSelf;
|
|
450
|
+
bottom?: boolean;
|
|
451
|
+
children?: ReactChildren;
|
|
452
|
+
color?: BoxColor;
|
|
453
|
+
column?: UnsignedUpTo12;
|
|
454
|
+
smColumn?: UnsignedUpTo12;
|
|
455
|
+
mdColumn?: UnsignedUpTo12;
|
|
456
|
+
lgColumn?: UnsignedUpTo12;
|
|
457
|
+
dangerouslySetInlineStyle?: {
|
|
458
|
+
__style: {
|
|
459
|
+
[key: string]: any;
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
direction?: "row" | "column";
|
|
463
|
+
smDirection?: "row" | "column";
|
|
464
|
+
mdDirection?: "row" | "column";
|
|
465
|
+
lgDirection?: "row" | "column";
|
|
466
|
+
display?: "none" | "flex" | "block" | "inlineBlock" | "visuallyHidden";
|
|
467
|
+
smDisplay?: "none" | "flex" | "block" | "inlineBlock" | "visuallyHidden";
|
|
468
|
+
mdDisplay?: "none" | "flex" | "block" | "inlineBlock" | "visuallyHidden";
|
|
469
|
+
lgDisplay?: "none" | "flex" | "block" | "inlineBlock" | "visuallyHidden";
|
|
470
|
+
fit?: boolean;
|
|
471
|
+
flex?: "grow" | "shrink" | "none";
|
|
472
|
+
gap?: SignedUpTo12;
|
|
473
|
+
height?: NumberOrPercentage;
|
|
474
|
+
justifyContent?: "start" | "end" | "center" | "between" | "around";
|
|
475
|
+
left?: boolean;
|
|
476
|
+
margin?: SignedUpTo12;
|
|
477
|
+
smMargin?: SignedUpTo12;
|
|
478
|
+
mdMargin?: SignedUpTo12;
|
|
479
|
+
lgMargin?: SignedUpTo12;
|
|
480
|
+
marginBottom?: SignedUpTo12;
|
|
481
|
+
smMarginBottom?: SignedUpTo12;
|
|
482
|
+
mdMarginBottom?: SignedUpTo12;
|
|
483
|
+
lgMarginBottom?: SignedUpTo12;
|
|
484
|
+
marginEnd?: SignedUpTo12;
|
|
485
|
+
smMarginEnd?: SignedUpTo12;
|
|
486
|
+
mdMarginEnd?: SignedUpTo12;
|
|
487
|
+
lgMarginEnd?: SignedUpTo12;
|
|
488
|
+
marginLeft?: SignedUpTo12;
|
|
489
|
+
smMarginLeft?: SignedUpTo12;
|
|
490
|
+
mdMarginLeft?: SignedUpTo12;
|
|
491
|
+
lgMarginLeft?: SignedUpTo12;
|
|
492
|
+
marginRight?: SignedUpTo12;
|
|
493
|
+
smMarginRight?: SignedUpTo12;
|
|
494
|
+
mdMarginRight?: SignedUpTo12;
|
|
495
|
+
lgMarginRight?: SignedUpTo12;
|
|
496
|
+
marginStart?: SignedUpTo12;
|
|
497
|
+
smMarginStart?: SignedUpTo12;
|
|
498
|
+
mdMarginStart?: SignedUpTo12;
|
|
499
|
+
lgMarginStart?: SignedUpTo12;
|
|
500
|
+
marginTop?: SignedUpTo12;
|
|
501
|
+
smMarginTop?: SignedUpTo12;
|
|
502
|
+
mdMarginTop?: SignedUpTo12;
|
|
503
|
+
lgMarginTop?: SignedUpTo12;
|
|
504
|
+
maxHeight?: NumberOrPercentage;
|
|
505
|
+
maxWidth?: NumberOrPercentage;
|
|
506
|
+
minHeight?: NumberOrPercentage;
|
|
507
|
+
minWidth?: NumberOrPercentage;
|
|
508
|
+
overflow?: "visible" | "hidden" | "scroll" | "scrollX" | "scrollY" | "auto";
|
|
509
|
+
padding?: UnsignedUpTo12;
|
|
510
|
+
smPadding?: UnsignedUpTo12;
|
|
511
|
+
mdPadding?: UnsignedUpTo12;
|
|
512
|
+
lgPadding?: UnsignedUpTo12;
|
|
513
|
+
paddingX?: UnsignedUpTo12;
|
|
514
|
+
smPaddingX?: UnsignedUpTo12;
|
|
515
|
+
mdPaddingX?: UnsignedUpTo12;
|
|
516
|
+
lgPaddingX?: UnsignedUpTo12;
|
|
517
|
+
paddingY?: UnsignedUpTo12;
|
|
518
|
+
smPaddingY?: UnsignedUpTo12;
|
|
519
|
+
mdPaddingY?: UnsignedUpTo12;
|
|
520
|
+
lgPaddingY?: UnsignedUpTo12;
|
|
521
|
+
position?: "static" | "absolute" | "relative" | "fixed";
|
|
522
|
+
right?: boolean;
|
|
523
|
+
rounding?: Rounding | "circle";
|
|
524
|
+
top?: boolean;
|
|
525
|
+
width?: NumberOrPercentage;
|
|
526
|
+
wrap?: boolean;
|
|
527
|
+
zIndex?: number | "auto";
|
|
528
|
+
|
|
529
|
+
onClick?: () => void | Promise<void>;
|
|
530
|
+
className?: string;
|
|
531
|
+
style?: any;
|
|
532
|
+
onHoverStart?: () => void | Promise<void>;
|
|
533
|
+
onHoverEnd?: () => void | Promise<void>;
|
|
534
|
+
scroll?: boolean;
|
|
535
|
+
shadow?: boolean;
|
|
536
|
+
border?: BorderColor;
|
|
537
|
+
borderBottom?: BorderColor;
|
|
538
|
+
borderTop?: BorderColor;
|
|
539
|
+
borderLeft?: BorderColor;
|
|
540
|
+
borderRight?: BorderColor;
|
|
541
|
+
|
|
542
|
+
avoidKeyboard?: boolean;
|
|
543
|
+
keyboardOffset?: number;
|
|
544
|
+
scrollRef?: React.RefObject<any>;
|
|
545
|
+
onScroll?: (offsetY: number) => void;
|
|
546
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
547
|
+
testID?: string;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// If onClick is provided, add accessibility props.
|
|
551
|
+
export type BoxProps =
|
|
552
|
+
| (BoxPropsBase & {onClick?: undefined})
|
|
553
|
+
| (BoxPropsBase & {onClick: () => void} & AccessibilityProps);
|
|
554
|
+
export type BoxColor = SurfaceColor | "transparent";
|
|
555
|
+
|
|
556
|
+
export interface ErrorBoundaryProps {
|
|
557
|
+
onError?: (error: Error, stack: any) => void;
|
|
558
|
+
children?: ReactNode;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export interface IconProps {
|
|
562
|
+
iconName: IconName;
|
|
563
|
+
type?:
|
|
564
|
+
| "regular"
|
|
565
|
+
| "brand"
|
|
566
|
+
| "solid"
|
|
567
|
+
| "light"
|
|
568
|
+
| "thin"
|
|
569
|
+
| "duotone"
|
|
570
|
+
| "sharpSolid"
|
|
571
|
+
| "sharpLight"
|
|
572
|
+
| "sharp";
|
|
573
|
+
color?: IconColor;
|
|
574
|
+
size?: IconSize;
|
|
575
|
+
testID?: string;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export type TooltipPosition = "top" | "bottom" | "left" | "right";
|
|
579
|
+
|
|
580
|
+
export type IndicatorDirection = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
581
|
+
|
|
582
|
+
export interface SegmentedControlBadgeConfig {
|
|
583
|
+
count: number;
|
|
584
|
+
status?: "info" | "error" | "warning" | "success" | "neutral";
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export interface SegmentedControlProps {
|
|
588
|
+
items: string[];
|
|
589
|
+
size?: "md" | "lg"; // default "md"
|
|
590
|
+
onChange: (activeIndex: number) => void;
|
|
591
|
+
selectedIndex?: number;
|
|
592
|
+
maxItems?: number;
|
|
593
|
+
badges?: SegmentedControlBadgeConfig[];
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export interface TimezonePickerProps {
|
|
597
|
+
timezone?: string;
|
|
598
|
+
onChange: (tz: string | undefined) => void | Promise<void>;
|
|
599
|
+
showLabel?: boolean; // defaults to true
|
|
600
|
+
width?: number | string; // defaults to 100
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// extend TextStyle to include "outline" since it exists for web
|
|
604
|
+
export interface TextStyleWithOutline extends TextStyle {
|
|
605
|
+
outline?: string;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
interface BaseFieldProps {
|
|
609
|
+
id?: string;
|
|
610
|
+
testID?: string;
|
|
611
|
+
title?: string;
|
|
612
|
+
placeholder?: string;
|
|
613
|
+
iconName?: IconName;
|
|
614
|
+
onIconClick?: () => void;
|
|
615
|
+
onBlur?: OnChangeCallback;
|
|
616
|
+
onChange: OnChangeCallback;
|
|
617
|
+
onEnter?: () => void;
|
|
618
|
+
onFocus?: () => void;
|
|
619
|
+
onSubmitEditing?: () => void;
|
|
620
|
+
blurOnSubmit?: boolean;
|
|
621
|
+
disabled?: boolean; // default false
|
|
622
|
+
value?: string;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export interface HelperTextProps {
|
|
626
|
+
helperText?: string;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export interface ErrorTextProps {
|
|
630
|
+
errorText?: string;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export interface TextFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {
|
|
634
|
+
type?: "email" | "password" | "phoneNumber" | "search" | "text" | "url";
|
|
635
|
+
|
|
636
|
+
autoComplete?: "current-password" | "on" | "off" | "username";
|
|
637
|
+
returnKeyType?: "done" | "go" | "next" | "search" | "send";
|
|
638
|
+
|
|
639
|
+
grow?: boolean;
|
|
640
|
+
multiline?: boolean;
|
|
641
|
+
rows?: number;
|
|
642
|
+
|
|
643
|
+
inputRef?: any;
|
|
644
|
+
trimOnBlur?: boolean;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export interface TextAreaProps extends Omit<TextFieldProps, "multiline" | "type"> {}
|
|
648
|
+
|
|
649
|
+
export interface NumberFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {
|
|
650
|
+
type: "number" | "decimal";
|
|
651
|
+
min?: number;
|
|
652
|
+
max?: number;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export interface NumberRangeFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {
|
|
656
|
+
type: "numberRange" | "decimalRange";
|
|
657
|
+
min: number;
|
|
658
|
+
max: number;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export interface DateTimeFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {
|
|
662
|
+
type: "date" | "datetime" | "time";
|
|
663
|
+
value?: string; // ISO string always
|
|
664
|
+
onChange: (date: string) => void;
|
|
665
|
+
onTimezoneChange?: (timezone: string) => void;
|
|
666
|
+
dateFormat?: string;
|
|
667
|
+
pickerType?: "default" | "compact" | "inline" | "spinner";
|
|
668
|
+
showTimezone?: boolean; // defaults to true
|
|
669
|
+
timezone?: string;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
export interface EmailFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {}
|
|
673
|
+
|
|
674
|
+
export interface PhoneNumberFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {
|
|
675
|
+
/**
|
|
676
|
+
* Defaults to "US"
|
|
677
|
+
*/
|
|
678
|
+
defaultCountryCode?: CountryCode;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export interface URLFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {}
|
|
682
|
+
|
|
683
|
+
export interface SearchFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {}
|
|
684
|
+
|
|
685
|
+
export interface PercentFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {}
|
|
686
|
+
|
|
687
|
+
export interface CurrencyFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {}
|
|
688
|
+
|
|
689
|
+
export interface AddressFieldProps
|
|
690
|
+
extends Omit<BaseFieldProps, "value" | "onChange" | "onBlur">,
|
|
691
|
+
HelperTextProps,
|
|
692
|
+
ErrorTextProps {
|
|
693
|
+
includeCounty?: boolean;
|
|
694
|
+
googleMapsApiKey?: string;
|
|
695
|
+
googlePlacesMobileStyles?: Styles;
|
|
696
|
+
value: AddressInterface;
|
|
697
|
+
onChange: (value: AddressInterface) => void;
|
|
698
|
+
onBlur?: (value: AddressInterface) => void;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export type Rounding =
|
|
702
|
+
| "minimal" // alias "sm"
|
|
703
|
+
| "default" // alias "md"
|
|
704
|
+
| "full" // alias "lg"
|
|
705
|
+
| "rounded" // alias "3xl"
|
|
706
|
+
| "sm"
|
|
707
|
+
| "md"
|
|
708
|
+
| "lg"
|
|
709
|
+
| "xl"
|
|
710
|
+
| "2xl"
|
|
711
|
+
| "3xl";
|
|
712
|
+
|
|
713
|
+
const ROUNDING_MAP = {
|
|
714
|
+
"2xl": 128,
|
|
715
|
+
"3xl": 360,
|
|
716
|
+
default: 3,
|
|
717
|
+
full: 16,
|
|
718
|
+
lg: 16,
|
|
719
|
+
md: 4,
|
|
720
|
+
minimal: 2,
|
|
721
|
+
rounded: 360,
|
|
722
|
+
sm: 2,
|
|
723
|
+
xl: 32,
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
export function getRounding(rounding: Rounding) {
|
|
727
|
+
return ROUNDING_MAP[rounding];
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export interface HeadingProps {
|
|
731
|
+
align?: "left" | "right" | "center" | "justify"; // default "left"
|
|
732
|
+
children?: React.ReactNode;
|
|
733
|
+
color?: TextColor;
|
|
734
|
+
overflow?: "normal" | "breakWord"; // default "breakWord"
|
|
735
|
+
size?: "sm" | "md" | "lg" | "xl" | "2xl"; // default "sm"
|
|
736
|
+
truncate?: boolean; // default false
|
|
737
|
+
testID?: string;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
export interface MetaProps {
|
|
741
|
+
itemProp?: string;
|
|
742
|
+
content?: string;
|
|
743
|
+
itemType?: string;
|
|
744
|
+
key?: string;
|
|
745
|
+
property?: string;
|
|
746
|
+
children?: ReactNode;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
export interface ImageProps {
|
|
750
|
+
alt?: string;
|
|
751
|
+
color: BoxColor;
|
|
752
|
+
naturalHeight?: number;
|
|
753
|
+
naturalWidth?: number;
|
|
754
|
+
maxWidth?: number;
|
|
755
|
+
maxHeight?: number;
|
|
756
|
+
src: string;
|
|
757
|
+
children?: ReactChildren;
|
|
758
|
+
fit?: "cover" | "contain" | "none";
|
|
759
|
+
onError?: () => void;
|
|
760
|
+
onLoad?: () => void;
|
|
761
|
+
size?: string;
|
|
762
|
+
srcSet?: string;
|
|
763
|
+
fullWidth?: boolean;
|
|
764
|
+
style?: any;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export interface BackButtonInterface {
|
|
768
|
+
onBack: () => void;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export interface BooleanFieldProps extends HelperTextProps, ErrorTextProps {
|
|
772
|
+
title?: string;
|
|
773
|
+
variant?: "simple" | "title"; // default "simple"
|
|
774
|
+
disabled?: boolean;
|
|
775
|
+
disabledHelperText?: string;
|
|
776
|
+
value: boolean;
|
|
777
|
+
onChange: (value: boolean) => void;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
export interface CheckBoxProps {
|
|
781
|
+
/**
|
|
782
|
+
* The background color of the checkbox.
|
|
783
|
+
* @default "default"
|
|
784
|
+
*/
|
|
785
|
+
bgColor?: "default" | "accent" | "black";
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* If true, the checkbox is selected.
|
|
789
|
+
*/
|
|
790
|
+
selected: boolean;
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* The size of the checkbox.
|
|
794
|
+
* @default "md"
|
|
795
|
+
*/
|
|
796
|
+
size?: "sm" | "md" | "lg";
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
export interface LayoutRectangle {
|
|
800
|
+
x: number;
|
|
801
|
+
y: number;
|
|
802
|
+
width: number;
|
|
803
|
+
height: number;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export interface LayoutChangeEvent {
|
|
807
|
+
nativeEvent: {
|
|
808
|
+
layout: LayoutRectangle;
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export interface SplitPageProps {
|
|
813
|
+
/**
|
|
814
|
+
* can accept either one React Child or any array of ReactChild. If this is not provided,
|
|
815
|
+
* renderContent must return one or many ReactChild.
|
|
816
|
+
*/
|
|
817
|
+
children?: ReactChild | ReactChild[] | null;
|
|
818
|
+
/**
|
|
819
|
+
* The names of the tabs that will be generated per ReactChild provided.
|
|
820
|
+
* Tabs will not be generated if renderContent is provided in place of children
|
|
821
|
+
*/
|
|
822
|
+
tabs?: string[];
|
|
823
|
+
// The select limit for the number of tabs that can be selected
|
|
824
|
+
selectLimit?: number;
|
|
825
|
+
// Provide in mobile if you have a bottomTabBar so that split page can adjust accordingly
|
|
826
|
+
bottomNavBarHeight?: number;
|
|
827
|
+
// boolean to initiate and handle state from the app that has imported @terreno/ui
|
|
828
|
+
showItemList?: boolean;
|
|
829
|
+
loading?: boolean;
|
|
830
|
+
color?: SurfaceColor;
|
|
831
|
+
keyboardOffset?: number;
|
|
832
|
+
renderListViewItem: (itemInfo: ListRenderItemInfo<any>) => ReactElement | null;
|
|
833
|
+
renderListViewHeader?: () => ReactElement | null;
|
|
834
|
+
renderContent?: (index?: number) => ReactElement | ReactElement[] | null;
|
|
835
|
+
listViewData: any[];
|
|
836
|
+
listViewExtraData?: any;
|
|
837
|
+
listViewWidth?: number;
|
|
838
|
+
listViewMaxWidth?: number;
|
|
839
|
+
renderChild?: () => ReactChild;
|
|
840
|
+
onSelectionChange?: (value?: any) => void | Promise<void>;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
export type PermissionKind =
|
|
844
|
+
| "location"
|
|
845
|
+
| "locationAlways"
|
|
846
|
+
| "camera"
|
|
847
|
+
| "microphone"
|
|
848
|
+
| "photo"
|
|
849
|
+
| "contacts"
|
|
850
|
+
| "event"
|
|
851
|
+
| "reminder"
|
|
852
|
+
| "bluetooth"
|
|
853
|
+
| "notification"
|
|
854
|
+
| "backgroundRefresh"
|
|
855
|
+
| "speechRecognition"
|
|
856
|
+
| "mediaLibrary"
|
|
857
|
+
| "motion";
|
|
858
|
+
export type PermissionStatus =
|
|
859
|
+
| "authorized"
|
|
860
|
+
| "denied"
|
|
861
|
+
| "softDenied"
|
|
862
|
+
| "restricted"
|
|
863
|
+
| "undetermined";
|
|
864
|
+
|
|
865
|
+
export interface AddressInterface {
|
|
866
|
+
address1: string;
|
|
867
|
+
address2?: string;
|
|
868
|
+
city: string;
|
|
869
|
+
state: string;
|
|
870
|
+
zipcode: string;
|
|
871
|
+
countyName?: string;
|
|
872
|
+
countyCode?: string;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export interface TransformValueOptions {
|
|
876
|
+
func?: (value: string) => string;
|
|
877
|
+
options?: {
|
|
878
|
+
[key: string]: any;
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// TODO: Tighten up type to exclude string, which is almost never an acceptable type for React
|
|
883
|
+
// Native children (except Heading or Text for example.).
|
|
884
|
+
export type ReactChild = ReactNode;
|
|
885
|
+
export type ReactChildren = ReactNode;
|
|
886
|
+
export type WithChildren<P> = P & {children?: ReactNode};
|
|
887
|
+
|
|
888
|
+
export interface AddressAutocompleteProps {
|
|
889
|
+
disabled?: boolean;
|
|
890
|
+
googleMapsApiKey?: string;
|
|
891
|
+
includeCounty?: boolean;
|
|
892
|
+
inputValue: string;
|
|
893
|
+
styles?: Styles;
|
|
894
|
+
handleAddressChange: OnChangeCallback;
|
|
895
|
+
handleAutoCompleteChange: (value: AddressInterface) => void;
|
|
896
|
+
googlePlacesMobileStyles?: Styles;
|
|
897
|
+
testID?: string;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
export interface ActionSheetProps {
|
|
901
|
+
children?: React.ReactNode;
|
|
902
|
+
ref?: React.MutableRefObject<{
|
|
903
|
+
/**
|
|
904
|
+
* Open or close the ActionSheet.
|
|
905
|
+
*/
|
|
906
|
+
setModalVisible(visible?: boolean): void;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Open the Action Sheet.
|
|
910
|
+
*/
|
|
911
|
+
show(): void;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Close the ActionSheet.
|
|
915
|
+
*/
|
|
916
|
+
hide(): void;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Attach this to any child ScrollView Component's onScrollEndDrag,
|
|
920
|
+
* onMomentumScrollEnd,onScrollAnimationEnd callbacks to handle the ActionSheet
|
|
921
|
+
* closing and bouncing back properly.
|
|
922
|
+
*/
|
|
923
|
+
handleChildScrollEnd(): void;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Snap ActionSheet to given offset
|
|
927
|
+
*/
|
|
928
|
+
snapToOffset(offset: number): void;
|
|
929
|
+
}>;
|
|
930
|
+
/**
|
|
931
|
+
* Animate the opening and closing of ActionSheet.
|
|
932
|
+
|
|
933
|
+
| Type | Required |
|
|
934
|
+
| ---- | -------- |
|
|
935
|
+
| boolean | no |
|
|
936
|
+
|
|
937
|
+
Default: `true`
|
|
938
|
+
*/
|
|
939
|
+
animated?: boolean;
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Use if you want to show the ActionSheet Partially on Opening.
|
|
943
|
+
* **Requires `gestureEnabled=true`**
|
|
944
|
+
|
|
945
|
+
| Type | Required |
|
|
946
|
+
| ---- | -------- |
|
|
947
|
+
| boolean | no |
|
|
948
|
+
|
|
949
|
+
Default:`1`
|
|
950
|
+
*/
|
|
951
|
+
|
|
952
|
+
initialOffsetFromBottom?: number;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* When touch ends and user has not moved farther from the set springOffset,
|
|
956
|
+
* the ActionSheet will return to previous position.
|
|
957
|
+
|
|
958
|
+
| Type | Required |
|
|
959
|
+
| ---- | -------- |
|
|
960
|
+
| number | no |
|
|
961
|
+
|
|
962
|
+
Default: `50`
|
|
963
|
+
*/
|
|
964
|
+
springOffset?: number;
|
|
965
|
+
/**
|
|
966
|
+
* Add elevation to the ActionSheet container.
|
|
967
|
+
|
|
968
|
+
| Type | Required |
|
|
969
|
+
| ---- | -------- |
|
|
970
|
+
| number | no |
|
|
971
|
+
|
|
972
|
+
Default: `0`
|
|
973
|
+
|
|
974
|
+
#
|
|
975
|
+
*/
|
|
976
|
+
elevation?: number;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Color of the gestureEnabled Indicator.
|
|
980
|
+
|
|
981
|
+
| Type | Required |
|
|
982
|
+
| ---- | -------- |
|
|
983
|
+
| string | no |
|
|
984
|
+
|
|
985
|
+
Default: `"#f0f0f0"`
|
|
986
|
+
*/
|
|
987
|
+
indicatorColor?: string;
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Normally when the ActionSheet is fully opened, a small portion from the bottom is hidden by
|
|
991
|
+
* default. Use this prop if you want the ActionSheet to hover over the bottom of screen and not
|
|
992
|
+
* hide a little behind it.
|
|
993
|
+
|
|
994
|
+
| Type | Required |
|
|
995
|
+
| ---- | -------- |
|
|
996
|
+
| number | no |
|
|
997
|
+
|
|
998
|
+
Default:`0`
|
|
999
|
+
*/
|
|
1000
|
+
extraScroll?: number;
|
|
1001
|
+
/**
|
|
1002
|
+
* Color of the overlay/backdrop.
|
|
1003
|
+
|
|
1004
|
+
| Type | Required |
|
|
1005
|
+
| ---- | -------- |
|
|
1006
|
+
| string | no |
|
|
1007
|
+
|
|
1008
|
+
Default: `"black"`
|
|
1009
|
+
*/
|
|
1010
|
+
overlayColor?: string;
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Keep the header always visible even when gestures are disabled.
|
|
1014
|
+
|
|
1015
|
+
| Type | Required |
|
|
1016
|
+
| ---- | -------- |
|
|
1017
|
+
| boolean | no |
|
|
1018
|
+
|
|
1019
|
+
Default: `false`
|
|
1020
|
+
*/
|
|
1021
|
+
headerAlwaysVisible?: boolean;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* Delay draw of ActionSheet on open for android.
|
|
1025
|
+
|
|
1026
|
+
| Type | Required |
|
|
1027
|
+
| ---- | -------- |
|
|
1028
|
+
| boolean | no |
|
|
1029
|
+
|
|
1030
|
+
Default: `false`
|
|
1031
|
+
*/
|
|
1032
|
+
|
|
1033
|
+
delayActionSheetDraw?: boolean;
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Delay draw of ActionSheet on open for android time.
|
|
1037
|
+
|
|
1038
|
+
| Type | Required |
|
|
1039
|
+
| ---- | -------- |
|
|
1040
|
+
| number (ms) | no |
|
|
1041
|
+
|
|
1042
|
+
Default: `50`
|
|
1043
|
+
*/
|
|
1044
|
+
|
|
1045
|
+
delayActionSheetDrawTime?: number;
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Your custom header component. Using this will hide the default indicator.
|
|
1049
|
+
|
|
1050
|
+
| Type | Required |
|
|
1051
|
+
| ---- | -------- |
|
|
1052
|
+
| React.Component | no |
|
|
1053
|
+
*/
|
|
1054
|
+
CustomHeaderComponent?: React.ReactNode;
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Any custom styles for the container.
|
|
1058
|
+
|
|
1059
|
+
| Type | Required |
|
|
1060
|
+
| ---- | -------- |
|
|
1061
|
+
| Object | no |
|
|
1062
|
+
*/
|
|
1063
|
+
containerStyle?: ViewStyle;
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* Control closing ActionSheet by touching on backdrop.
|
|
1067
|
+
|
|
1068
|
+
| Type | Required |
|
|
1069
|
+
| ---- | -------- |
|
|
1070
|
+
| boolean | no |
|
|
1071
|
+
|
|
1072
|
+
Default: `true`
|
|
1073
|
+
*/
|
|
1074
|
+
closeOnTouchBackdrop?: boolean;
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Speed of opening animation. Higher means the ActionSheet will open more quickly.
|
|
1078
|
+
|
|
1079
|
+
| Type | Required |
|
|
1080
|
+
| ---- | -------- |
|
|
1081
|
+
| number | no |
|
|
1082
|
+
|
|
1083
|
+
Default: `12`
|
|
1084
|
+
*/
|
|
1085
|
+
openAnimationSpeed?: number;
|
|
1086
|
+
/**
|
|
1087
|
+
* Duration of closing animation.
|
|
1088
|
+
|
|
1089
|
+
| Type | Required |
|
|
1090
|
+
| ---- | -------- |
|
|
1091
|
+
| number | no |
|
|
1092
|
+
|
|
1093
|
+
Default: `300`
|
|
1094
|
+
*/
|
|
1095
|
+
closeAnimationDuration?: number;
|
|
1096
|
+
/**
|
|
1097
|
+
*
|
|
1098
|
+
How much you want the ActionSheet to bounce when it is opened.
|
|
1099
|
+
|
|
1100
|
+
| Type | Required |
|
|
1101
|
+
| ---- | -------- |
|
|
1102
|
+
| number | no |
|
|
1103
|
+
|
|
1104
|
+
Default: `8`
|
|
1105
|
+
*/
|
|
1106
|
+
bounciness?: number;
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Will the ActionSheet close on `hardwareBackPress` event.
|
|
1110
|
+
|
|
1111
|
+
| Type | Required |
|
|
1112
|
+
| ---- | -------- |
|
|
1113
|
+
| boolean | no |
|
|
1114
|
+
|
|
1115
|
+
Default: `true`
|
|
1116
|
+
*/
|
|
1117
|
+
closeOnPressBack?: boolean;
|
|
1118
|
+
/**
|
|
1119
|
+
* Default opacity of the overlay/backdrop.
|
|
1120
|
+
|
|
1121
|
+
| Type | Required |
|
|
1122
|
+
| ---- | -------- |
|
|
1123
|
+
| number 0 - 1 | no |
|
|
1124
|
+
|
|
1125
|
+
Default: `0.3`
|
|
1126
|
+
*/
|
|
1127
|
+
defaultOverlayOpacity?: number;
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Enables gesture control of ActionSheet
|
|
1131
|
+
|
|
1132
|
+
| Type | Required |
|
|
1133
|
+
| ---- | -------- |
|
|
1134
|
+
| boolean | no |
|
|
1135
|
+
|
|
1136
|
+
Default: `false`
|
|
1137
|
+
*/
|
|
1138
|
+
gestureEnabled?: boolean;
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Bounces the ActionSheet on open.
|
|
1142
|
+
|
|
1143
|
+
| Type | Required |
|
|
1144
|
+
| ---- | -------- |
|
|
1145
|
+
| boolean | no |
|
|
1146
|
+
|
|
1147
|
+
Default: `false`
|
|
1148
|
+
*/
|
|
1149
|
+
bounceOnOpen?: boolean;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Setting the keyboard persistence of the ScrollView component, should be one of "never",
|
|
1153
|
+
* "always", or "handled"
|
|
1154
|
+
|
|
1155
|
+
| Type | Required |
|
|
1156
|
+
| ---- | -------- |
|
|
1157
|
+
| string | no |
|
|
1158
|
+
|
|
1159
|
+
Default: `"never"`
|
|
1160
|
+
*/
|
|
1161
|
+
keyboardShouldPersistTaps?: boolean | "always" | "never" | "handled";
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* Determine whether the modal should go under the system statusbar.
|
|
1165
|
+
|
|
1166
|
+
| Type | Required |
|
|
1167
|
+
| ---- | -------- |
|
|
1168
|
+
| boolean | no |
|
|
1169
|
+
|
|
1170
|
+
Default: `true`
|
|
1171
|
+
*/
|
|
1172
|
+
statusBarTranslucent?: boolean;
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Prevent ActionSheet from closing on
|
|
1176
|
+
* gesture or tapping on backdrop.
|
|
1177
|
+
* Instead snap it to `bottomOffset` location
|
|
1178
|
+
*
|
|
1179
|
+
*
|
|
1180
|
+
* | Type | Required |
|
|
1181
|
+
| ---- | -------- |
|
|
1182
|
+
| boolean | no |
|
|
1183
|
+
*/
|
|
1184
|
+
closable?: boolean;
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Allow ActionSheet to draw under the StatusBar.
|
|
1188
|
+
* This is enabled by default.
|
|
1189
|
+
*
|
|
1190
|
+
*
|
|
1191
|
+
* | Type | Required |
|
|
1192
|
+
| ---- | -------- |
|
|
1193
|
+
| boolean | no |
|
|
1194
|
+
Default: `true`
|
|
1195
|
+
*/
|
|
1196
|
+
drawUnderStatusBar?: boolean;
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Snap ActionSheet to this location if `closable` is set to false;
|
|
1200
|
+
*
|
|
1201
|
+
*
|
|
1202
|
+
* | Type | Required |
|
|
1203
|
+
| ---- | -------- |
|
|
1204
|
+
| number | no |
|
|
1205
|
+
*/
|
|
1206
|
+
|
|
1207
|
+
bottomOffset?: number;
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* Change how ActionSheet behaves when keyboard is opened.
|
|
1211
|
+
*
|
|
1212
|
+
*
|
|
1213
|
+
* | Type | Required |
|
|
1214
|
+
| ---- | -------- |
|
|
1215
|
+
| "padding" | "position" | no |
|
|
1216
|
+
Default:`padding`
|
|
1217
|
+
*/
|
|
1218
|
+
|
|
1219
|
+
keyboardMode?: "padding" | "position";
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* Test ID for unit testing
|
|
1223
|
+
*/
|
|
1224
|
+
testID?: string;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
*
|
|
1228
|
+
Event called when the ActionSheet closes.
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
* | Type | Required |
|
|
1232
|
+
| ---- | -------- |
|
|
1233
|
+
| function | no |
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
#
|
|
1237
|
+
*/
|
|
1238
|
+
|
|
1239
|
+
onClose?: () => void;
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* An event called when the ActionSheet Opens.
|
|
1243
|
+
|
|
1244
|
+
| Type | Required |
|
|
1245
|
+
| ---- | -------- |
|
|
1246
|
+
| function | no |
|
|
1247
|
+
*/
|
|
1248
|
+
onOpen?: () => void;
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Event called when position of ActionSheet changes.
|
|
1252
|
+
*/
|
|
1253
|
+
onPositionChanged?: (hasReachedTop: boolean) => void;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
export type AvatarStatus = "offline" | "online" | "outOfOffice" | "activeMobile" | "imagePicker";
|
|
1257
|
+
|
|
1258
|
+
export interface AvatarImagePickerEvent {
|
|
1259
|
+
avatarImageFormat?: string;
|
|
1260
|
+
base64?: string;
|
|
1261
|
+
uri?: string;
|
|
1262
|
+
height?: number;
|
|
1263
|
+
width?: number;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
export interface CustomSvgProps extends SvgProps {
|
|
1267
|
+
doNotDisturb?: boolean;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
export interface AvatarProps {
|
|
1271
|
+
/**
|
|
1272
|
+
* The name of the user. This is used for the placeholder treatment if an image is not available.
|
|
1273
|
+
*/
|
|
1274
|
+
name: string;
|
|
1275
|
+
/**
|
|
1276
|
+
* Adds a white border around Avatar so it's visible when displayed on other images.
|
|
1277
|
+
*/
|
|
1278
|
+
hasBorder?: boolean;
|
|
1279
|
+
/**
|
|
1280
|
+
* xs: 24px, sm: 32px, md: 48px, lg: 64px, xl: 120px.
|
|
1281
|
+
*/
|
|
1282
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1283
|
+
/**
|
|
1284
|
+
* The URL of the user's image.
|
|
1285
|
+
*/
|
|
1286
|
+
src?: string;
|
|
1287
|
+
/**
|
|
1288
|
+
* Function to handle the avatar image edit
|
|
1289
|
+
*/
|
|
1290
|
+
onChange?: (val: AvatarImagePickerEvent) => void;
|
|
1291
|
+
/**
|
|
1292
|
+
* The status of the user to display with the avatar.
|
|
1293
|
+
*/
|
|
1294
|
+
status?: AvatarStatus;
|
|
1295
|
+
/**
|
|
1296
|
+
* If true, the status will have a "Z" to indicate the user has snoozed notifications.
|
|
1297
|
+
*/
|
|
1298
|
+
doNotDisturb?: boolean;
|
|
1299
|
+
/**
|
|
1300
|
+
* Accessibility label for the avatar image.
|
|
1301
|
+
*/
|
|
1302
|
+
accessibilityLabel?: string;
|
|
1303
|
+
/**
|
|
1304
|
+
* Test ID for unit testing
|
|
1305
|
+
*/
|
|
1306
|
+
testID?: string;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
export interface BadgeProps {
|
|
1310
|
+
/**
|
|
1311
|
+
* When status is "custom", determines the badge's background color.
|
|
1312
|
+
*/
|
|
1313
|
+
customBackgroundColor?: string;
|
|
1314
|
+
/**
|
|
1315
|
+
* When status is "custom", determines the badge's border color.
|
|
1316
|
+
*/
|
|
1317
|
+
customBorderColor?: string;
|
|
1318
|
+
/**
|
|
1319
|
+
* When status is "custom", determines the badge's icon color
|
|
1320
|
+
*/
|
|
1321
|
+
customIconColor?: IconColor;
|
|
1322
|
+
/**
|
|
1323
|
+
* When status is "custom", determines the badge's icon
|
|
1324
|
+
*/
|
|
1325
|
+
customIconName?: IconName;
|
|
1326
|
+
/**
|
|
1327
|
+
* When status is "custom", determines the badge's text color.
|
|
1328
|
+
*/
|
|
1329
|
+
customTextColor?: string;
|
|
1330
|
+
/**
|
|
1331
|
+
* The name of the icon to display in the badge.
|
|
1332
|
+
*/
|
|
1333
|
+
iconName?: IconName;
|
|
1334
|
+
|
|
1335
|
+
// TODO: improve type discrimination
|
|
1336
|
+
// used for numberOnly variant to display "${maxValue}+" when value is greater than max
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* The maximum value to display. Used for "numberOnly" variant to display "${maxValue}+" when
|
|
1340
|
+
* value is greater than max.
|
|
1341
|
+
*/
|
|
1342
|
+
maxValue?: number;
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* If true, the badge will have a secondary style.
|
|
1346
|
+
* @default false
|
|
1347
|
+
*/
|
|
1348
|
+
secondary?: boolean;
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* The status of the badge. Determines its color and appearance.
|
|
1352
|
+
* @default "info"
|
|
1353
|
+
*/
|
|
1354
|
+
status?: "info" | "error" | "warning" | "success" | "neutral" | "custom";
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* Test ID for unit testing
|
|
1358
|
+
*/
|
|
1359
|
+
testID?: string;
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* The text or number to display inside the badge.
|
|
1363
|
+
*/
|
|
1364
|
+
value?: number | string;
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* The variant of the badge. Determines if it displays an icon or number only.
|
|
1368
|
+
*/
|
|
1369
|
+
variant?: "iconOnly" | "numberOnly";
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
export interface SelectBadgeProps {
|
|
1373
|
+
/**
|
|
1374
|
+
* When status is "custom", determines the badge's background color.
|
|
1375
|
+
*/
|
|
1376
|
+
customBackgroundColor?: string;
|
|
1377
|
+
/**
|
|
1378
|
+
* When status is "custom", determines the badge's border color.
|
|
1379
|
+
*/
|
|
1380
|
+
customBorderColor?: string;
|
|
1381
|
+
/**
|
|
1382
|
+
* When status is "custom", determines the badge's text color.
|
|
1383
|
+
*/
|
|
1384
|
+
customTextColor?: string;
|
|
1385
|
+
/**
|
|
1386
|
+
* If true, the badge will be disabled and not interactive.
|
|
1387
|
+
* @default false
|
|
1388
|
+
*/
|
|
1389
|
+
disabled?: boolean;
|
|
1390
|
+
/**
|
|
1391
|
+
* The options available for the dropdown badge.
|
|
1392
|
+
* Each option should have a label and a value.
|
|
1393
|
+
*/
|
|
1394
|
+
options: FieldOption[];
|
|
1395
|
+
/**
|
|
1396
|
+
* The current value of the select field.
|
|
1397
|
+
*/
|
|
1398
|
+
value?: string;
|
|
1399
|
+
/**
|
|
1400
|
+
* If true, the badge will have a secondary style.
|
|
1401
|
+
* @default false
|
|
1402
|
+
*/
|
|
1403
|
+
secondary?: boolean;
|
|
1404
|
+
/**
|
|
1405
|
+
* The status of the badge. Determines its color and appearance.
|
|
1406
|
+
* @default "info"
|
|
1407
|
+
*/
|
|
1408
|
+
status?: "info" | "error" | "warning" | "success" | "neutral" | "custom";
|
|
1409
|
+
/**
|
|
1410
|
+
* The function to call when the selected value changes.
|
|
1411
|
+
*/
|
|
1412
|
+
onChange: (value: string) => void;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
export interface BannerButtonProps {
|
|
1416
|
+
/**
|
|
1417
|
+
* Text to display on optional banner button, will display button if provided
|
|
1418
|
+
*/
|
|
1419
|
+
buttonText: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* Icon to display on optional banner button
|
|
1422
|
+
*/
|
|
1423
|
+
buttonIconName?: IconName;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
export interface BannerPropsBase {
|
|
1427
|
+
/**
|
|
1428
|
+
* Used to identify if banner has been dismissed by the user.
|
|
1429
|
+
*/
|
|
1430
|
+
id: string;
|
|
1431
|
+
/**
|
|
1432
|
+
* The text to display in the main body of the banner.
|
|
1433
|
+
*/
|
|
1434
|
+
text: string;
|
|
1435
|
+
/**
|
|
1436
|
+
* The status of the banner changes the color of the banner.
|
|
1437
|
+
* @default "info"
|
|
1438
|
+
*/
|
|
1439
|
+
status?: "info" | "alert" | "warning";
|
|
1440
|
+
/**
|
|
1441
|
+
* Allows the banner to be dismissed and removed by clicking X button on the right.
|
|
1442
|
+
* @default false
|
|
1443
|
+
*/
|
|
1444
|
+
dismissible?: boolean; // default false
|
|
1445
|
+
/**
|
|
1446
|
+
* Renders triangle with exclamation mark icon to the left of banner content.
|
|
1447
|
+
* @default false
|
|
1448
|
+
*/
|
|
1449
|
+
hasIcon?: boolean;
|
|
1450
|
+
/**
|
|
1451
|
+
* Function called when optional button on banner is clicked.
|
|
1452
|
+
*/
|
|
1453
|
+
buttonOnClick?: () => void | Promise<void>;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
export type BannerProps =
|
|
1457
|
+
| (BannerPropsBase & {buttonOnClick?: undefined})
|
|
1458
|
+
| (BannerPropsBase & {buttonOnClick: () => void | Promise<void>} & BannerButtonProps);
|
|
1459
|
+
|
|
1460
|
+
export interface BodyProps {
|
|
1461
|
+
scroll?: boolean;
|
|
1462
|
+
loading?: boolean;
|
|
1463
|
+
padding?: UnsignedUpTo12;
|
|
1464
|
+
height?: number | string;
|
|
1465
|
+
avoidKeyboard?: boolean; // default true
|
|
1466
|
+
children?: ReactNode;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
export interface ButtonProps {
|
|
1470
|
+
/**
|
|
1471
|
+
* The text content of the confirmation modal.
|
|
1472
|
+
* @default "Are you sure you want to continue?"
|
|
1473
|
+
*/
|
|
1474
|
+
confirmationText?: string;
|
|
1475
|
+
/**
|
|
1476
|
+
* If true, the button will be disabled.
|
|
1477
|
+
* @default false
|
|
1478
|
+
*/
|
|
1479
|
+
disabled?: boolean;
|
|
1480
|
+
/**
|
|
1481
|
+
* If true, the button will take the full width of its container.
|
|
1482
|
+
* @default false
|
|
1483
|
+
*/
|
|
1484
|
+
fullWidth?: boolean;
|
|
1485
|
+
/**
|
|
1486
|
+
* The name of the icon to display in the button.
|
|
1487
|
+
*/
|
|
1488
|
+
iconName?: IconName;
|
|
1489
|
+
/**
|
|
1490
|
+
* The position of the icon within the button.
|
|
1491
|
+
* @default "left"
|
|
1492
|
+
*/
|
|
1493
|
+
iconPosition?: "left" | "right";
|
|
1494
|
+
/**
|
|
1495
|
+
* If true, a loading spinner will be shown in the button.
|
|
1496
|
+
*/
|
|
1497
|
+
loading?: boolean;
|
|
1498
|
+
/**
|
|
1499
|
+
* The title of the confirmation modal.
|
|
1500
|
+
* @default "Confirm"
|
|
1501
|
+
*/
|
|
1502
|
+
modalTitle?: string;
|
|
1503
|
+
/**
|
|
1504
|
+
* The subtitle of the confirmation modal.
|
|
1505
|
+
*/
|
|
1506
|
+
modalSubTitle?: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* The test ID for the button, used for testing purposes.
|
|
1509
|
+
*/
|
|
1510
|
+
testID?: string;
|
|
1511
|
+
/**
|
|
1512
|
+
* The text content of the button.
|
|
1513
|
+
*/
|
|
1514
|
+
text: string;
|
|
1515
|
+
/**
|
|
1516
|
+
* The position of the tooltip.
|
|
1517
|
+
*/
|
|
1518
|
+
tooltipIdealPosition?: TooltipPosition;
|
|
1519
|
+
/**
|
|
1520
|
+
* Include an arrow in the tooltip. Pointing to the button.
|
|
1521
|
+
* @default false
|
|
1522
|
+
*/
|
|
1523
|
+
tooltipIncludeArrow?: boolean;
|
|
1524
|
+
/**
|
|
1525
|
+
* The text content of the tooltip.
|
|
1526
|
+
*/
|
|
1527
|
+
tooltipText?: string;
|
|
1528
|
+
/**
|
|
1529
|
+
* The type of the button, which determines its style.
|
|
1530
|
+
* @default "primary"
|
|
1531
|
+
*/
|
|
1532
|
+
variant?: "primary" | "secondary" | "muted" | "outline" | "destructive";
|
|
1533
|
+
/**
|
|
1534
|
+
* If true, a confirmation modal will be shown before the onClick action.
|
|
1535
|
+
*/
|
|
1536
|
+
withConfirmation?: boolean;
|
|
1537
|
+
/**
|
|
1538
|
+
* The function to call when the button is clicked.
|
|
1539
|
+
*/
|
|
1540
|
+
onClick: () => void | Promise<void>;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
export interface CustomSelectFieldProps {
|
|
1544
|
+
/**
|
|
1545
|
+
* The current value of the custom select field.
|
|
1546
|
+
*/
|
|
1547
|
+
value: string | undefined;
|
|
1548
|
+
|
|
1549
|
+
/**
|
|
1550
|
+
* The function to call when the custom select field value changes.
|
|
1551
|
+
*/
|
|
1552
|
+
onChange: (value: string | undefined) => void;
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* The options available for selection in the select field.
|
|
1556
|
+
* Each option should have a label and a value.
|
|
1557
|
+
*/
|
|
1558
|
+
options: FieldOption[];
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* The placeholder text to display when no option is selected.
|
|
1562
|
+
*/
|
|
1563
|
+
|
|
1564
|
+
placeholder?: string;
|
|
1565
|
+
/**
|
|
1566
|
+
* If true, the select field will be disabled.
|
|
1567
|
+
* @default false
|
|
1568
|
+
*/
|
|
1569
|
+
disabled?: boolean;
|
|
1570
|
+
|
|
1571
|
+
/**
|
|
1572
|
+
* The error text to display if there is an error.
|
|
1573
|
+
*/
|
|
1574
|
+
errorText?: string;
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* The helper text to display below the select field.
|
|
1578
|
+
*/
|
|
1579
|
+
helperText?: string;
|
|
1580
|
+
|
|
1581
|
+
/**
|
|
1582
|
+
* The title of the custom select field.
|
|
1583
|
+
*/
|
|
1584
|
+
title?: string;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
export interface DateTimeActionSheetProps {
|
|
1588
|
+
value?: string;
|
|
1589
|
+
type?: "date" | "time" | "datetime";
|
|
1590
|
+
// Returns an ISO 8601 string. If mode is "time", the date portion is today.
|
|
1591
|
+
onChange: OnChangeCallback;
|
|
1592
|
+
actionSheetRef: React.RefObject<any>;
|
|
1593
|
+
visible: boolean;
|
|
1594
|
+
onDismiss: () => void;
|
|
1595
|
+
timezone?: string;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
export interface DecimalRangeActionSheetProps {
|
|
1599
|
+
value: string;
|
|
1600
|
+
min: number;
|
|
1601
|
+
max: number;
|
|
1602
|
+
onChange: OnChangeCallback;
|
|
1603
|
+
actionSheetRef: React.RefObject<any>;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
export interface DecimalRangeActionSheetState {
|
|
1607
|
+
whole: string;
|
|
1608
|
+
decimal: string;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
export interface DismissButtonProps {
|
|
1612
|
+
/**
|
|
1613
|
+
* The accessibility hint describes the results of performing an action on a control or view.
|
|
1614
|
+
* It should be a very brief description of the result of interacting with the button.
|
|
1615
|
+
*/
|
|
1616
|
+
accessibilityHint: string;
|
|
1617
|
+
|
|
1618
|
+
/**
|
|
1619
|
+
* The accessibility label attribute identifies the user interface element.
|
|
1620
|
+
* It should be a very brief description of the element, such as "Dismiss".
|
|
1621
|
+
*/
|
|
1622
|
+
accessibilityLabel: string;
|
|
1623
|
+
/**
|
|
1624
|
+
* A function to call when the button is clicked,
|
|
1625
|
+
* function should result in hiding the element rendering the dismiss button.
|
|
1626
|
+
*/
|
|
1627
|
+
onClick: () => void;
|
|
1628
|
+
/**
|
|
1629
|
+
* Color of the icon on the dismiss button
|
|
1630
|
+
* @default "primary"
|
|
1631
|
+
*/
|
|
1632
|
+
color?: IconColor;
|
|
1633
|
+
}
|
|
1634
|
+
export interface ErrorPageProps {
|
|
1635
|
+
error: Error;
|
|
1636
|
+
resetError: () => void;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
export type FieldProps =
|
|
1640
|
+
| TextFieldProps
|
|
1641
|
+
| NumberFieldProps
|
|
1642
|
+
| NumberRangeFieldProps
|
|
1643
|
+
| DateTimeFieldProps
|
|
1644
|
+
| (MultiselectFieldProps & {type: "multiselect"})
|
|
1645
|
+
| (TextAreaProps & {type: "textarea"})
|
|
1646
|
+
| (SelectFieldProps & {type: "select"})
|
|
1647
|
+
| (CustomSelectFieldProps & {type: "customSelect"})
|
|
1648
|
+
| (EmailFieldProps & {type: "email"})
|
|
1649
|
+
| (PhoneNumberFieldProps & {type: "phoneNumber"})
|
|
1650
|
+
| (BooleanFieldProps & {type: "boolean"})
|
|
1651
|
+
| (RadioFieldProps & {type: "radio"})
|
|
1652
|
+
| (SignatureFieldProps & {type: "signature"})
|
|
1653
|
+
| (SearchFieldProps & {type: "search"})
|
|
1654
|
+
| (AddressFieldProps & {type: "address"});
|
|
1655
|
+
// | (CurrencyFieldProps & {type: "currency"});
|
|
1656
|
+
// | (PercentFieldProps & {type: "percent"});
|
|
1657
|
+
// | URLFieldProps
|
|
1658
|
+
|
|
1659
|
+
export interface HeightActionSheetProps {
|
|
1660
|
+
value?: string;
|
|
1661
|
+
onChange: OnChangeCallback;
|
|
1662
|
+
actionSheetRef: React.RefObject<any>;
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
export interface HyperlinkProps {
|
|
1666
|
+
linkDefault?: boolean;
|
|
1667
|
+
linkify?: any;
|
|
1668
|
+
linkStyle?: StyleProp<any>;
|
|
1669
|
+
linkText?: string | ((url: string) => string);
|
|
1670
|
+
onPress?: (url: string) => void;
|
|
1671
|
+
onLongPress?: (url: string, text: string) => void;
|
|
1672
|
+
injectViewProps?: (url: string) => any;
|
|
1673
|
+
children?: React.ReactNode;
|
|
1674
|
+
style?: StyleProp<any>;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
export interface IconButtonProps {
|
|
1678
|
+
/**
|
|
1679
|
+
* The accessibility hint describes the results of performing an action on a control or view.
|
|
1680
|
+
* It should be a very brief description of the result of interacting with the button.
|
|
1681
|
+
*/
|
|
1682
|
+
accessibilityHint?: string;
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* The accessibility label attribute identifies the user interface element.
|
|
1686
|
+
* It should be a very brief description of the element, such as "Add", "Play", "Deleted", etc.
|
|
1687
|
+
*/
|
|
1688
|
+
accessibilityLabel: string;
|
|
1689
|
+
|
|
1690
|
+
/**
|
|
1691
|
+
* The heading of the confirmation modal.
|
|
1692
|
+
* @default "Confirm"
|
|
1693
|
+
*/
|
|
1694
|
+
confirmationHeading?: string;
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* The text content of the confirmation modal.
|
|
1698
|
+
* @default "Are you sure you want to continue?"
|
|
1699
|
+
*/
|
|
1700
|
+
confirmationText?: string;
|
|
1701
|
+
|
|
1702
|
+
/**
|
|
1703
|
+
* If true, the button will be disabled.
|
|
1704
|
+
* @default false
|
|
1705
|
+
*/
|
|
1706
|
+
disabled?: boolean;
|
|
1707
|
+
|
|
1708
|
+
/**
|
|
1709
|
+
* Show a small indicator icon in the lower right corner of the button.
|
|
1710
|
+
*/
|
|
1711
|
+
indicator?: "error" | "warning" | "success" | "primary" | "neutral";
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* The text or number to display in the indicator. If not provided,
|
|
1715
|
+
* the indicator will be a solid circle.
|
|
1716
|
+
*/
|
|
1717
|
+
indicatorText?: number | string;
|
|
1718
|
+
|
|
1719
|
+
/**
|
|
1720
|
+
* The name of the icon to display in the button.
|
|
1721
|
+
*/
|
|
1722
|
+
iconName: IconName;
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* If true, a loading spinner will be shown in the button.
|
|
1726
|
+
*/
|
|
1727
|
+
loading?: boolean;
|
|
1728
|
+
|
|
1729
|
+
/**
|
|
1730
|
+
* The test ID for the button, used for testing purposes.
|
|
1731
|
+
*/
|
|
1732
|
+
testID?: string;
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* The ideal position of the tooltip.
|
|
1736
|
+
*/
|
|
1737
|
+
tooltipIdealPosition?: TooltipPosition;
|
|
1738
|
+
|
|
1739
|
+
/**
|
|
1740
|
+
* Include an arrow in the tooltip. Pointing to the button.
|
|
1741
|
+
* @default false
|
|
1742
|
+
*/
|
|
1743
|
+
tooltipIncludeArrow?: boolean;
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* The text content of the tooltip.
|
|
1747
|
+
*/
|
|
1748
|
+
tooltipText?: string;
|
|
1749
|
+
|
|
1750
|
+
/**
|
|
1751
|
+
* The variant of the button, which determines its style.
|
|
1752
|
+
* @default "primary"
|
|
1753
|
+
*/
|
|
1754
|
+
variant?: "primary" | "secondary" | "muted" | "destructive" | "navigation";
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* If true, a confirmation modal will be shown before the onClick action.
|
|
1758
|
+
* @default false
|
|
1759
|
+
*/
|
|
1760
|
+
withConfirmation?: boolean;
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
* The function to call when the button is clicked.
|
|
1764
|
+
*/
|
|
1765
|
+
onClick: () => void | Promise<void>;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
export interface InfoTooltipButtonProps {
|
|
1769
|
+
text: string;
|
|
1770
|
+
size?: IconSize;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
export interface ModalProps {
|
|
1774
|
+
/**
|
|
1775
|
+
* The content of the modal.
|
|
1776
|
+
*/
|
|
1777
|
+
children?: React.ReactElement;
|
|
1778
|
+
/**
|
|
1779
|
+
* If true, the modal will be closed when the background is clicked.
|
|
1780
|
+
* @default false
|
|
1781
|
+
*/
|
|
1782
|
+
persistOnBackgroundClick?: boolean;
|
|
1783
|
+
/**
|
|
1784
|
+
* If true, the primary button will be disabled.
|
|
1785
|
+
* @default false
|
|
1786
|
+
*/
|
|
1787
|
+
primaryButtonDisabled?: boolean;
|
|
1788
|
+
/**
|
|
1789
|
+
* The text content of the primary button.
|
|
1790
|
+
*/
|
|
1791
|
+
primaryButtonText?: string;
|
|
1792
|
+
/**
|
|
1793
|
+
* The text content of the secondary button.
|
|
1794
|
+
*/
|
|
1795
|
+
secondaryButtonText?: string;
|
|
1796
|
+
/**
|
|
1797
|
+
* The size of the modal.
|
|
1798
|
+
* @default "sm"
|
|
1799
|
+
*/
|
|
1800
|
+
size?: "sm" | "md" | "lg";
|
|
1801
|
+
/**
|
|
1802
|
+
* The subtitle of the modal.
|
|
1803
|
+
*/
|
|
1804
|
+
subtitle?: string;
|
|
1805
|
+
/**
|
|
1806
|
+
* The text content of the modal.
|
|
1807
|
+
*/
|
|
1808
|
+
text?: string;
|
|
1809
|
+
/**
|
|
1810
|
+
* The title of the modal.
|
|
1811
|
+
*/
|
|
1812
|
+
title?: string;
|
|
1813
|
+
/**
|
|
1814
|
+
* If true, the modal will be visible.
|
|
1815
|
+
*/
|
|
1816
|
+
visible: boolean;
|
|
1817
|
+
/**
|
|
1818
|
+
*/
|
|
1819
|
+
onDismiss: () => void;
|
|
1820
|
+
/**
|
|
1821
|
+
* The function to call when the primary button is clicked.
|
|
1822
|
+
*/
|
|
1823
|
+
primaryButtonOnClick?: (value?: any) => void | Promise<void>;
|
|
1824
|
+
/**
|
|
1825
|
+
* The function to call when the secondary button is clicked.
|
|
1826
|
+
*/
|
|
1827
|
+
secondaryButtonOnClick?: (value?: any) => void | Promise<void>;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
export interface NumberPickerActionSheetProps {
|
|
1831
|
+
value: string;
|
|
1832
|
+
min: number;
|
|
1833
|
+
max: number;
|
|
1834
|
+
onChange: OnChangeCallback;
|
|
1835
|
+
actionSheetRef: React.RefObject<any>;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
export interface PageProps {
|
|
1839
|
+
// TODO: figure out navigation
|
|
1840
|
+
navigation: any;
|
|
1841
|
+
scroll?: boolean;
|
|
1842
|
+
loading?: boolean;
|
|
1843
|
+
display?: "flex" | "none" | "block" | "inlineBlock";
|
|
1844
|
+
title?: string;
|
|
1845
|
+
backButton?: boolean;
|
|
1846
|
+
closeButton?: boolean;
|
|
1847
|
+
direction?: "row" | "column";
|
|
1848
|
+
padding?: UnsignedUpTo12;
|
|
1849
|
+
color?: SurfaceColor;
|
|
1850
|
+
maxWidth?: number | string;
|
|
1851
|
+
keyboardOffset?: number;
|
|
1852
|
+
footer?: any;
|
|
1853
|
+
rightButton?: string;
|
|
1854
|
+
rightButtonOnClick?: () => void;
|
|
1855
|
+
children?: any;
|
|
1856
|
+
onError?: (error: Error, stack: any) => void;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
export interface ProgressBarProps {
|
|
1860
|
+
color: SurfaceColor;
|
|
1861
|
+
completed: number;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
export interface RadioProps {
|
|
1865
|
+
selected?: boolean;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
export interface RadioFieldProps {
|
|
1869
|
+
title: string;
|
|
1870
|
+
variant?: "leftText" | "rightText"; // default "rightText"
|
|
1871
|
+
value: string;
|
|
1872
|
+
onChange: (value: string) => void;
|
|
1873
|
+
options: FieldOption[];
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
export interface SignatureFieldProps {
|
|
1877
|
+
disabled?: boolean; // default "default"
|
|
1878
|
+
value?: string;
|
|
1879
|
+
onChange: (value: any) => void;
|
|
1880
|
+
title?: string; // default "Signature"
|
|
1881
|
+
onStart?: () => void;
|
|
1882
|
+
onEnd?: () => void;
|
|
1883
|
+
disabledText?: string;
|
|
1884
|
+
errorText?: string;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
export interface SideDrawerProps {
|
|
1888
|
+
// Position of the drawer relative to the child
|
|
1889
|
+
position?: "right" | "left";
|
|
1890
|
+
// Used to open/hide drawer. Use the onClose and onOpen props to control state
|
|
1891
|
+
isOpen: boolean;
|
|
1892
|
+
// Content within the drawer
|
|
1893
|
+
renderContent: () => ReactElement | ReactElement[];
|
|
1894
|
+
// TODO: Allow the hardware back button on Android to close the SideDrawer
|
|
1895
|
+
onClose?: () => void;
|
|
1896
|
+
onOpen?: () => void;
|
|
1897
|
+
drawerType?: "front" | "back" | "slide" | "permanent";
|
|
1898
|
+
// Content that is wrapped by the drawer. The drawer will use the height of the child it wraps.
|
|
1899
|
+
// Can be overwritten via styles prop
|
|
1900
|
+
children?: ReactElement;
|
|
1901
|
+
drawerStyles?: StyleProp<ViewStyle>;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
export interface SpinnerProps {
|
|
1905
|
+
size?: "sm" | "md";
|
|
1906
|
+
color?: "light" | "dark" | "accent" | "secondary";
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
export interface ColumnSortInterface {
|
|
1910
|
+
column: number;
|
|
1911
|
+
direction: "asc" | "desc";
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
export interface TableProps {
|
|
1915
|
+
/**
|
|
1916
|
+
* Must be instances of TableHeader, TableRow, and/or TableFooter components.
|
|
1917
|
+
*/
|
|
1918
|
+
children: React.ReactNode | React.ReactNode[];
|
|
1919
|
+
/**
|
|
1920
|
+
* Width of columns in the table. This is used to calculate the width of each column.
|
|
1921
|
+
* Can be numbers for pixels or strings for percentages.
|
|
1922
|
+
*/
|
|
1923
|
+
// in figma/ jos documentation for the component, TableTitle,
|
|
1924
|
+
// she included the width as prop size
|
|
1925
|
+
/**
|
|
1926
|
+
* The size of the table title.
|
|
1927
|
+
* Can be one of "sm", "md", "lg", or "xl".
|
|
1928
|
+
*/
|
|
1929
|
+
// size: "sm" | "md" | "lg" | "xl";
|
|
1930
|
+
// const width = {
|
|
1931
|
+
// sm: 82,
|
|
1932
|
+
// md: 161,
|
|
1933
|
+
// lg: 233,
|
|
1934
|
+
// xl: 302,
|
|
1935
|
+
// };
|
|
1936
|
+
columns: Array<number | string>;
|
|
1937
|
+
/**
|
|
1938
|
+
* Specify a border width for Table: "sm" is 1px.
|
|
1939
|
+
*/
|
|
1940
|
+
borderStyle?: "sm" | "none";
|
|
1941
|
+
/**
|
|
1942
|
+
* Use numbers for pixels: `maxHeight={100}` and strings for percentages: `maxHeight="100%"`.
|
|
1943
|
+
*/
|
|
1944
|
+
maxHeight?: DimensionValue;
|
|
1945
|
+
/**
|
|
1946
|
+
* If true, the header will stick to the top of the table when scrolling. Defaults to true.
|
|
1947
|
+
*/
|
|
1948
|
+
stickyHeader?: boolean;
|
|
1949
|
+
/**
|
|
1950
|
+
* If true, alternate rows will have a light gray background. Defaults to true.
|
|
1951
|
+
*/
|
|
1952
|
+
alternateRowBackground?: boolean;
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* Control sort outside of the Table
|
|
1956
|
+
*/
|
|
1957
|
+
sort?: ColumnSortInterface;
|
|
1958
|
+
/**
|
|
1959
|
+
* Set the page outside of the Table
|
|
1960
|
+
*/
|
|
1961
|
+
page?: number;
|
|
1962
|
+
/**
|
|
1963
|
+
* Set the page outside of the Table
|
|
1964
|
+
*/
|
|
1965
|
+
setPage?: (page: number) => void;
|
|
1966
|
+
/**
|
|
1967
|
+
* Set the total number of pages of the Table
|
|
1968
|
+
*/
|
|
1969
|
+
totalPages?: number;
|
|
1970
|
+
/**
|
|
1971
|
+
* If true, the table will render a next page button. Defaults to true.
|
|
1972
|
+
*/
|
|
1973
|
+
more?: boolean;
|
|
1974
|
+
/**
|
|
1975
|
+
* Extra controls to render below the table next to pagination
|
|
1976
|
+
*/
|
|
1977
|
+
extraControls?: React.ReactElement;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
export interface PaginationProps {
|
|
1981
|
+
page: number;
|
|
1982
|
+
setPage: (page: number) => void;
|
|
1983
|
+
totalPages: number;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* Data Table
|
|
1988
|
+
*/
|
|
1989
|
+
export interface DataTableCellData {
|
|
1990
|
+
value: any;
|
|
1991
|
+
highlight?: SurfaceColor;
|
|
1992
|
+
textSize?: "sm" | "md" | "lg";
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
export type DataTableCustomComponentMap = Record<
|
|
1996
|
+
string,
|
|
1997
|
+
React.ComponentType<{column: DataTableColumn; cellData: DataTableCellData}>
|
|
1998
|
+
>;
|
|
1999
|
+
export interface DataTableColumn {
|
|
2000
|
+
title: string;
|
|
2001
|
+
columnType: "text" | "number" | "date" | "boolean" | string;
|
|
2002
|
+
width: number;
|
|
2003
|
+
highlight?: SurfaceColor;
|
|
2004
|
+
sortable?: boolean;
|
|
2005
|
+
infoModalText?: string;
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
export interface DataTableProps {
|
|
2009
|
+
data: {value: any; highlight?: SurfaceColor; textSize?: "sm" | "md" | "lg"}[][];
|
|
2010
|
+
columns: DataTableColumn[];
|
|
2011
|
+
alternateRowBackground?: boolean;
|
|
2012
|
+
totalPages?: number;
|
|
2013
|
+
page?: number;
|
|
2014
|
+
setPage?: (page: number) => void;
|
|
2015
|
+
pinnedColumns?: number;
|
|
2016
|
+
sortColumn?: ColumnSortInterface;
|
|
2017
|
+
setSortColumn?: (sortColumn?: ColumnSortInterface) => void;
|
|
2018
|
+
rowHeight?: number;
|
|
2019
|
+
headerHeight?: number;
|
|
2020
|
+
defaultTextSize?: "sm" | "md" | "lg";
|
|
2021
|
+
/**
|
|
2022
|
+
* When tapping the eye icon, a modal is shown with more info about the row.
|
|
2023
|
+
*/
|
|
2024
|
+
moreContentComponent?: React.ComponentType<{
|
|
2025
|
+
column: DataTableColumn;
|
|
2026
|
+
rowData: any[];
|
|
2027
|
+
rowIndex: number;
|
|
2028
|
+
}>;
|
|
2029
|
+
// Extra data to pass to the more modal.
|
|
2030
|
+
moreContentExtraData?: any[];
|
|
2031
|
+
// Allows handling of custom column types.
|
|
2032
|
+
customColumnComponentMap?: DataTableCustomComponentMap;
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
export interface DataTableCellProps {
|
|
2036
|
+
value: any;
|
|
2037
|
+
columnDef: DataTableColumn;
|
|
2038
|
+
colIndex: number;
|
|
2039
|
+
isPinnedHorizontal: boolean;
|
|
2040
|
+
isPinnedRow?: boolean;
|
|
2041
|
+
pinnedColumns: number;
|
|
2042
|
+
columnWidths: number[];
|
|
2043
|
+
backgroundColor: string;
|
|
2044
|
+
highlight?: SurfaceColor;
|
|
2045
|
+
customColumnComponentMap?: DataTableCustomComponentMap;
|
|
2046
|
+
height: number;
|
|
2047
|
+
textSize?: "sm" | "md" | "lg";
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
export interface TableHeaderProps {
|
|
2051
|
+
/**
|
|
2052
|
+
* Must be an instance of TableRow.
|
|
2053
|
+
*/
|
|
2054
|
+
children: React.ReactNode | React.ReactNode[];
|
|
2055
|
+
/**
|
|
2056
|
+
* Display `visuallyHidden` ensures the component is visually hidden but still is read by screen
|
|
2057
|
+
* readers.
|
|
2058
|
+
*/
|
|
2059
|
+
display?: "tableHeaderGroup" | "visuallyHidden";
|
|
2060
|
+
/**
|
|
2061
|
+
* If true, the table header will be sticky and the table body will be scrollable. Not yet
|
|
2062
|
+
* implemented.
|
|
2063
|
+
*/
|
|
2064
|
+
sticky?: boolean;
|
|
2065
|
+
color?: BoxColor;
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
export interface TableHeaderCellProps extends InfoModalIconProps {
|
|
2069
|
+
/**
|
|
2070
|
+
* The content of the table header cell.
|
|
2071
|
+
*/
|
|
2072
|
+
children?: ReactElement;
|
|
2073
|
+
index: number;
|
|
2074
|
+
sortable?: boolean;
|
|
2075
|
+
onSortChange?: (direction: "asc" | "desc" | undefined) => void;
|
|
2076
|
+
/**
|
|
2077
|
+
* The alignment of the text/components in the cell. Most cells should be left aligned,
|
|
2078
|
+
* unless the column is for a badge, icon, or boolean, then center align.
|
|
2079
|
+
* It should be right if the column is right aligned text or numbers.
|
|
2080
|
+
*/
|
|
2081
|
+
align?: "left" | "center" | "right";
|
|
2082
|
+
/**
|
|
2083
|
+
* If title is provided, the text will be wrapped in a TableTitle, saving you from having to
|
|
2084
|
+
* wrap the text yourself. Alignments will match between the cell and the title.
|
|
2085
|
+
*/
|
|
2086
|
+
title?: string;
|
|
2087
|
+
/**
|
|
2088
|
+
* If provided, a tooltip icon will be shown and a tooltip will be shown when hovering over the
|
|
2089
|
+
* icon.
|
|
2090
|
+
*/
|
|
2091
|
+
infoText?: string;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
export interface TableRowProps {
|
|
2095
|
+
/**
|
|
2096
|
+
* Must be instances of TableCell or TableHeaderCell.
|
|
2097
|
+
*/
|
|
2098
|
+
children: React.ReactNode | React.ReactNode[];
|
|
2099
|
+
/**
|
|
2100
|
+
* Header rows have an extra thick bottom border.
|
|
2101
|
+
*/
|
|
2102
|
+
headerRow?: boolean;
|
|
2103
|
+
/**
|
|
2104
|
+
* Whether the row should start expanded or not.
|
|
2105
|
+
*/
|
|
2106
|
+
expanded?: boolean;
|
|
2107
|
+
/**
|
|
2108
|
+
* When the row is expanded, the drawerContents are shown. If not
|
|
2109
|
+
*/
|
|
2110
|
+
drawerContents?: React.ReactNode | React.ReactNode[];
|
|
2111
|
+
/**
|
|
2112
|
+
* Background color of the row. Defaults to white.
|
|
2113
|
+
*/
|
|
2114
|
+
color?: BoxColor;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
export type TableFilters = Record<string, string[]>;
|
|
2118
|
+
|
|
2119
|
+
export interface TableSearch {
|
|
2120
|
+
search: string;
|
|
2121
|
+
field: string;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
export interface TableContextType {
|
|
2125
|
+
columns: Array<number | string>;
|
|
2126
|
+
hasDrawerContents: boolean;
|
|
2127
|
+
sortColumn?: ColumnSortInterface | undefined;
|
|
2128
|
+
setSortColumn?: (sort: ColumnSortInterface | undefined) => void;
|
|
2129
|
+
stickyHeader?: boolean;
|
|
2130
|
+
borderStyle?: "sm" | "none";
|
|
2131
|
+
alternateRowBackground?: boolean;
|
|
2132
|
+
page?: number;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
export interface TableContextProviderProps extends TableContextType {
|
|
2136
|
+
children: React.ReactNode;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
export interface TextProps {
|
|
2140
|
+
align?: "left" | "right" | "center" | "justify"; // default "left"
|
|
2141
|
+
children?: React.ReactNode;
|
|
2142
|
+
bold?: boolean; // default false
|
|
2143
|
+
color?: TextColor;
|
|
2144
|
+
italic?: boolean; // default false
|
|
2145
|
+
size?: TextSize; // default "md"
|
|
2146
|
+
truncate?: boolean; // default false
|
|
2147
|
+
underline?: boolean;
|
|
2148
|
+
numberOfLines?: number;
|
|
2149
|
+
skipLinking?: boolean;
|
|
2150
|
+
testID?: string;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
export interface TextFieldPickerActionSheetProps {
|
|
2154
|
+
value?: string;
|
|
2155
|
+
mode?: "date" | "time";
|
|
2156
|
+
onChange: OnChangeCallback;
|
|
2157
|
+
actionSheetRef: React.RefObject<any>;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
export interface ToastProps {
|
|
2161
|
+
title: string;
|
|
2162
|
+
variant?: "error" | "info" | "success" | "warning";
|
|
2163
|
+
secondary?: boolean;
|
|
2164
|
+
size?: "sm" | "lg";
|
|
2165
|
+
onDismiss?: () => void;
|
|
2166
|
+
persistent?: boolean;
|
|
2167
|
+
// TODO enforce these should only show if size is "lg" with type discrinimation
|
|
2168
|
+
subtitle?: string;
|
|
2169
|
+
// TODO Add buttons for Toast
|
|
2170
|
+
// buttonText?: string;
|
|
2171
|
+
// buttonOnClick?: () => void | Promise<void>;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
export interface TooltipProps {
|
|
2175
|
+
/**
|
|
2176
|
+
* The content of the tooltip.
|
|
2177
|
+
*/
|
|
2178
|
+
children: React.ReactElement;
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* If true, an arrow will be included in the tooltip.
|
|
2182
|
+
* @default false
|
|
2183
|
+
*/
|
|
2184
|
+
includeArrow?: boolean;
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* The ideal position of the tooltip.
|
|
2188
|
+
* @default "top"
|
|
2189
|
+
*/
|
|
2190
|
+
idealPosition?: "top" | "bottom" | "left" | "right";
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* The text content of the tooltip. If text is undefined,
|
|
2194
|
+
* the children will be rendered without a tooltip.
|
|
2195
|
+
*/
|
|
2196
|
+
text?: string;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
export type LinkProps = TextProps & {
|
|
2200
|
+
text: string;
|
|
2201
|
+
} & (
|
|
2202
|
+
| {
|
|
2203
|
+
href: string;
|
|
2204
|
+
onClick?: never;
|
|
2205
|
+
}
|
|
2206
|
+
| {
|
|
2207
|
+
href?: never;
|
|
2208
|
+
onClick: () => void | Promise<void>;
|
|
2209
|
+
}
|
|
2210
|
+
);
|
|
2211
|
+
|
|
2212
|
+
export type TapToEditProps =
|
|
2213
|
+
| (BaseTapToEditProps &
|
|
2214
|
+
Omit<TextFieldProps, "onChange" | "value"> & {
|
|
2215
|
+
type: "password" | "text" | "url";
|
|
2216
|
+
})
|
|
2217
|
+
| (BaseTapToEditProps &
|
|
2218
|
+
Omit<NumberFieldProps, "onChange" | "value"> & {
|
|
2219
|
+
type: "number" | "decimal";
|
|
2220
|
+
})
|
|
2221
|
+
| (BaseTapToEditProps &
|
|
2222
|
+
Omit<NumberRangeFieldProps, "onChange" | "value"> & {
|
|
2223
|
+
type: "numberRange" | "decimalRange";
|
|
2224
|
+
})
|
|
2225
|
+
| (BaseTapToEditProps &
|
|
2226
|
+
Omit<DateTimeFieldProps, "onChange" | "value"> & {
|
|
2227
|
+
type: "date" | "datetime" | "time";
|
|
2228
|
+
})
|
|
2229
|
+
| (BaseTapToEditProps &
|
|
2230
|
+
Omit<MultiselectFieldProps, "onChange" | "value"> & {
|
|
2231
|
+
type: "multiselect";
|
|
2232
|
+
})
|
|
2233
|
+
| (BaseTapToEditProps &
|
|
2234
|
+
Omit<TextAreaProps, "onChange" | "value"> & {
|
|
2235
|
+
type: "textarea";
|
|
2236
|
+
})
|
|
2237
|
+
| (BaseTapToEditProps &
|
|
2238
|
+
Omit<SelectFieldProps, "onChange" | "value"> & {
|
|
2239
|
+
type: "select";
|
|
2240
|
+
})
|
|
2241
|
+
| (BaseTapToEditProps &
|
|
2242
|
+
Omit<CustomSelectFieldProps, "onChange" | "value"> & {
|
|
2243
|
+
type: "customSelect";
|
|
2244
|
+
})
|
|
2245
|
+
| (BaseTapToEditProps &
|
|
2246
|
+
Omit<EmailFieldProps, "onChange" | "value"> & {
|
|
2247
|
+
type: "email";
|
|
2248
|
+
})
|
|
2249
|
+
| (BaseTapToEditProps &
|
|
2250
|
+
Omit<PhoneNumberFieldProps, "onChange" | "value"> & {
|
|
2251
|
+
type: "phoneNumber";
|
|
2252
|
+
})
|
|
2253
|
+
| (BaseTapToEditProps &
|
|
2254
|
+
Omit<BooleanFieldProps, "onChange" | "value"> & {
|
|
2255
|
+
type: "boolean";
|
|
2256
|
+
})
|
|
2257
|
+
| (BaseTapToEditProps &
|
|
2258
|
+
Omit<RadioFieldProps, "onChange" | "value"> & {
|
|
2259
|
+
type: "radio";
|
|
2260
|
+
})
|
|
2261
|
+
| (BaseTapToEditProps &
|
|
2262
|
+
Omit<SignatureFieldProps, "onChange" | "value"> & {
|
|
2263
|
+
type: "signature";
|
|
2264
|
+
})
|
|
2265
|
+
| (BaseTapToEditProps &
|
|
2266
|
+
Omit<SearchFieldProps, "onChange" | "value"> & {
|
|
2267
|
+
type: "search";
|
|
2268
|
+
})
|
|
2269
|
+
| (BaseTapToEditProps &
|
|
2270
|
+
Omit<AddressFieldProps, "onChange" | "value"> & {
|
|
2271
|
+
type: "address";
|
|
2272
|
+
});
|
|
2273
|
+
|
|
2274
|
+
export interface BaseTapToEditProps extends Omit<FieldProps, "onChange" | "value"> {
|
|
2275
|
+
title: string;
|
|
2276
|
+
value: any;
|
|
2277
|
+
|
|
2278
|
+
/**
|
|
2279
|
+
* Not required if not editable.
|
|
2280
|
+
*/
|
|
2281
|
+
setValue?: (value: any) => void;
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* Not required if not editable.
|
|
2285
|
+
*/
|
|
2286
|
+
onSave?: (value: any) => void | Promise<void>;
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* If false, the field will not be editable and will be disabled
|
|
2290
|
+
* @default true
|
|
2291
|
+
*/
|
|
2292
|
+
editable?: boolean;
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* Enable edit mode from outside the component.
|
|
2296
|
+
*/
|
|
2297
|
+
isEditing?: boolean;
|
|
2298
|
+
transform?: (value: any) => string;
|
|
2299
|
+
/**
|
|
2300
|
+
* Show a confirmation modal before saving the value.
|
|
2301
|
+
* @default false
|
|
2302
|
+
*/
|
|
2303
|
+
withConfirmation?: boolean;
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* The text content of the confirmation modal.
|
|
2307
|
+
* @default "Are you sure you want save your changes?"
|
|
2308
|
+
*/
|
|
2309
|
+
confirmationText?: string;
|
|
2310
|
+
|
|
2311
|
+
/**
|
|
2312
|
+
* The title of the confirmation modal.
|
|
2313
|
+
* @default "Confirm"
|
|
2314
|
+
*/
|
|
2315
|
+
confirmationTitle?: string;
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* Field helperText, a description of the field surfaced in the UI
|
|
2319
|
+
* @default "Confirm"
|
|
2320
|
+
*/
|
|
2321
|
+
helperText?: string;
|
|
2322
|
+
|
|
2323
|
+
/**
|
|
2324
|
+
* Only display the helperText in the UI while editing. if false, the helperText is always shown below the value.
|
|
2325
|
+
* @default true
|
|
2326
|
+
*/
|
|
2327
|
+
onlyShowHelperTextWhileEditing?: boolean;
|
|
2328
|
+
|
|
2329
|
+
/**
|
|
2330
|
+
* Show a clear button in the button row alongside Cancel/Save for clearing the field value.
|
|
2331
|
+
* @default false
|
|
2332
|
+
*/
|
|
2333
|
+
showClearButton?: boolean;
|
|
2334
|
+
|
|
2335
|
+
// openApi to supported in future
|
|
2336
|
+
// openApiModel?: string;
|
|
2337
|
+
// openApiField?: string;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
export interface APIError {
|
|
2341
|
+
status: number;
|
|
2342
|
+
data: {
|
|
2343
|
+
title: string;
|
|
2344
|
+
detail?: string;
|
|
2345
|
+
id?: string;
|
|
2346
|
+
links?: string;
|
|
2347
|
+
about?: string;
|
|
2348
|
+
status?: number;
|
|
2349
|
+
code?: string;
|
|
2350
|
+
source?: string;
|
|
2351
|
+
pointer?: string;
|
|
2352
|
+
parameter?: string;
|
|
2353
|
+
meta?: {[id: string]: any};
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
export type OpenApiPropertyType =
|
|
2358
|
+
| "string"
|
|
2359
|
+
| "date"
|
|
2360
|
+
| "datetime"
|
|
2361
|
+
| "boolean"
|
|
2362
|
+
| "array"
|
|
2363
|
+
| "object"
|
|
2364
|
+
| "number"
|
|
2365
|
+
| "any";
|
|
2366
|
+
|
|
2367
|
+
export interface OpenApiProperty {
|
|
2368
|
+
type?: OpenApiPropertyType;
|
|
2369
|
+
format?: string;
|
|
2370
|
+
properties?: OpenApiProperty;
|
|
2371
|
+
items?: OpenApiProperty[];
|
|
2372
|
+
description?: string;
|
|
2373
|
+
// TODO: is this actually there?
|
|
2374
|
+
required?: string[];
|
|
2375
|
+
enum?: string[];
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
export interface ModelFields {
|
|
2379
|
+
type: "object" | "array";
|
|
2380
|
+
required: string[];
|
|
2381
|
+
properties: {[name: string]: OpenApiProperty};
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
export interface OpenAPISpec {
|
|
2385
|
+
paths: {
|
|
2386
|
+
[key: string]: any;
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
export type ModelFieldConfig = any;
|
|
2391
|
+
|
|
2392
|
+
export interface OpenAPIProviderProps {
|
|
2393
|
+
children: React.ReactElement;
|
|
2394
|
+
specUrl?: string;
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
export interface OpenAPIContextType {
|
|
2398
|
+
spec: OpenAPISpec | null;
|
|
2399
|
+
getModelFields: (modelName: string) => ModelFields | null;
|
|
2400
|
+
getModelField: (modelName: string, field: string) => OpenApiProperty | null;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
// The config for a single column in the table display of a model.
|
|
2404
|
+
export interface ModelAdminFieldConfig {
|
|
2405
|
+
fieldKey: string; // Dot notation representation of the field.
|
|
2406
|
+
title: string;
|
|
2407
|
+
description?: string;
|
|
2408
|
+
type: OpenApiPropertyType;
|
|
2409
|
+
width?: number;
|
|
2410
|
+
minWidth?: number;
|
|
2411
|
+
options?: string[];
|
|
2412
|
+
sort?: string;
|
|
2413
|
+
CustomComponent?: (props: ModelAdminCustomComponentProps) => React.ReactElement | null;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
// The props for a custom column component for ModelAdmin.
|
|
2417
|
+
export interface ModelAdminCustomComponentProps extends Omit<FieldProps, "name"> {
|
|
2418
|
+
doc: any; // The rest of the document.
|
|
2419
|
+
fieldKey: string; // Dot notation representation of the field.
|
|
2420
|
+
// user: User;
|
|
2421
|
+
editing: boolean; // Allow for inline editing of the field.
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
export interface MultiselectFieldProps extends HelperTextProps, ErrorTextProps {
|
|
2425
|
+
/**
|
|
2426
|
+
* The available options for the multiselect field.
|
|
2427
|
+
*/
|
|
2428
|
+
options: FieldOption[];
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* The title of the multiselect field.
|
|
2432
|
+
*/
|
|
2433
|
+
title: string;
|
|
2434
|
+
|
|
2435
|
+
/**
|
|
2436
|
+
* The selected values of the multiselect field.
|
|
2437
|
+
*/
|
|
2438
|
+
value: string[];
|
|
2439
|
+
|
|
2440
|
+
/**
|
|
2441
|
+
* The variant of the multiselect field, which determines the position of the text.
|
|
2442
|
+
* @default "rightText"
|
|
2443
|
+
*/
|
|
2444
|
+
variant?: "rightText" | "leftText";
|
|
2445
|
+
|
|
2446
|
+
/**
|
|
2447
|
+
* The function to call when the selected values change.
|
|
2448
|
+
*/
|
|
2449
|
+
onChange: (selected: string[]) => void;
|
|
2450
|
+
|
|
2451
|
+
/**
|
|
2452
|
+
* The disabled state of multiselect. Removes checkboxes and only shows the values.
|
|
2453
|
+
*/
|
|
2454
|
+
|
|
2455
|
+
disabled?: boolean;
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
export interface TableTitleProps {
|
|
2459
|
+
/**
|
|
2460
|
+
* The text content of the table title.
|
|
2461
|
+
*/
|
|
2462
|
+
title: string;
|
|
2463
|
+
|
|
2464
|
+
/**
|
|
2465
|
+
* Most titles should be left aligned, but some may be centered, such as badges or booleans.
|
|
2466
|
+
* It should match the alignment of the column.
|
|
2467
|
+
* @default "left"
|
|
2468
|
+
*/
|
|
2469
|
+
align?: "left" | "center" | "right";
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
export interface TableBooleanProps {
|
|
2473
|
+
/**
|
|
2474
|
+
* If true, the component is in editing mode.
|
|
2475
|
+
* @default false
|
|
2476
|
+
*/
|
|
2477
|
+
isEditing?: boolean;
|
|
2478
|
+
|
|
2479
|
+
/**
|
|
2480
|
+
* The function to call when the value is saved.
|
|
2481
|
+
*/
|
|
2482
|
+
onSave?: () => void | Promise<void>;
|
|
2483
|
+
|
|
2484
|
+
/**
|
|
2485
|
+
* The boolean value to be displayed or edited.
|
|
2486
|
+
*/
|
|
2487
|
+
value: boolean;
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
export interface TableDateProps {
|
|
2491
|
+
/**
|
|
2492
|
+
* If true, the date is annotated.
|
|
2493
|
+
* @default false
|
|
2494
|
+
*/
|
|
2495
|
+
annotated?: boolean;
|
|
2496
|
+
|
|
2497
|
+
/**
|
|
2498
|
+
* If true, the component is in editing mode.
|
|
2499
|
+
* @default false
|
|
2500
|
+
*/
|
|
2501
|
+
isEditing?: boolean;
|
|
2502
|
+
|
|
2503
|
+
/**
|
|
2504
|
+
* The function to call when the value is saved.
|
|
2505
|
+
*/
|
|
2506
|
+
onSave?: () => void;
|
|
2507
|
+
|
|
2508
|
+
/**
|
|
2509
|
+
* The date value to be displayed or edited. Can be a string or a Date object.
|
|
2510
|
+
*/
|
|
2511
|
+
value: string | Date;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
export interface TableIconButtonProps {
|
|
2515
|
+
/**
|
|
2516
|
+
* The name of the icon button to display in the table.
|
|
2517
|
+
* Can be one of "edit", "saveAndClose", "insert", "drawerOpen", or "drawerClose".
|
|
2518
|
+
*/
|
|
2519
|
+
tableIconButtonName: "edit" | "saveAndClose" | "insert" | "drawerOpen" | "drawerClose";
|
|
2520
|
+
|
|
2521
|
+
/**
|
|
2522
|
+
* The function to call when the icon button is clicked.
|
|
2523
|
+
*/
|
|
2524
|
+
onClick: () => void | Promise<void>;
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
export interface FieldOption {
|
|
2528
|
+
/**
|
|
2529
|
+
* The label to display for the option.
|
|
2530
|
+
*/
|
|
2531
|
+
label: string;
|
|
2532
|
+
|
|
2533
|
+
/**
|
|
2534
|
+
* The key of the option. Useful for uniquely identifying the option.
|
|
2535
|
+
*/
|
|
2536
|
+
key?: string;
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* The value of the option.
|
|
2540
|
+
*/
|
|
2541
|
+
value: string;
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
// Split up SelectField so if value is passed as a string,
|
|
2545
|
+
export interface SelectFieldPropsBase {
|
|
2546
|
+
/**
|
|
2547
|
+
* If true, the select field will be disabled.
|
|
2548
|
+
* @default false
|
|
2549
|
+
*/
|
|
2550
|
+
disabled?: boolean;
|
|
2551
|
+
|
|
2552
|
+
/**
|
|
2553
|
+
* The error text to display if there is an error.
|
|
2554
|
+
*/
|
|
2555
|
+
errorText?: string;
|
|
2556
|
+
|
|
2557
|
+
/**
|
|
2558
|
+
* The helper text to display below the select field.
|
|
2559
|
+
*/
|
|
2560
|
+
helperText?: string;
|
|
2561
|
+
|
|
2562
|
+
/**
|
|
2563
|
+
* The function to call when the selected value changes.
|
|
2564
|
+
* If requireValue is false and value is undefined, onChange will return empty string.
|
|
2565
|
+
*/
|
|
2566
|
+
onChange: (value: string) => void;
|
|
2567
|
+
|
|
2568
|
+
/**
|
|
2569
|
+
* The options available for selection in the select field.
|
|
2570
|
+
* Each option should have a label and a value.
|
|
2571
|
+
*/
|
|
2572
|
+
options: FieldOption[];
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* The placeholder text to display when no option is selected.
|
|
2576
|
+
*/
|
|
2577
|
+
placeholder?: string;
|
|
2578
|
+
|
|
2579
|
+
/**
|
|
2580
|
+
* The title of the select field.
|
|
2581
|
+
*/
|
|
2582
|
+
title?: string;
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
export interface SelectFieldPropsWithoutRequire extends SelectFieldPropsBase {
|
|
2586
|
+
/**
|
|
2587
|
+
* Whether the select field should have an empty "---" button to return undefined.
|
|
2588
|
+
* @default false
|
|
2589
|
+
*/
|
|
2590
|
+
requireValue?: false;
|
|
2591
|
+
|
|
2592
|
+
/**
|
|
2593
|
+
* The current value of the select field (optional when requireValue is false).
|
|
2594
|
+
*/
|
|
2595
|
+
value?: string;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
export interface SelectFieldPropsWithRequire extends SelectFieldPropsBase {
|
|
2599
|
+
/**
|
|
2600
|
+
* When requireValue is true, the value is required and onChange will return a string.
|
|
2601
|
+
*/
|
|
2602
|
+
requireValue: true;
|
|
2603
|
+
|
|
2604
|
+
/**
|
|
2605
|
+
* The current value of the select field (required when requireValue is true).
|
|
2606
|
+
*/
|
|
2607
|
+
value: string;
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* The function to call when the required select field value changes.
|
|
2611
|
+
*/
|
|
2612
|
+
onChange: (value: string) => void;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
export type SelectFieldProps = SelectFieldPropsWithoutRequire | SelectFieldPropsWithRequire;
|
|
2616
|
+
|
|
2617
|
+
export interface TableBadgeProps {
|
|
2618
|
+
/**
|
|
2619
|
+
* The icon name of the badge.
|
|
2620
|
+
*/
|
|
2621
|
+
badgeIconName?: BadgeProps["iconName"];
|
|
2622
|
+
|
|
2623
|
+
/**
|
|
2624
|
+
* The status of the badge.
|
|
2625
|
+
* @default "info"
|
|
2626
|
+
*/
|
|
2627
|
+
badgeStatus?: BadgeProps["status"];
|
|
2628
|
+
|
|
2629
|
+
/**
|
|
2630
|
+
* If true, the component is in editing mode.
|
|
2631
|
+
* @default false
|
|
2632
|
+
*/
|
|
2633
|
+
isEditing?: boolean;
|
|
2634
|
+
|
|
2635
|
+
/**
|
|
2636
|
+
* The options available for editing the badge.
|
|
2637
|
+
*/
|
|
2638
|
+
editingOptions?: FieldOption[];
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* The function to call when the badge status is saved.
|
|
2642
|
+
*/
|
|
2643
|
+
onSave?: (newStatus: string | undefined) => void | Promise<void>;
|
|
2644
|
+
|
|
2645
|
+
/**
|
|
2646
|
+
* The value of the badge.
|
|
2647
|
+
*/
|
|
2648
|
+
value: string;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
export interface TableTextProps {
|
|
2652
|
+
/**
|
|
2653
|
+
* Whether the text field is in editing mode.
|
|
2654
|
+
*/
|
|
2655
|
+
isEditing?: boolean;
|
|
2656
|
+
/**
|
|
2657
|
+
* The text to display in the text field.
|
|
2658
|
+
*/
|
|
2659
|
+
value: string;
|
|
2660
|
+
/**
|
|
2661
|
+
* Callback to save the text field value.
|
|
2662
|
+
*/
|
|
2663
|
+
onSave?: () => void | Promise<void>;
|
|
2664
|
+
/**
|
|
2665
|
+
* The alignment of the text field. Most text fields should be left aligned.
|
|
2666
|
+
* @default "left"
|
|
2667
|
+
*/
|
|
2668
|
+
align?: "left" | "center" | "right";
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
export interface TableNumberProps {
|
|
2672
|
+
/**
|
|
2673
|
+
* Whether the text field is in editing mode.
|
|
2674
|
+
*/
|
|
2675
|
+
isEditing?: boolean;
|
|
2676
|
+
/**
|
|
2677
|
+
* The number to display in the text field.
|
|
2678
|
+
*/
|
|
2679
|
+
value: string;
|
|
2680
|
+
/**
|
|
2681
|
+
* Callback to save the text field value.
|
|
2682
|
+
*/
|
|
2683
|
+
onSave?: () => void | Promise<void>;
|
|
2684
|
+
/**
|
|
2685
|
+
* Numbers generally should be right aligned for ease of scanability.
|
|
2686
|
+
* @default "right"
|
|
2687
|
+
*/
|
|
2688
|
+
align?: "left" | "right";
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
export interface SliderProps extends HelperTextProps, ErrorTextProps {
|
|
2692
|
+
/**
|
|
2693
|
+
* The title of the slider field.
|
|
2694
|
+
*/
|
|
2695
|
+
title?: string;
|
|
2696
|
+
|
|
2697
|
+
/**
|
|
2698
|
+
* The current value of the slider.
|
|
2699
|
+
*/
|
|
2700
|
+
value: number;
|
|
2701
|
+
|
|
2702
|
+
/**
|
|
2703
|
+
* The function to call when the slider value changes.
|
|
2704
|
+
*/
|
|
2705
|
+
onChange: (value: number) => void;
|
|
2706
|
+
|
|
2707
|
+
/**
|
|
2708
|
+
* The minimum value of the slider.
|
|
2709
|
+
* @default 0
|
|
2710
|
+
*/
|
|
2711
|
+
minimumValue?: number;
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* The maximum value of the slider.
|
|
2715
|
+
* @default 1
|
|
2716
|
+
*/
|
|
2717
|
+
maximumValue?: number;
|
|
2718
|
+
|
|
2719
|
+
/**
|
|
2720
|
+
* The step value of the slider.
|
|
2721
|
+
* @default 0
|
|
2722
|
+
*/
|
|
2723
|
+
step?: number;
|
|
2724
|
+
|
|
2725
|
+
/**
|
|
2726
|
+
* If true, the slider will be disabled.
|
|
2727
|
+
* @default false
|
|
2728
|
+
*/
|
|
2729
|
+
disabled?: boolean;
|
|
2730
|
+
|
|
2731
|
+
/**
|
|
2732
|
+
* The color of the track to the left of the thumb.
|
|
2733
|
+
*/
|
|
2734
|
+
minimumTrackTintColor?: string;
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* The color of the track to the right of the thumb.
|
|
2738
|
+
*/
|
|
2739
|
+
maximumTrackTintColor?: string;
|
|
2740
|
+
|
|
2741
|
+
/**
|
|
2742
|
+
* The color of the thumb.
|
|
2743
|
+
*/
|
|
2744
|
+
thumbTintColor?: string;
|
|
2745
|
+
|
|
2746
|
+
/**
|
|
2747
|
+
* If true, the slider will show the current value as text.
|
|
2748
|
+
* @default false
|
|
2749
|
+
*/
|
|
2750
|
+
showSelection?: boolean;
|
|
2751
|
+
|
|
2752
|
+
/**
|
|
2753
|
+
* Labels to show below the slider track.
|
|
2754
|
+
*/
|
|
2755
|
+
labels?: {
|
|
2756
|
+
/**
|
|
2757
|
+
* The minimum value label.
|
|
2758
|
+
*/
|
|
2759
|
+
min?: string;
|
|
2760
|
+
/**
|
|
2761
|
+
* The maximum value label.
|
|
2762
|
+
*/
|
|
2763
|
+
max?: string;
|
|
2764
|
+
/**
|
|
2765
|
+
* Additional labels with their positions (0-1 range).
|
|
2766
|
+
*/
|
|
2767
|
+
custom?: Array<{index: number; label: string}>;
|
|
2768
|
+
};
|
|
2769
|
+
|
|
2770
|
+
/**
|
|
2771
|
+
* If true, displays min and max labels inline on both ends of the track.
|
|
2772
|
+
* @default false
|
|
2773
|
+
*/
|
|
2774
|
+
inlineLabels?: boolean;
|
|
2775
|
+
|
|
2776
|
+
/**
|
|
2777
|
+
* If true, icons will be displayed instead of numeric values when valueMapping is provided.
|
|
2778
|
+
* @default false
|
|
2779
|
+
*/
|
|
2780
|
+
useIcons?: boolean;
|
|
2781
|
+
|
|
2782
|
+
/**
|
|
2783
|
+
* Graphics/icons to display instead of numeric values.
|
|
2784
|
+
* Maps slider values to icon names or any string.
|
|
2785
|
+
*/
|
|
2786
|
+
valueMapping?: ValueMappingItem[];
|
|
2787
|
+
}
|