@pedidopago/ui 1.6.9 → 1.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.d.ts +1 -1
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/components/Alert/alert.test.js +4 -11
- package/dist/components/Alert/index.js +9 -16
- package/dist/components/Alert/styles.js +0 -16
- package/dist/components/Alert/types.d.ts +2 -2
- package/dist/components/Alert/types.d.ts.map +1 -1
- package/dist/components/Avatar/avatar.test.js +4 -11
- package/dist/components/Avatar/index.js +15 -38
- package/dist/components/Avatar/styles.js +0 -16
- package/dist/components/Avatar/types.d.ts +2 -2
- package/dist/components/Avatar/types.d.ts.map +1 -1
- package/dist/components/Badge/badge.test.js +5 -16
- package/dist/components/Badge/index.js +5 -9
- package/dist/components/Badge/styles.js +1 -11
- package/dist/components/Badge/types.d.ts +3 -3
- package/dist/components/Badge/types.d.ts.map +1 -1
- package/dist/components/Button/Button.test.js +14 -32
- package/dist/components/Button/index.js +21 -37
- package/dist/components/Button/styles.js +6 -35
- package/dist/components/Button/types.d.ts +4 -4
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Card/card.test.js +8 -15
- package/dist/components/Card/index.js +15 -24
- package/dist/components/Card/styles.js +0 -8
- package/dist/components/Card/types.d.ts +2 -2
- package/dist/components/Card/types.d.ts.map +1 -1
- package/dist/components/CheckboxInput/checkbox-input.test.js +65 -89
- package/dist/components/CheckboxInput/components/MultipleCheckbox.js +27 -58
- package/dist/components/CheckboxInput/index.js +20 -41
- package/dist/components/CheckboxInput/styles.js +9 -33
- package/dist/components/CheckboxInput/types.d.ts +1 -1
- package/dist/components/CheckboxInput/types.d.ts.map +1 -1
- package/dist/components/CollapseCard/ExpandButton/index.js +3 -11
- package/dist/components/CollapseCard/ExpandButton/styles.d.ts +4 -2
- package/dist/components/CollapseCard/ExpandButton/styles.d.ts.map +1 -1
- package/dist/components/CollapseCard/ExpandButton/styles.js +0 -6
- package/dist/components/CollapseCard/expand-button.test.js +71 -110
- package/dist/components/CollapseCard/index.js +23 -44
- package/dist/components/CollapseCard/styles.d.ts +4 -1
- package/dist/components/CollapseCard/styles.d.ts.map +1 -1
- package/dist/components/CollapseCard/styles.js +0 -9
- package/dist/components/ColorPicker/colorpicker.test.js +6 -16
- package/dist/components/ColorPicker/components/ColorHue.js +1 -12
- package/dist/components/ColorPicker/components/ColorInput.js +10 -31
- package/dist/components/ColorPicker/components/ColorPickerBox.js +5 -17
- package/dist/components/ColorPicker/components/ColorPointer.js +3 -8
- package/dist/components/ColorPicker/components/ColorSelector.js +45 -77
- package/dist/components/ColorPicker/hooks/useCachedCallback.js +0 -3
- package/dist/components/ColorPicker/hooks/useHsva.js +7 -20
- package/dist/components/ColorPicker/index.js +18 -41
- package/dist/components/ColorPicker/styles.js +0 -24
- package/dist/components/ColorPicker/types.d.ts +11 -11
- package/dist/components/ColorPicker/types.d.ts.map +1 -1
- package/dist/components/ColorPicker/utils/checkers.js +0 -19
- package/dist/components/ColorPicker/utils/conversors.js +41 -88
- package/dist/components/ColorPicker/utils/parsers.js +11 -40
- package/dist/components/DateInput/DateInput-example.js +14 -23
- package/dist/components/DateInput/components/ModalWrapper/index.js +8 -12
- package/dist/components/DateInput/components/ModalWrapper/styles.d.ts +4 -1
- package/dist/components/DateInput/components/ModalWrapper/styles.d.ts.map +1 -1
- package/dist/components/DateInput/components/ModalWrapper/styles.js +1 -12
- package/dist/components/DateInput/dateInput.test.js +17 -26
- package/dist/components/DateInput/index.js +32 -54
- package/dist/components/DateInput/styles.js +0 -9
- package/dist/components/DateInput/types.d.ts +1 -1
- package/dist/components/DateInput/types.d.ts.map +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.d.ts.map +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.js +19 -43
- package/dist/components/DatePicker/components/DateYearPicker.js +11 -31
- package/dist/components/DatePicker/datepicker.test.js +44 -62
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +74 -118
- package/dist/components/DatePicker/styles.js +2 -35
- package/dist/components/DatePicker/types.d.ts +4 -4
- package/dist/components/DatePicker/types.d.ts.map +1 -1
- package/dist/components/DatePicker/utils/getMonthName.js +0 -2
- package/dist/components/Dialog/dialog-example.js +9 -22
- package/dist/components/Dialog/dialog.test.js +32 -45
- package/dist/components/Dialog/index.js +14 -22
- package/dist/components/Dialog/styles.js +0 -13
- package/dist/components/Dropzone/dropzone.test.js +35 -45
- package/dist/components/Dropzone/index.js +29 -68
- package/dist/components/Dropzone/styles.js +8 -32
- package/dist/components/Dropzone/types.d.ts +4 -4
- package/dist/components/Dropzone/types.d.ts.map +1 -1
- package/dist/components/Dropzone/utils/accepts.js +0 -5
- package/dist/components/Flex/flex.test.js +267 -286
- package/dist/components/Flex/index.js +16 -24
- package/dist/components/Flex/styles.js +0 -11
- package/dist/components/Flex/types.d.ts +13 -13
- package/dist/components/Flex/types.d.ts.map +1 -1
- package/dist/components/Grid/grid.test.js +0 -6
- package/dist/components/Grid/index.js +17 -25
- package/dist/components/Grid/styles.js +1 -9
- package/dist/components/Grid/types.d.ts +2 -2
- package/dist/components/Grid/types.d.ts.map +1 -1
- package/dist/components/Icon/data/beauty.js +1 -0
- package/dist/components/Icon/data/ecommerce.js +1 -0
- package/dist/components/Icon/data/form.js +1 -0
- package/dist/components/Icon/data/health.js +1 -0
- package/dist/components/Icon/data/illustrations.js +1 -0
- package/dist/components/Icon/data/men.js +1 -0
- package/dist/components/Icon/data/payment.js +1 -0
- package/dist/components/Icon/data/pedidoPago.js +1 -0
- package/dist/components/Icon/data/physicalPerfomance.js +1 -0
- package/dist/components/Icon/data/social.js +1 -0
- package/dist/components/Icon/data/status.js +1 -0
- package/dist/components/Icon/data/summer.js +1 -0
- package/dist/components/Icon/data/woman.js +1 -0
- package/dist/components/Icon/icon.test.js +19 -32
- package/dist/components/Icon/index.js +14 -28
- package/dist/components/Icon/scripts/build.js +14 -51
- package/dist/components/Icon/scripts/extractor.js +0 -6
- package/dist/components/Icon/scripts/run-build.js +0 -2
- package/dist/components/Icon/scripts/writers.d.ts +1 -1
- package/dist/components/Icon/scripts/writers.d.ts.map +1 -1
- package/dist/components/Icon/scripts/writers.js +1 -12
- package/dist/components/Icon/styles.d.ts +1 -1
- package/dist/components/Icon/styles.d.ts.map +1 -1
- package/dist/components/Icon/styles.js +3 -11
- package/dist/components/Icon/types.d.ts +2 -2
- package/dist/components/Icon/types.d.ts.map +1 -1
- package/dist/components/Icon/utils/allIcons.js +1 -22
- package/dist/components/Icon/utils/iconExists.d.ts +1 -1
- package/dist/components/Icon/utils/iconExists.d.ts.map +1 -1
- package/dist/components/Icon/utils/iconExists.js +0 -3
- package/dist/components/IconItem/IconItem.test.js +27 -37
- package/dist/components/IconItem/index.js +5 -12
- package/dist/components/IconItem/styles.js +2 -16
- package/dist/components/IconItem/types.d.ts +3 -3
- package/dist/components/IconItem/types.d.ts.map +1 -1
- package/dist/components/Illustration/AlternativeOrderSvg/index.js +0 -2
- package/dist/components/Illustration/BoletoSvg/index.js +0 -2
- package/dist/components/Illustration/BoxClosedSvg/index.js +0 -2
- package/dist/components/Illustration/BoxDeliverySvg/index.js +0 -2
- package/dist/components/Illustration/BoxOpenSvg/index.js +0 -2
- package/dist/components/Illustration/CalendarSvg/index.js +0 -2
- package/dist/components/Illustration/CardSvg/index.js +0 -2
- package/dist/components/Illustration/CollaboratorSvg/index.js +0 -2
- package/dist/components/Illustration/InquirySvg/index.js +0 -2
- package/dist/components/Illustration/OrderSvg/index.js +0 -2
- package/dist/components/Illustration/PixSvg/index.js +0 -2
- package/dist/components/Illustration/PrescriptionSvg/index.js +0 -2
- package/dist/components/Illustration/TransportSvg/index.js +0 -2
- package/dist/components/Illustration/illustration.test.js +20 -31
- package/dist/components/Illustration/index.js +11 -43
- package/dist/components/Illustration/styles.js +0 -14
- package/dist/components/ImageItem/imageFake.js +0 -2
- package/dist/components/ImageItem/index.js +18 -25
- package/dist/components/ImageItem/input.test.js +31 -51
- package/dist/components/ImageItem/styles.js +2 -22
- package/dist/components/ImageItem/types.d.ts +2 -2
- package/dist/components/ImageItem/types.d.ts.map +1 -1
- package/dist/components/Input/index.js +25 -47
- package/dist/components/Input/input.test.js +49 -73
- package/dist/components/Input/styles.js +12 -65
- package/dist/components/Input/types.d.ts +1 -1
- package/dist/components/Input/types.d.ts.map +1 -1
- package/dist/components/Label/index.js +9 -19
- package/dist/components/Label/label.test.js +32 -58
- package/dist/components/Label/styles.js +0 -6
- package/dist/components/Label/types.d.ts +2 -2
- package/dist/components/Label/types.d.ts.map +1 -1
- package/dist/components/List/index.js +9 -17
- package/dist/components/List/list.test.js +4 -11
- package/dist/components/List/styles.js +0 -11
- package/dist/components/Modal/ModalExample.js +9 -27
- package/dist/components/Modal/index.js +23 -47
- package/dist/components/Modal/modal.test.js +15 -33
- package/dist/components/Modal/styles.d.ts +8 -2
- package/dist/components/Modal/styles.d.ts.map +1 -1
- package/dist/components/Modal/styles.js +3 -16
- package/dist/components/Modal/types.d.ts +2 -2
- package/dist/components/Modal/types.d.ts.map +1 -1
- package/dist/components/MultipleSelect/MultipleSelect.test.js +106 -223
- package/dist/components/MultipleSelect/components/InputWrapper/index.js +1 -11
- package/dist/components/MultipleSelect/components/InputWrapper/types.d.ts +1 -1
- package/dist/components/MultipleSelect/components/InputWrapper/types.d.ts.map +1 -1
- package/dist/components/MultipleSelect/components/OptionsArea/index.js +36 -70
- package/dist/components/MultipleSelect/components/OptionsArea/styles.d.ts +4 -1
- package/dist/components/MultipleSelect/components/OptionsArea/styles.d.ts.map +1 -1
- package/dist/components/MultipleSelect/components/OptionsArea/styles.js +6 -19
- package/dist/components/MultipleSelect/components/SelectArea/ButtonsArea.js +0 -9
- package/dist/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.js +2 -12
- package/dist/components/MultipleSelect/components/SelectArea/SelectedOptionsArea.js +0 -15
- package/dist/components/MultipleSelect/components/SelectArea/index.js +10 -20
- package/dist/components/MultipleSelect/components/SelectArea/styles.js +1 -12
- package/dist/components/MultipleSelect/components/SelectArea/types.d.ts +1 -1
- package/dist/components/MultipleSelect/components/SelectArea/types.d.ts.map +1 -1
- package/dist/components/MultipleSelect/components/index.js +0 -6
- package/dist/components/MultipleSelect/index.d.ts +1 -1
- package/dist/components/MultipleSelect/index.d.ts.map +1 -1
- package/dist/components/MultipleSelect/index.js +51 -94
- package/dist/components/MultipleSelect/types.d.ts +2 -2
- package/dist/components/MultipleSelect/types.d.ts.map +1 -1
- package/dist/components/Observer/index.js +10 -25
- package/dist/components/Observer/observer.test.js +0 -4
- package/dist/components/Observer/types.d.ts +1 -1
- package/dist/components/Observer/types.d.ts.map +1 -1
- package/dist/components/Pagination/hooks/usePagination.js +2 -18
- package/dist/components/Pagination/index.d.ts.map +1 -1
- package/dist/components/Pagination/index.js +53 -86
- package/dist/components/Pagination/pagination.test.js +16 -50
- package/dist/components/Pagination/styles.js +23 -45
- package/dist/components/Progress/Circle/index.js +15 -31
- package/dist/components/Progress/Circle/styles.js +1 -15
- package/dist/components/Progress/Circle/types.d.ts +1 -1
- package/dist/components/Progress/Circle/types.d.ts.map +1 -1
- package/dist/components/Progress/Linear/index.js +12 -30
- package/dist/components/Progress/Linear/styles.js +1 -14
- package/dist/components/Progress/Linear/types.d.ts +3 -3
- package/dist/components/Progress/Linear/types.d.ts.map +1 -1
- package/dist/components/Progress/getSteps.js +0 -3
- package/dist/components/Progress/index.js +10 -19
- package/dist/components/Progress/progress.test.js +47 -64
- package/dist/components/Progress/types.d.ts +2 -2
- package/dist/components/Progress/types.d.ts.map +1 -1
- package/dist/components/RadioInput/components/ChoiceList/index.js +14 -27
- package/dist/components/RadioInput/index.js +15 -26
- package/dist/components/RadioInput/radio-input.test.js +44 -68
- package/dist/components/RadioInput/styles.js +2 -21
- package/dist/components/RadioInput/types.d.ts +4 -4
- package/dist/components/RadioInput/types.d.ts.map +1 -1
- package/dist/components/RadioInput/utils/get-colors-props.js +0 -1
- package/dist/components/Rating/index.js +35 -66
- package/dist/components/Rating/rating.test.js +0 -16
- package/dist/components/Rating/styles.js +1 -12
- package/dist/components/ReactPortal/index.js +7 -22
- package/dist/components/ReactPortal/reactPortal.test.js +0 -5
- package/dist/components/ReactPortal/utils/createWrapperAndApprendToBody.js +0 -1
- package/dist/components/Select/components/OptionsSelect/index.js +25 -45
- package/dist/components/Select/components/OptionsSelect/styles.d.ts +4 -1
- package/dist/components/Select/components/OptionsSelect/styles.d.ts.map +1 -1
- package/dist/components/Select/components/OptionsSelect/styles.js +1 -12
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +37 -74
- package/dist/components/Select/select.test.js +13 -22
- package/dist/components/Select/styles.js +0 -12
- package/dist/components/Select/types.d.ts +2 -2
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +6 -14
- package/dist/components/Skeleton/skeleton.test.js +35 -51
- package/dist/components/Skeleton/styles.js +0 -10
- package/dist/components/Skeleton/types.d.ts +1 -1
- package/dist/components/Skeleton/types.d.ts.map +1 -1
- package/dist/components/Slider/SliderExample.js +11 -25
- package/dist/components/Slider/components/SliderPointer.js +1 -7
- package/dist/components/Slider/components/SliderRail.js +49 -81
- package/dist/components/Slider/components/SliderSelector.js +22 -45
- package/dist/components/Slider/hooks/useEventCallback.js +0 -3
- package/dist/components/Slider/index.js +26 -62
- package/dist/components/Slider/slider.test.js +52 -65
- package/dist/components/Slider/styles.js +0 -25
- package/dist/components/Slider/types.d.ts +5 -5
- package/dist/components/Slider/types.d.ts.map +1 -1
- package/dist/components/Spinner/index.js +6 -10
- package/dist/components/Spinner/spinner.test.js +14 -24
- package/dist/components/Spinner/styles.js +5 -10
- package/dist/components/Spinner/types.d.ts +2 -2
- package/dist/components/Spinner/types.d.ts.map +1 -1
- package/dist/components/Steps/components/StepIcon/index.js +5 -14
- package/dist/components/Steps/components/StepIconMobile/index.js +5 -14
- package/dist/components/Steps/index.js +12 -37
- package/dist/components/Steps/steps.test.js +23 -33
- package/dist/components/Steps/styles.js +4 -27
- package/dist/components/Steps/types.d.ts +1 -1
- package/dist/components/Steps/types.d.ts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.js +22 -39
- package/dist/components/Switch/styles.js +4 -21
- package/dist/components/Switch/switch.test.js +41 -179
- package/dist/components/Switch/types.d.ts +2 -2
- package/dist/components/Switch/types.d.ts.map +1 -1
- package/dist/components/Table/components/MenuItem.js +5 -11
- package/dist/components/Table/components/TableSkeleton.js +3 -9
- package/dist/components/Table/index.js +38 -71
- package/dist/components/Table/styles.js +0 -19
- package/dist/components/Table/table.test.js +68 -84
- package/dist/components/Table/types.d.ts +3 -3
- package/dist/components/Table/types.d.ts.map +1 -1
- package/dist/components/Tabs/TabsExample.js +11 -24
- package/dist/components/Tabs/components/Tab.js +12 -20
- package/dist/components/Tabs/components/TabPanel.js +3 -7
- package/dist/components/Tabs/components/Tabs.js +25 -49
- package/dist/components/Tabs/index.js +0 -3
- package/dist/components/Tabs/styles.js +9 -29
- package/dist/components/Tabs/tabs.test.js +104 -117
- package/dist/components/Tabs/types.d.ts +7 -7
- package/dist/components/Tabs/types.d.ts.map +1 -1
- package/dist/components/Tag/index.js +6 -13
- package/dist/components/Tag/styles.js +7 -18
- package/dist/components/Tag/tag.test.js +3 -17
- package/dist/components/TextAreaInput/index.js +16 -35
- package/dist/components/TextAreaInput/styles.js +10 -23
- package/dist/components/TextAreaInput/text-area-input.test.js +21 -36
- package/dist/components/TextAreaInput/types.d.ts +3 -3
- package/dist/components/TextAreaInput/types.d.ts.map +1 -1
- package/dist/components/Thumbnail/index.js +31 -60
- package/dist/components/Thumbnail/styles.js +9 -26
- package/dist/components/Thumbnail/thumbnail.test.js +13 -29
- package/dist/components/Thumbnail/types.d.ts +1 -1
- package/dist/components/Thumbnail/types.d.ts.map +1 -1
- package/dist/components/Thumbnail/utils/index.js +0 -4
- package/dist/components/Thumbnail/utils/validate-file-size.js +0 -1
- package/dist/components/Thumbnail/utils/validate-file-type.js +0 -1
- package/dist/components/Timeline/components/Timeline.js +3 -8
- package/dist/components/Timeline/components/TimelineContent.js +7 -18
- package/dist/components/Timeline/components/TimelineItem.js +5 -13
- package/dist/components/Timeline/components/TimelineSeparator.js +1 -5
- package/dist/components/Timeline/index.js +0 -4
- package/dist/components/Timeline/styles.js +0 -17
- package/dist/components/Timeline/timeline.test.js +103 -115
- package/dist/components/Timeline/types.d.ts +4 -4
- package/dist/components/Timeline/types.d.ts.map +1 -1
- package/dist/components/Toast/button-example.js +1 -14
- package/dist/components/Toast/components/Toast.js +12 -21
- package/dist/components/Toast/contexts/ToastProvider.js +9 -31
- package/dist/components/Toast/hooks/useToast.js +1 -7
- package/dist/components/Toast/index.js +6 -17
- package/dist/components/Toast/styles.js +0 -12
- package/dist/components/Toast/toast.test.js +4 -14
- package/dist/components/Toast/types.d.ts +5 -5
- package/dist/components/Toast/types.d.ts.map +1 -1
- package/dist/components/Tooltip/components/TooltipLabel.js +12 -23
- package/dist/components/Tooltip/example.js +0 -4
- package/dist/components/Tooltip/index.js +29 -66
- package/dist/components/Tooltip/styles.js +0 -10
- package/dist/components/Tooltip/types.d.ts +3 -3
- package/dist/components/Tooltip/types.d.ts.map +1 -1
- package/dist/components/Typography/index.js +9 -21
- package/dist/components/Typography/styles.js +0 -7
- package/dist/components/Typography/types.d.ts +1 -1
- package/dist/components/Typography/types.d.ts.map +1 -1
- package/dist/components/Typography/typography.test.js +134 -171
- package/dist/index.js +0 -61
- package/dist/shared/components/FocusLock/index.js +17 -30
- package/dist/shared/formatters/format-number.js +4 -10
- package/dist/shared/hooks/devices.d.ts +1 -1
- package/dist/shared/hooks/devices.d.ts.map +1 -1
- package/dist/shared/hooks/useBreakpoints.d.ts +3 -3
- package/dist/shared/hooks/useBreakpoints.d.ts.map +1 -1
- package/dist/shared/hooks/useBreakpoints.js +5 -34
- package/dist/shared/hooks/useDebounce.js +1 -12
- package/dist/shared/hooks/useDevices.js +6 -20
- package/dist/shared/hooks/useDisableBodyScroll.js +6 -15
- package/dist/shared/hooks/useKeyPress.js +0 -3
- package/dist/shared/hooks/useObserver.js +1 -5
- package/dist/shared/hooks/useOnClickOutside.js +0 -7
- package/dist/shared/hooks/useWindowSize.d.ts +1 -1
- package/dist/shared/hooks/useWindowSize.d.ts.map +1 -1
- package/dist/shared/hooks/useWindowSize.js +8 -18
- package/dist/shared/tests/test-utils.js +5 -13
- package/dist/shared/tests/types.d.ts +1 -1
- package/dist/shared/tests/types.d.ts.map +1 -1
- package/dist/shared/theme/button-example.js +2 -12
- package/dist/shared/theme/contexts/ThemeContext.d.ts +2 -2
- package/dist/shared/theme/contexts/ThemeContext.d.ts.map +1 -1
- package/dist/shared/theme/contexts/ThemeContext.js +14 -37
- package/dist/shared/theme/hooks/useColorMode.js +2 -7
- package/dist/shared/theme/hooks/useColorModeValue.js +1 -5
- package/dist/shared/theme/hooks/useTheme.js +1 -7
- package/dist/shared/theme/index.js +0 -8
- package/dist/shared/theme/theme.js +5 -9
- package/dist/shared/theme/theme.test.js +35 -61
- package/dist/shared/theme/theme.types.d.ts +5 -5
- package/dist/shared/theme/theme.types.d.ts.map +1 -1
- package/dist/shared/theme/utils/extendTheme.js +0 -4
- package/dist/shared/types/credit-card.d.ts +1 -1
- package/dist/shared/types/credit-card.d.ts.map +1 -1
- package/dist/shared/types/file.d.ts +2 -2
- package/dist/shared/types/file.d.ts.map +1 -1
- package/dist/shared/types/name.d.ts +1 -1
- package/dist/shared/types/name.d.ts.map +1 -1
- package/dist/utils/GenerateKey.js +1 -3
- package/dist/utils/brightnessColorChange.js +0 -1
- package/dist/utils/colorCheck.d.ts +1 -1
- package/dist/utils/colorCheck.d.ts.map +1 -1
- package/dist/utils/colorCheck.js +9 -29
- package/dist/utils/colorFunctions.js +0 -6
- package/dist/utils/colorToGray.js +5 -22
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +56 -83
- package/dist/utils/formatters/bytes.js +0 -1
- package/dist/utils/formatters/capitalize.js +0 -1
- package/dist/utils/formatters/cep.js +1 -3
- package/dist/utils/formatters/cnpj.js +2 -9
- package/dist/utils/formatters/color.js +19 -20
- package/dist/utils/formatters/cpf.js +18 -25
- package/dist/utils/formatters/credit-card.js +6 -19
- package/dist/utils/formatters/index.js +0 -30
- package/dist/utils/formatters/name.js +1 -6
- package/dist/utils/formatters/number.js +0 -1
- package/dist/utils/formatters/passport.js +3 -7
- package/dist/utils/formatters/phone.js +17 -45
- package/dist/utils/formatters/price.js +1 -3
- package/dist/utils/formatters/rg.js +1 -3
- package/dist/utils/formatters/strings.js +0 -5
- package/dist/utils/fuctionsColors.js +0 -6
- package/dist/utils/generateUUID.js +0 -1
- package/dist/utils/getColorValue.js +0 -5
- package/dist/utils/getSvg.d.ts +1 -1
- package/dist/utils/getSvg.d.ts.map +1 -1
- package/dist/utils/getSvg.js +0 -3
- package/dist/utils/getValuesBySize.d.ts +2 -2
- package/dist/utils/getValuesBySize.d.ts.map +1 -1
- package/dist/utils/getValuesBySize.js +0 -1
- package/dist/utils/invertColor.js +7 -15
- package/package.json +18 -18
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.formatCnpj = formatCnpj;
|
|
7
7
|
exports.sanitizeCNPJ = sanitizeCNPJ;
|
|
8
8
|
exports.validateCNPJ = validateCNPJ;
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* This function takes in a string representing a Brazilian CNPJ number and returns a formatted string in the standard CNPJ format (e.g. "12.345.678/0001-90").
|
|
12
11
|
* @param {string} text - The string representing the Brazilian CNPJ number.
|
|
@@ -15,40 +14,34 @@ exports.validateCNPJ = validateCNPJ;
|
|
|
15
14
|
function formatCnpj(text) {
|
|
16
15
|
return text.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, '$1.$2.$3/$4-$5');
|
|
17
16
|
}
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* This function takes in a string representing a Brazilian CNPJ number and returns a sanitized string without any non-numeric characters, with a maximum length of 14 characters.
|
|
20
20
|
* @param {string} cnpj - The string representing the Brazilian CNPJ number.
|
|
21
21
|
* @returns {string} - A sanitized string without any non-numeric characters, with a maximum length of 14 characters.
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
23
|
function sanitizeCNPJ(cnpj) {
|
|
26
24
|
return cnpj ? cnpj.replace(/\D/g, '').substring(0, 14) : '';
|
|
27
25
|
}
|
|
26
|
+
|
|
28
27
|
/**
|
|
29
28
|
* This function takes in a string representing a Brazilian CNPJ number and returns a boolean indicating whether the number is valid or not.
|
|
30
29
|
* @param {string} cnpj - The string representing the Brazilian CNPJ number.
|
|
31
30
|
* @returns {boolean} - A boolean indicating whether the CNPJ number is valid or not.
|
|
32
31
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
32
|
function validateCNPJ(cnpj) {
|
|
36
33
|
var sanitizedCnpj = sanitizeCNPJ(cnpj);
|
|
37
|
-
|
|
38
34
|
if (sanitizedCnpj.length === 14) {
|
|
39
35
|
var digits = [0, 0];
|
|
40
|
-
|
|
41
36
|
for (var i = 0; i < 12; i++) {
|
|
42
37
|
digits[0] += Number(sanitizedCnpj[11 - i]) * (i % 8 + 2);
|
|
43
38
|
digits[1] += Number(sanitizedCnpj[11 - i]) * ((i + 1) % 8 + 2);
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
digits[0] = digits[0] % 11;
|
|
47
41
|
if (digits[0] > 1) digits[0] = 11 - digits[0];else digits[0] = 0;
|
|
48
42
|
digits[1] = (digits[1] + digits[0] * 2) % 11;
|
|
49
43
|
if (digits[1] > 1) digits[1] = 11 - digits[1];else digits[1] = 0;
|
|
50
44
|
return sanitizedCnpj[12] === digits[0].toString() && sanitizedCnpj[13] === digits[1].toString();
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
return false;
|
|
54
47
|
}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.hexToHsl = hexToHsl;
|
|
7
7
|
exports.hslToHex = hslToHex;
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* Converts a hexadecimal color code to HSL (Hue, Saturation, Luminance) format.
|
|
11
10
|
* @param {string} hex - The hexadecimal color code to convert.
|
|
@@ -14,7 +13,6 @@ exports.hslToHex = hslToHex;
|
|
|
14
13
|
function hexToHsl(hex) {
|
|
15
14
|
// Extract the red, green, and blue values from the hexadecimal color code.
|
|
16
15
|
var r, g, b;
|
|
17
|
-
|
|
18
16
|
if (hex.length === 4) {
|
|
19
17
|
r = parseInt('0x' + hex[1] + hex[1]);
|
|
20
18
|
g = parseInt('0x' + hex[2] + hex[2]);
|
|
@@ -23,16 +21,17 @@ function hexToHsl(hex) {
|
|
|
23
21
|
r = parseInt('0x' + hex[1] + hex[2]);
|
|
24
22
|
g = parseInt('0x' + hex[3] + hex[4]);
|
|
25
23
|
b = parseInt('0x' + hex[5] + hex[6]);
|
|
26
|
-
}
|
|
27
|
-
|
|
24
|
+
}
|
|
28
25
|
|
|
26
|
+
// Convert the RGB values to the 0-1 range and calculate the minimum, maximum, and delta values.
|
|
29
27
|
r /= 255;
|
|
30
28
|
g /= 255;
|
|
31
29
|
b /= 255;
|
|
32
30
|
var cmin = Math.min(r, g, b);
|
|
33
31
|
var cmax = Math.max(r, g, b);
|
|
34
|
-
var delta = cmax - cmin;
|
|
32
|
+
var delta = cmax - cmin;
|
|
35
33
|
|
|
34
|
+
// Calculate the hue, saturation, and luminance values based on the RGB values.
|
|
36
35
|
var h, s, l;
|
|
37
36
|
if (delta === 0) h = 0;else if (cmax === r) h = (g - b) / delta % 6;else if (cmax === g) h = (b - r) / delta + 2;else h = (r - g) / delta + 4;
|
|
38
37
|
h = Math.round(h * 60);
|
|
@@ -40,14 +39,16 @@ function hexToHsl(hex) {
|
|
|
40
39
|
l = (cmax + cmin) / 2;
|
|
41
40
|
s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
42
41
|
s = +(s * 100).toFixed(1);
|
|
43
|
-
l = +(l * 100).toFixed(1);
|
|
42
|
+
l = +(l * 100).toFixed(1);
|
|
44
43
|
|
|
44
|
+
// Return the HSL values as an object.
|
|
45
45
|
return {
|
|
46
46
|
hue: h,
|
|
47
47
|
saturation: s,
|
|
48
48
|
luminance: l
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
+
|
|
51
52
|
/**
|
|
52
53
|
* Converts HSL color values to a hex string representation.
|
|
53
54
|
*
|
|
@@ -56,56 +57,54 @@ function hexToHsl(hex) {
|
|
|
56
57
|
* @param {number} l - The lightness value (from 0 to 100).
|
|
57
58
|
* @returns {string} The hex string representation of the HSL color.
|
|
58
59
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
60
|
function hslToHex(h, s, l) {
|
|
62
61
|
// Convert saturation and lightness to values between 0 and 1.
|
|
63
62
|
s /= 100;
|
|
64
|
-
l /= 100;
|
|
63
|
+
l /= 100;
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
// Calculate chroma, which is the difference between the max and min values.
|
|
66
|
+
var c = (1 - Math.abs(2 * l - 1)) * s;
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
// Calculate the intermediate value x.
|
|
69
|
+
var x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
// Calculate the lightness adjustment factor.
|
|
72
|
+
var m = l - c / 2;
|
|
71
73
|
|
|
74
|
+
// Initialize RGB values.
|
|
72
75
|
var r = 0;
|
|
73
76
|
var g = 0;
|
|
74
|
-
var b = 0;
|
|
77
|
+
var b = 0;
|
|
75
78
|
|
|
79
|
+
// Calculate RGB values based on the current hue.
|
|
76
80
|
switch (Math.floor(h / 60)) {
|
|
77
81
|
case 0:
|
|
78
82
|
r = c;
|
|
79
83
|
g = x;
|
|
80
84
|
break;
|
|
81
|
-
|
|
82
85
|
case 1:
|
|
83
86
|
r = x;
|
|
84
87
|
g = c;
|
|
85
88
|
break;
|
|
86
|
-
|
|
87
89
|
case 2:
|
|
88
90
|
g = c;
|
|
89
91
|
b = x;
|
|
90
92
|
break;
|
|
91
|
-
|
|
92
93
|
case 3:
|
|
93
94
|
g = x;
|
|
94
95
|
b = c;
|
|
95
96
|
break;
|
|
96
|
-
|
|
97
97
|
case 4:
|
|
98
98
|
r = x;
|
|
99
99
|
b = c;
|
|
100
100
|
break;
|
|
101
|
-
|
|
102
101
|
case 5:
|
|
103
102
|
r = c;
|
|
104
103
|
b = x;
|
|
105
104
|
break;
|
|
106
|
-
}
|
|
107
|
-
|
|
105
|
+
}
|
|
108
106
|
|
|
107
|
+
// Convert the RGB values to a hex string.
|
|
109
108
|
var hexValue = (r + m) * 255 << 16 | (g + m) * 255 << 8 | (b + m) * 255;
|
|
110
109
|
return '#' + hexValue.toString(16).padStart(6, '0');
|
|
111
110
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.formatCPF = formatCPF;
|
|
7
7
|
exports.sanitizeCPF = sanitizeCPF;
|
|
8
8
|
exports.validateCPF = validateCPF;
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* Formats a CPF string to a standard format.
|
|
12
11
|
* @param {string} cpf - The CPF string to format.
|
|
@@ -14,88 +13,82 @@ exports.validateCPF = validateCPF;
|
|
|
14
13
|
*/
|
|
15
14
|
function formatCPF(cpf) {
|
|
16
15
|
// Initialize an empty string to store the formatted CPF
|
|
17
|
-
var result = '';
|
|
16
|
+
var result = '';
|
|
18
17
|
|
|
18
|
+
// Check if a CPF string was provided
|
|
19
19
|
if (cpf) {
|
|
20
20
|
// Remove any non-numeric characters from the string and take the first 11 digits
|
|
21
|
-
var sanitizedCpf = cpf.replace(/[^\d*]/g, '').substring(0, 11);
|
|
21
|
+
var sanitizedCpf = cpf.replace(/[^\d*]/g, '').substring(0, 11);
|
|
22
22
|
|
|
23
|
+
// Loop through the sanitized CPF string and add formatting characters in the appropriate positions
|
|
23
24
|
for (var i = 0, n = Math.min(sanitizedCpf.length, 11); i < n; i++) {
|
|
24
25
|
result += sanitizedCpf[i];
|
|
25
|
-
|
|
26
26
|
if (i + 1 < n) {
|
|
27
27
|
if (i === 2 || i === 5) result += '.';else if (i === 8) result += '-';
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
30
|
+
}
|
|
32
31
|
|
|
32
|
+
// Return the formatted CPF string
|
|
33
33
|
return result;
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
/**
|
|
36
37
|
* Sanitizes a CPF string by removing all non-numeric characters and taking only the first 11 digits.
|
|
37
38
|
* @param {string} cpf - The CPF string to sanitize.
|
|
38
39
|
* @returns {string} The sanitized CPF string.
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
41
|
function sanitizeCPF(cpf) {
|
|
43
42
|
// Return an empty string if no CPF was provided
|
|
44
43
|
if (!cpf) {
|
|
45
44
|
return '';
|
|
46
|
-
}
|
|
47
|
-
|
|
45
|
+
}
|
|
48
46
|
|
|
47
|
+
// Remove all non-numeric characters from the string and take the first 11 digits
|
|
49
48
|
return cpf.replace(/\D/g, '').substring(0, 11);
|
|
50
49
|
}
|
|
50
|
+
|
|
51
51
|
/**
|
|
52
52
|
* Validates a CPF string using the Brazilian CPF algorithm.
|
|
53
53
|
* @param {string} cpf - The CPF string to validate.
|
|
54
54
|
* @returns {boolean} True if the CPF is valid, false otherwise.
|
|
55
55
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
56
|
function validateCPF(cpf) {
|
|
59
57
|
// Sanitize the CPF string by removing all non-numeric characters and taking only the first 11 digits
|
|
60
|
-
var sanitizedCpf = sanitizeCPF(cpf);
|
|
58
|
+
var sanitizedCpf = sanitizeCPF(cpf);
|
|
61
59
|
|
|
60
|
+
// Return true if no CPF was provided
|
|
62
61
|
if (sanitizedCpf.length === 0) {
|
|
63
62
|
return true;
|
|
64
|
-
}
|
|
65
|
-
|
|
63
|
+
}
|
|
66
64
|
|
|
65
|
+
// Check if all digits in the CPF are the same
|
|
67
66
|
if (/^(\d)\1+$/.test(sanitizedCpf)) {
|
|
68
67
|
return false;
|
|
69
|
-
}
|
|
70
|
-
|
|
68
|
+
}
|
|
71
69
|
|
|
70
|
+
// Validate the CPF using the Brazilian CPF algorithm
|
|
72
71
|
if (sanitizedCpf.length === 11) {
|
|
73
72
|
var digits = [0, 0];
|
|
74
|
-
|
|
75
73
|
for (var i = 0; i < 9; i++) {
|
|
76
74
|
digits[0] += Number(sanitizedCpf[i]) * (10 - i);
|
|
77
75
|
digits[1] += Number(sanitizedCpf[i]) * (11 - i);
|
|
78
76
|
}
|
|
79
|
-
|
|
80
77
|
digits[0] = digits[0] % 11;
|
|
81
|
-
|
|
82
78
|
if (digits[0] > 1) {
|
|
83
79
|
digits[0] = 11 - digits[0];
|
|
84
80
|
} else {
|
|
85
81
|
digits[0] = 0;
|
|
86
82
|
}
|
|
87
|
-
|
|
88
83
|
digits[1] = (digits[1] + digits[0] * 2) % 11;
|
|
89
|
-
|
|
90
84
|
if (digits[1] > 1) {
|
|
91
85
|
digits[1] = 11 - digits[1];
|
|
92
86
|
} else {
|
|
93
87
|
digits[1] = 0;
|
|
94
88
|
}
|
|
95
|
-
|
|
96
89
|
return sanitizedCpf[9] === digits[0].toString() && sanitizedCpf[10] === digits[1].toString();
|
|
97
|
-
}
|
|
98
|
-
|
|
90
|
+
}
|
|
99
91
|
|
|
92
|
+
// Return false if the CPF is not valid
|
|
100
93
|
return false;
|
|
101
94
|
}
|
|
@@ -7,7 +7,6 @@ exports.formatCreditCardExpirationDate = formatCreditCardExpirationDate;
|
|
|
7
7
|
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
8
8
|
exports.sanitizeCreditCardNumber = sanitizeCreditCardNumber;
|
|
9
9
|
exports.validateCreditCardExpirationDate = validateCreditCardExpirationDate;
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Format a credit card number by adding spaces after every four digits, up to a maximum of 19 characters.
|
|
13
12
|
* @param {string} creditCardNumber - The credit card number to format
|
|
@@ -21,8 +20,6 @@ function formatCreditCardNumber(creditCardNumber) {
|
|
|
21
20
|
* @param {string} creditCardNumber - The credit card number to sanitize
|
|
22
21
|
* @returns {string} The sanitized credit card number
|
|
23
22
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
23
|
function sanitizeCreditCardNumber(creditCardNumber) {
|
|
27
24
|
return creditCardNumber ? creditCardNumber.replace(/\D/g, '').replace(/^0+/, '') : '';
|
|
28
25
|
}
|
|
@@ -31,50 +28,40 @@ function sanitizeCreditCardNumber(creditCardNumber) {
|
|
|
31
28
|
* @param {string} value - The expiration date to format
|
|
32
29
|
* @returns {string} The formatted expiration date
|
|
33
30
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
31
|
function formatCreditCardExpirationDate(value) {
|
|
37
32
|
var month = value.replace(/\D/g, '').substring(0, 2);
|
|
38
33
|
var year = value.replace(/\D/g, '').substring(2, 6);
|
|
39
34
|
return month + (value.length > 2 ? '/' : '') + year;
|
|
40
35
|
}
|
|
36
|
+
|
|
41
37
|
/**
|
|
42
38
|
* Validate a credit card expiration date by checking if it is a valid date in the future.
|
|
43
39
|
* @param {string} value - The expiration date to validate
|
|
44
40
|
* @param {CreditCardOptions} options - An object containing the following properties: monthErrorMessage, yearErrorMessage, dateErrorMessage
|
|
45
41
|
* @returns {boolean | string} true if the expiration date is valid, or an error message otherwise
|
|
46
42
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
43
|
function validateCreditCardExpirationDate(value, _ref) {
|
|
50
44
|
var _ref$monthErrorMessag = _ref.monthErrorMessage,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
monthErrorMessage = _ref$monthErrorMessag === void 0 ? 'Please enter a valid month' : _ref$monthErrorMessag,
|
|
46
|
+
_ref$yearErrorMessage = _ref.yearErrorMessage,
|
|
47
|
+
yearErrorMessage = _ref$yearErrorMessage === void 0 ? 'Please enter a valid year' : _ref$yearErrorMessage,
|
|
48
|
+
_ref$dateErrorMessage = _ref.dateErrorMessage,
|
|
49
|
+
dateErrorMessage = _ref$dateErrorMessage === void 0 ? 'Please enter a valid date' : _ref$dateErrorMessage;
|
|
57
50
|
if (value.length === 0) {
|
|
58
51
|
return true;
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
var month = value.substring(0, 2);
|
|
62
54
|
var year = value.substring(3, 7);
|
|
63
|
-
|
|
64
55
|
if (month.length === 2 && (Number(month) < 1 || Number(month) > 12)) {
|
|
65
56
|
return monthErrorMessage;
|
|
66
57
|
}
|
|
67
|
-
|
|
68
58
|
if (year.length === 0 || year.length < 4 && Number(year) < new Date().getFullYear()) {
|
|
69
59
|
return yearErrorMessage;
|
|
70
60
|
}
|
|
71
|
-
|
|
72
61
|
var validateDate = new Date(Number(year), Number(month) - 1, 1);
|
|
73
62
|
var today = new Date();
|
|
74
|
-
|
|
75
63
|
if (validateDate < today && validateDate.getMonth() !== today.getMonth()) {
|
|
76
64
|
return dateErrorMessage;
|
|
77
65
|
}
|
|
78
|
-
|
|
79
66
|
return true;
|
|
80
67
|
}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _bytes = require("./bytes");
|
|
8
|
-
|
|
9
7
|
Object.keys(_bytes).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _bytes[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_bytes).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _capitalize = require("./capitalize");
|
|
21
|
-
|
|
22
18
|
Object.keys(_capitalize).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _capitalize[key]) return;
|
|
@@ -29,9 +25,7 @@ Object.keys(_capitalize).forEach(function (key) {
|
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
});
|
|
32
|
-
|
|
33
28
|
var _cep = require("./cep");
|
|
34
|
-
|
|
35
29
|
Object.keys(_cep).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
37
31
|
if (key in exports && exports[key] === _cep[key]) return;
|
|
@@ -42,9 +36,7 @@ Object.keys(_cep).forEach(function (key) {
|
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
38
|
});
|
|
45
|
-
|
|
46
39
|
var _cnpj = require("./cnpj");
|
|
47
|
-
|
|
48
40
|
Object.keys(_cnpj).forEach(function (key) {
|
|
49
41
|
if (key === "default" || key === "__esModule") return;
|
|
50
42
|
if (key in exports && exports[key] === _cnpj[key]) return;
|
|
@@ -55,9 +47,7 @@ Object.keys(_cnpj).forEach(function (key) {
|
|
|
55
47
|
}
|
|
56
48
|
});
|
|
57
49
|
});
|
|
58
|
-
|
|
59
50
|
var _color = require("./color");
|
|
60
|
-
|
|
61
51
|
Object.keys(_color).forEach(function (key) {
|
|
62
52
|
if (key === "default" || key === "__esModule") return;
|
|
63
53
|
if (key in exports && exports[key] === _color[key]) return;
|
|
@@ -68,9 +58,7 @@ Object.keys(_color).forEach(function (key) {
|
|
|
68
58
|
}
|
|
69
59
|
});
|
|
70
60
|
});
|
|
71
|
-
|
|
72
61
|
var _cpf = require("./cpf");
|
|
73
|
-
|
|
74
62
|
Object.keys(_cpf).forEach(function (key) {
|
|
75
63
|
if (key === "default" || key === "__esModule") return;
|
|
76
64
|
if (key in exports && exports[key] === _cpf[key]) return;
|
|
@@ -81,9 +69,7 @@ Object.keys(_cpf).forEach(function (key) {
|
|
|
81
69
|
}
|
|
82
70
|
});
|
|
83
71
|
});
|
|
84
|
-
|
|
85
72
|
var _creditCard = require("./credit-card");
|
|
86
|
-
|
|
87
73
|
Object.keys(_creditCard).forEach(function (key) {
|
|
88
74
|
if (key === "default" || key === "__esModule") return;
|
|
89
75
|
if (key in exports && exports[key] === _creditCard[key]) return;
|
|
@@ -94,9 +80,7 @@ Object.keys(_creditCard).forEach(function (key) {
|
|
|
94
80
|
}
|
|
95
81
|
});
|
|
96
82
|
});
|
|
97
|
-
|
|
98
83
|
var _email = require("./email");
|
|
99
|
-
|
|
100
84
|
Object.keys(_email).forEach(function (key) {
|
|
101
85
|
if (key === "default" || key === "__esModule") return;
|
|
102
86
|
if (key in exports && exports[key] === _email[key]) return;
|
|
@@ -107,9 +91,7 @@ Object.keys(_email).forEach(function (key) {
|
|
|
107
91
|
}
|
|
108
92
|
});
|
|
109
93
|
});
|
|
110
|
-
|
|
111
94
|
var _name = require("./name");
|
|
112
|
-
|
|
113
95
|
Object.keys(_name).forEach(function (key) {
|
|
114
96
|
if (key === "default" || key === "__esModule") return;
|
|
115
97
|
if (key in exports && exports[key] === _name[key]) return;
|
|
@@ -120,9 +102,7 @@ Object.keys(_name).forEach(function (key) {
|
|
|
120
102
|
}
|
|
121
103
|
});
|
|
122
104
|
});
|
|
123
|
-
|
|
124
105
|
var _number = require("./number");
|
|
125
|
-
|
|
126
106
|
Object.keys(_number).forEach(function (key) {
|
|
127
107
|
if (key === "default" || key === "__esModule") return;
|
|
128
108
|
if (key in exports && exports[key] === _number[key]) return;
|
|
@@ -133,9 +113,7 @@ Object.keys(_number).forEach(function (key) {
|
|
|
133
113
|
}
|
|
134
114
|
});
|
|
135
115
|
});
|
|
136
|
-
|
|
137
116
|
var _passport = require("./passport");
|
|
138
|
-
|
|
139
117
|
Object.keys(_passport).forEach(function (key) {
|
|
140
118
|
if (key === "default" || key === "__esModule") return;
|
|
141
119
|
if (key in exports && exports[key] === _passport[key]) return;
|
|
@@ -146,9 +124,7 @@ Object.keys(_passport).forEach(function (key) {
|
|
|
146
124
|
}
|
|
147
125
|
});
|
|
148
126
|
});
|
|
149
|
-
|
|
150
127
|
var _phone = require("./phone");
|
|
151
|
-
|
|
152
128
|
Object.keys(_phone).forEach(function (key) {
|
|
153
129
|
if (key === "default" || key === "__esModule") return;
|
|
154
130
|
if (key in exports && exports[key] === _phone[key]) return;
|
|
@@ -159,9 +135,7 @@ Object.keys(_phone).forEach(function (key) {
|
|
|
159
135
|
}
|
|
160
136
|
});
|
|
161
137
|
});
|
|
162
|
-
|
|
163
138
|
var _price = require("./price");
|
|
164
|
-
|
|
165
139
|
Object.keys(_price).forEach(function (key) {
|
|
166
140
|
if (key === "default" || key === "__esModule") return;
|
|
167
141
|
if (key in exports && exports[key] === _price[key]) return;
|
|
@@ -172,9 +146,7 @@ Object.keys(_price).forEach(function (key) {
|
|
|
172
146
|
}
|
|
173
147
|
});
|
|
174
148
|
});
|
|
175
|
-
|
|
176
149
|
var _rg = require("./rg");
|
|
177
|
-
|
|
178
150
|
Object.keys(_rg).forEach(function (key) {
|
|
179
151
|
if (key === "default" || key === "__esModule") return;
|
|
180
152
|
if (key in exports && exports[key] === _rg[key]) return;
|
|
@@ -185,9 +157,7 @@ Object.keys(_rg).forEach(function (key) {
|
|
|
185
157
|
}
|
|
186
158
|
});
|
|
187
159
|
});
|
|
188
|
-
|
|
189
160
|
var _strings = require("./strings");
|
|
190
|
-
|
|
191
161
|
Object.keys(_strings).forEach(function (key) {
|
|
192
162
|
if (key === "default" || key === "__esModule") return;
|
|
193
163
|
if (key in exports && exports[key] === _strings[key]) return;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.formatName = formatName;
|
|
7
7
|
exports.nameIsValid = nameIsValid;
|
|
8
8
|
exports.removeSpaces = removeSpaces;
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* Remove spaces at the start and end of the string
|
|
12
11
|
* @param {string} name - The name to remove spaces from
|
|
@@ -20,8 +19,6 @@ function removeSpaces(name) {
|
|
|
20
19
|
* @param {string} name - The name to format
|
|
21
20
|
* @returns {string} The formatted name
|
|
22
21
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
22
|
function formatName(name) {
|
|
26
23
|
if (!name) return '';
|
|
27
24
|
return String(name).replace(/\s+/g, ' ');
|
|
@@ -32,11 +29,9 @@ function formatName(name) {
|
|
|
32
29
|
* @param {NameOptions} options - An object containing the following properties: characterErrorMessage (default: 'The character(s) "{0}" is(are) not allowed.')
|
|
33
30
|
* @returns {boolean|string} true if the name is valid, otherwise an error message
|
|
34
31
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
32
|
function nameIsValid(name, _ref) {
|
|
38
33
|
var _ref$errorMessage = _ref.errorMessage,
|
|
39
|
-
|
|
34
|
+
errorMessage = _ref$errorMessage === void 0 ? 'The character(s) "{0}" is(are) not allowed.' : _ref$errorMessage;
|
|
40
35
|
if (name.length === 1 && name.match(/[\u0300-\u036f]/)) return false;
|
|
41
36
|
var regex = /([a-zA-Z]|[à-ü]|[À-Ü]|\s|')/g;
|
|
42
37
|
var match = name.match(regex);
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.sanitizeNumber = sanitizeNumber;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Sanitizes the input number string by removing non-numeric characters, converting commas to dots for decimal separation, and removing excess dots
|
|
10
9
|
* @param {string} number - Input string to sanitize
|
|
@@ -7,7 +7,6 @@ exports.formatPassport = formatPassport;
|
|
|
7
7
|
exports.formatPassportDocument = formatPassportDocument;
|
|
8
8
|
exports.sanitizePassport = sanitizePassport;
|
|
9
9
|
exports.validatePassport = validatePassport;
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Formats passport document string to upper case.
|
|
13
12
|
* @param {string} passport - Passport document string.
|
|
@@ -17,33 +16,30 @@ function formatPassportDocument(passport) {
|
|
|
17
16
|
if (!passport) return '';
|
|
18
17
|
return passport.toUpperCase();
|
|
19
18
|
}
|
|
19
|
+
|
|
20
20
|
/**
|
|
21
21
|
* Formats passport document string by removing non-alphanumeric characters and limits length to 20.
|
|
22
22
|
* @param {string} passport - Passport document string.
|
|
23
23
|
* @returns {string} - Formatted passport string.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
25
|
function formatPassport(passport) {
|
|
28
26
|
return passport.replace(/[^\dA-Za-z]/g, '').substring(0, 20).toUpperCase();
|
|
29
27
|
}
|
|
28
|
+
|
|
30
29
|
/**
|
|
31
30
|
* Sanitizes passport document string by removing non-alphanumeric characters and limits length to 20.
|
|
32
31
|
* @param {string} passport - Passport document string.
|
|
33
32
|
* @returns {string} - Sanitized passport document string.
|
|
34
33
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
34
|
function sanitizePassport(passport) {
|
|
38
35
|
return passport.replace(/[^\dA-Za-z]/g, '').substring(0, 20).toUpperCase();
|
|
39
36
|
}
|
|
37
|
+
|
|
40
38
|
/**
|
|
41
39
|
* Validates passport document string by checking if it starts with 2 letters followed by any number of digits.
|
|
42
40
|
* @param {string} passport - Passport document string.
|
|
43
41
|
* @returns {boolean} - Returns true if passport document is valid, otherwise returns false.
|
|
44
42
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
43
|
function validatePassport(passport) {
|
|
48
44
|
return /^[a-zA-Z]{2}\d*$/.test(passport);
|
|
49
45
|
}
|