@tecsinapse/react-core 1.9.0 → 1.10.3

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/components/atoms/Avatar/styled.js +0 -3
  3. package/dist/components/atoms/Avatar/styled.js.map +1 -1
  4. package/dist/components/atoms/BoxContent/styled.d.ts +10 -1
  5. package/dist/components/atoms/BoxContent/styled.js.map +1 -1
  6. package/dist/components/atoms/Button/States/Error.js +2 -2
  7. package/dist/components/atoms/Button/States/Error.js.map +1 -1
  8. package/dist/components/atoms/Button/States/Success.js +2 -2
  9. package/dist/components/atoms/Button/States/Success.js.map +1 -1
  10. package/dist/components/atoms/GroupButton/GroupButton.d.ts +2 -1
  11. package/dist/components/atoms/GroupButton/GroupButton.js +3 -2
  12. package/dist/components/atoms/GroupButton/GroupButton.js.map +1 -1
  13. package/dist/components/atoms/GroupButton/GroupButtonOption.d.ts +2 -2
  14. package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
  15. package/dist/components/atoms/GroupButton/styled.d.ts +1 -1
  16. package/dist/components/atoms/GroupButton/styled.js +8 -0
  17. package/dist/components/atoms/GroupButton/styled.js.map +1 -1
  18. package/dist/components/atoms/Input/InputElement/InputElement.d.ts +5 -4
  19. package/dist/components/atoms/Input/InputElement/InputElement.js +5 -3
  20. package/dist/components/atoms/Input/InputElement/InputElement.js.map +1 -1
  21. package/dist/components/atoms/Input/hooks/useCurrencyMask.d.ts +2 -2
  22. package/dist/components/atoms/Input/hooks/useCurrencyMask.js.map +1 -1
  23. package/dist/components/atoms/Input/hooks/useMask.d.ts +5 -5
  24. package/dist/components/atoms/Input/hooks/useMask.js +1 -1
  25. package/dist/components/atoms/Input/hooks/useMask.js.map +1 -1
  26. package/dist/components/atoms/Input/masks/index.js +1 -1
  27. package/dist/components/atoms/Input/masks/index.js.map +1 -1
  28. package/dist/components/atoms/Switch/Switch.d.ts +1 -0
  29. package/dist/components/atoms/Switch/Switch.js +10 -4
  30. package/dist/components/atoms/Switch/Switch.js.map +1 -1
  31. package/dist/components/atoms/Switch/animation.d.ts +2 -1
  32. package/dist/components/atoms/Switch/animation.js.map +1 -1
  33. package/dist/components/atoms/Tag/Tag.js +2 -2
  34. package/dist/components/atoms/Tag/Tag.js.map +1 -1
  35. package/dist/components/molecules/Calendar/Calendar.d.ts +1 -1
  36. package/dist/components/molecules/Calendar/Calendar.js +35 -156
  37. package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
  38. package/dist/components/molecules/Calendar/components/MonthWeek.d.ts +13 -0
  39. package/dist/components/molecules/Calendar/components/MonthWeek.js +152 -0
  40. package/dist/components/molecules/Calendar/components/MonthWeek.js.map +1 -0
  41. package/dist/components/molecules/Calendar/components/Weekdays.d.ts +8 -0
  42. package/dist/components/molecules/Calendar/components/Weekdays.js +41 -0
  43. package/dist/components/molecules/Calendar/components/Weekdays.js.map +1 -0
  44. package/dist/components/molecules/Calendar/components/index.d.ts +2 -0
  45. package/dist/components/molecules/Calendar/components/index.js +24 -0
  46. package/dist/components/molecules/Calendar/components/index.js.map +1 -0
  47. package/dist/components/molecules/DatePicker/Modal.js.map +1 -1
  48. package/dist/components/molecules/DatePicker/styled.d.ts +4 -25
  49. package/dist/components/molecules/DatePicker/styled.js.map +1 -1
  50. package/dist/components/molecules/HintInputContainer/HintInputContainer.d.ts +1 -2
  51. package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
  52. package/dist/hooks/useTheme.js.map +1 -1
  53. package/dist/index.d.ts +1 -1
  54. package/dist/index.js +14 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/utils/extractNumbersFromString.d.ts +1 -0
  57. package/dist/utils/extractNumbersFromString.js +5 -1
  58. package/dist/utils/extractNumbersFromString.js.map +1 -1
  59. package/dist/utils/index.d.ts +1 -1
  60. package/dist/utils/index.js +6 -0
  61. package/dist/utils/index.js.map +1 -1
  62. package/dist/utils/lightenDarkenColor.js +5 -5
  63. package/dist/utils/lightenDarkenColor.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/components/atoms/Avatar/styled.ts +0 -1
  66. package/src/components/atoms/BoxContent/styled.ts +1 -1
  67. package/src/components/atoms/Button/States/Error.tsx +1 -1
  68. package/src/components/atoms/Button/States/Success.tsx +1 -1
  69. package/src/components/atoms/GroupButton/GroupButton.tsx +6 -4
  70. package/src/components/atoms/GroupButton/GroupButtonOption.tsx +3 -3
  71. package/src/components/atoms/GroupButton/styled.ts +13 -1
  72. package/src/components/atoms/Input/InputElement/InputElement.tsx +36 -27
  73. package/src/components/atoms/Input/hooks/useCurrencyMask.ts +4 -5
  74. package/src/components/atoms/Input/hooks/useMask.ts +10 -9
  75. package/src/components/atoms/Input/masks/index.ts +1 -1
  76. package/src/components/atoms/Switch/Switch.stories.tsx +2 -1
  77. package/src/components/atoms/Switch/Switch.tsx +17 -6
  78. package/src/components/atoms/Switch/animation.ts +5 -1
  79. package/src/components/atoms/Tag/Tag.tsx +2 -2
  80. package/src/components/molecules/Calendar/Calendar.tsx +60 -162
  81. package/src/components/molecules/Calendar/components/MonthWeek.tsx +144 -0
  82. package/src/components/molecules/Calendar/components/Weekdays.tsx +34 -0
  83. package/src/components/molecules/Calendar/components/index.ts +2 -0
  84. package/src/components/molecules/DatePicker/Modal.tsx +1 -1
  85. package/src/components/molecules/DatePicker/styled.ts +1 -2
  86. package/src/components/molecules/HintInputContainer/HintInputContainer.tsx +1 -2
  87. package/src/hooks/useTheme.ts +1 -1
  88. package/src/index.ts +2 -0
  89. package/src/utils/extractNumbersFromString.ts +6 -0
  90. package/src/utils/index.ts +4 -1
  91. package/src/utils/lightenDarkenColor.ts +5 -5
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Weekdays", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Weekdays.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "MonthWeek", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _MonthWeek.default;
16
+ }
17
+ });
18
+
19
+ var _Weekdays = _interopRequireDefault(require("./Weekdays"));
20
+
21
+ var _MonthWeek = _interopRequireDefault(require("./MonthWeek"));
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/molecules/Calendar/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { default as Weekdays } from './Weekdays';\nexport { default as MonthWeek } from './MonthWeek';\n"],"file":"index.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DatePicker/Modal.tsx"],"names":["Component","type","value","onRequestClose","month","year","onChange","CalendarComponent","Calendar","bottomOffset","locale","modalProps","Modal"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAOA,MAAMA,SAAS,GAAG,CAA0B;AAC1CC,EAAAA,IAD0C;AAE1CC,EAAAA,KAF0C;AAG1CC,EAAAA,cAH0C;AAI1CC,EAAAA,KAJ0C;AAK1CC,EAAAA,IAL0C;AAM1CC,EAAAA,QAN0C;AAO1CC,EAAAA,iBAAiB,GAAGC,kBAPsB;AAQ1CC,EAAAA,YAAY,GAAG,CAR2B;AAS1CC,EAAAA,MAT0C;AAU1C,KAAGC;AAVuC,CAA1B,KAW6C;AAC7D,SACE,oBAAC,kBAAD;AACE,IAAA,WAAW,MADb;AAEE,IAAA,mBAAmB,MAFrB;AAGE,IAAA,oBAAoB;AAHtB,KAIMA,UAJN;AAKE,IAAA,cAAc,EAAER;AALlB,MAOE,oBAAC,gBAAD;AAAU,IAAA,OAAO,EAAEA,cAAnB;AAAmC,IAAA,MAAM,EAAC;AAA1C,KACE,oBAAC,oBAAD;AAAc,IAAA,MAAM,EAAEM;AAAtB,KACE,oBAAC,iBAAD;AACE,IAAA,aAAa,EAAE,UADjB;AAEE,IAAA,IAAI,EAAER,IAFR;AAGE,IAAA,KAAK,EAAEC,KAHT;AAIE,IAAA,KAAK,EAAEE,KAJT;AAKE,IAAA,IAAI,EAAEC,IALR;AAME,IAAA,QAAQ,EAAEC,QANZ;AAOE,IAAA,MAAM,EAAEI;AAPV,IADF,CADF,CAPF,CADF;AAuBD,CAnCD;;AAqCO,MAAME,KAAK,GAAGZ,SAAd","sourcesContent":["import * as React from 'react';\nimport { Modal as RNModal, ModalProps } from 'react-native';\nimport { Calendar, CalendarProps, SelectionType } from '../Calendar';\nimport { Backdrop, ModalContent } from './styled';\n\nexport interface DatePickerModalProps<T extends SelectionType> {\n CalendarComponent?: React.FC<CalendarProps<T>>;\n bottomOffset?: number;\n}\n\nconst Component = <T extends SelectionType>({\n type,\n value,\n onRequestClose,\n month,\n year,\n onChange,\n CalendarComponent = Calendar,\n bottomOffset = 0,\n locale,\n ...modalProps\n}: CalendarProps<T> & ModalProps & DatePickerModalProps<T>) => {\n return (\n <RNModal\n transparent\n hardwareAccelerated\n statusBarTranslucent\n {...modalProps}\n onRequestClose={onRequestClose}\n >\n <Backdrop onPress={onRequestClose} effect=\"none\">\n <ModalContent offset={bottomOffset}>\n <CalendarComponent\n pointerEvents={'box-none'}\n type={type}\n value={value}\n month={month}\n year={year}\n onChange={onChange}\n locale={locale}\n />\n </ModalContent>\n </Backdrop>\n </RNModal>\n );\n};\n\nexport const Modal = Component;\n"],"file":"Modal.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DatePicker/Modal.tsx"],"names":["Component","type","value","onRequestClose","month","year","onChange","CalendarComponent","Calendar","bottomOffset","locale","modalProps","Modal"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAOA,MAAMA,SAAS,GAAG,CAA0B;AAC1CC,EAAAA,IAD0C;AAE1CC,EAAAA,KAF0C;AAG1CC,EAAAA,cAH0C;AAI1CC,EAAAA,KAJ0C;AAK1CC,EAAAA,IAL0C;AAM1CC,EAAAA,QAN0C;AAO1CC,EAAAA,iBAAiB,GAAGC,kBAPsB;AAQ1CC,EAAAA,YAAY,GAAG,CAR2B;AAS1CC,EAAAA,MAT0C;AAU1C,KAAGC;AAVuC,CAA1B,KAW0D;AAC1E,SACE,oBAAC,kBAAD;AACE,IAAA,WAAW,MADb;AAEE,IAAA,mBAAmB,MAFrB;AAGE,IAAA,oBAAoB;AAHtB,KAIMA,UAJN;AAKE,IAAA,cAAc,EAAER;AALlB,MAOE,oBAAC,gBAAD;AAAU,IAAA,OAAO,EAAEA,cAAnB;AAAmC,IAAA,MAAM,EAAC;AAA1C,KACE,oBAAC,oBAAD;AAAc,IAAA,MAAM,EAAEM;AAAtB,KACE,oBAAC,iBAAD;AACE,IAAA,aAAa,EAAE,UADjB;AAEE,IAAA,IAAI,EAAER,IAFR;AAGE,IAAA,KAAK,EAAEC,KAHT;AAIE,IAAA,KAAK,EAAEE,KAJT;AAKE,IAAA,IAAI,EAAEC,IALR;AAME,IAAA,QAAQ,EAAEC,QANZ;AAOE,IAAA,MAAM,EAAEI;AAPV,IADF,CADF,CAPF,CADF;AAuBD,CAnCD;;AAqCO,MAAME,KAAK,GAAGZ,SAAd","sourcesContent":["import * as React from 'react';\nimport { Modal as RNModal, ModalProps } from 'react-native';\nimport { Calendar, CalendarProps, SelectionType } from '../Calendar';\nimport { Backdrop, ModalContent } from './styled';\n\nexport interface DatePickerModalProps<T extends SelectionType> {\n CalendarComponent?: React.FC<CalendarProps<T>>;\n bottomOffset?: number;\n}\n\nconst Component = <T extends SelectionType>({\n type,\n value,\n onRequestClose,\n month,\n year,\n onChange,\n CalendarComponent = Calendar,\n bottomOffset = 0,\n locale,\n ...modalProps\n}: CalendarProps<T> & ModalProps & DatePickerModalProps<T>): JSX.Element => {\n return (\n <RNModal\n transparent\n hardwareAccelerated\n statusBarTranslucent\n {...modalProps}\n onRequestClose={onRequestClose}\n >\n <Backdrop onPress={onRequestClose} effect=\"none\">\n <ModalContent offset={bottomOffset}>\n <CalendarComponent\n pointerEvents={'box-none'}\n type={type}\n value={value}\n month={month}\n year={year}\n onChange={onChange}\n locale={locale}\n />\n </ModalContent>\n </Backdrop>\n </RNModal>\n );\n};\n\nexport const Modal = Component;\n"],"file":"Modal.js"}
@@ -1,29 +1,8 @@
1
1
  import { FC } from 'react';
2
- import { InputContainerProps } from '../../atoms/Input';
3
2
  import { TextProps } from '../../atoms/Text';
4
- export declare const Backdrop: import("@emotion/native").StyledComponent<import("../../atoms/PressableSurface").PressableSurfaceProps & {
5
- children?: import("react").ReactNode;
6
- } & {
7
- theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any> | undefined;
9
- } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {}>;
10
- export declare const ModalContent: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
11
- theme?: import("@emotion/react").Theme | undefined;
12
- as?: import("react").ElementType<any> | undefined;
13
- } & {
14
- offset: number;
15
- } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {
3
+ export declare const Backdrop: import("@emotion/native").StyledComponent<any, {}, {}>;
4
+ export declare const ModalContent: import("@emotion/native").StyledComponent<any, {}, {
16
5
  ref?: import("react").Ref<import("react-native").View> | undefined;
17
6
  }>;
18
- export declare const getStyledTextComponent: (component: FC<TextProps>) => import("@emotion/native").StyledComponent<TextProps & {
19
- children?: import("react").ReactNode;
20
- } & {
21
- theme?: import("@emotion/react").Theme | undefined;
22
- as?: import("react").ElementType<any> | undefined;
23
- } & Partial<InputContainerProps> & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {}>;
24
- export declare const CalendarIcon: import("@emotion/native").StyledComponent<import("../../atoms/Icon").IconProps & {
25
- children?: import("react").ReactNode;
26
- } & {
27
- theme?: import("@emotion/react").Theme | undefined;
28
- as?: import("react").ElementType<any> | undefined;
29
- } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {}>;
7
+ export declare const getStyledTextComponent: (component: FC<TextProps>) => import("@emotion/native").StyledComponent<any, {}, {}>;
8
+ export declare const CalendarIcon: import("@emotion/native").StyledComponent<any, {}, {}>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DatePicker/styled.ts"],"names":["isWeb","Platform","OS","Backdrop","PressableSurface","theme","miscellaneous","overlay","ModalContent","styled","View","offset","borderRadius","micro","deca","getStyledTextComponent","component","props","typography","h5","lineHeight","CalendarIcon","Icon","spacing","centi","color","secondary","medium"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AACA;;AAEA;;;;;;AAEA,MAAMA,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;AAEO,MAAMC,QAAQ,GAAG,qBAAOC,kCAAP,CAA8C;AACtE,IAAI,CAAC;AAAEC,EAAAA;AAAF,CAAD,KACAL,KAAK,GACD,gBAAI;AACZ;AACA;AACA,8BAA8B,yBAASK,KAAK,CAACC,aAAN,CAAoBC,OAA7B,EAAsC,GAAtC,CAA2C;AACzE;AACA,SANS,GAOD,gBAAI;AACZ;AACA,8BAA8B,yBAASF,KAAK,CAACC,aAAN,CAAoBC,OAA7B,EAAsC,GAAtC,CAA2C;AACzE;AACA,SAAU;AACV,CAdO;;AAgBA,MAAMC,YAAY,GAAGC,gBAAOC,IAEjC;AACF;AACA,oBAAoB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAiB,GAAEA,MAAO,IAAI;AAClD,IAAI,CAAC;AAAEN,EAAAA,KAAK,EAAE;AAAEO,IAAAA;AAAF;AAAT,CAAD,KAAiC,gBAAI;AACzC,MAAMZ,KAAK,GACF;AACT,uBAAuBY,YAAY,CAACC,KAAM;AAC1C,KAHW,GAIF;AACT,gCAAgCD,YAAY,CAACE,IAAK;AAClD,iCAAiCF,YAAY,CAACE,IAAK;AACnD,KAAM;AACN,GAAI;AACJ;AACA,CAhBO;;;AAkBA,MAAMC,sBAAsB,GAAIC,SAAD,IAA8B;AAClE,SAAO,qBAAOA,SAAP,EACJC,KAAD;AAAA;;AAAA,WAA+D,gBAAI;AACvE,qBADsE,gBACjDA,KAAK,CAACZ,KAD2C,iDACjD,aAAaa,UAAb,CAAwBC,EAAxB,CAA2BC,UAAW;AAC3D,QAAQ,gCAAoBH,KAApB,CAA2B;AACnC,KAHI;AAAA,GADK,CAAP;AAMD,CAPM;;;AASA,MAAMI,YAAY,GAAG,qBAAOC,UAAP,CAAkC;AAC9D,aAAa,CAAC;AAAEjB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACkB,OAAN,CAAcC,KAAM;AAChD,WAAW,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACoB,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AACvD,CAHO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { Platform } from 'react-native';\nimport { StyleProps } from '../../../types/defaults';\nimport { Icon } from '../../atoms/Icon';\nimport { disabledInputStyles, InputContainerProps } from '../../atoms/Input';\nimport { PressableSurface } from '../../atoms/PressableSurface';\nimport { TextProps } from '../../atoms/Text';\nimport { hex2rgba } from '@tecsinapse/react-core';\n\nconst isWeb = Platform.OS === 'web';\n\nexport const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`\n ${({ theme }) =>\n isWeb\n ? css`\n justify-content: center;\n align-items: center;\n background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};\n height: 100vh;\n `\n : css`\n justify-content: flex-end;\n background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};\n height: 100%;\n `}\n`;\n\nexport const ModalContent = styled.View<\n { offset: number } & Partial<StyleProps>\n>`\n background-color: transparent;\n padding-bottom: ${({ offset }) => `${offset}px`};\n ${({ theme: { borderRadius } }) => css`\n ${isWeb\n ? `\n border-radius: ${borderRadius.micro};\n `\n : `\n border-top-left-radius: ${borderRadius.deca};\n border-top-right-radius: ${borderRadius.deca};\n `}\n `}\n overflow: hidden;\n`;\n\nexport const getStyledTextComponent = (component: FC<TextProps>) => {\n return styled(component)(\n (props: Partial<InputContainerProps> & Partial<StyleProps>) => css`\n line-height: ${props.theme?.typography.h5.lineHeight};\n ${disabledInputStyles(props)}\n `\n );\n};\n\nexport const CalendarIcon = styled(Icon)<Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.centi};\n color: ${({ theme }) => theme.color.secondary.medium};\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DatePicker/styled.ts"],"names":["isWeb","Platform","OS","Backdrop","PressableSurface","theme","miscellaneous","overlay","ModalContent","styled","View","offset","borderRadius","micro","deca","getStyledTextComponent","component","props","typography","h5","lineHeight","CalendarIcon","Icon","spacing","centi","color","secondary","medium"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA,MAAMA,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;AAEO,MAAMC,QAAQ,GAAG,qBAAOC,kCAAP,CAA8C;AACtE,IAAI,CAAC;AAAEC,EAAAA;AAAF,CAAD,KACAL,KAAK,GACD,gBAAI;AACZ;AACA;AACA,8BAA8B,yBAASK,KAAK,CAACC,aAAN,CAAoBC,OAA7B,EAAsC,GAAtC,CAA2C;AACzE;AACA,SANS,GAOD,gBAAI;AACZ;AACA,8BAA8B,yBAASF,KAAK,CAACC,aAAN,CAAoBC,OAA7B,EAAsC,GAAtC,CAA2C;AACzE;AACA,SAAU;AACV,CAdO;;AAgBA,MAAMC,YAAY,GAAGC,gBAAOC,IAEjC;AACF;AACA,oBAAoB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAiB,GAAEA,MAAO,IAAI;AAClD,IAAI,CAAC;AAAEN,EAAAA,KAAK,EAAE;AAAEO,IAAAA;AAAF;AAAT,CAAD,KAAiC,gBAAI;AACzC,MAAMZ,KAAK,GACF;AACT,uBAAuBY,YAAY,CAACC,KAAM;AAC1C,KAHW,GAIF;AACT,gCAAgCD,YAAY,CAACE,IAAK;AAClD,iCAAiCF,YAAY,CAACE,IAAK;AACnD,KAAM;AACN,GAAI;AACJ;AACA,CAhBO;;;AAkBA,MAAMC,sBAAsB,GAAIC,SAAD,IAA8B;AAClE,SAAO,qBAAOA,SAAP,EACJC,KAAD;AAAA;;AAAA,WAA+D,gBAAI;AACvE,qBADsE,gBACjDA,KAAK,CAACZ,KAD2C,iDACjD,aAAaa,UAAb,CAAwBC,EAAxB,CAA2BC,UAAW;AAC3D,QAAQ,gCAAoBH,KAApB,CAA2B;AACnC,KAHI;AAAA,GADK,CAAP;AAMD,CAPM;;;AASA,MAAMI,YAAY,GAAG,qBAAOC,UAAP,CAAkC;AAC9D,aAAa,CAAC;AAAEjB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACkB,OAAN,CAAcC,KAAM;AAChD,WAAW,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACoB,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AACvD,CAHO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { Platform } from 'react-native';\nimport { Icon } from '../../atoms/Icon';\nimport { disabledInputStyles, InputContainerProps } from '../../atoms/Input';\nimport { PressableSurface } from '../../atoms/PressableSurface';\nimport { TextProps } from '../../atoms/Text';\nimport { hex2rgba, StyleProps } from '@tecsinapse/react-core';\n\nconst isWeb = Platform.OS === 'web';\n\nexport const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`\n ${({ theme }) =>\n isWeb\n ? css`\n justify-content: center;\n align-items: center;\n background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};\n height: 100vh;\n `\n : css`\n justify-content: flex-end;\n background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};\n height: 100%;\n `}\n`;\n\nexport const ModalContent = styled.View<\n { offset: number } & Partial<StyleProps>\n>`\n background-color: transparent;\n padding-bottom: ${({ offset }) => `${offset}px`};\n ${({ theme: { borderRadius } }) => css`\n ${isWeb\n ? `\n border-radius: ${borderRadius.micro};\n `\n : `\n border-top-left-radius: ${borderRadius.deca};\n border-top-right-radius: ${borderRadius.deca};\n `}\n `}\n overflow: hidden;\n`;\n\nexport const getStyledTextComponent = (component: FC<TextProps>) => {\n return styled(component)(\n (props: Partial<InputContainerProps> & Partial<StyleProps>) => css`\n line-height: ${props.theme?.typography.h5.lineHeight};\n ${disabledInputStyles(props)}\n `\n );\n};\n\nexport const CalendarIcon = styled(Icon)<Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.centi};\n color: ${({ theme }) => theme.color.secondary.medium};\n`;\n"],"file":"styled.js"}
@@ -1,7 +1,6 @@
1
1
  import { InputVariantType, PressableInputContainerProps, TextProps } from '@tecsinapse/react-core';
2
2
  import { StyleProp, ViewStyle } from 'react-native';
3
3
  import * as React from 'react';
4
- import { FC } from 'react';
5
4
  export interface HintInputContainerProps extends PressableInputContainerProps {
6
5
  viewStyle?: StyleProp<ViewStyle>;
7
6
  focused: boolean;
@@ -13,5 +12,5 @@ export interface HintInputContainerProps extends PressableInputContainerProps {
13
12
  variant?: InputVariantType;
14
13
  rightComponent?: JSX.Element;
15
14
  }
16
- declare const HintInputContainer: FC<HintInputContainerProps>;
15
+ declare const HintInputContainer: React.FC<HintInputContainerProps>;
17
16
  export default HintInputContainer;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/HintInputContainer/HintInputContainer.tsx"],"names":["HintInputContainer","viewStyle","onPress","focused","disabled","LabelComponent","variant","rightComponent","children","hint","hintComponent","rest","_hint"],"mappings":";;;;;;;AAAA;;AAOA;;AACA;;;;;;;;AAeA,MAAMA,kBAA+C,GAAG,CAAC;AACvDC,EAAAA,SADuD;AAEvDC,EAAAA,OAFuD;AAGvDC,EAAAA,OAHuD;AAIvDC,EAAAA,QAJuD;AAKvDC,EAAAA,cALuD;AAMvDC,EAAAA,OAAO,GAAG,SAN6C;AAOvDC,EAAAA,cAPuD;AAQvDC,EAAAA,QARuD;AASvDC,EAAAA,IATuD;AAUvDC,EAAAA,aAVuD;AAWvD,KAAGC;AAXoD,CAAD,KAYlD;AACJ,QAAMC,KAAK,GAAGF,aAAa,IACzB,oBAAC,eAAD;AAAM,IAAA,aAAa,EAAEL,cAArB;AAAqC,IAAA,IAAI,EAAEI,IAA3C;AAAiD,IAAA,OAAO,EAAEH;AAA1D,IADF;;AAIA,SACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEL;AAAb,KACE,oBAAC,kCAAD;AACE,IAAA,OAAO,EAAEC,OADX;AAEE,IAAA,OAAO,EAAEC,OAFX;AAGE,IAAA,QAAQ,EAAEC,QAHZ;AAIE,IAAA,cAAc,EAAEC,cAJlB;AAKE,IAAA,OAAO,EAAEC,OALX;AAME,IAAA,cAAc,EAAEC;AANlB,KAOMI,IAPN,GASGH,QATH,CADF,EAYGC,IAAI,IAAIG,KAZX,CADF;AAgBD,CAjCD;;eAmCeZ,kB","sourcesContent":["import {\n Hint,\n InputVariantType,\n PressableInputContainer,\n PressableInputContainerProps,\n TextProps,\n} from '@tecsinapse/react-core';\nimport { StyleProp, View, ViewStyle } from 'react-native';\nimport * as React from 'react';\nimport { FC } from 'react';\n\nexport interface HintInputContainerProps extends PressableInputContainerProps {\n viewStyle?: StyleProp<ViewStyle>;\n focused: boolean;\n LabelComponent?: React.FC<TextProps>;\n onPress?: () => void | never;\n disabled?: boolean;\n hint?: string;\n hintComponent?: JSX.Element;\n variant?: InputVariantType;\n rightComponent?: JSX.Element;\n}\n\nconst HintInputContainer: FC<HintInputContainerProps> = ({\n viewStyle,\n onPress,\n focused,\n disabled,\n LabelComponent,\n variant = 'default',\n rightComponent,\n children,\n hint,\n hintComponent,\n ...rest\n}) => {\n const _hint = hintComponent || (\n <Hint TextComponent={LabelComponent} text={hint} variant={variant} />\n );\n\n return (\n <View style={viewStyle}>\n <PressableInputContainer\n onPress={onPress}\n focused={focused}\n disabled={disabled}\n LabelComponent={LabelComponent}\n variant={variant}\n rightComponent={rightComponent}\n {...rest}\n >\n {children}\n </PressableInputContainer>\n {hint && _hint}\n </View>\n );\n};\n\nexport default HintInputContainer;\n"],"file":"HintInputContainer.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/HintInputContainer/HintInputContainer.tsx"],"names":["HintInputContainer","viewStyle","onPress","focused","disabled","LabelComponent","variant","rightComponent","children","hint","hintComponent","rest","_hint"],"mappings":";;;;;;;AAAA;;AAOA;;AACA;;;;;;;;AAcA,MAAMA,kBAAqD,GAAG,CAAC;AAC7DC,EAAAA,SAD6D;AAE7DC,EAAAA,OAF6D;AAG7DC,EAAAA,OAH6D;AAI7DC,EAAAA,QAJ6D;AAK7DC,EAAAA,cAL6D;AAM7DC,EAAAA,OAAO,GAAG,SANmD;AAO7DC,EAAAA,cAP6D;AAQ7DC,EAAAA,QAR6D;AAS7DC,EAAAA,IAT6D;AAU7DC,EAAAA,aAV6D;AAW7D,KAAGC;AAX0D,CAAD,KAYxD;AACJ,QAAMC,KAAK,GAAGF,aAAa,IACzB,oBAAC,eAAD;AAAM,IAAA,aAAa,EAAEL,cAArB;AAAqC,IAAA,IAAI,EAAEI,IAA3C;AAAiD,IAAA,OAAO,EAAEH;AAA1D,IADF;;AAIA,SACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEL;AAAb,KACE,oBAAC,kCAAD;AACE,IAAA,OAAO,EAAEC,OADX;AAEE,IAAA,OAAO,EAAEC,OAFX;AAGE,IAAA,QAAQ,EAAEC,QAHZ;AAIE,IAAA,cAAc,EAAEC,cAJlB;AAKE,IAAA,OAAO,EAAEC,OALX;AAME,IAAA,cAAc,EAAEC;AANlB,KAOMI,IAPN,GASGH,QATH,CADF,EAYGC,IAAI,IAAIG,KAZX,CADF;AAgBD,CAjCD;;eAmCeZ,kB","sourcesContent":["import {\n Hint,\n InputVariantType,\n PressableInputContainer,\n PressableInputContainerProps,\n TextProps,\n} from '@tecsinapse/react-core';\nimport { StyleProp, View, ViewStyle } from 'react-native';\nimport * as React from 'react';\n\nexport interface HintInputContainerProps extends PressableInputContainerProps {\n viewStyle?: StyleProp<ViewStyle>;\n focused: boolean;\n LabelComponent?: React.FC<TextProps>;\n onPress?: () => void | never;\n disabled?: boolean;\n hint?: string;\n hintComponent?: JSX.Element;\n variant?: InputVariantType;\n rightComponent?: JSX.Element;\n}\n\nconst HintInputContainer: React.FC<HintInputContainerProps> = ({\n viewStyle,\n onPress,\n focused,\n disabled,\n LabelComponent,\n variant = 'default',\n rightComponent,\n children,\n hint,\n hintComponent,\n ...rest\n}) => {\n const _hint = hintComponent || (\n <Hint TextComponent={LabelComponent} text={hint} variant={variant} />\n );\n\n return (\n <View style={viewStyle}>\n <PressableInputContainer\n onPress={onPress}\n focused={focused}\n disabled={disabled}\n LabelComponent={LabelComponent}\n variant={variant}\n rightComponent={rightComponent}\n {...rest}\n >\n {children}\n </PressableInputContainer>\n {hint && _hint}\n </View>\n );\n};\n\nexport default HintInputContainer;\n"],"file":"HintInputContainer.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useTheme.ts"],"names":["useTheme"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,QAAQ,GAAG,MAAM,sBAAvB","sourcesContent":["import { useTheme as useEmotionTheme } from '@emotion/react';\nimport { ThemeProp } from '../types/defaults';\n\nexport const useTheme = () => useEmotionTheme() as ThemeProp;\n"],"file":"useTheme.js"}
1
+ {"version":3,"sources":["../../src/hooks/useTheme.ts"],"names":["useTheme"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,QAAQ,GAAG,MAAiB,sBAAlC","sourcesContent":["import { useTheme as useEmotionTheme } from '@emotion/react';\nimport { ThemeProp } from '../types/defaults';\n\nexport const useTheme = (): ThemeProp => useEmotionTheme() as ThemeProp;\n"],"file":"useTheme.js"}
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { Checkbox, CheckboxProps } from './components/atoms/Checkbox';
9
9
  export { Divider, DividerProps } from './components/atoms/Divider';
10
10
  export { GroupButton, GroupButtonOption, GroupButtonOptionProps, GroupButtonProps, GroupButtonValue, } from './components/atoms/GroupButton';
11
11
  export { Icon, IconProps } from './components/atoms/Icon';
12
- export { Hint, InputContainer, InputContainerProps, InputElement, InputElementProps, InputVariantType, Masks, PressableInputContainer, PressableInputContainerProps, StyledBorderKeeper, useCurrencyMask, useInputFocus, useMask, disabledInputStyles, } from './components/atoms/Input';
12
+ export { Hint, InputContainer, InputContainerProps, InputElement, InputElementProps, InputVariantType, Masks, PressableInputContainer, PressableInputContainerProps, StyledBorderKeeper, useCurrencyMask, useInputFocus, useMask, disabledInputStyles, IMask, IMaskValue, } from './components/atoms/Input';
13
13
  export { Paper, PaperProps } from './components/atoms/Paper';
14
14
  export { PressableSurface, PressableSurfaceProps, } from './components/atoms/PressableSurface';
15
15
  export { ProgressBar, ProgressBarProps } from './components/atoms/ProgressBar';
package/dist/index.js CHANGED
@@ -49,6 +49,8 @@ var _exportNames = {
49
49
  useInputFocus: true,
50
50
  useMask: true,
51
51
  disabledInputStyles: true,
52
+ IMask: true,
53
+ IMaskValue: true,
52
54
  Paper: true,
53
55
  PaperProps: true,
54
56
  PressableSurface: true,
@@ -354,6 +356,18 @@ Object.defineProperty(exports, "disabledInputStyles", {
354
356
  return _Input.disabledInputStyles;
355
357
  }
356
358
  });
359
+ Object.defineProperty(exports, "IMask", {
360
+ enumerable: true,
361
+ get: function () {
362
+ return _Input.IMask;
363
+ }
364
+ });
365
+ Object.defineProperty(exports, "IMaskValue", {
366
+ enumerable: true,
367
+ get: function () {
368
+ return _Input.IMaskValue;
369
+ }
370
+ });
357
371
  Object.defineProperty(exports, "Paper", {
358
372
  enumerable: true,
359
373
  get: function () {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAgBA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { Avatar, AvatarProps } from './components/atoms/Avatar';\nexport { Badge, BadgeProps } from './components/atoms/Badge';\nexport { BoxContent, BoxContentProps } from './components/atoms/BoxContent';\nexport {\n Button,\n ButtonProps,\n ButtonSizeType,\n ButtonStateProps,\n ButtonStateType,\n Error,\n Loading,\n Success,\n} from './components/atoms/Button';\nexport { Card, CardProps } from './components/atoms/Card';\nexport { Footer, FooterProps } from './components/atoms/Card/Footer';\nexport { Header, HeaderProps } from './components/atoms/Card/Header';\nexport { Checkbox, CheckboxProps } from './components/atoms/Checkbox';\nexport { Divider, DividerProps } from './components/atoms/Divider';\nexport {\n GroupButton,\n GroupButtonOption,\n GroupButtonOptionProps,\n GroupButtonProps,\n GroupButtonValue,\n} from './components/atoms/GroupButton';\nexport { Icon, IconProps } from './components/atoms/Icon';\nexport {\n Hint,\n InputContainer,\n InputContainerProps,\n InputElement,\n InputElementProps,\n InputVariantType,\n Masks,\n PressableInputContainer,\n PressableInputContainerProps,\n StyledBorderKeeper,\n useCurrencyMask,\n useInputFocus,\n useMask,\n disabledInputStyles,\n} from './components/atoms/Input';\nexport { Paper, PaperProps } from './components/atoms/Paper';\nexport {\n PressableSurface,\n PressableSurfaceProps,\n} from './components/atoms/PressableSurface';\nexport { ProgressBar, ProgressBarProps } from './components/atoms/ProgressBar';\nexport { RadioButton, RadioButtonProps } from './components/atoms/RadioButton';\nexport { Switch, SwitchProps } from './components/atoms/Switch';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport { Text, TextProps } from './components/atoms/Text';\nexport {\n Calendar,\n CalendarProps,\n DateRange,\n SelectionType,\n} from './components/molecules/Calendar';\nexport { DatePicker, DatePickerProps } from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n DateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport {\n DateTimeSelector,\n DateTimeSelectorMode,\n DateTimeSelectorProps,\n} from './components/molecules/DateTimeSelector';\nexport { InputPasswordIcon } from './components/molecules/InputPassword';\nexport { Snackbar, SnackbarProps } from './components/molecules/Snackbar';\nexport {\n HintInputContainer,\n HintInputContainerProps,\n} from './components/molecules/HintInputContainer';\nexport {\n TextArea,\n TextAreaProps,\n TextAreaInputBase,\n} from './components/molecules/TextArea';\nexport * from './styles/definitions';\nexport * from './styles/light';\nexport { default as ThemeProvider } from './styles/ThemeProvider';\nexport * from './types/defaults';\nexport * from './utils';\nexport * from './hooks';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAkBA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { Avatar, AvatarProps } from './components/atoms/Avatar';\nexport { Badge, BadgeProps } from './components/atoms/Badge';\nexport { BoxContent, BoxContentProps } from './components/atoms/BoxContent';\nexport {\n Button,\n ButtonProps,\n ButtonSizeType,\n ButtonStateProps,\n ButtonStateType,\n Error,\n Loading,\n Success,\n} from './components/atoms/Button';\nexport { Card, CardProps } from './components/atoms/Card';\nexport { Footer, FooterProps } from './components/atoms/Card/Footer';\nexport { Header, HeaderProps } from './components/atoms/Card/Header';\nexport { Checkbox, CheckboxProps } from './components/atoms/Checkbox';\nexport { Divider, DividerProps } from './components/atoms/Divider';\nexport {\n GroupButton,\n GroupButtonOption,\n GroupButtonOptionProps,\n GroupButtonProps,\n GroupButtonValue,\n} from './components/atoms/GroupButton';\nexport { Icon, IconProps } from './components/atoms/Icon';\nexport {\n Hint,\n InputContainer,\n InputContainerProps,\n InputElement,\n InputElementProps,\n InputVariantType,\n Masks,\n PressableInputContainer,\n PressableInputContainerProps,\n StyledBorderKeeper,\n useCurrencyMask,\n useInputFocus,\n useMask,\n disabledInputStyles,\n IMask,\n IMaskValue,\n} from './components/atoms/Input';\nexport { Paper, PaperProps } from './components/atoms/Paper';\nexport {\n PressableSurface,\n PressableSurfaceProps,\n} from './components/atoms/PressableSurface';\nexport { ProgressBar, ProgressBarProps } from './components/atoms/ProgressBar';\nexport { RadioButton, RadioButtonProps } from './components/atoms/RadioButton';\nexport { Switch, SwitchProps } from './components/atoms/Switch';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport { Text, TextProps } from './components/atoms/Text';\nexport {\n Calendar,\n CalendarProps,\n DateRange,\n SelectionType,\n} from './components/molecules/Calendar';\nexport { DatePicker, DatePickerProps } from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n DateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport {\n DateTimeSelector,\n DateTimeSelectorMode,\n DateTimeSelectorProps,\n} from './components/molecules/DateTimeSelector';\nexport { InputPasswordIcon } from './components/molecules/InputPassword';\nexport { Snackbar, SnackbarProps } from './components/molecules/Snackbar';\nexport {\n HintInputContainer,\n HintInputContainerProps,\n} from './components/molecules/HintInputContainer';\nexport {\n TextArea,\n TextAreaProps,\n TextAreaInputBase,\n} from './components/molecules/TextArea';\nexport * from './styles/definitions';\nexport * from './styles/light';\nexport { default as ThemeProvider } from './styles/ThemeProvider';\nexport * from './types/defaults';\nexport * from './utils';\nexport * from './hooks';\n"],"file":"index.js"}
@@ -1 +1,2 @@
1
1
  export declare const extractNumbersFromString: (value: string) => number;
2
+ export declare const extractDigitsFromString: (value: string) => string;
@@ -3,9 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.extractNumbersFromString = void 0;
6
+ exports.extractDigitsFromString = exports.extractNumbersFromString = void 0;
7
7
 
8
8
  const extractNumbersFromString = value => Number(value.replace(/[^0-9]/g, ''));
9
9
 
10
10
  exports.extractNumbersFromString = extractNumbersFromString;
11
+
12
+ const extractDigitsFromString = value => value.replace(/[^0-9]/g, '');
13
+
14
+ exports.extractDigitsFromString = extractDigitsFromString;
11
15
  //# sourceMappingURL=extractNumbersFromString.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/extractNumbersFromString.ts"],"names":["extractNumbersFromString","value","Number","replace"],"mappings":";;;;;;;AAAO,MAAMA,wBAAwB,GAAIC,KAAD,IACtCC,MAAM,CAACD,KAAK,CAACE,OAAN,CAAc,SAAd,EAAyB,EAAzB,CAAD,CADD","sourcesContent":["export const extractNumbersFromString = (value: string): number =>\n Number(value.replace(/[^0-9]/g, ''));\n"],"file":"extractNumbersFromString.js"}
1
+ {"version":3,"sources":["../../src/utils/extractNumbersFromString.ts"],"names":["extractNumbersFromString","value","Number","replace","extractDigitsFromString"],"mappings":";;;;;;;AAAO,MAAMA,wBAAwB,GAAIC,KAAD,IACtCC,MAAM,CAACD,KAAK,CAACE,OAAN,CAAc,SAAd,EAAyB,EAAzB,CAAD,CADD;;;;AAMA,MAAMC,uBAAuB,GAAIH,KAAD,IACrCA,KAAK,CAACE,OAAN,CAAc,SAAd,EAAyB,EAAzB,CADK","sourcesContent":["export const extractNumbersFromString = (value: string): number =>\n Number(value.replace(/[^0-9]/g, ''));\n\n/*\n * implemented for the case: string numbers start with 0. Example: 012.345.678-91 Example: 012.345.678-91\n * */\nexport const extractDigitsFromString = (value: string): string =>\n value.replace(/[^0-9]/g, '');\n"],"file":"extractNumbersFromString.js"}
@@ -1,2 +1,2 @@
1
1
  export { lightenDarkenColor } from './lightenDarkenColor';
2
- export { extractNumbersFromString } from './extractNumbersFromString';
2
+ export { extractNumbersFromString, extractDigitsFromString, } from './extractNumbersFromString';
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "extractNumbersFromString", {
15
15
  return _extractNumbersFromString.extractNumbersFromString;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "extractDigitsFromString", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _extractNumbersFromString.extractDigitsFromString;
22
+ }
23
+ });
18
24
 
19
25
  var _lightenDarkenColor = require("./lightenDarkenColor");
20
26
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { lightenDarkenColor } from './lightenDarkenColor';\nexport { extractNumbersFromString } from './extractNumbersFromString';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { lightenDarkenColor } from './lightenDarkenColor';\nexport {\n extractNumbersFromString,\n extractDigitsFromString,\n} from './extractNumbersFromString';\n"],"file":"index.js"}
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.lightenDarkenColor = void 0;
7
7
 
8
8
  const lightenDarkenColor = (color, variation) => {
9
- var usePound = false;
9
+ let usePound = false;
10
10
 
11
11
  if (color[0] == '#') {
12
12
  color = color.slice(1);
13
13
  usePound = true;
14
14
  }
15
15
 
16
- var num = parseInt(color, 16);
17
- var r = (num >> 16) + variation;
16
+ const num = parseInt(color, 16);
17
+ let r = (num >> 16) + variation;
18
18
  if (r > 255) r = 255;else if (r < 0) r = 0;
19
- var b = (num >> 8 & 0x00ff) + variation;
19
+ let b = (num >> 8 & 0x00ff) + variation;
20
20
  if (b > 255) b = 255;else if (b < 0) b = 0;
21
- var g = (num & 0x0000ff) + variation;
21
+ let g = (num & 0x0000ff) + variation;
22
22
  if (g > 255) g = 255;else if (g < 0) g = 0;
23
23
  return (usePound ? '#' : '') + (g | b << 8 | r << 16).toString(16);
24
24
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/lightenDarkenColor.ts"],"names":["lightenDarkenColor","color","variation","usePound","slice","num","parseInt","r","b","g","toString"],"mappings":";;;;;;;AAAO,MAAMA,kBAAkB,GAAG,CAACC,KAAD,EAAgBC,SAAhB,KAAsC;AACtE,MAAIC,QAAQ,GAAG,KAAf;;AAEA,MAAIF,KAAK,CAAC,CAAD,CAAL,IAAY,GAAhB,EAAqB;AACnBA,IAAAA,KAAK,GAAGA,KAAK,CAACG,KAAN,CAAY,CAAZ,CAAR;AACAD,IAAAA,QAAQ,GAAG,IAAX;AACD;;AAED,MAAIE,GAAG,GAAGC,QAAQ,CAACL,KAAD,EAAQ,EAAR,CAAlB;AAEA,MAAIM,CAAC,GAAG,CAACF,GAAG,IAAI,EAAR,IAAcH,SAAtB;AACA,MAAIK,CAAC,GAAG,GAAR,EAAaA,CAAC,GAAG,GAAJ,CAAb,KACK,IAAIA,CAAC,GAAG,CAAR,EAAWA,CAAC,GAAG,CAAJ;AAEhB,MAAIC,CAAC,GAAG,CAAEH,GAAG,IAAI,CAAR,GAAa,MAAd,IAAwBH,SAAhC;AACA,MAAIM,CAAC,GAAG,GAAR,EAAaA,CAAC,GAAG,GAAJ,CAAb,KACK,IAAIA,CAAC,GAAG,CAAR,EAAWA,CAAC,GAAG,CAAJ;AAEhB,MAAIC,CAAC,GAAG,CAACJ,GAAG,GAAG,QAAP,IAAmBH,SAA3B;AACA,MAAIO,CAAC,GAAG,GAAR,EAAaA,CAAC,GAAG,GAAJ,CAAb,KACK,IAAIA,CAAC,GAAG,CAAR,EAAWA,CAAC,GAAG,CAAJ;AAEhB,SAAO,CAACN,QAAQ,GAAG,GAAH,GAAS,EAAlB,IAAwB,CAACM,CAAC,GAAID,CAAC,IAAI,CAAV,GAAgBD,CAAC,IAAI,EAAtB,EAA2BG,QAA3B,CAAoC,EAApC,CAA/B;AACD,CAvBM","sourcesContent":["export const lightenDarkenColor = (color: string, variation: number) => {\n var usePound = false;\n\n if (color[0] == '#') {\n color = color.slice(1);\n usePound = true;\n }\n\n var num = parseInt(color, 16);\n\n var r = (num >> 16) + variation;\n if (r > 255) r = 255;\n else if (r < 0) r = 0;\n\n var b = ((num >> 8) & 0x00ff) + variation;\n if (b > 255) b = 255;\n else if (b < 0) b = 0;\n\n var g = (num & 0x0000ff) + variation;\n if (g > 255) g = 255;\n else if (g < 0) g = 0;\n\n return (usePound ? '#' : '') + (g | (b << 8) | (r << 16)).toString(16);\n};\n"],"file":"lightenDarkenColor.js"}
1
+ {"version":3,"sources":["../../src/utils/lightenDarkenColor.ts"],"names":["lightenDarkenColor","color","variation","usePound","slice","num","parseInt","r","b","g","toString"],"mappings":";;;;;;;AAAO,MAAMA,kBAAkB,GAAG,CAACC,KAAD,EAAgBC,SAAhB,KAAsC;AACtE,MAAIC,QAAQ,GAAG,KAAf;;AAEA,MAAIF,KAAK,CAAC,CAAD,CAAL,IAAY,GAAhB,EAAqB;AACnBA,IAAAA,KAAK,GAAGA,KAAK,CAACG,KAAN,CAAY,CAAZ,CAAR;AACAD,IAAAA,QAAQ,GAAG,IAAX;AACD;;AAED,QAAME,GAAG,GAAGC,QAAQ,CAACL,KAAD,EAAQ,EAAR,CAApB;AAEA,MAAIM,CAAC,GAAG,CAACF,GAAG,IAAI,EAAR,IAAcH,SAAtB;AACA,MAAIK,CAAC,GAAG,GAAR,EAAaA,CAAC,GAAG,GAAJ,CAAb,KACK,IAAIA,CAAC,GAAG,CAAR,EAAWA,CAAC,GAAG,CAAJ;AAEhB,MAAIC,CAAC,GAAG,CAAEH,GAAG,IAAI,CAAR,GAAa,MAAd,IAAwBH,SAAhC;AACA,MAAIM,CAAC,GAAG,GAAR,EAAaA,CAAC,GAAG,GAAJ,CAAb,KACK,IAAIA,CAAC,GAAG,CAAR,EAAWA,CAAC,GAAG,CAAJ;AAEhB,MAAIC,CAAC,GAAG,CAACJ,GAAG,GAAG,QAAP,IAAmBH,SAA3B;AACA,MAAIO,CAAC,GAAG,GAAR,EAAaA,CAAC,GAAG,GAAJ,CAAb,KACK,IAAIA,CAAC,GAAG,CAAR,EAAWA,CAAC,GAAG,CAAJ;AAEhB,SAAO,CAACN,QAAQ,GAAG,GAAH,GAAS,EAAlB,IAAwB,CAACM,CAAC,GAAID,CAAC,IAAI,CAAV,GAAgBD,CAAC,IAAI,EAAtB,EAA2BG,QAA3B,CAAoC,EAApC,CAA/B;AACD,CAvBM","sourcesContent":["export const lightenDarkenColor = (color: string, variation: number) => {\n let usePound = false;\n\n if (color[0] == '#') {\n color = color.slice(1);\n usePound = true;\n }\n\n const num = parseInt(color, 16);\n\n let r = (num >> 16) + variation;\n if (r > 255) r = 255;\n else if (r < 0) r = 0;\n\n let b = ((num >> 8) & 0x00ff) + variation;\n if (b > 255) b = 255;\n else if (b < 0) b = 0;\n\n let g = (num & 0x0000ff) + variation;\n if (g > 255) g = 255;\n else if (g < 0) g = 0;\n\n return (usePound ? '#' : '') + (g | (b << 8) | (r << 16)).toString(16);\n};\n"],"file":"lightenDarkenColor.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tecsinapse/react-core",
3
3
  "description": "TecSinapse hybrid React components",
4
- "version": "1.9.0",
4
+ "version": "1.10.3",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -31,5 +31,5 @@
31
31
  "react-native": ">=0.64.0",
32
32
  "react-native-vector-icons": ">=8.1.0"
33
33
  },
34
- "gitHead": "78aacb207b6f5678668983c20d23f286a2b494f9"
34
+ "gitHead": "2608df0807f22cca02b657a64b3bfef334daf0e9"
35
35
  }
@@ -13,7 +13,6 @@ export const ContainerButtonAvatar = styled(PressableSurface)<
13
13
  theme.iconSize[size]};
14
14
  height: ${({ theme, size = 'mega' }: StyleProps & Partial<AvatarProps>) =>
15
15
  theme.iconSize[size]};
16
- cursor: ${({ onPress }) => (onPress ? 'pointer' : 'default')};
17
16
  `;
