@omniumretail/component-library 1.0.66 → 1.0.68

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 (176) hide show
  1. package/.storybook/main.js +16 -16
  2. package/.storybook/preview-head.html +20 -20
  3. package/.storybook/preview.js +27 -27
  4. package/README.md +54 -54
  5. package/bitbucket-pipelines.yml +94 -94
  6. package/dist/bundle.js +12047 -0
  7. package/dist/main.css +1244 -0
  8. package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -0
  9. package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -0
  10. package/dist/types/components/AnalyticsBar/index.d.ts +2 -0
  11. package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -0
  12. package/dist/types/components/Button/Button.stories.d.ts +6 -0
  13. package/dist/types/components/Button/index.d.ts +7 -0
  14. package/dist/types/components/Category/Category.stories.d.ts +4 -0
  15. package/dist/types/components/Category/CategoryContent/index.d.ts +7 -0
  16. package/dist/types/components/Category/CategorySidebar/index.d.ts +26 -0
  17. package/dist/types/components/Category/index.d.ts +7 -0
  18. package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +4 -0
  19. package/dist/types/components/CategoryReadOnly/evaluationOptions.d.ts +10 -0
  20. package/dist/types/components/CategoryReadOnly/index.d.ts +9 -0
  21. package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -0
  22. package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -0
  23. package/dist/types/components/CategoryResponse/index.d.ts +9 -0
  24. package/dist/types/components/DatePicker/DatePicker.stories.d.ts +5 -0
  25. package/dist/types/components/DatePicker/index.d.ts +8 -0
  26. package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +5 -0
  27. package/dist/types/components/DatePickerTag/index.d.ts +6 -0
  28. package/dist/types/components/Footer/Footer.stories.d.ts +5 -0
  29. package/dist/types/components/Footer/index.d.ts +4 -0
  30. package/dist/types/components/Input/Input.stories.d.ts +5 -0
  31. package/dist/types/components/Input/index.d.ts +10 -0
  32. package/dist/types/components/InputCountryCode/index.d.ts +10 -0
  33. package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +5 -0
  34. package/dist/types/components/Label/Label.stories.d.ts +6 -0
  35. package/dist/types/components/Label/index.d.ts +7 -0
  36. package/dist/types/components/Link/Link.stories.d.ts +7 -0
  37. package/dist/types/components/Link/index.d.ts +7 -0
  38. package/dist/types/components/Menu/Menu.stories.d.ts +5 -0
  39. package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -0
  40. package/dist/types/components/Menu/index.d.ts +2 -0
  41. package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +5 -0
  42. package/dist/types/components/ModalConfirmation/ModalStatusList.d.ts +5 -0
  43. package/dist/types/components/ModalConfirmation/index.d.ts +9 -0
  44. package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +5 -0
  45. package/dist/types/components/ModalWithTable/index.d.ts +13 -0
  46. package/dist/types/components/Navigation/Navigation.stories.d.ts +5 -0
  47. package/dist/types/components/Navigation/index.d.ts +10 -0
  48. package/dist/types/components/Notification/Notification.stories.d.ts +5 -0
  49. package/dist/types/components/Notification/index.d.ts +9 -0
  50. package/dist/types/components/Questions/Questions.stories.d.ts +4 -0
  51. package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -0
  52. package/dist/types/components/Questions/index.d.ts +5 -0
  53. package/dist/types/components/Radio/Radio.stories.d.ts +5 -0
  54. package/dist/types/components/Radio/index.d.ts +10 -0
  55. package/dist/types/components/Select/Select.stories.d.ts +6 -0
  56. package/dist/types/components/Select/index.d.ts +5 -0
  57. package/dist/types/components/Separator/Separator.stories.d.ts +6 -0
  58. package/dist/types/components/Separator/index.d.ts +11 -0
  59. package/dist/types/components/Sidebar/Sidebar.stories.d.ts +6 -0
  60. package/dist/types/components/Sidebar/index.d.ts +15 -0
  61. package/dist/types/components/Switch/Switch.stories.d.ts +5 -0
  62. package/dist/types/components/Switch/index.d.ts +2 -0
  63. package/dist/types/components/Table/Table.stories.d.ts +9 -0
  64. package/dist/types/components/Table/index.d.ts +36 -0
  65. package/dist/types/components/Tag/Tag.stories.d.ts +5 -0
  66. package/dist/types/components/Tag/index.d.ts +8 -0
  67. package/dist/types/components/Upload/Upload.stories.d.ts +4 -0
  68. package/dist/types/components/Upload/index.d.ts +8 -0
  69. package/dist/types/components/UserInfo/UserInfo.stories.d.ts +4 -0
  70. package/dist/types/components/UserInfo/index.d.ts +8 -0
  71. package/dist/types/components/index.d.ts +25 -0
  72. package/dist/types/constants/i18n.d.ts +1 -0
  73. package/dist/types/constants/translationHelper.d.ts +2 -0
  74. package/dist/types/index.d.ts +2 -0
  75. package/package.json +198 -198
  76. package/src/assets/scss/_global.scss +89 -89
  77. package/src/assets/scss/index.scss +2 -2
  78. package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +236 -236
  79. package/src/components/AnalyticsBar/helpers/codeMutation.tsx +19 -19
  80. package/src/components/AnalyticsBar/index.tsx +76 -76
  81. package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +13 -13
  82. package/src/components/AnalyticsBar/styles.module.scss +108 -108
  83. package/src/components/Button/Button.stories.tsx +26 -26
  84. package/src/components/Button/index.tsx +24 -24
  85. package/src/components/Button/styles.module.scss +65 -65
  86. package/src/components/Category/Category.stories.tsx +88 -88
  87. package/src/components/Category/CategoryContent/index.tsx +188 -188
  88. package/src/components/Category/CategoryContent/styles.module.scss +51 -51
  89. package/src/components/Category/CategorySidebar/index.tsx +268 -268
  90. package/src/components/Category/CategorySidebar/styles.module.scss +28 -28
  91. package/src/components/Category/index.tsx +76 -76
  92. package/src/components/Category/styles.module.scss +13 -13
  93. package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +270 -270
  94. package/src/components/CategoryReadOnly/evaluationOptions.tsx +81 -81
  95. package/src/components/CategoryReadOnly/index.tsx +254 -254
  96. package/src/components/CategoryReadOnly/styles.module.scss +184 -184
  97. package/src/components/CategoryResponse/CategoryResponse.stories.tsx +251 -251
  98. package/src/components/CategoryResponse/evaluationOptions.tsx +81 -81
  99. package/src/components/CategoryResponse/index.tsx +277 -277
  100. package/src/components/CategoryResponse/styles.module.scss +175 -160
  101. package/src/components/DatePicker/DatePicker.stories.tsx +16 -16
  102. package/src/components/DatePicker/index.tsx +38 -38
  103. package/src/components/DatePicker/styles.module.scss +3 -3
  104. package/src/components/DatePickerTag/DatePickerTag.stories.tsx +19 -19
  105. package/src/components/DatePickerTag/index.tsx +89 -89
  106. package/src/components/DatePickerTag/styles.module.scss +31 -31
  107. package/src/components/Footer/Footer.stories.tsx +14 -14
  108. package/src/components/Footer/index.tsx +38 -38
  109. package/src/components/Footer/styles.module.scss +38 -38
  110. package/src/components/Input/Input.stories.tsx +13 -13
  111. package/src/components/Input/index.tsx +31 -31
  112. package/src/components/Input/styles.module.scss +8 -8
  113. package/src/components/InputCountryCode/index.tsx +75 -75
  114. package/src/components/InputCountryCode/inputCountryCode.stories.tsx +55 -55
  115. package/src/components/InputCountryCode/styles.module.scss +3 -3
  116. package/src/components/Label/Label.stories.tsx +21 -21
  117. package/src/components/Label/index.tsx +19 -19
  118. package/src/components/Label/styles.module.scss +16 -16
  119. package/src/components/Link/Link.stories.tsx +30 -30
  120. package/src/components/Link/index.tsx +21 -21
  121. package/src/components/Link/styles.module.scss +24 -24
  122. package/src/components/Menu/Menu.stories.tsx +178 -178
  123. package/src/components/Menu/helpers/codeMutation.tsx +19 -19
  124. package/src/components/Menu/index.tsx +23 -23
  125. package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +40 -40
  126. package/src/components/ModalConfirmation/ModalStatusList.tsx +5 -5
  127. package/src/components/ModalConfirmation/index.tsx +70 -70
  128. package/src/components/ModalConfirmation/styles.module.scss +62 -62
  129. package/src/components/ModalWithTable/ModalWithTable.stories.tsx +96 -96
  130. package/src/components/ModalWithTable/index.tsx +232 -232
  131. package/src/components/ModalWithTable/styles.module.scss +77 -77
  132. package/src/components/Navigation/Navigation.stories.tsx +17 -17
  133. package/src/components/Navigation/index.tsx +33 -33
  134. package/src/components/Navigation/styles.module.scss +58 -42
  135. package/src/components/Notification/Notification.stories.tsx +29 -29
  136. package/src/components/Notification/index.tsx +21 -21
  137. package/src/components/Questions/Questions.stories.tsx +37 -37
  138. package/src/components/Questions/SingleQuestion/index.tsx +84 -84
  139. package/src/components/Questions/SingleQuestion/styles.module.scss +81 -81
  140. package/src/components/Questions/index.tsx +78 -78
  141. package/src/components/Radio/Radio.stories.tsx +43 -43
  142. package/src/components/Radio/index.tsx +26 -26
  143. package/src/components/Radio/styles.module.scss +23 -23
  144. package/src/components/Select/Select.stories.tsx +39 -39
  145. package/src/components/Select/index.tsx +27 -27
  146. package/src/components/Select/styles.module.scss +13 -13
  147. package/src/components/Separator/Separator.stories.tsx +22 -22
  148. package/src/components/Separator/index.tsx +27 -27
  149. package/src/components/Separator/styles.module.scss +25 -25
  150. package/src/components/Sidebar/Sidebar.stories.tsx +85 -85
  151. package/src/components/Sidebar/index.tsx +103 -103
  152. package/src/components/Sidebar/styles.module.scss +85 -85
  153. package/src/components/Switch/Switch.stories.tsx +14 -14
  154. package/src/components/Switch/index.tsx +8 -8
  155. package/src/components/Switch/styles.module.scss +7 -7
  156. package/src/components/Table/Table.stories.tsx +221 -221
  157. package/src/components/Table/index.tsx +271 -271
  158. package/src/components/Table/styles.module.scss +75 -75
  159. package/src/components/Tag/Tag.stories.tsx +22 -22
  160. package/src/components/Tag/index.tsx +189 -189
  161. package/src/components/Tag/styles.module.scss +60 -60
  162. package/src/components/Upload/Upload.stories.tsx +45 -45
  163. package/src/components/Upload/index.tsx +91 -91
  164. package/src/components/UserInfo/UserInfo.stories.tsx +37 -37
  165. package/src/components/UserInfo/index.tsx +62 -62
  166. package/src/components/UserInfo/styles.module.scss +29 -29
  167. package/src/components/index.tsx +25 -25
  168. package/src/constants/i18n.ts +25 -25
  169. package/src/constants/translationHelper.ts +7 -7
  170. package/src/index.ts +2 -2
  171. package/src/locales/en.json +86 -86
  172. package/src/locales/es.json +86 -86
  173. package/src/locales/pt.json +86 -86
  174. package/src/types/Global.d.ts +4 -4
  175. package/tsconfig.json +29 -29
  176. package/webpack.config.js +51 -51
