@tecsinapse/react-core 1.12.5 → 1.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/components/atoms/Input/hooks/useCurrencyMask.js +2 -2
  3. package/dist/components/atoms/Input/hooks/useCurrencyMask.js.map +1 -1
  4. package/dist/components/atoms/Input/hooks/useMask.js +2 -2
  5. package/dist/components/atoms/Input/hooks/useMask.js.map +1 -1
  6. package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
  7. package/dist/components/atoms/ProgressBar/ProgressBar.js +6 -6
  8. package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
  9. package/dist/components/atoms/Switch/Switch.js +30 -22
  10. package/dist/components/atoms/Switch/Switch.js.map +1 -1
  11. package/dist/components/atoms/Switch/animation.d.ts +1 -1
  12. package/dist/components/atoms/Switch/animation.js +24 -16
  13. package/dist/components/atoms/Switch/animation.js.map +1 -1
  14. package/dist/components/atoms/Switch/styled.d.ts +3 -2
  15. package/dist/components/atoms/Switch/styled.js +7 -3
  16. package/dist/components/atoms/Switch/styled.js.map +1 -1
  17. package/dist/components/atoms/shared/PaperAndCard.js +3 -4
  18. package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
  19. package/dist/components/molecules/Calendar/index.d.ts +1 -1
  20. package/dist/components/molecules/Calendar/index.js +6 -0
  21. package/dist/components/molecules/Calendar/index.js.map +1 -1
  22. package/dist/components/molecules/Calendar/styled.js +0 -17
  23. package/dist/components/molecules/Calendar/styled.js.map +1 -1
  24. package/dist/components/molecules/DatePicker/DatePicker.d.ts +6 -5
  25. package/dist/components/molecules/DatePicker/DatePicker.js +22 -32
  26. package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
  27. package/dist/components/molecules/DatePicker/styled.d.ts +0 -14
  28. package/dist/components/molecules/DatePicker/styled.js +1 -46
  29. package/dist/components/molecules/DatePicker/styled.js.map +1 -1
  30. package/dist/components/molecules/DateTimePicker/DateTimePicker.d.ts +5 -4
  31. package/dist/components/molecules/DateTimePicker/DateTimePicker.js +35 -37
  32. package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
  33. package/dist/components/molecules/DateTimePicker/styled.d.ts +0 -21
  34. package/dist/components/molecules/DateTimePicker/styled.js +3 -51
  35. package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
  36. package/dist/components/molecules/Grid/Item/Item.d.ts +1 -1
  37. package/dist/components/molecules/Grid/Item/Item.js +7 -5
  38. package/dist/components/molecules/Grid/Item/Item.js.map +1 -1
  39. package/dist/components/molecules/HintInputContainer/HintInputContainer.d.ts +3 -2
  40. package/dist/components/molecules/HintInputContainer/HintInputContainer.js +4 -4
  41. package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
  42. package/dist/components/molecules/TextArea/TextArea.d.ts +3 -1
  43. package/dist/components/molecules/TextArea/TextArea.js +4 -4
  44. package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
  45. package/dist/index.d.ts +1 -1
  46. package/dist/index.js +7 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/styles/definitions.js +1 -1
  49. package/dist/styles/definitions.js.map +1 -1
  50. package/dist/utils/extractNumbersFromString.js +1 -1
  51. package/dist/utils/extractNumbersFromString.js.map +1 -1
  52. package/package.json +2 -2
  53. package/src/components/atoms/Input/hooks/useCurrencyMask.ts +2 -2
  54. package/src/components/atoms/Input/hooks/useMask.ts +1 -1
  55. package/src/components/atoms/ProgressBar/ProgressBar.tsx +5 -5
  56. package/src/components/atoms/Switch/Switch.tsx +29 -32
  57. package/src/components/atoms/Switch/animation.ts +26 -16
  58. package/src/components/atoms/Switch/styled.ts +6 -4
  59. package/src/components/atoms/shared/PaperAndCard.ts +4 -5
  60. package/src/components/molecules/Calendar/index.ts +1 -0
  61. package/src/components/molecules/Calendar/styled.ts +0 -22
  62. package/src/components/molecules/DatePicker/DatePicker.tsx +32 -41
  63. package/src/components/molecules/DatePicker/styled.ts +0 -40
  64. package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +46 -52
  65. package/src/components/molecules/DateTimePicker/styled.ts +1 -49
  66. package/src/components/molecules/Grid/Item/Item.tsx +3 -5
  67. package/src/components/molecules/HintInputContainer/HintInputContainer.tsx +3 -8
  68. package/src/components/molecules/TextArea/TextArea.tsx +3 -9
  69. package/src/index.ts +1 -0
  70. package/src/styles/definitions.ts +1 -1
  71. package/src/utils/extractNumbersFromString.ts +4 -5
  72. package/dist/components/molecules/DatePicker/Modal.d.ts +0 -8
  73. package/dist/components/molecules/DatePicker/Modal.js +0 -60
  74. package/dist/components/molecules/DatePicker/Modal.js.map +0 -1
  75. package/dist/components/molecules/DateTimePicker/Modal.d.ts +0 -7
  76. package/dist/components/molecules/DateTimePicker/Modal.js +0 -89
  77. package/dist/components/molecules/DateTimePicker/Modal.js.map +0 -1
  78. package/src/components/molecules/DatePicker/DatePicker.stories.tsx +0 -44
  79. package/src/components/molecules/DatePicker/Modal.tsx +0 -51
  80. package/src/components/molecules/DateTimePicker/DateTimePicker.stories.tsx +0 -26
  81. package/src/components/molecules/DateTimePicker/Modal.tsx +0 -84