18
17
 
19
18
  export const StyledAvatar = styled(Image)<Partial<StyleProps>>`
@@ -3,7 +3,7 @@ import { StyleProps } from '@tecsinapse/react-core';
3
3
  import { View } from 'react-native';
4
4
  import { BoxContentProps } from './BoxContent';
5
5
 
6
- export const elevatedStyles = ({ theme }: Partial<StyleProps>): any => [
6
+ export const elevatedStyles = ({ theme }: Partial<StyleProps>) => [
7
7
  css({
8
8
  shadowColor: theme?.miscellaneous.shadow,
9
9
  shadowOffset: { width: 0, height: 2 },
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { ButtonStateProps } from '../Button';
3
- import BaseState from './BaseState';
3
+ import { BaseState } from './BaseState';
4
4
 
5
5
  export const Error: FC<ButtonStateProps> = props => {
6
6
  return <BaseState {...props} icon="close-circle-outline" />;
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { ButtonStateProps } from '../Button';
3
- import BaseState from './BaseState';
3
+ import { BaseState } from './BaseState';
4
4
 
5
5
  export const Success: FC<ButtonStateProps> = props => {
6
6
  return <BaseState {...props} icon="checkmark-circle-outline" />;
@@ -25,6 +25,7 @@ export interface GroupButtonOptions {
25
25
  inactiveBorderColorTone?: ColorGradationType;
26
26
  activeStyle?: StyleProp<ViewStyle>;
27
27
  inactiveStyle?: StyleProp<ViewStyle>;
28
+ disabled?: boolean;
28
29
  }
29
30
 
30
31
  export interface GroupButtonValue<T> {
@@ -35,14 +36,14 @@ export interface GroupButtonValue<T> {
35
36
  export interface GroupButtonProps<T> {
36
37
  value: T;
37
38
  options: GroupButtonValue<T>[];
38
- renderKey: (option?: T) => any;
39
+ renderKey: (option?: T) => string | number | undefined;
39
40
  renderOption: (option: T, active: boolean) => JSX.Element;
40
41
  onChange: (option: T) => void;
41
42
  buttonSize?: ButtonSizeType;
42
43
  style?: StyleProp<ViewStyle>;
43
44
  }
44
45
 
45
- const GroupButton = <T extends any>({
46
+ const GroupButton = <T extends unknown>({
46
47
  style,
47
48
  ...rest
48
49
  }: GroupButtonProps<T>) => {
@@ -51,7 +52,7 @@ const GroupButton = <T extends any>({
51
52
  );
52
53
  };
53
54
 
54
- const groupOptions = <T extends any>({
55
+ const groupOptions = <T extends unknown>({
55
56
  options,
56
57
  renderOption,
57
58
  renderKey,
@@ -70,6 +71,7 @@ const groupOptions = <T extends any>({
70
71
  activeBackgroundColorTone,
71
72
  inactiveBackgroundColor,
72
73
  inactiveBackgroundColorTone,
74
+ disabled,
73
75
  } = {},
74
76
  } = option;
75
77
 
@@ -98,7 +100,7 @@ const groupOptions = <T extends any>({
98
100
  <StyledPressable
99
101
  {...rest}
100
102
  {...option.options}
101
- disabled={active}
103
+ disabled={disabled}
102
104
  isActive={active}
103
105
  isFirstOption={isFirst}
104
106
  isLastOption={isLast}
@@ -2,17 +2,17 @@ import React, { FC } from 'react';
2
2
  import { Text, TextProps } from '../Text';
3
3
  import { getStyledGroupItemText } from './styled';
4
4
 
5
- export interface GroupButtonOptionProps<T> {
5
+ export interface GroupButtonOptionProps {
6
6
  active: boolean;
7
7
  description: string;
8
8
  TextComponent?: FC<TextProps>;
9
9
  }
10
10
 
11
- const GroupButtonOption = <T extends any>({
11
+ const GroupButtonOption = ({
12
12
  TextComponent = Text,
13
13
  active,
14
14
  description,
15
- }: GroupButtonOptionProps<T>) => {
15
+ }: GroupButtonOptionProps): JSX.Element => {
16
16
  const StyledText = getStyledGroupItemText(TextComponent);
17
17
  return (
18
18
  <StyledText fontWeight="bold" typography="sub" active={active}>
@@ -18,9 +18,20 @@ export const StyledGroupButton = styled.View<Partial<StyleProps>>`
18
18
  flex-direction: row;
