@ovotech/element-native 4.4.8 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.d.ts +2 -1
- package/dist/components/Accordion/Accordion.js +47 -116
- package/dist/components/Accordion/Group.d.ts +1 -1
- package/dist/components/Accordion/Group.js +12 -19
- package/dist/components/Accordion/Icon.js +20 -48
- package/dist/components/Accordion/index.js +3 -9
- package/dist/components/Accordion/styles.d.ts +95 -96
- package/dist/components/Accordion/styles.js +44 -59
- package/dist/components/Accordion/types.js +1 -2
- package/dist/components/ActionCard/ActionCard.d.ts +1 -1
- package/dist/components/ActionCard/ActionCard.js +59 -87
- package/dist/components/ActionCard/CloseIconShape.d.ts +1 -1
- package/dist/components/ActionCard/CloseIconShape.js +7 -41
- package/dist/components/ActionCard/IndicatorIconShape.d.ts +1 -1
- package/dist/components/ActionCard/IndicatorIconShape.js +7 -41
- package/dist/components/ActionCard/index.js +1 -5
- package/dist/components/ActionList/ActionList.d.ts +9 -7
- package/dist/components/ActionList/ActionList.js +22 -56
- package/dist/components/ActionList/index.js +1 -6
- package/dist/components/ActionList/styled.d.ts +228 -229
- package/dist/components/ActionList/styled.js +52 -60
- package/dist/components/Badge/Badge.d.ts +34 -34
- package/dist/components/Badge/Badge.js +27 -72
- package/dist/components/Badge/index.js +1 -5
- package/dist/components/CTAButton/CTAButton.d.ts +9 -11
- package/dist/components/CTAButton/CTAButton.js +62 -100
- package/dist/components/CTAButton/index.js +1 -8
- package/dist/components/CTALink/CTALink.d.ts +5 -8
- package/dist/components/CTALink/CTALink.js +6 -23
- package/dist/components/CTALink/index.js +1 -7
- package/dist/components/Card/Card.js +14 -43
- package/dist/components/Card/index.js +1 -5
- package/dist/components/Checkbox/Checkbox.d.ts +9 -7
- package/dist/components/Checkbox/Checkbox.js +50 -72
- package/dist/components/Checkbox/CheckboxField.js +16 -44
- package/dist/components/Checkbox/index.js +2 -7
- package/dist/components/CurrencyField/CurrencyField.d.ts +4 -11
- package/dist/components/CurrencyField/CurrencyField.js +5 -32
- package/dist/components/CurrencyField/index.js +1 -5
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +4 -11
- package/dist/components/CurrencyInput/CurrencyInput.js +10 -36
- package/dist/components/CurrencyInput/index.js +1 -5
- package/dist/components/DataTable/DataTable.d.ts +1 -3
- package/dist/components/DataTable/DataTable.js +17 -44
- package/dist/components/DataTable/TableRow.js +15 -31
- package/dist/components/DataTable/index.js +3 -21
- package/dist/components/DataTable/styles.d.ts +404 -404
- package/dist/components/DataTable/styles.js +97 -84
- package/dist/components/DataTable/types.d.ts +1 -1
- package/dist/components/DataTable/types.js +1 -2
- package/dist/components/DateField/DateField.d.ts +8 -6
- package/dist/components/DateField/DateField.js +61 -82
- package/dist/components/DateField/index.js +1 -5
- package/dist/components/DescriptionList/DescriptionList.js +12 -44
- package/dist/components/DescriptionList/index.js +1 -6
- package/dist/components/DescriptionList/styled.d.ts +31 -31
- package/dist/components/DescriptionList/styled.js +34 -85
- package/dist/components/Disclosure/Disclosure.d.ts +574 -6
- package/dist/components/Disclosure/Disclosure.js +34 -79
- package/dist/components/Disclosure/index.js +1 -17
- package/dist/components/Display0/Display0.js +19 -69
- package/dist/components/Display0/index.js +1 -5
- package/dist/components/Display1/Display1.js +19 -69
- package/dist/components/Display1/index.js +1 -5
- package/dist/components/Display2/Display2.js +19 -69
- package/dist/components/Display2/index.js +1 -5
- package/dist/components/Display3/Display3.js +19 -69
- package/dist/components/Display3/index.js +1 -5
- package/dist/components/Divider/Divider.js +11 -41
- package/dist/components/Divider/index.js +1 -5
- package/dist/components/Em/Em.d.ts +31 -31
- package/dist/components/Em/Em.js +6 -13
- package/dist/components/Em/index.js +1 -5
- package/dist/components/EmailField/EmailField.d.ts +4 -9
- package/dist/components/EmailField/EmailField.js +5 -32
- package/dist/components/EmailField/index.js +1 -5
- package/dist/components/EmailInput/EmailInput.d.ts +2 -9
- package/dist/components/EmailInput/EmailInput.js +4 -19
- package/dist/components/EmailInput/index.js +1 -5
- package/dist/components/ErrorSummaryNotification/ErrorSummaryNotification.d.ts +1 -1
- package/dist/components/ErrorSummaryNotification/ErrorSummaryNotification.js +14 -43
- package/dist/components/ErrorSummaryNotification/index.js +1 -5
- package/dist/components/ErrorText/ErrorText.d.ts +33 -35
- package/dist/components/ErrorText/ErrorText.js +15 -40
- package/dist/components/ErrorText/index.js +1 -5
- package/dist/components/Field/Field.d.ts +9 -8
- package/dist/components/Field/Field.js +25 -48
- package/dist/components/Field/index.js +1 -17
- package/dist/components/FilterSelect/FilterSelect.js +55 -76
- package/dist/components/FilterSelect/index.js +1 -5
- package/dist/components/FormGroup/FormGroup.js +8 -42
- package/dist/components/FormGroup/index.js +1 -5
- package/dist/components/Grid/Col.d.ts +33 -34
- package/dist/components/Grid/Col.js +24 -48
- package/dist/components/Grid/Row.d.ts +6 -572
- package/dist/components/Grid/Row.js +34 -72
- package/dist/components/Grid/index.d.ts +1 -1
- package/dist/components/Grid/index.js +2 -7
- package/dist/components/Heading1/Heading1.js +19 -69
- package/dist/components/Heading1/index.js +1 -5
- package/dist/components/Heading2/Heading2.js +19 -69
- package/dist/components/Heading2/index.js +1 -5
- package/dist/components/Heading3/Heading3.js +19 -69
- package/dist/components/Heading3/index.js +1 -5
- package/dist/components/Heading4/Heading4.js +19 -69
- package/dist/components/Heading4/index.js +1 -5
- package/dist/components/HintText/HintText.d.ts +33 -35
- package/dist/components/HintText/HintText.js +15 -40
- package/dist/components/HintText/index.js +1 -5
- package/dist/components/Icon/Icon.d.ts +0 -1
- package/dist/components/Icon/Icon.js +10 -37
- package/dist/components/Icon/index.js +1 -5
- package/dist/components/Input/Input.d.ts +3 -8
- package/dist/components/Input/Input.js +64 -86
- package/dist/components/Label/Label.d.ts +7 -6
- package/dist/components/Label/Label.js +10 -51
- package/dist/components/Label/index.js +1 -5
- package/dist/components/LabelText/LabelText.d.ts +33 -35
- package/dist/components/LabelText/LabelText.js +13 -40
- package/dist/components/LabelText/index.js +1 -5
- package/dist/components/Lead/Lead.d.ts +7 -6
- package/dist/components/Lead/Lead.js +12 -53
- package/dist/components/Lead/index.js +1 -5
- package/dist/components/LineThrough/LineThrough.d.ts +31 -31
- package/dist/components/LineThrough/LineThrough.js +4 -13
- package/dist/components/LineThrough/index.js +1 -5
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/List/List.js +21 -29
- package/dist/components/List/index.js +1 -7
- package/dist/components/List/styled.d.ts +126 -127
- package/dist/components/List/styled.js +32 -45
- package/dist/components/Margin/Margin.d.ts +31 -31
- package/dist/components/Margin/Margin.js +34 -50
- package/dist/components/Margin/index.js +1 -5
- package/dist/components/NavHeader/IconButton.js +10 -18
- package/dist/components/NavHeader/NavHeader.js +21 -49
- package/dist/components/NavHeader/NavHeader.styles.d.ts +283 -284
- package/dist/components/NavHeader/NavHeader.styles.js +82 -78
- package/dist/components/NavHeader/index.js +1 -5
- package/dist/components/Notification/Notification.d.ts +79 -77
- package/dist/components/Notification/Notification.js +69 -92
- package/dist/components/Notification/index.js +1 -9
- package/dist/components/NumberField/NumberField.d.ts +4 -9
- package/dist/components/NumberField/NumberField.js +5 -32
- package/dist/components/NumberField/index.js +1 -5
- package/dist/components/NumberInput/NumberInput.d.ts +2 -9
- package/dist/components/NumberInput/NumberInput.js +4 -19
- package/dist/components/NumberInput/index.js +1 -5
- package/dist/components/P/P.d.ts +8 -7
- package/dist/components/P/P.js +13 -54
- package/dist/components/P/index.js +1 -5
- package/dist/components/PasswordField/PasswordField.d.ts +6 -11
- package/dist/components/PasswordField/PasswordField.js +5 -32
- package/dist/components/PasswordField/index.js +1 -5
- package/dist/components/PasswordInput/PasswordInput.d.ts +5 -11
- package/dist/components/PasswordInput/PasswordInput.js +7 -34
- package/dist/components/PasswordInput/PasswordInput.styled.d.ts +31 -32
- package/dist/components/PasswordInput/PasswordInput.styled.js +13 -37
- package/dist/components/PasswordInput/PasswordVisibilityToggle.js +14 -20
- package/dist/components/PasswordInput/index.js +1 -5
- package/dist/components/PhoneField/PhoneField.d.ts +4 -9
- package/dist/components/PhoneField/PhoneField.js +5 -32
- package/dist/components/PhoneField/index.js +1 -5
- package/dist/components/PhoneInput/PhoneInput.d.ts +2 -9
- package/dist/components/PhoneInput/PhoneInput.js +3 -18
- package/dist/components/PhoneInput/index.js +1 -5
- package/dist/components/ProductCarousel/NavigationDots.js +32 -61
- package/dist/components/ProductCarousel/ProductCarousel.d.ts +1 -0
- package/dist/components/ProductCarousel/ProductCarousel.js +54 -101
- package/dist/components/ProductCarousel/anchor-point.d.ts +198 -1
- package/dist/components/ProductCarousel/anchor-point.js +11 -21
- package/dist/components/ProductCarousel/index.js +1 -5
- package/dist/components/Radio/Radio.d.ts +10 -8
- package/dist/components/Radio/Radio.js +45 -61
- package/dist/components/Radio/RadioField.js +20 -48
- package/dist/components/Radio/index.js +2 -7
- package/dist/components/RadioCard/RadioCard.d.ts +11 -8
- package/dist/components/RadioCard/RadioCard.js +50 -65
- package/dist/components/RadioCard/index.js +1 -5
- package/dist/components/SegmentedControls/SegmentedControls.d.ts +1 -0
- package/dist/components/SegmentedControls/SegmentedControls.js +37 -89
- package/dist/components/SegmentedControls/components/SegmentButton.d.ts +1 -0
- package/dist/components/SegmentedControls/components/SegmentButton.js +41 -82
- package/dist/components/SegmentedControls/index.js +2 -5
- package/dist/components/SelectField/Select.d.ts +31 -31
- package/dist/components/SelectField/Select.js +84 -87
- package/dist/components/SelectField/SelectField.js +4 -33
- package/dist/components/SelectField/index.js +1 -5
- package/dist/components/SkeletonAnimation/SkeletonAnimation.d.ts +2 -2
- package/dist/components/SkeletonAnimation/SkeletonAnimation.js +12 -17
- package/dist/components/SkeletonAnimation/index.js +1 -5
- package/dist/components/SkeletonCTA/SkeletonCTA.js +11 -42
- package/dist/components/SkeletonCTA/index.js +1 -5
- package/dist/components/SkeletonCircle/SkeletonCircle.js +12 -45
- package/dist/components/SkeletonCircle/index.js +1 -5
- package/dist/components/SkeletonHeading/SkeletonHeading.js +9 -41
- package/dist/components/SkeletonHeading/index.js +1 -5
- package/dist/components/SkeletonText/SkeletonText.js +22 -47
- package/dist/components/SkeletonText/index.js +1 -5
- package/dist/components/Small/Small.d.ts +33 -35
- package/dist/components/Small/Small.js +8 -39
- package/dist/components/Small/index.js +1 -5
- package/dist/components/Spinner/Spinner.js +35 -63
- package/dist/components/Spinner/index.js +1 -5
- package/dist/components/Stack/Stack.js +15 -47
- package/dist/components/Stack/index.js +1 -5
- package/dist/components/Stretch/Stretch.js +11 -54
- package/dist/components/Stretch/index.js +1 -17
- package/dist/components/Strong/Strong.d.ts +31 -31
- package/dist/components/Strong/Strong.js +4 -11
- package/dist/components/Strong/index.js +1 -5
- package/dist/components/SubLabelText/SubLabelText.d.ts +33 -35
- package/dist/components/SubLabelText/SubLabelText.js +13 -40
- package/dist/components/SubLabelText/index.js +1 -5
- package/dist/components/Tabs/Tab.d.ts +582 -10
- package/dist/components/Tabs/Tab.js +64 -76
- package/dist/components/Tabs/TabList.d.ts +0 -1
- package/dist/components/Tabs/TabList.js +20 -77
- package/dist/components/Tabs/TabPanel.js +12 -64
- package/dist/components/Tabs/Tabs.js +32 -89
- package/dist/components/Tabs/index.js +4 -11
- package/dist/components/TextField/TextField.d.ts +4 -9
- package/dist/components/TextField/TextField.js +5 -32
- package/dist/components/TextField/index.js +1 -5
- package/dist/components/TextGroup/TextGroup.js +16 -39
- package/dist/components/TextGroup/index.js +1 -5
- package/dist/components/TextInput/TextInput.d.ts +6 -8
- package/dist/components/TextInput/TextInput.js +4 -19
- package/dist/components/TextInput/index.js +1 -5
- package/dist/components/TextLink/TextLink.d.ts +6 -6
- package/dist/components/TextLink/TextLink.js +20 -74
- package/dist/components/TextLink/index.js +1 -5
- package/dist/components/TextareaField/TextareaField.d.ts +4 -11
- package/dist/components/TextareaField/TextareaField.js +5 -32
- package/dist/components/TextareaField/index.js +1 -5
- package/dist/components/TextareaInput/TextareaInput.d.ts +1 -11
- package/dist/components/TextareaInput/TextareaInput.js +13 -67
- package/dist/components/TextareaInput/index.js +1 -5
- package/dist/components/Toast/Toast.d.ts +5 -5
- package/dist/components/Toast/Toast.js +88 -131
- package/dist/components/Toast/index.js +1 -6
- package/dist/components/Toggle/Toggle.d.ts +10 -7
- package/dist/components/Toggle/Toggle.js +18 -49
- package/dist/components/Toggle/index.js +1 -5
- package/dist/components/Toggle/styles.d.ts +130 -130
- package/dist/components/Toggle/styles.js +32 -24
- package/dist/components/index.js +67 -83
- package/dist/esm/components/Accordion/Accordion.js +35 -76
- package/dist/esm/components/Accordion/Group.js +9 -12
- package/dist/esm/components/Accordion/Icon.js +12 -13
- package/dist/esm/components/Accordion/styles.js +42 -28
- package/dist/esm/components/ActionCard/ActionCard.js +48 -46
- package/dist/esm/components/ActionCard/CloseIconShape.js +4 -8
- package/dist/esm/components/ActionCard/IndicatorIconShape.js +4 -8
- package/dist/esm/components/ActionList/ActionList.js +17 -47
- package/dist/esm/components/ActionList/styled.js +48 -30
- package/dist/esm/components/Badge/Badge.js +24 -42
- package/dist/esm/components/CTAButton/CTAButton.js +56 -65
- package/dist/esm/components/CTALink/CTALink.js +3 -15
- package/dist/esm/components/Card/Card.js +10 -32
- package/dist/esm/components/Checkbox/Checkbox.js +39 -55
- package/dist/esm/components/Checkbox/CheckboxField.js +7 -32
- package/dist/esm/components/CurrencyField/CurrencyField.js +3 -27
- package/dist/esm/components/CurrencyInput/CurrencyInput.js +7 -30
- package/dist/esm/components/DataTable/DataTable.js +8 -32
- package/dist/esm/components/DataTable/TableRow.js +8 -20
- package/dist/esm/components/DataTable/styles.js +95 -56
- package/dist/esm/components/DateField/DateField.js +49 -44
- package/dist/esm/components/DescriptionList/DescriptionList.js +7 -35
- package/dist/esm/components/DescriptionList/styled.js +29 -52
- package/dist/esm/components/Disclosure/Disclosure.js +29 -48
- package/dist/esm/components/Display0/Display0.js +14 -37
- package/dist/esm/components/Display1/Display1.js +14 -37
- package/dist/esm/components/Display2/Display2.js +14 -37
- package/dist/esm/components/Display3/Display3.js +14 -37
- package/dist/esm/components/Divider/Divider.js +8 -11
- package/dist/esm/components/Em/Em.js +5 -6
- package/dist/esm/components/EmailField/EmailField.js +3 -27
- package/dist/esm/components/EmailInput/EmailInput.js +1 -13
- package/dist/esm/components/ErrorSummaryNotification/ErrorSummaryNotification.js +6 -32
- package/dist/esm/components/ErrorText/ErrorText.js +11 -10
- package/dist/esm/components/Field/Field.js +16 -36
- package/dist/esm/components/FilterSelect/FilterSelect.js +43 -37
- package/dist/esm/components/FormGroup/FormGroup.js +4 -32
- package/dist/esm/components/Grid/Col.js +20 -18
- package/dist/esm/components/Grid/Row.js +29 -41
- package/dist/esm/components/Grid/index.js +1 -1
- package/dist/esm/components/Heading1/Heading1.js +14 -37
- package/dist/esm/components/Heading2/Heading2.js +14 -37
- package/dist/esm/components/Heading3/Heading3.js +14 -37
- package/dist/esm/components/Heading4/Heading4.js +14 -37
- package/dist/esm/components/HintText/HintText.js +11 -10
- package/dist/esm/components/Icon/Icon.js +6 -29
- package/dist/esm/components/Input/Input.js +58 -54
- package/dist/esm/components/Label/Label.js +7 -22
- package/dist/esm/components/LabelText/LabelText.js +9 -10
- package/dist/esm/components/Lead/Lead.js +9 -24
- package/dist/esm/components/LineThrough/LineThrough.js +3 -6
- package/dist/esm/components/List/List.js +11 -14
- package/dist/esm/components/List/styled.js +30 -17
- package/dist/esm/components/Margin/Margin.js +26 -36
- package/dist/esm/components/NavHeader/IconButton.js +5 -9
- package/dist/esm/components/NavHeader/NavHeader.js +10 -11
- package/dist/esm/components/NavHeader/NavHeader.styles.js +79 -46
- package/dist/esm/components/Notification/Notification.js +63 -60
- package/dist/esm/components/NumberField/NumberField.js +3 -27
- package/dist/esm/components/NumberInput/NumberInput.js +1 -13
- package/dist/esm/components/P/P.js +10 -25
- package/dist/esm/components/PasswordField/PasswordField.js +3 -27
- package/dist/esm/components/PasswordInput/PasswordInput.js +4 -28
- package/dist/esm/components/PasswordInput/PasswordInput.styled.js +10 -8
- package/dist/esm/components/PasswordInput/PasswordVisibilityToggle.js +9 -10
- package/dist/esm/components/PhoneField/PhoneField.js +3 -27
- package/dist/esm/components/PhoneInput/PhoneInput.js +1 -13
- package/dist/esm/components/ProductCarousel/NavigationDots.js +28 -30
- package/dist/esm/components/ProductCarousel/ProductCarousel.js +40 -57
- package/dist/esm/components/ProductCarousel/anchor-point.js +11 -17
- package/dist/esm/components/Radio/Radio.js +38 -48
- package/dist/esm/components/Radio/RadioField.js +10 -35
- package/dist/esm/components/RadioCard/RadioCard.js +44 -53
- package/dist/esm/components/SegmentedControls/SegmentedControls.js +33 -58
- package/dist/esm/components/SegmentedControls/components/SegmentButton.js +33 -44
- package/dist/esm/components/SelectField/Select.js +76 -49
- package/dist/esm/components/SelectField/SelectField.js +1 -26
- package/dist/esm/components/SkeletonAnimation/SkeletonAnimation.js +4 -5
- package/dist/esm/components/SkeletonCTA/SkeletonCTA.js +6 -30
- package/dist/esm/components/SkeletonCircle/SkeletonCircle.js +8 -34
- package/dist/esm/components/SkeletonHeading/SkeletonHeading.js +5 -30
- package/dist/esm/components/SkeletonText/SkeletonText.js +15 -33
- package/dist/esm/components/Small/Small.js +5 -10
- package/dist/esm/components/Spinner/Spinner.js +30 -31
- package/dist/esm/components/Stack/Stack.js +7 -33
- package/dist/esm/components/Stretch/Stretch.js +8 -24
- package/dist/esm/components/Strong/Strong.js +3 -4
- package/dist/esm/components/SubLabelText/SubLabelText.js +9 -10
- package/dist/esm/components/Tabs/Tab.js +60 -46
- package/dist/esm/components/Tabs/TabList.js +15 -45
- package/dist/esm/components/Tabs/TabPanel.js +9 -34
- package/dist/esm/components/Tabs/Tabs.js +24 -54
- package/dist/esm/components/TextField/TextField.js +3 -27
- package/dist/esm/components/TextGroup/TextGroup.js +11 -30
- package/dist/esm/components/TextInput/TextInput.js +1 -13
- package/dist/esm/components/TextLink/TextLink.js +14 -42
- package/dist/esm/components/TextareaField/TextareaField.js +3 -27
- package/dist/esm/components/TextareaInput/TextareaInput.js +8 -36
- package/dist/esm/components/Toast/Toast.js +67 -82
- package/dist/esm/components/Toggle/Toggle.js +13 -41
- package/dist/esm/components/Toggle/styles.js +29 -15
- package/dist/esm/hooks/use-breakpoint.js +3 -3
- package/dist/esm/hooks/use-full-width.js +5 -6
- package/dist/esm/hooks/use-layout.js +6 -6
- package/dist/esm/providers/IconsProvider.js +9 -18
- package/dist/esm/providers/icons/Address.js +1 -12
- package/dist/esm/providers/icons/Advice.js +1 -12
- package/dist/esm/providers/icons/Archive.js +1 -12
- package/dist/esm/providers/icons/ArrowDown.js +1 -12
- package/dist/esm/providers/icons/ArrowLeft.js +1 -12
- package/dist/esm/providers/icons/ArrowRight.js +1 -12
- package/dist/esm/providers/icons/ArrowUp.js +1 -12
- package/dist/esm/providers/icons/Award.js +1 -12
- package/dist/esm/providers/icons/Battery.js +1 -12
- package/dist/esm/providers/icons/Cal.js +1 -12
- package/dist/esm/providers/icons/CalBook.js +1 -12
- package/dist/esm/providers/icons/CaretArrowDown.js +1 -12
- package/dist/esm/providers/icons/CaretArrowLeft.js +1 -12
- package/dist/esm/providers/icons/CaretArrowRight.js +1 -12
- package/dist/esm/providers/icons/CaretArrowUp.js +1 -12
- package/dist/esm/providers/icons/CaretDown.js +1 -12
- package/dist/esm/providers/icons/CaretLeft.js +1 -12
- package/dist/esm/providers/icons/CaretRight.js +1 -12
- package/dist/esm/providers/icons/CaretUp.js +1 -12
- package/dist/esm/providers/icons/Chart.js +1 -12
- package/dist/esm/providers/icons/ChartFilled.js +1 -12
- package/dist/esm/providers/icons/Check.js +1 -12
- package/dist/esm/providers/icons/CheckCircle.js +1 -12
- package/dist/esm/providers/icons/ChevronDown.js +1 -12
- package/dist/esm/providers/icons/ChevronLeft.js +1 -12
- package/dist/esm/providers/icons/ChevronLeftSmall.js +1 -12
- package/dist/esm/providers/icons/ChevronLeftSmallFirst.js +1 -12
- package/dist/esm/providers/icons/ChevronRight.js +1 -12
- package/dist/esm/providers/icons/ChevronRightSmall.js +1 -12
- package/dist/esm/providers/icons/ChevronRightSmallLast.js +1 -12
- package/dist/esm/providers/icons/ChevronUp.js +1 -12
- package/dist/esm/providers/icons/Circle.js +1 -12
- package/dist/esm/providers/icons/CloseCircle.js +1 -12
- package/dist/esm/providers/icons/Cross.js +1 -12
- package/dist/esm/providers/icons/Doc.js +1 -12
- package/dist/esm/providers/icons/Dollar.js +1 -12
- package/dist/esm/providers/icons/Download.js +1 -12
- package/dist/esm/providers/icons/Eco.js +1 -12
- package/dist/esm/providers/icons/EcoHome.js +1 -12
- package/dist/esm/providers/icons/Edit.js +1 -12
- package/dist/esm/providers/icons/ElectricCar.js +1 -12
- package/dist/esm/providers/icons/ElectricHome.js +1 -12
- package/dist/esm/providers/icons/Electricity.js +1 -12
- package/dist/esm/providers/icons/EnergyAdvice.js +1 -12
- package/dist/esm/providers/icons/Equals.js +1 -12
- package/dist/esm/providers/icons/Euro.js +1 -12
- package/dist/esm/providers/icons/Gas.js +1 -12
- package/dist/esm/providers/icons/GlobeAddress.js +1 -12
- package/dist/esm/providers/icons/Help.js +1 -12
- package/dist/esm/providers/icons/HelpFilled.js +1 -12
- package/dist/esm/providers/icons/Hide.js +1 -12
- package/dist/esm/providers/icons/Home.js +1 -12
- package/dist/esm/providers/icons/HomeFilled.js +1 -12
- package/dist/esm/providers/icons/HydroPower.js +1 -12
- package/dist/esm/providers/icons/Info.js +1 -12
- package/dist/esm/providers/icons/Link.js +1 -12
- package/dist/esm/providers/icons/Logo.js +1 -12
- package/dist/esm/providers/icons/Mail.js +1 -12
- package/dist/esm/providers/icons/MailOpen.js +1 -12
- package/dist/esm/providers/icons/Menu.js +1 -12
- package/dist/esm/providers/icons/Message.js +1 -12
- package/dist/esm/providers/icons/MessageFilled.js +1 -12
- package/dist/esm/providers/icons/Minus.js +1 -12
- package/dist/esm/providers/icons/Mobile.js +1 -12
- package/dist/esm/providers/icons/NewWindow.js +1 -12
- package/dist/esm/providers/icons/PaymentCard.js +1 -12
- package/dist/esm/providers/icons/PaymentCardFilled.js +1 -12
- package/dist/esm/providers/icons/Phone.js +1 -12
- package/dist/esm/providers/icons/Plus.js +1 -12
- package/dist/esm/providers/icons/Pound.js +1 -12
- package/dist/esm/providers/icons/Pricing.js +1 -12
- package/dist/esm/providers/icons/PricingFilled.js +1 -12
- package/dist/esm/providers/icons/Search.js +1 -12
- package/dist/esm/providers/icons/Security.js +1 -12
- package/dist/esm/providers/icons/Shop.js +1 -12
- package/dist/esm/providers/icons/ShopFilled.js +1 -12
- package/dist/esm/providers/icons/Show.js +1 -12
- package/dist/esm/providers/icons/SmartHome.js +1 -12
- package/dist/esm/providers/icons/SmartMeter.js +1 -12
- package/dist/esm/providers/icons/Solar.js +1 -12
- package/dist/esm/providers/icons/Star.js +1 -12
- package/dist/esm/providers/icons/StarFilled.js +1 -12
- package/dist/esm/providers/icons/Sun.js +1 -12
- package/dist/esm/providers/icons/Torch.js +1 -12
- package/dist/esm/providers/icons/Trees.js +1 -12
- package/dist/esm/providers/icons/Tune.js +1 -12
- package/dist/esm/providers/icons/User.js +1 -12
- package/dist/esm/providers/icons/UserFilled.js +1 -12
- package/dist/esm/providers/icons/Wallet.js +1 -12
- package/dist/esm/providers/icons/WalletFilled.js +1 -12
- package/dist/esm/providers/icons/WarmHome.js +1 -12
- package/dist/esm/providers/icons/Warning.js +1 -12
- package/dist/esm/providers/icons/WebAddress.js +1 -12
- package/dist/esm/providers/icons/WindPower.js +1 -12
- package/dist/esm/styled.native.js +1 -1
- package/dist/esm/utils/utils.js +23 -50
- package/dist/hooks/index.js +2 -18
- package/dist/hooks/use-breakpoint.js +6 -10
- package/dist/hooks/use-full-width.js +7 -12
- package/dist/hooks/use-layout.js +7 -11
- package/dist/index.js +3 -19
- package/dist/providers/IconsProvider.js +107 -121
- package/dist/providers/icons/Address.js +3 -41
- package/dist/providers/icons/Advice.js +3 -41
- package/dist/providers/icons/Archive.js +3 -41
- package/dist/providers/icons/ArrowDown.js +3 -41
- package/dist/providers/icons/ArrowLeft.js +3 -41
- package/dist/providers/icons/ArrowRight.js +3 -41
- package/dist/providers/icons/ArrowUp.js +3 -41
- package/dist/providers/icons/Award.js +3 -41
- package/dist/providers/icons/Battery.js +3 -41
- package/dist/providers/icons/Cal.js +3 -41
- package/dist/providers/icons/CalBook.js +3 -41
- package/dist/providers/icons/CaretArrowDown.js +3 -41
- package/dist/providers/icons/CaretArrowLeft.js +3 -41
- package/dist/providers/icons/CaretArrowRight.js +3 -41
- package/dist/providers/icons/CaretArrowUp.js +3 -41
- package/dist/providers/icons/CaretDown.js +3 -41
- package/dist/providers/icons/CaretLeft.js +3 -41
- package/dist/providers/icons/CaretRight.js +3 -41
- package/dist/providers/icons/CaretUp.js +3 -41
- package/dist/providers/icons/Chart.js +3 -41
- package/dist/providers/icons/ChartFilled.js +3 -41
- package/dist/providers/icons/Check.js +3 -41
- package/dist/providers/icons/CheckCircle.js +3 -41
- package/dist/providers/icons/ChevronDown.js +3 -41
- package/dist/providers/icons/ChevronLeft.js +3 -41
- package/dist/providers/icons/ChevronLeftSmall.js +3 -41
- package/dist/providers/icons/ChevronLeftSmallFirst.js +3 -41
- package/dist/providers/icons/ChevronRight.js +3 -41
- package/dist/providers/icons/ChevronRightSmall.js +3 -41
- package/dist/providers/icons/ChevronRightSmallLast.js +3 -41
- package/dist/providers/icons/ChevronUp.js +3 -41
- package/dist/providers/icons/Circle.js +3 -41
- package/dist/providers/icons/CloseCircle.js +3 -41
- package/dist/providers/icons/Cross.js +3 -41
- package/dist/providers/icons/Doc.js +3 -41
- package/dist/providers/icons/Dollar.js +3 -41
- package/dist/providers/icons/Download.js +3 -41
- package/dist/providers/icons/Eco.js +3 -41
- package/dist/providers/icons/EcoHome.js +3 -41
- package/dist/providers/icons/Edit.js +3 -41
- package/dist/providers/icons/ElectricCar.js +3 -41
- package/dist/providers/icons/ElectricHome.js +3 -41
- package/dist/providers/icons/Electricity.js +3 -41
- package/dist/providers/icons/EnergyAdvice.js +3 -41
- package/dist/providers/icons/Equals.js +3 -41
- package/dist/providers/icons/Euro.js +3 -41
- package/dist/providers/icons/Gas.js +3 -41
- package/dist/providers/icons/GlobeAddress.js +3 -41
- package/dist/providers/icons/Help.js +3 -41
- package/dist/providers/icons/HelpFilled.js +3 -41
- package/dist/providers/icons/Hide.js +3 -41
- package/dist/providers/icons/Home.js +3 -41
- package/dist/providers/icons/HomeFilled.js +3 -41
- package/dist/providers/icons/HydroPower.js +3 -41
- package/dist/providers/icons/Info.js +3 -41
- package/dist/providers/icons/Link.js +3 -41
- package/dist/providers/icons/Logo.js +3 -41
- package/dist/providers/icons/Mail.js +3 -41
- package/dist/providers/icons/MailOpen.js +3 -41
- package/dist/providers/icons/Menu.js +3 -41
- package/dist/providers/icons/Message.js +3 -41
- package/dist/providers/icons/MessageFilled.js +3 -41
- package/dist/providers/icons/Minus.js +3 -41
- package/dist/providers/icons/Mobile.js +3 -41
- package/dist/providers/icons/NewWindow.js +3 -41
- package/dist/providers/icons/PaymentCard.js +3 -41
- package/dist/providers/icons/PaymentCardFilled.js +3 -41
- package/dist/providers/icons/Phone.js +3 -41
- package/dist/providers/icons/Plus.js +3 -41
- package/dist/providers/icons/Pound.js +3 -41
- package/dist/providers/icons/Pricing.js +3 -41
- package/dist/providers/icons/PricingFilled.js +3 -41
- package/dist/providers/icons/Search.js +3 -41
- package/dist/providers/icons/Security.js +3 -41
- package/dist/providers/icons/Shop.js +3 -41
- package/dist/providers/icons/ShopFilled.js +3 -41
- package/dist/providers/icons/Show.js +3 -41
- package/dist/providers/icons/SmartHome.js +3 -41
- package/dist/providers/icons/SmartMeter.js +3 -41
- package/dist/providers/icons/Solar.js +3 -41
- package/dist/providers/icons/Star.js +3 -41
- package/dist/providers/icons/StarFilled.js +3 -41
- package/dist/providers/icons/Sun.js +3 -41
- package/dist/providers/icons/Torch.js +3 -41
- package/dist/providers/icons/Trees.js +3 -41
- package/dist/providers/icons/Tune.js +3 -41
- package/dist/providers/icons/User.js +3 -41
- package/dist/providers/icons/UserFilled.js +3 -41
- package/dist/providers/icons/Wallet.js +3 -41
- package/dist/providers/icons/WalletFilled.js +3 -41
- package/dist/providers/icons/WarmHome.js +3 -41
- package/dist/providers/icons/Warning.js +3 -41
- package/dist/providers/icons/WebAddress.js +3 -41
- package/dist/providers/icons/WindPower.js +3 -41
- package/dist/providers/icons/index.js +93 -109
- package/dist/providers/index.js +2 -18
- package/dist/providers/types.js +1 -2
- package/dist/styled.native.d.ts +186 -188
- package/dist/styled.native.js +4 -33
- package/dist/theme/index.js +1 -17
- package/dist/utils/index.js +1 -17
- package/dist/utils/utils.d.ts +3 -3
- package/dist/utils/utils.js +27 -64
- package/package.json +37 -34
|
@@ -1,73 +1,48 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
2
|
import Animated, { useAnimatedStyle, useSharedValue, withSpring, } from 'react-native-reanimated';
|
|
25
3
|
import styled, { useTheme } from '../../styled.native';
|
|
26
4
|
import { SegmentButton } from './components/SegmentButton';
|
|
27
5
|
/* These settings were found to be nice and fast whilst maintaining spring */
|
|
28
|
-
|
|
6
|
+
const springSettings = {
|
|
29
7
|
damping: 25,
|
|
30
8
|
mass: 0.25,
|
|
31
9
|
};
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
translateX: animatedX.value,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
translateY: animatedY.value + theme.core.space[size === 'small' ? 1 : 2],
|
|
46
|
-
} /* accounting for margin from top & bottom */,
|
|
47
|
-
],
|
|
10
|
+
export const SegmentedControls = ({ activeSegment, setActiveSegment, segments, inline = false, multipleRows, size = 'large', ...rest }) => {
|
|
11
|
+
const animatedX = useSharedValue(0);
|
|
12
|
+
const animatedY = useSharedValue(0);
|
|
13
|
+
const animatedHeight = useSharedValue(0);
|
|
14
|
+
const animatedWidth = useSharedValue(0);
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const animatedBackgroundStyle = useAnimatedStyle(() => ({
|
|
17
|
+
left: animatedX.value,
|
|
18
|
+
top: animatedY.value + theme.core.space[size === 'small' ? 2 : 3],
|
|
48
19
|
width: animatedWidth.value,
|
|
49
20
|
height: animatedHeight.value,
|
|
50
21
|
position: 'absolute',
|
|
51
22
|
borderRadius: theme.core.radius.max,
|
|
52
23
|
backgroundColor: theme.semantic.surface.elevated,
|
|
53
|
-
})
|
|
54
|
-
return (_jsxs(SegmentsContainer,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
24
|
+
}), [animatedX, animatedY, animatedWidth, animatedHeight]);
|
|
25
|
+
return (_jsxs(SegmentsContainer, { "$inline": inline, "$multipleRows": multipleRows, ...rest, children: [_jsx(Animated.View, { style: animatedBackgroundStyle }), segments.map(segment => (_jsx(SegmentButton, { isSelected: activeSegment.key === segment.key, label: segment.label, accessibilityLabel: segment.accessibilityLabel, accessibilityHint: segment.accessibilityHint, setAnimatedValues: (x, y, width) => {
|
|
26
|
+
animatedX.value = withSpring(x, springSettings);
|
|
27
|
+
animatedY.value = withSpring(y, springSettings);
|
|
28
|
+
animatedWidth.value = width;
|
|
29
|
+
}, onPress: () => setActiveSegment(segment), onLayout: (width, height, x, y) => {
|
|
30
|
+
if (activeSegment.key === segment.key) {
|
|
31
|
+
animatedX.value = x;
|
|
32
|
+
animatedY.value = y;
|
|
33
|
+
animatedHeight.value = height;
|
|
59
34
|
animatedWidth.value = width;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
animatedX.value = x;
|
|
63
|
-
animatedY.value = y;
|
|
64
|
-
animatedHeight.value = height;
|
|
65
|
-
animatedWidth.value = width;
|
|
66
|
-
}
|
|
67
|
-
}, multipleRows: multipleRows, size: size, inline: inline, testID: "".concat((_a = rest.testID) !== null && _a !== void 0 ? _a : 'segment', "-").concat(segment.key), segmentCount: (_b = segments.length) !== null && _b !== void 0 ? _b : 0 }, segment.key));
|
|
68
|
-
})] })));
|
|
35
|
+
}
|
|
36
|
+
}, multipleRows: multipleRows, size: size, inline: inline, testID: `${rest.testID ?? 'segment'}-${segment.key}`, segmentCount: segments.length ?? 0 }, segment.key)))] }));
|
|
69
37
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
38
|
+
const SegmentsContainer = styled.View(({ theme: { core, semantic }, $inline, $multipleRows }) => `
|
|
39
|
+
flex-direction: row;
|
|
40
|
+
flex-wrap: ${$multipleRows ? '' : 'no-'}wrap;
|
|
41
|
+
justify-content: ${$multipleRows ? 'space-between' : 'space-around'};
|
|
42
|
+
align-items: center;
|
|
43
|
+
width: ${$inline ? 'auto' : '100%'};
|
|
44
|
+
align-self: ${$inline ? 'flex-start' : 'stretch'};
|
|
45
|
+
padding: ${core.space[1]}px;
|
|
46
|
+
background-color: ${semantic.surface.cutout};
|
|
47
|
+
border-radius: ${core.radius.max}px;
|
|
48
|
+
`);
|
|
@@ -1,65 +1,53 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import { useEffect, useRef } from 'react';
|
|
14
3
|
import { Pressable, useWindowDimensions, } from 'react-native';
|
|
15
4
|
import Animated, { useAnimatedStyle, useSharedValue, withTiming, } from 'react-native-reanimated';
|
|
16
5
|
import styled from '../../../styled.native';
|
|
17
6
|
import { P } from '../../P';
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const AnimatedP = Animated.createAnimatedComponent(P);
|
|
8
|
+
const textSizeProps = {
|
|
20
9
|
numberOfLines: 1,
|
|
21
10
|
adjustsFontSizeToFit: true,
|
|
22
11
|
minimumFontScale: 0.95,
|
|
23
12
|
maxFontSizeMultiplier: 1.75,
|
|
24
13
|
};
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var animatedStyleNormal = useAnimatedStyle(function () {
|
|
14
|
+
export const SegmentButton = ({ accessibilityLabel, accessibilityHint, inline, isSelected, label, multipleRows, onLayout, onPress, setAnimatedValues, segmentCount, size = 'large', testID, }) => {
|
|
15
|
+
const xRef = useRef(0);
|
|
16
|
+
const yRef = useRef(0);
|
|
17
|
+
const widthRef = useRef(0);
|
|
18
|
+
const heightRef = useRef(0);
|
|
19
|
+
const hitslopVal = size === 'small' ? 8 : 4;
|
|
20
|
+
const fontScale = useWindowDimensions().fontScale;
|
|
21
|
+
const fontWeightAnim = useSharedValue(isSelected ? 1 : 0);
|
|
22
|
+
const animatedStyleNormal = useAnimatedStyle(() => {
|
|
35
23
|
return {
|
|
36
24
|
opacity: 1 - fontWeightAnim.value,
|
|
37
25
|
position: 'absolute',
|
|
38
26
|
};
|
|
39
27
|
}, [fontWeightAnim]);
|
|
40
|
-
|
|
28
|
+
const animatedStyleBold = useAnimatedStyle(() => {
|
|
41
29
|
return {
|
|
42
30
|
opacity: fontWeightAnim.value,
|
|
43
31
|
position: 'absolute',
|
|
44
32
|
};
|
|
45
33
|
}, [fontWeightAnim]);
|
|
46
|
-
useEffect(
|
|
34
|
+
useEffect(() => {
|
|
47
35
|
fontWeightAnim.value = withTiming(isSelected ? 1 : 0);
|
|
48
36
|
}, [fontWeightAnim, isSelected]);
|
|
49
|
-
useEffect(
|
|
37
|
+
useEffect(() => {
|
|
50
38
|
if (!isSelected) {
|
|
51
39
|
return;
|
|
52
40
|
}
|
|
53
41
|
setAnimatedValues(xRef.current, yRef.current, widthRef.current);
|
|
54
42
|
}, [isSelected]);
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
const handleLayout = (event) => {
|
|
44
|
+
const { width, height, x, y } = event.nativeEvent.layout;
|
|
57
45
|
xRef.current = x;
|
|
58
46
|
// (adrian.pop) - I couldn't figure out how to make the positioning work once the
|
|
59
47
|
// choices go on the second row. The only way I could get it to work
|
|
60
48
|
// was to hardcode the denominator to 3 for the single row ones
|
|
61
49
|
// and 1.1 for the multiple row ones.
|
|
62
|
-
yRef.current = y - height / (multipleRows ?
|
|
50
|
+
yRef.current = y - height / ((multipleRows ? 2.5 : 3) * fontScale);
|
|
63
51
|
heightRef.current = height;
|
|
64
52
|
widthRef.current = width;
|
|
65
53
|
onLayout(width, height, x, yRef.current);
|
|
@@ -69,21 +57,22 @@ export var SegmentButton = function (_a) {
|
|
|
69
57
|
bottom: hitslopVal,
|
|
70
58
|
}, style: {
|
|
71
59
|
flexGrow: inline || multipleRows ? undefined : 1,
|
|
72
|
-
width: inline || multipleRows ? 'auto' :
|
|
73
|
-
}, testID: testID, children: _jsxs(SSegmentsWrapper, { "$isSelected": isSelected, "$size": size, multiline: multipleRows, children: [_jsx(SSegmentText,
|
|
60
|
+
width: inline || multipleRows ? 'auto' : `${100 / segmentCount}%`,
|
|
61
|
+
}, testID: testID, children: _jsxs(SSegmentsWrapper, { "$isSelected": isSelected, "$size": size, multiline: multipleRows, children: [_jsx(SSegmentText, { style: {
|
|
74
62
|
opacity: 0,
|
|
75
63
|
fontWeight: '900',
|
|
76
|
-
}, "$isSelected": false
|
|
64
|
+
}, "$isSelected": false, ...textSizeProps, children: label }), _jsx(SSegmentText, { style: animatedStyleNormal, "$isSelected": false, ...textSizeProps, children: label }), _jsx(SSegmentText, { style: animatedStyleBold, "$isSelected": true, ...textSizeProps, children: label })] }) }));
|
|
77
65
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
66
|
+
const SSegmentsWrapper = styled.View(({ theme, $size, multiline }) => `
|
|
67
|
+
${multiline
|
|
68
|
+
? `padding: 4px ${theme.core.space[$size === 'small' ? 4 : 6]}px;`
|
|
69
|
+
: `padding: ${$size === 'small' ? 2 : 8}px ${theme.core.space[$size === 'small' ? 3 : 4]}px;`}
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
`);
|
|
73
|
+
const SSegmentText = styled(AnimatedP)(({ $isSelected, theme }) => `
|
|
74
|
+
font-family: ${$isSelected
|
|
75
|
+
? theme.core.fontFamily.bodyBold.native
|
|
76
|
+
: theme.core.fontFamily.body.native};
|
|
77
|
+
color: ${theme.semantic.message.base};
|
|
78
|
+
`);
|
|
@@ -1,66 +1,93 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
2
|
import { numToPx } from '@ovotech/element-core';
|
|
7
3
|
import groupBy from 'lodash.groupby';
|
|
8
4
|
import { Fragment, useState } from 'react';
|
|
9
|
-
import { Modal, ScrollView, View } from 'react-native';
|
|
5
|
+
import { Dimensions, Modal, ScrollView, View } from 'react-native';
|
|
6
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
10
7
|
import styled, { css } from '../../styled.native';
|
|
11
8
|
import { Icon } from '../Icon';
|
|
12
9
|
import { P } from '../P';
|
|
13
10
|
import { Strong } from '../Strong';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const SelectInput = styled.TouchableOpacity(({ theme: { semantic, core }, hasError }) => {
|
|
12
|
+
return css `
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background-color: transparent;
|
|
16
|
+
border-color: ${hasError
|
|
17
17
|
? semantic.error.message
|
|
18
|
-
: semantic.border.functional
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var core = _a.theme.core;
|
|
26
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 95%;\n max-height: 70%;\n border-radius: ", ";\n background-color: ", ";\n "], ["\n width: 95%;\n max-height: 70%;\n border-radius: ", ";\n background-color: ", ";\n "])), numToPx(core.radius.small), core.color.brand.white);
|
|
27
|
-
});
|
|
28
|
-
var SelectOption = styled.TouchableOpacity(function (_a) {
|
|
29
|
-
var _b = _a.theme, semantic = _b.semantic, core = _b.core, isLastOption = _a.isLastOption;
|
|
30
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n border-bottom-color: ", ";\n border-bottom-width: ", "px;\n padding: 0 ", ";\n "], ["\n flex-direction: row;\n align-items: center;\n border-bottom-color: ", ";\n border-bottom-width: ", "px;\n padding: 0 ", ";\n "])), semantic.border.differentiated, isLastOption ? 0 : 1, numToPx(core.space[4]));
|
|
31
|
-
});
|
|
32
|
-
var Radio = styled.View(function (_a) {
|
|
33
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic, isChecked = _a.isChecked;
|
|
34
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 24px;\n height: 24px;\n margin-left: auto;\n border-radius: 24px;\n border-width: ", ";\n border-color: ", ";\n "], ["\n width: 24px;\n height: 24px;\n margin-left: auto;\n border-radius: 24px;\n border-width: ", ";\n border-color: ", ";\n "])), numToPx(core.borderWidth.small), isChecked
|
|
35
|
-
? semantic.focus.outline
|
|
36
|
-
: semantic.border.functional);
|
|
37
|
-
});
|
|
38
|
-
var RadioDot = styled.View(function (_a) {
|
|
39
|
-
var semantic = _a.theme.semantic, isChecked = _a.isChecked;
|
|
40
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n position: absolute;\n top: 5px;\n width: 12px;\n height: 12px;\n border-radius: 12px;\n align-self: center;\n opacity: ", ";\n "], ["\n background-color: ", ";\n position: absolute;\n top: 5px;\n width: 12px;\n height: 12px;\n border-radius: 12px;\n align-self: center;\n opacity: ", ";\n "])), semantic.focus.outline, isChecked ? 1 : 0);
|
|
41
|
-
});
|
|
42
|
-
var StyledP = styled(P)(function (_a) {
|
|
43
|
-
var core = _a.theme.core;
|
|
44
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n margin-bottom: ", ";\n "], ["\n margin-top: ", ";\n margin-bottom: ", ";\n "])), numToPx(core.space[3]), numToPx(core.space[3]));
|
|
45
|
-
});
|
|
46
|
-
var StyledCategory = styled(P)(function (_a) {
|
|
47
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic;
|
|
48
|
-
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-size: ", ";\n color: ", ";\n background-color: ", ";\n padding: ", " ", ";\n "], ["\n font-size: ", ";\n color: ", ";\n background-color: ", ";\n padding: ", " ", ";\n "])), numToPx(core.fontSize.label.large), semantic.message.secondary, semantic.surface.cutout, numToPx(core.space[1]), numToPx(core.space[4]));
|
|
18
|
+
: semantic.border.functional};
|
|
19
|
+
border-width: ${numToPx(core.borderWidth.small)};
|
|
20
|
+
border-radius: ${numToPx(core.radius.small)};
|
|
21
|
+
padding: ${numToPx(core.space[2])};
|
|
22
|
+
padding-right: 14px;
|
|
23
|
+
height: 44px;
|
|
24
|
+
`;
|
|
49
25
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
const DropdownWrapper = styled.View(({ theme: { core } }) => css `
|
|
27
|
+
flex: 1;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
|
|
31
|
+
/* 40 is an opacity for hex https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4 */
|
|
32
|
+
background-color: ${core.color.neutral.darkest}40;
|
|
33
|
+
`);
|
|
34
|
+
const DropdownContainer = styled(SafeAreaView)(({ theme: { core } }) => css `
|
|
35
|
+
width: 95%;
|
|
36
|
+
max-height: 70%;
|
|
37
|
+
border-radius: ${numToPx(core.radius.small)};
|
|
38
|
+
background-color: ${core.color.brand.white};
|
|
39
|
+
`);
|
|
40
|
+
const SelectOption = styled.TouchableOpacity(({ theme: { semantic, core }, isLastOption }) => css `
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
align-items: center;
|
|
43
|
+
border-bottom-color: ${semantic.border.differentiated};
|
|
44
|
+
border-bottom-width: ${isLastOption ? 0 : 1}px;
|
|
45
|
+
padding: 0 ${numToPx(core.space[4])};
|
|
46
|
+
`);
|
|
47
|
+
const Radio = styled.View(({ theme: { core, semantic }, isChecked }) => css `
|
|
48
|
+
width: 24px;
|
|
49
|
+
height: 24px;
|
|
50
|
+
margin-left: auto;
|
|
51
|
+
border-radius: 24px;
|
|
52
|
+
border-width: ${numToPx(core.borderWidth.small)};
|
|
53
|
+
border-color: ${isChecked
|
|
54
|
+
? semantic.focus.outline
|
|
55
|
+
: semantic.border.functional};
|
|
56
|
+
`);
|
|
57
|
+
const RadioDot = styled.View(({ theme: { semantic }, isChecked }) => css `
|
|
58
|
+
background-color: ${semantic.focus.outline};
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 5px;
|
|
61
|
+
width: 12px;
|
|
62
|
+
height: 12px;
|
|
63
|
+
border-radius: 12px;
|
|
64
|
+
align-self: center;
|
|
65
|
+
opacity: ${isChecked ? 1 : 0};
|
|
66
|
+
`);
|
|
67
|
+
const StyledP = styled(P)(({ theme: { core } }) => css `
|
|
68
|
+
margin-top: ${numToPx(core.space[3])};
|
|
69
|
+
margin-bottom: ${numToPx(core.space[3])};
|
|
70
|
+
`);
|
|
71
|
+
const StyledCategory = styled(P)(({ theme: { core, semantic } }) => css `
|
|
72
|
+
font-size: ${numToPx(core.fontSize.label.large)};
|
|
73
|
+
color: ${semantic.message.secondary};
|
|
74
|
+
background-color: ${semantic.surface.cutout};
|
|
75
|
+
padding: ${numToPx(core.space[1])} ${numToPx(core.space[4])};
|
|
76
|
+
`);
|
|
77
|
+
export const Select = ({ options = [], defaultSelected = { label: '', value: 'default' }, noOptionMessage = 'No option selected', onSelected = () => null, hasError = false, testID = 'select', }) => {
|
|
78
|
+
const [isOpen, setOpen] = useState(false);
|
|
79
|
+
const [selected, setSelected] = useState(defaultSelected);
|
|
80
|
+
const height = Dimensions.get('window').height;
|
|
81
|
+
const dropdownContainerMaxHeight = height * 0.7;
|
|
82
|
+
const handleOptionPress = (val) => {
|
|
55
83
|
onSelected(val);
|
|
56
84
|
setOpen(false);
|
|
57
85
|
setSelected(val);
|
|
58
86
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
label:
|
|
87
|
+
const optionsByCategories = groupBy(options, 'category');
|
|
88
|
+
const requiredOption = {
|
|
89
|
+
label: `-- ${noOptionMessage} --`,
|
|
62
90
|
value: 'default',
|
|
63
91
|
};
|
|
64
|
-
return (_jsxs(View, { children: [_jsxs(SelectInput, { testID: testID, hasError: hasError, onPress:
|
|
92
|
+
return (_jsxs(View, { children: [_jsxs(SelectInput, { testID: testID, hasError: hasError, onPress: () => setOpen(!isOpen), children: [_jsx(P, { style: { marginTop: 0, marginBottom: 0 }, children: selected.value === 'default' ? '' : selected.label }), _jsx(Icon, { name: "chevron-down", size: 16, style: { marginLeft: 'auto' } })] }), _jsx(Modal, { transparent: true, visible: isOpen, animationType: "fade", onRequestClose: () => setOpen(false), children: _jsx(DropdownWrapper, { children: _jsx(DropdownContainer, { style: { maxHeight: dropdownContainerMaxHeight }, children: _jsxs(ScrollView, { nestedScrollEnabled: true, testID: `${testID}-OptionsScrollView`, children: [_jsxs(SelectOption, { accessible: true, accessibilityRole: "radio", onPress: () => handleOptionPress(requiredOption), children: [_jsx(StyledP, { children: _jsx(Strong, { children: requiredOption.label }) }), _jsx(Radio, { isChecked: selected.value === requiredOption.value, children: _jsx(RadioDot, { isChecked: selected.value === requiredOption.value }) })] }), Object.keys(optionsByCategories).map(category => (_jsxs(Fragment, { children: [category !== 'undefined' ? (_jsx(StyledCategory, { children: category })) : null, optionsByCategories[category].map((option, i) => (_jsxs(SelectOption, { accessible: true, accessibilityRole: "radio", isLastOption: i === optionsByCategories[category].length - 1, onPress: () => handleOptionPress(option), children: [_jsx(StyledP, { children: _jsx(Strong, { children: option.label }) }), _jsx(Radio, { isChecked: selected.value === option.value, children: _jsx(RadioDot, { isChecked: selected.value === option.value }) })] }, option.label)))] }, category)))] }) }) }) })] }));
|
|
65
93
|
};
|
|
66
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
2
|
import { Field } from '../Field';
|
|
25
3
|
import { Select } from './Select';
|
|
26
|
-
export
|
|
27
|
-
var error = _a.error, options = _a.options, onSelected = _a.onSelected, noOptionMessage = _a.noOptionMessage, defaultSelected = _a.defaultSelected, testID = _a.testID, rest = __rest(_a, ["error", "options", "onSelected", "noOptionMessage", "defaultSelected", "testID"]);
|
|
28
|
-
return (_jsx(Field, __assign({ affixWidth: 20, error: error }, rest, { children: _jsx(_Fragment, { children: _jsx(Select, { onSelected: onSelected, options: options, noOptionMessage: noOptionMessage, defaultSelected: defaultSelected, hasError: Boolean(error), testID: testID }) }) })));
|
|
29
|
-
};
|
|
4
|
+
export const SelectField = ({ error, options, onSelected, noOptionMessage, defaultSelected, testID, ...rest }) => (_jsx(Field, { affixWidth: 20, error: error, ...rest, children: _jsx(_Fragment, { children: _jsx(Select, { onSelected: onSelected, options: options, noOptionMessage: noOptionMessage, defaultSelected: defaultSelected, hasError: Boolean(error), testID: testID }) }) }));
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { View, Animated, Platform } from 'react-native';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
useEffect(function () {
|
|
4
|
+
export const SkeletonAnimation = ({ children, animation = 'pulse', testID, }) => {
|
|
5
|
+
const animationRef = useRef(new Animated.Value(0));
|
|
6
|
+
const animationLoop = useRef(undefined);
|
|
7
|
+
useEffect(() => {
|
|
9
8
|
animationLoop.current = Animated.timing(animationRef.current, {
|
|
10
9
|
toValue: 2,
|
|
11
10
|
delay: 400,
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import { numToPx } from '@ovotech/element-core';
|
|
25
3
|
import styled from '../../styled.native';
|
|
26
4
|
import { P } from '../P';
|
|
27
5
|
import { SkeletonAnimation } from '../SkeletonAnimation';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return (_jsx(SkeletonAnimation, { children: _jsx(StyledSkeletonCTA, __assign({ as: P, size: size }, rest)) }));
|
|
35
|
-
};
|
|
6
|
+
const StyledSkeletonCTA = styled.View(({ theme: { core }, size }) => `
|
|
7
|
+
background-color: ${core.color.neutral.light};
|
|
8
|
+
width: ${size};
|
|
9
|
+
height: ${numToPx(core.space[12])};
|
|
10
|
+
`);
|
|
11
|
+
export const SkeletonCTA = ({ size = '250px', ...rest }) => (_jsx(SkeletonAnimation, { children: _jsx(StyledSkeletonCTA, { as: P, size: size, ...rest }) }));
|
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import { pxToNumber } from '@ovotech/element-core';
|
|
25
3
|
import styled from '../../styled.native';
|
|
26
4
|
import { SkeletonAnimation } from '../SkeletonAnimation';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
export var SkeletonCircle = function (_a) {
|
|
36
|
-
var _b = _a.size, size = _b === void 0 ? '120px' : _b, rest = __rest(_a, ["size"]);
|
|
37
|
-
return (_jsx(SkeletonAnimation, { children: _jsx(StyledSkeletonCircleWrapper, __assign({ size: size }, rest, { children: _jsx(StyledSkeletonCircle, { size: size }) })) }));
|
|
38
|
-
};
|
|
5
|
+
const StyledSkeletonCircleWrapper = styled.View(({ size }) => `width: ${size}; max-width: 100%;`);
|
|
6
|
+
const StyledSkeletonCircle = styled.View(({ theme: { core }, size }) => `
|
|
7
|
+
background-color: ${core.color.neutral.light};
|
|
8
|
+
height: 0;
|
|
9
|
+
padding-bottom: 100%;
|
|
10
|
+
border-radius: ${pxToNumber(size) / 2}px;
|
|
11
|
+
`);
|
|
12
|
+
export const SkeletonCircle = ({ size = '120px', ...rest }) => (_jsx(SkeletonAnimation, { children: _jsx(StyledSkeletonCircleWrapper, { size: size, ...rest, children: _jsx(StyledSkeletonCircle, { size: size }) }) }));
|
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import styled from '../../styled.native';
|
|
25
3
|
import { Heading3 } from '../Heading3';
|
|
26
4
|
import { SkeletonAnimation } from '../SkeletonAnimation';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export
|
|
32
|
-
var _b = _a.size, size = _b === void 0 ? '70%' : _b, _c = _a.headingComponent, Heading = _c === void 0 ? Heading3 : _c, rest = __rest(_a, ["size", "headingComponent"]);
|
|
33
|
-
return (_jsx(SkeletonAnimation, { children: _jsx(StyledSkeletonHeading, __assign({ "aria-hidden": "true", size: size, as: Heading }, rest, { children: "\u00A0" })) }));
|
|
34
|
-
};
|
|
5
|
+
const StyledSkeletonHeading = styled.View(({ theme: { core }, size }) => `
|
|
6
|
+
background-color: ${core.color.neutral.light};
|
|
7
|
+
width: ${size};
|
|
8
|
+
`);
|
|
9
|
+
export const SkeletonHeading = ({ size = '70%', headingComponent: Heading = Heading3, ...rest }) => (_jsx(SkeletonAnimation, { children: _jsx(StyledSkeletonHeading, { "aria-hidden": "true", size: size, as: Heading, ...rest, children: "\u00A0" }) }));
|
|
@@ -1,45 +1,27 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import { numToPx } from '@ovotech/element-core';
|
|
25
3
|
import { useBreakpoint } from '../../hooks';
|
|
26
4
|
import styled from '../../styled.native';
|
|
27
5
|
import { P } from '../P';
|
|
28
6
|
import { SkeletonAnimation } from '../SkeletonAnimation';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
const StyledSkeletonText = styled.View(({ theme: { core }, aboveSmallBreakpoint, short }) => {
|
|
8
|
+
return `
|
|
9
|
+
background-color: ${core.color.neutral.light};
|
|
10
|
+
margin-bottom: ${numToPx(core.space[2])};
|
|
11
|
+
height: ${aboveSmallBreakpoint
|
|
32
12
|
? numToPx(core.fontSize.body.large)
|
|
33
|
-
: numToPx(core.fontSize.body.small)
|
|
13
|
+
: numToPx(core.fontSize.body.small)};
|
|
14
|
+
|
|
15
|
+
${short ? 'width: 50%' : ''};
|
|
16
|
+
`;
|
|
34
17
|
});
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
generatedLines.push(_jsx(StyledSkeletonText, { short: i === lines, aboveSmallBreakpoint: smallAndUp }, "line-".concat(i)));
|
|
18
|
+
export const SkeletonText = ({ lines = 1, ...rest }) => {
|
|
19
|
+
const generatedLines = [];
|
|
20
|
+
const { smallAndUp } = useBreakpoint();
|
|
21
|
+
for (let i = 1; i <= lines; i++) {
|
|
22
|
+
generatedLines.push(_jsx(StyledSkeletonText, { short: i === lines, aboveSmallBreakpoint: smallAndUp }, `line-${i}`));
|
|
41
23
|
}
|
|
42
24
|
return (
|
|
43
25
|
// @ts-ignore styled components stuff
|
|
44
|
-
_jsx(P,
|
|
26
|
+
_jsx(P, { as: SkeletonAnimation, ...rest, children: generatedLines }));
|
|
45
27
|
};
|