@tecsinapse/react-core 1.12.7 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/molecules/Calendar/components/MonthWeek.js +5 -10
- package/dist/components/molecules/Calendar/components/MonthWeek.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/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/molecules/Calendar/components/MonthWeek.tsx +5 -10
- 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/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/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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;;AAOA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;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;;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 Value\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 { GridItem, Grid, IGridItem, IGrid } from './components/molecules/Grid';\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"}
|
|
@@ -11,7 +11,7 @@ var _extractNumbersFromString = require("./extractNumbersFromString");
|
|
|
11
11
|
|
|
12
12
|
var _IPhoneXHelper = require("./IPhoneXHelper");
|
|
13
13
|
|
|
14
|
-
const STANDARD_SCREEN_HEIGHT =
|
|
14
|
+
const STANDARD_SCREEN_HEIGHT = 680;
|
|
15
15
|
|
|
16
16
|
const RFPercentage = percent => {
|
|
17
17
|
if (_reactNative.Platform.OS === 'web') return percent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/ResponsiveFontSize.ts"],"names":["STANDARD_SCREEN_HEIGHT","RFPercentage","percent","Platform","OS","height","width","Dimensions","get","standardLength","offset","StatusBar","currentHeight","deviceHeight","heightPercent","Math","round","RFValue","fontSize","standardScreenHeight","RFValueStr","_fontSize"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA,MAAMA,sBAAsB,GAAG,GAA/B;;AASO,MAAMC,YAAY,GAAIC,OAAD,IAAqB;AAC7C,MAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B,OAAOF,OAAP;;AAC3B,QAAM;AAAEG,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAoBC,wBAAWC,GAAX,CAAe,QAAf,CAA1B;;AACA,QAAMC,cAAc,GAAGH,KAAK,GAAGD,MAAR,GAAiBC,KAAjB,GAAyBD,MAAhD;AACA,QAAMK,MAAM,GAAGJ,KAAK,GAAGD,MAAR,GAAiB,CAAjB,GAAqBF,sBAASC,EAAT,KAAgB,KAAhB,GAAwB,EAAxB,GAA6BO,uBAAUC,aAAV,IAA2B,CAA5F;AACA,QAAMC,YAAY,GAAG,mCAAeV,sBAASC,EAAT,KAAgB,SAA/B,GAA2CK,cAAc,GAAGC,MAA5D,GAAqED,cAA1F;AACA,QAAMK,aAAa,GAAIZ,OAAO,GAAGW,YAAX,GAA2B,GAAjD;AACA,SAAOE,IAAI,CAACC,KAAL,CAAWF,aAAX,CAAP;AACH,CARM;;;;AAkBA,MAAMG,OAAO,GAAG,CAACC,QAAD,EAAmBC,oBAA4B,GAAGnB,sBAAlD,KAA6E;AAChG,MAAIG,sBAASC,EAAT,KAAgB,KAApB,EAA2B,OAAOc,QAAP;;AAC3B,QAAM;AAAEb,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAoBC,wBAAWC,GAAX,CAAe,QAAf,CAA1B;;AACA,QAAMC,cAAc,GAAGH,KAAK,GAAGD,MAAR,GAAiBC,KAAjB,GAAyBD,MAAhD;AACA,QAAMK,MAAM,GAAGJ,KAAK,GAAGD,MAAR,GAAiB,CAAjB,GAAqBF,sBAASC,EAAT,KAAgB,KAAhB,GAAwB,EAAxB,GAA6BO,uBAAUC,aAAV,IAA2B,CAA5F;AACA,QAAMC,YAAY,GAAG,mCAAeV,sBAASC,EAAT,KAAgB,SAA/B,GAA2CK,cAAc,GAAGC,MAA5D,GAAqED,cAA1F;AACA,QAAMK,aAAa,GAAII,QAAQ,GAAGL,YAAZ,GAA4BM,oBAAlD;AACA,SAAOJ,IAAI,CAACC,KAAL,CAAWF,aAAX,CAAP;AACH,CARM;;;;AAiBA,MAAMM,UAAU,GAAG,CAACF,QAAD,EAAmBC,oBAAnB,KAAqD;AAC3E,QAAME,SAAS,GAAG,wDAAyBH,QAAzB,CAAlB;;AACA,SAAQ,GAAED,OAAO,CAACI,SAAD,EAAYF,oBAAZ,CAAkC,IAAnD;AACH,CAHM","sourcesContent":["import { Dimensions, Platform, StatusBar } from \"react-native\";\nimport { extractNumbersFromString } from \"./extractNumbersFromString\";\nimport { isIphoneX } from \"./IPhoneXHelper\";\n\nconst STANDARD_SCREEN_HEIGHT =
|
|
1
|
+
{"version":3,"sources":["../../src/utils/ResponsiveFontSize.ts"],"names":["STANDARD_SCREEN_HEIGHT","RFPercentage","percent","Platform","OS","height","width","Dimensions","get","standardLength","offset","StatusBar","currentHeight","deviceHeight","heightPercent","Math","round","RFValue","fontSize","standardScreenHeight","RFValueStr","_fontSize"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA,MAAMA,sBAAsB,GAAG,GAA/B;;AASO,MAAMC,YAAY,GAAIC,OAAD,IAAqB;AAC7C,MAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B,OAAOF,OAAP;;AAC3B,QAAM;AAAEG,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAoBC,wBAAWC,GAAX,CAAe,QAAf,CAA1B;;AACA,QAAMC,cAAc,GAAGH,KAAK,GAAGD,MAAR,GAAiBC,KAAjB,GAAyBD,MAAhD;AACA,QAAMK,MAAM,GAAGJ,KAAK,GAAGD,MAAR,GAAiB,CAAjB,GAAqBF,sBAASC,EAAT,KAAgB,KAAhB,GAAwB,EAAxB,GAA6BO,uBAAUC,aAAV,IAA2B,CAA5F;AACA,QAAMC,YAAY,GAAG,mCAAeV,sBAASC,EAAT,KAAgB,SAA/B,GAA2CK,cAAc,GAAGC,MAA5D,GAAqED,cAA1F;AACA,QAAMK,aAAa,GAAIZ,OAAO,GAAGW,YAAX,GAA2B,GAAjD;AACA,SAAOE,IAAI,CAACC,KAAL,CAAWF,aAAX,CAAP;AACH,CARM;;;;AAkBA,MAAMG,OAAO,GAAG,CAACC,QAAD,EAAmBC,oBAA4B,GAAGnB,sBAAlD,KAA6E;AAChG,MAAIG,sBAASC,EAAT,KAAgB,KAApB,EAA2B,OAAOc,QAAP;;AAC3B,QAAM;AAAEb,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAoBC,wBAAWC,GAAX,CAAe,QAAf,CAA1B;;AACA,QAAMC,cAAc,GAAGH,KAAK,GAAGD,MAAR,GAAiBC,KAAjB,GAAyBD,MAAhD;AACA,QAAMK,MAAM,GAAGJ,KAAK,GAAGD,MAAR,GAAiB,CAAjB,GAAqBF,sBAASC,EAAT,KAAgB,KAAhB,GAAwB,EAAxB,GAA6BO,uBAAUC,aAAV,IAA2B,CAA5F;AACA,QAAMC,YAAY,GAAG,mCAAeV,sBAASC,EAAT,KAAgB,SAA/B,GAA2CK,cAAc,GAAGC,MAA5D,GAAqED,cAA1F;AACA,QAAMK,aAAa,GAAII,QAAQ,GAAGL,YAAZ,GAA4BM,oBAAlD;AACA,SAAOJ,IAAI,CAACC,KAAL,CAAWF,aAAX,CAAP;AACH,CARM;;;;AAiBA,MAAMM,UAAU,GAAG,CAACF,QAAD,EAAmBC,oBAAnB,KAAqD;AAC3E,QAAME,SAAS,GAAG,wDAAyBH,QAAzB,CAAlB;;AACA,SAAQ,GAAED,OAAO,CAACI,SAAD,EAAYF,oBAAZ,CAAkC,IAAnD;AACH,CAHM","sourcesContent":["import { Dimensions, Platform, StatusBar } from \"react-native\";\nimport { extractNumbersFromString } from \"./extractNumbersFromString\";\nimport { isIphoneX } from \"./IPhoneXHelper\";\n\nconst STANDARD_SCREEN_HEIGHT = 680\n\n/**\n * Use this function when you want to scale a percentage number\n * to a reasonable value that will fit better on most of devices.\n * \n * @param percent \n * @returns \n */\nexport const RFPercentage = (percent: number) => {\n if (Platform.OS === 'web') return percent\n const { height, width } = Dimensions.get(\"window\");\n const standardLength = width > height ? width : height;\n const offset = width > height ? 0 : Platform.OS === \"ios\" ? 78 : StatusBar.currentHeight || 0 // iPhone X style SafeAreaView size in portrait\n const deviceHeight = isIphoneX() || Platform.OS === \"android\" ? standardLength - offset : standardLength;\n const heightPercent = (percent * deviceHeight) / 100;\n return Math.round(heightPercent);\n}\n\n/**\n * Use this function when you want to scale a font size based on pixel unit \n * to a reasonable value that will fit better on most of devices.\n * \n * @param fontSize \n * @param standardScreenHeight \n * @returns \n */\nexport const RFValue = (fontSize: number, standardScreenHeight: number = STANDARD_SCREEN_HEIGHT) => {\n if (Platform.OS === 'web') return fontSize\n const { height, width } = Dimensions.get(\"window\");\n const standardLength = width > height ? width : height;\n const offset = width > height ? 0 : Platform.OS === \"ios\" ? 78 : StatusBar.currentHeight || 0 // iPhone X style SafeAreaView size in portrait\n const deviceHeight = isIphoneX() || Platform.OS === \"android\" ? standardLength - offset : standardLength;\n const heightPercent = (fontSize * deviceHeight) / standardScreenHeight;\n return Math.round(heightPercent);\n}\n\n/**\n * Same as RFValue, however you can provide string values. E.g: '10px', '-5px'.\n * \n * @param fontSize \n * @param standardScreenHeight \n * @returns \n */\nexport const RFValueStr = (fontSize: string, standardScreenHeight?: number) => {\n const _fontSize = extractNumbersFromString(fontSize)\n return `${RFValue(_fontSize, standardScreenHeight)}px`\n}"],"file":"ResponsiveFontSize.js"}
|
|
@@ -9,7 +9,7 @@ const extractNumbersFromString = value => Number(extractDigitsFromString(value))
|
|
|
9
9
|
|
|
10
10
|
exports.extractNumbersFromString = extractNumbersFromString;
|
|
11
11
|
|
|
12
|
-
const extractDigitsFromString = value => value.replace(/[
|
|
12
|
+
const extractDigitsFromString = value => value.replace(/[^0-9]/g, '');
|
|
13
13
|
|
|
14
14
|
exports.extractDigitsFromString = extractDigitsFromString;
|
|
15
15
|
//# sourceMappingURL=extractNumbersFromString.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/extractNumbersFromString.ts"],"names":["extractNumbersFromString","value","Number","extractDigitsFromString","replace"],"mappings":";;;;;;;AAAO,MAAMA,wBAAwB,GAAIC,KAAD,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/extractNumbersFromString.ts"],"names":["extractNumbersFromString","value","Number","extractDigitsFromString","replace"],"mappings":";;;;;;;AAAO,MAAMA,wBAAwB,GAAIC,KAAD,IACtCC,MAAM,CAACC,uBAAuB,CAACF,KAAD,CAAxB,CADD;;;;AAGA,MAAME,uBAAuB,GAAIF,KAAD,IACrCA,KAAK,CAACG,OAAN,CAAc,SAAd,EAAyB,EAAzB,CADK","sourcesContent":["export const extractNumbersFromString = (value: string): number =>\n Number(extractDigitsFromString(value));\n\nexport const extractDigitsFromString = (value: string): string =>\n value.replace(/[^0-9]/g, '');\n"],"file":"extractNumbersFromString.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.
|
|
4
|
+
"version": "1.13.0",
|
|
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": "
|
|
34
|
+
"gitHead": "d5d2193bf8716615751e28b7009da59520e8080c"
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import currency from 'currency.js';
|
|
2
2
|
import { useCallback, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { extractNumbersFromString } from '../../../../utils';
|
|
4
|
+
import { IMask, IMaskValue } from './useMask';
|
|
5
5
|
|
|
6
6
|
type CurrencyOptions = currency.Options;
|
|
7
7
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { useTheme } from '@emotion/react';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { Animated, ViewProps } from 'react-native';
|
|
3
|
-
import { Container, Progress, Segment } from './styled';
|
|
4
|
-
import { useTheme } from '@emotion/react';
|
|
5
4
|
import {
|
|
6
5
|
ColorGradationType,
|
|
7
6
|
ColorType,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from '
|
|
7
|
+
ThemeProp
|
|
8
|
+
} from '../../../types/defaults';
|
|
9
|
+
import { extractNumbersFromString } from '../../../utils';
|
|
10
|
+
import { Container, Progress, Segment } from './styled';
|
|
11
11
|
|
|
12
12
|
export interface ProgressBarProps extends ViewProps {
|
|
13
13
|
/** Number of segments. Defaults to 1. Set to 1 when 0 or less */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { compareAsc as compare,
|
|
2
|
+
import { compareAsc as compare, isSameDay } from 'date-fns';
|
|
3
3
|
import { Cell, Selected, Week } from '../styled';
|
|
4
4
|
import { Value, DateRange, SelectionType } from '../Calendar';
|
|
5
5
|
import { TextProps } from '@tecsinapse/react-core';
|
|
@@ -62,7 +62,7 @@ const MonthWeek = <T extends SelectionType>({
|
|
|
62
62
|
|
|
63
63
|
if (!highest) {
|
|
64
64
|
if (compare(date, lowest) === -1) {
|
|
65
|
-
newValue = { lowest: date, highest:
|
|
65
|
+
newValue = { lowest: date, highest: undefined };
|
|
66
66
|
} else if (compare(date, lowest) === 0) {
|
|
67
67
|
newValue = undefined;
|
|
68
68
|
} else {
|
|
@@ -70,17 +70,12 @@ const MonthWeek = <T extends SelectionType>({
|
|
|
70
70
|
}
|
|
71
71
|
} else {
|
|
72
72
|
if (compare(date, lowest) === -1) {
|
|
73
|
-
newValue = { lowest: date, highest:
|
|
73
|
+
newValue = { lowest: date, highest: undefined };
|
|
74
74
|
} else if (compare(date, lowest) === 0) {
|
|
75
|
-
newValue =
|
|
75
|
+
newValue = undefined;
|
|
76
76
|
} else {
|
|
77
77
|
if (compare(date, highest) === -1) {
|
|
78
|
-
|
|
79
|
-
const highestDiff = Math.abs(differenceInDays(date, highest));
|
|
80
|
-
newValue = {
|
|
81
|
-
lowest: lowestDiff < highestDiff ? date : lowest,
|
|
82
|
-
highest: highestDiff <= lowestDiff ? date : highest,
|
|
83
|
-
};
|
|
78
|
+
newValue = { lowest: lowest, highest: date };
|
|
84
79
|
} else if (compare(date, highest) === 0) {
|
|
85
80
|
newValue = { lowest: lowest, highest: undefined };
|
|
86
81
|
} else {
|
|
@@ -19,26 +19,6 @@ export const TitleContainer = styled.View<Partial<StyleProps>>`
|
|
|
19
19
|
background-color: ${({ theme }) => theme.color.secondary.xlight};
|
|
20
20
|
`;
|
|
21
21
|
|
|
22
|
-
const surfaceBorderRight = ({
|
|
23
|
-
isRright,
|
|
24
|
-
theme,
|
|
25
|
-
}: ButtonBorders & Partial<StyleProps>) =>
|
|
26
|
-
!isWeb &&
|
|
27
|
-
isRright &&
|
|
28
|
-
css`
|
|
29
|
-
border-top-right-radius: ${theme?.borderRadius.deca};
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const surfaceBorderLeft = ({
|
|
33
|
-
isLeft,
|
|
34
|
-
theme,
|
|
35
|
-
}: ButtonBorders & Partial<StyleProps>) =>
|
|
36
|
-
!isWeb &&
|
|
37
|
-
isLeft &&
|
|
38
|
-
css`
|
|
39
|
-
border-top-left-radius: ${theme?.borderRadius.deca};
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
22
|
export const Control = styled(PressableSurface)(
|
|
43
23
|
(
|
|
44
24
|
props: Partial<StyleProps> & ButtonBorders & { align: 'start' | 'end' }
|
|
@@ -47,8 +27,6 @@ export const Control = styled(PressableSurface)(
|
|
|
47
27
|
padding: ${props.theme?.spacing.centi};
|
|
48
28
|
border-radius: ${props.theme?.borderRadius.mili};
|
|
49
29
|
margin: ${props.theme?.spacing.mili};
|
|
50
|
-
${surfaceBorderRight(props)}
|
|
51
|
-
${surfaceBorderLeft(props)}
|
|
52
30
|
`
|
|
53
31
|
);
|
|
54
32
|
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import { format as formatDate } from 'date-fns';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
4
|
import { InputContainerProps, useInputFocus } from '../../atoms/Input';
|
|
5
5
|
import { Text, TextProps } from '../../atoms/Text';
|
|
6
6
|
import { CalendarProps, DateRange, SelectionType } from '../Calendar';
|
|
7
|
-
import { DatePickerModalProps, Modal } from './Modal';
|
|
8
|
-
import { CalendarIcon, getStyledTextComponent } from './styled';
|
|
9
7
|
import { HintInputContainer } from '../HintInputContainer';
|
|
10
|
-
import {
|
|
8
|
+
import { CalendarIcon, getStyledTextComponent } from './styled';
|
|
11
9
|
|
|
12
|
-
export interface DatePickerProps<T extends SelectionType>
|
|
13
|
-
extends InputContainerProps,
|
|
14
|
-
DatePickerModalProps<T>,
|
|
15
|
-
Omit<CalendarProps<T>, 'style'> {
|
|
10
|
+
export interface DatePickerProps<T extends SelectionType> extends InputContainerProps, Omit<CalendarProps<T>, 'style'> {
|
|
16
11
|
controlComponent?: (
|
|
17
12
|
onPress: () => void,
|
|
18
13
|
displayValue?: string
|
|
19
14
|
) => JSX.Element;
|
|
20
15
|
TextComponent?: React.FC<TextProps>;
|
|
21
|
-
|
|
16
|
+
CalendarComponent: React.FC<CalendarProps<T>>
|
|
22
17
|
placeholder?: string;
|
|
23
18
|
onFocus?: () => void | never;
|
|
24
19
|
onBlur?: () => void | never;
|
|
25
20
|
format?: string;
|
|
26
21
|
closeOnPick?: boolean;
|
|
22
|
+
renderCalendar: (calendar: React.ReactElement, blur?: () => void) => JSX.Element|null
|
|
23
|
+
requestShowCalendar: () => void
|
|
24
|
+
requestCloseCalendar: () => void
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
function DatePicker<T extends SelectionType>({
|
|
@@ -34,7 +32,6 @@ function DatePicker<T extends SelectionType>({
|
|
|
34
32
|
value,
|
|
35
33
|
type,
|
|
36
34
|
format = 'yyyy-MM-dd',
|
|
37
|
-
|
|
38
35
|
placeholder,
|
|
39
36
|
onFocus,
|
|
40
37
|
onBlur,
|
|
@@ -45,31 +42,26 @@ function DatePicker<T extends SelectionType>({
|
|
|
45
42
|
variant,
|
|
46
43
|
TextComponent = Text,
|
|
47
44
|
CalendarComponent,
|
|
48
|
-
bottomOffset,
|
|
49
45
|
rightComponent,
|
|
50
|
-
animationType = 'fade',
|
|
51
46
|
style,
|
|
52
47
|
locale,
|
|
53
48
|
closeOnPick = false,
|
|
49
|
+
renderCalendar,
|
|
50
|
+
requestShowCalendar,
|
|
51
|
+
requestCloseCalendar,
|
|
54
52
|
...rest
|
|
55
53
|
}: DatePickerProps<T>): JSX.Element {
|
|
54
|
+
|
|
56
55
|
const { focused, handleBlur, handleFocus } = useInputFocus(
|
|
57
56
|
onFocus,
|
|
58
57
|
onBlur,
|
|
59
58
|
!disabled
|
|
60
59
|
);
|
|
61
60
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const handlePressInput = React.useCallback(() => {
|
|
65
|
-
setModalVisible(true);
|
|
61
|
+
const handleShowCalendar = React.useCallback(() => {
|
|
62
|
+
requestShowCalendar()
|
|
66
63
|
handleFocus();
|
|
67
|
-
}, [handleFocus,
|
|
68
|
-
|
|
69
|
-
const handleCloseModal = React.useCallback(() => {
|
|
70
|
-
setModalVisible(false);
|
|
71
|
-
handleBlur();
|
|
72
|
-
}, [handleBlur, setModalVisible]);
|
|
64
|
+
}, [handleFocus, requestShowCalendar]);
|
|
73
65
|
|
|
74
66
|
const getDisplayValue = () => {
|
|
75
67
|
if (!value) return placeholder;
|
|
@@ -89,23 +81,35 @@ function DatePicker<T extends SelectionType>({
|
|
|
89
81
|
|
|
90
82
|
useEffect(() => {
|
|
91
83
|
if (closeOnPick && value && type === 'day') {
|
|
92
|
-
setTimeout(
|
|
84
|
+
setTimeout(requestCloseCalendar, 200);
|
|
93
85
|
}
|
|
94
86
|
if (closeOnPick && value && type === 'range') {
|
|
95
87
|
const { lowest, highest } = value as DateRange;
|
|
96
|
-
lowest && highest && setTimeout(
|
|
88
|
+
lowest && highest && setTimeout(requestCloseCalendar, 200);
|
|
97
89
|
}
|
|
98
|
-
}, [value, closeOnPick, type,
|
|
90
|
+
}, [value, closeOnPick, type, requestCloseCalendar]);
|
|
91
|
+
|
|
92
|
+
const calendar = (
|
|
93
|
+
<CalendarComponent
|
|
94
|
+
pointerEvents={'box-none'}
|
|
95
|
+
type={type}
|
|
96
|
+
value={value}
|
|
97
|
+
month={month}
|
|
98
|
+
year={year}
|
|
99
|
+
onChange={onChange}
|
|
100
|
+
locale={locale}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
99
103
|
|
|
100
104
|
return (
|
|
101
105
|
<>
|
|
102
106
|
{controlComponent ? (
|
|
103
|
-
controlComponent(
|
|
107
|
+
controlComponent(handleShowCalendar, getDisplayValue())
|
|
104
108
|
) : (
|
|
105
109
|
<HintInputContainer
|
|
106
110
|
focused={focused}
|
|
107
111
|
viewStyle={style}
|
|
108
|
-
onPress={
|
|
112
|
+
onPress={handleShowCalendar}
|
|
109
113
|
disabled={disabled}
|
|
110
114
|
hintComponent={hintComponent}
|
|
111
115
|
LabelComponent={TextComponent}
|
|
@@ -124,20 +128,7 @@ function DatePicker<T extends SelectionType>({
|
|
|
124
128
|
</StyledText>
|
|
125
129
|
</HintInputContainer>
|
|
126
130
|
)}
|
|
127
|
-
|
|
128
|
-
CalendarComponent={CalendarComponent}
|
|
129
|
-
bottomOffset={bottomOffset}
|
|
130
|
-
visible={modalVisible}
|
|
131
|
-
onRequestClose={handleCloseModal}
|
|
132
|
-
animated
|
|
133
|
-
animationType={animationType}
|
|
134
|
-
month={month}
|
|
135
|
-
year={year}
|
|
136
|
-
onChange={onChange}
|
|
137
|
-
value={value}
|
|
138
|
-
type={type}
|
|
139
|
-
locale={locale}
|
|
140
|
-
/>
|
|
131
|
+
{renderCalendar(calendar, handleBlur)}
|
|
141
132
|
</>
|
|
142
133
|
);
|
|
143
134
|
}
|
|
@@ -1,50 +1,10 @@
|
|
|
1
1
|
import styled, { css } from '@emotion/native';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import { hex2rgba } from '../../../styles/definitions';
|
|
5
3
|
import { StyleProps } from '../../../types/defaults';
|
|
6
|
-
import { RFValue } from '../../../utils';
|
|
7
4
|
import { Icon } from '../../atoms/Icon';
|
|
8
5
|
import { disabledInputStyles, InputContainerProps } from '../../atoms/Input';
|
|
9
|
-
import { PressableSurface } from '../../atoms/PressableSurface';
|
|
10
6
|
import { TextProps } from '../../atoms/Text';
|
|
11
7
|
|
|
12
|
-
const isWeb = Platform.OS === 'web';
|
|
13
|
-
|
|
14
|
-
export const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`
|
|
15
|
-
${({ theme }) =>
|
|
16
|
-
isWeb
|
|
17
|
-
? css`
|
|
18
|
-
justify-content: center;
|
|
19
|
-
align-items: center;
|
|
20
|
-
background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};
|
|
21
|
-
height: 100vh;
|
|
22
|
-
`
|
|
23
|
-
: css`
|
|
24
|
-
justify-content: flex-end;
|
|
25
|
-
background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};
|
|
26
|
-
height: 100%;
|
|
27
|
-
`}
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
export const ModalContent = styled.View<
|
|
31
|
-
{ offset: number } & Partial<StyleProps>
|
|
32
|
-
>`
|
|
33
|
-
background-color: transparent;
|
|
34
|
-
padding-bottom: ${({ offset }) => `${RFValue(offset)}px`};
|
|
35
|
-
${({ theme: { borderRadius } }) => css`
|
|
36
|
-
${isWeb
|
|
37
|
-
? `
|
|
38
|
-
border-radius: ${borderRadius.micro};
|
|
39
|
-
`
|
|
40
|
-
: `
|
|
41
|
-
border-top-left-radius: ${borderRadius.deca};
|
|
42
|
-
border-top-right-radius: ${borderRadius.deca};
|
|
43
|
-
`}
|
|
44
|
-
`}
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
8
|
export const getStyledTextComponent = (component: FC<TextProps>) => {
|
|
49
9
|
return styled(component)(
|
|
50
10
|
(props: Partial<InputContainerProps> & Partial<StyleProps>) => css`
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { format as formatDate } from 'date-fns';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { ModalBaseProps } from 'react-native';
|
|
4
3
|
import { InputContainerProps, useInputFocus } from '../../atoms/Input';
|
|
5
4
|
import { Text, TextProps } from '../../atoms/Text';
|
|
6
5
|
import { CalendarIcon, getStyledTextComponent } from '../DatePicker/styled';
|
|
7
|
-
import { DateTimeSelectorProps } from '../DateTimeSelector';
|
|
8
|
-
import { DateTimePickerModalProps, Modal } from './Modal';
|
|
6
|
+
import { DateTimeSelector, DateTimeSelectorProps } from '../DateTimeSelector';
|
|
9
7
|
import { HintInputContainer } from '../HintInputContainer';
|
|
8
|
+
import { getStyledDateTimeSelector } from './styled';
|
|
10
9
|
|
|
11
|
-
export interface DateTimePickerProps
|
|
12
|
-
extends InputContainerProps,
|
|
13
|
-
DateTimePickerModalProps,
|
|
14
|
-
Omit<DateTimeSelectorProps, 'style'> {
|
|
10
|
+
export interface DateTimePickerProps extends InputContainerProps, Omit<DateTimeSelectorProps, 'style'> {
|
|
15
11
|
controlComponent?: (
|
|
16
12
|
onPress: () => void,
|
|
17
13
|
displayValue?: string
|
|
18
14
|
) => JSX.Element;
|
|
19
15
|
TextComponent?: React.FC<TextProps>;
|
|
20
|
-
|
|
16
|
+
DateTimeSelectorComponent: React.FC<DateTimeSelectorProps>;
|
|
21
17
|
placeholder?: string;
|
|
22
18
|
onFocus?: () => void | never;
|
|
23
19
|
onBlur?: () => void | never;
|
|
20
|
+
renderSelector: (selector: React.ReactElement, blur?: () => void) => JSX.Element|null
|
|
21
|
+
requestShowSelector: () => void
|
|
22
|
+
requestCloseSelector: () => void
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
@@ -34,7 +33,6 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
34
33
|
offsetThreshold,
|
|
35
34
|
upperOffsetThreshold,
|
|
36
35
|
lowerOffsetThreshold,
|
|
37
|
-
|
|
38
36
|
dateModalTitle,
|
|
39
37
|
timeModalTitle,
|
|
40
38
|
dateConfirmButtonText,
|
|
@@ -44,7 +42,6 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
44
42
|
yearLabel,
|
|
45
43
|
hourLabel,
|
|
46
44
|
minuteLabel,
|
|
47
|
-
|
|
48
45
|
placeholder,
|
|
49
46
|
onFocus,
|
|
50
47
|
onBlur,
|
|
@@ -54,45 +51,68 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
54
51
|
hint,
|
|
55
52
|
variant = 'default',
|
|
56
53
|
TextComponent = Text,
|
|
57
|
-
DateTimeSelectorComponent,
|
|
58
|
-
bottomOffset,
|
|
54
|
+
DateTimeSelectorComponent = DateTimeSelector,
|
|
59
55
|
rightComponent,
|
|
60
|
-
animationType = 'fade',
|
|
61
56
|
style,
|
|
57
|
+
renderSelector,
|
|
58
|
+
requestShowSelector,
|
|
59
|
+
requestCloseSelector,
|
|
62
60
|
...rest
|
|
63
61
|
}) => {
|
|
62
|
+
|
|
64
63
|
const { focused, handleBlur, handleFocus } = useInputFocus(
|
|
65
64
|
onFocus,
|
|
66
65
|
onBlur,
|
|
67
66
|
!disabled
|
|
68
67
|
);
|
|
69
68
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const handlePressInput = () => {
|
|
73
|
-
setModalVisible(true);
|
|
69
|
+
const handleShowSelector = () => {
|
|
70
|
+
requestShowSelector()
|
|
74
71
|
handleFocus();
|
|
75
72
|
};
|
|
76
73
|
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const handleChoosing = (value: Date) => {
|
|
75
|
+
onChange?.(value)
|
|
76
|
+
requestCloseSelector()
|
|
80
77
|
};
|
|
81
78
|
|
|
82
79
|
const StyledText = getStyledTextComponent(TextComponent);
|
|
83
|
-
const displayValue =
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const displayValue = (value ? formatDate(value, format, { locale: locale }) : placeholder) || ' ';
|
|
81
|
+
const StyledDateTimeSelector = getStyledDateTimeSelector(DateTimeSelectorComponent)
|
|
82
|
+
|
|
83
|
+
const dateTimeSelector = (
|
|
84
|
+
<StyledDateTimeSelector
|
|
85
|
+
value={value}
|
|
86
|
+
mode={mode}
|
|
87
|
+
format={format}
|
|
88
|
+
locale={locale}
|
|
89
|
+
upperDateThreshold={upperDateThreshold}
|
|
90
|
+
lowerDateThreshold={lowerDateThreshold}
|
|
91
|
+
offsetThreshold={offsetThreshold}
|
|
92
|
+
upperOffsetThreshold={upperOffsetThreshold}
|
|
93
|
+
lowerOffsetThreshold={lowerOffsetThreshold}
|
|
94
|
+
dateModalTitle={dateModalTitle}
|
|
95
|
+
timeModalTitle={timeModalTitle}
|
|
96
|
+
dateConfirmButtonText={dateConfirmButtonText}
|
|
97
|
+
timeConfirmButtonText={timeConfirmButtonText}
|
|
98
|
+
dayLabel={dayLabel}
|
|
99
|
+
monthLabel={monthLabel}
|
|
100
|
+
yearLabel={yearLabel}
|
|
101
|
+
hourLabel={hourLabel}
|
|
102
|
+
minuteLabel={minuteLabel}
|
|
103
|
+
onChange={handleChoosing}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
86
106
|
|
|
87
107
|
return (
|
|
88
108
|
<>
|
|
89
109
|
{controlComponent ? (
|
|
90
|
-
controlComponent(
|
|
110
|
+
controlComponent(handleShowSelector, displayValue)
|
|
91
111
|
) : (
|
|
92
112
|
<HintInputContainer
|
|
93
113
|
focused={focused}
|
|
94
114
|
viewStyle={style}
|
|
95
|
-
onPress={
|
|
115
|
+
onPress={handleShowSelector}
|
|
96
116
|
disabled={disabled}
|
|
97
117
|
LabelComponent={TextComponent}
|
|
98
118
|
variant={variant}
|
|
@@ -111,33 +131,7 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
111
131
|
</StyledText>
|
|
112
132
|
</HintInputContainer>
|
|
113
133
|
)}
|
|
114
|
-
|
|
115
|
-
DateTimeSelectorComponent={DateTimeSelectorComponent}
|
|
116
|
-
bottomOffset={bottomOffset}
|
|
117
|
-
visible={modalVisible}
|
|
118
|
-
onRequestClose={handleCloseModal}
|
|
119
|
-
animated
|
|
120
|
-
animationType={animationType}
|
|
121
|
-
onChange={onChange}
|
|
122
|
-
value={value}
|
|
123
|
-
mode={mode}
|
|
124
|
-
format={format}
|
|
125
|
-
locale={locale}
|
|
126
|
-
upperDateThreshold={upperDateThreshold}
|
|
127
|
-
lowerDateThreshold={lowerDateThreshold}
|
|
128
|
-
offsetThreshold={offsetThreshold}
|
|
129
|
-
upperOffsetThreshold={upperOffsetThreshold}
|
|
130
|
-
lowerOffsetThreshold={lowerOffsetThreshold}
|
|
131
|
-
dateModalTitle={dateModalTitle}
|
|
132
|
-
timeModalTitle={timeModalTitle}
|
|
133
|
-
dateConfirmButtonText={dateConfirmButtonText}
|
|
134
|
-
timeConfirmButtonText={timeConfirmButtonText}
|
|
135
|
-
dayLabel={dayLabel}
|
|
136
|
-
monthLabel={monthLabel}
|
|
137
|
-
yearLabel={yearLabel}
|
|
138
|
-
hourLabel={hourLabel}
|
|
139
|
-
minuteLabel={minuteLabel}
|
|
140
|
-
/>
|
|
134
|
+
{renderSelector(dateTimeSelector, handleBlur)}
|
|
141
135
|
</>
|
|
142
136
|
);
|
|
143
137
|
};
|
|
@@ -1,56 +1,8 @@
|
|
|
1
|
-
import styled
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
3
|
import { StyleProps } from '../../../types/defaults';
|
|
5
|
-
import { RFValue, RFValueStr } from '../../../utils';
|
|
6
|
-
import {
|
|
7
|
-
PressableSurface,
|
|
8
|
-
PressableSurfaceProps
|
|
9
|
-
} from '../../atoms/PressableSurface';
|
|
10
4
|
import { DateTimeSelectorProps } from '../DateTimeSelector';
|
|
11
5
|
|
|
12
|
-
const isWeb = Platform.OS === 'web';
|
|
13
|
-
|
|
14
|
-
export const StyledPressableSurface = styled(
|
|
15
|
-
PressableSurface
|
|
16
|
-
)<PressableSurfaceProps>`
|
|
17
|
-
width: 100%;
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
export const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`
|
|
21
|
-
${isWeb
|
|
22
|
-
? css`
|
|
23
|
-
justify-content: center;
|
|
24
|
-
align-items: center;
|
|
25
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
26
|
-
height: 100vh;
|
|
27
|
-
`
|
|
28
|
-
: css`
|
|
29
|
-
justify-content: flex-end;
|
|
30
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
31
|
-
height: 100%;
|
|
32
|
-
`}
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
export const ModalContent = styled.View<
|
|
36
|
-
{ offset: number } & Partial<StyleProps>
|
|
37
|
-
>`
|
|
38
|
-
background-color: transparent;
|
|
39
|
-
padding-bottom: ${({ offset }) => `${RFValue(offset)}px`};
|
|
40
|
-
${({ theme: { borderRadius } }) => css`
|
|
41
|
-
${isWeb
|
|
42
|
-
? `
|
|
43
|
-
width: ${RFValueStr('375px')};
|
|
44
|
-
border-radius: ${borderRadius.micro};
|
|
45
|
-
`
|
|
46
|
-
: `
|
|
47
|
-
border-top-left-radius: ${borderRadius.deca};
|
|
48
|
-
border-top-right-radius: ${borderRadius.deca};
|
|
49
|
-
`}
|
|
50
|
-
`}
|
|
51
|
-
overflow: hidden;
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
6
|
export const getStyledDateTimeSelector = (
|
|
55
7
|
component: FC<DateTimeSelectorProps>
|
|
56
8
|
) => {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
extractNumbersFromString,
|
|
4
|
-
SpacingType,
|
|
5
|
-
useTheme,
|
|
6
|
-
} from '@tecsinapse/react-core';
|
|
7
2
|
import { View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../../hooks';
|
|
4
|
+
import { SpacingType } from '../../../../types/defaults';
|
|
5
|
+
import { extractNumbersFromString } from '../../../../utils';
|
|
8
6
|
|
|
9
7
|
type FlexPositioning = 'flex-start' | 'flex-end' | 'center';
|
|
10
8
|
type FlexAlignBase = FlexPositioning | 'stretch';
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Hint,
|
|
3
|
-
InputVariantType,
|
|
4
|
-
PressableInputContainer,
|
|
5
|
-
PressableInputContainerProps,
|
|
6
|
-
TextProps,
|
|
7
|
-
} from '@tecsinapse/react-core';
|
|
8
|
-
import { StyleProp, View, ViewStyle } from 'react-native';
|
|
9
1
|
import * as React from 'react';
|
|
2
|
+
import { StyleProp, View, ViewStyle } from 'react-native';
|
|
3
|
+
import { Hint, InputVariantType, PressableInputContainer, PressableInputContainerProps } from '../../atoms/Input';
|
|
4
|
+
import { TextProps } from '../../atoms/Text';
|
|
10
5
|
|
|
11
6
|
export interface HintInputContainerProps extends PressableInputContainerProps {
|
|
12
7
|
viewStyle?: StyleProp<ViewStyle>;
|