@omniumretail/component-library 1.2.70 → 1.2.72

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 (249) hide show
  1. package/dist/component-library.umd.js +1154 -0
  2. package/dist/{types/components → components}/AnalyticsBar/helpers/codeMutation.d.ts +2 -2
  3. package/dist/{types/components → components}/AnalyticsBar/index.d.ts +2 -1
  4. package/dist/{types/components → components}/Button/index.d.ts +2 -1
  5. package/dist/{types/components → components}/Category/index.d.ts +2 -1
  6. package/dist/{types/components → components}/CategoryReadOnly/index.d.ts +2 -1
  7. package/dist/{types/components → components}/CategoryResponse/index.d.ts +3 -2
  8. package/dist/{types/components → components}/DatePicker/index.d.ts +2 -1
  9. package/dist/{types/components → components}/DatePickerTag/index.d.ts +2 -1
  10. package/dist/{types/components → components}/DropdownButton/index.d.ts +3 -2
  11. package/dist/{types/components → components}/Footer2/index.d.ts +2 -1
  12. package/dist/{types/components → components}/Header/Header.data.d.ts +2 -1
  13. package/dist/{types/components → components}/Header/Header.types.d.ts +2 -1
  14. package/dist/{types/components → components}/Header/index.d.ts +2 -1
  15. package/dist/{types/components → components}/Input/index.d.ts +2 -1
  16. package/dist/{types/components → components}/InputCountryCode/index.d.ts +2 -1
  17. package/dist/{types/components → components}/Link/index.d.ts +2 -1
  18. package/dist/{types/components → components}/Menu/helpers/codeMutation.d.ts +2 -2
  19. package/dist/{types/components → components}/Menu/index.d.ts +2 -1
  20. package/dist/{types/components → components}/MobileTable/index.d.ts +2 -1
  21. package/dist/{types/components → components}/ModalWithTable/index.d.ts +2 -1
  22. package/dist/{types/components → components}/Notification/index.d.ts +2 -1
  23. package/dist/{types/components → components}/Radio/index.d.ts +3 -2
  24. package/dist/{types/components → components}/ResponsiveTable/index.d.ts +2 -1
  25. package/dist/{types/components → components}/Select/index.d.ts +2 -1
  26. package/dist/{types/components → components}/Switch/index.d.ts +2 -1
  27. package/dist/{types/components → components}/Table/index.d.ts +2 -1
  28. package/dist/{types/components → components}/Tag/index.d.ts +3 -2
  29. package/dist/{types/components → components}/Upload/index.d.ts +3 -2
  30. package/dist/{types/components → components}/WebCam/index.d.ts +2 -1
  31. package/{src/locales/en.json → dist/locales/en.json.d.ts} +4 -2
  32. package/{src/locales/es.json → dist/locales/es.json.d.ts} +4 -2
  33. package/{src/locales/pt.json → dist/locales/pt.json.d.ts} +4 -1
  34. package/package.json +98 -183
  35. package/NPMPUBLISH.md +0 -29
  36. package/bitbucket-pipelines.yml +0 -95
  37. package/dist/780.bundle.js +0 -1
  38. package/dist/838.bundle.js +0 -2
  39. package/dist/838.bundle.js.LICENSE.txt +0 -1
  40. package/dist/bundle.js +0 -2
  41. package/dist/bundle.js.LICENSE.txt +0 -451
  42. package/dist/main.css +0 -36
  43. package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +0 -4
  44. package/dist/types/components/BellNotifications/BellNotifications.stories.d.ts +0 -4
  45. package/dist/types/components/Button/Button.stories.d.ts +0 -5
  46. package/dist/types/components/Category/Category.stories.d.ts +0 -3
  47. package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +0 -3
  48. package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +0 -3
  49. package/dist/types/components/DatePicker/DatePicker.stories.d.ts +0 -4
  50. package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +0 -4
  51. package/dist/types/components/DropdownButton/DropdownButton.stories.d.ts +0 -4
  52. package/dist/types/components/ExportTableData/ExportTableData.stories.d.ts +0 -3
  53. package/dist/types/components/Footer/Footer.stories.d.ts +0 -4
  54. package/dist/types/components/Footer2/Footer.stories.d.ts +0 -5
  55. package/dist/types/components/Header/Header.stories.d.ts +0 -4
  56. package/dist/types/components/Input/Input.stories.d.ts +0 -4
  57. package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +0 -4
  58. package/dist/types/components/Label/Label.stories.d.ts +0 -5
  59. package/dist/types/components/Link/Link.stories.d.ts +0 -6
  60. package/dist/types/components/Menu/Menu.stories.d.ts +0 -4
  61. package/dist/types/components/MobileTable/MobileTable.stories.d.ts +0 -4
  62. package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +0 -4
  63. package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +0 -4
  64. package/dist/types/components/Navigation/Navigation.stories.d.ts +0 -4
  65. package/dist/types/components/Notification/Notification.stories.d.ts +0 -4
  66. package/dist/types/components/Questions/Questions.stories.d.ts +0 -3
  67. package/dist/types/components/Radio/Radio.stories.d.ts +0 -4
  68. package/dist/types/components/ResponseType/ResponseType.stories.d.ts +0 -3
  69. package/dist/types/components/ResponsiveTable/ResponsiveTable.stories.d.ts +0 -8
  70. package/dist/types/components/Select/Select.stories.d.ts +0 -5
  71. package/dist/types/components/Separator/Separator.stories.d.ts +0 -5
  72. package/dist/types/components/Sidebar/Sidebar.stories.d.ts +0 -5
  73. package/dist/types/components/Switch/Switch.stories.d.ts +0 -4
  74. package/dist/types/components/Table/Table.stories.d.ts +0 -8
  75. package/dist/types/components/Tag/Tag.stories.d.ts +0 -4
  76. package/dist/types/components/Upload/Upload.stories.d.ts +0 -3
  77. package/dist/types/components/UserInfo/UserInfo.stories.d.ts +0 -3
  78. package/dist/types/components/WebCam/WebCam.stories.d.ts +0 -3
  79. package/src/assets/code-brackets.svg +0 -1
  80. package/src/assets/colors.svg +0 -1
  81. package/src/assets/comments.svg +0 -1
  82. package/src/assets/direction.svg +0 -1
  83. package/src/assets/flow.svg +0 -1
  84. package/src/assets/fonts/Silka-Bold.woff2 +0 -0
  85. package/src/assets/fonts/Silka-Regular.woff2 +0 -0
  86. package/src/assets/images/A2AI-logo.png +0 -0
  87. package/src/assets/images/omnium-retail-logo-white.png +0 -0
  88. package/src/assets/images/omnium-retail-logo.png +0 -0
  89. package/src/assets/images/omnium-retail_icon.png +0 -0
  90. package/src/assets/plugin.svg +0 -1
  91. package/src/assets/repo.svg +0 -1
  92. package/src/assets/scss/_combinations.scss +0 -0
  93. package/src/assets/scss/_global.scss +0 -89
  94. package/src/assets/scss/index.scss +0 -2
  95. package/src/assets/stackalt.svg +0 -1
  96. package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +0 -236
  97. package/src/components/AnalyticsBar/helpers/codeMutation.tsx +0 -19
  98. package/src/components/AnalyticsBar/index.tsx +0 -76
  99. package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +0 -13
  100. package/src/components/AnalyticsBar/styles.module.scss +0 -137
  101. package/src/components/BellNotifications/BellNotifications.stories.tsx +0 -200
  102. package/src/components/BellNotifications/index.tsx +0 -154
  103. package/src/components/BellNotifications/styles.module.scss +0 -239
  104. package/src/components/Button/Button.stories.tsx +0 -26
  105. package/src/components/Button/index.tsx +0 -24
  106. package/src/components/Button/styles.module.scss +0 -70
  107. package/src/components/Category/Category.stories.tsx +0 -371
  108. package/src/components/Category/CategoryContent/index.tsx +0 -255
  109. package/src/components/Category/CategoryContent/styles.module.scss +0 -69
  110. package/src/components/Category/CategorySidebar/index.tsx +0 -344
  111. package/src/components/Category/CategorySidebar/styles.module.scss +0 -28
  112. package/src/components/Category/index.tsx +0 -58
  113. package/src/components/Category/styles.module.scss +0 -13
  114. package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +0 -274
  115. package/src/components/CategoryReadOnly/evaluationOptions.tsx +0 -81
  116. package/src/components/CategoryReadOnly/index.tsx +0 -328
  117. package/src/components/CategoryReadOnly/styles.module.scss +0 -214
  118. package/src/components/CategoryResponse/CategoryResponse.stories.tsx +0 -312
  119. package/src/components/CategoryResponse/evaluationOptions.tsx +0 -81
  120. package/src/components/CategoryResponse/index.tsx +0 -502
  121. package/src/components/CategoryResponse/styles.module.scss +0 -365
  122. package/src/components/DatePicker/DatePicker.stories.tsx +0 -16
  123. package/src/components/DatePicker/index.tsx +0 -38
  124. package/src/components/DatePicker/styles.module.scss +0 -3
  125. package/src/components/DatePickerTag/DatePickerTag.stories.tsx +0 -19
  126. package/src/components/DatePickerTag/index.tsx +0 -91
  127. package/src/components/DatePickerTag/styles.module.scss +0 -32
  128. package/src/components/DropdownButton/DropdownButton.stories.tsx +0 -24
  129. package/src/components/DropdownButton/index.tsx +0 -36
  130. package/src/components/DropdownButton/styles.module.scss +0 -9
  131. package/src/components/ExportTableData/ExportTableData.stories.tsx +0 -43
  132. package/src/components/ExportTableData/index.tsx +0 -37
  133. package/src/components/ExportTableData/styles.module.scss +0 -4
  134. package/src/components/Footer/Footer.stories.tsx +0 -15
  135. package/src/components/Footer/index.tsx +0 -45
  136. package/src/components/Footer/styles.module.scss +0 -38
  137. package/src/components/Footer2/Footer.stories.tsx +0 -184
  138. package/src/components/Footer2/index.tsx +0 -322
  139. package/src/components/Footer2/styles.module.scss +0 -292
  140. package/src/components/Header/Header.data.ts +0 -26
  141. package/src/components/Header/Header.stories.tsx +0 -236
  142. package/src/components/Header/Header.types.ts +0 -32
  143. package/src/components/Header/README.md +0 -38
  144. package/src/components/Header/index.tsx +0 -200
  145. package/src/components/Header/styles.module.scss +0 -216
  146. package/src/components/Input/Input.stories.tsx +0 -13
  147. package/src/components/Input/index.tsx +0 -31
  148. package/src/components/Input/styles.module.scss +0 -8
  149. package/src/components/InputCountryCode/index.tsx +0 -79
  150. package/src/components/InputCountryCode/inputCountryCode.stories.tsx +0 -55
  151. package/src/components/InputCountryCode/styles.module.scss +0 -3
  152. package/src/components/Label/Label.stories.tsx +0 -21
  153. package/src/components/Label/index.tsx +0 -19
  154. package/src/components/Label/styles.module.scss +0 -17
  155. package/src/components/Link/Link.stories.tsx +0 -30
  156. package/src/components/Link/index.tsx +0 -21
  157. package/src/components/Link/styles.module.scss +0 -24
  158. package/src/components/Menu/Menu.stories.tsx +0 -178
  159. package/src/components/Menu/helpers/codeMutation.tsx +0 -19
  160. package/src/components/Menu/index.tsx +0 -24
  161. package/src/components/Menu/styles.module.scss +0 -0
  162. package/src/components/MobileTable/MobileTable.stories.tsx +0 -27
  163. package/src/components/MobileTable/index.tsx +0 -102
  164. package/src/components/MobileTable/styles.module.scss +0 -75
  165. package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +0 -40
  166. package/src/components/ModalConfirmation/ModalStatusList.tsx +0 -5
  167. package/src/components/ModalConfirmation/index.tsx +0 -71
  168. package/src/components/ModalConfirmation/styles.module.scss +0 -62
  169. package/src/components/ModalWithTable/ModalWithTable.stories.tsx +0 -99
  170. package/src/components/ModalWithTable/index.tsx +0 -238
  171. package/src/components/ModalWithTable/styles.module.scss +0 -77
  172. package/src/components/Navigation/Navigation.stories.tsx +0 -21
  173. package/src/components/Navigation/index.tsx +0 -91
  174. package/src/components/Navigation/styles.module.scss +0 -91
  175. package/src/components/Notification/Notification.stories.tsx +0 -32
  176. package/src/components/Notification/index.tsx +0 -28
  177. package/src/components/Questions/Questions.stories.tsx +0 -37
  178. package/src/components/Questions/SingleQuestion/index.tsx +0 -337
  179. package/src/components/Questions/SingleQuestion/styles.module.scss +0 -142
  180. package/src/components/Questions/index.tsx +0 -124
  181. package/src/components/Questions/styles.modules.scss +0 -0
  182. package/src/components/Radio/Radio.stories.tsx +0 -43
  183. package/src/components/Radio/index.tsx +0 -26
  184. package/src/components/Radio/styles.module.scss +0 -24
  185. package/src/components/ResponseType/ResponseType.stories.tsx +0 -393
  186. package/src/components/ResponseType/index.tsx +0 -100
  187. package/src/components/ResponseType/styles.module.scss +0 -31
  188. package/src/components/ResponsiveTable/ResponsiveTable.stories.tsx +0 -386
  189. package/src/components/ResponsiveTable/index.tsx +0 -389
  190. package/src/components/ResponsiveTable/styles.module.scss +0 -153
  191. package/src/components/Select/Select.stories.tsx +0 -39
  192. package/src/components/Select/index.tsx +0 -27
  193. package/src/components/Select/styles.module.scss +0 -19
  194. package/src/components/Separator/Separator.stories.tsx +0 -22
  195. package/src/components/Separator/index.tsx +0 -27
  196. package/src/components/Separator/styles.module.scss +0 -25
  197. package/src/components/Sidebar/Sidebar.stories.tsx +0 -85
  198. package/src/components/Sidebar/index.tsx +0 -127
  199. package/src/components/Sidebar/styles.module.scss +0 -141
  200. package/src/components/Switch/Switch.stories.tsx +0 -14
  201. package/src/components/Switch/index.tsx +0 -18
  202. package/src/components/Switch/styles.module.scss +0 -7
  203. package/src/components/Table/Table.stories.tsx +0 -337
  204. package/src/components/Table/index.tsx +0 -313
  205. package/src/components/Table/styles.module.scss +0 -97
  206. package/src/components/Tag/Tag.stories.tsx +0 -32
  207. package/src/components/Tag/index.tsx +0 -295
  208. package/src/components/Tag/styles.module.scss +0 -104
  209. package/src/components/Upload/Upload.stories.tsx +0 -45
  210. package/src/components/Upload/index.tsx +0 -112
  211. package/src/components/Upload/styles.module.scss +0 -29
  212. package/src/components/UserInfo/UserInfo.stories.tsx +0 -38
  213. package/src/components/UserInfo/index.tsx +0 -77
  214. package/src/components/UserInfo/styles.module.scss +0 -35
  215. package/src/components/WebCam/WebCam.stories.tsx +0 -24
  216. package/src/components/WebCam/index.tsx +0 -73
  217. package/src/components/WebCam/styles.module.scss +0 -37
  218. package/src/components/index.tsx +0 -34
  219. package/src/constants/i18n.ts +0 -25
  220. package/src/constants/logoCompanyHelper.ts +0 -52
  221. package/src/constants/translationHelper.ts +0 -7
  222. package/src/index.ts +0 -3
  223. package/src/types/Global.d.ts +0 -4
  224. package/tsconfig.json +0 -29
  225. package/webpack.config.js +0 -51
  226. /package/dist/{types/components → components}/AnalyticsBar/interfaces/analyticsBar.d.ts +0 -0
  227. /package/dist/{types/components → components}/BellNotifications/index.d.ts +0 -0
  228. /package/dist/{types/components → components}/Category/CategoryContent/index.d.ts +0 -0
  229. /package/dist/{types/components → components}/Category/CategorySidebar/index.d.ts +0 -0
  230. /package/dist/{types/components → components}/CategoryReadOnly/evaluationOptions.d.ts +0 -0
  231. /package/dist/{types/components → components}/CategoryResponse/evaluationOptions.d.ts +0 -0
  232. /package/dist/{types/components → components}/ExportTableData/index.d.ts +0 -0
  233. /package/dist/{types/components → components}/Footer/index.d.ts +0 -0
  234. /package/dist/{types/components → components}/Label/index.d.ts +0 -0
  235. /package/dist/{types/components → components}/ModalConfirmation/ModalStatusList.d.ts +0 -0
  236. /package/dist/{types/components → components}/ModalConfirmation/index.d.ts +0 -0
  237. /package/dist/{types/components → components}/Navigation/index.d.ts +0 -0
  238. /package/dist/{types/components → components}/Questions/SingleQuestion/index.d.ts +0 -0
  239. /package/dist/{types/components → components}/Questions/index.d.ts +0 -0
  240. /package/dist/{types/components → components}/ResponseType/index.d.ts +0 -0
  241. /package/dist/{types/components → components}/Separator/index.d.ts +0 -0
  242. /package/dist/{types/components → components}/Sidebar/index.d.ts +0 -0
  243. /package/dist/{types/components → components}/UserInfo/index.d.ts +0 -0
  244. /package/dist/{types/components → components}/index.d.ts +0 -0
  245. /package/dist/{types/constants → constants}/i18n.d.ts +0 -0
  246. /package/dist/{types/constants → constants}/logoCompanyHelper.d.ts +0 -0
  247. /package/dist/{types/constants → constants}/translationHelper.d.ts +0 -0
  248. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
  249. /package/{public → dist}/index.ts +0 -0