@@ -1,29 +1,27 @@
1
1
  import { format as formatDate } from 'date-fns';
2
2
  import * as React from 'react';
3
- import { ModalBaseProps } from 'react-native';
3
+ import { useEffect } from 'react';
4
4
  import { InputContainerProps, useInputFocus } from '../../atoms/Input';
5
5
  import { Text, TextProps } from '../../atoms/Text';
6
6
  import { CalendarProps, DateRange, SelectionType } from '../Calendar';
7
- import { DatePickerModalProps, Modal } from './Modal';
8
- import { CalendarIcon, getStyledTextComponent } from './styled';
9
7
  import { HintInputContainer } from '../HintInputContainer';
10
- import { useEffect } from 'react';
8
+ import { CalendarIcon, getStyledTextComponent } from './styled';
11
9
 
12
- export interface DatePickerProps<T extends SelectionType>
13
- extends InputContainerProps,
14
- DatePickerModalProps<T>,
15
- Omit<CalendarProps<T>, 'style'> {
10
+ export interface DatePickerProps<T extends SelectionType> extends InputContainerProps, Omit<CalendarProps<T>, 'style'> {
16
11
  controlComponent?: (
17
12
  onPress: () => void,
18
13
  displayValue?: string
19
14
  ) => JSX.Element;
20
15
  TextComponent?: React.FC<TextProps>;
21
- animationType?: ModalBaseProps['animationType'];
16
+ CalendarComponent: React.FC<CalendarProps<T>>
22
17
  placeholder?: string;
23
18
  onFocus?: () => void | never;
24
19
  onBlur?: () => void | never;
25
20
  format?: string;
26
21
  closeOnPick?: boolean;
22
+ renderCalendar: (calendar: React.ReactElement, blur?: () => void) => JSX.Element|null
23
+ requestShowCalendar: () => void
24
+ requestCloseCalendar: () => void
27
25
  }
28
26
 
29
27
  function DatePicker<T extends SelectionType>({
@@ -34,7 +32,6 @@ function DatePicker<T extends SelectionType>({
34
32
  value,
35
33
  type,
36
34
  format = 'yyyy-MM-dd',
37
-
38
35
  placeholder,
39
36
  onFocus,
40
37
  onBlur,
@@ -45,31 +42,26 @@ function DatePicker<T extends SelectionType>({
45
42
  variant,
46
43
  TextComponent = Text,
47
44
  CalendarComponent,
48
- bottomOffset,
49
45
  rightComponent,
50
- animationType = 'fade',
51
46
  style,
52
47
  locale,
53
48
  closeOnPick = false,
49
+ renderCalendar,
50
+ requestShowCalendar,
51
+ requestCloseCalendar,
54
52
  ...rest
55
53
  }: DatePickerProps<T>): JSX.Element {
54
+
56
55
  const { focused, handleBlur, handleFocus } = useInputFocus(
57
56
  onFocus,
58
57
  onBlur,
59
58
  !disabled
60
59
  );
61
60
 
62
- const [modalVisible, setModalVisible] = React.useState(false);
63
-
64
- const handlePressInput = React.useCallback(() => {
65
- setModalVisible(true);
61
+ const handleShowCalendar = React.useCallback(() => {
62
+ requestShowCalendar()
66
63
  handleFocus();
67
- }, [handleFocus, setModalVisible]);
68
-
69
- const handleCloseModal = React.useCallback(() => {
70
- setModalVisible(false);
71
- handleBlur();
72
- }, [handleBlur, setModalVisible]);
64
+ }, [handleFocus, requestShowCalendar]);
73
65
 
74
66
  const getDisplayValue = () => {
75
67
  if (!value) return placeholder;
@@ -89,23 +81,35 @@ function DatePicker<T extends SelectionType>({
89
81
 
90
82
  useEffect(() => {
91
83
  if (closeOnPick && value && type === 'day') {
92
- setTimeout(handleCloseModal, 200);
84
+ setTimeout(requestCloseCalendar, 200);
93
85
  }
94
86
  if (closeOnPick && value && type === 'range') {
95
87
  const { lowest, highest } = value as DateRange;
96
- lowest && highest && setTimeout(handleCloseModal, 200);
88
+ lowest && highest && setTimeout(requestCloseCalendar, 200);
97
89
  }
98
- }, [value, closeOnPick, type, handleCloseModal]);
90
+ }, [value, closeOnPick, type, requestCloseCalendar]);
91
+
92
+ const calendar = (
93
+ <CalendarComponent
94
+ pointerEvents={'box-none'}
95
+ type={type}
96
+ value={value}
97
+ month={month}
98
+ year={year}
99
+ onChange={onChange}
100
+ locale={locale}
101
+ />
102
+ )
99
103
 
100
104
  return (
101
105
  <>
102
106
  {controlComponent ? (
103
- controlComponent(handlePressInput, getDisplayValue())
107
+ controlComponent(handleShowCalendar, getDisplayValue())
104
108
  ) : (
105
109
  <HintInputContainer
106
110
  focused={focused}
107
111
  viewStyle={style}
108
- onPress={handlePressInput}
112
+ onPress={handleShowCalendar}
109
113
  disabled={disabled}
110
114
  hintComponent={hintComponent}
111
115
  LabelComponent={TextComponent}
@@ -124,20 +128,7 @@ function DatePicker<T extends SelectionType>({
124
128
  </StyledText>
125
129
  </HintInputContainer>
126
130
  )}
127
- <Modal
128
- CalendarComponent={CalendarComponent}
129
- bottomOffset={bottomOffset}
130
- visible={modalVisible}
131
- onRequestClose={handleCloseModal}
132
- animated
133
- animationType={animationType}
134
- month={month}
135
- year={year}
136
- onChange={onChange}
137
- value={value}
138
- type={type}
139
- locale={locale}
140
- />
131
+ {renderCalendar(calendar, handleBlur)}
141
132
  </>
142
133
  );
143
134
  }
@@ -1,50 +1,10 @@
1
1
  import styled, { css } from '@emotion/native';
2
2
  import { FC } from 'react';
3
- import { Platform } from 'react-native';
4
- import { hex2rgba } from '../../../styles/definitions';
5
3
  import { StyleProps } from '../../../types/defaults';
6
- import { RFValue } from '../../../utils';
7
4
  import { Icon } from '../../atoms/Icon';
8
5
  import { disabledInputStyles, InputContainerProps } from '../../atoms/Input';
9
- import { PressableSurface } from '../../atoms/PressableSurface';
10
6
  import { TextProps } from '../../atoms/Text';
11
7
 
12
- const isWeb = Platform.OS === 'web';
13
-
14
- export const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`
15
- ${({ theme }) =>
16
- isWeb
17
- ? css`
18
- justify-content: center;
19
- align-items: center;
20
- background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};
21
- height: 100vh;
22
- `
23
- : css`
24
- justify-content: flex-end;
25
- background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};
26
- height: 100%;
27
- `}
28
- `;
29
-
30
- export const ModalContent = styled.View<
31
- { offset: number } & Partial<StyleProps>
32
- >`
33
- background-color: transparent;
34
- padding-bottom: ${({ offset }) => `${RFValue(offset)}px`};
35
- ${({ theme: { borderRadius } }) => css`
36
- ${isWeb
37
- ? `
38
- border-radius: ${borderRadius.micro};
39
- `
40
- : `
41
- border-top-left-radius: ${borderRadius.deca};
42
- border-top-right-radius: ${borderRadius.deca};
43
- `}
44
- `}
45
- overflow: hidden;
46
- `;
47
-
48
8
  export const getStyledTextComponent = (component: FC<TextProps>) => {
49
9
  return styled(component)(
50
10
  (props: Partial<InputContainerProps> & Partial<StyleProps>) => css`
@@ -1,26 +1,25 @@
1
1
  import { format as formatDate } from 'date-fns';
2
2
  import * as React from 'react';
3
- import { ModalBaseProps } from 'react-native';
4
3
  import { InputContainerProps, useInputFocus } from '../../atoms/Input';
5
4
  import { Text, TextProps } from '../../atoms/Text';
6
5
  import { CalendarIcon, getStyledTextComponent } from '../DatePicker/styled';
7
- import { DateTimeSelectorProps } from '../DateTimeSelector';
8
- import { DateTimePickerModalProps, Modal } from './Modal';
6
+ import { DateTimeSelector, DateTimeSelectorProps } from '../DateTimeSelector';
9
7
  import { HintInputContainer } from '../HintInputContainer';
8
+ import { getStyledDateTimeSelector } from './styled';
10
9
 
11
- export interface DateTimePickerProps
12
- extends InputContainerProps,
13
- DateTimePickerModalProps,
14
- Omit<DateTimeSelectorProps, 'style'> {
10
+ export interface DateTimePickerProps extends InputContainerProps, Omit<DateTimeSelectorProps, 'style'> {
15
11
  controlComponent?: (
16
12
  onPress: () => void,
17
13
  displayValue?: string
18
14
  ) => JSX.Element;
19
15
  TextComponent?: React.FC<TextProps>;
20
- animationType?: ModalBaseProps['animationType'];
16
+ DateTimeSelectorComponent: React.FC<DateTimeSelectorProps>;
21
17
  placeholder?: string;
22
18
  onFocus?: () => void | never;
23
19
  onBlur?: () => void | never;
20
+ renderSelector: (selector: React.ReactElement, blur?: () => void) => JSX.Element|null
21
+ requestShowSelector: () => void
22
+ requestCloseSelector: () => void
24
23
  }
25
24
 
26
25
  const DateTimePicker: React.FC<DateTimePickerProps> = ({
@@ -34,7 +33,6 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
34
33
  offsetThreshold,
35
34
  upperOffsetThreshold,
36
35
  lowerOffsetThreshold,
37
-
38
36
  dateModalTitle,
39
37
  timeModalTitle,
40
38
  dateConfirmButtonText,
@@ -44,7 +42,6 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
44
42
  yearLabel,
45
43
  hourLabel,
46
44
  minuteLabel,
47
-
48
45
  placeholder,
49
46
  onFocus,
50
47
  onBlur,
@@ -54,45 +51,68 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
54
51
  hint,
55
52
  variant = 'default',
56
53
  TextComponent = Text,
57
- DateTimeSelectorComponent,
58
- bottomOffset,
54
+ DateTimeSelectorComponent = DateTimeSelector,
59
55
  rightComponent,
60
- animationType = 'fade',
61
56
  style,
57
+ renderSelector,
58
+ requestShowSelector,
59
+ requestCloseSelector,
62
60
  ...rest
63
61
  }) => {
62
+
64
63
  const { focused, handleBlur, handleFocus } = useInputFocus(
65
64
  onFocus,
66
65
  onBlur,
67
66
  !disabled
68
67
  );
69
68
 
70
- const [modalVisible, setModalVisible] = React.useState(false);
71
-
72
- const handlePressInput = () => {
73
- setModalVisible(true);
69
+ const handleShowSelector = () => {
70
+ requestShowSelector()
74
71
  handleFocus();
75
72
  };
76
73
 
77
- const handleCloseModal = () => {
78
- setModalVisible(false);
79
- handleBlur();
74
+ const handleChoosing = (value: Date) => {
75
+ onChange?.(value)
76
+ requestCloseSelector()
80
77
  };
81
78
 
82
79
  const StyledText = getStyledTextComponent(TextComponent);
83
- const displayValue =
84
- (value ? formatDate(value, format, { locale: locale }) : placeholder) ||
85
- ' ';
80
+ const displayValue = (value ? formatDate(value, format, { locale: locale }) : placeholder) || ' ';
81
+ const StyledDateTimeSelector = getStyledDateTimeSelector(DateTimeSelectorComponent)
82
+
83
+ const dateTimeSelector = (
84
+ <StyledDateTimeSelector
85
+ value={value}
86
+ mode={mode}
87
+ format={format}
88
+ locale={locale}
89
+ upperDateThreshold={upperDateThreshold}
90
+ lowerDateThreshold={lowerDateThreshold}
91
+ offsetThreshold={offsetThreshold}
92
+ upperOffsetThreshold={upperOffsetThreshold}
93
+ lowerOffsetThreshold={lowerOffsetThreshold}
94
+ dateModalTitle={dateModalTitle}
95
+ timeModalTitle={timeModalTitle}
96
+ dateConfirmButtonText={dateConfirmButtonText}
97
+ timeConfirmButtonText={timeConfirmButtonText}
98
+ dayLabel={dayLabel}
99
+ monthLabel={monthLabel}
100
+ yearLabel={yearLabel}
101
+ hourLabel={hourLabel}
102
+ minuteLabel={minuteLabel}
103
+ onChange={handleChoosing}
104
+ />
105
+ )
86
106
 
87
107
  return (
88
108
  <>
89
109
  {controlComponent ? (
90
- controlComponent(handlePressInput, displayValue)
110
+ controlComponent(handleShowSelector, displayValue)
91
111
  ) : (
92
112
  <HintInputContainer
93
113
  focused={focused}
94
114
  viewStyle={style}
95
- onPress={handlePressInput}
115
+ onPress={handleShowSelector}
96
116
  disabled={disabled}
97
117
  LabelComponent={TextComponent}
98
118
  variant={variant}
@@ -111,33 +131,7 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
111
131
  </StyledText>
112
132
  </HintInputContainer>
113
133
  )}
114
- <Modal
115
- DateTimeSelectorComponent={DateTimeSelectorComponent}
116
- bottomOffset={bottomOffset}
117
- visible={modalVisible}
118
- onRequestClose={handleCloseModal}
119
- animated
120
- animationType={animationType}
121
- onChange={onChange}
122
- value={value}
123
- mode={mode}
124
- format={format}
125
- locale={locale}
126
- upperDateThreshold={upperDateThreshold}
127
- lowerDateThreshold={lowerDateThreshold}
128
- offsetThreshold={offsetThreshold}
129
- upperOffsetThreshold={upperOffsetThreshold}
130
- lowerOffsetThreshold={lowerOffsetThreshold}
131
- dateModalTitle={dateModalTitle}
132
- timeModalTitle={timeModalTitle}
133
- dateConfirmButtonText={dateConfirmButtonText}
134
- timeConfirmButtonText={timeConfirmButtonText}
135
- dayLabel={dayLabel}
136
- monthLabel={monthLabel}
137
- yearLabel={yearLabel}
138
- hourLabel={hourLabel}
139
- minuteLabel={minuteLabel}
140
- />
134
+ {renderSelector(dateTimeSelector, handleBlur)}
141
135
  </>
142
136
  );
143
137
  };
@@ -1,56 +1,8 @@
1
- import styled, { css } from '@emotion/native';
1
+ import styled from '@emotion/native';
2
2
  import { FC } from 'react';
3
- import { Platform } from 'react-native';
4
3
  import { StyleProps } from '../../../types/defaults';
5
- import { RFValue, RFValueStr } from '../../../utils';
6
- import {
7
- PressableSurface,
8
- PressableSurfaceProps
9
- } from '../../atoms/PressableSurface';
10
4
  import { DateTimeSelectorProps } from '../DateTimeSelector';
11
5
 
12
- const isWeb = Platform.OS === 'web';
13
-
14
- export const StyledPressableSurface = styled(
15
- PressableSurface
16
- )<PressableSurfaceProps>`
17
- width: 100%;
18
- `;
19
-
20
- export const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`
21
- ${isWeb
22
- ? css`
23
- justify-content: center;
24
- align-items: center;
25
- background-color: rgba(0, 0, 0, 0.5);
26
- height: 100vh;
27
- `
28
- : css`
29
- justify-content: flex-end;
30
- background-color: rgba(0, 0, 0, 0.5);
31
- height: 100%;
32
- `}
33
- `;
34
-
35
- export const ModalContent = styled.View<
36
- { offset: number } & Partial<StyleProps>
37
- >`
38
- background-color: transparent;
39
- padding-bottom: ${({ offset }) => `${RFValue(offset)}px`};
40
- ${({ theme: { borderRadius } }) => css`
41
- ${isWeb
42
- ? `
43
- width: ${RFValueStr('375px')};
44
- border-radius: ${borderRadius.micro};
45
- `
46
- : `
47
- border-top-left-radius: ${borderRadius.deca};
48
- border-top-right-radius: ${borderRadius.deca};
49
- `}
50
- `}
51
- overflow: hidden;
52
- `;
53
-
54
6
  export const getStyledDateTimeSelector = (
55
7
  component: FC<DateTimeSelectorProps>
56
8
  ) => {
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
- import {
3
- extractNumbersFromString,
4
- SpacingType,
5
- useTheme,
6
- } from '@tecsinapse/react-core';
7
2
  import { View } from 'react-native';
3
+ import { useTheme } from '../../../../hooks';
4
+ import { SpacingType } from '../../../../types/defaults';
5
+ import { extractNumbersFromString } from '../../../../utils';
8
6
 
9
7
  type FlexPositioning = 'flex-start' | 'flex-end' | 'center';
10
8
  type FlexAlignBase = FlexPositioning | 'stretch';
@@ -1,12 +1,7 @@
1
- import {
2
- Hint,
3
- InputVariantType,
4
- PressableInputContainer,
5
- PressableInputContainerProps,
6
- TextProps,
7
- } from '@tecsinapse/react-core';
8
- import { StyleProp, View, ViewStyle } from 'react-native';
9
1
  import * as React from 'react';
2
+ import { StyleProp, View, ViewStyle } from 'react-native';
3
+ import { Hint, InputVariantType, PressableInputContainer, PressableInputContainerProps } from '../../atoms/Input';
4
+ import { TextProps } from '../../atoms/Text';
10
5
 
11
6
  export interface HintInputContainerProps extends PressableInputContainerProps {
12
7
  viewStyle?: StyleProp<ViewStyle>;
@@ -1,15 +1,9 @@
1
1
  import React, { FC } from 'react';
2
- import {
3
- FontStackType,
4
- FontWeightType,
5
- Hint,
6
- InputContainerProps,
7
- InputElementProps,
8
- TextProps,
9
- } from '@tecsinapse/react-core';
10
2
  import { View } from 'react-native';
3
+ import { FontStackType, FontWeightType } from '../../../types/defaults';
4
+ import { Hint, InputContainerProps, InputElementProps } from '../../atoms/Input';
5
+ import { Text, TextProps } from '../../atoms/Text';
11
6
  import { StyledInputContainer } from './styled';
12
- import { Text } from '../../atoms/Text';
13
7
 
14
8
  export interface TextAreaProps
15
9
  extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>,
package/src/index.ts CHANGED
@@ -57,6 +57,7 @@ export {
57
57
  CalendarProps,
58
58
  DateRange,
59
59
  SelectionType,
60
+ Value
60
61
  } from './components/molecules/Calendar';
61
62
  export { DatePicker, DatePickerProps } from './components/molecules/DatePicker';
62
63
  export {
@@ -49,7 +49,7 @@ export const hex2rgba: (hex, alpha?: number) => string = (hex, alpha = 1) => {
49
49
  };
50
50
 
51
51
  export const miscellaneous: Miscellaneous = {
52
- shadow: '#85807a', // rgba(133, 128, 122, 0.08)
52
+ shadow: '#000000', // black
53
53
  overlay: '#282625', // rgba(40, 38, 37, 0.5)
54
54
  bodyColor: '#f8f7f7',
55
55
  surfaceColor: '#ffffff', //input, group button, cards
@@ -1,6 +1,5 @@
1
- export const extractNumbersFromString = (value: string): number => Number(extractDigitsFromString(value));
1
+ export const extractNumbersFromString = (value: string): number =>
2
+ Number(extractDigitsFromString(value));
2
3
 
3
- /*
4
- * implemented for the case: string numbers start with 0. Example: 012.345.678-91 Example: 012.345.678-91
5
- * */
6
- export const extractDigitsFromString = (value: string): string => value.replace(/[^-0-9]/g, '');
4
+ export const extractDigitsFromString = (value: string): string =>
5
+ value.replace(/[^0-9]/g, '');
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { ModalProps } from 'react-native';
3
- import { CalendarProps, SelectionType } from '../Calendar';
4
- export interface DatePickerModalProps<T extends SelectionType> {
5
- CalendarComponent?: React.FC<CalendarProps<T>>;
6
- bottomOffset?: number;
7
- }
8
- export declare const Modal: <T extends SelectionType>({ type, value, onRequestClose, month, year, onChange, CalendarComponent, bottomOffset, locale, ...modalProps }: CalendarProps<T> & import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & DatePickerModalProps<T>) => JSX.Element;
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Modal = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _Calendar = require("../Calendar");
13
-
14
- var _styled = require("./styled");
15
-
16
- var _reactCore = require("@tecsinapse/react-core");
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
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
-
22
- function _extends() { _extends = Object.assign || 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
-
24
- const Component = ({
25
- type,
26
- value,
27
- onRequestClose,
28
- month,
29
- year,
30
- onChange,
31
- CalendarComponent = _Calendar.Calendar,
32
- bottomOffset = 0,
33
- locale,
34
- ...modalProps
35
- }) => {
36
- return React.createElement(_reactNative.Modal, _extends({
37
- transparent: true,
38
- hardwareAccelerated: true,
39
- statusBarTranslucent: true
40
- }, modalProps, {
41
- onRequestClose: onRequestClose
42
- }), React.createElement(_styled.Backdrop, {
43
- onPress: onRequestClose,
44
- effect: "none"
45
- }, React.createElement(_reactCore.PressableSurface, null, React.createElement(_styled.ModalContent, {
46
- offset: bottomOffset
47
- }, React.createElement(CalendarComponent, {
48
- pointerEvents: 'box-none',
49
- type: type,
50
- value: value,
51
- month: month,
52
- year: year,
53
- onChange: onChange,
54
- locale: locale
55
- })))));
56
- };
57
-
58
- const Modal = Component;
59
- exports.Modal = Modal;
60
- //# sourceMappingURL=Modal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DatePicker/Modal.tsx"],"names":["Component","type","value","onRequestClose","month","year","onChange","CalendarComponent","Calendar","bottomOffset","locale","modalProps","Modal"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAOA,MAAMA,SAAS,GAAG,CAA0B;AAC1CC,EAAAA,IAD0C;AAE1CC,EAAAA,KAF0C;AAG1CC,EAAAA,cAH0C;AAI1CC,EAAAA,KAJ0C;AAK1CC,EAAAA,IAL0C;AAM1CC,EAAAA,QAN0C;AAO1CC,EAAAA,iBAAiB,GAAGC,kBAPsB;AAQ1CC,EAAAA,YAAY,GAAG,CAR2B;AAS1CC,EAAAA,MAT0C;AAU1C,KAAGC;AAVuC,CAA1B,KAW0D;AAC1E,SACE,oBAAC,kBAAD;AACE,IAAA,WAAW,MADb;AAEE,IAAA,mBAAmB,MAFrB;AAGE,IAAA,oBAAoB;AAHtB,KAIMA,UAJN;AAKE,IAAA,cAAc,EAAER;AALlB,MAOE,oBAAC,gBAAD;AAAU,IAAA,OAAO,EAAEA,cAAnB;AAAmC,IAAA,MAAM,EAAC;AAA1C,KACE,oBAAC,2BAAD,QACE,oBAAC,oBAAD;AAAc,IAAA,MAAM,EAAEM;AAAtB,KACE,oBAAC,iBAAD;AACE,IAAA,aAAa,EAAE,UADjB;AAEE,IAAA,IAAI,EAAER,IAFR;AAGE,IAAA,KAAK,EAAEC,KAHT;AAIE,IAAA,KAAK,EAAEE,KAJT;AAKE,IAAA,IAAI,EAAEC,IALR;AAME,IAAA,QAAQ,EAAEC,QANZ;AAOE,IAAA,MAAM,EAAEI;AAPV,IADF,CADF,CADF,CAPF,CADF;AAyBD,CArCD;;AAuCO,MAAME,KAAK,GAAGZ,SAAd","sourcesContent":["import * as React from 'react';\nimport { Modal as RNModal, ModalProps } from 'react-native';\nimport { Calendar, CalendarProps, SelectionType } from '../Calendar';\nimport { Backdrop, ModalContent } from './styled';\nimport { PressableSurface } from '@tecsinapse/react-core';\n\nexport interface DatePickerModalProps<T extends SelectionType> {\n CalendarComponent?: React.FC<CalendarProps<T>>;\n bottomOffset?: number;\n}\n\nconst Component = <T extends SelectionType>({\n type,\n value,\n onRequestClose,\n month,\n year,\n onChange,\n CalendarComponent = Calendar,\n bottomOffset = 0,\n locale,\n ...modalProps\n}: CalendarProps<T> & ModalProps & DatePickerModalProps<T>): JSX.Element => {\n return (\n <RNModal\n transparent\n hardwareAccelerated\n statusBarTranslucent\n {...modalProps}\n onRequestClose={onRequestClose}\n >\n <Backdrop onPress={onRequestClose} effect=\"none\">\n <PressableSurface>\n <ModalContent offset={bottomOffset}>\n <CalendarComponent\n pointerEvents={'box-none'}\n type={type}\n value={value}\n month={month}\n year={year}\n onChange={onChange}\n locale={locale}\n />\n </ModalContent>\n </PressableSurface>\n </Backdrop>\n </RNModal>\n );\n};\n\nexport const Modal = Component;\n"],"file":"Modal.js"}
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- import { DateTimeSelectorProps } from '../DateTimeSelector';
3
- export interface DateTimePickerModalProps {
4
- DateTimeSelectorComponent?: React.FC<DateTimeSelectorProps>;
5
- bottomOffset?: number;
6
- }
7
- export declare const Modal: React.FC<DateTimeSelectorProps & import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & DateTimePickerModalProps>;