@tecsinapse/react-core 1.12.6 → 1.12.10
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/CHANGELOG.md +35 -0
- package/dist/components/atoms/Input/hooks/useCurrencyMask.js +2 -2
- package/dist/components/atoms/Input/hooks/useCurrencyMask.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useMask.js +2 -2
- package/dist/components/atoms/Input/hooks/useMask.js.map +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.js +6 -6
- package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/atoms/shared/PaperAndCard.js +3 -4
- package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
- package/dist/components/molecules/Calendar/index.d.ts +1 -1
- package/dist/components/molecules/Calendar/index.js +6 -0
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/Calendar/styled.js +0 -17
- package/dist/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.d.ts +6 -5
- package/dist/components/molecules/DatePicker/DatePicker.js +22 -32
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.d.ts +0 -14
- package/dist/components/molecules/DatePicker/styled.js +1 -46
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.d.ts +5 -4
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +35 -37
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/styled.d.ts +0 -21
- package/dist/components/molecules/DateTimePicker/styled.js +3 -51
- package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
- package/dist/components/molecules/Grid/Item/Item.d.ts +1 -1
- package/dist/components/molecules/Grid/Item/Item.js +7 -5
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/HintInputContainer.d.ts +3 -2
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js +4 -4
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/components/molecules/TextArea/TextArea.d.ts +3 -1
- package/dist/components/molecules/TextArea/TextArea.js +4 -4
- package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/definitions.js +1 -1
- package/dist/styles/definitions.js.map +1 -1
- package/dist/utils/ResponsiveFontSize.js +1 -1
- package/dist/utils/ResponsiveFontSize.js.map +1 -1
- package/dist/utils/extractNumbersFromString.js +1 -1
- package/dist/utils/extractNumbersFromString.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/Input/hooks/useCurrencyMask.ts +2 -2
- package/src/components/atoms/Input/hooks/useMask.ts +1 -1
- package/src/components/atoms/ProgressBar/ProgressBar.tsx +5 -5
- package/src/components/atoms/shared/PaperAndCard.ts +4 -5
- package/src/components/molecules/Calendar/index.ts +1 -0
- package/src/components/molecules/Calendar/styled.ts +0 -22
- package/src/components/molecules/DatePicker/DatePicker.tsx +32 -41
- package/src/components/molecules/DatePicker/styled.ts +0 -40
- package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +46 -52
- package/src/components/molecules/DateTimePicker/styled.ts +1 -49
- package/src/components/molecules/Grid/Item/Item.tsx +3 -5
- package/src/components/molecules/HintInputContainer/HintInputContainer.tsx +3 -8
- package/src/components/molecules/TextArea/TextArea.tsx +3 -9
- package/src/index.ts +1 -0
- package/src/styles/definitions.ts +1 -1
- package/src/utils/ResponsiveFontSize.ts +2 -2
- package/src/utils/extractNumbersFromString.ts +4 -5
- package/dist/components/molecules/DatePicker/Modal.d.ts +0 -8
- package/dist/components/molecules/DatePicker/Modal.js +0 -60
- package/dist/components/molecules/DatePicker/Modal.js.map +0 -1
- package/dist/components/molecules/DateTimePicker/Modal.d.ts +0 -7
- package/dist/components/molecules/DateTimePicker/Modal.js +0 -89
- package/dist/components/molecules/DateTimePicker/Modal.js.map +0 -1
- package/src/components/molecules/DatePicker/DatePicker.stories.tsx +0 -44
- package/src/components/molecules/DatePicker/Modal.tsx +0 -51
- package/src/components/molecules/DateTimePicker/DateTimePicker.stories.tsx +0 -26
- package/src/components/molecules/DateTimePicker/Modal.tsx +0 -84
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.12.10](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.9...@tecsinapse/react-core@1.12.10) (2022-01-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @tecsinapse/react-core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.12.9](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.8...@tecsinapse/react-core@1.12.9) (2022-01-18)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @tecsinapse/react-core
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.12.8](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.7...@tecsinapse/react-core@1.12.8) (2022-01-17)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* regex method extractDigitsFromString ([99eb01a](https://github.com/tecsinapse/design-system/commit/99eb01a694d013129e4c08b633af003791bc6e9b))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [1.12.7](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.6...@tecsinapse/react-core@1.12.7) (2022-01-11)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @tecsinapse/react-core
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [1.12.6](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.5...@tecsinapse/react-core@1.12.6) (2022-01-06)
|
|
7
42
|
|
|
8
43
|
**Note:** Version bump only for package @tecsinapse/react-core
|
|
@@ -9,7 +9,7 @@ var _currency = _interopRequireDefault(require("currency.js"));
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _utils = require("../../../../utils");
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ const useCurrencyMask = (options, defaultValue) => {
|
|
|
29
29
|
const {
|
|
30
30
|
precision = -1
|
|
31
31
|
} = mergedOptions;
|
|
32
|
-
const onlyNumbers = String((0,
|
|
32
|
+
const onlyNumbers = String((0, _utils.extractNumbersFromString)(value));
|
|
33
33
|
const padZeros = String(onlyNumbers).padStart(precision + 1, '0');
|
|
34
34
|
let internalNumber = Number(padZeros.replace(getRegex(precision), '.'));
|
|
35
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useCurrencyMask.ts"],"names":["DEFAULT_OPTIONS","symbol","separator","decimal","precision","useCurrencyMask","options","defaultValue","getRegex","RegExp","applyMask","value","mergedOptions","onlyNumbers","String","padZeros","padStart","internalNumber","Number","replace","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","raw","formatted","format","setValue","converter","maskValue","handleChangeValue","formattedValue","oldValue"],"mappings":";;;;;;;AAAA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useCurrencyMask.ts"],"names":["DEFAULT_OPTIONS","symbol","separator","decimal","precision","useCurrencyMask","options","defaultValue","getRegex","RegExp","applyMask","value","mergedOptions","onlyNumbers","String","padZeros","padStart","internalNumber","Number","replace","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","raw","formatted","format","setValue","converter","maskValue","handleChangeValue","formattedValue","oldValue"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAKA,MAAMA,eAAgC,GAAG;AACvCC,EAAAA,MAAM,EAAE,KAD+B;AAEvCC,EAAAA,SAAS,EAAE,GAF4B;AAGvCC,EAAAA,OAAO,EAAE,GAH8B;AAIvCC,EAAAA,SAAS,EAAE;AAJ4B,CAAzC;;AAaO,MAAMC,eAAe,GAAG,CAC7BC,OAD6B,EAE7BC,YAF6B,KAGQ;AACrC,QAAMC,QAAQ,GAAG,wBACdJ,SAAD,IAAuB,IAAIK,MAAJ,CAAY,cAAaL,SAAU,YAAnC,EAAgD,GAAhD,CADR,EAEf,CAACE,OAAD,CAFe,CAAjB;AAKA,QAAMI,SAAS,GAAG,wBAChB,CAACC,KAAK,GAAG,EAAT,KAA4B;AAC1B,UAAMC,aAAa,GAAG,EAAE,GAAGZ,eAAL;AAAsB,SAAGM;AAAzB,KAAtB;AACA,UAAM;AAAEF,MAAAA,SAAS,GAAG,CAAC;AAAf,QAAqBQ,aAA3B;AACA,UAAMC,WAAW,GAAGC,MAAM,CAAC,qCAAyBH,KAAzB,CAAD,CAA1B;AACA,UAAMI,QAAQ,GAAGD,MAAM,CAACD,WAAD,CAAN,CAAoBG,QAApB,CAA6BZ,SAAS,GAAG,CAAzC,EAA4C,GAA5C,CAAjB;AACA,QAAIa,cAAc,GAAGC,MAAM,CAACH,QAAQ,CAACI,OAAT,CAAiBX,QAAQ,CAACJ,SAAD,CAAzB,EAAsC,GAAtC,CAAD,CAA3B;;AAEA,QAAIa,cAAc,GAAGC,MAAM,CAACE,gBAA5B,EAA8C;AAC5CH,MAAAA,cAAc,GAAGC,MAAM,CAACE,gBAAxB;AACD;;AAED,QAAIH,cAAc,GAAGC,MAAM,CAACG,gBAA5B,EAA8C;AAC5CJ,MAAAA,cAAc,GAAGC,MAAM,CAACG,gBAAxB;AACD;;AAED,WAAO;AACLC,MAAAA,GAAG,EAAEL,cADA;AAELM,MAAAA,SAAS,EAAE,uBAASN,cAAT,EAAyBO,MAAzB,CAAgCZ,aAAhC;AAFN,KAAP;AAID,GApBe,EAqBhB,CAACN,OAAD,EAAUE,QAAV,CArBgB,CAAlB;AAwBA,QAAM,CAACG,KAAD,EAAQc,QAAR,IAAoB,qBAAgB;AACxCC,IAAAA,SAAS,EAAEhB,SAD6B;AAExCiB,IAAAA,SAAS,EAAEjB,SAAS,CAACH,YAAD;AAFoB,GAAhB,CAA1B;AAKA,QAAMqB,iBAAiB,GAAG,wBACvBC,cAAD,IAA4B;AAC1B,UAAM;AAAEP,MAAAA,GAAF;AAAOC,MAAAA;AAAP,QAAqBb,SAAS,CAACmB,cAAD,CAApC;AACAJ,IAAAA,QAAQ,CAACK,QAAQ,KAAK,EACpB,GAAGA,QADiB;AAEpBH,MAAAA,SAAS,EAAE;AACTL,QAAAA,GADS;AAETC,QAAAA;AAFS;AAFS,KAAL,CAAT,CAAR;AAOD,GAVuB,EAWxB,CAACb,SAAD,EAAYe,QAAZ,CAXwB,CAA1B;AAcA,SAAO,CAACd,KAAD,EAAQiB,iBAAR,CAAP;AACD,CArDM","sourcesContent":["import currency from 'currency.js';\nimport { useCallback, useState } from 'react';\nimport { extractNumbersFromString } from '../../../../utils';\nimport { IMask, IMaskValue } from './useMask';\n\ntype CurrencyOptions = currency.Options;\n\nconst DEFAULT_OPTIONS: CurrencyOptions = {\n symbol: 'R$ ',\n separator: '.',\n decimal: ',',\n precision: 2,\n};\n\n/**\n * TODO:\n * @param options\n * @param defaultValue\n * @returns\n */\nexport const useCurrencyMask = (\n options?: CurrencyOptions,\n defaultValue?: string\n): [IMask, (value: string) => void] => {\n const getRegex = useCallback(\n (precision: number) => new RegExp(`\\\\B(?=(\\\\d{${precision}})(?!\\\\d))`, 'g'),\n [options]\n );\n\n const applyMask = useCallback(\n (value = ''): IMaskValue => {\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const { precision = -1 } = mergedOptions;\n const onlyNumbers = String(extractNumbersFromString(value));\n const padZeros = String(onlyNumbers).padStart(precision + 1, '0');\n let internalNumber = Number(padZeros.replace(getRegex(precision), '.'));\n\n if (internalNumber > Number.MAX_SAFE_INTEGER) {\n internalNumber = Number.MAX_SAFE_INTEGER;\n }\n\n if (internalNumber < Number.MIN_SAFE_INTEGER) {\n internalNumber = Number.MIN_SAFE_INTEGER;\n }\n\n return {\n raw: internalNumber,\n formatted: currency(internalNumber).format(mergedOptions),\n };\n },\n [options, getRegex]\n );\n\n const [value, setValue] = useState<IMask>({\n converter: applyMask,\n maskValue: applyMask(defaultValue),\n });\n\n const handleChangeValue = useCallback(\n (formattedValue: string) => {\n const { raw, formatted } = applyMask(formattedValue);\n setValue(oldValue => ({\n ...oldValue,\n maskValue: {\n raw,\n formatted,\n },\n }));\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"file":"useCurrencyMask.js"}
|
|
@@ -7,7 +7,7 @@ exports.useMask = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _utils = require("../../../../utils");
|
|
11
11
|
|
|
12
12
|
const mergeMask = (value = '', mask) => {
|
|
13
13
|
const chars = '' + value;
|
|
@@ -30,7 +30,7 @@ const getMask = (value = '', mask) => {
|
|
|
30
30
|
|
|
31
31
|
const useMask = (mask, defaultValue) => {
|
|
32
32
|
const applyMask = (0, _react.useCallback)((value = '') => {
|
|
33
|
-
const onlyNumbers = value ? (0,
|
|
33
|
+
const onlyNumbers = value ? (0, _utils.extractDigitsFromString)(value) : value;
|
|
34
34
|
const selectedMask = getMask(onlyNumbers, mask);
|
|
35
35
|
const formattedValue = mergeMask(onlyNumbers, selectedMask);
|
|
36
36
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useMask.ts"],"names":["mergeMask","value","mask","chars","formattedValue","iMask","iChars","length","charAt","getMask","useMask","defaultValue","applyMask","onlyNumbers","selectedMask","raw","formatted","setValue","converter","maskValue","handleChangeValue","oldValue"],"mappings":";;;;;;;AAAA;;AACA;;AAkBA,MAAMA,SAAS,GAAG,CAACC,KAAK,GAAG,EAAT,EAAaC,IAAb,KAA8B;AAC9C,QAAMC,KAAK,GAAG,KAAKF,KAAnB;AACA,MAAIG,cAAc,GAAG,EAArB;;AAEA,OACE,IAAIC,KAAK,GAAG,CAAZ,EAAeC,MAAM,GAAG,CAD1B,EAEED,KAAK,GAAGH,IAAI,CAACK,MAAb,IAAuBD,MAAM,GAAGH,KAAK,CAACI,MAFxC,EAGEF,KAAK,EAHP,EAIE;AACAD,IAAAA,cAAc,IACZF,IAAI,CAACM,MAAL,CAAYH,KAAZ,MAAuB,GAAvB,GAA6BF,KAAK,CAACK,MAAN,CAAaF,MAAM,EAAnB,CAA7B,GAAsDJ,IAAI,CAACM,MAAL,CAAYH,KAAZ,CADxD;AAED;;AACD,SAAOD,cAAP;AACD,CAbD;;AAqBA,MAAMK,OAAO,GAAG,CAACR,KAAK,GAAG,EAAT,EAAaC,IAAb,KAA+D;AAC7E,MAAI,OAAOA,IAAP,KAAgB,UAApB,EAAgC;AAC9B,WAAOA,IAAI,CAACD,KAAD,CAAX;AACD;;AACD,SAAOC,IAAP;AACD,CALD;;AAaO,MAAMQ,OAAO,GAAG,CACrBR,IADqB,EAErBS,YAFqB,KAGe;AACpC,QAAMC,SAAS,GAAG,wBAChB,CAACX,KAAK,GAAG,EAAT,KAA4B;AAC1B,UAAMY,WAAW,GAAGZ,KAAK,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useMask.ts"],"names":["mergeMask","value","mask","chars","formattedValue","iMask","iChars","length","charAt","getMask","useMask","defaultValue","applyMask","onlyNumbers","selectedMask","raw","formatted","setValue","converter","maskValue","handleChangeValue","oldValue"],"mappings":";;;;;;;AAAA;;AACA;;AAkBA,MAAMA,SAAS,GAAG,CAACC,KAAK,GAAG,EAAT,EAAaC,IAAb,KAA8B;AAC9C,QAAMC,KAAK,GAAG,KAAKF,KAAnB;AACA,MAAIG,cAAc,GAAG,EAArB;;AAEA,OACE,IAAIC,KAAK,GAAG,CAAZ,EAAeC,MAAM,GAAG,CAD1B,EAEED,KAAK,GAAGH,IAAI,CAACK,MAAb,IAAuBD,MAAM,GAAGH,KAAK,CAACI,MAFxC,EAGEF,KAAK,EAHP,EAIE;AACAD,IAAAA,cAAc,IACZF,IAAI,CAACM,MAAL,CAAYH,KAAZ,MAAuB,GAAvB,GAA6BF,KAAK,CAACK,MAAN,CAAaF,MAAM,EAAnB,CAA7B,GAAsDJ,IAAI,CAACM,MAAL,CAAYH,KAAZ,CADxD;AAED;;AACD,SAAOD,cAAP;AACD,CAbD;;AAqBA,MAAMK,OAAO,GAAG,CAACR,KAAK,GAAG,EAAT,EAAaC,IAAb,KAA+D;AAC7E,MAAI,OAAOA,IAAP,KAAgB,UAApB,EAAgC;AAC9B,WAAOA,IAAI,CAACD,KAAD,CAAX;AACD;;AACD,SAAOC,IAAP;AACD,CALD;;AAaO,MAAMQ,OAAO,GAAG,CACrBR,IADqB,EAErBS,YAFqB,KAGe;AACpC,QAAMC,SAAS,GAAG,wBAChB,CAACX,KAAK,GAAG,EAAT,KAA4B;AAC1B,UAAMY,WAAW,GAAGZ,KAAK,GAAG,oCAAwBA,KAAxB,CAAH,GAAoCA,KAA7D;AACA,UAAMa,YAAY,GAAGL,OAAO,CAACI,WAAD,EAAcX,IAAd,CAA5B;AACA,UAAME,cAAc,GAAGJ,SAAS,CAACa,WAAD,EAAcC,YAAd,CAAhC;AAEA,WAAO;AACLC,MAAAA,GAAG,EAAEF,WADA;AAELG,MAAAA,SAAS,EAAEZ;AAFN,KAAP;AAID,GAVe,EAWhB,CAACF,IAAD,CAXgB,CAAlB;AAcA,QAAM,CAACD,KAAD,EAAQgB,QAAR,IAAoB,qBAAgB;AACxCC,IAAAA,SAAS,EAAEN,SAD6B;AAExCO,IAAAA,SAAS,EAAEP,SAAS,CAACD,YAAD;AAFoB,GAAhB,CAA1B;AAKA,QAAMS,iBAAiB,GAAG,wBACvBnB,KAAD,IAAmB;AACjB,UAAM;AAAEc,MAAAA,GAAF;AAAOC,MAAAA;AAAP,QAAqBJ,SAAS,CAACX,KAAD,CAApC;AACAgB,IAAAA,QAAQ,CAACI,QAAQ,KAAK,EACpB,GAAGA,QADiB;AAEpBF,MAAAA,SAAS,EAAE;AACTJ,QAAAA,GADS;AAETC,QAAAA;AAFS;AAFS,KAAL,CAAT,CAAR;AAOD,GAVuB,EAWxB,CAACJ,SAAD,EAAYK,QAAZ,CAXwB,CAA1B;AAcA,SAAO,CAAChB,KAAD,EAAQmB,iBAAR,CAAP;AACD,CAtCM","sourcesContent":["import { useCallback, useState } from 'react';\nimport { extractDigitsFromString } from '../../../../utils';\n\nexport interface IMaskValue {\n formatted?: string;\n raw?: any;\n}\n\nexport interface IMask {\n converter?: (raw?: string) => IMaskValue;\n maskValue?: IMaskValue;\n}\n\n/**\n * TODO:\n * @param value\n * @param mask\n * @returns\n */\nconst mergeMask = (value = '', mask: string) => {\n const chars = '' + value;\n let formattedValue = '';\n\n for (\n let iMask = 0, iChars = 0;\n iMask < mask.length && iChars < chars.length;\n iMask++\n ) {\n formattedValue +=\n mask.charAt(iMask) === '9' ? chars.charAt(iChars++) : mask.charAt(iMask);\n }\n return formattedValue;\n};\n\n/**\n * TODO:\n * @param value\n * @param mask\n * @returns\n */\nconst getMask = (value = '', mask: ((raw: any) => string) | string): string => {\n if (typeof mask === 'function') {\n return mask(value);\n }\n return mask;\n};\n\n/**\n * TODO:\n * @param mask\n * @param defaultValue\n * @returns\n */\nexport const useMask = (\n mask: ((raw: any) => string) | string,\n defaultValue?: string\n): [IMask, (text: string) => void] => {\n const applyMask = useCallback(\n (value = ''): IMaskValue => {\n const onlyNumbers = value ? extractDigitsFromString(value) : value;\n const selectedMask = getMask(onlyNumbers, mask);\n const formattedValue = mergeMask(onlyNumbers, selectedMask);\n\n return {\n raw: onlyNumbers,\n formatted: formattedValue,\n };\n },\n [mask]\n );\n\n const [value, setValue] = useState<IMask>({\n converter: applyMask,\n maskValue: applyMask(defaultValue),\n });\n\n const handleChangeValue = useCallback(\n (value: string) => {\n const { raw, formatted } = applyMask(value);\n setValue(oldValue => ({\n ...oldValue,\n maskValue: {\n raw,\n formatted,\n },\n }));\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"file":"useMask.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
-
import { ColorGradationType, ColorType } from '
|
|
3
|
+
import { ColorGradationType, ColorType } from '../../../types/defaults';
|
|
4
4
|
export interface ProgressBarProps extends ViewProps {
|
|
5
5
|
segments?: number;
|
|
6
6
|
valueMin?: number;
|
|
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _reactNative = require("react-native");
|
|
11
13
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _react2 = require("@emotion/react");
|
|
14
|
+
var _utils = require("../../../utils");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _styled = require("./styled");
|
|
17
17
|
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
|
|
@@ -30,8 +30,8 @@ const ProgressBar = ({
|
|
|
30
30
|
animationParameters,
|
|
31
31
|
...rest
|
|
32
32
|
}) => {
|
|
33
|
-
const theme = (0,
|
|
34
|
-
const valueNow = typeof _valueNow === 'string' ? (0,
|
|
33
|
+
const theme = (0, _react.useTheme)();
|
|
34
|
+
const valueNow = typeof _valueNow === 'string' ? (0, _utils.extractNumbersFromString)(_valueNow) : _valueNow;
|
|
35
35
|
const totalProgress = (valueNow - valueMin) / (valueMax - valueMin) * 100;
|
|
36
36
|
const segments = Math.max(1, _segments);
|
|
37
37
|
const segmentWidth = 100 / Math.max(segments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/ProgressBar/ProgressBar.tsx"],"names":["ProgressBar","segments","_segments","valueMin","valueNow","_valueNow","valueMax","color","colorTone","animate","animationParameters","rest","theme","totalProgress","Math","max","segmentWidth","items","Array","keys","segmentsRender","map","index","animationValue","React","useRef","Animated","Value","current","min","minmax","width","progressPercent","timing","toValue","duration","length","useNativeDriver","delay","direction","start","rangeAnimation","interpolate","inputRange","outputRange","borderRightWidth","backgroundColor"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/ProgressBar/ProgressBar.tsx"],"names":["ProgressBar","segments","_segments","valueMin","valueNow","_valueNow","valueMax","color","colorTone","animate","animationParameters","rest","theme","totalProgress","Math","max","segmentWidth","items","Array","keys","segmentsRender","map","index","animationValue","React","useRef","Animated","Value","current","min","minmax","width","progressPercent","timing","toValue","duration","length","useNativeDriver","delay","direction","start","rangeAnimation","interpolate","inputRange","outputRange","borderRightWidth","backgroundColor"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AACA;;;;;;AAqBA,MAAMA,WAAuC,GAAG,CAAC;AAC/CC,EAAAA,QAAQ,EAAEC,SAAS,GAAG,CADyB;AAE/CC,EAAAA,QAAQ,GAAG,CAFoC;AAG/CC,EAAA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L8B,QAAAA,KAAK,EAAEC,eADF;AAELc,QAAAA,eAAe,EAAElC,KAAK,CAACL,KAAN,CAAYA,KAAZ,EAAmBC,SAAnB,CAFZ;AAGLqC,QAAAA,gBAAgB,EAAEd,KAAK,GAAG,CAAR,IAAaA,KAAK,GAAG,GAArB,GAA2B,CAA3B,GAA+B;AAH5C;AADT,MANF,CADF;AAgBD,GAjDsB,CAAvB;AAmDA,SAAO,oBAAC,iBAAD,EAAepB,IAAf,EAAsBS,cAAtB,CAAP;AACD,CA5ED;;eA8EepB,W","sourcesContent":["import { useTheme } from '@emotion/react';\nimport * as React from 'react';\nimport { Animated, ViewProps } from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp\n} from '../../../types/defaults';\nimport { extractNumbersFromString } from '../../../utils';\nimport { Container, Progress, Segment } from './styled';\n\nexport interface ProgressBarProps extends ViewProps {\n /** Number of segments. Defaults to 1. Set to 1 when 0 or less */\n segments?: number;\n /** Minimum possible value (0% of the bar). Defaults to 0 */\n valueMin?: number;\n /** Maximum possible value (100% of the bar). Defaults to 100 */\n valueMax?: number;\n /** Current value */\n valueNow: number | string;\n /** Filled partition color. Defaults to 'primary' */\n color?: ColorType;\n /** Filled partition color tone. Defaults to 'medium' */\n colorTone?: ColorGradationType;\n /** Animation */\n animate: boolean;\n /** Parameters animation */\n animationParameters?: { direction: 'left' | 'right'; duration: number };\n}\n\nconst ProgressBar: React.FC<ProgressBarProps> = ({\n segments: _segments = 1,\n valueMin = 0,\n valueNow: _valueNow,\n valueMax = 100,\n color = 'primary',\n colorTone = 'medium',\n animate,\n animationParameters,\n ...rest\n}) => {\n const theme = useTheme() as ThemeProp;\n\n const valueNow =\n typeof _valueNow === 'string'\n ? extractNumbersFromString(_valueNow)\n : _valueNow;\n\n const totalProgress = ((valueNow - valueMin) / (valueMax - valueMin)) * 100;\n const segments = Math.max(1, _segments);\n const segmentWidth = 100 / Math.max(segments);\n\n const items = [...Array(segments).keys()];\n\n const segmentsRender = items.map(index => {\n const animationValue = React.useRef(new Animated.Value(0)).current;\n\n const max = segmentWidth * (index + 1);\n const min = segmentWidth * index;\n const minmax = (totalProgress - min) / (max - min);\n const width = (minmax > 1 ? 1 : minmax < 0 ? 0 : minmax) * 100;\n\n let progressPercent: string | Animated.AnimatedInterpolation = `${width}%`;\n\n if (animate && animationParameters) {\n Animated.timing(animationValue, {\n toValue: 1,\n duration: animationParameters.duration / items.length,\n useNativeDriver: false,\n delay:\n animationParameters.direction === 'right'\n ? index * (animationParameters.duration / items.length)\n : (items.length - index - 1) *\n (animationParameters.duration / items.length),\n }).start();\n\n const rangeAnimation =\n animationParameters?.direction === 'right'\n ? [`${valueMin < 0 ? 0 : valueMin}%`, `${width}%`]\n : [`${valueMax}%`, `${width}%`];\n\n progressPercent = animationValue.interpolate?.({\n inputRange: [0, 1],\n outputRange: rangeAnimation,\n });\n }\n\n return (\n <Segment\n key={index}\n style={{\n borderRightWidth: index == segments - 1 ? 0 : 2,\n }}\n >\n <Progress\n style={{\n width: progressPercent,\n backgroundColor: theme.color[color][colorTone],\n borderRightWidth: width > 0 && width < 100 ? 2 : 0,\n }}\n />\n </Segment>\n );\n });\n\n return <Container {...rest}>{segmentsRender}</Container>;\n};\n\nexport default ProgressBar;\n"],"file":"ProgressBar.js"}
|
|
@@ -12,7 +12,6 @@ const baseStyles = ({
|
|
|
12
12
|
}) => (0, _native.css)`
|
|
13
13
|
border-radius: ${theme.borderRadius.mili};
|
|
14
14
|
background-color: ${theme.miscellaneous.surfaceColor};
|
|
15
|
-
overflow: hidden;
|
|
16
15
|
`;
|
|
17
16
|
|
|
18
17
|
exports.baseStyles = baseStyles;
|
|
@@ -24,10 +23,10 @@ const elevatedStyles = ({
|
|
|
24
23
|
shadowColor: theme.miscellaneous.shadow,
|
|
25
24
|
shadowOffset: {
|
|
26
25
|
width: 0,
|
|
27
|
-
height:
|
|
26
|
+
height: 2
|
|
28
27
|
},
|
|
29
|
-
shadowOpacity: 0.
|
|
30
|
-
shadowRadius:
|
|
28
|
+
shadowOpacity: 0.05,
|
|
29
|
+
shadowRadius: 5,
|
|
31
30
|
elevation: 2
|
|
32
31
|
})];
|
|
33
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/shared/PaperAndCard.ts"],"names":["baseStyles","theme","borderRadius","mili","miscellaneous","surfaceColor","elevatedStyles","elevated","shadowColor","shadow","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation"],"mappings":";;;;;;;AAAA;;AAIO,MAAMA,UAAU,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAgC,gBAAI;AAC9D,mBAAmBA,KAAK,CAACC,YAAN,CAAmBC,IAAK;AAC3C,sBAAsBF,KAAK,CAACG,aAAN,CAAoBC,YAAa;AACvD
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/shared/PaperAndCard.ts"],"names":["baseStyles","theme","borderRadius","mili","miscellaneous","surfaceColor","elevatedStyles","elevated","shadowColor","shadow","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation"],"mappings":";;;;;;;AAAA;;AAIO,MAAMA,UAAU,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAgC,gBAAI;AAC9D,mBAAmBA,KAAK,CAACC,YAAN,CAAmBC,IAAK;AAC3C,sBAAsBF,KAAK,CAACG,aAAN,CAAoBC,YAAa;AACvD,CAHO;;;;AAMA,MAAMC,cAAc,GAAG,CAAC;AAC7BL,EAAAA,KAD6B;AAE7BM,EAAAA,QAAQ,GAAG;AAFkB,CAAD,KAI5BA,QAAQ,IAAI,CACV,iBAAI;AACFC,EAAAA,WAAW,EAAEP,KAAK,CAACG,aAAN,CAAoBK,MAD/B;AAEFC,EAAAA,YAAY,EAAE;AAAEC,IAAAA,KAAK,EAAE,CAAT;AAAYC,IAAAA,MAAM,EAAE;AAApB,GAFZ;AAGFC,EAAAA,aAAa,EAAE,IAHb;AAIFC,EAAAA,YAAY,EAAE,CAJZ;AAKFC,EAAAA,SAAS,EAAE;AALT,CAAJ,CADU,CAJP","sourcesContent":["import { css } from '@emotion/native';\nimport { StyleProps } from '@tecsinapse/react-core';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const baseStyles = ({ theme }: StyleProps): any => css`\n border-radius: ${theme.borderRadius.mili};\n background-color: ${theme.miscellaneous.surfaceColor};\n`;\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const elevatedStyles = ({\n theme,\n elevated = false,\n}: { elevated?: boolean } & StyleProps): any =>\n elevated && [\n css({\n shadowColor: theme.miscellaneous.shadow,\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.05,\n shadowRadius: 5,\n elevation: 2\n }),\n ];\n/* eslint-enable @typescript-eslint/no-explicit-any */\n"],"file":"PaperAndCard.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Calendar, CalendarProps, SelectionType, DateRange, } from './Calendar';
|
|
1
|
+
export { default as Calendar, CalendarProps, SelectionType, DateRange, Value } from './Calendar';
|
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "DateRange", {
|
|
|
27
27
|
return _Calendar.DateRange;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "Value", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _Calendar.Value;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
|
|
31
37
|
var _Calendar = _interopRequireWildcard(require("./Calendar"));
|
|
32
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Calendar/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Calendar/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n default as Calendar,\n CalendarProps,\n SelectionType,\n DateRange,\n Value\n} from './Calendar';\n"],"file":"index.js"}
|
|
@@ -25,21 +25,6 @@ const TitleContainer = _native.default.View`
|
|
|
25
25
|
}) => theme.color.secondary.xlight};
|
|
26
26
|
`;
|
|
27
27
|
exports.TitleContainer = TitleContainer;
|
|
28
|
-
|
|
29
|
-
const surfaceBorderRight = ({
|
|
30
|
-
isRright,
|
|
31
|
-
theme
|
|
32
|
-
}) => !isWeb && isRright && (0, _native.css)`
|
|
33
|
-
border-top-right-radius: ${theme === null || theme === void 0 ? void 0 : theme.borderRadius.deca};
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
const surfaceBorderLeft = ({
|
|
37
|
-
isLeft,
|
|
38
|
-
theme
|
|
39
|
-
}) => !isWeb && isLeft && (0, _native.css)`
|
|
40
|
-
border-top-left-radius: ${theme === null || theme === void 0 ? void 0 : theme.borderRadius.deca};
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
28
|
const Control = (0, _native.default)(_PressableSurface.PressableSurface)(props => {
|
|
44
29
|
var _props$theme, _props$theme2, _props$theme3;
|
|
45
30
|
|
|
@@ -48,8 +33,6 @@ const Control = (0, _native.default)(_PressableSurface.PressableSurface)(props =
|
|
|
48
33
|
padding: ${(_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.spacing.centi};
|
|
49
34
|
border-radius: ${(_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.borderRadius.mili};
|
|
50
35
|
margin: ${(_props$theme3 = props.theme) === null || _props$theme3 === void 0 ? void 0 : _props$theme3.spacing.mili};
|
|
51
|
-
${surfaceBorderRight(props)}
|
|
52
|
-
${surfaceBorderLeft(props)}
|
|
53
36
|
`;
|
|
54
37
|
});
|
|
55
38
|
exports.Control = Control;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Calendar/styled.ts"],"names":["isWeb","Platform","OS","TitleContainer","styled","View","theme","color","secondary","xlight","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Calendar/styled.ts"],"names":["isWeb","Platform","OS","TitleContainer","styled","View","theme","color","secondary","xlight","Control","PressableSurface","props","align","spacing","centi","borderRadius","mili","getCapitalizedTextComponent","component","Content","deca","miscellaneous","surfaceColor","Week","Selected","selected","primary","medium","Cell","highlighted","isLineEnd","isLineStart","isRangeStart","isRangeEnd","borderRadiusSize","rightBorderRadius","leftBorderRadius","borderEffect","backgroundColor","light"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;;;AAGA,MAAMA,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;AAOO,MAAMC,cAAc,GAAGC,gBAAOC,IAA0B;AAC/D;AACA;AACA;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AAClE,CALO;;AAOA,MAAMC,OAAO,GAAG,qBAAOC,kCAAP,EAEnBC,KADF;AAAA;;AAAA,SAEK,gBAAI;AACX,wBAAwBA,KAAK,CAACC,KAAM;AACpC,eAFU,gBAEKD,KAAK,CAACN,KAFX,iDAEK,aAAaQ,OAAb,CAAqBC,KAAM;AAC1C,qBAHU,iBAGWH,KAAK,CAACN,KAHjB,kDAGW,cAAaU,YAAb,CAA0BC,IAAK;AACpD,cAJU,iBAIIL,KAAK,CAACN,KAJV,kDAII,cAAaQ,OAAb,CAAqBG,IAAK;AACxC,GAPE;AAAA,CADqB,CAAhB;;;AAWA,MAAMC,2BAA2B,GAAIC,SAAD,IAA8B;AACvE,SAAO,qBAAOA,SAAP,CAAkB;AAC3B;AACA,GAFE;AAGD,CAJM;;;AAMA,MAAMC,OAAO,GAAGhB,gBAAOC,IAAsC;AACpE,aAAa,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACQ,OAAN,CAAcO,IAAK;AAC/C,sBAAsB,CAAC;AAAEf,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACgB,aAAN,CAAoBC,YAAa;AACtE,CAHO;;AAKA,MAAMC,IAAI,GA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BAAiB;AACjD,mCAAmCA,gBAAiB;AACpD,iCAAiCD,iBAAkB;AACnD,oCAAoCA,iBAAkB;AACtD,0BAA0BG,eAAgB;AAC1C,KAnBI;AAoBD,CAvDiB,CAAb","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { Platform, PressableProps, ViewProps } from 'react-native';\nimport { StyleProps } from '../../../types/defaults';\nimport { PressableSurface } from '../../atoms/PressableSurface';\nimport { TextProps } from '../../atoms/Text';\n\nconst isWeb = Platform.OS === 'web';\n\ninterface ButtonBorders {\n isLeft?: boolean;\n isRright?: boolean;\n}\n\nexport const TitleContainer = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background-color: ${({ theme }) => theme.color.secondary.xlight};\n`;\n\nexport const Control = styled(PressableSurface)(\n (\n props: Partial<StyleProps> & ButtonBorders & { align: 'start' | 'end' }\n ) => css`\n align-items: flex-${props.align};\n padding: ${props.theme?.spacing.centi};\n border-radius: ${props.theme?.borderRadius.mili};\n margin: ${props.theme?.spacing.mili};\n `\n);\n\nexport const getCapitalizedTextComponent = (component: FC<TextProps>) => {\n return styled(component)`\n text-transform: capitalize;\n `;\n};\n\nexport const Content = styled.View<ViewProps & Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.deca};\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n`;\n\nexport const Week = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n`;\n\nexport const Selected = styled.View<\n Partial<StyleProps> & { selected: boolean }\n>`\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: ${({ theme, selected }) =>\n selected ? theme.color.primary.medium : 'transparent'};\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n width: 100%;\n height: 100%;\n`;\n\nexport const Cell = styled(PressableSurface)<\n PressableProps &\n Partial<StyleProps> & {\n selected: boolean;\n highlighted: boolean;\n isLineEnd: boolean;\n isLineStart: boolean;\n isRangeStart: boolean;\n isRangeEnd: boolean;\n }\n>(\n ({\n theme,\n selected,\n highlighted,\n isLineEnd,\n isLineStart,\n isRangeStart,\n isRangeEnd,\n }) => {\n const borderRadiusSize = theme.borderRadius.mili;\n\n const { rightBorderRadius, leftBorderRadius } = {\n rightBorderRadius:\n (selected && !isRangeStart) || isLineEnd ? borderRadiusSize : 0,\n leftBorderRadius:\n (selected && !isRangeEnd) || isLineStart ? borderRadiusSize : 0,\n };\n\n const borderEffect = highlighted ? 0 : borderRadiusSize;\n\n const backgroundColor = highlighted\n ? theme.color.primary.light\n : 'transparent';\n\n return css`\n ${isWeb\n ? css`\n width: 32px;\n height: 32px;\n `\n : css`\n aspect-ratio: 1;\n flex: 1;\n `}\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ${borderEffect};\n border-top-left-radius: ${leftBorderRadius};\n border-bottom-left-radius: ${leftBorderRadius};\n border-top-right-radius: ${rightBorderRadius};\n border-bottom-right-radius: ${rightBorderRadius};\n background-color: ${backgroundColor};\n `;\n }\n);\n"],"file":"styled.js"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ModalBaseProps } from 'react-native';
|
|
3
2
|
import { InputContainerProps } from '../../atoms/Input';
|
|
4
3
|
import { TextProps } from '../../atoms/Text';
|
|
5
4
|
import { CalendarProps, SelectionType } from '../Calendar';
|
|
6
|
-
|
|
7
|
-
export interface DatePickerProps<T extends SelectionType> extends InputContainerProps, DatePickerModalProps<T>, Omit<CalendarProps<T>, 'style'> {
|
|
5
|
+
export interface DatePickerProps<T extends SelectionType> extends InputContainerProps, Omit<CalendarProps<T>, 'style'> {
|
|
8
6
|
controlComponent?: (onPress: () => void, displayValue?: string) => JSX.Element;
|
|
9
7
|
TextComponent?: React.FC<TextProps>;
|
|
10
|
-
|
|
8
|
+
CalendarComponent: React.FC<CalendarProps<T>>;
|
|
11
9
|
placeholder?: string;
|
|
12
10
|
onFocus?: () => void | never;
|
|
13
11
|
onBlur?: () => void | never;
|
|
14
12
|
format?: string;
|
|
15
13
|
closeOnPick?: boolean;
|
|
14
|
+
renderCalendar: (calendar: React.ReactElement, blur?: () => void) => JSX.Element | null;
|
|
15
|
+
requestShowCalendar: () => void;
|
|
16
|
+
requestCloseCalendar: () => void;
|
|
16
17
|
}
|
|
17
|
-
declare function DatePicker<T extends SelectionType>({ month, year, onChange, value, type, format, placeholder, onFocus, onBlur, disabled, controlComponent, hintComponent, hint, variant, TextComponent, CalendarComponent,
|
|
18
|
+
declare function DatePicker<T extends SelectionType>({ month, year, onChange, value, type, format, placeholder, onFocus, onBlur, disabled, controlComponent, hintComponent, hint, variant, TextComponent, CalendarComponent, rightComponent, style, locale, closeOnPick, renderCalendar, requestShowCalendar, requestCloseCalendar, ...rest }: DatePickerProps<T>): JSX.Element;
|
|
18
19
|
export default DatePicker;
|
|
@@ -13,12 +13,10 @@ var _Input = require("../../atoms/Input");
|
|
|
13
13
|
|
|
14
14
|
var _Text = require("../../atoms/Text");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _HintInputContainer = require("../HintInputContainer");
|
|
17
17
|
|
|
18
18
|
var _styled = require("./styled");
|
|
19
19
|
|
|
20
|
-
var _HintInputContainer = require("../HintInputContainer");
|
|
21
|
-
|
|
22
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
21
|
|
|
24
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -42,12 +40,13 @@ function DatePicker({
|
|
|
42
40
|
variant,
|
|
43
41
|
TextComponent = _Text.Text,
|
|
44
42
|
CalendarComponent,
|
|
45
|
-
bottomOffset,
|
|
46
43
|
rightComponent,
|
|
47
|
-
animationType = 'fade',
|
|
48
44
|
style,
|
|
49
45
|
locale,
|
|
50
46
|
closeOnPick = false,
|
|
47
|
+
renderCalendar,
|
|
48
|
+
requestShowCalendar,
|
|
49
|
+
requestCloseCalendar,
|
|
51
50
|
...rest
|
|
52
51
|
}) {
|
|
53
52
|
const {
|
|
@@ -55,15 +54,10 @@ function DatePicker({
|
|
|
55
54
|
handleBlur,
|
|
56
55
|
handleFocus
|
|
57
56
|
} = (0, _Input.useInputFocus)(onFocus, onBlur, !disabled);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
setModalVisible(true);
|
|
57
|
+
const handleShowCalendar = React.useCallback(() => {
|
|
58
|
+
requestShowCalendar();
|
|
61
59
|
handleFocus();
|
|
62
|
-
}, [handleFocus,
|
|
63
|
-
const handleCloseModal = React.useCallback(() => {
|
|
64
|
-
setModalVisible(false);
|
|
65
|
-
handleBlur();
|
|
66
|
-
}, [handleBlur, setModalVisible]);
|
|
60
|
+
}, [handleFocus, requestShowCalendar]);
|
|
67
61
|
|
|
68
62
|
const getDisplayValue = () => {
|
|
69
63
|
if (!value) return placeholder;
|
|
@@ -90,7 +84,7 @@ function DatePicker({
|
|
|
90
84
|
const StyledText = (0, _styled.getStyledTextComponent)(TextComponent);
|
|
91
85
|
(0, React.useEffect)(() => {
|
|
92
86
|
if (closeOnPick && value && type === 'day') {
|
|
93
|
-
setTimeout(
|
|
87
|
+
setTimeout(requestCloseCalendar, 200);
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
if (closeOnPick && value && type === 'range') {
|
|
@@ -98,13 +92,22 @@ function DatePicker({
|
|
|
98
92
|
lowest,
|
|
99
93
|
highest
|
|
100
94
|
} = value;
|
|
101
|
-
lowest && highest && setTimeout(
|
|
95
|
+
lowest && highest && setTimeout(requestCloseCalendar, 200);
|
|
102
96
|
}
|
|
103
|
-
}, [value, closeOnPick, type,
|
|
104
|
-
|
|
97
|
+
}, [value, closeOnPick, type, requestCloseCalendar]);
|
|
98
|
+
const calendar = React.createElement(CalendarComponent, {
|
|
99
|
+
pointerEvents: 'box-none',
|
|
100
|
+
type: type,
|
|
101
|
+
value: value,
|
|
102
|
+
month: month,
|
|
103
|
+
year: year,
|
|
104
|
+
onChange: onChange,
|
|
105
|
+
locale: locale
|
|
106
|
+
});
|
|
107
|
+
return React.createElement(React.Fragment, null, controlComponent ? controlComponent(handleShowCalendar, getDisplayValue()) : React.createElement(_HintInputContainer.HintInputContainer, _extends({
|
|
105
108
|
focused: focused,
|
|
106
109
|
viewStyle: style,
|
|
107
|
-
onPress:
|
|
110
|
+
onPress: handleShowCalendar,
|
|
108
111
|
disabled: disabled,
|
|
109
112
|
hintComponent: hintComponent,
|
|
110
113
|
LabelComponent: TextComponent,
|
|
@@ -118,20 +121,7 @@ function DatePicker({
|
|
|
118
121
|
}, rest), React.createElement(StyledText, {
|
|
119
122
|
fontWeight: "bold",
|
|
120
123
|
disabled: disabled
|
|
121
|
-
}, getDisplayValue() || ' ')),
|
|
122
|
-
CalendarComponent: CalendarComponent,
|
|
123
|
-
bottomOffset: bottomOffset,
|
|
124
|
-
visible: modalVisible,
|
|
125
|
-
onRequestClose: handleCloseModal,
|
|
126
|
-
animated: true,
|
|
127
|
-
animationType: animationType,
|
|
128
|
-
month: month,
|
|
129
|
-
year: year,
|
|
130
|
-
onChange: onChange,
|
|
131
|
-
value: value,
|
|
132
|
-
type: type,
|
|
133
|
-
locale: locale
|
|
134
|
-
}));
|
|
124
|
+
}, getDisplayValue() || ' ')), renderCalendar(calendar, handleBlur));
|
|
135
125
|
}
|
|
136
126
|
|
|
137
127
|
var _default = DatePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"names":["DatePicker","month","year","onChange","value","type","format","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","CalendarComponent","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"names":["DatePicker","month","year","onChange","value","type","format","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","CalendarComponent","rightComponent","style","locale","closeOnPick","renderCalendar","requestShowCalendar","requestCloseCalendar","rest","focused","handleBlur","handleFocus","handleShowCalendar","React","useCallback","getDisplayValue","lowest","highest","StyledText","setTimeout","calendar"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;AAmBA,SAASA,UAAT,CAA6C;AAE3CC,EAAAA,KAF2C;AAG3CC,EAAAA,IAH2C;AAI3CC,EAAAA,QAJ2C;AAK3CC,EAAAA,KAL2C;AAM3CC,EAAAA,IAN2C;AAO3CC,EAAAA,MAAM,GAAG,YAPkC;AAQ3CC,EAAAA,WAR2C;AAS3CC,EAAAA,OAT2C;AAU3CC,EAAAA,MAV2C;AAW3CC,EAAAA,QAX2C;AAY3CC,EAAAA,gBAZ2C;AAa3CC,EAAAA,aAb2C;AAc3CC,EAAAA,IAd2C;AAe3CC,EAAAA,OAf2C;AAgB3CC,EAAAA,aAAa,GAAGC,UAhB2B;AAiB3CC,EAAAA,iBAjB2C;AAkB3CC,EAAAA,cAlB2C;AAmB3CC,EAAAA,KAnB2C;AAoB3CC,EAAAA,MApB2C;AAqB3CC,EAAAA,WAAW,GAAG,KArB6B;AAsB3CC,EAAAA,cAtB2C;AAuB3CC,EAAAA,mBAvB2C;AAwB3CC,EAAAA,oBAxB2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1BjB,CADF;AA8BD;;eAEc3B,U","sourcesContent":["import { format as formatDate } from 'date-fns';\nimport * as React from 'react';\nimport { useEffect } from 'react';\nimport { InputContainerProps, useInputFocus } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { CalendarProps, DateRange, SelectionType } from '../Calendar';\nimport { HintInputContainer } from '../HintInputContainer';\nimport { CalendarIcon, getStyledTextComponent } from './styled';\n\nexport interface DatePickerProps<T extends SelectionType> extends InputContainerProps, Omit<CalendarProps<T>, 'style'> {\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n TextComponent?: React.FC<TextProps>;\n CalendarComponent: React.FC<CalendarProps<T>>\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n format?: string;\n closeOnPick?: boolean;\n renderCalendar: (calendar: React.ReactElement, blur?: () => void) => JSX.Element|null\n requestShowCalendar: () => void\n requestCloseCalendar: () => void\n}\n\nfunction DatePicker<T extends SelectionType>({\n /** DatePicker props */\n month,\n year,\n onChange,\n value,\n type,\n format = 'yyyy-MM-dd',\n placeholder,\n onFocus,\n onBlur,\n disabled,\n controlComponent,\n hintComponent,\n hint,\n variant,\n TextComponent = Text,\n CalendarComponent,\n rightComponent,\n style,\n locale,\n closeOnPick = false,\n renderCalendar,\n requestShowCalendar,\n requestCloseCalendar,\n ...rest\n}: DatePickerProps<T>): JSX.Element {\n \n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const handleShowCalendar = React.useCallback(() => {\n requestShowCalendar()\n handleFocus();\n }, [handleFocus, requestShowCalendar]);\n\n const getDisplayValue = () => {\n if (!value) return placeholder;\n if (type === 'day') {\n return formatDate(value as Date, format, { locale: locale });\n } else {\n const { lowest, highest } = value as DateRange;\n if (highest)\n return `${formatDate(lowest, format, {\n locale: locale,\n })} - ${formatDate(highest, format, { locale: locale })}`;\n else return formatDate(lowest, format, { locale: locale });\n }\n };\n\n const StyledText = getStyledTextComponent(TextComponent);\n\n useEffect(() => {\n if (closeOnPick && value && type === 'day') {\n setTimeout(requestCloseCalendar, 200);\n }\n if (closeOnPick && value && type === 'range') {\n const { lowest, highest } = value as DateRange;\n lowest && highest && setTimeout(requestCloseCalendar, 200);\n }\n }, [value, closeOnPick, type, requestCloseCalendar]);\n\n const calendar = (\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 )\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handleShowCalendar, getDisplayValue())\n ) : (\n <HintInputContainer\n focused={focused}\n viewStyle={style}\n onPress={handleShowCalendar}\n disabled={disabled}\n hintComponent={hintComponent}\n LabelComponent={TextComponent}\n variant={variant}\n hint={hint}\n rightComponent={\n <>\n <CalendarIcon name=\"calendar-sharp\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledText fontWeight=\"bold\" disabled={disabled}>\n {getDisplayValue() || ' '}\n </StyledText>\n </HintInputContainer>\n )}\n {renderCalendar(calendar, handleBlur)}\n </>\n );\n}\n\nexport default DatePicker;\n"],"file":"DatePicker.js"}
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { InputContainerProps } from '../../atoms/Input';
|
|
3
3
|
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>, {}, {
|
|
16
|
-
ref?: import("react").Ref<import("react-native").View> | undefined;
|
|
17
|
-
}>;
|
|
18
4
|
export declare const getStyledTextComponent: (component: FC<TextProps>) => import("@emotion/native").StyledComponent<TextProps & {
|
|
19
5
|
children?: import("react").ReactNode;
|
|
20
6
|
} & {
|
|
@@ -3,63 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CalendarIcon = exports.getStyledTextComponent =
|
|
6
|
+
exports.CalendarIcon = exports.getStyledTextComponent = void 0;
|
|
7
7
|
|
|
8
8
|
var _native = _interopRequireWildcard(require("@emotion/native"));
|
|
9
9
|
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
var _definitions = require("../../../styles/definitions");
|
|
13
|
-
|
|
14
|
-
var _utils = require("../../../utils");
|
|
15
|
-
|
|
16
10
|
var _Icon = require("../../atoms/Icon");
|
|
17
11
|
|
|
18
12
|
var _Input = require("../../atoms/Input");
|
|
19
13
|
|
|
20
|
-
var _PressableSurface = require("../../atoms/PressableSurface");
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
15
|
|
|
24
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
17
|
|
|
26
|
-
const isWeb = _reactNative.Platform.OS === 'web';
|
|
27
|
-
const Backdrop = (0, _native.default)(_PressableSurface.PressableSurface)`
|
|
28
|
-
${({
|
|
29
|
-
theme
|
|
30
|
-
}) => isWeb ? (0, _native.css)`
|
|
31
|
-
justify-content: center;
|
|
32
|
-
align-items: center;
|
|
33
|
-
background-color: ${(0, _definitions.hex2rgba)(theme.miscellaneous.overlay, 0.5)};
|
|
34
|
-
height: 100vh;
|
|
35
|
-
` : (0, _native.css)`
|
|
36
|
-
justify-content: flex-end;
|
|
37
|
-
background-color: ${(0, _definitions.hex2rgba)(theme.miscellaneous.overlay, 0.5)};
|
|
38
|
-
height: 100%;
|
|
39
|
-
`}
|
|
40
|
-
`;
|
|
41
|
-
exports.Backdrop = Backdrop;
|
|
42
|
-
const ModalContent = _native.default.View`
|
|
43
|
-
background-color: transparent;
|
|
44
|
-
padding-bottom: ${({
|
|
45
|
-
offset
|
|
46
|
-
}) => `${(0, _utils.RFValue)(offset)}px`};
|
|
47
|
-
${({
|
|
48
|
-
theme: {
|
|
49
|
-
borderRadius
|
|
50
|
-
}
|
|
51
|
-
}) => (0, _native.css)`
|
|
52
|
-
${isWeb ? `
|
|
53
|
-
border-radius: ${borderRadius.micro};
|
|
54
|
-
` : `
|
|
55
|
-
border-top-left-radius: ${borderRadius.deca};
|
|
56
|
-
border-top-right-radius: ${borderRadius.deca};
|
|
57
|
-
`}
|
|
58
|
-
`}
|
|
59
|
-
overflow: hidden;
|
|
60
|
-
`;
|
|
61
|
-
exports.ModalContent = ModalContent;
|
|
62
|
-
|
|
63
18
|
const getStyledTextComponent = component => {
|
|
64
19
|
return (0, _native.default)(component)(props => {
|
|
65
20
|
var _props$theme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DatePicker/styled.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/DatePicker/styled.ts"],"names":["getStyledTextComponent","component","props","theme","typography","h5","lineHeight","CalendarIcon","Icon","spacing","centi","color","secondary","medium"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;;;;;AAGO,MAAMA,sBAAsB,GAAIC,SAAD,IAA8B;AAClE,SAAO,qBAAOA,SAAP,EACJC,KAAD;AAAA;;AAAA,WAA+D,gBAAI;AACvE,qBADsE,gBACjDA,KAAK,CAACC,KAD2C,iDACjD,aAAaC,UAAb,CAAwBC,EAAxB,CAA2BC,UAAW;AAC3D,QAAQ,gCAAoBJ,KAApB,CAA2B;AACnC,KAHI;AAAA,GADK,CAAP;AAMD,CAPM;;;AASA,MAAMK,YAAY,GAAG,qBAAOC,UAAP,CAAkC;AAC9D,aAAa,CAAC;AAAEL,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACM,OAAN,CAAcC,KAAM;AAChD,WAAW,CAAC;AAAEP,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACQ,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AACvD,CAHO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { StyleProps } from '../../../types/defaults';\nimport { Icon } from '../../atoms/Icon';\nimport { disabledInputStyles, InputContainerProps } from '../../atoms/Input';\nimport { TextProps } from '../../atoms/Text';\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"}
|