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