@@ -1,97 +0,0 @@
1
- .tableWrapper {
2
- display: flex;
3
- flex-wrap: wrap;
4
- flex-direction: column;
5
-
6
- :global {
7
- .ant-table-thead>tr>th {
8
- background-color: transparent;
9
- border: 0px;
10
- color: var(--color-blue);
11
-
12
- &:before {
13
- display: none;
14
- }
15
- }
16
-
17
- .ant-table-tbody {
18
- >tr {
19
- cursor: pointer;
20
-
21
- &:last-child {
22
- >td {
23
- border-bottom: 1px solid var(--color-grey-light) !important;
24
- }
25
- }
26
-
27
- &:first-child {
28
- >td {
29
- border-top: 1px solid var(--color-blue) !important;
30
- }
31
- }
32
-
33
- &:hover {
34
- td {
35
- border-radius: 0 !important;
36
- border-bottom-color: var(--color-grey-light) !important;
37
- }
38
- }
39
- }
40
- }
41
-
42
- .ant-space {
43
- align-self: flex-end;
44
- }
45
-
46
- .ant-select-selection-placeholder {
47
- color: var(--color-black);
48
- }
49
-
50
- .ant-select-selector,
51
- .ant-select-focused .ant-select-selection-search {
52
- border: none !important;
53
- box-shadow: none !important;
54
-
55
- &:focus,
56
- &:hover {
57
- border: none !important;
58
- box-shadow: none !important;
59
- }
60
- }
61
-
62
- .ant-pagination {
63
- max-width: calc(100% - 200px);
64
- margin-left: auto !important;
65
- }
66
-
67
- button[type="button"].ant-pagination-item-link {
68
- margin-top: 0 !important;
69
- }
70
- }
71
-
72
- button[type="button"] {
73
- margin-top: -50px;
74
- }
75
- }
76
-
77
- :global {
78
- .ant-spin-dot-item {
79
- background-color: var(--color-blue) !important;
80
- opacity: 1 !important;
81
- }
82
-
83
- .ant-spin-dot-item:nth-child(2) {
84
- background-color: var(--color-orange) !important;
85
- opacity: 1;
86
- }
87
-
88
- .ant-spin-dot-item:nth-child(3) {
89
- background-color: var(--color-blue) !important;
90
- opacity: 1;
91
- }
92
-
93
- .ant-spin-dot-item:nth-child(4) {
94
- background-color: var(--color-orange) !important;
95
- opacity: 1;
96
- }
97
- }
@@ -1,32 +0,0 @@
1
- import { Meta, StoryFn } from "@storybook/react-webpack5";
2
- import { TagField } from '.';
3
- import { TagProps } from 'antd';
4
- import { useState } from "react";
5
- import { t } from "i18next";
6
-
7
- export default {
8
- title: 'TagField',
9
- component: TagField,
10
- } as Meta;
11
-
12
- const Template: StoryFn<TagProps> = (args: any) => {
13
- const [tagsInfo, setTagsInfo] = useState<any>({});
14
- const [advancedTagsInfo, setAdvancedTagsInfo] = useState<any>({});
15
- const advancedsFilters = [{ display: t('components.tag.State'), value: "State" }, { display: t('components.tag.1'), value: "Olaaaaaa" }];
16
- const [switchTest, setSwitchTest] = useState<boolean>(false);
17
-
18
- return <TagField
19
- disable={false}
20
- {...args}
21
- setInactiveUsersSwitch={setSwitchTest}
22
- advancedTags={advancedsFilters}
23
- tagsInfo={setTagsInfo}
24
- advancedTagsInfo={setAdvancedTagsInfo}
25
- inputPlacehold="ola"
26
- >
27
- </TagField>;
28
- }
29
-
30
- export const Primary = Template.bind({});
31
- Primary.args = {
32
- };
@@ -1,295 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import { DownOutlined, SearchOutlined, UpOutlined } from '@ant-design/icons';
3
- import type { InputRef } from 'antd';
4
- import { Input, Tag, TagProps } from 'antd';
5
- import { TweenOneGroup } from 'rc-tween-one';
6
- import styles from './styles.module.scss';
7
- import classNames from 'classnames';
8
- import { t } from 'i18next';
9
- import { Switch } from '../Switch';
10
-
11
- export interface customTagProps extends TagProps {
12
- customTags?: string[];
13
- tagsInfo?: (tags: string[]) => void;
14
- advancedTagsInfo?: (tags: string[]) => void;
15
- advancedTags?: { display: string; value: string }[];
16
- addExtraTags?: string;
17
- disable?: boolean;
18
- addSwitch?: boolean;
19
- setInactiveUsersSwitch?: React.Dispatch<React.SetStateAction<boolean>>;
20
- hideAdvancedFilters?: boolean;
21
- defaultAdvancedFilters?: { display: string; value: string }[];
22
- inputPlacehold?: string;
23
- inputDefaultAdvancedFilter?: string;
24
- autoFocus?: boolean;
25
- }
26
-
27
- export const TagField = (props: customTagProps) => {
28
- const {
29
- customTags = [],
30
- advancedTags,
31
- disable,
32
- defaultAdvancedFilters = [],
33
- hideAdvancedFilters = true,
34
- inputPlacehold,
35
- inputDefaultAdvancedFilter = "",
36
- autoFocus = false
37
- } = props;
38
-
39
- const [tags, setTags] = useState<string[]>(customTags.filter(tag => !tag.includes('=')));
40
- const [inputVisible, setInputVisible] = useState<boolean>(
41
- inputDefaultAdvancedFilter !== "" || autoFocus
42
- );
43
- const [inputValue, setInputValue] = useState(
44
- inputDefaultAdvancedFilter !== "" ? inputDefaultAdvancedFilter + '=' : ''
45
- );
46
- const inputRef = useRef<InputRef>(null);
47
- const [advancedTagList, setAdvancedTagList] = useState<Array<{ display: string; value: string }>>(
48
- defaultAdvancedFilters
49
- );
50
- const [allTags, setAllTags] = useState<string[]>([
51
- ...customTags.filter(tag => !tag.includes('=')),
52
- ...defaultAdvancedFilters.map((filter) => `${filter.display}`),
53
- ]);
54
- const [showAdvancedFilters, setShowAdvancedFilters] = useState<boolean>(hideAdvancedFilters ? false : true);
55
-
56
- useEffect(() => {
57
- if (defaultAdvancedFilters?.length > 0) {
58
- setAdvancedTagList(defaultAdvancedFilters);
59
- setAllTags(defaultAdvancedFilters.map((filter) => `${filter.display}`));
60
- }
61
- }, [defaultAdvancedFilters]);
62
-
63
- useEffect(() => {
64
- if (inputVisible) {
65
- inputRef.current?.focus();
66
- }
67
- }, [inputVisible]);
68
-
69
- const handleClose = (removedTag: string) => {
70
- const newAllTags = allTags.filter((tag) => tag !== removedTag);
71
- setAllTags(newAllTags);
72
-
73
- const newTags = tags.filter((tag) => tag !== removedTag);
74
- setTags(newTags);
75
-
76
- if (advancedTags && advancedTagList.some(tag => tag.display === removedTag)) {
77
- const newAdvancedTags = advancedTagList.filter((tag) => tag.display !== removedTag);
78
- setAdvancedTagList(newAdvancedTags);
79
- }
80
- };
81
-
82
- const showInput = () => {
83
- setInputVisible(true);
84
- };
85
-
86
- const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
87
- setInputValue(e.target.value);
88
- };
89
-
90
- const handleInputConfirm = () => {
91
- if (inputValue && allTags.indexOf(inputValue) === -1) {
92
- const [, value] = inputValue.split('=');
93
-
94
- if (props.addSwitch) {
95
- const newTags = props.addSwitch ? [inputValue] : [...tags, inputValue];
96
- setTags(newTags);
97
- setAllTags([inputValue]);
98
- } else {
99
- setAllTags([...allTags, inputValue]);
100
- }
101
-
102
- const matchedFilter = advancedTags && advancedTags.find(filter => filter.display === inputValue.split('=')[0]);
103
-
104
- if (matchedFilter && !advancedTagList.some(tag => tag.display === inputValue)) {
105
- const newTag = {
106
- display: inputValue,
107
- value: `${matchedFilter.value}=${value}`
108
- };
109
-
110
- setAdvancedTagList([...advancedTagList, newTag]);
111
-
112
- } else if (props.addSwitch) {
113
- setTags([inputValue]);
114
-
115
- } else {
116
- setTags([...tags, inputValue]);
117
- }
118
- }
119
-
120
- setInputVisible(false);
121
- setInputValue('');
122
-
123
- const basicTags = tags.filter(tag => !advancedTagList.some(tagObj => tagObj.display === tag));
124
- props.tagsInfo?.(basicTags);
125
- props.advancedTagsInfo?.(advancedTagList.map(tagObj => tagObj.value));
126
- };
127
-
128
- const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
129
- const cursorPosition: any = e.currentTarget.selectionStart;
130
- const advancedFilterMatch = advancedTags && advancedTags.find((filter: any) => inputValue.startsWith(`${filter}=`));
131
- if (advancedFilterMatch) {
132
- const filterLength = advancedFilterMatch.display.length;
133
- if (cursorPosition <= filterLength && ![8, 46].includes(e.keyCode)) {
134
- e.preventDefault();
135
- }
136
- }
137
-
138
- // Prevent the input of '=' manually
139
- if (e.key === "=") {
140
- e.preventDefault();
141
- }
142
- };
143
-
144
- const doSomething = (e: any) => {
145
- const tag = e.target.innerText;
146
- if (!advancedTagList.map(tagObj => tagObj.display).includes(tag)) {
147
- setInputValue(`${tag}=`);
148
- setInputVisible(true);
149
- }
150
- };
151
-
152
- useEffect(() => {
153
- props.tagsInfo?.(tags);
154
- props.advancedTagsInfo?.(advancedTagList.map(tag => tag.value));
155
- }, [tags, advancedTagList]);
156
-
157
- useEffect(() => {
158
- // Adiciona a nova tag ao allTags usando a prop addExtraTags
159
- if (props.addExtraTags && typeof props.addExtraTags === "string") {
160
- const newTags = props.addSwitch ? [props.addExtraTags] : [...tags, props.addExtraTags];
161
-
162
- if (props.addSwitch) {
163
- setTags([props.addExtraTags]);
164
- setAllTags([props.addExtraTags]);
165
- } else {
166
- setTags([...tags, props.addExtraTags]);
167
- setAllTags([...allTags, props.addExtraTags]);
168
- }
169
- }
170
- }, [props.addExtraTags, props.addSwitch]);
171
-
172
- const forMap = (tag: string) => {
173
- const tagElem = (
174
- <Tag
175
- closable
176
- onClose={(e) => {
177
- e.preventDefault();
178
- handleClose(tag);
179
- }}
180
- >
181
- {tag}
182
- </Tag>
183
- );
184
- return (
185
- <span key={tag} className={styles['tagfield__new']} style={{ display: 'inline-block' }}>
186
- {tagElem}
187
- </span>
188
- );
189
- };
190
-
191
- const advancedTagsMap = (tag: { display: string; value: string; }) => {
192
- const disabled = advancedTagList.map(tag => tag.display.split('=')[0]).includes(tag.display);
193
- return (
194
- <div onClick={!disabled ? doSomething : undefined} key={tag.display} style={{ color: disabled ? 'gray' : undefined }}>
195
- {tag.display}
196
- </div>
197
- );
198
- };
199
-
200
- const tagChild = allTags.map(forMap);
201
- const advancedTagsChild = advancedTags && advancedTags.map(advancedTagsMap);
202
-
203
- return (
204
- <div className={styles.tagfield}>
205
- <div className={styles.switchInputContainer}>
206
- {inputVisible && (
207
- <Input
208
- ref={inputRef}
209
- type="search"
210
- enterKeyHint='done'
211
- size="small"
212
- value={inputValue}
213
- onChange={handleInputChange}
214
- onKeyDown={handleKeyDown}
215
- onPressEnter={handleInputConfirm}
216
- className={styles['tagfield__input']}
217
- disabled={disable}
218
- suffix={
219
- hideAdvancedFilters ? (
220
- showAdvancedFilters ? (
221
- <UpOutlined onClick={() => setShowAdvancedFilters(false)} />
222
- ) : (
223
- <DownOutlined onClick={() => setShowAdvancedFilters(true)} />
224
- )
225
- ) : null
226
- }
227
- />
228
- )}
229
-
230
- {!inputVisible && (
231
- <Tag onClick={showInput} className={classNames(styles['tagfield__creator'], 'site-tag-plus')}>
232
- {inputPlacehold ? inputPlacehold : (
233
- <>
234
- <SearchOutlined /> {t('components.tag.search')}
235
- </>
236
- )}
237
-
238
- {hideAdvancedFilters && (
239
- showAdvancedFilters ? (
240
- <UpOutlined className={styles.tagIcon} onClick={() => setShowAdvancedFilters(false)} />
241
- ) : (
242
- <DownOutlined className={styles.tagIcon} onClick={() => setShowAdvancedFilters(true)} />
243
- )
244
- )}
245
- </Tag>
246
- )}
247
- </div>
248
-
249
- {showAdvancedFilters && advancedTags && (
250
- <div style={{ marginTop: 16, marginBottom: 16 }} className={styles.advancedTagsWrapper}>
251
- <div className={styles.label}>
252
- {t('components.tag.advancedFields')}:
253
- </div>
254
- <div className={styles.advancedTags}>
255
- {advancedTagsChild}
256
- </div>
257
- </div>
258
- )}
259
-
260
- {props.setInactiveUsersSwitch &&
261
- <div className={styles.switchContainer}>
262
- <div className={styles.inactiveLabel}>
263
- {t('components.tag.inactiveSwitch')}:
264
- </div>
265
-
266
- <Switch
267
- size={"small"}
268
- customClass={styles.inactiveSwitchStyle}
269
- onChange={(checked) => props?.setInactiveUsersSwitch!(checked)}
270
- />
271
- </div>
272
- }
273
-
274
- <div className={`${styles.tagsContainer} ${disable ? styles.disabled : ''}`}>
275
- <TweenOneGroup
276
- enter={{
277
- scale: 0.8,
278
- opacity: 0,
279
- type: 'from',
280
- duration: 100,
281
- }}
282
- onEnd={(e: any) => {
283
- if (e.type === 'appear' || e.type === 'enter') {
284
- (e.target as any).style = 'display: inline-block';
285
- }
286
- }}
287
- leave={{ opacity: 0, width: 0, scale: 0, duration: 200 }}
288
- appear={false}
289
- >
290
- {tagChild}
291
- </TweenOneGroup>
292
- </div>
293
- </div>
294
- );
295
- };
@@ -1,104 +0,0 @@
1
- .tagfield {
2
- contain: inline-size;
3
-
4
- .tagsContainer {
5
- margin-top: 16px;
6
-
7
- &.disabled {
8
- pointer-events: none;
9
- }
10
- }
11
-
12
- &__creator {
13
- height: 50px;
14
- display: flex;
15
- align-items: center;
16
- gap: 12px;
17
- padding: 16px;
18
- margin-inline-end: 0;
19
- width: 100%;
20
-
21
- :global {
22
- .ant-input {
23
- height: 50px;
24
- padding-left: 40px;
25
- }
26
- }
27
- }
28
-
29
- &__input {
30
- height: 50px;
31
- }
32
-
33
- &__new {
34
- :global {
35
- .ant-tag {
36
- background-color: var(--color-orange);
37
- color: var(--color-white);
38
- padding: 6px 16px;
39
- max-width: 240px;
40
- overflow: hidden;
41
- text-overflow: ellipsis;
42
- white-space: nowrap;
43
- position: relative;
44
- padding-right: 24px;
45
- min-height: 34px;
46
- }
47
-
48
- .anticon-close {
49
- color: var(--color-white);
50
- font-size: 12px;
51
- position: absolute;
52
- right: 4px;
53
- top: 10px;
54
-
55
- &:hover {
56
- color: var(--color-black);
57
- }
58
- }
59
- }
60
- }
61
-
62
- .switchInputContainer {
63
- display: flex;
64
- align-items: center;
65
- gap: 32px;
66
- width: calc(100% - 40px);
67
-
68
- @media (max-width: 768px) {
69
- gap: 12px;
70
- width: calc(100% - 20px);
71
- }
72
- }
73
-
74
- .advancedTagsWrapper {
75
- display: flex;
76
- gap: 12px;
77
- }
78
-
79
- .advancedTags {
80
- display: flex;
81
- flex-direction: row;
82
- gap: 12px;
83
- text-decoration: underline;
84
- font-weight: 700;
85
-
86
- div {
87
- cursor: pointer;
88
- }
89
- }
90
-
91
- .switchContainer {
92
- display: flex;
93
- gap: 20px;
94
- }
95
-
96
- .inactiveSwitchStyle {
97
- margin-top: 2px;
98
- }
99
-
100
- .tagIcon {
101
- width: 100%;
102
- justify-content: flex-end;
103
- }
104
- }
@@ -1,45 +0,0 @@
1
- import { Meta, StoryFn } from "@storybook/react-webpack5";
2
- import { Form, UploadFile } from "antd";
3
- import { Button } from "components/Button";
4
- import { Upload } from '.';
5
-
6
- export default {
7
- title: 'Upload',
8
- component: Upload,
9
- } as Meta;
10
-
11
- const Template: StoryFn<any> = (args: any) => {
12
- const [form] = Form.useForm();
13
-
14
- const handleSubmit = (values: any) => {
15
- console.log('Form values:', values);
16
- };
17
-
18
- const handleImageChange = (file: UploadFile | null) => {
19
- form.setFieldsValue({ image: file?.originFileObj });
20
- };
21
-
22
- const initialValue = {
23
- uid: '-1',
24
- name: 'image.png',
25
- status: 'done',
26
- url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
27
- }
28
- return (
29
- <Form form={form} onFinish={handleSubmit}>
30
- <Form.Item name="image" valuePropName="file" initialValue={initialValue}>
31
- <Upload {...args} onImageChange={handleImageChange} initialFileList={[initialValue]} disable={true}></Upload>
32
- </Form.Item>
33
- <Form.Item>
34
- <Button type="primary" htmlType="submit">
35
- Submit
36
- </Button>
37
- </Form.Item>
38
- </Form>
39
- )
40
- }
41
-
42
-
43
- export const Primary = Template.bind({});
44
- Primary.args = {
45
- };
@@ -1,112 +0,0 @@
1
- import styles from './styles.module.scss';
2
- import { Upload as UploadAntd } from 'antd';
3
- import ImgCrop from 'antd-img-crop';
4
- import type { RcFile, UploadFile, UploadProps } from 'antd/es/upload/interface';
5
- import { Button } from '../Button';
6
- import { Dispatch, SetStateAction, useEffect, useState } from 'react';
7
- import { useTranslation } from 'react-i18next';
8
-
9
- interface UploadPropsExtended extends UploadProps {
10
- onImageChange?: (file: UploadFile | null) => void;
11
- initialFileList?: UploadFile[];
12
- initialImageUrl?: string;
13
- disable?: boolean;
14
- file?: boolean;
15
- setFiles?: Dispatch<SetStateAction<UploadFile<any>[]>> | any;
16
- }
17
-
18
- function generateRandomString() {
19
- return Math.random().toString(36).substring(2, 14);
20
- }
21
-
22
- export const Upload = (props: UploadPropsExtended) => {
23
- const {
24
- onImageChange,
25
- initialFileList,
26
- initialImageUrl,
27
- disable,
28
- setFiles
29
- } = props;
30
-
31
- const { t } = useTranslation();
32
- const [fileList, setFileList] = useState<UploadFile[]>(initialFileList || []);
33
-
34
- // when component mounts or initialImageUrl changes, update fileList
35
- useEffect(() => {
36
- if (initialImageUrl) {
37
- const newFile: UploadFile = {
38
- uid: generateRandomString(), // use any unique string
39
- name: initialImageUrl, // use the URL as the name
40
- status: 'done',
41
- url: initialImageUrl, // this is used for preview
42
- };
43
- setFileList((prevFileList) => [...prevFileList, newFile]);
44
- }
45
- }, [initialImageUrl]);
46
-
47
- useEffect(() => {
48
- if (setFiles) {
49
- setFiles(fileList);
50
- }
51
- }, [fileList, setFiles]);
52
-
53
- const beforeUpload: UploadProps['beforeUpload'] = async (file: RcFile) => {
54
- const newFile: UploadFile = {
55
- uid: file.uid,
56
- name: file.name,
57
- type: file.type,
58
- size: file.size,
59
- originFileObj: file,
60
- status: 'done',
61
- };
62
-
63
- setFileList((prevFileList) => [...prevFileList, newFile]);
64
- if (onImageChange) {
65
- onImageChange(newFile);
66
- }
67
- return false;
68
- };
69
-
70
- const onChange: UploadProps['onChange'] = ({ file, fileList: newFileList }) => {
71
- if (file.status === 'removed') {
72
- setFileList(newFileList);
73
- if (onImageChange) {
74
- onImageChange(newFileList[0] || null);
75
- }
76
- }
77
- };
78
-
79
- const onPreview = async (file: UploadFile) => {
80
- let src = file.url as string;
81
- if (!src) {
82
- src = await new Promise((resolve) => {
83
- const reader = new FileReader();
84
- reader.readAsDataURL(file.originFileObj as RcFile);
85
- reader.onload = () => resolve(reader.result as string);
86
- });
87
- }
88
- const image = new Image();
89
- image.src = src;
90
- const imgWindow = window.open(src);
91
- imgWindow?.document.write(image.outerHTML);
92
- };
93
-
94
- return (
95
- <ImgCrop rotationSlider>
96
- <UploadAntd
97
- listType={props.file ? "text" : "picture-card"}
98
- fileList={fileList}
99
- beforeUpload={beforeUpload}
100
- onChange={onChange}
101
- onPreview={onPreview}
102
- disabled={disable}
103
- >
104
- {props.file
105
- ? <Button customClass={styles.loadFile}>{t('components.upload.loadFile')}</Button>
106
-
107
- : fileList.length < 1 && '+ Upload'
108
- }
109
- </UploadAntd>
110
- </ImgCrop>
111
- );
112
- };