@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,45 @@
|
|
|
1
|
+
import type { PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
FlatList,
|
|
4
|
+
NativeScrollEvent,
|
|
5
|
+
NativeSyntheticEvent,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Render item function type for Carousel
|
|
10
|
+
* @template T - The type of items in the data array
|
|
11
|
+
*/
|
|
12
|
+
type RenderCarouselItem<T> = (info: {
|
|
13
|
+
item: T;
|
|
14
|
+
index: number;
|
|
15
|
+
}) => React.ReactElement | null;
|
|
16
|
+
|
|
17
|
+
export type CarouselRootProps<T> = PropsWithChildren<{
|
|
18
|
+
data: T[];
|
|
19
|
+
itemWidth?: number;
|
|
20
|
+
gapBetweenItems?: number;
|
|
21
|
+
renderItem: RenderCarouselItem<T>;
|
|
22
|
+
onSnapToItem?: (index: number) => void;
|
|
23
|
+
defaultIndex?: number;
|
|
24
|
+
/** Enable auto play functionality */
|
|
25
|
+
autoPlay?: boolean;
|
|
26
|
+
/** Auto play interval in seconds */
|
|
27
|
+
autoPlaySeconds?: number;
|
|
28
|
+
/** Center items in the carousel (except first and last) */
|
|
29
|
+
centerItems?: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
|
|
32
|
+
export type CarouselContextValue<T> = {
|
|
33
|
+
data: T[];
|
|
34
|
+
pageWidth: number;
|
|
35
|
+
gapBetweenItems: number;
|
|
36
|
+
activeIndex: number;
|
|
37
|
+
goTo: (index: number) => void;
|
|
38
|
+
onMomentumScrollEnd: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
39
|
+
listRef: RefObject<FlatList<T> | null>;
|
|
40
|
+
renderItem: RenderCarouselItem<T>;
|
|
41
|
+
itemWidth: number;
|
|
42
|
+
handleScrollBeginDrag: () => void;
|
|
43
|
+
calculateSnapOffset: (index: number) => number;
|
|
44
|
+
centerItems: boolean;
|
|
45
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CheckboxProps } from 'expo-checkbox';
|
|
2
|
+
import RNCheckBox from 'expo-checkbox';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
import { Container } from './styles';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
value: boolean;
|
|
9
|
+
onValueChange: (value: boolean) => void;
|
|
10
|
+
containerProps?: ViewProps;
|
|
11
|
+
} & Omit<CheckboxProps, 'OnValueChange'>;
|
|
12
|
+
|
|
13
|
+
const Checkbox = ({
|
|
14
|
+
value,
|
|
15
|
+
onValueChange,
|
|
16
|
+
children,
|
|
17
|
+
containerProps,
|
|
18
|
+
disabled,
|
|
19
|
+
...props
|
|
20
|
+
}: Props) => {
|
|
21
|
+
return (
|
|
22
|
+
<Container onPress={() => onValueChange(!value)} {...containerProps}>
|
|
23
|
+
<RNCheckBox
|
|
24
|
+
value={value}
|
|
25
|
+
onValueChange={onValueChange}
|
|
26
|
+
disabled={disabled}
|
|
27
|
+
color={value ? 'rgb(0, 140, 255)' : undefined}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
<Text
|
|
31
|
+
color={disabled ? '#888888' : '#000000'}
|
|
32
|
+
style={{
|
|
33
|
+
flexShrink: 1,
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</Text>
|
|
38
|
+
</Container>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { Checkbox };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExtendedFABContainer,
|
|
3
|
+
type ExtendedFABProps,
|
|
4
|
+
FABText,
|
|
5
|
+
} from '../styles';
|
|
6
|
+
|
|
7
|
+
export const ExtendedFAB = ({
|
|
8
|
+
label,
|
|
9
|
+
labelColor,
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}: ExtendedFABProps) => (
|
|
13
|
+
<ExtendedFABContainer {...props}>
|
|
14
|
+
{children}
|
|
15
|
+
<FABText color={labelColor}>{label}</FABText>
|
|
16
|
+
</ExtendedFABContainer>
|
|
17
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExtendedFAB } from './components/extended-fab';
|
|
2
|
+
import { DefaultFABStyle, type FABProps, LargeFAB, SmallFAB } from './styles';
|
|
3
|
+
|
|
4
|
+
const DefaultFAB = (props: FABProps) => (
|
|
5
|
+
<DefaultFABStyle activeOpacity={0.9} {...props} />
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
const SmallFABComponent = (props: FABProps) => (
|
|
9
|
+
<SmallFAB activeOpacity={0.9} {...props} />
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const LargeFABComponent = (props: FABProps) => (
|
|
13
|
+
<LargeFAB activeOpacity={0.9} {...props} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const FAB = Object.assign(DefaultFAB, {
|
|
17
|
+
Small: SmallFABComponent,
|
|
18
|
+
Large: LargeFABComponent,
|
|
19
|
+
Extended: ExtendedFAB,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export { FAB };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import type { TouchableOpacityProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
import {
|
|
6
|
+
getPositionStyle,
|
|
7
|
+
getSizeStyle,
|
|
8
|
+
type Position,
|
|
9
|
+
type Size,
|
|
10
|
+
} from './utils';
|
|
11
|
+
|
|
12
|
+
type FABProps = {
|
|
13
|
+
position?: Position;
|
|
14
|
+
size?: Size;
|
|
15
|
+
color?: string;
|
|
16
|
+
offset?: {
|
|
17
|
+
horizontal?: number;
|
|
18
|
+
vertical?: number;
|
|
19
|
+
};
|
|
20
|
+
} & TouchableOpacityProps;
|
|
21
|
+
|
|
22
|
+
export type { FABProps };
|
|
23
|
+
|
|
24
|
+
export type ExtendedFABProps = FABProps & {
|
|
25
|
+
label: string;
|
|
26
|
+
labelColor?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const DefaultFABStyle = styled.TouchableOpacity<FABProps>(
|
|
30
|
+
({ position, size, color, offset }) => ({
|
|
31
|
+
...getPositionStyle(position, offset),
|
|
32
|
+
...getSizeStyle(size),
|
|
33
|
+
backgroundColor: color ?? '#fff',
|
|
34
|
+
borderRadius: 999,
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
boxShadow: '0px 3px 2px rgba(0, 0, 0, 0.28)',
|
|
38
|
+
elevation: 4,
|
|
39
|
+
zIndex: 1000,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const SmallFAB = styled(DefaultFABStyle)(() => getSizeStyle('small'));
|
|
44
|
+
|
|
45
|
+
export const LargeFAB = styled(DefaultFABStyle)(() => getSizeStyle('large'));
|
|
46
|
+
|
|
47
|
+
export const ExtendedFABContainer = styled(DefaultFABStyle)(() => ({
|
|
48
|
+
width: 'auto',
|
|
49
|
+
minWidth: 120,
|
|
50
|
+
paddingHorizontal: 16,
|
|
51
|
+
paddingVertical: 12,
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
gap: 8,
|
|
54
|
+
borderRadius: 28, // Pill shape
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
export const FABText = styled(Text)(({ color }) => ({
|
|
58
|
+
color: color ?? '#333',
|
|
59
|
+
fontSize: 14,
|
|
60
|
+
fontWeight: '600',
|
|
61
|
+
}));
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
4
|
+
type Size = 'small' | 'regular' | 'large';
|
|
5
|
+
|
|
6
|
+
export type { Position, Size };
|
|
7
|
+
|
|
8
|
+
export const getPositionStyle = (
|
|
9
|
+
position: Position = 'bottom-right',
|
|
10
|
+
offset?: { horizontal?: number; vertical?: number },
|
|
11
|
+
): ViewStyle => {
|
|
12
|
+
const horizontalOffset = offset?.horizontal ?? 16;
|
|
13
|
+
const verticalOffset = offset?.vertical ?? 16;
|
|
14
|
+
|
|
15
|
+
const safeBottom = 80; // Tab navigation clearance
|
|
16
|
+
const safeTop = 60; // Header clearance
|
|
17
|
+
|
|
18
|
+
const positions = {
|
|
19
|
+
'top-left': { top: safeTop + verticalOffset, left: horizontalOffset },
|
|
20
|
+
'top-right': { top: safeTop + verticalOffset, right: horizontalOffset },
|
|
21
|
+
'bottom-left': {
|
|
22
|
+
bottom: safeBottom + verticalOffset,
|
|
23
|
+
left: horizontalOffset,
|
|
24
|
+
},
|
|
25
|
+
'bottom-right': {
|
|
26
|
+
bottom: safeBottom + verticalOffset,
|
|
27
|
+
right: horizontalOffset,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
...positions[position],
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const getSizeStyle = (size?: Size) => {
|
|
38
|
+
const sizes = {
|
|
39
|
+
small: { width: 40, height: 40 },
|
|
40
|
+
regular: { width: 56, height: 56 },
|
|
41
|
+
large: { width: 72, height: 72 },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return sizes[size ?? 'regular'];
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Flex } from './styles';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import type { ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type FlexProps = Pick<
|
|
5
|
+
ViewStyle,
|
|
6
|
+
| 'flex'
|
|
7
|
+
| 'flexDirection'
|
|
8
|
+
| 'flexGrow'
|
|
9
|
+
| 'flexShrink'
|
|
10
|
+
| 'flexWrap'
|
|
11
|
+
| 'alignContent'
|
|
12
|
+
| 'alignItems'
|
|
13
|
+
| 'alignSelf'
|
|
14
|
+
| 'justifyContent'
|
|
15
|
+
| 'gap'
|
|
16
|
+
| 'flexBasis'
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export const Flex = styled.View<FlexProps>(
|
|
20
|
+
({
|
|
21
|
+
theme,
|
|
22
|
+
flex,
|
|
23
|
+
flexBasis,
|
|
24
|
+
flexDirection,
|
|
25
|
+
flexGrow,
|
|
26
|
+
flexShrink,
|
|
27
|
+
flexWrap,
|
|
28
|
+
alignContent,
|
|
29
|
+
alignItems,
|
|
30
|
+
alignSelf,
|
|
31
|
+
justifyContent,
|
|
32
|
+
gap,
|
|
33
|
+
}) => ({
|
|
34
|
+
theme,
|
|
35
|
+
flex,
|
|
36
|
+
flexBasis,
|
|
37
|
+
flexDirection,
|
|
38
|
+
flexGrow,
|
|
39
|
+
flexShrink,
|
|
40
|
+
flexWrap,
|
|
41
|
+
alignContent,
|
|
42
|
+
alignItems,
|
|
43
|
+
alignSelf,
|
|
44
|
+
justifyContent,
|
|
45
|
+
gap,
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PressableProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { useInputContext } from '../context';
|
|
4
|
+
import { InputControlContainer } from '../styles';
|
|
5
|
+
|
|
6
|
+
export const InputControl = ({ children, ...props }: PressableProps) => {
|
|
7
|
+
const { isFocused, handleFocus, hasError, disabled } = useInputContext();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<InputControlContainer
|
|
11
|
+
isFocused={isFocused}
|
|
12
|
+
hasError={hasError}
|
|
13
|
+
onPress={handleFocus}
|
|
14
|
+
disabled={disabled}
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</InputControlContainer>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TextProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { useInputContext } from '../context';
|
|
4
|
+
import { InputErrorText } from '../styles';
|
|
5
|
+
|
|
6
|
+
export const InputError = (props: TextProps) => {
|
|
7
|
+
const { hasError } = useInputContext();
|
|
8
|
+
|
|
9
|
+
if (!hasError) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return <InputErrorText {...props} />;
|
|
14
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { memo, useState } from 'react';
|
|
2
|
+
import type { MaskInputProps } from 'react-native-mask-input';
|
|
3
|
+
|
|
4
|
+
import { useInputContext } from '../context';
|
|
5
|
+
import { ErrorExclamation, StyledMaskInput } from '../styles';
|
|
6
|
+
import { InputIcon } from './input-icon';
|
|
7
|
+
|
|
8
|
+
type InputProps = {
|
|
9
|
+
onChangeText?: (unmasked: string, masked: string) => void;
|
|
10
|
+
} & MaskInputProps;
|
|
11
|
+
|
|
12
|
+
export const InputField = memo(
|
|
13
|
+
({ value, onChangeText, ...props }: InputProps) => {
|
|
14
|
+
const {
|
|
15
|
+
inputRef,
|
|
16
|
+
handleFocus,
|
|
17
|
+
handleBlur,
|
|
18
|
+
isPassword,
|
|
19
|
+
showPassword,
|
|
20
|
+
hasError,
|
|
21
|
+
disabled,
|
|
22
|
+
} = useInputContext();
|
|
23
|
+
const [internalValue, setInternalValue] = useState(value ?? '');
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<StyledMaskInput
|
|
28
|
+
ref={inputRef}
|
|
29
|
+
onFocus={handleFocus}
|
|
30
|
+
onBlur={handleBlur}
|
|
31
|
+
secureTextEntry={isPassword && !showPassword}
|
|
32
|
+
value={internalValue}
|
|
33
|
+
onChangeText={(masked, unmasked) => {
|
|
34
|
+
setInternalValue(unmasked);
|
|
35
|
+
|
|
36
|
+
if (onChangeText) {
|
|
37
|
+
onChangeText(unmasked, masked);
|
|
38
|
+
}
|
|
39
|
+
}}
|
|
40
|
+
cursorColor="#000"
|
|
41
|
+
editable={!disabled}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
{hasError && (
|
|
45
|
+
<InputIcon>
|
|
46
|
+
<ErrorExclamation>!</ErrorExclamation>
|
|
47
|
+
</InputIcon>
|
|
48
|
+
)}
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
(prevProps, nextProps) => {
|
|
53
|
+
return prevProps.value === nextProps.value;
|
|
54
|
+
},
|
|
55
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EyeIcon, EyeOffIcon } from 'lucide-react-native';
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useInputContext } from '../context';
|
|
5
|
+
import { InputIcon } from './input-icon';
|
|
6
|
+
|
|
7
|
+
export const InputPasswordToggle = () => {
|
|
8
|
+
const { toggleShowPassword, showPassword } = useInputContext();
|
|
9
|
+
return (
|
|
10
|
+
<InputIcon>
|
|
11
|
+
<Pressable
|
|
12
|
+
hitSlop={{ bottom: 10, left: 10, right: 10, top: 10 }}
|
|
13
|
+
onPress={toggleShowPassword}
|
|
14
|
+
>
|
|
15
|
+
{showPassword ? <EyeOffIcon size={20} /> : <EyeIcon size={20} />}
|
|
16
|
+
</Pressable>
|
|
17
|
+
</InputIcon>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { InputContext } from '../context';
|
|
4
|
+
import { InputRootContainer } from '../styles';
|
|
5
|
+
|
|
6
|
+
type InputRootProps = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
isPassword?: boolean;
|
|
9
|
+
hasError?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const InputRoot = ({
|
|
14
|
+
children,
|
|
15
|
+
isPassword,
|
|
16
|
+
hasError = false,
|
|
17
|
+
disabled = false,
|
|
18
|
+
}: InputRootProps) => {
|
|
19
|
+
// biome-ignore lint/suspicious/noExplicitAny: For any reason, TextInput type does not has focus and blur methods
|
|
20
|
+
const inputRef = useRef<any>(null);
|
|
21
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
22
|
+
const [showPassword, setShowPassword] = useState(!isPassword);
|
|
23
|
+
|
|
24
|
+
const handleFocus = () => {
|
|
25
|
+
inputRef.current?.focus();
|
|
26
|
+
setIsFocused(true);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleBlur = () => {
|
|
30
|
+
inputRef.current?.blur();
|
|
31
|
+
setIsFocused(false);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const toggleShowPassword = () => {
|
|
35
|
+
setShowPassword((prev) => !prev);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<InputContext.Provider
|
|
40
|
+
value={{
|
|
41
|
+
inputRef,
|
|
42
|
+
handleFocus,
|
|
43
|
+
handleBlur,
|
|
44
|
+
isFocused,
|
|
45
|
+
isPassword: !!isPassword,
|
|
46
|
+
showPassword,
|
|
47
|
+
toggleShowPassword,
|
|
48
|
+
hasError,
|
|
49
|
+
disabled,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<InputRootContainer>{children}</InputRootContainer>
|
|
53
|
+
</InputContext.Provider>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import type { TextInput } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export type InputContextType = {
|
|
5
|
+
inputRef: React.RefObject<TextInput | null>;
|
|
6
|
+
handleFocus: () => void;
|
|
7
|
+
handleBlur: () => void;
|
|
8
|
+
isFocused: boolean;
|
|
9
|
+
isPassword: boolean;
|
|
10
|
+
showPassword: boolean;
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
toggleShowPassword: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const InputContext = createContext<InputContextType | null>(null);
|
|
17
|
+
|
|
18
|
+
export const useInputContext = () => {
|
|
19
|
+
const context = useContext(InputContext);
|
|
20
|
+
|
|
21
|
+
if (!context) {
|
|
22
|
+
throw new Error('Input components must be used within an Input.Root');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return context;
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InputControl } from './components/input-control';
|
|
2
|
+
import { InputError } from './components/input-error';
|
|
3
|
+
import { InputField } from './components/input-field';
|
|
4
|
+
import { InputIcon } from './components/input-icon';
|
|
5
|
+
import { InputPasswordToggle } from './components/input-password-toggle';
|
|
6
|
+
import { InputRoot } from './components/input-root';
|
|
7
|
+
|
|
8
|
+
const Input = {
|
|
9
|
+
Root: InputRoot,
|
|
10
|
+
Field: InputField,
|
|
11
|
+
Error: InputError,
|
|
12
|
+
Control: InputControl,
|
|
13
|
+
Icon: InputIcon,
|
|
14
|
+
PasswordToggle: InputPasswordToggle,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Input };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import RNMaskInput from 'react-native-mask-input';
|
|
3
|
+
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
import { getInputBorderColor, getInputShadow } from './utils';
|
|
6
|
+
|
|
7
|
+
export const InputRootContainer = styled.View({
|
|
8
|
+
width: '100%',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const InputErrorText = styled(Text)({
|
|
12
|
+
color: '#d13033',
|
|
13
|
+
marginTop: 4,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const StyledMaskInput = styled(RNMaskInput)({
|
|
17
|
+
flex: 1,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const ErrorExclamation = styled(InputErrorText)({
|
|
21
|
+
fontWeight: 'bold',
|
|
22
|
+
fontSize: 16,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const InputControlContainer = styled.Pressable<{
|
|
26
|
+
isFocused: boolean;
|
|
27
|
+
hasError?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}>(({ isFocused, hasError, disabled }) => ({
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
gap: 8,
|
|
33
|
+
borderWidth: isFocused || hasError ? 1.5 : 1,
|
|
34
|
+
borderColor: getInputBorderColor(!!hasError, isFocused),
|
|
35
|
+
borderRadius: 4,
|
|
36
|
+
boxShadow: getInputShadow(!!hasError, isFocused),
|
|
37
|
+
paddingInline: 8,
|
|
38
|
+
paddingBlock: 4,
|
|
39
|
+
|
|
40
|
+
backgroundColor: disabled ? '#f2f2f2' : '#fff',
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export const InputIconContainer = styled.View({
|
|
44
|
+
marginInline: 4,
|
|
45
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const getInputShadow = (hasError: boolean, isFocused: boolean) => {
|
|
2
|
+
if (!hasError && !isFocused) {
|
|
3
|
+
return '2px 2px 0 2px rgba(0, 0, 0, 0.06) inset';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
if (hasError) {
|
|
7
|
+
return '0px 0px 3px 0px rgba(255,0,0,0.5)';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (isFocused) {
|
|
11
|
+
return '0px 0px 3px 0px rgba(0,4,255,0.5)';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return 'none';
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const getInputBorderColor = (hasError: boolean, isFocused: boolean) => {
|
|
18
|
+
if (hasError) {
|
|
19
|
+
return '#dc4548';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (isFocused) {
|
|
23
|
+
return 'rgb(0, 140, 255)';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return '#ccc';
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Margin } from './styles';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
|
|
3
|
+
type MarginTypes = {
|
|
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 Margin = styled.View<MarginTypes>(({ insets }) => ({
|
|
16
|
+
margin: insets.all,
|
|
17
|
+
marginBlock: insets.block,
|
|
18
|
+
marginInline: insets.inline,
|
|
19
|
+
marginBottom: insets.bottom,
|
|
20
|
+
marginLeft: insets.left,
|
|
21
|
+
marginRight: insets.right,
|
|
22
|
+
marginTop: insets.top,
|
|
23
|
+
}));
|