19
19
  `;
20
20
 
21
+ // TO FIXED: hexa color to theme definitions
22
+ const disabledStyles = ({
23
+ disabled,
24
+ isActive,
25
+ }: PressableOptions & Partial<StyleProps>) =>
26
+ disabled &&
27
+ !isActive &&
28
+ css`
29
+ background-color: #dcdcdc;
30
+ `;
31
+
21
32
  export const getStyledGroupItemText = (component: FC<TextProps>) => {
22
33
  return styled(component)<
23
- Partial<GroupButtonOptionProps<any>> & Partial<StyleProps>
34
+ Partial<GroupButtonOptionProps> & Partial<StyleProps>
24
35
  >`
25
36
  color: ${({ active, theme }) =>
26
37
  active ? theme.miscellaneous.surfaceColor : theme.color.secondary.medium};
@@ -130,5 +141,6 @@ export const StyledPressable = styled(StyledPressableBase)(
130
141
  ${leftStyles(props)}
131
142
  ${rightStyles(props)}
132
143
  ${sizeStyles(props)}
144
+ ${disabledStyles(props)}
133
145
  `
134
146
  );
@@ -2,47 +2,56 @@ import { useTheme } from '@emotion/react';
2
2
  import { ThemeProp } from '@tecsinapse/react-core';
3
3
  import React, { FC } from 'react';
4
4
  import { StyleProp, TextInputProps, TextStyle } from 'react-native';
5
- import { Mask } from '../hooks/useMask';
5
+ import { IMask } from '../hooks/useMask';
6
6
  import { StyledInputElement } from '../styled';
7
7
 
8
8
  export interface InputElementProps
9
- extends Omit<TextInputProps, 'onChange' | 'value'> {
9
+ extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {
10
10
  style?: StyleProp<TextStyle>;
11
11
  /**
12
12
  * TODO:
13
13
  */
14
- value?: string | Mask;
14
+ value?: string | IMask;
15
15
  placeholder?: string;
16
16
  disabled?: boolean;
17
17
  onChange?: (value: string) => void;
18
18
  onFocus?: () => void;
19
19
  onBlur?: () => void;
20
+ ref?: React.Ref<any>;
20
21
  }
21
22
 
22
- const InputElement: FC<InputElementProps> = ({
23
- onChange,
24
- placeholder,
25
- value,
26
- disabled = false,
27
- placeholderTextColor,
28
- ...rest
29
- }): JSX.Element => {
30
- const theme = useTheme() as ThemeProp;
31
- const _value =
32
- typeof value === 'string' ? value : value?.maskValue?.formatted;
33
- const _placeholderColor = placeholderTextColor || theme.font.color.dark;
23
+ const InputElement: FC<InputElementProps> = React.forwardRef(
24
+ (
25
+ {
26
+ onChange,
27
+ placeholder,
28
+ value,
29
+ disabled = false,
30
+ placeholderTextColor,
31
+ ...rest
32
+ },
33
+ ref: React.Ref<any>
34
+ ): JSX.Element => {
35
+ const theme = useTheme() as ThemeProp;
36
+ const _value =
37
+ typeof value === 'string' ? value : value?.maskValue?.formatted;
38
+ const _placeholderColor = placeholderTextColor || theme.font.color.dark;
34
39
 
35
- return (
36
- <StyledInputElement
37
- {...rest}
38
- onChangeText={onChange}
39
- value={_value}
40
- placeholder={placeholder}
41
- placeholderTextColor={_placeholderColor}
42
- disabled={disabled}
43
- editable={!disabled}
44
- />
45
- );
46
- };
40
+ return (
41
+ <StyledInputElement
42
+ {...rest}
43
+ ref={ref}
44
+ onChangeText={onChange}
45
+ value={_value}
46
+ placeholder={placeholder}
47
+ placeholderTextColor={_placeholderColor}
48
+ disabled={disabled}
49
+ editable={!disabled}
50
+ />
51
+ );
52
+ }
53
+ );
54
+
55
+ InputElement.displayName = 'InputElement';
47
56
 
48
57
  export default InputElement;
@@ -1,7 +1,6 @@
1
1
  import currency from 'currency.js';
2
2
  import { useCallback, useState } from 'react';
3
- import { Mask } from '..';
4
- import { MaskValue } from './useMask';
3
+ import { IMaskValue, IMask } from './useMask';
5
4
  import { extractNumbersFromString } from '@tecsinapse/react-core';
6
5
 
7
6
  type CurrencyOptions = currency.Options;
@@ -22,14 +21,14 @@ const DEFAULT_OPTIONS: CurrencyOptions = {
22
21
  export const useCurrencyMask = (
23
22
  options?: CurrencyOptions,
24
23
  defaultValue?: string
25
- ): [Mask, (value: string) => void] => {
24
+ ): [IMask, (value: string) => void] => {
26
25
  const getRegex = useCallback(
27
26
  (precision: number) => new RegExp(`\\B(?=(\\d{${precision}})(?!\\d))`, 'g'),
28
27
  [options]
29
28
  );
30
29
 
31
30
  const applyMask = useCallback(
32
- (value = ''): MaskValue => {
31
+ (value = ''): IMaskValue => {
33
32
  const mergedOptions = { ...DEFAULT_OPTIONS, ...options };
34
33
  const { precision = -1 } = mergedOptions;
35
34
  const onlyNumbers = String(extractNumbersFromString(value));
@@ -52,7 +51,7 @@ export const useCurrencyMask = (
52
51
  [options, getRegex]
53
52
  );
54
53
 
55
- const [value, setValue] = useState<Mask>({
54
+ const [value, setValue] = useState<IMask>({
56
55
  converter: applyMask,
57
56
  maskValue: applyMask(defaultValue),
58
57
  });
@@ -1,14 +1,14 @@
1
1
  import { useCallback, useState } from 'react';
2
- import { extractNumbersFromString } from '@tecsinapse/react-core';
2
+ import { extractDigitsFromString } from '@tecsinapse/react-core';
3
3
 
4
- export interface MaskValue {
4
+ export interface IMaskValue {
5
5
  formatted?: string;
6
6
  raw?: any;
7
7
  }
8
8
 
9
- export interface Mask {
10
- converter?: (raw?: string) => MaskValue;
11
- maskValue?: MaskValue;
9
+ export interface IMask {
10
+ converter?: (raw?: string) => IMaskValue;
11
+ maskValue?: IMaskValue;
12
12
  }
13
13
 
14
14
  /**
@@ -48,15 +48,16 @@ const getMask = (value = '', mask: ((raw: any) => string) | string): string => {
48
48
  /**
49
49
  * TODO:
50
50
  * @param mask
51
+ * @param defaultValue
51
52
  * @returns
52
53
  */
53
54
  export const useMask = (
54
55
  mask: ((raw: any) => string) | string,
55
56
  defaultValue?: string
56
- ): [Mask, (text: string) => void] => {
57
+ ): [IMask, (text: string) => void] => {
57
58
  const applyMask = useCallback(
58
- (value = ''): MaskValue => {
59
- const onlyNumbers = String(extractNumbersFromString(value));
59
+ (value = ''): IMaskValue => {
60
+ const onlyNumbers = value ? extractDigitsFromString(value) : value;
60
61
  const selectedMask = getMask(onlyNumbers, mask);
61
62
  const formattedValue = mergeMask(onlyNumbers, selectedMask);
62
63
 
@@ -68,7 +69,7 @@ export const useMask = (
68
69
  [mask]
69
70
  );
70
71
 
71
- const [value, setValue] = useState<Mask>({
72
+ const [value, setValue] = useState<IMask>({
72
73
  converter: applyMask,
73
74
  maskValue: applyMask(defaultValue),
74
75
  });
@@ -8,5 +8,5 @@ export const Masks = {
8
8
  PHONE: '(99) 9999-9999',
9
9
  PHONE_EXTENDED: '(99) 99999-9999',
10
10
  COMBINED_PHONE: (value: string) =>
11
- value.length <= 10 ? Masks.PHONE : Masks.PHONE_EXTENDED,
11
+ value?.length <= 10 ? Masks.PHONE : Masks.PHONE_EXTENDED,
12
12
  };