@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,116 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: . */
|
|
2
|
+
/** biome-ignore-all lint/suspicious/noArrayIndexKey: . */
|
|
3
|
+
import { type ComponentProps, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import type { TextInputKeyPressEvent, TextInputProps } from 'react-native';
|
|
5
|
+
|
|
6
|
+
import { Flex } from '../Flex';
|
|
7
|
+
import { InputBox } from './styles';
|
|
8
|
+
|
|
9
|
+
type OTPInputProps = {
|
|
10
|
+
length?: number;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onComplete: (code: string[]) => void;
|
|
13
|
+
hasError?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
onlyNumbers?: boolean;
|
|
17
|
+
containerProps?: ComponentProps<typeof Flex>;
|
|
18
|
+
} & Omit<TextInputProps, 'value' | 'onChangeText' | 'maxLength'>;
|
|
19
|
+
|
|
20
|
+
export const OTPInput = ({
|
|
21
|
+
length = 6,
|
|
22
|
+
defaultValue = '',
|
|
23
|
+
onComplete,
|
|
24
|
+
hasError = false,
|
|
25
|
+
disabled = false,
|
|
26
|
+
autoFocus = false,
|
|
27
|
+
onlyNumbers = true,
|
|
28
|
+
containerProps,
|
|
29
|
+
...props
|
|
30
|
+
}: OTPInputProps) => {
|
|
31
|
+
const [otp, setOtp] = useState<string[]>(
|
|
32
|
+
Array(length)
|
|
33
|
+
.fill('')
|
|
34
|
+
.map((_, i) => defaultValue[i] || ''),
|
|
35
|
+
);
|
|
36
|
+
const [focusedIndex, setFocusedIndex] = useState<number | null>(
|
|
37
|
+
autoFocus ? 0 : null,
|
|
38
|
+
);
|
|
39
|
+
const inputRefs = useRef<any[]>([]);
|
|
40
|
+
|
|
41
|
+
const handleChangeText = (text: string, index: number) => {
|
|
42
|
+
if (disabled) return;
|
|
43
|
+
|
|
44
|
+
setOtp((prevOtp) => {
|
|
45
|
+
const newOtp = [...prevOtp];
|
|
46
|
+
newOtp[index] = text;
|
|
47
|
+
|
|
48
|
+
const newOtpLength = newOtp.join('').length;
|
|
49
|
+
|
|
50
|
+
if (newOtpLength === length) {
|
|
51
|
+
onComplete(newOtp);
|
|
52
|
+
inputRefs.current[index]?.blur();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return newOtp;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (index < length - 1 && text) {
|
|
59
|
+
inputRefs.current[index + 1]?.focus();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const handleKeyPress = (e: TextInputKeyPressEvent, index: number) => {
|
|
64
|
+
if (e.nativeEvent.key === 'Backspace' && !otp[index] && index > 0) {
|
|
65
|
+
inputRefs.current[index - 1]?.focus();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleFocus = (index: number) => {
|
|
70
|
+
setFocusedIndex(index);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handleBlur = () => {
|
|
74
|
+
setFocusedIndex(null);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (autoFocus && inputRefs.current[0]) {
|
|
79
|
+
inputRefs.current[0]?.focus();
|
|
80
|
+
}
|
|
81
|
+
}, [autoFocus]);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Flex
|
|
85
|
+
alignContent="center"
|
|
86
|
+
gap={8}
|
|
87
|
+
flexWrap="wrap"
|
|
88
|
+
flexDirection="row"
|
|
89
|
+
{...containerProps}
|
|
90
|
+
>
|
|
91
|
+
{Array.from({ length }).map((_, index) => (
|
|
92
|
+
<InputBox
|
|
93
|
+
key={index}
|
|
94
|
+
ref={(ref: any) => {
|
|
95
|
+
inputRefs.current[index] = ref;
|
|
96
|
+
}}
|
|
97
|
+
value={otp[index]}
|
|
98
|
+
onChangeText={(text) => handleChangeText(text, index)}
|
|
99
|
+
onKeyPress={(e) => handleKeyPress(e, index)}
|
|
100
|
+
onFocus={() => handleFocus(index)}
|
|
101
|
+
onBlur={handleBlur}
|
|
102
|
+
isFocused={focusedIndex === index}
|
|
103
|
+
hasError={hasError}
|
|
104
|
+
disabled={disabled}
|
|
105
|
+
hasValue={!!otp[index]}
|
|
106
|
+
keyboardType={onlyNumbers ? 'number-pad' : 'default'}
|
|
107
|
+
maxLength={1}
|
|
108
|
+
selectTextOnFocus
|
|
109
|
+
editable={!disabled}
|
|
110
|
+
cursorColor="#000"
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
))}
|
|
114
|
+
</Flex>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
|
|
3
|
+
import { getInputBorderColor, getInputShadow } from './utils';
|
|
4
|
+
|
|
5
|
+
export const InputBox = styled.TextInput<{
|
|
6
|
+
isFocused: boolean;
|
|
7
|
+
hasError?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
hasValue: boolean;
|
|
10
|
+
}>(({ isFocused, hasError, disabled, hasValue }) => ({
|
|
11
|
+
width: 48,
|
|
12
|
+
height: 56,
|
|
13
|
+
borderWidth: isFocused || hasError ? 1.5 : 1,
|
|
14
|
+
borderColor: getInputBorderColor(!!hasError, isFocused, hasValue),
|
|
15
|
+
borderRadius: 8,
|
|
16
|
+
textAlign: 'center',
|
|
17
|
+
fontSize: 24,
|
|
18
|
+
fontWeight: '600',
|
|
19
|
+
color: disabled ? '#888' : '#000',
|
|
20
|
+
backgroundColor: disabled ? '#f2f2f2' : '#fff',
|
|
21
|
+
|
|
22
|
+
boxShadow: getInputShadow(!!hasError, isFocused),
|
|
23
|
+
}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const getInputBorderColor = (
|
|
2
|
+
hasError: boolean,
|
|
3
|
+
isFocused: boolean,
|
|
4
|
+
hasValue: boolean,
|
|
5
|
+
) => {
|
|
6
|
+
if (hasError) {
|
|
7
|
+
return '#d13033';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (isFocused) {
|
|
11
|
+
return 'rgb(0, 140, 255)';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (hasValue) {
|
|
15
|
+
return '#666';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return '#ccc';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getInputShadow = (hasError: boolean, isFocused: boolean) => {
|
|
22
|
+
if (hasError) {
|
|
23
|
+
return '0px 0px 3px 0px rgba(255,0,0,0.5)';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (isFocused) {
|
|
27
|
+
return '0px 0px 3px 0px rgba(0,4,255,0.5)';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return 'none';
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Padding } from './styles';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
|
|
3
|
+
type PaddingTypes = {
|
|
4
|
+
insets: {
|
|
5
|
+
all?: number | 'auto';
|
|
6
|
+
block?: number | 'auto';
|
|
7
|
+
inline?: number | 'auto';
|
|
8
|
+
top?: number | 'auto';
|
|
9
|
+
right?: number | 'auto';
|
|
10
|
+
bottom?: number | 'auto';
|
|
11
|
+
left?: number | 'auto';
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Padding = styled.View<PaddingTypes>(({ insets }) => ({
|
|
16
|
+
padding: insets.all,
|
|
17
|
+
paddingBlock: insets.block,
|
|
18
|
+
paddingInline: insets.inline,
|
|
19
|
+
paddingBottom: insets.bottom,
|
|
20
|
+
paddingLeft: insets.left,
|
|
21
|
+
paddingRight: insets.right,
|
|
22
|
+
paddingTop: insets.top,
|
|
23
|
+
}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import type { TouchableOpacityProps } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { Text } from '../../Text';
|
|
6
|
+
import { RadioContext } from '../context';
|
|
7
|
+
import { RadioButton, RadioInner, RadioTouchable } from '../styles';
|
|
8
|
+
|
|
9
|
+
type RadioItemProps = PropsWithChildren<{
|
|
10
|
+
value: string;
|
|
11
|
+
}> &
|
|
12
|
+
Omit<TouchableOpacityProps, 'onPress'>;
|
|
13
|
+
|
|
14
|
+
export const RadioItem = ({ value, children, ...props }: RadioItemProps) => {
|
|
15
|
+
const context = useContext(RadioContext);
|
|
16
|
+
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error('Radio.Item must be used within Radio.Group');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { value: selectedValue, onChange, disabled, hasError } = context;
|
|
22
|
+
const isSelected = selectedValue === value;
|
|
23
|
+
|
|
24
|
+
const handlePress = () => {
|
|
25
|
+
if (!disabled) {
|
|
26
|
+
onChange(value);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<RadioTouchable
|
|
32
|
+
onPress={handlePress}
|
|
33
|
+
disabled={disabled}
|
|
34
|
+
activeOpacity={0.8}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
<RadioButton
|
|
38
|
+
isSelected={isSelected}
|
|
39
|
+
hasError={!!hasError}
|
|
40
|
+
disabled={!!disabled}
|
|
41
|
+
>
|
|
42
|
+
<RadioInner isSelected={isSelected} disabled={!!disabled} />
|
|
43
|
+
</RadioButton>
|
|
44
|
+
<Text
|
|
45
|
+
size={14}
|
|
46
|
+
color={disabled ? '#888' : '#333'}
|
|
47
|
+
style={{ userSelect: 'none' }}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</Text>
|
|
51
|
+
</RadioTouchable>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Flex } from '../Flex';
|
|
4
|
+
import { RadioItem } from './components/radio-item';
|
|
5
|
+
import { RadioContext } from './context';
|
|
6
|
+
|
|
7
|
+
type RadioGroupProps = PropsWithChildren<{
|
|
8
|
+
value: string;
|
|
9
|
+
onValueChange: (value: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
hasError?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
const RadioGroup = ({
|
|
15
|
+
value,
|
|
16
|
+
onValueChange,
|
|
17
|
+
disabled = false,
|
|
18
|
+
hasError = false,
|
|
19
|
+
children,
|
|
20
|
+
}: RadioGroupProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<RadioContext.Provider
|
|
23
|
+
value={{ value, onChange: onValueChange, disabled, hasError }}
|
|
24
|
+
>
|
|
25
|
+
<Flex gap={12}>{children}</Flex>
|
|
26
|
+
</RadioContext.Provider>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Radio = Object.assign(RadioGroup, {
|
|
31
|
+
Item: RadioItem,
|
|
32
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
|
|
3
|
+
import { getRadioBorderColor } from './utils';
|
|
4
|
+
|
|
5
|
+
export const RadioButton = styled.View<{
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
}>(({ isSelected, hasError, disabled }) => ({
|
|
10
|
+
width: 20,
|
|
11
|
+
height: 20,
|
|
12
|
+
borderRadius: 999,
|
|
13
|
+
borderWidth: 2,
|
|
14
|
+
borderColor: getRadioBorderColor(hasError, isSelected, disabled),
|
|
15
|
+
backgroundColor: disabled ? '#f2f2f2' : '#fff',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const RadioInner = styled.View<{
|
|
21
|
+
isSelected: boolean;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
}>(({ isSelected, disabled }) => ({
|
|
24
|
+
width: 10,
|
|
25
|
+
height: 10,
|
|
26
|
+
borderRadius: 99,
|
|
27
|
+
backgroundColor: isSelected
|
|
28
|
+
? disabled
|
|
29
|
+
? '#888'
|
|
30
|
+
: 'rgb(0, 140, 255)'
|
|
31
|
+
: 'transparent',
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
export const RadioTouchable = styled.TouchableOpacity({
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
gap: 8,
|
|
38
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const getRadioBorderColor = (
|
|
2
|
+
hasError: boolean,
|
|
3
|
+
isSelected: boolean,
|
|
4
|
+
disabled: boolean,
|
|
5
|
+
) => {
|
|
6
|
+
if (disabled) {
|
|
7
|
+
return '#ccc';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (hasError) {
|
|
11
|
+
return '#d13033';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (isSelected) {
|
|
15
|
+
return 'rgb(0, 140, 255)';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return '#ccc';
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TextProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { useSelectContext } from '../context';
|
|
4
|
+
import { SelectErrorText } from '../styles';
|
|
5
|
+
|
|
6
|
+
export const SelectError = (props: TextProps) => {
|
|
7
|
+
const { hasError } = useSelectContext();
|
|
8
|
+
|
|
9
|
+
if (!hasError) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return <SelectErrorText {...props} />;
|
|
14
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { PickerSelectProps } from 'react-native-picker-select';
|
|
2
|
+
import RNPickerSelect from 'react-native-picker-select';
|
|
3
|
+
|
|
4
|
+
import { useSelectContext } from '../context';
|
|
5
|
+
import { ErrorIcon } from './error-icon';
|
|
6
|
+
|
|
7
|
+
type FormSelectProps = PickerSelectProps;
|
|
8
|
+
|
|
9
|
+
export const SelectField = ({
|
|
10
|
+
placeholder,
|
|
11
|
+
style,
|
|
12
|
+
disabled,
|
|
13
|
+
...props
|
|
14
|
+
}: FormSelectProps) => {
|
|
15
|
+
const { hasError } = useSelectContext();
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
viewContainer,
|
|
19
|
+
inputIOSContainer,
|
|
20
|
+
inputIOS,
|
|
21
|
+
inputAndroid,
|
|
22
|
+
placeholder: stylePlaceholder,
|
|
23
|
+
...rest
|
|
24
|
+
} = style || {};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<RNPickerSelect
|
|
28
|
+
placeholder={{
|
|
29
|
+
label: placeholder ?? 'Selecione...',
|
|
30
|
+
value: '',
|
|
31
|
+
}}
|
|
32
|
+
Icon={hasError ? ErrorIcon : undefined}
|
|
33
|
+
style={{
|
|
34
|
+
viewContainer: {
|
|
35
|
+
backgroundColor: disabled ? '#f2f2f2' : '#fff',
|
|
36
|
+
borderWidth: hasError ? 1.5 : 1,
|
|
37
|
+
borderColor: hasError ? '#d13033' : '#cccccc',
|
|
38
|
+
borderRadius: 4,
|
|
39
|
+
boxShadow: hasError
|
|
40
|
+
? '0px 0px 3px 0px rgba(255,0,0,0.5)'
|
|
41
|
+
: '2px 2px 0 2px rgba(0, 0, 0, 0.06) inset',
|
|
42
|
+
paddingLeft: 8,
|
|
43
|
+
...viewContainer,
|
|
44
|
+
},
|
|
45
|
+
inputIOSContainer: {
|
|
46
|
+
zIndex: 99,
|
|
47
|
+
...inputIOSContainer,
|
|
48
|
+
},
|
|
49
|
+
inputIOS: {
|
|
50
|
+
fontFamily: 'System',
|
|
51
|
+
minHeight: 42,
|
|
52
|
+
fontSize: 16,
|
|
53
|
+
color: '#000',
|
|
54
|
+
...inputIOS,
|
|
55
|
+
},
|
|
56
|
+
inputAndroid: {
|
|
57
|
+
fontFamily: 'System',
|
|
58
|
+
minHeight: 42,
|
|
59
|
+
fontSize: 16,
|
|
60
|
+
...inputAndroid,
|
|
61
|
+
},
|
|
62
|
+
placeholder: {
|
|
63
|
+
color: '#666666',
|
|
64
|
+
...stylePlaceholder,
|
|
65
|
+
},
|
|
66
|
+
...rest,
|
|
67
|
+
}}
|
|
68
|
+
disabled={disabled}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
type SelectContextType = {
|
|
4
|
+
hasError?: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const SelectContext = createContext<SelectContextType | null>(null);
|
|
8
|
+
|
|
9
|
+
export const useSelectContext = () => {
|
|
10
|
+
const context = useContext(SelectContext);
|
|
11
|
+
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('Select components must be used within a Select.Root');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return context;
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { SelectError } from './components/select-error';
|
|
5
|
+
import { SelectField } from './components/select-field';
|
|
6
|
+
import { SelectContext } from './context';
|
|
7
|
+
|
|
8
|
+
type SelectRootProps = PropsWithChildren & {
|
|
9
|
+
hasError?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const SelectRoot = ({ children, hasError }: SelectRootProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<SelectContext.Provider value={{ hasError }}>
|
|
15
|
+
<View>{children}</View>
|
|
16
|
+
</SelectContext.Provider>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Select = {
|
|
21
|
+
Root: SelectRoot,
|
|
22
|
+
Field: SelectField,
|
|
23
|
+
Error: SelectError,
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
|
|
3
|
+
import { Text } from '../Text';
|
|
4
|
+
|
|
5
|
+
export const SelectErrorText = styled(Text)({
|
|
6
|
+
color: '#d13033',
|
|
7
|
+
marginTop: 4,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const ErrorExclamation = styled(SelectErrorText)({
|
|
11
|
+
fontWeight: 'bold',
|
|
12
|
+
fontSize: 16,
|
|
13
|
+
marginRight: 48,
|
|
14
|
+
marginTop: 16,
|
|
15
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type PropsWithChildren, useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, type DimensionValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type SkeletonProps = {
|
|
5
|
+
width: DimensionValue;
|
|
6
|
+
height: DimensionValue;
|
|
7
|
+
radius?: number;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
} & PropsWithChildren;
|
|
10
|
+
|
|
11
|
+
export const Skeleton = ({
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
14
|
+
radius = 4,
|
|
15
|
+
isLoading = true,
|
|
16
|
+
children,
|
|
17
|
+
}: SkeletonProps) => {
|
|
18
|
+
const opacity = useRef(new Animated.Value(0.3));
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const animation = Animated.loop(
|
|
22
|
+
Animated.sequence([
|
|
23
|
+
Animated.timing(opacity.current, {
|
|
24
|
+
toValue: 1,
|
|
25
|
+
useNativeDriver: true,
|
|
26
|
+
duration: 500,
|
|
27
|
+
}),
|
|
28
|
+
Animated.timing(opacity.current, {
|
|
29
|
+
toValue: 0.3,
|
|
30
|
+
useNativeDriver: true,
|
|
31
|
+
duration: 800,
|
|
32
|
+
}),
|
|
33
|
+
]),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (isLoading) {
|
|
37
|
+
animation.start();
|
|
38
|
+
} else {
|
|
39
|
+
animation.stop();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return () => {
|
|
43
|
+
animation.stop();
|
|
44
|
+
};
|
|
45
|
+
}, [isLoading]);
|
|
46
|
+
|
|
47
|
+
if (!isLoading) return children;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Animated.View
|
|
51
|
+
style={{
|
|
52
|
+
opacity: opacity.current,
|
|
53
|
+
width,
|
|
54
|
+
height,
|
|
55
|
+
backgroundColor: '#d3d3d3',
|
|
56
|
+
borderRadius: radius,
|
|
57
|
+
}}
|
|
58
|
+
></Animated.View>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { Animated, type TouchableOpacityProps } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { Text } from '../Text';
|
|
6
|
+
import { SwitchContainer, SwitchThumb, SwitchTrack } from './styles';
|
|
7
|
+
|
|
8
|
+
type SwitchProps = PropsWithChildren<{
|
|
9
|
+
value: boolean;
|
|
10
|
+
onValueChange: (value: boolean) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
hasError?: boolean;
|
|
13
|
+
}> &
|
|
14
|
+
Omit<TouchableOpacityProps, 'onPress'>;
|
|
15
|
+
|
|
16
|
+
export const Switch = ({
|
|
17
|
+
value,
|
|
18
|
+
onValueChange,
|
|
19
|
+
disabled = false,
|
|
20
|
+
hasError = false,
|
|
21
|
+
children,
|
|
22
|
+
...props
|
|
23
|
+
}: SwitchProps) => {
|
|
24
|
+
const translateX = useRef(new Animated.Value(value ? 20 : 0)).current;
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
Animated.timing(translateX, {
|
|
28
|
+
toValue: value ? 20 : 0,
|
|
29
|
+
duration: 200,
|
|
30
|
+
useNativeDriver: true,
|
|
31
|
+
}).start();
|
|
32
|
+
}, [value, translateX]);
|
|
33
|
+
|
|
34
|
+
const handlePress = () => {
|
|
35
|
+
if (!disabled) {
|
|
36
|
+
onValueChange(!value);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<SwitchContainer
|
|
42
|
+
onPress={handlePress}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
activeOpacity={0.8}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
<SwitchTrack value={value} disabled={disabled} hasError={hasError}>
|
|
48
|
+
<SwitchThumb style={{ transform: [{ translateX }] }} />
|
|
49
|
+
</SwitchTrack>
|
|
50
|
+
{children && (
|
|
51
|
+
<Text
|
|
52
|
+
size={14}
|
|
53
|
+
color={disabled ? '#888' : '#333'}
|
|
54
|
+
style={{ userSelect: 'none' }}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</Text>
|
|
58
|
+
)}
|
|
59
|
+
</SwitchContainer>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { getSwitchBackgroundColor } from './utils';
|
|
5
|
+
|
|
6
|
+
export const SwitchContainer = styled.TouchableOpacity({
|
|
7
|
+
flexDirection: 'row',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
gap: 12,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const SwitchTrack = styled.View<{
|
|
13
|
+
value: boolean;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
hasError: boolean;
|
|
16
|
+
}>(({ value, disabled, hasError }) => ({
|
|
17
|
+
width: 51,
|
|
18
|
+
height: 31,
|
|
19
|
+
borderRadius: 999,
|
|
20
|
+
backgroundColor: getSwitchBackgroundColor(value, disabled, hasError),
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
padding: 2,
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
export const SwitchThumb = styled(Animated.View)({
|
|
26
|
+
width: 27,
|
|
27
|
+
height: 27,
|
|
28
|
+
borderRadius: 999,
|
|
29
|
+
backgroundColor: '#fff',
|
|
30
|
+
boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.2)',
|
|
31
|
+
elevation: 2,
|
|
32
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const getSwitchBackgroundColor = (
|
|
2
|
+
value: boolean,
|
|
3
|
+
disabled: boolean,
|
|
4
|
+
hasError: boolean,
|
|
5
|
+
) => {
|
|
6
|
+
if (disabled) {
|
|
7
|
+
return value ? '#b3d9ff' : '#e0e0e0';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (hasError) {
|
|
11
|
+
return '#d13033';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return value ? 'rgb(0, 140, 255)' : '#ccc';
|
|
15
|
+
};
|