@tecsinapse/react-core 1.15.1 → 1.16.2
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 +30 -0
- package/dist/components/atoms/Avatar/Avatar.js +1 -3
- package/dist/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/components/atoms/Avatar/helpers.js +1 -3
- package/dist/components/atoms/Avatar/helpers.js.map +1 -1
- package/dist/components/atoms/Avatar/index.js +5 -15
- package/dist/components/atoms/Avatar/index.js.map +1 -1
- package/dist/components/atoms/Avatar/styled.js +1 -3
- package/dist/components/atoms/Avatar/styled.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.js +1 -3
- package/dist/components/atoms/Badge/Badge.js.map +1 -1
- package/dist/components/atoms/Badge/index.js +5 -15
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/Badge/styled.js +1 -3
- package/dist/components/atoms/Badge/styled.js.map +1 -1
- package/dist/components/atoms/BoxContent/BoxContent.js +1 -3
- package/dist/components/atoms/BoxContent/BoxContent.js.map +1 -1
- package/dist/components/atoms/BoxContent/index.js +5 -15
- package/dist/components/atoms/BoxContent/index.js.map +1 -1
- package/dist/components/atoms/BoxContent/styled.js +2 -4
- package/dist/components/atoms/BoxContent/styled.js.map +1 -1
- package/dist/components/atoms/Button/Button.js +1 -3
- package/dist/components/atoms/Button/Button.js.map +1 -1
- package/dist/components/atoms/Button/States/BaseState.js +1 -3
- package/dist/components/atoms/Button/States/BaseState.js.map +1 -1
- package/dist/components/atoms/Button/States/Error.js +1 -3
- package/dist/components/atoms/Button/States/Error.js.map +1 -1
- package/dist/components/atoms/Button/States/Loading.js +1 -3
- package/dist/components/atoms/Button/States/Loading.js.map +1 -1
- package/dist/components/atoms/Button/States/Success.js +1 -3
- package/dist/components/atoms/Button/States/Success.js.map +1 -1
- package/dist/components/atoms/Button/States/index.js +8 -21
- package/dist/components/atoms/Button/States/index.js.map +1 -1
- package/dist/components/atoms/Button/States/styled.js +1 -3
- package/dist/components/atoms/Button/States/styled.js.map +1 -1
- package/dist/components/atoms/Button/index.js +12 -51
- package/dist/components/atoms/Button/index.js.map +1 -1
- package/dist/components/atoms/Button/styled.js +1 -3
- package/dist/components/atoms/Button/styled.js.map +1 -1
- package/dist/components/atoms/Card/Card.js +1 -3
- package/dist/components/atoms/Card/Card.js.map +1 -1
- package/dist/components/atoms/Card/Footer/Footer.js +1 -3
- package/dist/components/atoms/Card/Footer/Footer.js.map +1 -1
- package/dist/components/atoms/Card/Footer/index.js +5 -15
- package/dist/components/atoms/Card/Footer/index.js.map +1 -1
- package/dist/components/atoms/Card/Header/Header.js +1 -3
- package/dist/components/atoms/Card/Header/Header.js.map +1 -1
- package/dist/components/atoms/Card/Header/index.js +5 -15
- package/dist/components/atoms/Card/Header/index.js.map +1 -1
- package/dist/components/atoms/Card/index.js +5 -15
- package/dist/components/atoms/Card/index.js.map +1 -1
- package/dist/components/atoms/Card/styled.js +1 -3
- package/dist/components/atoms/Card/styled.js.map +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.js +1 -3
- package/dist/components/atoms/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/atoms/Checkbox/index.js +5 -15
- package/dist/components/atoms/Checkbox/index.js.map +1 -1
- package/dist/components/atoms/Checkbox/styled.js +1 -3
- package/dist/components/atoms/Checkbox/styled.js.map +1 -1
- package/dist/components/atoms/Divider/Divider.js +1 -3
- package/dist/components/atoms/Divider/Divider.js.map +1 -1
- package/dist/components/atoms/Divider/index.js +5 -15
- package/dist/components/atoms/Divider/index.js.map +1 -1
- package/dist/components/atoms/Divider/styled.js +1 -3
- package/dist/components/atoms/Divider/styled.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButton.js +7 -9
- package/dist/components/atoms/GroupButton/GroupButton.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButtonOption.js +1 -3
- package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
- package/dist/components/atoms/GroupButton/index.js +9 -33
- package/dist/components/atoms/GroupButton/index.js.map +1 -1
- package/dist/components/atoms/GroupButton/styled.js +12 -14
- package/dist/components/atoms/GroupButton/styled.js.map +1 -1
- package/dist/components/atoms/Icon/Icon.js +1 -3
- package/dist/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/components/atoms/Icon/helpers.js +1 -3
- package/dist/components/atoms/Icon/helpers.js.map +1 -1
- package/dist/components/atoms/Icon/index.js +5 -15
- package/dist/components/atoms/Icon/index.js.map +1 -1
- package/dist/components/atoms/Input/Hint.js +1 -3
- package/dist/components/atoms/Input/Hint.js.map +1 -1
- package/dist/components/atoms/Input/InputContainer/InputContainer.js +1 -3
- package/dist/components/atoms/Input/InputContainer/InputContainer.js.map +1 -1
- package/dist/components/atoms/Input/InputElement/InputElement.d.ts +2 -5
- package/dist/components/atoms/Input/InputElement/InputElement.js +5 -49
- package/dist/components/atoms/Input/InputElement/InputElement.js.map +1 -1
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.d.ts +17 -0
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.js +84 -0
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.js.map +1 -0
- package/dist/components/atoms/Input/PressableInputContainer/PressableInputContainer.js +1 -3
- package/dist/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/index.js +5 -15
- package/dist/components/atoms/Input/PressableInputContainer/index.js.map +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/styled.js +1 -3
- package/dist/components/atoms/Input/PressableInputContainer/styled.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useInputFocus.js +1 -3
- package/dist/components/atoms/Input/hooks/useInputFocus.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useNumberMask.js +3 -5
- package/dist/components/atoms/Input/hooks/useNumberMask.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useStringMask.js +3 -5
- package/dist/components/atoms/Input/hooks/useStringMask.js.map +1 -1
- package/dist/components/atoms/Input/index.d.ts +1 -0
- package/dist/components/atoms/Input/index.js +28 -82
- package/dist/components/atoms/Input/index.js.map +1 -1
- package/dist/components/atoms/Input/styled.js +4 -6
- package/dist/components/atoms/Input/styled.js.map +1 -1
- package/dist/components/atoms/Paper/Paper.js +1 -3
- package/dist/components/atoms/Paper/Paper.js.map +1 -1
- package/dist/components/atoms/Paper/index.js +5 -15
- package/dist/components/atoms/Paper/index.js.map +1 -1
- package/dist/components/atoms/Paper/styled.js +1 -3
- package/dist/components/atoms/Paper/styled.js.map +1 -1
- package/dist/components/atoms/PressableSurface/PressableSurface.js +1 -3
- package/dist/components/atoms/PressableSurface/PressableSurface.js.map +1 -1
- package/dist/components/atoms/PressableSurface/index.js +5 -15
- package/dist/components/atoms/PressableSurface/index.js.map +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.js +4 -8
- package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/atoms/ProgressBar/index.js +5 -15
- package/dist/components/atoms/ProgressBar/index.js.map +1 -1
- package/dist/components/atoms/ProgressBar/styled.js +1 -3
- package/dist/components/atoms/ProgressBar/styled.js.map +1 -1
- package/dist/components/atoms/RadioButton/RadioButton.js +1 -3
- package/dist/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/atoms/RadioButton/index.js +5 -15
- package/dist/components/atoms/RadioButton/index.js.map +1 -1
- package/dist/components/atoms/RadioButton/styled.js +1 -3
- package/dist/components/atoms/RadioButton/styled.js.map +1 -1
- package/dist/components/atoms/Switch/Switch.js +1 -3
- package/dist/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/components/atoms/Switch/animation.js +1 -3
- package/dist/components/atoms/Switch/animation.js.map +1 -1
- package/dist/components/atoms/Switch/index.js +5 -15
- package/dist/components/atoms/Switch/index.js.map +1 -1
- package/dist/components/atoms/Switch/styled.js +1 -3
- package/dist/components/atoms/Switch/styled.js.map +1 -1
- package/dist/components/atoms/Tag/Tag.js +2 -4
- package/dist/components/atoms/Tag/Tag.js.map +1 -1
- package/dist/components/atoms/Tag/index.js +5 -15
- package/dist/components/atoms/Tag/index.js.map +1 -1
- package/dist/components/atoms/Tag/styled.js +1 -3
- package/dist/components/atoms/Tag/styled.js.map +1 -1
- package/dist/components/atoms/Text/Text.d.ts +2 -0
- package/dist/components/atoms/Text/Text.js +8 -5
- package/dist/components/atoms/Text/Text.js.map +1 -1
- package/dist/components/atoms/Text/functions.d.ts +2 -0
- package/dist/components/atoms/Text/functions.js +13 -0
- package/dist/components/atoms/Text/functions.js.map +1 -0
- package/dist/components/atoms/Text/index.js +5 -15
- package/dist/components/atoms/Text/index.js.map +1 -1
- package/dist/components/atoms/Text/styled.js +4 -3
- package/dist/components/atoms/Text/styled.js.map +1 -1
- package/dist/components/atoms/shared/PaperAndCard.js +1 -3
- package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
- package/dist/components/molecules/Calendar/Calendar.js +3 -5
- package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
- package/dist/components/molecules/Calendar/components/MonthWeek.js +4 -6
- package/dist/components/molecules/Calendar/components/MonthWeek.js.map +1 -1
- package/dist/components/molecules/Calendar/components/Weekdays.js +1 -3
- package/dist/components/molecules/Calendar/components/Weekdays.js.map +1 -1
- package/dist/components/molecules/Calendar/components/index.js +6 -15
- package/dist/components/molecules/Calendar/components/index.js.map +1 -1
- package/dist/components/molecules/Calendar/index.js +8 -33
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/Calendar/styled.js +4 -6
- package/dist/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.js +1 -3
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/index.js +5 -15
- package/dist/components/molecules/DatePicker/index.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.js +2 -4
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +2 -4
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/index.js +5 -15
- package/dist/components/molecules/DateTimePicker/index.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/styled.js +1 -3
- package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js +2 -4
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/Selector.js +1 -3
- package/dist/components/molecules/DateTimeSelector/Selector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/index.js +6 -21
- package/dist/components/molecules/DateTimeSelector/index.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/styled.js +1 -3
- package/dist/components/molecules/DateTimeSelector/styled.js.map +1 -1
- package/dist/components/molecules/Grid/Grid.js +3 -5
- package/dist/components/molecules/Grid/Grid.js.map +1 -1
- package/dist/components/molecules/Grid/Item/Item.js +4 -6
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -1
- package/dist/components/molecules/Grid/Item/index.js +5 -15
- package/dist/components/molecules/Grid/Item/index.js.map +1 -1
- package/dist/components/molecules/Grid/index.js +8 -27
- package/dist/components/molecules/Grid/index.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js +1 -3
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/index.js +4 -9
- package/dist/components/molecules/HintInputContainer/index.js.map +1 -1
- package/dist/components/molecules/InputPassword/InputPasswordIcon.js +1 -3
- package/dist/components/molecules/InputPassword/InputPasswordIcon.js.map +1 -1
- package/dist/components/molecules/InputPassword/index.js +4 -9
- package/dist/components/molecules/InputPassword/index.js.map +1 -1
- package/dist/components/molecules/InputPassword/styled.js +1 -3
- package/dist/components/molecules/InputPassword/styled.js.map +1 -1
- package/dist/components/molecules/Snackbar/Snackbar.js +3 -5
- package/dist/components/molecules/Snackbar/Snackbar.js.map +1 -1
- package/dist/components/molecules/Snackbar/index.js +5 -15
- package/dist/components/molecules/Snackbar/index.js.map +1 -1
- package/dist/components/molecules/Snackbar/styled.js +1 -3
- package/dist/components/molecules/Snackbar/styled.js.map +1 -1
- package/dist/components/molecules/TextArea/TextArea.js +1 -3
- package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
- package/dist/components/molecules/TextArea/index.js +7 -21
- package/dist/components/molecules/TextArea/index.js.map +1 -1
- package/dist/components/molecules/TextArea/styled.js +1 -3
- package/dist/components/molecules/TextArea/styled.js.map +1 -1
- package/dist/hooks/index.js +6 -15
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDebouncedState.js +1 -3
- package/dist/hooks/useDebouncedState.js.map +1 -1
- package/dist/hooks/useTheme.js +1 -3
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +123 -531
- package/dist/index.js.map +1 -1
- package/dist/styles/ThemeProvider.js +1 -3
- package/dist/styles/ThemeProvider.js.map +1 -1
- package/dist/styles/definitions.js +1 -3
- package/dist/styles/definitions.js.map +1 -1
- package/dist/styles/light.js +1 -3
- package/dist/styles/light.js.map +1 -1
- package/dist/types/defaults.d.ts +2 -0
- package/dist/types/defaults.js +1 -3
- package/dist/utils/IPhoneXHelper.js +1 -3
- package/dist/utils/IPhoneXHelper.js.map +1 -1
- package/dist/utils/ResponsiveFontSize.js +1 -3
- package/dist/utils/ResponsiveFontSize.js.map +1 -1
- package/dist/utils/extractNumbersFromString.js +1 -3
- package/dist/utils/extractNumbersFromString.js.map +1 -1
- package/dist/utils/formatWithMask.js +1 -3
- package/dist/utils/formatWithMask.js.map +1 -1
- package/dist/utils/index.js +11 -45
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lightenDarkenColor.js +1 -3
- package/dist/utils/lightenDarkenColor.js.map +1 -1
- package/dist/utils/masks.js +3 -5
- package/dist/utils/masks.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/Input/InputElement/InputElement.tsx +5 -74
- package/src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx +120 -0
- package/src/components/atoms/Input/hooks/useNumberMask.ts +1 -1
- package/src/components/atoms/Input/index.ts +4 -0
- package/src/components/atoms/Input/styled.ts +1 -1
- package/src/components/atoms/ProgressBar/ProgressBar.tsx +2 -1
- package/src/components/atoms/Text/Text.tsx +7 -1
- package/src/components/atoms/Text/functions.ts +8 -0
- package/src/components/atoms/Text/styled.ts +1 -0
- package/src/index.ts +2 -0
- package/src/types/defaults.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/DateTimeSelector.tsx"],"names":["getThresholdUnit","mode","threshold","months","includes","days","hours","DateTimeSelector","TextComponent","Text","value","onChange","format","locale","upperDateThreshold","_upperDateThreshold","lowerDateThreshold","_lowerDateThreshold","offsetThreshold","upperOffsetThreshold","lowerOffsetThreshold","dateModalTitle","timeModalTitle","dateConfirmButtonText","timeConfirmButtonText","dayLabel","monthLabel","yearLabel","hourLabel","minuteLabel","rest","Date","date","setDate","React","useState","currentMode","setCurrentMode","isDate","modalTitle","confirmButtonText","handleChange","granularity","newValue","newState","newDate","daysInMonth","getMonth","month","getDate","getDisplayedValue","slice","toString","padStart","handlePressConfirm","handlePressBack","getFullYear","getHours","getMinutes"],"mappings":";;;;;;;AAAA;;AAWA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAoEA,SAASA,gBAAT,CAA0BC,IAA1B,EAAsDC,SAAtD,EAA0E;AACxE,MAAI,CAACA,SAAL,EAAgB,OAAO,EAAP;;AAChB,MAAID,IAAI,KAAK,OAAb,EAAsB;AACpB,WAAO;AAAEE,MAAAA,MAAM,EAAED;AAAV,KAAP;AACD,GAFD,MAEO,IAAI,CAAC,MAAD,EAAS,UAAT,EAAqBE,QAArB,CAA8BH,IAA9B,CAAJ,EAAyC;AAC9C,WAAO;AAAEI,MAAAA,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,iBAAiB,CAAC,SAAD;AAPpC,IADF,CAZF,CAtFJ,EA+GE,oBAAC,cAAD;AAAQ,IAAA,KAAK,EAAE,SAAf;AAA0B,IAAA,OAAO,EAAEI;AAAnC,KACE,oBAAC,aAAD;AAAe,IAAA,UAAU,EAAC,MAA1B;AAAiC,IAAA,SAAS,EAAC;AAA3C,KACGd,iBAAiB,IAAI,IADxB,CADF,CA/GF,CADF;AAuHD,CA7ND;;eA+NejC,gB","sourcesContent":["import {\n add,\n compareAsc,\n format as formatDate,\n getDaysInMonth,\n isSameDay,\n isSameMonth,\n isSameYear,\n set,\n sub,\n} from 'date-fns';\nimport * as React from 'react';\nimport { ViewProps } from 'react-native';\nimport { Button } from '../../atoms/Button';\nimport { Icon } from '../../atoms/Icon';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { Granularity, Selector } from './Selector';\nimport { BackButton, Content, Header, Root, SelectorContainer } from './styled';\n\nexport type DateTimeSelectorMode = 'date' | 'time' | 'datetime' | 'month';\n\nexport interface DateTimeSelectorProps extends ViewProps {\n TextComponent?: React.FC<TextProps>;\n value?: Date;\n onChange?: (value: Date) => void | never;\n\n /**\n * Defines the Picker behavior\n * Must be one of ['date', 'time', 'datetime', 'month']\n */\n mode?: DateTimeSelectorMode;\n format?: string;\n locale?: Locale;\n\n /**\n * Maximum date from today\n */\n upperDateThreshold?: Date;\n\n /**\n * Minimum date from today\n */\n lowerDateThreshold?: Date;\n\n /**\n * Minimum and maximum date in distance units from today.\n * The distance unit used depends on the picker mode\n * If mode is date, the unit is day\n * If mode is time, the unit is hour\n * If mode is datetime, the unit is day\n * If mode is month, the unit is month\n */\n offsetThreshold?: number;\n\n /**\n * Maximum date in distance units from today.\n * The distance unit used depends on the picker mode\n * If mode is date, the unit is day\n * If mode is time, the unit is hour\n * If mode is datetime, the unit is day\n * If mode is month, the unit is month\n */\n upperOffsetThreshold?: number;\n\n /**\n * Minimum date in distance units from today.\n * The distance unit used depends on the picker mode\n * If mode is date, the unit is day\n * If mode is time, the unit is hour\n * If mode is datetime, the unit is day\n * If mode is month, the unit is month\n */\n lowerOffsetThreshold?: number;\n\n dateModalTitle?: string;\n timeModalTitle?: string;\n dateConfirmButtonText?: string;\n timeConfirmButtonText?: string;\n dayLabel?: string;\n monthLabel?: string;\n yearLabel?: string;\n hourLabel?: string;\n minuteLabel?: string;\n}\n\nfunction getThresholdUnit(mode: DateTimeSelectorMode, threshold?: number) {\n if (!threshold) return {};\n if (mode === 'month') {\n return { months: threshold };\n } else if (['date', 'datetime'].includes(mode)) {\n return { days: threshold };\n } else {\n return { hours: threshold };\n }\n}\n\nconst DateTimeSelector: React.FC<DateTimeSelectorProps> = ({\n TextComponent = Text,\n value,\n onChange,\n mode = 'date',\n format,\n locale,\n upperDateThreshold: _upperDateThreshold,\n lowerDateThreshold: _lowerDateThreshold,\n offsetThreshold,\n upperOffsetThreshold,\n lowerOffsetThreshold,\n dateModalTitle,\n timeModalTitle,\n dateConfirmButtonText,\n timeConfirmButtonText,\n dayLabel,\n monthLabel,\n yearLabel,\n hourLabel,\n minuteLabel,\n ...rest\n}) => {\n const lowerDateThreshold =\n _lowerDateThreshold ||\n ((offsetThreshold || lowerOffsetThreshold) &&\n sub(\n new Date(),\n getThresholdUnit(mode, offsetThreshold || lowerOffsetThreshold)\n ));\n\n const upperDateThreshold =\n _upperDateThreshold ||\n ((offsetThreshold || upperOffsetThreshold) &&\n add(\n new Date(),\n getThresholdUnit(mode, offsetThreshold || upperOffsetThreshold)\n ));\n\n const [date, setDate] = React.useState<Date>(value || new Date());\n const [currentMode, setCurrentMode] = React.useState<0 | 1>(0);\n\n const isDate =\n ['date', 'month'].includes(mode) ||\n (mode === 'datetime' && currentMode === 0);\n\n const modalTitle = isDate ? dateModalTitle : timeModalTitle;\n const confirmButtonText = isDate\n ? dateConfirmButtonText\n : timeConfirmButtonText;\n\n const handleChange = (granularity: Granularity) => (newValue: number) => {\n setDate(date => {\n let newState: Date;\n // Months and years must have a different handling for being\n // the only date units that may interfere another unit.\n if (['month', 'year'].includes(granularity)) {\n let newDate = set(date, { [granularity]: newValue });\n const daysInMonth = getDaysInMonth(newDate);\n if (granularity === 'year' && date.getMonth() != newDate.getMonth()) {\n newDate = set(newDate, { month: date.getMonth() });\n newState = set(newDate, { date: getDaysInMonth(newDate) });\n }\n newState =\n daysInMonth < date.getDate()\n ? set(newDate, { date: daysInMonth })\n : newDate;\n } else {\n newState = set(date, { [granularity]: newValue });\n }\n\n if (upperDateThreshold && compareAsc(newState, upperDateThreshold) > 0) {\n return upperDateThreshold;\n } else if (\n lowerDateThreshold &&\n compareAsc(newState, lowerDateThreshold) < 0\n ) {\n return lowerDateThreshold;\n } else {\n return newState;\n }\n });\n };\n\n const getDisplayedValue = (granularity: Granularity) => (value: number) => {\n return granularity === 'month'\n ? formatDate(date, 'MMM', { locale: locale }).slice(0, 3)\n : value.toString().padStart(2, '0');\n };\n\n const handlePressConfirm = () => {\n if (mode === 'datetime' && currentMode === 0) {\n setCurrentMode(1);\n } else {\n onChange?.(date);\n }\n };\n\n const handlePressBack = () => {\n setCurrentMode(0);\n };\n\n return (\n <Root {...rest}>\n <Header>\n {currentMode === 1 && (\n <BackButton onPress={handlePressBack}>\n <Icon\n type={'material-community'}\n name={'chevron-left'}\n size={'mega'}\n colorVariant={'secondary'}\n />\n </BackButton>\n )}\n <TextComponent typography={'base'} colorVariant={'secondary'}>\n {modalTitle}\n </TextComponent>\n </Header>\n\n {isDate ? (\n <Content>\n {mode !== 'month' && (\n <SelectorContainer isFirst>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('date')}\n referenceDate={date}\n value={date.getDate()}\n label={dayLabel || 'Day'}\n granularity={'date'}\n getDisplayValue={getDisplayedValue('date')}\n preventUpper={\n upperDateThreshold\n ? isSameDay(upperDateThreshold, date)\n : false\n }\n preventLower={\n lowerDateThreshold\n ? isSameDay(lowerDateThreshold, date)\n : false\n }\n />\n </SelectorContainer>\n )}\n <SelectorContainer>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('month')}\n referenceDate={date}\n value={date.getMonth()}\n label={monthLabel || 'Month'}\n granularity={'month'}\n getDisplayValue={getDisplayedValue('month')}\n preventUpper={\n upperDateThreshold\n ? isSameMonth(upperDateThreshold, date)\n : false\n }\n preventLower={\n lowerDateThreshold\n ? isSameMonth(lowerDateThreshold, date)\n : false\n }\n />\n </SelectorContainer>\n <SelectorContainer isLast>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('year')}\n referenceDate={date}\n value={date.getFullYear()}\n label={yearLabel || 'Year'}\n granularity={'year'}\n getDisplayValue={getDisplayedValue('year')}\n preventUpper={\n upperDateThreshold\n ? isSameYear(upperDateThreshold, date)\n : false\n }\n preventLower={\n lowerDateThreshold\n ? isSameYear(lowerDateThreshold, date)\n : false\n }\n />\n </SelectorContainer>\n </Content>\n ) : (\n <Content>\n <SelectorContainer isFirst>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('hours')}\n referenceDate={date}\n value={date.getHours()}\n label={hourLabel || 'Hour'}\n granularity={'hours'}\n getDisplayValue={getDisplayedValue('hours')}\n />\n </SelectorContainer>\n <SelectorContainer isLast>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('minutes')}\n referenceDate={date}\n value={date.getMinutes()}\n label={minuteLabel || 'Minute'}\n granularity={'minutes'}\n getDisplayValue={getDisplayedValue('minutes')}\n />\n </SelectorContainer>\n </Content>\n )}\n <Button color={'primary'} onPress={handlePressConfirm}>\n <TextComponent fontWeight=\"bold\" fontColor=\"light\">\n {confirmButtonText || 'OK'}\n </TextComponent>\n </Button>\n </Root>\n );\n};\n\nexport default DateTimeSelector;\n"],"file":"DateTimeSelector.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/DateTimeSelector.tsx"],"names":["getThresholdUnit","mode","threshold","months","includes","days","hours","DateTimeSelector","TextComponent","Text","value","onChange","format","locale","upperDateThreshold","_upperDateThreshold","lowerDateThreshold","_lowerDateThreshold","offsetThreshold","upperOffsetThreshold","lowerOffsetThreshold","dateModalTitle","timeModalTitle","dateConfirmButtonText","timeConfirmButtonText","dayLabel","monthLabel","yearLabel","hourLabel","minuteLabel","rest","Date","date","setDate","React","useState","currentMode","setCurrentMode","isDate","modalTitle","confirmButtonText","handleChange","granularity","newValue","newState","newDate","daysInMonth","getMonth","month","getDate","getDisplayedValue","slice","toString","padStart","handlePressConfirm","handlePressBack","getFullYear","getHours","getMinutes"],"mappings":";;;;;AAAA;;AAWA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAoEA,SAASA,gBAAT,CAA0BC,IAA1B,EAAsDC,SAAtD,EAA0E;AACxE,MAAI,CAACA,SAAL,EAAgB,OAAO,EAAP;;AAChB,MAAID,IAAI,KAAK,OAAb,EAAsB;AACpB,WAAO;AAAEE,MAAAA,MAAM,EAAED;AAAV,KAAP;AACD,GAFD,MAEO,IAAI,CAAC,MAAD,EAAS,UAAT,EAAqBE,QAArB,CAA8BH,IAA9B,CAAJ,EAAyC;AAC9C,WAAO;AAAEI,MAAAA,IAAI,EAAEH;AAAR,KAAP;AACD,GAFM,MAEA;AACL,WAAO;AAAEI,MAAAA,KAAK,EAAEJ;AAAT,KAAP;AACD;AACF;;AAED,MAAMK,gBAAiD,GAAG,CAAC;AACzDC,EAAAA,aAAa,GAAGC,UADyC;AAEzDC,EAAAA,KAFyD;AAGzDC,EAAAA,QAHyD;AAIzDV,EAAAA,IAAI,GAAG,MAJkD;AAKzDW,EAAAA,MALyD;AAMzDC,EAAAA,MANyD;AAOzDC,EAAAA,kBAAkB,EAAEC,mBAPqC;AAQzDC,EAAAA,kBAAkB,EAAEC,mBARqC;AASzDC,EAAAA,eATyD;AAUzDC,EAAAA,oBAVyD;AAWzDC,EAAAA,oBAXyD;AAYzDC,EAAAA,cAZyD;AAazDC,EAAAA,cAbyD;AAczDC,EAAAA,qBAdyD;AAezDC,EAAAA,qBAfyD;AAgBzDC,EAAAA,QAhByD;AAiBzDC,EAAAA,UAjByD;A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ACE,IAAA,aAAa,EAAExB,aADjB;AAEE,IAAA,QAAQ,EAAEiC,YAAY,CAAC,OAAD,CAFxB;AAGE,IAAA,aAAa,EAAET,IAHjB;AAIE,IAAA,KAAK,EAAEA,IAAI,CAACyB,QAAL,EAJT;AAKE,IAAA,KAAK,EAAE7B,SAAS,IAAI,MALtB;AAME,IAAA,WAAW,EAAE,OANf;AAOE,IAAA,eAAe,EAAEsB,iBAAiB,CAAC,OAAD;AAPpC,IADF,CADF,EAYE,oBAAC,yBAAD;AAAmB,IAAA,MAAM;AAAzB,KACE,oBAAC,kBAAD;AACE,IAAA,aAAa,EAAE1C,aADjB;AAEE,IAAA,QAAQ,EAAEiC,YAAY,CAAC,SAAD,CAFxB;AAGE,IAAA,aAAa,EAAET,IAHjB;AAIE,IAAA,KAAK,EAAEA,IAAI,CAAC0B,UAAL,EAJT;AAKE,IAAA,KAAK,EAAE7B,WAAW,IAAI,QALxB;AAME,IAAA,WAAW,EAAE,SANf;AAOE,IAAA,eAAe,EAAEqB,iBAAiB,CAAC,SAAD;AAPpC,IADF,CAZF,CAtFJ,EA+GE,oBAAC,cAAD;AAAQ,IAAA,KAAK,EAAE,SAAf;AAA0B,IAAA,OAAO,EAAEI;AAAnC,KACE,oBAAC,aAAD;AAAe,IAAA,UAAU,EAAC,MAA1B;AAAiC,IAAA,SAAS,EAAC;AAA3C,KACGd,iBAAiB,IAAI,IADxB,CADF,CA/GF,CADF;AAuHD,CA7ND;;eA+NejC,gB","sourcesContent":["import {\n add,\n compareAsc,\n format as formatDate,\n getDaysInMonth,\n isSameDay,\n isSameMonth,\n isSameYear,\n set,\n sub,\n} from 'date-fns';\nimport * as React from 'react';\nimport { ViewProps } from 'react-native';\nimport { Button } from '../../atoms/Button';\nimport { Icon } from '../../atoms/Icon';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { Granularity, Selector } from './Selector';\nimport { BackButton, Content, Header, Root, SelectorContainer } from './styled';\n\nexport type DateTimeSelectorMode = 'date' | 'time' | 'datetime' | 'month';\n\nexport interface DateTimeSelectorProps extends ViewProps {\n TextComponent?: React.FC<TextProps>;\n value?: Date;\n onChange?: (value: Date) => void | never;\n\n /**\n * Defines the Picker behavior\n * Must be one of ['date', 'time', 'datetime', 'month']\n */\n mode?: DateTimeSelectorMode;\n format?: string;\n locale?: Locale;\n\n /**\n * Maximum date from today\n */\n upperDateThreshold?: Date;\n\n /**\n * Minimum date from today\n */\n lowerDateThreshold?: Date;\n\n /**\n * Minimum and maximum date in distance units from today.\n * The distance unit used depends on the picker mode\n * If mode is date, the unit is day\n * If mode is time, the unit is hour\n * If mode is datetime, the unit is day\n * If mode is month, the unit is month\n */\n offsetThreshold?: number;\n\n /**\n * Maximum date in distance units from today.\n * The distance unit used depends on the picker mode\n * If mode is date, the unit is day\n * If mode is time, the unit is hour\n * If mode is datetime, the unit is day\n * If mode is month, the unit is month\n */\n upperOffsetThreshold?: number;\n\n /**\n * Minimum date in distance units from today.\n * The distance unit used depends on the picker mode\n * If mode is date, the unit is day\n * If mode is time, the unit is hour\n * If mode is datetime, the unit is day\n * If mode is month, the unit is month\n */\n lowerOffsetThreshold?: number;\n\n dateModalTitle?: string;\n timeModalTitle?: string;\n dateConfirmButtonText?: string;\n timeConfirmButtonText?: string;\n dayLabel?: string;\n monthLabel?: string;\n yearLabel?: string;\n hourLabel?: string;\n minuteLabel?: string;\n}\n\nfunction getThresholdUnit(mode: DateTimeSelectorMode, threshold?: number) {\n if (!threshold) return {};\n if (mode === 'month') {\n return { months: threshold };\n } else if (['date', 'datetime'].includes(mode)) {\n return { days: threshold };\n } else {\n return { hours: threshold };\n }\n}\n\nconst DateTimeSelector: React.FC<DateTimeSelectorProps> = ({\n TextComponent = Text,\n value,\n onChange,\n mode = 'date',\n format,\n locale,\n upperDateThreshold: _upperDateThreshold,\n lowerDateThreshold: _lowerDateThreshold,\n offsetThreshold,\n upperOffsetThreshold,\n lowerOffsetThreshold,\n dateModalTitle,\n timeModalTitle,\n dateConfirmButtonText,\n timeConfirmButtonText,\n dayLabel,\n monthLabel,\n yearLabel,\n hourLabel,\n minuteLabel,\n ...rest\n}) => {\n const lowerDateThreshold =\n _lowerDateThreshold ||\n ((offsetThreshold || lowerOffsetThreshold) &&\n sub(\n new Date(),\n getThresholdUnit(mode, offsetThreshold || lowerOffsetThreshold)\n ));\n\n const upperDateThreshold =\n _upperDateThreshold ||\n ((offsetThreshold || upperOffsetThreshold) &&\n add(\n new Date(),\n getThresholdUnit(mode, offsetThreshold || upperOffsetThreshold)\n ));\n\n const [date, setDate] = React.useState<Date>(value || new Date());\n const [currentMode, setCurrentMode] = React.useState<0 | 1>(0);\n\n const isDate =\n ['date', 'month'].includes(mode) ||\n (mode === 'datetime' && currentMode === 0);\n\n const modalTitle = isDate ? dateModalTitle : timeModalTitle;\n const confirmButtonText = isDate\n ? dateConfirmButtonText\n : timeConfirmButtonText;\n\n const handleChange = (granularity: Granularity) => (newValue: number) => {\n setDate(date => {\n let newState: Date;\n // Months and years must have a different handling for being\n // the only date units that may interfere another unit.\n if (['month', 'year'].includes(granularity)) {\n let newDate = set(date, { [granularity]: newValue });\n const daysInMonth = getDaysInMonth(newDate);\n if (granularity === 'year' && date.getMonth() != newDate.getMonth()) {\n newDate = set(newDate, { month: date.getMonth() });\n newState = set(newDate, { date: getDaysInMonth(newDate) });\n }\n newState =\n daysInMonth < date.getDate()\n ? set(newDate, { date: daysInMonth })\n : newDate;\n } else {\n newState = set(date, { [granularity]: newValue });\n }\n\n if (upperDateThreshold && compareAsc(newState, upperDateThreshold) > 0) {\n return upperDateThreshold;\n } else if (\n lowerDateThreshold &&\n compareAsc(newState, lowerDateThreshold) < 0\n ) {\n return lowerDateThreshold;\n } else {\n return newState;\n }\n });\n };\n\n const getDisplayedValue = (granularity: Granularity) => (value: number) => {\n return granularity === 'month'\n ? formatDate(date, 'MMM', { locale: locale }).slice(0, 3)\n : value.toString().padStart(2, '0');\n };\n\n const handlePressConfirm = () => {\n if (mode === 'datetime' && currentMode === 0) {\n setCurrentMode(1);\n } else {\n onChange?.(date);\n }\n };\n\n const handlePressBack = () => {\n setCurrentMode(0);\n };\n\n return (\n <Root {...rest}>\n <Header>\n {currentMode === 1 && (\n <BackButton onPress={handlePressBack}>\n <Icon\n type={'material-community'}\n name={'chevron-left'}\n size={'mega'}\n colorVariant={'secondary'}\n />\n </BackButton>\n )}\n <TextComponent typography={'base'} colorVariant={'secondary'}>\n {modalTitle}\n </TextComponent>\n </Header>\n\n {isDate ? (\n <Content>\n {mode !== 'month' && (\n <SelectorContainer isFirst>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('date')}\n referenceDate={date}\n value={date.getDate()}\n label={dayLabel || 'Day'}\n granularity={'date'}\n getDisplayValue={getDisplayedValue('date')}\n preventUpper={\n upperDateThreshold\n ? isSameDay(upperDateThreshold, date)\n : false\n }\n preventLower={\n lowerDateThreshold\n ? isSameDay(lowerDateThreshold, date)\n : false\n }\n />\n </SelectorContainer>\n )}\n <SelectorContainer>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('month')}\n referenceDate={date}\n value={date.getMonth()}\n label={monthLabel || 'Month'}\n granularity={'month'}\n getDisplayValue={getDisplayedValue('month')}\n preventUpper={\n upperDateThreshold\n ? isSameMonth(upperDateThreshold, date)\n : false\n }\n preventLower={\n lowerDateThreshold\n ? isSameMonth(lowerDateThreshold, date)\n : false\n }\n />\n </SelectorContainer>\n <SelectorContainer isLast>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('year')}\n referenceDate={date}\n value={date.getFullYear()}\n label={yearLabel || 'Year'}\n granularity={'year'}\n getDisplayValue={getDisplayedValue('year')}\n preventUpper={\n upperDateThreshold\n ? isSameYear(upperDateThreshold, date)\n : false\n }\n preventLower={\n lowerDateThreshold\n ? isSameYear(lowerDateThreshold, date)\n : false\n }\n />\n </SelectorContainer>\n </Content>\n ) : (\n <Content>\n <SelectorContainer isFirst>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('hours')}\n referenceDate={date}\n value={date.getHours()}\n label={hourLabel || 'Hour'}\n granularity={'hours'}\n getDisplayValue={getDisplayedValue('hours')}\n />\n </SelectorContainer>\n <SelectorContainer isLast>\n <Selector\n TextComponent={TextComponent}\n onChange={handleChange('minutes')}\n referenceDate={date}\n value={date.getMinutes()}\n label={minuteLabel || 'Minute'}\n granularity={'minutes'}\n getDisplayValue={getDisplayedValue('minutes')}\n />\n </SelectorContainer>\n </Content>\n )}\n <Button color={'primary'} onPress={handlePressConfirm}>\n <TextComponent fontWeight=\"bold\" fontColor=\"light\">\n {confirmButtonText || 'OK'}\n </TextComponent>\n </Button>\n </Root>\n );\n};\n\nexport default DateTimeSelector;\n"],"file":"DateTimeSelector.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/Selector.tsx"],"names":["getPrevAndNext","value","granularity","daysInMonth","multiplier","next","prev","Selector","label","onChange","getDisplayValue","referenceDate","preventUpper","preventLower","TextComponent","rest","pressInTimeoutRef","React","useRef","handlePressInNext","_next","clearTimeout","current","setTimeout","handlePressInPrev","_prev","handlePressOut","requestAnimationFrame","opacity"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/Selector.tsx"],"names":["getPrevAndNext","value","granularity","daysInMonth","multiplier","next","prev","Selector","label","onChange","getDisplayValue","referenceDate","preventUpper","preventLower","TextComponent","rest","pressInTimeoutRef","React","useRef","handlePressInNext","_next","clearTimeout","current","setTimeout","handlePressInPrev","_prev","handlePressOut","requestAnimationFrame","opacity"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;AAgBA,SAASA,cAAT,CACEC,KADF,EAEEC,WAFF,EAGEC,WAHF,EAIEC,UAAU,GAAG,CAJf,EAKoB;AAClB,MAAIC,IAAI,GAAGJ,KAAK,GAAGG,UAAnB;AAAA,MACEE,IAAI,GAAGL,KAAK,GAAGG,UADjB;;AAGA,MAAIF,WAAW,KAAK,MAApB,EAA4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UAAU,EAAEO,cAFd;AAGE,IAAA,QAAQ,EAAEd;AAHZ,KAKE,oBAAC,UAAD;AACE,IAAA,IAAI,EAAE,YADR;AAEE,IAAA,IAAI,EAAE,oBAFR;AAGE,IAAA,IAAI,EAAE,MAHR;AAIE,IAAA,YAAY,EAAE;AAJhB,IALF,CADF,EAaE,oBAAC,qBAAD,QACE,oBAAC,aAAD;AAAe,IAAA,YAAY,EAAE,WAA7B;AAA0C,IAAA,UAAU,EAAE;AAAtD,KACGJ,KADH,CADF,EAIE,oBAAC,aAAD;AAAe,IAAA,UAAU,EAAE,MAA3B;AAAmC,IAAA,UAAU,EAAE;AAA/C,KACGE,eAAe,CAACT,KAAD,CADlB,CAJF,CAbF,EAqBE,oBAAC,eAAD;AACE,IAAA,SAAS,EAAE,MAAM0B,qBAAqB,CAAC,MAAMH,iBAAiB,EAAxB,CADxC;AAEE,IAAA,UAAU,EAAEE,cAFd;AAGE,IAAA,QAAQ,EAAEb,YAHZ;AAIE,IAAA,KAAK,EAAE;AAAEe,MAAAA,OAAO,EAAEf,YAAY,GAAG,CAAH,GAAO;AAA9B;AAJT,KAME,oBAAC,UAAD;AACE,IAAA,IAAI,EAAE,cADR;AAEE,IAAA,IAAI,EAAE,oBAFR;AAGE,IAAA,IAAI,EAAE,MAHR;AAIE,IAAA,YAAY,EAAE;AAJhB,IANF,CArBF,CADF;AAqCD,CA3EM","sourcesContent":["import { getDaysInMonth } from 'date-fns';\nimport * as React from 'react';\nimport { ViewProps } from 'react-native';\nimport { Icon } from '../../atoms/Icon';\nimport { TextProps } from '../../atoms/Text';\nimport { Control, SelectorRoot, SelectorValue } from './styled';\n\nexport type Granularity = 'date' | 'month' | 'year' | 'hours' | 'minutes';\n\ninterface SelectorProps extends ViewProps {\n TextComponent: React.FC<TextProps>;\n granularity: Granularity;\n referenceDate: Date;\n label: string;\n value: number;\n getDisplayValue: (value: number) => string;\n onChange: (value: number) => void | never;\n preventUpper?: boolean;\n preventLower?: boolean;\n}\n\nfunction getPrevAndNext(\n value: number,\n granularity: Granularity,\n daysInMonth: number,\n multiplier = 1\n): [number, number] {\n let next = value + multiplier,\n prev = value - multiplier;\n\n if (granularity === 'date') {\n next = next > daysInMonth ? 1 : next;\n prev = prev < 1 ? daysInMonth : prev;\n } else if (granularity === 'month') {\n next = next > 11 ? 0 : next;\n prev = prev < 0 ? 11 : prev;\n } else if (granularity === 'hours') {\n next = next > 23 ? 0 : next;\n prev = prev < 0 ? 23 : prev;\n } else if (granularity === 'minutes') {\n next = next > 59 ? 0 : next;\n prev = prev < 0 ? 59 : prev;\n }\n\n return [prev, next];\n}\nexport const Selector: React.FC<SelectorProps> = ({\n granularity,\n label,\n value,\n onChange,\n getDisplayValue,\n referenceDate,\n preventUpper,\n preventLower,\n TextComponent,\n ...rest\n}) => {\n const pressInTimeoutRef = React.useRef<number>();\n\n const handlePressInNext = (_next?: number) => {\n const daysInMonth = getDaysInMonth(referenceDate);\n const next = _next || getPrevAndNext(value, granularity, daysInMonth)[1];\n clearTimeout(pressInTimeoutRef.current);\n pressInTimeoutRef.current = setTimeout(() => {\n handlePressInNext(getPrevAndNext(next, granularity, daysInMonth, 3)[1]);\n }, 500);\n onChange(next);\n };\n\n const handlePressInPrev = (_prev?: number) => {\n const daysInMonth = getDaysInMonth(referenceDate);\n const prev = _prev || getPrevAndNext(value, granularity, daysInMonth)[0];\n clearTimeout(pressInTimeoutRef.current);\n pressInTimeoutRef.current = setTimeout(() => {\n handlePressInPrev(getPrevAndNext(prev, granularity, daysInMonth, 3)[0]);\n }, 500);\n onChange(prev);\n };\n\n const handlePressOut = () => {\n pressInTimeoutRef.current && clearTimeout(pressInTimeoutRef.current);\n };\n\n return (\n <SelectorRoot {...rest}>\n <Control\n onPressIn={() => requestAnimationFrame(() => handlePressInNext())}\n onPressOut={handlePressOut}\n disabled={preventUpper}\n >\n <Icon\n name={'chevron-up'}\n type={'material-community'}\n size={'mega'}\n colorVariant={'primary'}\n />\n </Control>\n <SelectorValue>\n <TextComponent colorVariant={'secondary'} typography={'sub'}>\n {label}\n </TextComponent>\n <TextComponent fontWeight={'bold'} typography={'h5'}>\n {getDisplayValue(value)}\n </TextComponent>\n </SelectorValue>\n <Control\n onPressIn={() => requestAnimationFrame(() => handlePressInPrev())}\n onPressOut={handlePressOut}\n disabled={preventLower}\n style={{ opacity: preventLower ? 0 : 1 }}\n >\n <Icon\n name={'chevron-down'}\n type={'material-community'}\n size={'mega'}\n colorVariant={'primary'}\n />\n </Control>\n </SelectorRoot>\n );\n};\n"],"file":"Selector.js"}
|
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "DateTimeSelector", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _DateTimeSelector.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "DateTimeSelectorProps", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _DateTimeSelector.DateTimeSelectorProps;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "DateTimeSelectorMode", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _DateTimeSelector.DateTimeSelectorMode;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.DateTimeSelectorMode = exports.DateTimeSelectorProps = exports.DateTimeSelector = void 0;
|
|
24
5
|
|
|
25
6
|
var _DateTimeSelector = _interopRequireWildcard(require("./DateTimeSelector"));
|
|
26
7
|
|
|
8
|
+
exports.DateTimeSelector = _DateTimeSelector.default;
|
|
9
|
+
exports.DateTimeSelectorProps = _DateTimeSelector.DateTimeSelectorProps;
|
|
10
|
+
exports.DateTimeSelectorMode = _DateTimeSelector.DateTimeSelectorMode;
|
|
11
|
+
|
|
27
12
|
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); }
|
|
28
13
|
|
|
29
14
|
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; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export {\n default as DateTimeSelector,\n DateTimeSelectorProps,\n DateTimeSelectorMode,\n} from './DateTimeSelector';\n"],"file":"index.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.BackButton = exports.Header = exports.Control = exports.SelectorContainer = exports.SelectorValue = exports.SelectorRoot = exports.Content = exports.Root = void 0;
|
|
7
5
|
|
|
8
6
|
var _native = _interopRequireDefault(require("@emotion/native"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/styled.ts"],"names":["Root","styled","View","theme","miscellaneous","surfaceColor","Content","spacing","deca","SelectorRoot","color","secondary","xlight","borderRadius","mili","SelectorValue","SelectorContainer","isFirst","isLast","Control","PressableSurface","micro","Header","BackButton"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/styled.ts"],"names":["Root","styled","View","theme","miscellaneous","surfaceColor","Content","spacing","deca","SelectorRoot","color","secondary","xlight","borderRadius","mili","SelectorValue","SelectorContainer","isFirst","isLast","Control","PressableSurface","micro","Header","BackButton"],"mappings":";;;;;AAAA;;AAEA;;AACA;;;;AAEO,MAAMA,IAAI,GAAGC,gBAAOC,IAA0B;AACrD;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,aAAN,CAAoBC,YAAa;AACtE,CAHO;;AAKA,MAAMC,OAAO,GAAGL,gBAAOC,IAA0B;AACxD;AACA;AACA,qBAAqB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,OAAN,CAAcC,IAAK;AACvD,CAJO;;AAMA,MAAMC,YAAY,GAAGR,gBAAOC,IAA0B;AAC7D,kBAAkB,uBAAW,KAAX,CAAkB;AACpC,kBAAkB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACO,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AAC9D,mBAAmB,CAAC;AAAET,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACU,YAAN,CAAmBC,IAAK;AAC1D,CAJO;;AAMA,MAAMC,aAAa,GAAGd,gBAAOC,IAAK;AACzC;AACA,CAFO;;AAIA,MAAMc,iBAAiB,GAAGf,gBAAOC,IAEtC;AACF,kBAAkB,CAAC;AAAEC,EAAAA,KAAF;AAASc,EAAAA;AAAT,CAAD,KAAyBA,OAAO,GAAGd,KAAK,CAACI,OAAN,CAAcC,IAAjB,GAAwB,CAAG;AAC7E,iBAAiB,CAAC;AAAEL,EAAAA,KAAF;AAASe,EAAAA;AAAT,CAAD,KAAwBA,MAAM,GAAGf,KAAK,CAACI,OAAN,CAAcC,IAAjB,GAAwB,CAAG;AAC1E;AACA,CANO;;AAQA,MAAMW,OAAO,GAAG,qBAAOC,kCAAP,CAA8C;AACrE,mBAAmB,CAAC;AAAEjB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACU,YAAN,CAAmBC,IAAK;AAC1D,aAAa,CAAC;AAAEX,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,OAAN,CAAcc,KAAM;AAChD,qBAAqB,CAAC;AAAElB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,OAAN,CAAcO,IAAK;AACvD,uBAAuB,CAAC;AAAEX,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,OAAN,CAAcO,IAAK;AACzD,CALO;;AAOA,MAAMQ,MAAM,GAAGrB,gBAAOC,IAAK;AAClC;AACA;AACA;AACA;AACA,CALO;;AAOA,MAAMqB,UAAU,GAAG,qBAAOH,kCAAP,CAA8C;AACxE,mBAAmB,CAAC;AAAEjB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACU,YAAN,CAAmBC,IAAK;AAC1D,aAAa,CAAC;AAAEX,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,OAAN,CAAcc,KAAM;AAChD;AACA;AACA;AACA,CANO","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\nimport { PressableSurface } from '../../atoms/PressableSurface';\n\nexport const Root = styled.View<Partial<StyleProps>>`\n position: relative;\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n`;\n\nexport const Content = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n justify-content: space-between;\n margin-vertical: ${({ theme }) => theme.spacing.deca};\n`;\n\nexport const SelectorRoot = styled.View<Partial<StyleProps>>`\n border-width: ${RFValueStr('1px')};\n border-color: ${({ theme }) => theme.color.secondary.xlight};\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n`;\n\nexport const SelectorValue = styled.View`\n align-items: center;\n`;\n\nexport const SelectorContainer = styled.View<\n Partial<StyleProps> & { isFirst?: boolean; isLast?: boolean }\n>`\n margin-right: ${({ theme, isFirst }) => (isFirst ? theme.spacing.deca : 0)};\n margin-left: ${({ theme, isLast }) => (isLast ? theme.spacing.deca : 0)};\n flex: 1;\n`;\n\nexport const Control = styled(PressableSurface)<Partial<StyleProps>>`\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n padding: ${({ theme }) => theme.spacing.micro};\n margin-vertical: ${({ theme }) => theme.spacing.mili};\n margin-horizontal: ${({ theme }) => theme.spacing.mili};\n`;\n\nexport const Header = styled.View`\n width: 100%;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n`;\n\nexport const BackButton = styled(PressableSurface)<Partial<StyleProps>>`\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n padding: ${({ theme }) => theme.spacing.micro};\n position: absolute;\n aspect-ratio: 1;\n left: 0;\n`;\n"],"file":"styled.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.default = void 0;
|
|
7
5
|
|
|
8
6
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -45,9 +43,9 @@ const Grid = ({
|
|
|
45
43
|
flexWrap: 'wrap'
|
|
46
44
|
}]
|
|
47
45
|
}, rest), _react.default.Children.map(children, child => {
|
|
48
|
-
return _react.default.cloneElement(child, { ...(child
|
|
46
|
+
return _react.default.cloneElement(child, { ...(child == null ? void 0 : child.props),
|
|
49
47
|
columns,
|
|
50
|
-
spacing: (child
|
|
48
|
+
spacing: (child == null ? void 0 : child.props.spacing) ?? spacing
|
|
51
49
|
});
|
|
52
50
|
}));
|
|
53
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Grid/Grid.tsx"],"names":["Grid","children","columns","layout","style","spacing","rest","flatLayout","flat","display","flexDirection","flexWrap","React","Children","map","child","index","cloneElement","props"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Grid/Grid.tsx"],"names":["Grid","children","columns","layout","style","spacing","rest","flatLayout","flat","display","flexDirection","flexWrap","React","Children","map","child","index","cloneElement","props"],"mappings":";;;;;AAAA;;AACA;;AACA;;;;;;AA0BA,MAAMA,IAAI,GAAG,CAAC;AACZC,EAAAA,QADY;AAEZC,EAAAA,OAAO,GAAG,EAFE;AAGZC,EAAAA,MAHY;AAIZC,EAAAA,KAJY;AAKZC,EAAAA,OALY;AAMZ,KAAGC;AANS,CAAD,KAOA;AACX,MAAIH,MAAJ,EAAY;AACV,UAAMI,UAAU,GAAGJ,MAAM,CAACK,IAAP,EAAnB;AACA,WACE,6BAAC,iBAAD;AACE,MAAA,KAAK,EAAE,CACLJ,KADK,EAEL;AACEK,QAAAA,OAAO,EAAE,MADX;AAEEC,QAAAA,aAAa,EAAE,KAFjB;AAGEC,QAAAA,QAAQ,EAAE;AAHZ,OAFK;AADT,OASML,IATN,GAWGM,eAAMC,QAAN,CAAeC,GAAf,CAAmBb,QAAnB,EAA6B,CAACc,KAAD,EAAQC,KAAR,KAC5B,6BAAC,cAAD;AACE,MAAA,OAAO,EAAEd,OADX;AAEE,MAAA,IAAI,EAAEK,UAAU,CAACS,KAAD,CAFlB;AAGE,MAAA,OAAO,EAAEX;AAHX,OAKGU,KALH,CADD,CAXH,CADF;AAuBD;;AAED,SACE,6BAAC,iBAAD;AACE,IAAA,KAAK,EAAE,CACLX,KADK,EAEL;AACEK,MAAAA,OAAO,EAAE,MADX;AAEEC,MAAAA,aAAa,EAAE,KAFjB;AAGEC,MAAAA,QAAQ,EAAE;AAHZ,KAFK;AADT,KASML,IATN,GAWGM,eAAMC,QAAN,CAAeC,GAAf,CAAmBb,QAAnB,EAA6Bc,KAAK,IAAI;AACrC,WAAOH,eAAMK,YAAN,CAAmBF,KAAnB,EAA0B,EAC/B,IAAGA,KAAH,oBAAGA,KAAK,CAAEG,KAAV,CAD+B;AAE/BhB,MAAAA,OAF+B;AAG/BG,MAAAA,OAAO,EAAE,CAAAU,KAAK,QAAL,YAAAA,KAAK,CAAEG,KAAP,CAAab,OAAb,KAAwBA;AAHF,KAA1B,CAAP;AAKD,GANA,CAXH,CADF;AAqBD,CAxDD;;eA0DeL,I","sourcesContent":["import React from 'react';\nimport { View, ViewProps } from 'react-native';\nimport { GridItem } from './Item';\nimport { SpacingType } from '@tecsinapse/react-core';\n\nexport interface IGrid extends ViewProps {\n children: JSX.Element[];\n /** Layout should represent the multiplier of columns to fill the rows properly.\n * Example:\n * const layout = [\n * [6, 6], // Two elements on row\n * [4, 4, 4], // Three elements on row\n * [12], // One element on row\n * ];\n * */\n layout?: number[][];\n /** Number of grid columns to be considered (not the number of elements per row) */\n columns?: number;\n spacing?:\n | SpacingType\n | {\n top?: SpacingType;\n right?: SpacingType;\n bottom?: SpacingType;\n left?: SpacingType;\n };\n}\n\nconst Grid = ({\n children,\n columns = 12,\n layout,\n style,\n spacing,\n ...rest\n}: IGrid) => {\n if (layout) {\n const flatLayout = layout.flat();\n return (\n <View\n style={[\n style,\n {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n ]}\n {...rest}\n >\n {React.Children.map(children, (child, index) => (\n <GridItem\n columns={columns}\n span={flatLayout[index]}\n spacing={spacing}\n >\n {child}\n </GridItem>\n ))}\n </View>\n );\n }\n\n return (\n <View\n style={[\n style,\n {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n ]}\n {...rest}\n >\n {React.Children.map(children, child => {\n return React.cloneElement(child, {\n ...child?.props,\n columns,\n spacing: child?.props.spacing ?? spacing,\n });\n })}\n </View>\n );\n};\n\nexport default Grid;\n"],"file":"Grid.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.default = void 0;
|
|
7
5
|
|
|
8
6
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -54,9 +52,9 @@ const GridItem = ({
|
|
|
54
52
|
paddingLeft: getPadding('left')
|
|
55
53
|
};
|
|
56
54
|
|
|
57
|
-
const clone = _react.default.cloneElement(children, { ...(children
|
|
58
|
-
style: wrapper ? children
|
|
59
|
-
...(children
|
|
55
|
+
const clone = _react.default.cloneElement(children, { ...(children == null ? void 0 : children.props),
|
|
56
|
+
style: wrapper ? children == null ? void 0 : children.props.style : { ...style,
|
|
57
|
+
...(children == null ? void 0 : children.props.style)
|
|
60
58
|
}
|
|
61
59
|
});
|
|
62
60
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/Item.tsx"],"names":["GridItem","children","span","columns","loadingComponent","loading","spacing","_spacing","wrapper","rest","React","Children","only","Error","getPadding","pos","undefined","style","boxSizing","flexBasis","paddingTop","paddingBottom","paddingRight","paddingLeft","clone","cloneElement","props"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/Item.tsx"],"names":["GridItem","children","span","columns","loadingComponent","loading","spacing","_spacing","wrapper","rest","React","Children","only","Error","getPadding","pos","undefined","style","boxSizing","flexBasis","paddingTop","paddingBottom","paddingRight","paddingLeft","clone","cloneElement","props"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAwCA,MAAMA,QAAQ,GAAG,CAAC;AAChBC,EAAAA,QADgB;AAEhBC,EAAAA,IAFgB;AAGhBC,EAAAA,OAAO,GAAG,EAHM;AAIhBC,EAAAA,gBAJgB;AAKhBC,EAAAA,OAAO,GAAG,KALM;AAMhBC,EAAAA,OAAO,EAAEC,QANO;AAOhBC,EAAAA,OAAO,GAAG,KAPM;AAQhB,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AAGA,KAAL;AAAY,UAAGhB,QAAH,oBAAGA,QAAQ,CAAEyB,KAAV,CAAgBT,KAAnB;AAAZ;AAJqC,GAA7B,CAAd;;AAOA,SAAOT,OAAO,GAAG,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAES;AAAb,KAAqBO,KAArB,CAAH,GAAwCA,KAAtD;AACD,CA9CD;;eAgDexB,Q","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { useTheme } from '../../../../hooks';\nimport { SpacingType } from '../../../../types/defaults';\nimport { extractNumbersFromString } from '../../../../utils';\n\ntype FlexPositioning = 'flex-start' | 'flex-end' | 'center';\ntype FlexAlignBase = FlexPositioning | 'stretch';\ntype FlexAlignType = FlexAlignBase | 'baseline';\ntype FlexSpacing = 'space-between' | 'space-around';\n\ntype PaddingPosition = 'top' | 'right' | 'bottom' | 'left';\n\nexport interface IGridItem {\n children: React.ReactElement;\n /** Number of columns to fill */\n span: number;\n /** You don't have to give this property since is inherited from Grid */\n columns?: number;\n loading?: boolean;\n /** If your GridItem has a loading state, specify the component here (Skeleton) */\n loadingComponent?: React.ReactElement;\n /** Flex properties below */\n alignContent?: FlexAlignBase | FlexSpacing;\n alignItems?: FlexAlignType;\n alignSelf?: 'auto' | FlexAlignType;\n flex?: number;\n flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';\n flexGrow?: number;\n flexShrink?: number;\n justifyContent?: FlexPositioning | FlexSpacing | 'space-evenly';\n /** You don't have to give this property since is inherited from Grid */\n spacing?:\n | SpacingType\n | {\n top?: SpacingType;\n right?: SpacingType;\n bottom?: SpacingType;\n left?: SpacingType;\n };\n /** Used to wrap children in a View when its style extrapolates the dimensions*/\n wrapper?: boolean;\n}\n\nconst GridItem = ({\n children,\n span,\n columns = 12,\n loadingComponent,\n loading = false,\n spacing: _spacing,\n wrapper = false,\n ...rest\n}: IGridItem) => {\n const { spacing } = useTheme();\n if (!React.Children.only(children)) {\n throw new Error('The number of children in GridItem should be one');\n }\n if (loadingComponent && loading) {\n return loadingComponent;\n }\n\n const getPadding = (pos: PaddingPosition) => {\n if (_spacing) {\n if (typeof _spacing === 'string')\n return extractNumbersFromString(spacing[_spacing]);\n else if (typeof _spacing === 'object' && _spacing[pos]) {\n return extractNumbersFromString(spacing[_spacing[pos]!]);\n } else return undefined;\n } else return undefined;\n };\n\n const style = {\n ...rest,\n boxSizing: 'border-box',\n flexBasis: `${100 / (columns / span)}%`,\n paddingTop: getPadding('top'),\n paddingBottom: getPadding('bottom'),\n paddingRight: getPadding('right'),\n paddingLeft: getPadding('left'),\n };\n\n const clone = React.cloneElement(children, {\n ...children?.props,\n style: wrapper\n ? children?.props.style\n : { ...style, ...children?.props.style },\n });\n\n return wrapper ? <View style={style}>{clone}</View> : clone;\n};\n\nexport default GridItem;\n"],"file":"Item.js"}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "GridItem", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Item.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "IGridItem", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _Item.IGridItem;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.IGridItem = exports.GridItem = void 0;
|
|
18
5
|
|
|
19
6
|
var _Item = _interopRequireWildcard(require("./Item"));
|
|
20
7
|
|
|
8
|
+
exports.GridItem = _Item.default;
|
|
9
|
+
exports.IGridItem = _Item.IGridItem;
|
|
10
|
+
|
|
21
11
|
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); }
|
|
22
12
|
|
|
23
13
|
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; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { default as GridItem, IGridItem } from './Item';\n"],"file":"index.js"}
|
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "GridItem", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Item.GridItem;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "IGridItem", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _Item.IGridItem;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "Grid", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _Grid.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "IGrid", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _Grid.IGrid;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.IGrid = exports.Grid = exports.IGridItem = exports.GridItem = void 0;
|
|
30
5
|
|
|
31
6
|
var _Item = require("./Item");
|
|
32
7
|
|
|
8
|
+
exports.GridItem = _Item.GridItem;
|
|
9
|
+
exports.IGridItem = _Item.IGridItem;
|
|
10
|
+
|
|
33
11
|
var _Grid = _interopRequireWildcard(require("./Grid"));
|
|
34
12
|
|
|
13
|
+
exports.Grid = _Grid.default;
|
|
14
|
+
exports.IGrid = _Grid.IGrid;
|
|
15
|
+
|
|
35
16
|
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); }
|
|
36
17
|
|
|
37
18
|
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; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Grid/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Grid/index.ts"],"names":[],"mappings":";;;;;AAAA;;;;;AACA","sourcesContent":["export { GridItem, IGridItem } from './Item';\nexport { default as Grid, IGrid } from './Grid';\n"],"file":"index.js"}
|
|
@@ -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":"
|
|
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;;AACA;;AACA;;;;;;;;AAeA,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,WAAD;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,8BAAD;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 * as React from 'react';\nimport { StyleProp, View, ViewStyle } from 'react-native';\nimport { Hint, InputVariantType, PressableInputContainer, PressableInputContainerProps } from '../../atoms/Input';\nimport { TextProps } from '../../atoms/Text';\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,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "HintInputContainer", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _HintInputContainer.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.HintInputContainer = void 0;
|
|
12
5
|
|
|
13
6
|
var _HintInputContainer = _interopRequireDefault(require("./HintInputContainer"));
|
|
14
7
|
|
|
8
|
+
exports.HintInputContainer = _HintInputContainer.default;
|
|
9
|
+
|
|
15
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/HintInputContainer/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/HintInputContainer/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { default as HintInputContainer } from './HintInputContainer';\nexport type { HintInputContainerProps } from './HintInputContainer';\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/InputPassword/InputPasswordIcon.tsx"],"names":["InputPasswordIcon","revealed","onChangeState","rest","icon"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/InputPassword/InputPasswordIcon.tsx"],"names":["InputPasswordIcon","revealed","onChangeState","rest","icon"],"mappings":";;;;;AAAA;;AAEA;;AACA;;;;;;AAOA,MAAMA,iBAA6C,GAAG,CAAC;AACrDC,EAAAA,QADqD;AAErDC,EAAAA,aAFqD;AAGrD,KAAGC;AAHkD,CAAD,KAIhD;AACJ,QAAMC,IAAI,GAAGH,QAAQ,GAAG,aAAH,GAAmB,iBAAxC;AACA,SACE,6BAAC,gCAAD,eACME,IADN;AAEE,IAAA,OAAO,EAAC,MAFV;AAGE,IAAA,IAAI,EAAC,OAHP;AAIE,IAAA,OAAO,EAAE,MAAMD,aAAa,CAAC,CAACD,QAAF;AAJ9B,MAME,6BAAC,UAAD;AAAM,IAAA,IAAI,EAAEG,IAAZ;AAAkB,IAAA,IAAI,EAAC,SAAvB;AAAiC,IAAA,IAAI,EAAC;AAAtC,IANF,CADF;AAUD,CAhBD;;eAkBeJ,iB","sourcesContent":["import React, { FC } from 'react';\nimport { ButtonProps } from '../../atoms/Button';\nimport { Icon } from '../../atoms/Icon';\nimport { StyledPasswordButtonIcon } from './styled';\n\ninterface InputPasswordIconProps extends ButtonProps {\n revealed: boolean;\n onChangeState: (revealed: boolean) => void;\n}\n\nconst InputPasswordIcon: FC<InputPasswordIconProps> = ({\n revealed,\n onChangeState,\n ...rest\n}) => {\n const icon = revealed ? 'eye-outline' : 'eye-off-outline';\n return (\n <StyledPasswordButtonIcon\n {...rest}\n variant=\"text\"\n size=\"small\"\n onPress={() => onChangeState(!revealed)}\n >\n <Icon name={icon} type=\"ionicon\" size=\"centi\" />\n </StyledPasswordButtonIcon>\n );\n};\n\nexport default InputPasswordIcon;\n"],"file":"InputPasswordIcon.js"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "InputPasswordIcon", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _InputPasswordIcon.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.InputPasswordIcon = void 0;
|
|
12
5
|
|
|
13
6
|
var _InputPasswordIcon = _interopRequireDefault(require("./InputPasswordIcon"));
|
|
14
7
|
|
|
8
|
+
exports.InputPasswordIcon = _InputPasswordIcon.default;
|
|
9
|
+
|
|
15
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/InputPassword/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/InputPassword/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { default as InputPasswordIcon } from './InputPasswordIcon';\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/InputPassword/styled.ts"],"names":["StyledPasswordButtonIcon","Button","theme","spacing","centi"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/InputPassword/styled.ts"],"names":["StyledPasswordButtonIcon","Button","theme","spacing","centi"],"mappings":";;;;;AAAA;;AAEA;;;;AAEO,MAAMA,wBAAwB,GAAG,qBAAOC,cAAP,CAAoC;AAC5E,aAAa,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,KAAM;AAChD,CAFO","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps } from '../../../types/defaults';\nimport { Button } from '../../atoms/Button';\n\nexport const StyledPasswordButtonIcon = styled(Button)<Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.centi};\n`;\n"],"file":"styled.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.default = exports.Snackbar = void 0;
|
|
7
5
|
|
|
8
6
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -62,7 +60,7 @@ const Snackbar = ({
|
|
|
62
60
|
|
|
63
61
|
if (open && timeout) {
|
|
64
62
|
setTimeout(() => {
|
|
65
|
-
onClose
|
|
63
|
+
onClose == null ? void 0 : onClose();
|
|
66
64
|
}, timeout + duration);
|
|
67
65
|
}
|
|
68
66
|
}, [open, timeout]);
|
|
@@ -86,7 +84,7 @@ const Snackbar = ({
|
|
|
86
84
|
fadeOut();
|
|
87
85
|
setTimeout(() => {
|
|
88
86
|
fadeAnim.setValue(0);
|
|
89
|
-
onClose
|
|
87
|
+
onClose == null ? void 0 : onClose();
|
|
90
88
|
}, duration);
|
|
91
89
|
}
|
|
92
90
|
}, _react.default.createElement(_Icon.Icon, _extends({}, rightIcon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Snackbar/Snackbar.tsx"],"names":["Snackbar","children","open","onClose","dismissable","timeout","undefined","leftIcon","colorTone","colorVariant","rightIcon","anchor","anchorDistance","style","fadeAnim","React","useRef","Animated","Value","current","duration","fadeIn","timing","toValue","useNativeDriver","start","fadeOut","delay","useEffect","setTimeout","opacity","setValue","direction"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Snackbar/Snackbar.tsx"],"names":["Snackbar","children","open","onClose","dismissable","timeout","undefined","leftIcon","colorTone","colorVariant","rightIcon","anchor","anchorDistance","style","fadeAnim","React","useRef","Animated","Value","current","duration","fadeIn","timing","toValue","useNativeDriver","start","fadeOut","delay","useEffect","setTimeout","opacity","setValue","direction"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AA6BO,MAAMA,QAAiC,GAAG,CAAC;AAChDC,EAAAA,QADgD;AAEhDC,EAAAA,IAAI,GAAG,IAFyC;AAGhDC,EAAAA,OAHgD;AAIhDC,EAAAA,WAAW,GAAG,KAJkC;AAKhDC,EAAAA,OAAO,GAAGC,SALsC;AAMhDC,EAAAA,QANgD;AAOhDC,EAAAA,SAAS,GAAG,QAPoC;AAQhDC,EAAAA,YAAY,GAAG,SARiC;AAShDC,EAAAA,SAAS,GAAG;AAAEF,IAAAA,SAAS,EAAE,QAAb;AAAuBC,IAAAA,YAAY,EAAE;AAArC,GAToC;AAUhDE,EAAAA,MAAM,GAAG,QAVuC;AAWhDC,EAAAA,cAXgD;AAYhDC,EAAAA;AAZgD,CAAD,KAa3C;AACJ,QAAMC,QAAQ,GAAGC,eAAMC,MAAN,CAAa,IAAIC,sBAASC,KAAb,CAAmB,CAAnB,CAAb,EAAoCC,OAArD;;AACA,QAAMC,QAAQ,GAAG,GAAjB;;AAEA,QAAMC,MAAM,GAAG,MAAM;AACnBJ,0BAASK,MAAT,CAAgBR,QAAhB,EAA0B;AACxBS,MAAAA,OAAO,EAAE,CADe;AAExBC,MAAAA,eAAe,EAAE,IAFO;AAGxBJ,MAAAA;AAHwB,KAA1B,EAIGK,KAJH,CAIS,MAAMpB,OAAO,IAAIqB,OAAO,EAJjC;AAKD,GAND;;AAQA,QAAMA,OAAO,GA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QAAT,CAAkB,CAAlB;AACA5B,QAAAA,OAAO,QAAP,YAAAA,OAAO;AACR,OAHS,EAGPiB,QAHO,CAAV;AAID;AARH,KAUE,6BAAC,UAAD,eACMV,SADN;AAEE,IAAA,IAAI,EAAC,OAFP;AAGE,IAAA,IAAI,EAAC,OAHP;AAIE,IAAA,IAAI,EAAC;AAJP,KAVF,CAVJ,CAVF,EAuCGL,OAAO,IAAIH,IAAX,IACC,6BAAC,yBAAD;AACE,IAAA,QAAQ,EAAE,CADZ;AAEE,IAAA,QAAQ,EAAE,GAFZ;AAGE,IAAA,QAAQ,EAAE,CAHZ;AAIE,IAAA,OAAO,EAAE,IAJX;AAKE,IAAA,KAAK,EAAEO,YALT;AAME,IAAA,SAAS,EAAC,QANZ;AAOE,IAAA,mBAAmB,EAAE;AAAEuB,MAAAA,SAAS,EAAE,MAAb;AAAqBZ,MAAAA,QAAQ,EAAEf;AAA/B;AAPvB,IAxCJ,CADF;AAqDD,CAlGM;;;eAoGQL,Q","sourcesContent":["import React from 'react';\nimport { Animated, StyleProp, ViewStyle } from 'react-native';\nimport { ColorGradationType, ColorType } from '../../../types/defaults';\nimport { Icon, IconProps } from '../../atoms/Icon';\nimport {\n ContentContainer,\n DismissContainer,\n IconContainer,\n SnackbarContainer,\n StyledContainerFlexRow,\n StyledProgressBar,\n TextContainer,\n} from './styled';\n\nexport interface SnackbarProps {\n colorVariant?: ColorType;\n colorTone?: ColorGradationType;\n open: boolean;\n /** Close callback */\n onClose?: () => void;\n /** Snackbar is closable */\n dismissable?: boolean;\n /** Time in miliseconds for auto hide */\n timeout?: number;\n leftIcon?: IconProps;\n /** Properties for close icon */\n rightIcon?: Omit<IconProps, 'name' | 'type'>;\n anchor?: 'top' | 'bottom';\n /** Distance from anchorage (results in px) */\n anchorDistance?: number;\n style?: StyleProp<ViewStyle>;\n}\n\nexport const Snackbar: React.FC<SnackbarProps> = ({\n children,\n open = true,\n onClose,\n dismissable = false,\n timeout = undefined,\n leftIcon,\n colorTone = 'xlight',\n colorVariant = 'primary',\n rightIcon = { colorTone: 'medium', colorVariant: 'primary' },\n anchor = 'bottom',\n anchorDistance,\n style,\n}) => {\n const fadeAnim = React.useRef(new Animated.Value(0)).current;\n const duration = 500;\n\n const fadeIn = () => {\n Animated.timing(fadeAnim, {\n toValue: 1,\n useNativeDriver: true,\n duration,\n }).start(() => timeout && fadeOut());\n };\n\n const fadeOut = () => {\n Animated.timing(fadeAnim, {\n toValue: 0,\n useNativeDriver: true,\n duration,\n delay: timeout ? timeout - duration : 0,\n }).start();\n };\n\n React.useEffect(() => {\n if (open) {\n fadeIn();\n }\n if (open && timeout) {\n setTimeout(() => {\n onClose?.();\n }, timeout + duration);\n }\n }, [open, timeout]);\n\n return (\n <SnackbarContainer\n colorVariant={colorVariant}\n colorTone={colorTone}\n elevated\n anchor={anchor}\n anchorDistance={anchorDistance}\n visible={open}\n style={[{ opacity: (fadeAnim as unknown) as number }, style]}\n timeout={timeout}\n >\n <StyledContainerFlexRow>\n <ContentContainer>\n {leftIcon && (\n <IconContainer>\n <Icon {...leftIcon} size=\"centi\" />\n </IconContainer>\n )}\n <TextContainer>{children}</TextContainer>\n </ContentContainer>\n {dismissable && (\n <DismissContainer\n effect=\"none\"\n onPress={() => {\n fadeOut();\n setTimeout(() => {\n fadeAnim.setValue(0);\n onClose?.();\n }, duration);\n }}\n >\n <Icon\n {...rightIcon}\n size=\"centi\"\n name=\"close\"\n type=\"material-community\"\n />\n </DismissContainer>\n )}\n </StyledContainerFlexRow>\n {timeout && open && (\n <StyledProgressBar\n valueNow={0}\n valueMax={100}\n valueMin={0}\n animate={true}\n color={colorVariant}\n colorTone=\"medium\"\n animationParameters={{ direction: 'left', duration: timeout }}\n />\n )}\n </SnackbarContainer>\n );\n};\n\nexport default Snackbar;\n"],"file":"Snackbar.js"}
|