@@ -1,160 +1,175 @@
1
- .categoryResponse {
2
- display: grid;
3
- grid-template-columns: 1fr;
4
- gap: 16px;
5
- height: 100%;
6
-
7
- @media(min-width: 600px) {
8
- grid-template-columns: 220px auto;
9
- }
10
-
11
- @media(min-width: 768px) {
12
- grid-template-columns: 300px auto;
13
- }
14
- }
15
-
16
- .sidebarWrapper {
17
- background: #EBECED;
18
- overflow: auto;
19
- }
20
-
21
- .contentWrapper {
22
- background: var(--color-white);
23
- overflow: auto;
24
- }
25
-
26
- .sidebarWrapper,
27
- .contentWrapper {
28
- padding: 20px;
29
- }
30
-
31
- .title {
32
- font-size: var(--font-size-body-3);
33
- color: var(--color-blue);
34
- margin-bottom: 36px;
35
- font-weight: var(--font-weight-semibold);
36
- text-transform: uppercase;
37
-
38
- @media(min-width: 768px) {
39
- font-size: var(--font-size-body-4);
40
- }
41
- }
42
-
43
- .label {
44
- padding-bottom: 15px;
45
- font-weight: var(--font-weight-bold);
46
- font-size: var(--font-size-body-3);
47
-
48
- @media(min-width: 768px) {
49
- font-size: var(--font-size-body-4);
50
- }
51
- }
52
-
53
- .cursorPointer {
54
- cursor: pointer;
55
- }
56
-
57
- .subCategory {
58
- padding-left: 16px;
59
-
60
- .label {
61
- font-weight: var(--font-weight-semibold);
62
- }
63
-
64
- .labelWrapper {
65
- .subCategory {
66
- .label {
67
- font-weight: var(--font-weight-light);
68
- }
69
- }
70
- }
71
- }
72
-
73
- .labelWrapper {
74
- display: block;
75
- }
76
-
77
- .active {
78
- color: var(--color-orange);
79
- }
80
-
81
- .details {
82
- margin-bottom: 24px;
83
- }
84
-
85
- .categoryName {
86
- font-size: var(--font-size-body-3);
87
- color: var(--color-blue);
88
- font-weight: var(--font-weight-semibold);
89
- margin-bottom: 8px;
90
-
91
- @media(min-width: 768px) {
92
- font-size: var(--font-size-body-4);
93
- }
94
- }
95
-
96
- .categoryDescription {
97
- font-size: var(--font-size-body-2);
98
- font-weight: var(--font-weight-light);
99
- color: var(--color-black);
100
-
101
- font-size: var(--font-size-body-3);
102
- }
103
-
104
- // Questions
105
- .questionWrapper {
106
- display: flex;
107
- flex-direction: row;
108
- gap: 12px;
109
- margin-bottom: 36px;
110
- }
111
-
112
- .questionWrapperOpenAnswer {
113
- flex-direction: column;
114
- border-bottom: 1px solid rgba(var(--color-blue-rgb), .2);
115
- margin-bottom: 24px;
116
-
117
- .question {
118
- width: 100%;
119
- border-bottom: none;
120
- }
121
-
122
- .answer {
123
- width: 100%;
124
- height: auto;
125
-
126
- :global {
127
- .ant-input {
128
- min-height: 140px;
129
- }
130
-
131
- .ant-form-item {
132
- margin-bottom: 16px;
133
- }
134
- }
135
- }
136
- }
137
-
138
- .question {
139
- width: calc(100% - 112px);
140
- border-bottom: 1px solid rgba(var(--color-blue-rgb), .2);
141
- }
142
-
143
- .answer {
144
- width: 100px;
145
- height: 50px;
146
- align-self: flex-end;
147
- }
148
-
149
- .subject {
150
- font-size: var(--font-size-body-2);
151
- font-weight: var(--font-weight-semibold);
152
- margin-bottom: 8px;
153
-
154
- font-size: var(--font-size-body-3);
155
- }
156
-
157
- .description {
158
- font-weight: var(--font-weight-light);
159
- margin-bottom: 4px;
160
- }
1
+ .categoryResponse {
2
+ display: grid;
3
+ grid-template-columns: 1fr;
4
+ gap: 16px;
5
+ height: 100%;
6
+
7
+ @media(min-width: 600px) {
8
+ grid-template-columns: 220px auto;
9
+ }
10
+
11
+ @media(min-width: 768px) {
12
+ grid-template-columns: 300px auto;
13
+ }
14
+ }
15
+
16
+ .sidebarWrapper {
17
+ background: #EBECED;
18
+ overflow: auto;
19
+ padding: 20px 20px 0 20px;
20
+ max-height: 80px;
21
+
22
+ @media(min-width: 768px) {
23
+ padding: 20px;
24
+ }
25
+ }
26
+
27
+ .contentWrapper {
28
+ background: var(--color-white);
29
+ overflow: auto;
30
+ padding: 20px;
31
+ }
32
+
33
+ .title {
34
+ font-size: var(--font-size-body-2);
35
+ color: var(--color-blue);
36
+ margin-bottom: 12px;
37
+ font-weight: var(--font-weight-semibold);
38
+ text-transform: uppercase;
39
+
40
+ @media(min-width: 768px) {
41
+ font-size: var(--font-size-body-4);
42
+ margin-bottom: 36px;
43
+ }
44
+ }
45
+
46
+ .label {
47
+ padding-bottom: 15px;
48
+ font-weight: var(--font-weight-bold);
49
+ font-size: var(--font-size-body-2);
50
+
51
+ @media(min-width: 768px) {
52
+ font-size: var(--font-size-body-4);
53
+ }
54
+ }
55
+
56
+ .cursorPointer {
57
+ cursor: pointer;
58
+ }
59
+
60
+ .subCategory {
61
+ padding-left: 16px;
62
+
63
+ .label {
64
+ font-weight: var(--font-weight-semibold);
65
+ }
66
+
67
+ .labelWrapper {
68
+ .subCategory {
69
+ .label {
70
+ font-weight: var(--font-weight-light);
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ .labelWrapper {
77
+ display: block;
78
+ }
79
+
80
+ .active {
81
+ color: var(--color-orange);
82
+ }
83
+
84
+ .details {
85
+ margin-bottom: 16px;
86
+
87
+ @media(min-width: 768px) {
88
+ margin-bottom: 24px;
89
+ }
90
+ }
91
+
92
+ .categoryName {
93
+ font-size: var(--font-size-body-3);
94
+ color: var(--color-blue);
95
+ font-weight: var(--font-weight-semibold);
96
+ margin-bottom: 8px;
97
+
98
+ @media(min-width: 768px) {
99
+ font-size: var(--font-size-body-4);
100
+ }
101
+ }
102
+
103
+ .categoryDescription {
104
+ font-size: var(--font-size-body-2);
105
+ font-weight: var(--font-weight-light);
106
+ color: var(--color-black);
107
+
108
+ @media(min-width: 768px) {
109
+ font-size: var(--font-size-body-3);
110
+ }
111
+ }
112
+
113
+ // Questions
114
+ .questionWrapper {
115
+ display: flex;
116
+ flex-direction: row;
117
+ gap: 12px;
118
+ margin-bottom: 24px;
119
+
120
+ @media(min-width: 768px) {
121
+ margin-bottom: 36px;
122
+ }
123
+ }
124
+
125
+ .questionWrapperOpenAnswer {
126
+ flex-direction: column;
127
+ border-bottom: 1px solid rgba(var(--color-blue-rgb), .2);
128
+ margin-bottom: 24px;
129
+
130
+ .question {
131
+ width: 100%;
132
+ border-bottom: none;
133
+ }
134
+
135
+ .answer {
136
+ width: 100%;
137
+ height: auto;
138
+
139
+ :global {
140
+ .ant-input {
141
+ min-height: 140px;
142
+ }
143
+
144
+ .ant-form-item {
145
+ margin-bottom: 16px;
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ .question {
152
+ width: calc(100% - 112px);
153
+ border-bottom: 1px solid rgba(var(--color-blue-rgb), .2);
154
+ }
155
+
156
+ .answer {
157
+ width: 100px;
158
+ height: 50px;
159
+ align-self: flex-end;
160
+ }
161
+
162
+ .subject {
163
+ font-size: var(--font-size-body-2);
164
+ font-weight: var(--font-weight-semibold);
165
+ margin-bottom: 8px;
166
+
167
+ @media(min-width: 768px) {
168
+ font-size: var(--font-size-body-3);
169
+ }
170
+ }
171
+
172
+ .description {
173
+ font-weight: var(--font-weight-light);
174
+ margin-bottom: 4px;
175
+ }
@@ -1,16 +1,16 @@
1
- import { Meta, Story } from "@storybook/react";
2
- import { CustomDatePicker, CustomDatePickerProps } from '.';
3
-
4
- export default {
5
- title: 'DatePicker',
6
- component: CustomDatePicker,
7
- } as Meta;
8
-
9
- const Template: Story<CustomDatePickerProps> = (args) => <CustomDatePicker {...args}></CustomDatePicker>;
10
-
11
- export const Primary = Template.bind({});
12
- Primary.args = {
13
- onChange: (x: any, y: any) => {
14
- console.log(x, y);
15
- },
16
- };
1
+ import { Meta, Story } from "@storybook/react";
2
+ import { CustomDatePicker, CustomDatePickerProps } from '.';
3
+
4
+ export default {
5
+ title: 'DatePicker',
6
+ component: CustomDatePicker,
7
+ } as Meta;
8
+
9
+ const Template: Story<CustomDatePickerProps> = (args) => <CustomDatePicker {...args}></CustomDatePicker>;
10
+
11
+ export const Primary = Template.bind({});
12
+ Primary.args = {
13
+ onChange: (x: any, y: any) => {
14
+ console.log(x, y);
15
+ },
16
+ };
@@ -1,38 +1,38 @@
1
- import styles from './styles.module.scss';
2
- import { DatePicker, DatePickerProps } from 'antd';
3
-
4
- export type CustomDatePickerProps = DatePickerProps & {
5
- isRangePicker?: boolean;
6
- onChange?: (a: any, b: any) => void;
7
- disabled?: boolean;
8
- defaultValue?: any;
9
- }
10
-
11
- const { RangePicker } = DatePicker;
12
-
13
- export const CustomDatePicker = ({
14
- className, onChange, value, isRangePicker, disabled, defaultValue, ...rest
15
- }: CustomDatePickerProps) => {
16
-
17
- return (
18
- <>
19
- { isRangePicker
20
- ?
21
- <RangePicker
22
- onChange={ onChange }
23
- className={ `${styles.sitooDatePicker} ${className}` }
24
- disabled={disabled}
25
- defaultValue={defaultValue}
26
- />
27
- :
28
- <DatePicker
29
- { ...rest }
30
- value={ value }
31
- onChange={ onChange }
32
- defaultValue={defaultValue}
33
- className={ `${styles.sitooDatePicker} ${className}` }
34
- />
35
- }
36
- </>
37
- );
38
- }
1
+ import styles from './styles.module.scss';
2
+ import { DatePicker, DatePickerProps } from 'antd';
3
+
4
+ export type CustomDatePickerProps = DatePickerProps & {
5
+ isRangePicker?: boolean;
6
+ onChange?: (a: any, b: any) => void;
7
+ disabled?: boolean;
8
+ defaultValue?: any;
9
+ }
10
+
11
+ const { RangePicker } = DatePicker;
12
+
13
+ export const CustomDatePicker = ({
14
+ className, onChange, value, isRangePicker, disabled, defaultValue, ...rest
15
+ }: CustomDatePickerProps) => {
16
+
17
+ return (
18
+ <>
19
+ { isRangePicker
20
+ ?
21
+ <RangePicker
22
+ onChange={ onChange }
23
+ className={ `${styles.sitooDatePicker} ${className}` }
24
+ disabled={disabled}
25
+ defaultValue={defaultValue}
26
+ />
27
+ :
28
+ <DatePicker
29
+ { ...rest }
30
+ value={ value }
31
+ onChange={ onChange }
32
+ defaultValue={defaultValue}
33
+ className={ `${styles.sitooDatePicker} ${className}` }
34
+ />
35
+ }
36
+ </>
37
+ );
38
+ }
@@ -1,3 +1,3 @@
1
- .sitooDatePicker {
2
- border-color: rgba(var(--color-black-rgb), .5);
3
- }
1
+ .sitooDatePicker {
2
+ border-color: rgba(var(--color-black-rgb), .5);
3
+ }
@@ -1,19 +1,19 @@
1
- import { Meta, Story } from "@storybook/react";
2
- import { DatePickerTag } from '.';
3
- import { TagProps } from 'antd';
4
- import { useState } from "react";
5
-
6
- export default {
7
- title: 'DatePickerTag',
8
- component: DatePickerTag,
9
- } as Meta;
10
-
11
- const Template: Story<TagProps> = (args) => {
12
- const [tagsInfo, setTagsInfo] = useState<any>({});
13
-
14
- return <DatePickerTag {...args} tagsInfo={setTagsInfo}></DatePickerTag>;
15
- }
16
-
17
- export const Primary = Template.bind({});
18
- Primary.args = {
19
- };
1
+ import { Meta, Story } from "@storybook/react";
2
+ import { DatePickerTag } from '.';
3
+ import { TagProps } from 'antd';
4
+ import { useState } from "react";
5
+
6
+ export default {
7
+ title: 'DatePickerTag',
8
+ component: DatePickerTag,
9
+ } as Meta;
10
+
11
+ const Template: Story<TagProps> = (args) => {
12
+ const [tagsInfo, setTagsInfo] = useState<any>({});
13
+
14
+ return <DatePickerTag {...args} tagsInfo={setTagsInfo}></DatePickerTag>;
15
+ }
16
+
17
+ export const Primary = Template.bind({});
18
+ Primary.args = {
19
+ };
@@ -1,89 +1,89 @@
1
- import React, { useEffect, useState } from 'react';
2
- import type { Dayjs } from 'dayjs';
3
- import { DatePicker, Tag, TagProps } from 'antd';
4
- import { TweenOneGroup } from 'rc-tween-one';
5
- import styles from './styles.module.scss';
6
- import { t } from 'i18next';
7
- import moment, { Moment } from 'moment';
8
-
9
- export interface DatePickerTagProps extends TagProps {
10
- customTags?: any,
11
- tagsInfo?: any;
12
- }
13
-
14
- type DateValue = Dayjs | null;
15
-
16
- export const DatePickerTag = (props: DatePickerTagProps) => {
17
- const { customTags = [] } = props;
18
-
19
- const [tags, setTags] = useState<any>(customTags);
20
- const [dateValue, setDateValue] = useState<DateValue>(null);
21
-
22
- const handleClose = (removedTag: any) => {
23
- const newTags = tags.filter((tag: any) => tag !== removedTag);
24
- setTags(newTags);
25
- };
26
-
27
- const handleChange = (date: DateValue, dateString: string) => {
28
- const formattedDate = date?.format('DD/MM/YYYY');
29
- setTags([...tags, formattedDate]);
30
- setDateValue(null);
31
- };
32
-
33
- useEffect(() => {
34
- props?.tagsInfo(tags);
35
- }, [tags]);
36
-
37
- const forMap = (tag: any) => {
38
- const tagElem = (
39
- <Tag
40
- closable
41
- onClose={(e) => {
42
- e.preventDefault();
43
- handleClose(tag);
44
- }}
45
- >
46
- {tag}
47
- </Tag>
48
- );
49
- return (
50
- <span key={tag} className={styles.new} style={{ display: 'inline-block' }}>
51
- {tagElem}
52
- </span>
53
- );
54
- };
55
-
56
- const tagChild = tags.map(forMap);
57
-
58
- return (
59
- <div className={styles.tagfield}>
60
- <DatePicker
61
- disabledDate={(current) => current && current < moment().endOf('day')}
62
- value={dateValue}
63
- onChange={handleChange}
64
- className={styles.picker}
65
- placeholder={t('components.datePickerTag.placeholder')!}
66
- />
67
-
68
- <div style={{ marginTop: 16 }}>
69
- <TweenOneGroup
70
- enter={{
71
- scale: 0.8,
72
- opacity: 0,
73
- type: 'from',
74
- duration: 100,
75
- }}
76
- onEnd={(e: any) => {
77
- if (e.type === 'appear' || e.type === 'enter') {
78
- (e.target as any).style = 'display: inline-block';
79
- }
80
- }}
81
- leave={{ opacity: 0, width: 0, scale: 0, duration: 200 }}
82
- appear={false}
83
- >
84
- {tagChild}
85
- </TweenOneGroup>
86
- </div>
87
- </div>
88
- );
89
- }
1
+ import React, { useEffect, useState } from 'react';
2
+ import type { Dayjs } from 'dayjs';
3
+ import { DatePicker, Tag, TagProps } from 'antd';
4
+ import { TweenOneGroup } from 'rc-tween-one';
5
+ import styles from './styles.module.scss';
6
+ import { t } from 'i18next';
7
+ import moment, { Moment } from 'moment';
8
+
9
+ export interface DatePickerTagProps extends TagProps {
10
+ customTags?: any,
11
+ tagsInfo?: any;
12
+ }
13
+
14
+ type DateValue = Dayjs | null;
15
+
16
+ export const DatePickerTag = (props: DatePickerTagProps) => {
17
+ const { customTags = [] } = props;
18
+
19
+ const [tags, setTags] = useState<any>(customTags);
20
+ const [dateValue, setDateValue] = useState<DateValue>(null);
21
+
22
+ const handleClose = (removedTag: any) => {
23
+ const newTags = tags.filter((tag: any) => tag !== removedTag);
24
+ setTags(newTags);
25
+ };
26
+
27
+ const handleChange = (date: DateValue, dateString: string) => {
28
+ const formattedDate = date?.format('DD/MM/YYYY');
29
+ setTags([...tags, formattedDate]);
30
+ setDateValue(null);
31
+ };
32
+
33
+ useEffect(() => {
34
+ props?.tagsInfo(tags);
35
+ }, [tags]);
36
+
37
+ const forMap = (tag: any) => {
38
+ const tagElem = (
39
+ <Tag
40
+ closable
41
+ onClose={(e) => {
42
+ e.preventDefault();
43
+ handleClose(tag);
44
+ }}
45
+ >
46
+ {tag}
47
+ </Tag>
48
+ );
49
+ return (
50
+ <span key={tag} className={styles.new} style={{ display: 'inline-block' }}>
51
+ {tagElem}
52
+ </span>
53
+ );
54
+ };
55
+
56
+ const tagChild = tags.map(forMap);
57
+
58
+ return (
59
+ <div className={styles.tagfield}>
60
+ <DatePicker
61
+ disabledDate={(current) => current && current < moment().endOf('day')}
62
+ value={dateValue}
63
+ onChange={handleChange}
64
+ className={styles.picker}
65
+ placeholder={t('components.datePickerTag.placeholder')!}
66
+ />
67
+
68
+ <div style={{ marginTop: 16 }}>
69
+ <TweenOneGroup
70
+ enter={{
71
+ scale: 0.8,
72
+ opacity: 0,
73
+ type: 'from',
74
+ duration: 100,
75
+ }}
76
+ onEnd={(e: any) => {
77
+ if (e.type === 'appear' || e.type === 'enter') {
78
+ (e.target as any).style = 'display: inline-block';
79
+ }
80
+ }}
81
+ leave={{ opacity: 0, width: 0, scale: 0, duration: 200 }}
82
+ appear={false}
83
+ >
84
+ {tagChild}
85
+ </TweenOneGroup>
86
+ </div>
87
+ </div>
88
+ );
89
+ }