@tecsinapse/react-core 1.17.3 → 1.19.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 +39 -0
- package/dist/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/components/atoms/Avatar/helpers.js.map +1 -1
- package/dist/components/atoms/Avatar/index.js.map +1 -1
- package/dist/components/atoms/Avatar/styled.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.js.map +1 -1
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/Badge/styled.js.map +1 -1
- package/dist/components/atoms/BoxContent/BoxContent.js.map +1 -1
- package/dist/components/atoms/BoxContent/index.js.map +1 -1
- package/dist/components/atoms/BoxContent/styled.js +1 -1
- package/dist/components/atoms/BoxContent/styled.js.map +1 -1
- package/dist/components/atoms/Button/Button.js +1 -1
- package/dist/components/atoms/Button/Button.js.map +1 -1
- package/dist/components/atoms/Button/States/BaseState.js.map +1 -1
- package/dist/components/atoms/Button/States/Error.js +1 -1
- package/dist/components/atoms/Button/States/Error.js.map +1 -1
- package/dist/components/atoms/Button/States/Loading.js.map +1 -1
- package/dist/components/atoms/Button/States/Success.js +1 -1
- package/dist/components/atoms/Button/States/Success.js.map +1 -1
- package/dist/components/atoms/Button/States/index.js.map +1 -1
- package/dist/components/atoms/Button/States/styled.js +1 -1
- package/dist/components/atoms/Button/States/styled.js.map +1 -1
- package/dist/components/atoms/Button/index.js +1 -1
- package/dist/components/atoms/Button/index.js.map +1 -1
- package/dist/components/atoms/Button/styled.js.map +1 -1
- package/dist/components/atoms/Card/Card.js +1 -1
- package/dist/components/atoms/Card/Card.js.map +1 -1
- package/dist/components/atoms/Card/Footer/Footer.js.map +1 -1
- package/dist/components/atoms/Card/Footer/index.js.map +1 -1
- package/dist/components/atoms/Card/Header/Header.js.map +1 -1
- package/dist/components/atoms/Card/Header/index.js.map +1 -1
- package/dist/components/atoms/Card/index.js.map +1 -1
- package/dist/components/atoms/Card/styled.js.map +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.js +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/atoms/Checkbox/index.js.map +1 -1
- package/dist/components/atoms/Checkbox/styled.js +1 -1
- package/dist/components/atoms/Checkbox/styled.js.map +1 -1
- package/dist/components/atoms/Divider/Divider.js.map +1 -1
- package/dist/components/atoms/Divider/index.js.map +1 -1
- package/dist/components/atoms/Divider/styled.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButton.d.ts +1 -1
- package/dist/components/atoms/GroupButton/GroupButton.js +1 -1
- package/dist/components/atoms/GroupButton/GroupButton.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
- package/dist/components/atoms/GroupButton/index.js +1 -1
- package/dist/components/atoms/GroupButton/index.js.map +1 -1
- package/dist/components/atoms/GroupButton/styled.js +1 -1
- package/dist/components/atoms/GroupButton/styled.js.map +1 -1
- package/dist/components/atoms/Icon/Icon.js +1 -1
- package/dist/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/components/atoms/Icon/helpers.js +1 -1
- package/dist/components/atoms/Icon/helpers.js.map +1 -1
- package/dist/components/atoms/Icon/index.js.map +1 -1
- package/dist/components/atoms/Input/Hint.js.map +1 -1
- package/dist/components/atoms/Input/InputContainer/InputContainer.d.ts +1 -1
- package/dist/components/atoms/Input/InputContainer/InputContainer.js +1 -1
- package/dist/components/atoms/Input/InputContainer/InputContainer.js.map +1 -1
- package/dist/components/atoms/Input/InputElement/InputElement.d.ts +3 -4
- package/dist/components/atoms/Input/InputElement/InputElement.js +1 -1
- package/dist/components/atoms/Input/InputElement/InputElement.js.map +1 -1
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.d.ts +3 -4
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.js +1 -1
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.js.map +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/PressableInputContainer.js +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/index.js.map +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/styled.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useInputFocus.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useNumberMask.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useStringMask.js +1 -1
- package/dist/components/atoms/Input/hooks/useStringMask.js.map +1 -1
- package/dist/components/atoms/Input/index.js +1 -1
- package/dist/components/atoms/Input/index.js.map +1 -1
- package/dist/components/atoms/Input/styled.js +1 -1
- package/dist/components/atoms/Input/styled.js.map +1 -1
- package/dist/components/atoms/Paper/Paper.js +1 -1
- package/dist/components/atoms/Paper/Paper.js.map +1 -1
- package/dist/components/atoms/Paper/index.js.map +1 -1
- package/dist/components/atoms/Paper/styled.js.map +1 -1
- package/dist/components/atoms/PressableSurface/PressableSurface.js +1 -1
- package/dist/components/atoms/PressableSurface/PressableSurface.js.map +1 -1
- package/dist/components/atoms/PressableSurface/index.js.map +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/atoms/ProgressBar/index.js.map +1 -1
- package/dist/components/atoms/ProgressBar/styled.js +1 -1
- package/dist/components/atoms/ProgressBar/styled.js.map +1 -1
- package/dist/components/atoms/RadioButton/RadioButton.js +1 -1
- package/dist/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/atoms/RadioButton/index.js.map +1 -1
- package/dist/components/atoms/RadioButton/styled.js +1 -1
- package/dist/components/atoms/RadioButton/styled.js.map +1 -1
- package/dist/components/atoms/Switch/Switch.d.ts +1 -1
- package/dist/components/atoms/Switch/Switch.js +1 -1
- package/dist/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/components/atoms/Switch/animation.js.map +1 -1
- package/dist/components/atoms/Switch/index.js.map +1 -1
- package/dist/components/atoms/Switch/styled.d.ts +2 -14
- package/dist/components/atoms/Switch/styled.js +1 -1
- package/dist/components/atoms/Switch/styled.js.map +1 -1
- package/dist/components/atoms/Tag/Tag.js +1 -1
- package/dist/components/atoms/Tag/Tag.js.map +1 -1
- package/dist/components/atoms/Tag/index.js.map +1 -1
- package/dist/components/atoms/Tag/styled.js +1 -1
- package/dist/components/atoms/Tag/styled.js.map +1 -1
- package/dist/components/atoms/Text/Text.js +1 -1
- package/dist/components/atoms/Text/Text.js.map +1 -1
- package/dist/components/atoms/Text/functions.js.map +1 -1
- package/dist/components/atoms/Text/index.js.map +1 -1
- package/dist/components/atoms/Text/styled.js +1 -1
- package/dist/components/atoms/Text/styled.js.map +1 -1
- package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
- package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
- package/dist/components/molecules/Calendar/components/MonthWeek.js.map +1 -1
- package/dist/components/molecules/Calendar/components/Weekdays.js.map +1 -1
- package/dist/components/molecules/Calendar/components/index.js +1 -1
- package/dist/components/molecules/Calendar/components/index.js.map +1 -1
- package/dist/components/molecules/Calendar/index.d.ts +1 -1
- package/dist/components/molecules/Calendar/index.js +1 -1
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/Calendar/styled.js +1 -1
- package/dist/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.js +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/index.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.js +1 -1
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/index.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js +2 -1
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/Selector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/index.js +1 -1
- package/dist/components/molecules/DateTimeSelector/index.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/styled.js +1 -1
- package/dist/components/molecules/DateTimeSelector/styled.js.map +1 -1
- package/dist/components/molecules/Grid/functions.d.ts +3 -0
- package/dist/components/molecules/Grid/functions.js +21 -0
- package/dist/components/molecules/Grid/functions.js.map +1 -0
- package/dist/components/molecules/Grid/index.d.ts +42 -2
- package/dist/components/molecules/Grid/index.js +4 -13
- package/dist/components/molecules/Grid/index.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js +1 -1
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/index.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/styled.js.map +1 -1
- package/dist/components/molecules/IconTextButton/IconComponent.d.ts +9 -0
- package/dist/components/molecules/IconTextButton/IconComponent.js +28 -0
- package/dist/components/molecules/IconTextButton/IconComponent.js.map +1 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.d.ts +8 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js +4 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js.map +1 -0
- package/dist/components/molecules/IconTextButton/index.d.ts +2 -0
- package/dist/components/molecules/IconTextButton/index.js +16 -0
- package/dist/components/molecules/IconTextButton/index.js.map +1 -0
- package/dist/components/molecules/IconTextButton/styled.d.ts +4 -0
- package/dist/components/molecules/{Grid/Item/index.js → IconTextButton/styled.js} +19 -5
- package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
- package/dist/components/molecules/InputPassword/InputPasswordIcon.js +1 -1
- package/dist/components/molecules/InputPassword/InputPasswordIcon.js.map +1 -1
- package/dist/components/molecules/InputPassword/index.js.map +1 -1
- package/dist/components/molecules/InputPassword/styled.js.map +1 -1
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.d.ts +7 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js +4 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/index.d.ts +1 -0
- package/dist/components/molecules/LabeledSwitch/index.js +10 -0
- package/dist/components/molecules/LabeledSwitch/index.js.map +1 -0
- package/dist/components/molecules/Snackbar/Snackbar.js +1 -1
- package/dist/components/molecules/Snackbar/Snackbar.js.map +1 -1
- package/dist/components/molecules/Snackbar/index.js.map +1 -1
- package/dist/components/molecules/Snackbar/styled.js +1 -1
- package/dist/components/molecules/Snackbar/styled.js.map +1 -1
- package/dist/components/molecules/TextArea/TextArea.d.ts +1 -1
- package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
- package/dist/components/molecules/TextArea/index.js +1 -1
- package/dist/components/molecules/TextArea/index.js.map +1 -1
- package/dist/components/molecules/TextArea/styled.d.ts +2 -14
- package/dist/components/molecules/TextArea/styled.js.map +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDebouncedState.js +1 -1
- package/dist/hooks/useDebouncedState.js.map +1 -1
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +58 -30
- package/dist/index.js.map +1 -1
- package/dist/styles/ThemeProvider.js.map +1 -1
- package/dist/styles/definitions.d.ts +2 -1
- package/dist/styles/definitions.js +7 -1
- package/dist/styles/definitions.js.map +1 -1
- package/dist/styles/light.js +2 -1
- package/dist/styles/light.js.map +1 -1
- package/dist/types/defaults.d.ts +8 -2
- package/dist/types/defaults.js.map +1 -1
- package/dist/utils/IPhoneXHelper.js +3 -3
- package/dist/utils/IPhoneXHelper.js.map +1 -1
- package/dist/utils/ResponsiveFontSize.js +6 -6
- package/dist/utils/ResponsiveFontSize.js.map +1 -1
- package/dist/utils/extractNumbersFromString.js +1 -1
- package/dist/utils/extractNumbersFromString.js.map +1 -1
- package/dist/utils/formatWithMask.js.map +1 -1
- package/dist/utils/index.d.ts +5 -4
- package/dist/utils/index.js +28 -19
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lightenDarkenColor.js.map +1 -1
- package/dist/utils/masks.js.map +1 -1
- package/dist/utils/variantComplement.d.ts +6 -0
- package/dist/utils/variantComplement.js +35 -0
- package/dist/utils/variantComplement.js.map +1 -0
- package/package.json +5 -5
- package/src/components/atoms/Badge/styled.ts +2 -3
- package/src/components/atoms/GroupButton/GroupButton.tsx +2 -5
- package/src/components/atoms/Input/InputContainer/InputContainer.tsx +3 -3
- package/src/components/atoms/Input/InputElement/InputElement.tsx +4 -5
- package/src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx +4 -5
- package/src/components/atoms/ProgressBar/ProgressBar.tsx +2 -4
- package/src/components/atoms/Switch/Switch.tsx +39 -19
- package/src/components/atoms/Switch/animation.ts +4 -6
- package/src/components/atoms/Switch/styled.ts +4 -6
- package/src/components/atoms/Tag/Tag.tsx +1 -1
- package/src/components/atoms/shared/PaperAndCard.ts +1 -1
- package/src/components/molecules/Calendar/index.ts +1 -1
- package/src/components/molecules/DatePicker/DatePicker.tsx +12 -8
- package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +19 -11
- package/src/components/molecules/DateTimeSelector/DateTimeSelector.tsx +0 -1
- package/src/components/molecules/Grid/functions.ts +29 -0
- package/src/components/molecules/Grid/index.ts +66 -2
- package/src/components/molecules/HintInputContainer/HintInputContainer.tsx +6 -1
- package/src/components/molecules/IconTextButton/IconComponent.tsx +31 -0
- package/src/components/molecules/IconTextButton/IconTextButton.tsx +10 -0
- package/src/components/molecules/IconTextButton/index.ts +2 -0
- package/src/components/molecules/IconTextButton/styled.ts +20 -0
- package/src/components/molecules/LabeledSwitch/LabeledSwitch.tsx +9 -0
- package/src/components/molecules/LabeledSwitch/index.ts +1 -0
- package/src/components/molecules/Snackbar/Snackbar.tsx +1 -1
- package/src/components/molecules/Snackbar/styled.ts +6 -2
- package/src/components/molecules/TextArea/TextArea.tsx +6 -2
- package/src/components/molecules/TextArea/styled.ts +5 -2
- package/src/hooks/useDebouncedState.ts +1 -1
- package/src/index.ts +26 -6
- package/src/styles/definitions.ts +8 -1
- package/src/styles/light.ts +2 -0
- package/src/types/defaults.ts +11 -1
- package/src/utils/IPhoneXHelper.ts +27 -22
- package/src/utils/ResponsiveFontSize.ts +55 -36
- package/src/utils/index.ts +5 -4
- package/src/utils/variantComplement.ts +36 -0
- package/dist/components/molecules/Grid/Grid.d.ts +0 -15
- package/dist/components/molecules/Grid/Grid.js +0 -55
- package/dist/components/molecules/Grid/Grid.js.map +0 -1
- package/dist/components/molecules/Grid/Item/Item.d.ts +0 -30
- package/dist/components/molecules/Grid/Item/Item.js +0 -68
- package/dist/components/molecules/Grid/Item/Item.js.map +0 -1
- package/dist/components/molecules/Grid/Item/index.d.ts +0 -1
- package/dist/components/molecules/Grid/Item/index.js.map +0 -1
- package/src/components/molecules/Grid/Grid.stories.tsx +0 -132
- package/src/components/molecules/Grid/Grid.tsx +0 -87
- package/src/components/molecules/Grid/Item/Item.tsx +0 -93
- package/src/components/molecules/Grid/Item/index.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Calendar, CalendarProps, SelectionType, DateRange, Value } from './Calendar';
|
|
1
|
+
export { default as Calendar, CalendarProps, SelectionType, DateRange, Value, } from './Calendar';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.Value = exports.
|
|
4
|
+
exports.Value = exports.SelectionType = exports.DateRange = exports.CalendarProps = exports.Calendar = void 0;
|
|
5
5
|
|
|
6
6
|
var _Calendar = _interopRequireWildcard(require("./Calendar"));
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Calendar/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/Calendar/index.ts"],"sourcesContent":["export {\n default as Calendar,\n CalendarProps,\n SelectionType,\n DateRange,\n Value,\n} from './Calendar';\n"],"mappings":";;;;;AAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getCapitalizedTextComponent = exports.Week = exports.TitleContainer = exports.Selected = exports.Control = exports.Content = exports.Cell = void 0;
|
|
5
5
|
|
|
6
6
|
var _native = _interopRequireWildcard(require("@emotion/native"));
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"styled.js","names":["isWeb","Platform","OS","TitleContainer","styled","View","theme","color","secondary","xlight","Control","PressableSurface","props","css","align","spacing","centi","borderRadius","mili","getCapitalizedTextComponent","component","Content","deca","miscellaneous","surfaceColor","Week","Selected","selected","primary","medium","Cell","highlighted","isLineEnd","isLineStart","isRangeStart","isRangeEnd","borderRadiusSize","rightBorderRadius","leftBorderRadius","borderEffect","backgroundColor","light"],"sources":["../../../../src/components/molecules/Calendar/styled.ts"],"sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { Platform, PressableProps, ViewProps } from 'react-native';\nimport { StyleProps } from '../../../types/defaults';\nimport { PressableSurface } from '../../atoms/PressableSurface';\nimport { TextProps } from '../../atoms/Text';\n\nconst isWeb = Platform.OS === 'web';\n\ninterface ButtonBorders {\n isLeft?: boolean;\n isRright?: boolean;\n}\n\nexport const TitleContainer = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background-color: ${({ theme }) => theme.color.secondary.xlight};\n`;\n\nexport const Control = styled(PressableSurface)(\n (\n props: Partial<StyleProps> & ButtonBorders & { align: 'start' | 'end' }\n ) => css`\n align-items: flex-${props.align};\n padding: ${props.theme?.spacing.centi};\n border-radius: ${props.theme?.borderRadius.mili};\n margin: ${props.theme?.spacing.mili};\n `\n);\n\nexport const getCapitalizedTextComponent = (component: FC<TextProps>) => {\n return styled(component)`\n text-transform: capitalize;\n `;\n};\n\nexport const Content = styled.View<ViewProps & Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.deca};\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n`;\n\nexport const Week = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n`;\n\nexport const Selected = styled.View<\n Partial<StyleProps> & { selected: boolean }\n>`\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: ${({ theme, selected }) =>\n selected ? theme.color.primary.medium : 'transparent'};\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n width: 100%;\n height: 100%;\n`;\n\nexport const Cell = styled(PressableSurface)<\n PressableProps &\n Partial<StyleProps> & {\n selected: boolean;\n highlighted: boolean;\n isLineEnd: boolean;\n isLineStart: boolean;\n isRangeStart: boolean;\n isRangeEnd: boolean;\n }\n>(\n ({\n theme,\n selected,\n highlighted,\n isLineEnd,\n isLineStart,\n isRangeStart,\n isRangeEnd,\n }) => {\n const borderRadiusSize = theme.borderRadius.mili;\n\n const { rightBorderRadius, leftBorderRadius } = {\n rightBorderRadius:\n (selected && !isRangeStart) || isLineEnd ? borderRadiusSize : 0,\n leftBorderRadius:\n (selected && !isRangeEnd) || isLineStart ? borderRadiusSize : 0,\n };\n\n const borderEffect = highlighted ? 0 : borderRadiusSize;\n\n const backgroundColor = highlighted\n ? theme.color.primary.light\n : 'transparent';\n\n return css`\n ${isWeb\n ? css`\n width: 32px;\n height: 32px;\n `\n : css`\n aspect-ratio: 1;\n flex: 1;\n `}\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ${borderEffect};\n border-top-left-radius: ${leftBorderRadius};\n border-bottom-left-radius: ${leftBorderRadius};\n border-top-right-radius: ${rightBorderRadius};\n border-bottom-right-radius: ${rightBorderRadius};\n background-color: ${backgroundColor};\n `;\n }\n);\n"],"mappings":";;;;;AAAA;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C,MAAvB,GAAgC,aAAc;AAC1D,mBAAmB,CAAC;EAAEvB;AAAF,CAAD,KAAeA,KAAK,CAACW,YAAN,CAAmBC,IAAK;AAC1D;AACA;AACA,CAXO;;AAaA,MAAMY,IAAI,GAAG,IAAA1B,eAAA,EAAOO,kCAAP,EAWlB,CAAC;EACCL,KADD;EAECqB,QAFD;EAGCI,WAHD;EAICC,SAJD;EAKCC,WALD;EAMCC,YAND;EAOCC;AAPD,CAAD,KAQM;EACJ,MAAMC,gBAAgB,GAAG9B,KAAK,CAACW,YAAN,CAAmBC,IAA5C;EAEA,MAAM;IAAEmB,iBAAF;IAAqBC;EAArB,IAA0C;IAC9CD,iBAAiB,EACdV,QAAQ,IAAI,CAACO,YAAd,IAA+BF,SAA/B,GAA2CI,gBAA3C,GAA8D,CAFlB;IAG9CE,gBAAgB,EACbX,QAAQ,IAAI,CAACQ,UAAd,IAA6BF,WAA7B,GAA2CG,gBAA3C,GAA8D;EAJlB,CAAhD;EAOA,MAAMG,YAAY,GAAGR,WAAW,GAAG,CAAH,GAAOK,gBAAvC;EAEA,MAAMI,eAAe,GAAGT,WAAW,GAC/BzB,KAAK,CAACC,KAAN,CAAYqB,OAAZ,CAAoBa,KADW,GAE/B,aAFJ;EAIA,OAAO,IAAA5B,WAAA,CAAI;AACf,QAAQb,KAAK,GACH,IAAAa,WAAA,CAAI;AACd;AACA;AACA,WAJa,GAKH,IAAAA,WAAA,CAAI;AACd;AACA;AACA,WAAY;AACZ;AACA;AACA;AACA,uBAAuB0B,YAAa;AACpC,gCAAgCD,gBAAiB;AACjD,mCAAmCA,gBAAiB;AACpD,iCAAiCD,iBAAkB;AACnD,oCAAoCA,iBAAkB;AACtD,0BAA0BG,eAAgB;AAC1C,KAnBI;AAoBD,CAvDiB,CAAb"}
|
|
@@ -19,7 +19,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
22
|
-
function _extends() { _extends = Object.assign
|
|
22
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
23
|
|
|
24
24
|
function DatePicker({
|
|
25
25
|
month,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"DatePicker.js","names":["DatePicker","month","year","onChange","value","type","format","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","CalendarComponent","rightComponent","style","locale","closeOnPick","renderCalendar","requestShowCalendar","requestCloseCalendar","rest","focused","handleBlur","handleFocus","useInputFocus","handleShowCalendar","React","useCallback","getDisplayValue","formatDate","lowest","highest","StyledText","getStyledTextComponent","useEffect","setTimeout","calendar"],"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"sourcesContent":["import { format as formatDate } from 'date-fns';\nimport * as React from 'react';\nimport { useEffect } from 'react';\nimport { InputContainerProps, useInputFocus } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { CalendarProps, DateRange, SelectionType } from '../Calendar';\nimport { HintInputContainer } from '../HintInputContainer';\nimport { CalendarIcon, getStyledTextComponent } from './styled';\n\nexport interface DatePickerProps<T extends SelectionType>\n extends InputContainerProps,\n Omit<CalendarProps<T>, 'style'> {\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n TextComponent?: React.FC<TextProps>;\n CalendarComponent: React.FC<CalendarProps<T>>;\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n format?: string;\n closeOnPick?: boolean;\n renderCalendar: (\n calendar: React.ReactElement,\n blur?: () => void\n ) => JSX.Element | null;\n requestShowCalendar: () => void;\n requestCloseCalendar: () => void;\n}\n\nfunction DatePicker<T extends SelectionType>({\n /** DatePicker props */\n month,\n year,\n onChange,\n value,\n type,\n format = 'yyyy-MM-dd',\n placeholder,\n onFocus,\n onBlur,\n disabled,\n controlComponent,\n hintComponent,\n hint,\n variant,\n TextComponent = Text,\n CalendarComponent,\n rightComponent,\n style,\n locale,\n closeOnPick = false,\n renderCalendar,\n requestShowCalendar,\n requestCloseCalendar,\n ...rest\n}: DatePickerProps<T>): JSX.Element {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const handleShowCalendar = React.useCallback(() => {\n requestShowCalendar();\n handleFocus();\n }, [handleFocus, requestShowCalendar]);\n\n const getDisplayValue = () => {\n if (!value) return placeholder;\n if (type === 'day') {\n return formatDate(value as Date, format, { locale: locale });\n } else {\n const { lowest, highest } = value as DateRange;\n if (highest)\n return `${formatDate(lowest, format, {\n locale: locale,\n })} - ${formatDate(highest, format, { locale: locale })}`;\n else return formatDate(lowest, format, { locale: locale });\n }\n };\n\n const StyledText = getStyledTextComponent(TextComponent);\n\n useEffect(() => {\n if (closeOnPick && value && type === 'day') {\n setTimeout(requestCloseCalendar, 200);\n }\n if (closeOnPick && value && type === 'range') {\n const { lowest, highest } = value as DateRange;\n lowest && highest && setTimeout(requestCloseCalendar, 200);\n }\n }, [value, closeOnPick, type, requestCloseCalendar]);\n\n const calendar = (\n <CalendarComponent\n pointerEvents={'box-none'}\n type={type}\n value={value}\n month={month}\n year={year}\n onChange={onChange}\n locale={locale}\n />\n );\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handleShowCalendar, getDisplayValue())\n ) : (\n <HintInputContainer\n focused={focused}\n viewStyle={style}\n onPress={handleShowCalendar}\n disabled={disabled}\n hintComponent={hintComponent}\n LabelComponent={TextComponent}\n variant={variant}\n hint={hint}\n rightComponent={\n <>\n <CalendarIcon name=\"calendar-sharp\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledText fontWeight=\"bold\" disabled={disabled}>\n {getDisplayValue() || ' '}\n </StyledText>\n </HintInputContainer>\n )}\n {renderCalendar(calendar, handleBlur)}\n </>\n );\n}\n\nexport default DatePicker;\n"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;AAwBA,SAASA,UAAT,CAA6C;EAE3CC,KAF2C;EAG3CC,IAH2C;EAI3CC,QAJ2C;EAK3CC,KAL2C;EAM3CC,IAN2C;EAO3CC,MAAM,GAAG,YAPkC;EAQ3CC,WAR2C;EAS3CC,OAT2C;EAU3CC,MAV2C;EAW3CC,QAX2C;EAY3CC,gBAZ2C;EAa3CC,aAb2C;EAc3CC,IAd2C;EAe3CC,OAf2C;EAgB3CC,aAAa,GAAGC,UAhB2B;EAiB3CC,iBAjB2C;EAkB3CC,cAlB2C;EAmB3CC,KAnB2C;EAoB3CC,MApB2C;EAqB3CC,WAAW,GAAG,KArB6B;EAsB3CC,cAtB2C;EAuB3CC,mBAvB2C;EAwB3CC,oBAxB2C;EAyB3C,GAAGC;AAzBwC,CAA7C,EA0BoC;EAClC,MAAM;IAAEC,OAAF;IAAWC,UAAX;IAAuBC;EAAvB,IAAuC,IAAAC,oBAAA,EAC3CrB,OAD2C,EAE3CC,MAF2C,EAG3C,CAACC,QAH0C,CAA7C;EAMA,MAAMoB,kBAAkB,GAAGC,KAAK,CAACC,W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AqBhB,IAArB,EAA2BmB,oBAA3B,CARH;EAUA,MAAMiB,QAAQ,GACZ,oBAAC,iBAAD;IACE,aAAa,EAAE,UADjB;IAEE,IAAI,EAAEpC,IAFR;IAGE,KAAK,EAAED,KAHT;IAIE,KAAK,EAAEH,KAJT;IAKE,IAAI,EAAEC,IALR;IAME,QAAQ,EAAEC,QANZ;IAOE,MAAM,EAAEiB;EAPV,EADF;EAYA,OACE,0CACGT,gBAAgB,GACfA,gBAAgB,CAACmB,kBAAD,EAAqBG,eAAe,EAApC,CADD,GAGf,oBAAC,sCAAD;IACE,OAAO,EAAEP,OADX;IAEE,SAAS,EAAEP,KAFb;IAGE,OAAO,EAAEW,kBAHX;IAIE,QAAQ,EAAEpB,QAJZ;IAKE,aAAa,EAAEE,aALjB;IAME,cAAc,EAAEG,aANlB;IAOE,OAAO,EAAED,OAPX;IAQE,IAAI,EAAED,IARR;IASE,cAAc,EACZ,0CACE,oBAAC,oBAAD;MAAc,IAAI,EAAC,gBAAnB;MAAoC,IAAI,EAAC,SAAzC;MAAmD,IAAI,EAAC;IAAxD,EADF,EAEGK,cAFH;EAVJ,GAeMO,IAfN,GAiBE,oBAAC,UAAD;IAAY,UAAU,EAAC,MAAvB;IAA8B,QAAQ,EAAEf;EAAxC,GACGuB,eAAe,MAAM,GADxB,CAjBF,CAJJ,EA0BGX,cAAc,CAACmB,QAAD,EAAWd,UAAX,CA1BjB,CADF;AA8BD;;eAEc3B,U"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DatePicker/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/DatePicker/index.ts"],"sourcesContent":["export { default as DatePicker, DatePickerProps } from './DatePicker';\n"],"mappings":";;;;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"styled.js","names":["getStyledTextComponent","component","styled","props","css","theme","typography","h5","lineHeight","disabledInputStyles","CalendarIcon","Icon","spacing","centi","color","secondary","medium"],"sources":["../../../../src/components/molecules/DatePicker/styled.ts"],"sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { StyleProps } from '../../../types/defaults';\nimport { Icon } from '../../atoms/Icon';\nimport { disabledInputStyles, InputContainerProps } from '../../atoms/Input';\nimport { TextProps } from '../../atoms/Text';\n\nexport const getStyledTextComponent = (component: FC<TextProps>) => {\n return styled(component)(\n (props: Partial<InputContainerProps> & Partial<StyleProps>) => css`\n line-height: ${props.theme?.typography.h5.lineHeight};\n ${disabledInputStyles(props)}\n `\n );\n};\n\nexport const CalendarIcon = styled(Icon)<Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.centi};\n color: ${({ theme }) => theme.color.secondary.medium};\n`;\n"],"mappings":";;;;;AAAA;;AAGA;;AACA;;;;;;AAGO,MAAMA,sBAAsB,GAAIC,SAAD,IAA8B;EAClE,OAAO,IAAAC,eAAA,EAAOD,SAAP,EACJE,KAAD;IAAA;;IAAA,OAA+D,IAAAC,WAAA,CAAI;AACvE,qBADsE,gBACjDD,KAAK,CAACE,KAD2C,qBACjD,aAAaC,UAAb,CAAwBC,EAAxB,CAA2BC,UAAW;AAC3D,QAAQ,IAAAC,0BAAA,EAAoBN,KAApB,CAA2B;AACnC,KAHI;EAAA,CADK,CAAP;AAMD,CAPM;;;AASA,MAAMO,YAAY,GAAG,IAAAR,eAAA,EAAOS,UAAP,CAAkC;AAC9D,aAAa,CAAC;EAAEN;AAAF,CAAD,KAAeA,KAAK,CAACO,OAAN,CAAcC,KAAM;AAChD,WAAW,CAAC;EAAER;AAAF,CAAD,KAAeA,KAAK,CAACS,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AACvD,CAHO"}
|
|
@@ -23,7 +23,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
|
|
26
|
-
function _extends() { _extends = Object.assign
|
|
26
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
27
|
|
|
28
28
|
const DateTimePicker = ({
|
|
29
29
|
onChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"DateTimePicker.js","names":["DateTimePicker","onChange","value","mode","format","locale","upperDateThreshold","lowerDateThreshold","offsetThreshold","upperOffsetThreshold","lowerOffsetThreshold","dateModalTitle","timeModalTitle","dateConfirmButtonText","timeConfirmButtonText","dayLabel","monthLabel","yearLabel","hourLabel","minuteLabel","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","DateTimeSelectorComponent","DateTimeSelector","rightComponent","style","renderSelector","requestShowSelector","requestCloseSelector","rest","focused","handleBlur","handleFocus","useInputFocus","handleShowSelector","handleChoosing","StyledText","getStyledTextComponent","displayValue","formatDate","StyledDateTimeSelector","getStyledDateTimeSelector","dateTimeSelector"],"sources":["../../../../src/components/molecules/DateTimePicker/DateTimePicker.tsx"],"sourcesContent":["import { format as formatDate } from 'date-fns';\nimport * as React from 'react';\nimport { InputContainerProps, useInputFocus } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { CalendarIcon, getStyledTextComponent } from '../DatePicker/styled';\nimport { DateTimeSelector, DateTimeSelectorProps } from '../DateTimeSelector';\nimport { HintInputContainer } from '../HintInputContainer';\nimport { getStyledDateTimeSelector } from './styled';\n\nexport interface DateTimePickerProps\n extends InputContainerProps,\n Omit<DateTimeSelectorProps, 'style'> {\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n TextComponent?: React.FC<TextProps>;\n DateTimeSelectorComponent: React.FC<DateTimeSelectorProps>;\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n renderSelector: (\n selector: React.ReactElement,\n blur?: () => void\n ) => JSX.Element | null;\n requestShowSelector: () => void;\n requestCloseSelector: () => void;\n}\n\nconst DateTimePicker: React.FC<DateTimePickerProps> = ({\n onChange,\n value,\n mode = 'date',\n format = 'yyyy-MM-dd hh:mm:ss',\n locale,\n upperDateThreshold,\n 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 placeholder,\n onFocus,\n onBlur,\n disabled,\n controlComponent,\n hintComponent,\n hint,\n variant = 'default',\n TextComponent = Text,\n DateTimeSelectorComponent = DateTimeSelector,\n rightComponent,\n style,\n renderSelector,\n requestShowSelector,\n requestCloseSelector,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const handleShowSelector = () => {\n requestShowSelector();\n handleFocus();\n };\n\n const handleChoosing = (value: Date) => {\n onChange?.(value);\n requestCloseSelector();\n };\n\n const StyledText = getStyledTextComponent(TextComponent);\n const displayValue =\n (value ? formatDate(value, format, { locale: locale }) : placeholder) ||\n ' ';\n const StyledDateTimeSelector = getStyledDateTimeSelector(\n DateTimeSelectorComponent\n );\n\n const dateTimeSelector = (\n <StyledDateTimeSelector\n value={value}\n mode={mode}\n format={format}\n locale={locale}\n upperDateThreshold={upperDateThreshold}\n lowerDateThreshold={lowerDateThreshold}\n offsetThreshold={offsetThreshold}\n upperOffsetThreshold={upperOffsetThreshold}\n lowerOffsetThreshold={lowerOffsetThreshold}\n dateModalTitle={dateModalTitle}\n timeModalTitle={timeModalTitle}\n dateConfirmButtonText={dateConfirmButtonText}\n timeConfirmButtonText={timeConfirmButtonText}\n dayLabel={dayLabel}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n hourLabel={hourLabel}\n minuteLabel={minuteLabel}\n onChange={handleChoosing}\n />\n );\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handleShowSelector, displayValue)\n ) : (\n <HintInputContainer\n focused={focused}\n viewStyle={style}\n onPress={handleShowSelector}\n disabled={disabled}\n LabelComponent={TextComponent}\n variant={variant}\n hint={hint}\n hintComponent={hintComponent}\n rightComponent={\n <>\n <CalendarIcon name=\"calendar-sharp\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledText fontWeight=\"bold\" disabled={disabled}>\n {displayValue}\n </StyledText>\n </HintInputContainer>\n )}\n {renderSelector(dateTimeSelector, handleBlur)}\n </>\n );\n};\n\nexport default DateTimePicker;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAsBA,MAAMA,cAA6C,GAAG,CAAC;EACrDC,QADqD;EAErDC,KAFqD;EAGrDC,IAAI,GAAG,MAH8C;EAIrDC,MAAM,GAAG,qBAJ4C;EAKrDC,MALqD;EAMrDC,kBANqD;EAOrDC,kBAPqD;EAQrDC,eARqD;EASrDC,oBATqD;EAUrDC,oBAVqD;EAWrDC,cAXqD;EAYrDC,cAZqD;EAarDC,qBAbqD;EAcrDC,qBAdqD;EAerDC,QAfqD;E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AME,kBAAkB,EAAEC,kBANtB;IAOE,eAAe,EAAEC,eAPnB;IAQE,oBAAoB,EAAEC,oBARxB;IASE,oBAAoB,EAAEC,oBATxB;IAUE,cAAc,EAAEC,cAVlB;IAWE,cAAc,EAAEC,cAXlB;IAYE,qBAAqB,EAAEC,qBAZzB;IAaE,qBAAqB,EAAEC,qBAbzB;IAcE,QAAQ,EAAEC,QAdZ;IAeE,UAAU,EAAEC,UAfd;IAgBE,SAAS,EAAEC,SAhBb;IAiBE,SAAS,EAAEC,SAjBb;IAkBE,WAAW,EAAEC,WAlBf;IAmBE,QAAQ,EAAEwB;EAnBZ,EADF;EAwBA,OACE,0CACGnB,gBAAgB,GACfA,gBAAgB,CAACkB,kBAAD,EAAqBI,YAArB,CADD,GAGf,oBAAC,sCAAD;IACE,OAAO,EAAER,OADX;IAEE,SAAS,EAAEL,KAFb;IAGE,OAAO,EAAES,kBAHX;IAIE,QAAQ,EAAEnB,QAJZ;IAKE,cAAc,EAAEK,aALlB;IAME,OAAO,EAAED,OANX;IAOE,IAAI,EAAED,IAPR;IAQE,aAAa,EAAED,aARjB;IASE,cAAc,EACZ,0CACE,oBAAC,oBAAD;MAAc,IAAI,EAAC,gBAAnB;MAAoC,IAAI,EAAC,SAAzC;MAAmD,IAAI,EAAC;IAAxD,EADF,EAEGO,cAFH;EAVJ,GAeMK,IAfN,GAiBE,oBAAC,UAAD;IAAY,UAAU,EAAC,MAAvB;IAA8B,QAAQ,EAAEd;EAAxC,GACGuB,YADH,CAjBF,CAJJ,EA0BGZ,cAAc,CAACgB,gBAAD,EAAmBX,UAAnB,CA1BjB,CADF;AA8BD,CAnHD;;eAqHevC,c"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/DateTimePicker/index.ts"],"sourcesContent":["export {\n default as DateTimePicker,\n DateTimePickerProps,\n} from './DateTimePicker';\n"],"mappings":";;;;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"styled.js","names":["getStyledDateTimeSelector","component","styled","theme","spacing","deca"],"sources":["../../../../src/components/molecules/DateTimePicker/styled.ts"],"sourcesContent":["import styled from '@emotion/native';\nimport { FC } from 'react';\nimport { StyleProps } from '../../../types/defaults';\nimport { DateTimeSelectorProps } from '../DateTimeSelector';\n\nexport const getStyledDateTimeSelector = (\n component: FC<DateTimeSelectorProps>\n) => {\n return styled(component)<Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.deca};\n `;\n};\n"],"mappings":";;;;;AAAA;;;;AAKO,MAAMA,yBAAyB,GACpCC,SADuC,IAEpC;EACH,OAAO,IAAAC,eAAA,EAAOD,SAAP,CAAuC;AAChD,eAAe,CAAC;IAAEE;EAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AACjD,GAFE;AAGD,CANM"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
5
|
|
|
6
|
+
require("core-js/modules/es.array.includes.js");
|
|
7
|
+
|
|
6
8
|
var _dateFns = require("date-fns");
|
|
7
9
|
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -44,7 +46,6 @@ const DateTimeSelector = ({
|
|
|
44
46
|
value,
|
|
45
47
|
onChange,
|
|
46
48
|
mode = 'date',
|
|
47
|
-
format,
|
|
48
49
|
locale,
|
|
49
50
|
upperDateThreshold: _upperDateThreshold,
|
|
50
51
|
lowerDateThreshold: _lowerDateThreshold,
|
|
@@ -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,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;AAiB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KACE,oBAAC,kBAAD;AACE,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
|
+
{"version":3,"file":"DateTimeSelector.js","names":["getThresholdUnit","mode","threshold","months","includes","days","hours","DateTimeSelector","TextComponent","Text","value","onChange","locale","upperDateThreshold","_upperDateThreshold","lowerDateThreshold","_lowerDateThreshold","offsetThreshold","upperOffsetThreshold","lowerOffsetThreshold","dateModalTitle","timeModalTitle","dateConfirmButtonText","timeConfirmButtonText","dayLabel","monthLabel","yearLabel","hourLabel","minuteLabel","rest","sub","Date","add","date","setDate","React","useState","currentMode","setCurrentMode","isDate","modalTitle","confirmButtonText","handleChange","granularity","newValue","newState","newDate","set","daysInMonth","getDaysInMonth","getMonth","month","getDate","compareAsc","getDisplayedValue","formatDate","slice","toString","padStart","handlePressConfirm","handlePressBack","isSameDay","isSameMonth","getFullYear","isSameYear","getHours","getMinutes"],"sources":["../../../../src/components/molecules/DateTimeSelector/DateTimeSelector.tsx"],"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 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"],"mappings":";;;;;;;AAAA;;AAWA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAoEA,SAASA,gBAAT,CAA0BC,IAA1B,EAAsDC,SAAtD,EAA0E;EACxE,IAAI,CAACA,SAAL,EAAgB,OAAO,EAAP;;EAChB,IAAID,IAAI,KAAK,OAAb,EAAsB;IACpB,OAAO;MAAEE,MAAM,EAAED;IAAV,CAAP;EACD,CAFD,MAEO,IAAI,CAAC,MAAD,EAAS,UAAT,EAAqBE,QAArB,CAA8BH,IAA9B,CAAJ,EAAyC;IAC9C,OAAO;MAAEI,IAAI,EAAEH;IAAR,CAAP;EACD,CAFM,MAEA;IACL,OAAO;MAAEI,KAAK,EAAEJ;IAAT,CAAP;EACD;AACF;;AAED,MAAMK,gBAAiD,GAAG,CAAC;EACzDC,aAAa,GAAGC,UADyC;EAEzDC,KAFyD;EAGzDC,QAHyD;EAIzDV,IAAI,GAAG,MAJkD;EAKzDW,MALyD;EAMzDC,kBAAkB,EAAEC,mBANqC;EAOzDC,kBAAkB,EAAEC,mBAPqC;EAQzDC,eARyD;EASzDC,oBATyD;EAUzDC,oBAVyD;EAWzDC,cAXyD;EAYzDC,cAZyD;EAazDC,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AEE,QAAQ,EAAEkC,YAAY,CAAC,OAAD,CAFxB;IAGE,aAAa,EAAET,IAHjB;IAIE,KAAK,EAAEA,IAAI,CAACgC,QAAL,EAJT;IAKE,KAAK,EAAEtC,SAAS,IAAI,MALtB;IAME,WAAW,EAAE,OANf;IAOE,eAAe,EAAE2B,iBAAiB,CAAC,OAAD;EAPpC,EADF,CADF,EAYE,oBAAC,yBAAD;IAAmB,MAAM;EAAzB,GACE,oBAAC,kBAAD;IACE,aAAa,EAAE9C,aADjB;IAEE,QAAQ,EAAEkC,YAAY,CAAC,SAAD,CAFxB;IAGE,aAAa,EAAET,IAHjB;IAIE,KAAK,EAAEA,IAAI,CAACiC,UAAL,EAJT;IAKE,KAAK,EAAEtC,WAAW,IAAI,QALxB;IAME,WAAW,EAAE,SANf;IAOE,eAAe,EAAE0B,iBAAiB,CAAC,SAAD;EAPpC,EADF,CAZF,CAtFJ,EA+GE,oBAAC,cAAD;IAAQ,KAAK,EAAE,SAAf;IAA0B,OAAO,EAAEK;EAAnC,GACE,oBAAC,aAAD;IAAe,UAAU,EAAC,MAA1B;IAAiC,SAAS,EAAC;EAA3C,GACGlB,iBAAiB,IAAI,IADxB,CADF,CA/GF,CADF;AAuHD,CA5ND;;eA8NelC,gB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Selector.js","names":["getPrevAndNext","value","granularity","daysInMonth","multiplier","next","prev","Selector","label","onChange","getDisplayValue","referenceDate","preventUpper","preventLower","TextComponent","rest","pressInTimeoutRef","React","useRef","handlePressInNext","_next","getDaysInMonth","clearTimeout","current","setTimeout","handlePressInPrev","_prev","handlePressOut","requestAnimationFrame","opacity"],"sources":["../../../../src/components/molecules/DateTimeSelector/Selector.tsx"],"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"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;AAgBA,SAASA,cAAT,CACEC,KADF,EAEEC,WAFF,EAGEC,WAHF,EAIEC,UAAU,GAAG,CAJf,EAKoB;EAClB,IAAIC,IAAI,GAAGJ,KAAK,GAAGG,UAAnB;EAAA,IACEE,IAAI,GAAGL,KAAK,GAAGG,UADjB;;EAGA,IAAIF,WAAW,KAAK,MAApB,EAA4B;IAC1BG,IAAI,GAAGA,IAAI,GAAGF,WAAP,GAAqB,CAArB,GAAyBE,IAAhC;IACAC,IAAI,GAAGA,IAAI,GAAG,CAAP,GAAWH,WAAX,GAAyBG,IAAhC;EACD,CAHD,MAGO,IAAIJ,WAAW,KAAK,OAApB,EAA6B;IAClCG,IAAI,GAAGA,IAAI,GAAG,EAAP,GAAY,CAAZ,GAAgBA,IAAvB;IACAC,IAAI,GAAGA,IAAI,GAAG,CAAP,GAAW,EAAX,GAAgBA,IAAvB;EACD,CAHM,MAGA,IAAIJ,WAAW,KAAK,OAApB,EAA6B;IAClCG,IAAI,GAAGA,IAAI,GAAG,EAAP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AAG,CAAH,GAAO;IAA9B;EAJT,GAME,oBAAC,UAAD;IACE,IAAI,EAAE,cADR;IAEE,IAAI,EAAE,oBAFR;IAGE,IAAI,EAAE,MAHR;IAIE,YAAY,EAAE;EAJhB,EANF,CArBF,CADF;AAqCD,CA3EM"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.DateTimeSelectorProps = exports.DateTimeSelectorMode = exports.DateTimeSelector = void 0;
|
|
5
5
|
|
|
6
6
|
var _DateTimeSelector = _interopRequireWildcard(require("./DateTimeSelector"));
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/DateTimeSelector/index.ts"],"sourcesContent":["export {\n default as DateTimeSelector,\n DateTimeSelectorProps,\n DateTimeSelectorMode,\n} from './DateTimeSelector';\n"],"mappings":";;;;;AAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.SelectorValue = exports.SelectorRoot = exports.SelectorContainer = exports.Root = exports.Header = exports.Control = exports.Content = exports.BackButton = void 0;
|
|
5
5
|
|
|
6
6
|
var _native = _interopRequireDefault(require("@emotion/native"));
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"styled.js","names":["Root","styled","View","theme","miscellaneous","surfaceColor","Content","spacing","deca","SelectorRoot","RFValueStr","color","secondary","xlight","borderRadius","mili","SelectorValue","SelectorContainer","isFirst","isLast","Control","PressableSurface","micro","Header","BackButton"],"sources":["../../../../src/components/molecules/DateTimeSelector/styled.ts"],"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"],"mappings":";;;;;AAAA;;AAEA;;AACA;;;;AAEO,MAAMA,IAAI,GAAGC,eAAA,CAAOC,IAA0B;AACrD;AACA,sBAAsB,CAAC;EAAEC;AAAF,CAAD,KAAeA,KAAK,CAACC,aAAN,CAAoBC,YAAa;AACtE,CAHO;;AAKA,MAAMC,OAAO,GAAGL,eAAA,CAAOC,IAA0B;AACxD;AAC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AAMsB,UAAU,GAAG,IAAAvB,eAAA,EAAOoB,kCAAP,CAA8C;AACxE,mBAAmB,CAAC;EAAElB;AAAF,CAAD,KAAeA,KAAK,CAACW,YAAN,CAAmBC,IAAK;AAC1D,aAAa,CAAC;EAAEZ;AAAF,CAAD,KAAeA,KAAK,CAACI,OAAN,CAAce,KAAM;AAChD;AACA;AACA;AACA,CANO"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getGridItemPadding = exports.getGridItemColumSpan = void 0;
|
|
5
|
+
|
|
6
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
7
|
+
|
|
8
|
+
const getGridItemPadding = (pos, _spacing, themeSpacing) => {
|
|
9
|
+
if (_spacing) {
|
|
10
|
+
if (typeof _spacing === 'string') return (0, _reactCore.extractNumbersFromString)(themeSpacing[_spacing]);else if (typeof _spacing === 'object' && _spacing[pos]) {
|
|
11
|
+
return (0, _reactCore.extractNumbersFromString)(themeSpacing[_spacing[pos] ?? '0']);
|
|
12
|
+
} else return undefined;
|
|
13
|
+
} else return undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.getGridItemPadding = getGridItemPadding;
|
|
17
|
+
|
|
18
|
+
const getGridItemColumSpan = (columns, span) => 100 / (columns / span);
|
|
19
|
+
|
|
20
|
+
exports.getGridItemColumSpan = getGridItemColumSpan;
|
|
21
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","names":["getGridItemPadding","pos","_spacing","themeSpacing","extractNumbersFromString","undefined","getGridItemColumSpan","columns","span"],"sources":["../../../../src/components/molecules/Grid/functions.ts"],"sourcesContent":["import {\n extractNumbersFromString,\n GridSpacing,\n PaddingPosition,\n Spacing,\n} from '@tecsinapse/react-core';\n\nexport const getGridItemPadding = (\n pos: PaddingPosition,\n _spacing: GridSpacing | undefined,\n themeSpacing: Spacing\n): number | undefined => {\n if (_spacing) {\n if (typeof _spacing === 'string')\n return extractNumbersFromString(themeSpacing[_spacing]);\n else if (typeof _spacing === 'object' && _spacing[pos]) {\n return extractNumbersFromString(themeSpacing[_spacing[pos] ?? '0']);\n } else return undefined;\n } else return undefined;\n};\n\n/**\n * Calc the basis width percentage for a given item\n * @param columns - number of grid columns\n * @param span - number of columns to merge\n * @returns {number} - value in %\n */\nexport const getGridItemColumSpan = (columns: number, span: number): number =>\n 100 / (columns / span);\n"],"mappings":";;;;;AAAA;;AAOO,MAAMA,kBAAkB,GAAG,CAChCC,GADgC,EAEhCC,QAFgC,EAGhCC,YAHgC,KAIT;EACvB,IAAID,QAAJ,EAAc;IACZ,IAAI,OAAOA,QAAP,KAAoB,QAAxB,EACE,OAAO,IAAAE,mCAAA,EAAyBD,YAAY,CAACD,QAAD,CAArC,CAAP,CADF,KAEK,IAAI,OAAOA,QAAP,KAAoB,QAApB,IAAgCA,QAAQ,CAACD,GAAD,CAA5C,EAAmD;MACtD,OAAO,IAAAG,mCAAA,EAAyBD,YAAY,CAACD,QAAQ,CAACD,GAAD,CAAR,IAAiB,GAAlB,CAArC,CAAP;IACD,CAFI,MAEE,OAAOI,SAAP;EACR,CAND,MAMO,OAAOA,SAAP;AACR,CAZM;;;;AAoBA,MAAMC,oBAAoB,GAAG,CAACC,OAAD,EAAkBC,IAAlB,KAClC,OAAOD,OAAO,GAAGC,IAAjB,CADK"}
|
|
@@ -1,2 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SpacingType } from '@tecsinapse/react-core';
|
|
3
|
+
export interface IGrid {
|
|
4
|
+
children: JSX.Element[];
|
|
5
|
+
layout?: number[][];
|
|
6
|
+
columns?: number;
|
|
7
|
+
spacing?: SpacingType | {
|
|
8
|
+
top?: SpacingType;
|
|
9
|
+
right?: SpacingType;
|
|
10
|
+
bottom?: SpacingType;
|
|
11
|
+
left?: SpacingType;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare type FlexPositioning = 'flex-start' | 'flex-end' | 'center';
|
|
15
|
+
export declare type FlexAlignBase = FlexPositioning | 'stretch';
|
|
16
|
+
export declare type FlexAlignType = FlexAlignBase | 'baseline';
|
|
17
|
+
export declare type FlexSpacing = 'space-between' | 'space-around';
|
|
18
|
+
export declare type PaddingPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
19
|
+
export declare type GridSpacing = SpacingType | {
|
|
20
|
+
top?: SpacingType;
|
|
21
|
+
right?: SpacingType;
|
|
22
|
+
bottom?: SpacingType;
|
|
23
|
+
left?: SpacingType;
|
|
24
|
+
};
|
|
25
|
+
export interface IGridItem {
|
|
26
|
+
children: React.ReactElement;
|
|
27
|
+
span: number;
|
|
28
|
+
columns?: number;
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
loadingComponent?: React.ReactElement;
|
|
31
|
+
alignContent?: FlexAlignBase | FlexSpacing;
|
|
32
|
+
alignItems?: FlexAlignType;
|
|
33
|
+
alignSelf?: 'auto' | FlexAlignType;
|
|
34
|
+
flex?: number;
|
|
35
|
+
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
36
|
+
flexGrow?: number;
|
|
37
|
+
flexShrink?: number;
|
|
38
|
+
justifyContent?: FlexPositioning | FlexSpacing | 'space-evenly';
|
|
39
|
+
spacing?: GridSpacing;
|
|
40
|
+
wrapper?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export { getGridItemColumSpan, getGridItemPadding } from './functions';
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getGridItemPadding = exports.getGridItemColumSpan = void 0;
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _functions = require("./functions");
|
|
7
7
|
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
|
|
11
|
-
var _Grid = _interopRequireWildcard(require("./Grid"));
|
|
12
|
-
|
|
13
|
-
exports.Grid = _Grid.default;
|
|
14
|
-
exports.IGrid = _Grid.IGrid;
|
|
15
|
-
|
|
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); }
|
|
17
|
-
|
|
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; }
|
|
8
|
+
exports.getGridItemColumSpan = _functions.getGridItemColumSpan;
|
|
9
|
+
exports.getGridItemPadding = _functions.getGridItemPadding;
|
|
19
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Grid/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/Grid/index.ts"],"sourcesContent":["import React from 'react';\nimport { SpacingType } from '@tecsinapse/react-core';\n\nexport interface IGrid {\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\nexport type FlexPositioning = 'flex-start' | 'flex-end' | 'center';\nexport type FlexAlignBase = FlexPositioning | 'stretch';\nexport type FlexAlignType = FlexAlignBase | 'baseline';\nexport type FlexSpacing = 'space-between' | 'space-around';\nexport type PaddingPosition = 'top' | 'right' | 'bottom' | 'left';\n\nexport type GridSpacing =\n | SpacingType\n | {\n top?: SpacingType;\n right?: SpacingType;\n bottom?: SpacingType;\n left?: SpacingType;\n };\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?: GridSpacing;\n /** Used to wrap children in a View when its style extrapolates the dimensions*/\n wrapper?: boolean;\n}\n\nexport { getGridItemColumSpan, getGridItemPadding } from './functions';\n"],"mappings":";;;;;AAiEA"}
|
|
@@ -13,7 +13,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
13
13
|
|
|
14
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; }
|
|
15
15
|
|
|
16
|
-
function _extends() { _extends = Object.assign
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
17
|
|
|
18
18
|
const HintInputContainer = ({
|
|
19
19
|
viewStyle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"HintInputContainer.js","names":["HintInputContainer","viewStyle","onPress","focused","disabled","LabelComponent","variant","rightComponent","children","hint","hintComponent","rest","_hint"],"sources":["../../../../src/components/molecules/HintInputContainer/HintInputContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { StyleProp, View, ViewStyle } from 'react-native';\nimport {\n Hint,\n InputVariantType,\n PressableInputContainer,\n PressableInputContainerProps,\n} 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"],"mappings":";;;;;AAAA;;AACA;;AACA;;;;;;;;AAoBA,MAAMA,kBAAqD,GAAG,CAAC;EAC7DC,SAD6D;EAE7DC,OAF6D;EAG7DC,OAH6D;EAI7DC,QAJ6D;EAK7DC,cAL6D;EAM7DC,OAAO,GAAG,SANmD;EAO7DC,cAP6D;EAQ7DC,QAR6D;EAS7DC,IAT6D;EAU7DC,aAV6D;EAW7D,GAAGC;AAX0D,CAAD,KAYxD;EACJ,MAAMC,KAAK,GAAGF,aAAa,IACzB,oBAAC,WAAD;IAAM,aAAa,EAAEL,cAArB;IAAqC,IAAI,EAAEI,IAA3C;IAAiD,OAAO,EAAEH;EAA1D,EADF;;EAIA,OACE,oBAAC,iBAAD;IAAM,KAAK,EAAEL;EAAb,GACE,oBAAC,8BAAD;IACE,OAAO,EAAEC,OADX;IAEE,OAAO,EAAEC,OAFX;IAGE,QAAQ,EAAEC,QAHZ;IAIE,cAAc,EAAEC,cAJlB;IAKE,OAAO,EAAEC,OALX;IAME,cAAc,EAAEC;EANlB,GAOMI,IAPN,GASGH,QATH,CADF,EAYGC,IAAI,IAAIG,KAZX,CADF;AAgBD,CAjCD;;eAmCeZ,kB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/HintInputContainer/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/HintInputContainer/index.ts"],"sourcesContent":["export { default as HintInputContainer } from './HintInputContainer';\nexport type { HintInputContainerProps } from './HintInputContainer';\n"],"mappings":";;;;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"styled.js","names":[],"sources":["../../../../src/components/molecules/HintInputContainer/styled.ts"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonSizeType, FontColor, IconProps } from '@tecsinapse/react-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface IconComponentProps {
|
|
4
|
+
iconProps?: IconProps;
|
|
5
|
+
size?: ButtonSizeType;
|
|
6
|
+
defaultFontColor: keyof FontColor;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.NamedExoticComponent<IconComponentProps>;
|
|
9
|
+
export default _default;
|