@navegarti/rn-design-system 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +37 -0
- package/lib/module/api/axios-adapter.js +174 -0
- package/lib/module/api/axios-adapter.js.map +1 -0
- package/lib/module/api/errors.js +91 -0
- package/lib/module/api/errors.js.map +1 -0
- package/lib/module/api/index.js +30 -0
- package/lib/module/api/index.js.map +1 -0
- package/lib/module/api/retry-strategy.js +68 -0
- package/lib/module/api/retry-strategy.js.map +1 -0
- package/lib/module/api/stores/auth-store.js +26 -0
- package/lib/module/api/stores/auth-store.js.map +1 -0
- package/lib/module/api/types.js +4 -0
- package/lib/module/api/types.js.map +1 -0
- package/lib/module/api.js +10 -0
- package/lib/module/api.js.map +1 -0
- package/lib/module/components/Button/index.js +32 -0
- package/lib/module/components/Button/index.js.map +1 -0
- package/lib/module/components/Button/styles.js +27 -0
- package/lib/module/components/Button/styles.js.map +1 -0
- package/lib/module/components/Carousel/components/dot.js +42 -0
- package/lib/module/components/Carousel/components/dot.js.map +1 -0
- package/lib/module/components/Carousel/components/footer.js +22 -0
- package/lib/module/components/Carousel/components/footer.js.map +1 -0
- package/lib/module/components/Carousel/components/list.js +55 -0
- package/lib/module/components/Carousel/components/list.js.map +1 -0
- package/lib/module/components/Carousel/components/pagination.js +29 -0
- package/lib/module/components/Carousel/components/pagination.js.map +1 -0
- package/lib/module/components/Carousel/components/see-all-button.js +24 -0
- package/lib/module/components/Carousel/components/see-all-button.js.map +1 -0
- package/lib/module/components/Carousel/context.js +15 -0
- package/lib/module/components/Carousel/context.js.map +1 -0
- package/lib/module/components/Carousel/index.js +142 -0
- package/lib/module/components/Carousel/index.js.map +1 -0
- package/lib/module/components/Carousel/styles.js +10 -0
- package/lib/module/components/Carousel/styles.js.map +1 -0
- package/lib/module/components/Carousel/types.js +4 -0
- package/lib/module/components/Carousel/types.js.map +1 -0
- package/lib/module/components/Checkbox/index.js +34 -0
- package/lib/module/components/Checkbox/index.js.map +1 -0
- package/lib/module/components/Checkbox/styles.js +9 -0
- package/lib/module/components/Checkbox/styles.js.map +1 -0
- package/lib/module/components/FAB/components/extended-fab.js +17 -0
- package/lib/module/components/FAB/components/extended-fab.js.map +1 -0
- package/lib/module/components/FAB/index.js +24 -0
- package/lib/module/components/FAB/index.js.map +1 -0
- package/lib/module/components/FAB/styles.js +40 -0
- package/lib/module/components/FAB/styles.js.map +1 -0
- package/lib/module/components/FAB/utils.js +49 -0
- package/lib/module/components/FAB/utils.js.map +1 -0
- package/lib/module/components/Flex/index.js +4 -0
- package/lib/module/components/Flex/index.js.map +1 -0
- package/lib/module/components/Flex/styles.js +31 -0
- package/lib/module/components/Flex/styles.js.map +1 -0
- package/lib/module/components/FormLabel/index.js +10 -0
- package/lib/module/components/FormLabel/index.js.map +1 -0
- package/lib/module/components/FormLabel/styles.js +10 -0
- package/lib/module/components/FormLabel/styles.js.map +1 -0
- package/lib/module/components/Input/components/input-control.js +25 -0
- package/lib/module/components/Input/components/input-control.js.map +1 -0
- package/lib/module/components/Input/components/input-error.js +17 -0
- package/lib/module/components/Input/components/input-error.js.map +1 -0
- package/lib/module/components/Input/components/input-field.js +48 -0
- package/lib/module/components/Input/components/input-field.js.map +1 -0
- package/lib/module/components/Input/components/input-icon.js +10 -0
- package/lib/module/components/Input/components/input-icon.js.map +1 -0
- package/lib/module/components/Input/components/input-password-toggle.js +30 -0
- package/lib/module/components/Input/components/input-password-toggle.js.map +1 -0
- package/lib/module/components/Input/components/input-root.js +45 -0
- package/lib/module/components/Input/components/input-root.js.map +1 -0
- package/lib/module/components/Input/context.js +12 -0
- package/lib/module/components/Input/context.js.map +1 -0
- package/lib/module/components/Input/index.js +18 -0
- package/lib/module/components/Input/index.js.map +1 -0
- package/lib/module/components/Input/styles.js +40 -0
- package/lib/module/components/Input/styles.js.map +1 -0
- package/lib/module/components/Input/utils.js +24 -0
- package/lib/module/components/Input/utils.js.map +1 -0
- package/lib/module/components/Margin/index.js +4 -0
- package/lib/module/components/Margin/index.js.map +1 -0
- package/lib/module/components/Margin/styles.js +15 -0
- package/lib/module/components/Margin/styles.js.map +1 -0
- package/lib/module/components/OTPInput/index.js +85 -0
- package/lib/module/components/OTPInput/index.js.map +1 -0
- package/lib/module/components/OTPInput/styles.js +23 -0
- package/lib/module/components/OTPInput/styles.js.map +1 -0
- package/lib/module/components/OTPInput/utils.js +24 -0
- package/lib/module/components/OTPInput/utils.js.map +1 -0
- package/lib/module/components/Padding/index.js +4 -0
- package/lib/module/components/Padding/index.js.map +1 -0
- package/lib/module/components/Padding/styles.js +15 -0
- package/lib/module/components/Padding/styles.js.map +1 -0
- package/lib/module/components/Radio/components/radio-item.js +52 -0
- package/lib/module/components/Radio/components/radio-item.js.map +1 -0
- package/lib/module/components/Radio/context.js +5 -0
- package/lib/module/components/Radio/context.js.map +1 -0
- package/lib/module/components/Radio/index.js +30 -0
- package/lib/module/components/Radio/index.js.map +1 -0
- package/lib/module/components/Radio/styles.js +33 -0
- package/lib/module/components/Radio/styles.js.map +1 -0
- package/lib/module/components/Radio/utils.js +15 -0
- package/lib/module/components/Radio/utils.js.map +1 -0
- package/lib/module/components/Select/components/error-icon.js +8 -0
- package/lib/module/components/Select/components/error-icon.js.map +1 -0
- package/lib/module/components/Select/components/select-error.js +17 -0
- package/lib/module/components/Select/components/select-error.js.map +1 -0
- package/lib/module/components/Select/components/select-field.js +67 -0
- package/lib/module/components/Select/components/select-field.js.map +1 -0
- package/lib/module/components/Select/context.js +12 -0
- package/lib/module/components/Select/context.js.map +1 -0
- package/lib/module/components/Select/index.js +26 -0
- package/lib/module/components/Select/index.js.map +1 -0
- package/lib/module/components/Select/styles.js +15 -0
- package/lib/module/components/Select/styles.js.map +1 -0
- package/lib/module/components/Skeleton/index.js +44 -0
- package/lib/module/components/Skeleton/index.js.map +1 -0
- package/lib/module/components/Switch/index.js +55 -0
- package/lib/module/components/Switch/index.js.map +1 -0
- package/lib/module/components/Switch/styles.js +31 -0
- package/lib/module/components/Switch/styles.js.map +1 -0
- package/lib/module/components/Switch/utils.js +12 -0
- package/lib/module/components/Switch/utils.js.map +1 -0
- package/lib/module/components/Text/index.js +4 -0
- package/lib/module/components/Text/index.js.map +1 -0
- package/lib/module/components/Text/styles.js +25 -0
- package/lib/module/components/Text/styles.js.map +1 -0
- package/lib/module/components.js +23 -0
- package/lib/module/components.js.map +1 -0
- package/lib/module/form.js +10 -0
- package/lib/module/form.js.map +1 -0
- package/lib/module/formValidators/ZodTypeValidator.js +38 -0
- package/lib/module/formValidators/ZodTypeValidator.js.map +1 -0
- package/lib/module/formValidators/index.js +8 -0
- package/lib/module/formValidators/index.js.map +1 -0
- package/lib/module/formValidators/types.js +4 -0
- package/lib/module/formValidators/types.js.map +1 -0
- package/lib/module/hooks/useAppIsActive.js +20 -0
- package/lib/module/hooks/useAppIsActive.js.map +1 -0
- package/lib/module/hooks/useAppSecurity.js +26 -0
- package/lib/module/hooks/useAppSecurity.js.map +1 -0
- package/lib/module/hooks/useNetworkStatus.js +55 -0
- package/lib/module/hooks/useNetworkStatus.js.map +1 -0
- package/lib/module/hooks/useStatusBar.js +26 -0
- package/lib/module/hooks/useStatusBar.js.map +1 -0
- package/lib/module/hooks.js +12 -0
- package/lib/module/hooks.js.map +1 -0
- package/lib/module/index.js +53 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/libs/tanstack-form.js +5 -0
- package/lib/module/libs/tanstack-form.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/utils/camelCase.js +7 -0
- package/lib/module/utils/camelCase.js.map +1 -0
- package/lib/module/utils/camelCaseJSONKeys.js +29 -0
- package/lib/module/utils/camelCaseJSONKeys.js.map +1 -0
- package/lib/module/utils/capitalizeWord.js +5 -0
- package/lib/module/utils/capitalizeWord.js.map +1 -0
- package/lib/module/utils/createLinkingPhoneNumberString.js +10 -0
- package/lib/module/utils/createLinkingPhoneNumberString.js.map +1 -0
- package/lib/module/utils/dateFormatters.js +34 -0
- package/lib/module/utils/dateFormatters.js.map +1 -0
- package/lib/module/utils/debounce.js +12 -0
- package/lib/module/utils/debounce.js.map +1 -0
- package/lib/module/utils/deepLinkParser.js +117 -0
- package/lib/module/utils/deepLinkParser.js.map +1 -0
- package/lib/module/utils/getAge.js +13 -0
- package/lib/module/utils/getAge.js.map +1 -0
- package/lib/module/utils/getOnlyNumbers.js +4 -0
- package/lib/module/utils/getOnlyNumbers.js.map +1 -0
- package/lib/module/utils/isArray.js +7 -0
- package/lib/module/utils/isArray.js.map +1 -0
- package/lib/module/utils/isObject.js +7 -0
- package/lib/module/utils/isObject.js.map +1 -0
- package/lib/module/utils/masks.js +5 -0
- package/lib/module/utils/masks.js.map +1 -0
- package/lib/module/utils/priceFormatter.js +9 -0
- package/lib/module/utils/priceFormatter.js.map +1 -0
- package/lib/module/utils/removeTextAccents.js +5 -0
- package/lib/module/utils/removeTextAccents.js.map +1 -0
- package/lib/module/utils/shadowStyledIos.js +8 -0
- package/lib/module/utils/shadowStyledIos.js.map +1 -0
- package/lib/module/utils/sortBy.js +18 -0
- package/lib/module/utils/sortBy.js.map +1 -0
- package/lib/module/utils/uniqBy.js +15 -0
- package/lib/module/utils/uniqBy.js.map +1 -0
- package/lib/module/utils/userFullnameInitialsExtractor.js +19 -0
- package/lib/module/utils/userFullnameInitialsExtractor.js.map +1 -0
- package/lib/module/utils.js +26 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/api/axios-adapter.d.ts +61 -0
- package/lib/typescript/src/api/axios-adapter.d.ts.map +1 -0
- package/lib/typescript/src/api/errors.d.ts +63 -0
- package/lib/typescript/src/api/errors.d.ts.map +1 -0
- package/lib/typescript/src/api/index.d.ts +21 -0
- package/lib/typescript/src/api/index.d.ts.map +1 -0
- package/lib/typescript/src/api/retry-strategy.d.ts +21 -0
- package/lib/typescript/src/api/retry-strategy.d.ts.map +1 -0
- package/lib/typescript/src/api/stores/auth-store.d.ts +15 -0
- package/lib/typescript/src/api/stores/auth-store.d.ts.map +1 -0
- package/lib/typescript/src/api/types.d.ts +68 -0
- package/lib/typescript/src/api/types.d.ts.map +1 -0
- package/lib/typescript/src/api.d.ts +8 -0
- package/lib/typescript/src/api.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/index.d.ts +478 -0
- package/lib/typescript/src/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/styles.d.ts +318 -0
- package/lib/typescript/src/components/Button/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/components/dot.d.ts +7 -0
- package/lib/typescript/src/components/Carousel/components/dot.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/components/footer.d.ts +6 -0
- package/lib/typescript/src/components/Carousel/components/footer.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/components/list.d.ts +8 -0
- package/lib/typescript/src/components/Carousel/components/list.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/components/pagination.d.ts +2 -0
- package/lib/typescript/src/components/Carousel/components/pagination.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/components/see-all-button.d.ts +7 -0
- package/lib/typescript/src/components/Carousel/components/see-all-button.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/context.d.ts +4 -0
- package/lib/typescript/src/components/Carousel/context.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/index.d.ts +394 -0
- package/lib/typescript/src/components/Carousel/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/styles.d.ts +79 -0
- package/lib/typescript/src/components/Carousel/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Carousel/types.d.ts +40 -0
- package/lib/typescript/src/components/Carousel/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Checkbox/index.d.ts +10 -0
- package/lib/typescript/src/components/Checkbox/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Checkbox/styles.d.ts +154 -0
- package/lib/typescript/src/components/Checkbox/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/FAB/components/extended-fab.d.ts +3 -0
- package/lib/typescript/src/components/FAB/components/extended-fab.d.ts.map +1 -0
- package/lib/typescript/src/components/FAB/index.d.ts +8 -0
- package/lib/typescript/src/components/FAB/index.d.ts.map +1 -0
- package/lib/typescript/src/components/FAB/styles.d.ts +807 -0
- package/lib/typescript/src/components/FAB/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/FAB/utils.d.ts +19 -0
- package/lib/typescript/src/components/FAB/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/Flex/index.d.ts +2 -0
- package/lib/typescript/src/components/Flex/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Flex/styles.d.ts +135 -0
- package/lib/typescript/src/components/Flex/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/FormLabel/index.d.ts +3 -0
- package/lib/typescript/src/components/FormLabel/index.d.ts.map +1 -0
- package/lib/typescript/src/components/FormLabel/styles.d.ts +158 -0
- package/lib/typescript/src/components/FormLabel/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/components/input-control.d.ts +3 -0
- package/lib/typescript/src/components/Input/components/input-control.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/components/input-error.d.ts +3 -0
- package/lib/typescript/src/components/Input/components/input-error.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/components/input-field.d.ts +7 -0
- package/lib/typescript/src/components/Input/components/input-field.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/components/input-icon.d.ts +3 -0
- package/lib/typescript/src/components/Input/components/input-icon.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/components/input-password-toggle.d.ts +2 -0
- package/lib/typescript/src/components/Input/components/input-password-toggle.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/components/input-root.d.ts +9 -0
- package/lib/typescript/src/components/Input/components/input-root.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/context.d.ts +15 -0
- package/lib/typescript/src/components/Input/context.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/index.d.ts +17 -0
- package/lib/typescript/src/components/Input/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/styles.d.ts +738 -0
- package/lib/typescript/src/components/Input/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/utils.d.ts +3 -0
- package/lib/typescript/src/components/Input/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/Margin/index.d.ts +2 -0
- package/lib/typescript/src/components/Margin/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Margin/styles.d.ts +144 -0
- package/lib/typescript/src/components/Margin/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/OTPInput/index.d.ts +18 -0
- package/lib/typescript/src/components/OTPInput/index.d.ts.map +1 -0
- package/lib/typescript/src/components/OTPInput/styles.d.ts +214 -0
- package/lib/typescript/src/components/OTPInput/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/OTPInput/utils.d.ts +3 -0
- package/lib/typescript/src/components/OTPInput/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/Padding/index.d.ts +2 -0
- package/lib/typescript/src/components/Padding/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Padding/styles.d.ts +144 -0
- package/lib/typescript/src/components/Padding/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Radio/components/radio-item.d.ts +8 -0
- package/lib/typescript/src/components/Radio/components/radio-item.d.ts.map +1 -0
- package/lib/typescript/src/components/Radio/context.d.ts +8 -0
- package/lib/typescript/src/components/Radio/context.d.ts.map +1 -0
- package/lib/typescript/src/components/Radio/index.d.ts +86 -0
- package/lib/typescript/src/components/Radio/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Radio/styles.d.ts +348 -0
- package/lib/typescript/src/components/Radio/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Radio/utils.d.ts +2 -0
- package/lib/typescript/src/components/Radio/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/Select/components/error-icon.d.ts +2 -0
- package/lib/typescript/src/components/Select/components/error-icon.d.ts.map +1 -0
- package/lib/typescript/src/components/Select/components/select-error.d.ts +3 -0
- package/lib/typescript/src/components/Select/components/select-error.d.ts.map +1 -0
- package/lib/typescript/src/components/Select/components/select-field.d.ts +5 -0
- package/lib/typescript/src/components/Select/components/select-field.d.ts.map +1 -0
- package/lib/typescript/src/components/Select/context.d.ts +7 -0
- package/lib/typescript/src/components/Select/context.d.ts.map +1 -0
- package/lib/typescript/src/components/Select/index.d.ts +11 -0
- package/lib/typescript/src/components/Select/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Select/styles.d.ts +315 -0
- package/lib/typescript/src/components/Select/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Skeleton/index.d.ts +11 -0
- package/lib/typescript/src/components/Skeleton/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Switch/index.d.ts +11 -0
- package/lib/typescript/src/components/Switch/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Switch/styles.d.ts +344 -0
- package/lib/typescript/src/components/Switch/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Switch/utils.d.ts +2 -0
- package/lib/typescript/src/components/Switch/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/Text/index.d.ts +3 -0
- package/lib/typescript/src/components/Text/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Text/styles.d.ts +169 -0
- package/lib/typescript/src/components/Text/styles.d.ts.map +1 -0
- package/lib/typescript/src/components.d.ts +20 -0
- package/lib/typescript/src/components.d.ts.map +1 -0
- package/lib/typescript/src/form.d.ts +7 -0
- package/lib/typescript/src/form.d.ts.map +1 -0
- package/lib/typescript/src/formValidators/ZodTypeValidator.d.ts +11 -0
- package/lib/typescript/src/formValidators/ZodTypeValidator.d.ts.map +1 -0
- package/lib/typescript/src/formValidators/index.d.ts +4 -0
- package/lib/typescript/src/formValidators/index.d.ts.map +1 -0
- package/lib/typescript/src/formValidators/types.d.ts +16 -0
- package/lib/typescript/src/formValidators/types.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useAppIsActive.d.ts +2 -0
- package/lib/typescript/src/hooks/useAppIsActive.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useAppSecurity.d.ts +8 -0
- package/lib/typescript/src/hooks/useAppSecurity.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNetworkStatus.d.ts +7 -0
- package/lib/typescript/src/hooks/useNetworkStatus.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useStatusBar.d.ts +7 -0
- package/lib/typescript/src/hooks/useStatusBar.d.ts.map +1 -0
- package/lib/typescript/src/hooks.d.ts +9 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +45 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/libs/tanstack-form.d.ts +3 -0
- package/lib/typescript/src/libs/tanstack-form.d.ts.map +1 -0
- package/lib/typescript/src/utils/camelCase.d.ts +2 -0
- package/lib/typescript/src/utils/camelCase.d.ts.map +1 -0
- package/lib/typescript/src/utils/camelCaseJSONKeys.d.ts +3 -0
- package/lib/typescript/src/utils/camelCaseJSONKeys.d.ts.map +1 -0
- package/lib/typescript/src/utils/capitalizeWord.d.ts +3 -0
- package/lib/typescript/src/utils/capitalizeWord.d.ts.map +1 -0
- package/lib/typescript/src/utils/createLinkingPhoneNumberString.d.ts +3 -0
- package/lib/typescript/src/utils/createLinkingPhoneNumberString.d.ts.map +1 -0
- package/lib/typescript/src/utils/dateFormatters.d.ts +7 -0
- package/lib/typescript/src/utils/dateFormatters.d.ts.map +1 -0
- package/lib/typescript/src/utils/debounce.d.ts +2 -0
- package/lib/typescript/src/utils/debounce.d.ts.map +1 -0
- package/lib/typescript/src/utils/deepLinkParser.d.ts +7 -0
- package/lib/typescript/src/utils/deepLinkParser.d.ts.map +1 -0
- package/lib/typescript/src/utils/getAge.d.ts +2 -0
- package/lib/typescript/src/utils/getAge.d.ts.map +1 -0
- package/lib/typescript/src/utils/getOnlyNumbers.d.ts +2 -0
- package/lib/typescript/src/utils/getOnlyNumbers.d.ts.map +1 -0
- package/lib/typescript/src/utils/isArray.d.ts +2 -0
- package/lib/typescript/src/utils/isArray.d.ts.map +1 -0
- package/lib/typescript/src/utils/isObject.d.ts +2 -0
- package/lib/typescript/src/utils/isObject.d.ts.map +1 -0
- package/lib/typescript/src/utils/masks.d.ts +3 -0
- package/lib/typescript/src/utils/masks.d.ts.map +1 -0
- package/lib/typescript/src/utils/priceFormatter.d.ts +2 -0
- package/lib/typescript/src/utils/priceFormatter.d.ts.map +1 -0
- package/lib/typescript/src/utils/removeTextAccents.d.ts +3 -0
- package/lib/typescript/src/utils/removeTextAccents.d.ts.map +1 -0
- package/lib/typescript/src/utils/shadowStyledIos.d.ts +3 -0
- package/lib/typescript/src/utils/shadowStyledIos.d.ts.map +1 -0
- package/lib/typescript/src/utils/sortBy.d.ts +2 -0
- package/lib/typescript/src/utils/sortBy.d.ts.map +1 -0
- package/lib/typescript/src/utils/uniqBy.d.ts +2 -0
- package/lib/typescript/src/utils/uniqBy.d.ts.map +1 -0
- package/lib/typescript/src/utils/userFullnameInitialsExtractor.d.ts +3 -0
- package/lib/typescript/src/utils/userFullnameInitialsExtractor.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +23 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/package.json +234 -0
- package/src/api/axios-adapter.ts +272 -0
- package/src/api/errors.ts +113 -0
- package/src/api/index.ts +27 -0
- package/src/api/retry-strategy.ts +86 -0
- package/src/api/stores/auth-store.ts +26 -0
- package/src/api/types.ts +91 -0
- package/src/api.tsx +17 -0
- package/src/components/Button/index.tsx +35 -0
- package/src/components/Button/styles.ts +28 -0
- package/src/components/Carousel/components/dot.tsx +43 -0
- package/src/components/Carousel/components/footer.tsx +21 -0
- package/src/components/Carousel/components/list.tsx +81 -0
- package/src/components/Carousel/components/pagination.tsx +16 -0
- package/src/components/Carousel/components/see-all-button.tsx +25 -0
- package/src/components/Carousel/context.tsx +19 -0
- package/src/components/Carousel/index.tsx +191 -0
- package/src/components/Carousel/styles.ts +8 -0
- package/src/components/Carousel/types.ts +45 -0
- package/src/components/Checkbox/index.tsx +42 -0
- package/src/components/Checkbox/styles.ts +7 -0
- package/src/components/FAB/components/extended-fab.tsx +17 -0
- package/src/components/FAB/index.tsx +22 -0
- package/src/components/FAB/styles.ts +61 -0
- package/src/components/FAB/utils.ts +45 -0
- package/src/components/Flex/index.tsx +1 -0
- package/src/components/Flex/styles.ts +47 -0
- package/src/components/FormLabel/index.tsx +6 -0
- package/src/components/FormLabel/styles.ts +8 -0
- package/src/components/Input/components/input-control.tsx +20 -0
- package/src/components/Input/components/input-error.tsx +14 -0
- package/src/components/Input/components/input-field.tsx +55 -0
- package/src/components/Input/components/input-icon.tsx +7 -0
- package/src/components/Input/components/input-password-toggle.tsx +19 -0
- package/src/components/Input/components/input-root.tsx +55 -0
- package/src/components/Input/context.tsx +26 -0
- package/src/components/Input/index.tsx +17 -0
- package/src/components/Input/styles.ts +45 -0
- package/src/components/Input/utils.ts +27 -0
- package/src/components/Margin/index.tsx +1 -0
- package/src/components/Margin/styles.ts +23 -0
- package/src/components/OTPInput/index.tsx +116 -0
- package/src/components/OTPInput/styles.ts +23 -0
- package/src/components/OTPInput/utils.ts +31 -0
- package/src/components/Padding/index.tsx +1 -0
- package/src/components/Padding/styles.ts +23 -0
- package/src/components/Radio/components/radio-item.tsx +53 -0
- package/src/components/Radio/context.tsx +10 -0
- package/src/components/Radio/index.tsx +32 -0
- package/src/components/Radio/styles.ts +38 -0
- package/src/components/Radio/utils.ts +19 -0
- package/src/components/Select/components/error-icon.tsx +3 -0
- package/src/components/Select/components/select-error.tsx +14 -0
- package/src/components/Select/components/select-field.tsx +72 -0
- package/src/components/Select/context.tsx +17 -0
- package/src/components/Select/index.tsx +24 -0
- package/src/components/Select/styles.ts +15 -0
- package/src/components/Skeleton/index.tsx +60 -0
- package/src/components/Switch/index.tsx +61 -0
- package/src/components/Switch/styles.ts +32 -0
- package/src/components/Switch/utils.ts +15 -0
- package/src/components/Text/index.tsx +2 -0
- package/src/components/Text/styles.ts +44 -0
- package/src/components.tsx +20 -0
- package/src/form.tsx +7 -0
- package/src/formValidators/ZodTypeValidator.ts +58 -0
- package/src/formValidators/index.ts +8 -0
- package/src/formValidators/types.ts +21 -0
- package/src/hooks/useAppIsActive.ts +28 -0
- package/src/hooks/useAppSecurity.tsx +35 -0
- package/src/hooks/useNetworkStatus.ts +75 -0
- package/src/hooks/useStatusBar.ts +34 -0
- package/src/hooks.tsx +9 -0
- package/src/index.tsx +50 -0
- package/src/libs/tanstack-form.tsx +3 -0
- package/src/utils/camelCase.ts +6 -0
- package/src/utils/camelCaseJSONKeys.ts +31 -0
- package/src/utils/capitalizeWord.ts +4 -0
- package/src/utils/createLinkingPhoneNumberString.ts +13 -0
- package/src/utils/dateFormatters.ts +48 -0
- package/src/utils/debounce.ts +15 -0
- package/src/utils/deepLinkParser.ts +88 -0
- package/src/utils/getAge.ts +12 -0
- package/src/utils/getOnlyNumbers.ts +1 -0
- package/src/utils/isArray.ts +4 -0
- package/src/utils/isObject.ts +4 -0
- package/src/utils/masks.ts +3 -0
- package/src/utils/priceFormatter.ts +11 -0
- package/src/utils/removeTextAccents.ts +4 -0
- package/src/utils/shadowStyledIos.ts +6 -0
- package/src/utils/sortBy.ts +21 -0
- package/src/utils/uniqBy.ts +20 -0
- package/src/utils/userFullnameInitialsExtractor.ts +23 -0
- package/src/utils.tsx +23 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import type {
|
|
3
|
+
DimensionValue,
|
|
4
|
+
TextProps as RNTextProps,
|
|
5
|
+
TextProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
export type TextStyleProps = TextProps & {
|
|
9
|
+
flex?: number;
|
|
10
|
+
weight?: 'light' | 'regular' | 'medium' | 'bold';
|
|
11
|
+
size?: number;
|
|
12
|
+
margin?: DimensionValue | string;
|
|
13
|
+
width?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
textAlign?: 'left' | 'center' | 'right' | 'justify';
|
|
16
|
+
textTransform?: 'none' | 'uppercase' | 'capitalize' | 'lowercase';
|
|
17
|
+
textDecorationLine?: 'none' | 'underline' | 'line-through';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface TextComponentProps extends RNTextProps, TextStyleProps {}
|
|
21
|
+
|
|
22
|
+
export const Text = styled.Text<TextStyleProps>(
|
|
23
|
+
({
|
|
24
|
+
size,
|
|
25
|
+
weight,
|
|
26
|
+
color,
|
|
27
|
+
textAlign,
|
|
28
|
+
flex,
|
|
29
|
+
width,
|
|
30
|
+
textTransform,
|
|
31
|
+
textDecorationLine,
|
|
32
|
+
margin,
|
|
33
|
+
}) => ({
|
|
34
|
+
fontSize: size ? size : 14,
|
|
35
|
+
fontWeight: weight ?? 'semibold',
|
|
36
|
+
color: color ?? '#333',
|
|
37
|
+
textAlign,
|
|
38
|
+
flex,
|
|
39
|
+
width,
|
|
40
|
+
textTransform,
|
|
41
|
+
textDecorationLine,
|
|
42
|
+
margin,
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Components module entry point.
|
|
3
|
+
* Exports all UI components from the design system.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { Button } from './components/Button';
|
|
7
|
+
export { Carousel } from './components/Carousel';
|
|
8
|
+
export { Checkbox } from './components/Checkbox';
|
|
9
|
+
export { FAB } from './components/FAB';
|
|
10
|
+
export { Flex } from './components/Flex';
|
|
11
|
+
export { FormLabel } from './components/FormLabel';
|
|
12
|
+
export { Input } from './components/Input';
|
|
13
|
+
export { Margin } from './components/Margin';
|
|
14
|
+
export { OTPInput } from './components/OTPInput';
|
|
15
|
+
export { Padding } from './components/Padding';
|
|
16
|
+
export { Radio } from './components/Radio';
|
|
17
|
+
export { Select } from './components/Select';
|
|
18
|
+
export { Skeleton } from './components/Skeleton';
|
|
19
|
+
export { Switch } from './components/Switch';
|
|
20
|
+
export { Text } from './components/Text';
|
package/src/form.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { isValid as isValidCnpj } from '@fnando/cnpj';
|
|
2
|
+
import { isValid as isValidCpf } from '@fnando/cpf';
|
|
3
|
+
import { type CountryCode, parsePhoneNumber } from 'libphonenumber-js/mobile';
|
|
4
|
+
import { type ZodType, z } from 'zod';
|
|
5
|
+
import type { ITypeValidator, ValidatorMessages } from './types';
|
|
6
|
+
|
|
7
|
+
class ZodTypeValidator implements ITypeValidator {
|
|
8
|
+
cpfValidation(messages: ValidatorMessages): ZodType {
|
|
9
|
+
return z
|
|
10
|
+
.string()
|
|
11
|
+
.nonempty({
|
|
12
|
+
error: messages.emptyMessage,
|
|
13
|
+
})
|
|
14
|
+
.refine((val) => isValidCpf(val), {
|
|
15
|
+
error: messages.validationMessage,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
cnpjValidation(messages: ValidatorMessages): ZodType {
|
|
20
|
+
return z
|
|
21
|
+
.string()
|
|
22
|
+
.nonempty({
|
|
23
|
+
error: messages.emptyMessage,
|
|
24
|
+
})
|
|
25
|
+
.refine((val) => isValidCnpj(val), {
|
|
26
|
+
error: messages.validationMessage,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
emailValidation(messages: ValidatorMessages): ZodType {
|
|
31
|
+
return z
|
|
32
|
+
.email({
|
|
33
|
+
error: messages.validationMessage,
|
|
34
|
+
})
|
|
35
|
+
.nonempty({
|
|
36
|
+
error: messages.emptyMessage,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
phoneNumberValidation(
|
|
41
|
+
messages: ValidatorMessages,
|
|
42
|
+
countryCodeValidation?: CountryCode,
|
|
43
|
+
): ZodType {
|
|
44
|
+
return z
|
|
45
|
+
.string()
|
|
46
|
+
.nonempty({
|
|
47
|
+
error: messages.emptyMessage,
|
|
48
|
+
})
|
|
49
|
+
.refine(
|
|
50
|
+
(val) => parsePhoneNumber(val, countryCodeValidation ?? 'BR').isValid(),
|
|
51
|
+
{
|
|
52
|
+
error: messages.validationMessage,
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { ZodTypeValidator };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: Allow any */
|
|
2
|
+
import type { CountryCode } from 'libphonenumber-js/mobile';
|
|
3
|
+
|
|
4
|
+
export type ValidatorMessages = {
|
|
5
|
+
emptyMessage: string;
|
|
6
|
+
validationMessage: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export interface ITypeValidator {
|
|
10
|
+
cpfValidation: (messages: ValidatorMessages) => any;
|
|
11
|
+
cnpjValidation: (messages: ValidatorMessages) => any;
|
|
12
|
+
emailValidation: (messages: ValidatorMessages) => any;
|
|
13
|
+
phoneNumberValidation: (
|
|
14
|
+
messages: ValidatorMessages,
|
|
15
|
+
countryCodeValidation?: CountryCode,
|
|
16
|
+
) => any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type FormValidators = {
|
|
20
|
+
zod: ITypeValidator;
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { AppState, type AppStateStatus } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export const useAppIsActive = (callback: () => void) => {
|
|
5
|
+
const appStateRef = useRef(AppState.currentState);
|
|
6
|
+
|
|
7
|
+
const handleAppStateChange = useCallback(
|
|
8
|
+
(nextAppState: AppStateStatus) => {
|
|
9
|
+
if (
|
|
10
|
+
appStateRef.current?.match(/inactive|background/) &&
|
|
11
|
+
nextAppState === 'active'
|
|
12
|
+
) {
|
|
13
|
+
callback();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
appStateRef.current = nextAppState;
|
|
17
|
+
},
|
|
18
|
+
[callback],
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const listener = AppState.addEventListener('change', handleAppStateChange);
|
|
23
|
+
|
|
24
|
+
return () => {
|
|
25
|
+
listener.remove();
|
|
26
|
+
};
|
|
27
|
+
}, [handleAppStateChange]);
|
|
28
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import JailMonkey from 'jail-monkey';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
type IAppSecurityContext = null;
|
|
5
|
+
|
|
6
|
+
interface IAppSecurityProvider {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const AppSecurityContext = createContext<IAppSecurityContext>(null);
|
|
11
|
+
|
|
12
|
+
const AppSecurityProvider: React.FC<IAppSecurityProvider> = ({ children }) => {
|
|
13
|
+
if (JailMonkey.isJailBroken() && !__DEV__) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<AppSecurityContext.Provider value={null}>
|
|
19
|
+
{children}
|
|
20
|
+
</AppSecurityContext.Provider>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
const useAppSecurity = (): IAppSecurityContext => {
|
|
24
|
+
const context = useContext(AppSecurityContext);
|
|
25
|
+
|
|
26
|
+
if (!context) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
'useAppSecurity must be used within an AppSecurityProvider',
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return context;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { AppSecurityProvider, useAppSecurity };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
2
|
+
import { onlineManager } from '@tanstack/react-query';
|
|
3
|
+
import { useEffect, useSyncExternalStore } from 'react';
|
|
4
|
+
import { Alert } from 'react-native';
|
|
5
|
+
|
|
6
|
+
export interface NetworkStatusSnapshot {
|
|
7
|
+
isConnected: boolean;
|
|
8
|
+
isInternetReachable: boolean | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let snapshot: NetworkStatusSnapshot = {
|
|
12
|
+
isConnected: true,
|
|
13
|
+
isInternetReachable: null,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const listeners = new Set<() => void>();
|
|
17
|
+
let started = false;
|
|
18
|
+
|
|
19
|
+
const emit = () => {
|
|
20
|
+
// biome-ignore lint/suspicious/useIterableCallbackReturn: .
|
|
21
|
+
listeners.forEach((listener) => listener());
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const ensureStarted = () => {
|
|
25
|
+
if (started) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
started = true;
|
|
30
|
+
|
|
31
|
+
NetInfo.addEventListener((state) => {
|
|
32
|
+
const next: NetworkStatusSnapshot = {
|
|
33
|
+
isConnected: Boolean(state.isConnected),
|
|
34
|
+
isInternetReachable: state.isInternetReachable ?? null,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
onlineManager.setOnline(next.isConnected);
|
|
38
|
+
|
|
39
|
+
if (
|
|
40
|
+
snapshot.isConnected !== next.isConnected ||
|
|
41
|
+
snapshot.isInternetReachable !== next.isInternetReachable
|
|
42
|
+
) {
|
|
43
|
+
snapshot = next;
|
|
44
|
+
emit();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const subscribe = (listener: () => void) => {
|
|
50
|
+
ensureStarted();
|
|
51
|
+
listeners.add(listener);
|
|
52
|
+
return () => {
|
|
53
|
+
listeners.delete(listener);
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const getSnapshot = () => snapshot;
|
|
58
|
+
|
|
59
|
+
const getServerSnapshot = () => snapshot;
|
|
60
|
+
|
|
61
|
+
export const useNetworkStatus = () =>
|
|
62
|
+
useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
63
|
+
|
|
64
|
+
export const useNetworkMonitor = () => {
|
|
65
|
+
const { isConnected, isInternetReachable } = useNetworkStatus();
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (isConnected === false && isInternetReachable === false) {
|
|
69
|
+
Alert.alert(
|
|
70
|
+
'Sem conexão com a internet',
|
|
71
|
+
'Por favor, verifique sua conexão e tente novamente.',
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}, [isConnected, isInternetReachable]);
|
|
75
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { Platform, StatusBar } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface IUseStatusBar {
|
|
5
|
+
setStatusBarLightTheme: () => void;
|
|
6
|
+
setStatusBarDarkTheme: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const useStatusBar = (): IUseStatusBar => {
|
|
10
|
+
const setStatusBarLightTheme = useCallback(() => {
|
|
11
|
+
StatusBar.setHidden(false);
|
|
12
|
+
StatusBar.setBarStyle('dark-content');
|
|
13
|
+
|
|
14
|
+
if (Platform.OS === 'android') {
|
|
15
|
+
StatusBar.setBackgroundColor('#fff');
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
const setStatusBarDarkTheme = useCallback(() => {
|
|
20
|
+
StatusBar.setHidden(false);
|
|
21
|
+
StatusBar.setBarStyle('light-content');
|
|
22
|
+
|
|
23
|
+
if (Platform.OS === 'android') {
|
|
24
|
+
StatusBar.setBackgroundColor('#000');
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
setStatusBarLightTheme,
|
|
30
|
+
setStatusBarDarkTheme,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { useStatusBar };
|
package/src/hooks.tsx
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks module entry point.
|
|
3
|
+
* Exports all custom hooks from the design system.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { useAppIsActive } from './hooks/useAppIsActive';
|
|
7
|
+
export { useAppSecurity } from './hooks/useAppSecurity';
|
|
8
|
+
export { useNetworkMonitor, useNetworkStatus } from './hooks/useNetworkStatus';
|
|
9
|
+
export { useStatusBar } from './hooks/useStatusBar';
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for @navegarti/rn-design-system
|
|
3
|
+
* Re-exports all components, utilities, form helpers, and hooks
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// API
|
|
7
|
+
export * from './api';
|
|
8
|
+
// Components
|
|
9
|
+
export { Button } from './components/Button';
|
|
10
|
+
export { Carousel } from './components/Carousel';
|
|
11
|
+
export { Checkbox } from './components/Checkbox';
|
|
12
|
+
export { FAB } from './components/FAB';
|
|
13
|
+
export { Flex } from './components/Flex';
|
|
14
|
+
export { FormLabel } from './components/FormLabel';
|
|
15
|
+
export { Input } from './components/Input';
|
|
16
|
+
export { Margin } from './components/Margin';
|
|
17
|
+
export { OTPInput } from './components/OTPInput';
|
|
18
|
+
export { Padding } from './components/Padding';
|
|
19
|
+
export { Radio } from './components/Radio';
|
|
20
|
+
export { Select } from './components/Select';
|
|
21
|
+
export { Skeleton } from './components/Skeleton';
|
|
22
|
+
export { Switch } from './components/Switch';
|
|
23
|
+
export { Text } from './components/Text';
|
|
24
|
+
// Form & Validators
|
|
25
|
+
export { formValidators } from './formValidators';
|
|
26
|
+
// Hooks
|
|
27
|
+
export { useAppIsActive } from './hooks/useAppIsActive';
|
|
28
|
+
export { useAppSecurity } from './hooks/useAppSecurity';
|
|
29
|
+
export { useNetworkMonitor, useNetworkStatus } from './hooks/useNetworkStatus';
|
|
30
|
+
export { useStatusBar } from './hooks/useStatusBar';
|
|
31
|
+
export { tanstackForm } from './libs/tanstack-form';
|
|
32
|
+
// Utils
|
|
33
|
+
export { camelCase } from './utils/camelCase';
|
|
34
|
+
export { camelCaseJSONKeys } from './utils/camelCaseJSONKeys';
|
|
35
|
+
export { capitalizeWord } from './utils/capitalizeWord';
|
|
36
|
+
export { createLinkingPhoneNumberString } from './utils/createLinkingPhoneNumberString';
|
|
37
|
+
export * from './utils/dateFormatters';
|
|
38
|
+
export { debounce } from './utils/debounce';
|
|
39
|
+
export { deepLinkParser } from './utils/deepLinkParser';
|
|
40
|
+
export { getAge } from './utils/getAge';
|
|
41
|
+
export { getOnlyNumbers } from './utils/getOnlyNumbers';
|
|
42
|
+
export { isArray } from './utils/isArray';
|
|
43
|
+
export { isObject } from './utils/isObject';
|
|
44
|
+
export { Masks } from './utils/masks';
|
|
45
|
+
export { priceFormatter } from './utils/priceFormatter';
|
|
46
|
+
export { removeTextAccents } from './utils/removeTextAccents';
|
|
47
|
+
export { shadowStyledIos } from './utils/shadowStyledIos';
|
|
48
|
+
export { sortBy } from './utils/sortBy';
|
|
49
|
+
export { uniqBy } from './utils/uniqBy';
|
|
50
|
+
export { userFullnameInitialsExtractor } from './utils/userFullnameInitialsExtractor';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { camelCase } from './camelCase';
|
|
2
|
+
import { isArray } from './isArray';
|
|
3
|
+
import { isObject } from './isObject';
|
|
4
|
+
|
|
5
|
+
const camelCaseJSONKeys = <T>(obj: T): unknown => {
|
|
6
|
+
// Handle primitive types (null, string, number, boolean)
|
|
7
|
+
if (obj === null || typeof obj !== 'object') {
|
|
8
|
+
return obj;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Handle arrays
|
|
12
|
+
if (isArray(obj)) {
|
|
13
|
+
return obj.map((item) => camelCaseJSONKeys(item));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Handle objects
|
|
17
|
+
if (isObject(obj)) {
|
|
18
|
+
return Object.entries(obj).reduce(
|
|
19
|
+
(acc, [key, val]) => {
|
|
20
|
+
acc[camelCase(key)] = camelCaseJSONKeys(val);
|
|
21
|
+
return acc;
|
|
22
|
+
},
|
|
23
|
+
{} as Record<string, unknown>,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Fallback for other object types (Date, etc.)
|
|
28
|
+
return obj;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { camelCaseJSONKeys };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const createLinkingPhoneNumberString = (phoneNumber: string) => {
|
|
2
|
+
if (
|
|
3
|
+
phoneNumber.startsWith('0800') ||
|
|
4
|
+
phoneNumber.startsWith('+55') ||
|
|
5
|
+
phoneNumber.length === 3
|
|
6
|
+
) {
|
|
7
|
+
return `tel://${phoneNumber}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return `tel://+55${phoneNumber}`;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { createLinkingPhoneNumberString };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
format as fDate,
|
|
3
|
+
formatRelative as fRelative,
|
|
4
|
+
parse,
|
|
5
|
+
parseISO,
|
|
6
|
+
} from 'date-fns';
|
|
7
|
+
import { ptBR } from 'date-fns/locale';
|
|
8
|
+
|
|
9
|
+
export const parseDateWithoutSlashs = (
|
|
10
|
+
date: string,
|
|
11
|
+
format = 'ddMMyyyy',
|
|
12
|
+
): Date => {
|
|
13
|
+
const parsedDate = parse(date, format, new Date());
|
|
14
|
+
return parsedDate;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const parseDate = (date: string, format = 'dd/MM/yyyy'): Date => {
|
|
18
|
+
const parsedDate = parse(date, format, new Date());
|
|
19
|
+
return parsedDate;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const format = (date: string, dateFormat?: string): string => {
|
|
23
|
+
try {
|
|
24
|
+
return fDate(parseISO(date), dateFormat || 'dd/MM/yyyy', {
|
|
25
|
+
locale: ptBR,
|
|
26
|
+
});
|
|
27
|
+
} catch {
|
|
28
|
+
return new Date().toLocaleDateString();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const formatWithoutParse = (date: Date, dateFormat?: string): string =>
|
|
33
|
+
fDate(date, dateFormat || 'dd/MM/yyyy', {
|
|
34
|
+
locale: ptBR,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const formatRelative = (date: string): string => {
|
|
38
|
+
const parsedDate = fRelative(parseISO(date), new Date(), {
|
|
39
|
+
locale: ptBR,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return parsedDate;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const formatDateTime = (date: Date): string =>
|
|
46
|
+
fDate(date, 'dd/MM/yyyy HH:mm', {
|
|
47
|
+
locale: ptBR,
|
|
48
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Utility debounce function using ES features
|
|
2
|
+
export function debounce<F extends (...args: unknown[]) => unknown>(
|
|
3
|
+
fn: F,
|
|
4
|
+
wait = 0,
|
|
5
|
+
): F {
|
|
6
|
+
let timeoutId: ReturnType<typeof setTimeout>;
|
|
7
|
+
|
|
8
|
+
const debounced = (...args: Parameters<F>) => {
|
|
9
|
+
clearTimeout(timeoutId);
|
|
10
|
+
|
|
11
|
+
timeoutId = setTimeout(() => fn(...args), wait);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return debounced as F;
|
|
15
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type ParsedDeepLink = {
|
|
2
|
+
screen: string;
|
|
3
|
+
// biome-ignore lint/suspicious/noExplicitAny: .
|
|
4
|
+
params?: Record<string, any>;
|
|
5
|
+
} | null;
|
|
6
|
+
|
|
7
|
+
export const parseDeepLink = (url?: string): ParsedDeepLink => {
|
|
8
|
+
if (!url) return null;
|
|
9
|
+
|
|
10
|
+
// Remove scheme and leading slashes
|
|
11
|
+
const withoutScheme = url.replace(/^[^:]+:\/\//, '').replace(/^\/+/, '');
|
|
12
|
+
const parts = withoutScheme.split('/').filter(Boolean);
|
|
13
|
+
|
|
14
|
+
// Helper to safely pull a value and strip query string
|
|
15
|
+
const part = (index: number) =>
|
|
16
|
+
parts[index]
|
|
17
|
+
? decodeURIComponent(String(parts[index]).split('?')[0] ?? '')
|
|
18
|
+
: undefined;
|
|
19
|
+
|
|
20
|
+
// news links: myriviera://news/:newsType?/:newsId or myriviera://news/:newsId
|
|
21
|
+
if (parts[0] === 'news') {
|
|
22
|
+
if (parts.length === 2) {
|
|
23
|
+
return { screen: 'NewsDetail', params: { newsId: part(1) } };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (parts.length >= 3) {
|
|
27
|
+
const newsType = part(1);
|
|
28
|
+
const newsId = part(2);
|
|
29
|
+
return { screen: 'NewsDetail', params: { newsType, newsId } };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Loyalty detail: myriviera://loyalty/:storeId/:id
|
|
34
|
+
if (parts[0] === 'loyalty' && parts.length >= 3) {
|
|
35
|
+
return {
|
|
36
|
+
screen: 'LoyaltyDetail',
|
|
37
|
+
params: { storeId: part(1), id: part(2) },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Coupon detail: myriviera://coupon/:storeId/:id
|
|
42
|
+
if (parts[0] === 'coupon' && parts.length >= 3) {
|
|
43
|
+
return {
|
|
44
|
+
screen: 'CouponDetail',
|
|
45
|
+
params: { storeId: part(1), id: part(2) },
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Newsletter list
|
|
50
|
+
if (parts[0] === 'newsletter') {
|
|
51
|
+
return { screen: 'NewsLetterList' };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Establishment list by group: myriviera://groupList/:groupId
|
|
55
|
+
if (parts[0] === 'groupList' && parts.length >= 2) {
|
|
56
|
+
return { screen: 'EstablishmentList', params: { groupId: part(1) } };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Establishment detail: myriviera://group/:id
|
|
60
|
+
if (parts[0] === 'group' && parts.length >= 2) {
|
|
61
|
+
return { screen: 'EstablishmentDetail', params: { id: part(1) } };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Sports / golf / easter notices
|
|
65
|
+
if (parts[0] === 'sport_event') {
|
|
66
|
+
return { screen: 'SportsEventNotice' };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (parts[0] === 'golf_event') {
|
|
70
|
+
return { screen: 'GolfEventNotice' };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (parts[0] === 'easter_registration') {
|
|
74
|
+
return { screen: 'EasterRegistrationNotice' };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Tab navigator deep links (e.g. myriviera://tabnavigator/benefits)
|
|
78
|
+
if (parts[0] === 'tabnavigator') {
|
|
79
|
+
// sub-screen mapping (only benefits currently configured)
|
|
80
|
+
if (parts[1] === 'benefits') {
|
|
81
|
+
return { screen: 'TabNavigator', params: { screen: 'Benefits' } };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const deepLinkParser = parseDeepLink;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { differenceInYears, parse } from 'date-fns';
|
|
2
|
+
|
|
3
|
+
/* birthDate-> 10/01/2000 */
|
|
4
|
+
export const getAge = (birthDate?: string) => {
|
|
5
|
+
if (!birthDate) {
|
|
6
|
+
return 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const parsedDate = parse(birthDate, 'dd/MM/yyyy', new Date());
|
|
10
|
+
|
|
11
|
+
return differenceInYears(new Date(), parsedDate);
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const getOnlyNumbers = (value: string) => value.replace(/\D/g, '');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const priceFormatter = (price: number, fractionDigits?: number) =>
|
|
2
|
+
new Intl.NumberFormat('pt-BR', {
|
|
3
|
+
style: 'currency',
|
|
4
|
+
currency: 'BRL',
|
|
5
|
+
minimumFractionDigits: Number.isInteger(fractionDigits)
|
|
6
|
+
? fractionDigits
|
|
7
|
+
: 2,
|
|
8
|
+
maximumFractionDigits: Number.isInteger(fractionDigits)
|
|
9
|
+
? fractionDigits
|
|
10
|
+
: 2,
|
|
11
|
+
}).format(price);
|