@ledgerhq/lumen-ui-rnative 0.1.64 → 0.1.66
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/module/index.js +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/Components/core/AddressInput/AddressInput.js +1 -1
- package/dist/module/lib/Components/core/AddressInput/AddressInput.js.map +1 -1
- package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.js +1 -1
- package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.js.map +1 -1
- package/dist/module/lib/Components/core/AmountInput/AmountInput.js +1 -1
- package/dist/module/lib/Components/core/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/core/Avatar/Avatar.js +1 -1
- package/dist/module/lib/Components/core/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/core/Banner/Banner.js +1 -1
- package/dist/module/lib/Components/core/Banner/Banner.js.map +1 -1
- package/dist/module/lib/Components/core/BottomSheet/BottomSheetHeader.js +1 -1
- package/dist/module/lib/Components/core/BottomSheet/BottomSheetHeader.js.map +1 -1
- package/dist/module/lib/Components/core/CardButton/CardButton.js +2 -0
- package/dist/module/lib/Components/core/CardButton/CardButton.js.map +1 -1
- package/dist/module/lib/Components/core/CardButton/CardButton.mdx +4 -0
- package/dist/module/lib/Components/core/CardButton/CardButton.stories.js +1 -0
- package/dist/module/lib/Components/core/CardButton/CardButton.stories.js.map +1 -1
- package/dist/module/lib/Components/core/ContentBanner/ContentBanner.js +1 -1
- package/dist/module/lib/Components/core/ContentBanner/ContentBanner.js.map +1 -1
- package/dist/module/lib/Components/core/Link/Link.figma.js +2 -1
- package/dist/module/lib/Components/core/Link/Link.figma.js.map +1 -1
- package/dist/module/lib/Components/core/Link/Link.js +5 -3
- package/dist/module/lib/Components/core/Link/Link.js.map +1 -1
- package/dist/module/lib/Components/core/Link/Link.mdx +3 -2
- package/dist/module/lib/Components/core/Link/Link.stories.js +4 -1
- package/dist/module/lib/Components/core/Link/Link.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Link/Link.test.js +2 -2
- package/dist/module/lib/Components/core/Link/Link.test.js.map +1 -1
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.js +1 -1
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.js.map +1 -1
- package/dist/module/lib/Components/core/MediaCard/MediaCard.js +1 -1
- package/dist/module/lib/Components/core/MediaCard/MediaCard.js.map +1 -1
- package/dist/module/lib/Components/core/NavBar/NavBar.js +1 -1
- package/dist/module/lib/Components/core/NavBar/NavBar.js.map +1 -1
- package/dist/module/lib/Components/core/Spinner/Spinner.js +1 -1
- package/dist/module/lib/Components/core/Spinner/Spinner.js.map +1 -1
- package/dist/module/lib/Components/core/Stepper/Stepper.js +77 -31
- package/dist/module/lib/Components/core/Stepper/Stepper.js.map +1 -1
- package/dist/module/lib/Components/core/Stepper/Stepper.mdx +37 -16
- package/dist/module/lib/Components/core/Stepper/Stepper.stories.js +102 -2
- package/dist/module/lib/Components/core/Stepper/Stepper.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Stepper/Stepper.test.js +32 -1
- package/dist/module/lib/Components/core/Stepper/Stepper.test.js.map +1 -1
- package/dist/module/lib/Components/core/Subheader/Subheader.js +5 -1
- package/dist/module/lib/Components/core/Subheader/Subheader.js.map +1 -1
- package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.js +2 -2
- package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.test.js +9 -0
- package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.test.js.map +1 -1
- package/dist/module/lib/Components/core/Timeline/Timeline.figma.js +83 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.figma.js.map +1 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.js +464 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.js.map +1 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.mdx +49 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.stories.js +289 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.stories.js.map +1 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.test.js +234 -0
- package/dist/module/lib/Components/core/Timeline/Timeline.test.js.map +1 -0
- package/dist/module/lib/Components/core/Timeline/index.js +5 -0
- package/dist/module/lib/Components/core/Timeline/index.js.map +1 -0
- package/dist/module/lib/Components/core/Timeline/types.js +4 -0
- package/dist/module/lib/Components/core/Timeline/types.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/Toast.figma.js +39 -0
- package/dist/module/lib/Components/core/Toast/Toast.figma.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/Toast.js +138 -0
- package/dist/module/lib/Components/core/Toast/Toast.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/Toast.mdx +203 -0
- package/dist/module/lib/Components/core/Toast/Toast.stories.js +238 -0
- package/dist/module/lib/Components/core/Toast/Toast.stories.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/Toast.test.js +203 -0
- package/dist/module/lib/Components/core/Toast/Toast.test.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/Toaster.js +147 -0
- package/dist/module/lib/Components/core/Toast/Toaster.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/Toaster.test.js +732 -0
- package/dist/module/lib/Components/core/Toast/Toaster.test.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastAccessibility.js +70 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastAccessibility.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastCollapse.js +33 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastCollapse.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastGesture.js +224 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastGesture.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastMotion.js +82 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastMotion.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastViewportStyles.js +21 -0
- package/dist/module/lib/Components/core/Toast/hooks/useToastViewportStyles.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/index.js +7 -0
- package/dist/module/lib/Components/core/Toast/index.js.map +1 -0
- package/dist/module/lib/Components/core/Toast/types.js +4 -0
- package/dist/module/lib/Components/core/Toast/types.js.map +1 -0
- package/dist/module/lib/Components/core/Trend/Trend.js +1 -1
- package/dist/module/lib/Components/core/Trend/Trend.js.map +1 -1
- package/dist/module/lib/Components/core/index.js +2 -0
- package/dist/module/lib/Components/core/index.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseInput/BaseInput.js +1 -1
- package/dist/module/lib/Components/internal/BaseInput/BaseInput.js.map +1 -1
- package/dist/module/lib/Components/visualization/CartesianChart/CartesianChart.js +6 -2
- package/dist/module/lib/Components/visualization/CartesianChart/CartesianChart.js.map +1 -1
- package/dist/module/lib/Components/visualization/DonutChart/DonutChart.js +8 -4
- package/dist/module/lib/Components/visualization/DonutChart/DonutChart.js.map +1 -1
- package/dist/module/lib/Components/visualization/DonutChart/DonutChart.test.js +1 -1
- package/dist/module/lib/Components/visualization/DonutChart/DonutChart.test.js.map +1 -1
- package/dist/module/lib/Components/visualization/DonutChart/DonutRing.js +12 -3
- package/dist/module/lib/Components/visualization/DonutChart/DonutRing.js.map +1 -1
- package/dist/module/lib/Components/visualization/Legend/Legend.js +1 -1
- package/dist/module/lib/Components/visualization/Legend/Legend.js.map +1 -1
- package/dist/module/lib/Components/visualization/Legend/Legend.test.js +12 -8
- package/dist/module/lib/Components/visualization/Legend/Legend.test.js.map +1 -1
- package/dist/module/lib/Components/visualization/LineChart/LineChart.js +8 -2
- package/dist/module/lib/Components/visualization/LineChart/LineChart.js.map +1 -1
- package/dist/module/lib/Components/visualization/LineChart/utils.js +3 -2
- package/dist/module/lib/Components/visualization/LineChart/utils.js.map +1 -1
- package/dist/module/lib/Components/visualization/LineChart/utils.test.js +8 -4
- package/dist/module/lib/Components/visualization/LineChart/utils.test.js.map +1 -1
- package/dist/module/lib/Components/visualization/config.js +1 -4
- package/dist/module/lib/Components/visualization/config.js.map +1 -1
- package/dist/module/translations/index.js +5 -0
- package/dist/module/translations/index.js.map +1 -0
- package/dist/module/{i18n → translations}/languages.js +0 -6
- package/dist/module/translations/languages.js.map +1 -0
- package/dist/module/{i18n → translations}/locales/de.json +0 -3
- package/{src/i18n → dist/module/translations}/locales/en.json +9 -3
- package/{src/i18n → dist/module/translations}/locales/es.json +0 -3
- package/dist/module/{i18n → translations}/locales/fr.json +0 -3
- package/{src/i18n → dist/module/translations}/locales/ja.json +0 -3
- package/dist/module/{i18n → translations}/locales/ko.json +0 -3
- package/dist/module/{i18n → translations}/locales/pt.json +0 -3
- package/dist/module/{i18n → translations}/locales/ru.json +0 -3
- package/dist/module/{i18n → translations}/locales/th.json +0 -3
- package/dist/module/{i18n → translations}/locales/tr.json +0 -3
- package/{src/i18n → dist/module/translations}/locales/zh.json +0 -3
- package/dist/module/translations/translations.js +36 -0
- package/dist/module/translations/translations.js.map +1 -0
- package/dist/module/translations/translations.test.js +34 -0
- package/dist/module/translations/translations.test.js.map +1 -0
- package/dist/typescript/src/index.d.ts +1 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/CardButton/CardButton.d.ts +2 -0
- package/dist/typescript/src/lib/Components/core/CardButton/CardButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Link/Link.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/Link/Link.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Link/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/Link/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Stepper/Stepper.d.ts +4 -3
- package/dist/typescript/src/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Stepper/types.d.ts +12 -2
- package/dist/typescript/src/lib/Components/core/Stepper/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Subheader/Subheader.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/ThemeProvider/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/ThemeProvider/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts +56 -0
- package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Timeline/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/core/Timeline/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Timeline/types.d.ts +109 -0
- package/dist/typescript/src/lib/Components/core/Timeline/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/Toast.d.ts +24 -0
- package/dist/typescript/src/lib/Components/core/Toast/Toast.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/Toaster.d.ts +35 -0
- package/dist/typescript/src/lib/Components/core/Toast/Toaster.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastAccessibility.d.ts +17 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastAccessibility.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastCollapse.d.ts +19 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastCollapse.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastGesture.d.ts +14 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastGesture.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastMotion.d.ts +15 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastMotion.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastViewportStyles.d.ts +21 -0
- package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastViewportStyles.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/index.d.ts +5 -0
- package/dist/typescript/src/lib/Components/core/Toast/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/Toast/types.d.ts +75 -0
- package/dist/typescript/src/lib/Components/core/Toast/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/core/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/visualization/CartesianChart/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/visualization/DonutChart/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/visualization/Legend/Legend.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/visualization/Legend/types.d.ts +2 -2
- package/dist/typescript/src/lib/Components/visualization/LineChart/LineChart.d.ts +1 -1
- package/dist/typescript/src/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/visualization/LineChart/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/visualization/LineChart/utils.d.ts +2 -1
- package/dist/typescript/src/lib/Components/visualization/LineChart/utils.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/visualization/config.d.ts +0 -3
- package/dist/typescript/src/lib/Components/visualization/config.d.ts.map +1 -1
- package/dist/typescript/src/translations/index.d.ts +3 -0
- package/dist/typescript/src/translations/index.d.ts.map +1 -0
- package/dist/typescript/src/{i18n → translations}/languages.d.ts +0 -5
- package/dist/typescript/src/translations/languages.d.ts.map +1 -0
- package/dist/typescript/src/translations/translations.d.ts +421 -0
- package/dist/typescript/src/translations/translations.d.ts.map +1 -0
- package/package.json +4 -6
- package/src/index.ts +1 -1
- package/src/lib/Components/core/AddressInput/AddressInput.tsx +1 -1
- package/src/lib/Components/core/AmountDisplay/AmountDisplay.tsx +1 -1
- package/src/lib/Components/core/AmountInput/AmountInput.tsx +1 -1
- package/src/lib/Components/core/Avatar/Avatar.tsx +1 -1
- package/src/lib/Components/core/Banner/Banner.tsx +1 -1
- package/src/lib/Components/core/BottomSheet/BottomSheetHeader.tsx +1 -1
- package/src/lib/Components/core/CardButton/CardButton.mdx +4 -0
- package/src/lib/Components/core/CardButton/CardButton.stories.tsx +1 -0
- package/src/lib/Components/core/CardButton/CardButton.tsx +2 -0
- package/src/lib/Components/core/ContentBanner/ContentBanner.tsx +1 -1
- package/src/lib/Components/core/Link/Link.figma.tsx +1 -0
- package/src/lib/Components/core/Link/Link.mdx +3 -2
- package/src/lib/Components/core/Link/Link.stories.tsx +3 -2
- package/src/lib/Components/core/Link/Link.test.tsx +2 -0
- package/src/lib/Components/core/Link/Link.tsx +3 -1
- package/src/lib/Components/core/Link/types.ts +1 -1
- package/src/lib/Components/core/MediaBanner/MediaBanner.tsx +1 -1
- package/src/lib/Components/core/MediaCard/MediaCard.tsx +1 -1
- package/src/lib/Components/core/NavBar/NavBar.tsx +1 -1
- package/src/lib/Components/core/Spinner/Spinner.tsx +1 -1
- package/src/lib/Components/core/Stepper/Stepper.mdx +37 -16
- package/src/lib/Components/core/Stepper/Stepper.stories.tsx +50 -2
- package/src/lib/Components/core/Stepper/Stepper.test.tsx +29 -1
- package/src/lib/Components/core/Stepper/Stepper.tsx +74 -33
- package/src/lib/Components/core/Stepper/types.ts +12 -2
- package/src/lib/Components/core/Subheader/Subheader.tsx +3 -1
- package/src/lib/Components/core/ThemeProvider/ThemeProvider.test.tsx +11 -0
- package/src/lib/Components/core/ThemeProvider/ThemeProvider.tsx +3 -3
- package/src/lib/Components/core/ThemeProvider/types.ts +1 -1
- package/src/lib/Components/core/Timeline/Timeline.figma.tsx +79 -0
- package/src/lib/Components/core/Timeline/Timeline.mdx +49 -0
- package/src/lib/Components/core/Timeline/Timeline.stories.tsx +250 -0
- package/src/lib/Components/core/Timeline/Timeline.test.tsx +275 -0
- package/src/lib/Components/core/Timeline/Timeline.tsx +576 -0
- package/src/lib/Components/core/Timeline/index.ts +2 -0
- package/src/lib/Components/core/Timeline/types.ts +124 -0
- package/src/lib/Components/core/Toast/Toast.figma.tsx +36 -0
- package/src/lib/Components/core/Toast/Toast.mdx +203 -0
- package/src/lib/Components/core/Toast/Toast.stories.tsx +260 -0
- package/src/lib/Components/core/Toast/Toast.test.tsx +181 -0
- package/src/lib/Components/core/Toast/Toast.tsx +163 -0
- package/src/lib/Components/core/Toast/Toaster.test.tsx +687 -0
- package/src/lib/Components/core/Toast/Toaster.tsx +157 -0
- package/src/lib/Components/core/Toast/hooks/useToastAccessibility.ts +82 -0
- package/src/lib/Components/core/Toast/hooks/useToastCollapse.ts +38 -0
- package/src/lib/Components/core/Toast/hooks/useToastGesture.ts +83 -0
- package/src/lib/Components/core/Toast/hooks/useToastMotion.ts +71 -0
- package/src/lib/Components/core/Toast/hooks/useToastViewportStyles.ts +45 -0
- package/src/lib/Components/core/Toast/index.ts +4 -0
- package/src/lib/Components/core/Toast/types.ts +94 -0
- package/src/lib/Components/core/Trend/Trend.tsx +1 -1
- package/src/lib/Components/core/index.ts +2 -0
- package/src/lib/Components/internal/BaseInput/BaseInput.tsx +1 -1
- package/src/lib/Components/visualization/CartesianChart/CartesianChart.tsx +4 -2
- package/src/lib/Components/visualization/CartesianChart/types.ts +1 -1
- package/src/lib/Components/visualization/DonutChart/DonutChart.test.tsx +1 -3
- package/src/lib/Components/visualization/DonutChart/DonutChart.tsx +7 -3
- package/src/lib/Components/visualization/DonutChart/DonutRing.tsx +11 -1
- package/src/lib/Components/visualization/DonutChart/types.ts +1 -1
- package/src/lib/Components/visualization/Legend/Legend.test.tsx +9 -8
- package/src/lib/Components/visualization/Legend/Legend.tsx +1 -1
- package/src/lib/Components/visualization/Legend/types.ts +2 -2
- package/src/lib/Components/visualization/LineChart/LineChart.tsx +10 -2
- package/src/lib/Components/visualization/LineChart/types.ts +1 -1
- package/src/lib/Components/visualization/LineChart/utils.test.ts +4 -0
- package/src/lib/Components/visualization/LineChart/utils.ts +6 -2
- package/src/lib/Components/visualization/config.ts +0 -3
- package/src/translations/index.ts +2 -0
- package/src/{i18n → translations}/languages.ts +0 -6
- package/src/{i18n → translations}/locales/de.json +0 -3
- package/{dist/module/i18n → src/translations}/locales/en.json +9 -3
- package/{dist/module/i18n → src/translations}/locales/es.json +0 -3
- package/src/{i18n → translations}/locales/fr.json +0 -3
- package/{dist/module/i18n → src/translations}/locales/ja.json +0 -3
- package/src/{i18n → translations}/locales/ko.json +0 -3
- package/src/{i18n → translations}/locales/pt.json +0 -3
- package/src/{i18n → translations}/locales/ru.json +0 -3
- package/src/{i18n → translations}/locales/th.json +0 -3
- package/src/{i18n → translations}/locales/tr.json +0 -3
- package/{dist/module/i18n → src/translations}/locales/zh.json +0 -3
- package/src/translations/translations.test.ts +56 -0
- package/src/translations/translations.ts +21 -0
- package/dist/module/i18n/I18nProvider.js +0 -20
- package/dist/module/i18n/I18nProvider.js.map +0 -1
- package/dist/module/i18n/i18n.js +0 -82
- package/dist/module/i18n/i18n.js.map +0 -1
- package/dist/module/i18n/index.js +0 -6
- package/dist/module/i18n/index.js.map +0 -1
- package/dist/module/i18n/languages.js.map +0 -1
- package/dist/module/i18n/useCommonTranslation.js +0 -8
- package/dist/module/i18n/useCommonTranslation.js.map +0 -1
- package/dist/typescript/src/i18n/I18nProvider.d.ts +0 -8
- package/dist/typescript/src/i18n/I18nProvider.d.ts.map +0 -1
- package/dist/typescript/src/i18n/i18n.d.ts +0 -13
- package/dist/typescript/src/i18n/i18n.d.ts.map +0 -1
- package/dist/typescript/src/i18n/index.d.ts +0 -4
- package/dist/typescript/src/i18n/index.d.ts.map +0 -1
- package/dist/typescript/src/i18n/languages.d.ts.map +0 -1
- package/dist/typescript/src/i18n/useCommonTranslation.d.ts +0 -2
- package/dist/typescript/src/i18n/useCommonTranslation.d.ts.map +0 -1
- package/src/i18n/I18nProvider.tsx +0 -20
- package/src/i18n/i18n.ts +0 -107
- package/src/i18n/index.ts +0 -3
- package/src/i18n/useCommonTranslation.ts +0 -6
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveDurationMs,
|
|
3
|
+
resolveMaxItems,
|
|
4
|
+
toastStore,
|
|
5
|
+
useToastBacklog,
|
|
6
|
+
useToastLifecycle,
|
|
7
|
+
} from '@ledgerhq/lumen-utils-shared';
|
|
8
|
+
import { useEffect, useState, useSyncExternalStore } from 'react';
|
|
9
|
+
import { View } from 'react-native';
|
|
10
|
+
import { GestureDetector } from 'react-native-gesture-handler';
|
|
11
|
+
import Animated from 'react-native-reanimated';
|
|
12
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
13
|
+
import { useToastAccessibility } from './hooks/useToastAccessibility';
|
|
14
|
+
import { useToastCollapse } from './hooks/useToastCollapse';
|
|
15
|
+
import { useToastGesture } from './hooks/useToastGesture';
|
|
16
|
+
import { useToastMotion } from './hooks/useToastMotion';
|
|
17
|
+
import { useToastViewportStyles } from './hooks/useToastViewportStyles';
|
|
18
|
+
import { Toast } from './Toast';
|
|
19
|
+
import type { ToasterProps, ToastItem, ToastPosition } from './types';
|
|
20
|
+
|
|
21
|
+
const ToastQueueItem = ({
|
|
22
|
+
item,
|
|
23
|
+
durationMs,
|
|
24
|
+
queued,
|
|
25
|
+
position,
|
|
26
|
+
onDismiss,
|
|
27
|
+
}: {
|
|
28
|
+
item: ToastItem;
|
|
29
|
+
durationMs: number;
|
|
30
|
+
queued: boolean;
|
|
31
|
+
position: ToastPosition;
|
|
32
|
+
onDismiss: () => void;
|
|
33
|
+
}) => {
|
|
34
|
+
const exiting = item.exiting ?? false;
|
|
35
|
+
const [held, setHeld] = useState(false);
|
|
36
|
+
|
|
37
|
+
useToastLifecycle({ durationMs, paused: held, exiting, onDismiss });
|
|
38
|
+
const { animatedStyle, translateX, markDismissedViaSwipe } = useToastMotion({
|
|
39
|
+
position,
|
|
40
|
+
queued,
|
|
41
|
+
exiting,
|
|
42
|
+
});
|
|
43
|
+
const { gesture } = useToastGesture({
|
|
44
|
+
dismissible: item.dismissible,
|
|
45
|
+
translateX,
|
|
46
|
+
onHoldChange: setHeld,
|
|
47
|
+
onSwipeDismiss: () => {
|
|
48
|
+
markDismissedViaSwipe();
|
|
49
|
+
onDismiss();
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const { collapseStyle, handleLayout } = useToastCollapse({
|
|
53
|
+
position,
|
|
54
|
+
exiting,
|
|
55
|
+
});
|
|
56
|
+
const accessibilityProps = useToastAccessibility({
|
|
57
|
+
item,
|
|
58
|
+
exiting,
|
|
59
|
+
onDismiss,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Animated.View testID='toast-collapse' style={collapseStyle}>
|
|
64
|
+
<GestureDetector gesture={gesture}>
|
|
65
|
+
<Animated.View
|
|
66
|
+
testID='toast-entry'
|
|
67
|
+
style={animatedStyle}
|
|
68
|
+
onLayout={handleLayout}
|
|
69
|
+
{...accessibilityProps}
|
|
70
|
+
>
|
|
71
|
+
<Toast
|
|
72
|
+
appearance={item.appearance}
|
|
73
|
+
loading={item.loading}
|
|
74
|
+
title={item.title}
|
|
75
|
+
action={item.action}
|
|
76
|
+
/>
|
|
77
|
+
</Animated.View>
|
|
78
|
+
</GestureDetector>
|
|
79
|
+
</Animated.View>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Subscribes to the module-level toast store and renders the queue viewport
|
|
85
|
+
* as an absolutely-positioned overlay. Mount it once, near the app root — it
|
|
86
|
+
* takes no children. `toast.*` from `@ledgerhq/lumen-utils-shared` works even
|
|
87
|
+
* before this mounts, or from outside the React tree entirely.
|
|
88
|
+
*
|
|
89
|
+
* Mount exactly one `<Toaster />` for the whole app. Every instance renders
|
|
90
|
+
* the full queue, so a second one duplicates every toast on screen — mounting
|
|
91
|
+
* more than one logs a console warning in development.
|
|
92
|
+
*
|
|
93
|
+
* Toasts are dismissed by swiping left or right; there is no close icon.
|
|
94
|
+
* Screen-reader users get the dismissal and the inline action as accessibility
|
|
95
|
+
* actions instead, and each toast is announced when it appears or changes.
|
|
96
|
+
* Touching a toast — a hold or an in-progress swipe — pauses its auto-dismiss
|
|
97
|
+
* timer until the finger is released.
|
|
98
|
+
* Requires `react-native-gesture-handler`'s `GestureHandlerRootView` at the
|
|
99
|
+
* app root.
|
|
100
|
+
*
|
|
101
|
+
* @see {@link https://ldls-react-native.vercel.app/?path=/docs/rnative-toast--docs Guidelines}
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* import { Toaster } from '@ledgerhq/lumen-ui-rnative';
|
|
105
|
+
*
|
|
106
|
+
* function App() {
|
|
107
|
+
* return (
|
|
108
|
+
* <>
|
|
109
|
+
* <Toaster position="bottom" maxItems={1} />
|
|
110
|
+
* <Screens />
|
|
111
|
+
* </>
|
|
112
|
+
* );
|
|
113
|
+
* }
|
|
114
|
+
*/
|
|
115
|
+
export const Toaster = ({
|
|
116
|
+
maxItems = 1,
|
|
117
|
+
position = 'bottom',
|
|
118
|
+
insets = {},
|
|
119
|
+
durations,
|
|
120
|
+
}: ToasterProps) => {
|
|
121
|
+
const items = useSyncExternalStore(
|
|
122
|
+
toastStore.subscribe,
|
|
123
|
+
toastStore.getSnapshot,
|
|
124
|
+
);
|
|
125
|
+
const safeAreaInsets = useSafeAreaInsets();
|
|
126
|
+
const viewportStyles = useToastViewportStyles({
|
|
127
|
+
position,
|
|
128
|
+
safeAreaTop: safeAreaInsets.top,
|
|
129
|
+
safeAreaBottom: safeAreaInsets.bottom,
|
|
130
|
+
insets,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
useEffect(() => toastStore.registerRenderer(), []);
|
|
134
|
+
|
|
135
|
+
const visibleSlots = resolveMaxItems(maxItems);
|
|
136
|
+
const visibleItems = items.slice(0, visibleSlots);
|
|
137
|
+
const isQueued = useToastBacklog(items, visibleSlots);
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<View
|
|
141
|
+
testID='toast-viewport'
|
|
142
|
+
pointerEvents='box-none'
|
|
143
|
+
style={viewportStyles.root}
|
|
144
|
+
>
|
|
145
|
+
{visibleItems.map((item) => (
|
|
146
|
+
<ToastQueueItem
|
|
147
|
+
key={item.id}
|
|
148
|
+
item={item}
|
|
149
|
+
durationMs={resolveDurationMs(item, durations)}
|
|
150
|
+
queued={isQueued(item.id)}
|
|
151
|
+
position={position}
|
|
152
|
+
onDismiss={() => toastStore.dismiss(item.id)}
|
|
153
|
+
/>
|
|
154
|
+
))}
|
|
155
|
+
</View>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AccessibilityInfo,
|
|
4
|
+
Platform,
|
|
5
|
+
type AccessibilityActionEvent,
|
|
6
|
+
type AccessibilityActionInfo,
|
|
7
|
+
type ViewProps,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { useCommonTranslation } from '../../../../../translations';
|
|
10
|
+
import type { ToastItem } from '../types';
|
|
11
|
+
|
|
12
|
+
type UseToastAccessibilityArgs = {
|
|
13
|
+
item: ToastItem;
|
|
14
|
+
exiting: boolean;
|
|
15
|
+
onDismiss: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ToastAccessibilityProps = Pick<
|
|
19
|
+
ViewProps,
|
|
20
|
+
| 'accessible'
|
|
21
|
+
| 'accessibilityLabel'
|
|
22
|
+
| 'accessibilityState'
|
|
23
|
+
| 'accessibilityActions'
|
|
24
|
+
| 'onAccessibilityAction'
|
|
25
|
+
| 'onAccessibilityEscape'
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
const DISMISS_ACTION = 'dismiss';
|
|
29
|
+
const TOAST_ACTION = 'toastAction';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Screen readers capture swipes for their own navigation, so the swipe-to-dismiss
|
|
33
|
+
* gesture is unreachable for them. The toast is exposed as a single element
|
|
34
|
+
* whose dismissal and inline action are custom accessibility actions instead
|
|
35
|
+
* (VoiceOver rotor, TalkBack actions menu, iOS two-finger scrub to escape).
|
|
36
|
+
*/
|
|
37
|
+
export const useToastAccessibility = ({
|
|
38
|
+
item,
|
|
39
|
+
exiting,
|
|
40
|
+
onDismiss,
|
|
41
|
+
}: UseToastAccessibilityArgs): ToastAccessibilityProps => {
|
|
42
|
+
const { t } = useCommonTranslation();
|
|
43
|
+
const { title, appearance, loading, dismissible, action } = item;
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (Platform.OS !== 'ios' || exiting) return;
|
|
47
|
+
AccessibilityInfo.announceForAccessibilityWithOptions(title, {
|
|
48
|
+
queue: appearance !== 'warning' && appearance !== 'error',
|
|
49
|
+
});
|
|
50
|
+
}, [title, appearance, exiting]);
|
|
51
|
+
|
|
52
|
+
const accessibilityActions: AccessibilityActionInfo[] = [];
|
|
53
|
+
if (action) {
|
|
54
|
+
accessibilityActions.push({ name: TOAST_ACTION, label: action.label });
|
|
55
|
+
}
|
|
56
|
+
if (dismissible) {
|
|
57
|
+
accessibilityActions.push({
|
|
58
|
+
name: DISMISS_ACTION,
|
|
59
|
+
label: t('common.closeAriaLabel'),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const handleAccessibilityAction = (event: AccessibilityActionEvent): void => {
|
|
64
|
+
switch (event.nativeEvent.actionName) {
|
|
65
|
+
case TOAST_ACTION:
|
|
66
|
+
action?.onAction();
|
|
67
|
+
break;
|
|
68
|
+
case DISMISS_ACTION:
|
|
69
|
+
onDismiss();
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
accessible: true,
|
|
76
|
+
accessibilityLabel: title,
|
|
77
|
+
accessibilityState: { busy: loading },
|
|
78
|
+
accessibilityActions,
|
|
79
|
+
onAccessibilityAction: handleAccessibilityAction,
|
|
80
|
+
onAccessibilityEscape: dismissible ? onDismiss : undefined,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EXIT_ANIMATION_MS } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import type { LayoutChangeEvent } from 'react-native';
|
|
4
|
+
import { useTheme } from '../../../../../styles';
|
|
5
|
+
import type { ToastPosition } from '../types';
|
|
6
|
+
|
|
7
|
+
type UseToastCollapseArgs = {
|
|
8
|
+
position: ToastPosition;
|
|
9
|
+
exiting: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const useToastCollapse = ({
|
|
13
|
+
position,
|
|
14
|
+
exiting,
|
|
15
|
+
}: UseToastCollapseArgs) => {
|
|
16
|
+
const { theme } = useTheme();
|
|
17
|
+
const [measuredHeight, setMeasuredHeight] = useState<number>();
|
|
18
|
+
const handleLayout = useCallback((event: LayoutChangeEvent) => {
|
|
19
|
+
setMeasuredHeight(event.nativeEvent.layout.height);
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
const collapseStyle = useMemo(() => {
|
|
23
|
+
const fullHeight =
|
|
24
|
+
measuredHeight === undefined
|
|
25
|
+
? undefined
|
|
26
|
+
: measuredHeight + theme.spacings.s8;
|
|
27
|
+
return {
|
|
28
|
+
width: '100%',
|
|
29
|
+
justifyContent: position === 'top' ? 'flex-start' : 'flex-end',
|
|
30
|
+
height: exiting ? 0 : fullHeight,
|
|
31
|
+
transitionProperty: 'height',
|
|
32
|
+
transitionDuration: EXIT_ANIMATION_MS,
|
|
33
|
+
transitionTimingFunction: 'ease-out',
|
|
34
|
+
} as const;
|
|
35
|
+
}, [exiting, measuredHeight, position, theme.spacings.s8]);
|
|
36
|
+
|
|
37
|
+
return { collapseStyle, handleLayout };
|
|
38
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { useWindowDimensions } from 'react-native';
|
|
3
|
+
import { Gesture, type PanGesture } from 'react-native-gesture-handler';
|
|
4
|
+
import { withTiming, type SharedValue } from 'react-native-reanimated';
|
|
5
|
+
import { scheduleOnRN } from 'react-native-worklets';
|
|
6
|
+
|
|
7
|
+
const SWIPE_DISMISS_THRESHOLD_PX = 80;
|
|
8
|
+
|
|
9
|
+
type UseToastGestureArgs = {
|
|
10
|
+
dismissible: boolean;
|
|
11
|
+
translateX: SharedValue<number>;
|
|
12
|
+
onHoldChange: (held: boolean) => void;
|
|
13
|
+
onSwipeDismiss: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type UseToastGestureReturn = {
|
|
17
|
+
gesture: PanGesture;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const useToastGesture = ({
|
|
21
|
+
dismissible,
|
|
22
|
+
translateX,
|
|
23
|
+
onHoldChange,
|
|
24
|
+
onSwipeDismiss,
|
|
25
|
+
}: UseToastGestureArgs): UseToastGestureReturn => {
|
|
26
|
+
const { width: windowWidth } = useWindowDimensions();
|
|
27
|
+
|
|
28
|
+
const onSwipeDismissRef = useRef(onSwipeDismiss);
|
|
29
|
+
onSwipeDismissRef.current = onSwipeDismiss;
|
|
30
|
+
const handleSwipeDismissRef = useRef(() => {
|
|
31
|
+
onSwipeDismissRef.current();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const onHoldChangeRef = useRef(onHoldChange);
|
|
35
|
+
onHoldChangeRef.current = onHoldChange;
|
|
36
|
+
const handleHoldStartRef = useRef(() => {
|
|
37
|
+
onHoldChangeRef.current(true);
|
|
38
|
+
});
|
|
39
|
+
const handleHoldEndRef = useRef(() => {
|
|
40
|
+
onHoldChangeRef.current(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const pan = Gesture.Pan()
|
|
44
|
+
.activeOffsetX([-10, 10])
|
|
45
|
+
.failOffsetY([-10, 10])
|
|
46
|
+
.cancelsTouchesInView(false)
|
|
47
|
+
.onTouchesDown(() => {
|
|
48
|
+
'worklet';
|
|
49
|
+
scheduleOnRN(handleHoldStartRef.current);
|
|
50
|
+
})
|
|
51
|
+
.onTouchesUp((e) => {
|
|
52
|
+
'worklet';
|
|
53
|
+
if (e.numberOfTouches === 0) scheduleOnRN(handleHoldEndRef.current);
|
|
54
|
+
})
|
|
55
|
+
.onTouchesCancelled(() => {
|
|
56
|
+
'worklet';
|
|
57
|
+
scheduleOnRN(handleHoldEndRef.current);
|
|
58
|
+
})
|
|
59
|
+
.onFinalize(() => {
|
|
60
|
+
'worklet';
|
|
61
|
+
scheduleOnRN(handleHoldEndRef.current);
|
|
62
|
+
})
|
|
63
|
+
.onUpdate((e) => {
|
|
64
|
+
'worklet';
|
|
65
|
+
if (!dismissible) return;
|
|
66
|
+
translateX.value = e.translationX;
|
|
67
|
+
})
|
|
68
|
+
.onEnd((e) => {
|
|
69
|
+
'worklet';
|
|
70
|
+
if (!dismissible) return;
|
|
71
|
+
if (Math.abs(e.translationX) > SWIPE_DISMISS_THRESHOLD_PX) {
|
|
72
|
+
translateX.value = withTiming(
|
|
73
|
+
e.translationX > 0 ? windowWidth : -windowWidth,
|
|
74
|
+
{ duration: 150 },
|
|
75
|
+
);
|
|
76
|
+
scheduleOnRN(handleSwipeDismissRef.current);
|
|
77
|
+
} else {
|
|
78
|
+
translateX.value = withTiming(0, { duration: 150 });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return { gesture: pan };
|
|
83
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
useAnimatedStyle,
|
|
4
|
+
useSharedValue,
|
|
5
|
+
withTiming,
|
|
6
|
+
type SharedValue,
|
|
7
|
+
} from 'react-native-reanimated';
|
|
8
|
+
import { useTimingConfig } from '../../../animations/useTimingConfig';
|
|
9
|
+
import type { ToastPosition } from '../types';
|
|
10
|
+
|
|
11
|
+
type UseToastMotionArgs = {
|
|
12
|
+
position: ToastPosition;
|
|
13
|
+
queued: boolean;
|
|
14
|
+
exiting: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type UseToastMotionReturn = {
|
|
18
|
+
animatedStyle: ReturnType<typeof useAnimatedStyle>;
|
|
19
|
+
translateX: SharedValue<number>;
|
|
20
|
+
markDismissedViaSwipe: () => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const useToastMotion = ({
|
|
24
|
+
position,
|
|
25
|
+
queued,
|
|
26
|
+
exiting,
|
|
27
|
+
}: UseToastMotionArgs): UseToastMotionReturn => {
|
|
28
|
+
const enterTiming = useTimingConfig({ duration: 200, easing: 'easeIn' });
|
|
29
|
+
const exitTiming = useTimingConfig({ duration: 200, easing: 'easeOut' });
|
|
30
|
+
const edgeOffset = position === 'top' ? -10 : 10;
|
|
31
|
+
// A toast promoted from the backlog slides out from behind the stack
|
|
32
|
+
// rather than from the anchored edge.
|
|
33
|
+
const enterOffset = queued ? -edgeOffset : edgeOffset;
|
|
34
|
+
|
|
35
|
+
const opacity = useSharedValue(0);
|
|
36
|
+
const translateY = useSharedValue(enterOffset);
|
|
37
|
+
const translateX = useSharedValue(0);
|
|
38
|
+
|
|
39
|
+
const dismissedViaSwipeRef = useRef(false);
|
|
40
|
+
const markDismissedViaSwipe = useRef(() => {
|
|
41
|
+
dismissedViaSwipeRef.current = true;
|
|
42
|
+
}).current;
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
translateY.value = withTiming(0, enterTiming);
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
opacity.value = withTiming(
|
|
51
|
+
exiting ? 0 : 1,
|
|
52
|
+
exiting ? exitTiming : enterTiming,
|
|
53
|
+
);
|
|
54
|
+
if (exiting && !dismissedViaSwipeRef.current) {
|
|
55
|
+
translateY.value = withTiming(edgeOffset, exitTiming);
|
|
56
|
+
}
|
|
57
|
+
}, [exiting, enterTiming, exitTiming, edgeOffset, opacity, translateY]);
|
|
58
|
+
|
|
59
|
+
const animatedStyle = useAnimatedStyle(
|
|
60
|
+
() => ({
|
|
61
|
+
opacity: opacity.value,
|
|
62
|
+
transform: [
|
|
63
|
+
{ translateY: translateY.value },
|
|
64
|
+
{ translateX: translateX.value },
|
|
65
|
+
],
|
|
66
|
+
}),
|
|
67
|
+
[opacity, translateY, translateX],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return { animatedStyle, translateX, markDismissedViaSwipe };
|
|
71
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useStyleSheet } from '../../../../../styles';
|
|
2
|
+
import type { ToastInsets, ToastPosition } from '../types';
|
|
3
|
+
|
|
4
|
+
type UseToastViewportStylesArgs = {
|
|
5
|
+
position: ToastPosition;
|
|
6
|
+
safeAreaTop: number;
|
|
7
|
+
safeAreaBottom: number;
|
|
8
|
+
insets: ToastInsets;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const useToastViewportStyles = ({
|
|
12
|
+
position,
|
|
13
|
+
safeAreaTop,
|
|
14
|
+
safeAreaBottom,
|
|
15
|
+
insets,
|
|
16
|
+
}: UseToastViewportStylesArgs) =>
|
|
17
|
+
useStyleSheet(
|
|
18
|
+
(t) => ({
|
|
19
|
+
root: {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
left: insets.left ?? 0,
|
|
22
|
+
right: insets.right ?? 0,
|
|
23
|
+
zIndex: 50,
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
flexDirection: position === 'top' ? 'column' : 'column-reverse',
|
|
26
|
+
top:
|
|
27
|
+
position === 'top'
|
|
28
|
+
? safeAreaTop + (insets.top ?? 0) + t.spacings.s24
|
|
29
|
+
: undefined,
|
|
30
|
+
bottom:
|
|
31
|
+
position === 'bottom'
|
|
32
|
+
? safeAreaBottom + (insets.bottom ?? 0) + t.spacings.s24
|
|
33
|
+
: undefined,
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
[
|
|
37
|
+
position,
|
|
38
|
+
safeAreaTop,
|
|
39
|
+
safeAreaBottom,
|
|
40
|
+
insets.top,
|
|
41
|
+
insets.bottom,
|
|
42
|
+
insets.left,
|
|
43
|
+
insets.right,
|
|
44
|
+
],
|
|
45
|
+
);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ToastAction,
|
|
3
|
+
ToastAppearance,
|
|
4
|
+
} from '@ledgerhq/lumen-utils-shared';
|
|
5
|
+
import type { StyledViewProps } from '../../../../styles';
|
|
6
|
+
|
|
7
|
+
// Re-exported for consumers importing from '@ledgerhq/lumen-ui-rnative': the
|
|
8
|
+
// domain model (appearance/duration/item/controller/...) is shared with
|
|
9
|
+
// ui-react and lives in utils-shared.
|
|
10
|
+
export type {
|
|
11
|
+
ToastAction,
|
|
12
|
+
ToastAppearance,
|
|
13
|
+
ToastController,
|
|
14
|
+
ToastItem,
|
|
15
|
+
ToastNotifyOptions,
|
|
16
|
+
ToastPromiseOptions,
|
|
17
|
+
ToastPromiseState,
|
|
18
|
+
ToastUpdateOptions,
|
|
19
|
+
} from '@ledgerhq/lumen-utils-shared';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Edge the queue is anchored to. Items enter from the same edge, and are
|
|
23
|
+
* dismissible by swiping left or right.
|
|
24
|
+
*/
|
|
25
|
+
export type ToastPosition = 'top' | 'bottom';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Extra space to clear beyond the safe-area inset, on each edge — e.g. the
|
|
29
|
+
* height of a custom tab bar. `top` and `bottom` apply only to the edge
|
|
30
|
+
* matching `position` — the other is ignored. All default to `0`; a fixed
|
|
31
|
+
* breathing-room gap is always added on top of `top`/`bottom` separately,
|
|
32
|
+
* so this only needs to describe the extra obstruction, not the full gap.
|
|
33
|
+
*/
|
|
34
|
+
export type ToastInsets = {
|
|
35
|
+
top?: number;
|
|
36
|
+
left?: number;
|
|
37
|
+
bottom?: number;
|
|
38
|
+
right?: number;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Props for the presentational `Toast` item.
|
|
43
|
+
*/
|
|
44
|
+
export type ToastProps = {
|
|
45
|
+
/**
|
|
46
|
+
* The status of the toast, driving the leading icon.
|
|
47
|
+
* @default info
|
|
48
|
+
*/
|
|
49
|
+
appearance?: ToastAppearance;
|
|
50
|
+
/**
|
|
51
|
+
* Replaces the leading status icon with a spinner.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
loading?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The main text. Wraps over up to five lines, then truncates.
|
|
57
|
+
* @required
|
|
58
|
+
*/
|
|
59
|
+
title: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional trailing action button. Pressing it does not dismiss the toast.
|
|
62
|
+
* It wraps onto its own row, aligned with the title, when it cannot share
|
|
63
|
+
* the title's row.
|
|
64
|
+
*/
|
|
65
|
+
action?: ToastAction;
|
|
66
|
+
} & StyledViewProps;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Props for `Toaster`.
|
|
70
|
+
*/
|
|
71
|
+
export type ToasterProps = {
|
|
72
|
+
/**
|
|
73
|
+
* Maximum number of toasts visible at once. Must be a positive integer.
|
|
74
|
+
* Extra items wait in a FIFO backlog and appear as visible slots free up.
|
|
75
|
+
* @default 1
|
|
76
|
+
*/
|
|
77
|
+
maxItems?: number;
|
|
78
|
+
/**
|
|
79
|
+
* The edge the queue is anchored to.
|
|
80
|
+
* @default bottom
|
|
81
|
+
*/
|
|
82
|
+
position?: ToastPosition;
|
|
83
|
+
/**
|
|
84
|
+
* Extra space to clear beyond the safe-area inset, on each edge — e.g.
|
|
85
|
+
* the height of a custom tab bar for `top`/`bottom`, or horizontal
|
|
86
|
+
* margins for the queue's width via `left`/`right`.
|
|
87
|
+
* @default {}
|
|
88
|
+
*/
|
|
89
|
+
insets?: ToastInsets;
|
|
90
|
+
/**
|
|
91
|
+
* Per-appearance duration overrides, layered over the Lumen status defaults.
|
|
92
|
+
*/
|
|
93
|
+
durations?: Partial<Record<ToastAppearance, number>>;
|
|
94
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
|
-
import { useCommonTranslation } from '../../../../i18n';
|
|
4
3
|
import type { LumenTextStyle } from '../../../../styles';
|
|
5
4
|
import { useStyleSheet } from '../../../../styles';
|
|
5
|
+
import { useCommonTranslation } from '../../../../translations';
|
|
6
6
|
import { Box, Text } from '../../primitives';
|
|
7
7
|
import { TriangleDown, TriangleUp } from '../../symbols';
|
|
8
8
|
import type { IconSize } from '../../symbols/Icon';
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
} from '@ledgerhq/lumen-utils-shared';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import { StyleSheet, TextInput, View } from 'react-native';
|
|
8
|
-
import { useCommonTranslation } from '../../../../i18n';
|
|
9
8
|
import { useStyleSheet, useTheme } from '../../../../styles';
|
|
9
|
+
import { useCommonTranslation } from '../../../../translations';
|
|
10
10
|
import { RuntimeConstants } from '../../../utils';
|
|
11
11
|
import { InteractiveIcon } from '../../core/InteractiveIcon';
|
|
12
12
|
import { Box, Pressable } from '../../primitives';
|
|
@@ -2,6 +2,7 @@ import { useCallback, useMemo, useState } from 'react';
|
|
|
2
2
|
import { View, type LayoutChangeEvent } from 'react-native';
|
|
3
3
|
import { Svg } from 'react-native-svg';
|
|
4
4
|
|
|
5
|
+
import { useCommonTranslation } from '../../../../translations';
|
|
5
6
|
import { MagneticPointsProvider } from '../Point/pointContext';
|
|
6
7
|
import { ScrubberProvider } from '../Scrubber/ScrubberProvider';
|
|
7
8
|
import { CartesianChartProvider, useBuildChartContext } from './context';
|
|
@@ -23,7 +24,7 @@ export function CartesianChart({
|
|
|
23
24
|
height = DEFAULT_HEIGHT,
|
|
24
25
|
inset,
|
|
25
26
|
axisPadding,
|
|
26
|
-
ariaLabel
|
|
27
|
+
ariaLabel,
|
|
27
28
|
ariaBusy = false,
|
|
28
29
|
overlay,
|
|
29
30
|
children,
|
|
@@ -32,6 +33,7 @@ export function CartesianChart({
|
|
|
32
33
|
animate = true,
|
|
33
34
|
magnetRadius,
|
|
34
35
|
}: Readonly<CartesianChartProps>) {
|
|
36
|
+
const { t } = useCommonTranslation();
|
|
35
37
|
const [measuredWidth, setMeasuredWidth] = useState<number | undefined>(width);
|
|
36
38
|
|
|
37
39
|
const needsMeasurement = width === undefined;
|
|
@@ -76,7 +78,7 @@ export function CartesianChart({
|
|
|
76
78
|
testID='chart-container'
|
|
77
79
|
onLayout={needsMeasurement ? handleLayout : undefined}
|
|
78
80
|
accessibilityRole='image'
|
|
79
|
-
accessibilityLabel={ariaLabel}
|
|
81
|
+
accessibilityLabel={ariaLabel || t('components.chart.defaultAriaLabel')}
|
|
80
82
|
accessibilityState={{ busy: ariaBusy }}
|
|
81
83
|
style={{
|
|
82
84
|
width: needsMeasurement ? undefined : resolvedWidth,
|
|
@@ -193,9 +193,7 @@ describe('DonutChart', () => {
|
|
|
193
193
|
|
|
194
194
|
const ring = getByTestId('donut-ring');
|
|
195
195
|
expect(ring.props.accessibilityState).toEqual({ busy: true });
|
|
196
|
-
expect(ring.props.accessibilityLabel).toBe(
|
|
197
|
-
chartConfig.donut.loading.ariaLabel,
|
|
198
|
-
);
|
|
196
|
+
expect(ring.props.accessibilityLabel).toBe('Loading chart');
|
|
199
197
|
});
|
|
200
198
|
|
|
201
199
|
it('ignores taps while loading', () => {
|