@omniumretail/component-library 1.1.55 → 1.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.css CHANGED
@@ -8,7 +8,7 @@
8
8
  .YPXf1KvhUKPvYzjuCpbK{display:block;color:var(--color-black);text-transform:capitalize;font-size:var(--font-size-body-base);line-height:125%;font-weight:var(--font-weight-semibold)}.YPXf1KvhUKPvYzjuCpbK:not(:first-child){margin-top:8px}.ExPJyFK95xTcgtx9cRbg{text-transform:uppercase}
9
9
  .EBnBgAHgtsQFrDoso9Dw{background-color:var(--color-orange);height:1px;border:none}.FLVlQ5eFtNDkCl4IcIIx{opacity:50%}.L2HU9MLCi6B1ZsJyWfp9{background-color:var(--color-blue)}.MQcBac9Gnb9D2ONENY8Q{margin:8px 0}.tdvYp9O5RnLEsNa3E_wz{margin:16px 0}.hWWGCDnwP_ROWFDlyVxe{margin:24px 0}
10
10
  .pwZdBKCECvzAH92fQDTI{display:flex;flex-wrap:wrap;flex-direction:column}.pwZdBKCECvzAH92fQDTI .ant-table-thead>tr>th{background-color:rgba(0,0,0,0);border:0px;color:var(--color-blue)}.pwZdBKCECvzAH92fQDTI .ant-table-thead>tr>th:before{display:none}.pwZdBKCECvzAH92fQDTI .ant-table-tbody>tr{cursor:pointer}.pwZdBKCECvzAH92fQDTI .ant-table-tbody>tr:last-child>td{border-bottom:1px solid var(--color-grey-light) !important}.pwZdBKCECvzAH92fQDTI .ant-table-tbody>tr:first-child>td{border-top:1px solid var(--color-blue) !important}.pwZdBKCECvzAH92fQDTI .ant-table-tbody>tr:hover td{border-radius:0 !important;border-bottom-color:var(--color-grey-light) !important}.pwZdBKCECvzAH92fQDTI .ant-space{align-self:flex-end}.pwZdBKCECvzAH92fQDTI .ant-select-selection-placeholder{color:var(--color-black)}.pwZdBKCECvzAH92fQDTI .ant-select-selector,.pwZdBKCECvzAH92fQDTI .ant-select-focused .ant-select-selection-search{border:none !important;box-shadow:none !important}.pwZdBKCECvzAH92fQDTI .ant-select-selector:focus,.pwZdBKCECvzAH92fQDTI .ant-select-selector:hover,.pwZdBKCECvzAH92fQDTI .ant-select-focused .ant-select-selection-search:focus,.pwZdBKCECvzAH92fQDTI .ant-select-focused .ant-select-selection-search:hover{border:none !important;box-shadow:none !important}.pwZdBKCECvzAH92fQDTI .ant-pagination{max-width:calc(100% - 200px);margin-left:auto !important}.pwZdBKCECvzAH92fQDTI button[type=button].ant-pagination-item-link{margin-top:0 !important}.pwZdBKCECvzAH92fQDTI button[type=button]{margin-top:-50px}.ant-spin-dot-item{background-color:var(--color-blue) !important;opacity:1 !important}.ant-spin-dot-item:nth-child(2){background-color:var(--color-orange) !important;opacity:1}.ant-spin-dot-item:nth-child(3){background-color:var(--color-blue) !important;opacity:1}.ant-spin-dot-item:nth-child(4){background-color:var(--color-orange) !important;opacity:1}
11
- .yhGDUJJiYhqjPCJgNdjI{contain:inline-size}.yhGDUJJiYhqjPCJgNdjI .G9kG_bHpbSm0APdxALXI{margin-top:16px}.yhGDUJJiYhqjPCJgNdjI .G9kG_bHpbSm0APdxALXI.sFDpKKys2XzhCHAvcoE3{pointer-events:none}.LEywos4xlf3LV6eEFLFv{height:50px;display:flex;align-items:center;gap:12px;padding:16px;margin-inline-end:0}.LEywos4xlf3LV6eEFLFv .ant-input{height:50px;padding-left:40px}.VhQgSZHBi1swQZeQePfL{height:50px}.Hfh5KLg4Y_g44Ajhx9aV .ant-tag{background-color:var(--color-orange);color:var(--color-white);padding:6px 16px;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;position:relative;padding-right:24px;min-height:34px}.Hfh5KLg4Y_g44Ajhx9aV .anticon-close{color:var(--color-white);font-size:12px;position:absolute;right:4px;top:10px}.Hfh5KLg4Y_g44Ajhx9aV .anticon-close:hover{color:var(--color-black)}.yhGDUJJiYhqjPCJgNdjI .Gj9zvBh4toFNL6uoWOIk{display:flex;gap:12px}.yhGDUJJiYhqjPCJgNdjI .BvTiplJPlDM4ob_yobaL{display:flex;flex-direction:row;gap:12px;font-family:"SilkaBold";text-decoration:underline}.yhGDUJJiYhqjPCJgNdjI .BvTiplJPlDM4ob_yobaL div{cursor:pointer}
11
+ .yhGDUJJiYhqjPCJgNdjI{contain:inline-size}.yhGDUJJiYhqjPCJgNdjI .ant-switch.ant-switch-checked .ant-switch-handle{inset-inline-start:calc(100% - 14px)}.yhGDUJJiYhqjPCJgNdjI .G9kG_bHpbSm0APdxALXI{margin-top:16px}.yhGDUJJiYhqjPCJgNdjI .G9kG_bHpbSm0APdxALXI.sFDpKKys2XzhCHAvcoE3{pointer-events:none}.LEywos4xlf3LV6eEFLFv{height:50px;display:flex;align-items:center;gap:12px;padding:16px;margin-inline-end:0;width:100%}.LEywos4xlf3LV6eEFLFv .ant-input{height:50px;padding-left:40px}.VhQgSZHBi1swQZeQePfL{height:50px}.Hfh5KLg4Y_g44Ajhx9aV .ant-tag{background-color:var(--color-orange);color:var(--color-white);padding:6px 16px;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;position:relative;padding-right:24px;min-height:34px}.Hfh5KLg4Y_g44Ajhx9aV .anticon-close{color:var(--color-white);font-size:12px;position:absolute;right:4px;top:10px}.Hfh5KLg4Y_g44Ajhx9aV .anticon-close:hover{color:var(--color-black)}.yhGDUJJiYhqjPCJgNdjI .Ds9QXq3nvfH3xjzeP87H{background-color:var(--color-grey) !important}.yhGDUJJiYhqjPCJgNdjI .Ds9QXq3nvfH3xjzeP87H[aria-checked=true]{background:var(--color-orange) !important}@media(max-width: 768px){.yhGDUJJiYhqjPCJgNdjI .Ds9QXq3nvfH3xjzeP87H{min-width:28px;height:16px;line-height:16px}.yhGDUJJiYhqjPCJgNdjI .Ds9QXq3nvfH3xjzeP87H .ant-switch-handle{width:12px;height:12px}.yhGDUJJiYhqjPCJgNdjI .Ds9QXq3nvfH3xjzeP87H .ant-switch-inner{padding-inline-start:18px;padding-inline-end:6px}}.yhGDUJJiYhqjPCJgNdjI .shyWfuOXQO29Vq9I8XGV{display:flex;align-items:center;gap:32px;width:calc(100% - 40px)}@media(max-width: 768px){.yhGDUJJiYhqjPCJgNdjI .shyWfuOXQO29Vq9I8XGV{gap:12px;width:calc(100% - 20px)}}.yhGDUJJiYhqjPCJgNdjI .Gj9zvBh4toFNL6uoWOIk{display:flex;gap:12px}.yhGDUJJiYhqjPCJgNdjI .BvTiplJPlDM4ob_yobaL{display:flex;flex-direction:row;gap:12px;font-family:"SilkaBold";text-decoration:underline}.yhGDUJJiYhqjPCJgNdjI .BvTiplJPlDM4ob_yobaL div{cursor:pointer}
12
12
  .vdTO5pKaLXA2FdyblLq5{border-color:rgba(var(--color-black-rgb), 0.5)}
13
13
  .e3BZiSKkbgvekUOREMi6{font-weight:var(--font-weight-medium);font-size:var(--font-size-body-3);margin-right:44px;margin-top:18px}.e3BZiSKkbgvekUOREMi6 .ant-radio-checked .ant-radio-inner{border-color:var(--color-black)}.e3BZiSKkbgvekUOREMi6 .ant-radio-checked .ant-radio-inner:after{background-color:var(--color-black)}.e3BZiSKkbgvekUOREMi6 .ant-radio-checked:hover .ant-radio-inner:after{background-color:var(--color-orange)}.e3BZiSKkbgvekUOREMi6 .ant-radio:hover .ant-radio-inner{border-color:var(--color-orange)}
14
14
  .D8zh2JqbXPRwa7HPZoou{display:flex;justify-content:space-between;align-items:center;flex-wrap:nowrap;gap:0 16px;background-color:var(--color-black);position:fixed;bottom:0;width:100%;padding:12px 24px;font-size:var(--font-size-body-1);color:var(--color-grey-light);height:60px;flex-direction:row;text-align:left;box-sizing:border-box}.D8zh2JqbXPRwa7HPZoou .rLcS8I6I0aB1gd6Ro7Ix{color:var(--grey2);width:100%;margin-bottom:4px}.D8zh2JqbXPRwa7HPZoou .I18ixqhkBJrOHeIm9ELH{margin-left:8px}.D8zh2JqbXPRwa7HPZoou .XVFO_EVWpXwEwbcS7OwM,.D8zh2JqbXPRwa7HPZoou .I18ixqhkBJrOHeIm9ELH{display:inline-block}.D8zh2JqbXPRwa7HPZoou .Ch59mk3ENKwL_xUV4kwI{height:25px;align-self:flex-end}
@@ -9,5 +9,6 @@ export interface customTagProps extends TagProps {
9
9
  }[];
10
10
  addExtraTags?: string;
11
11
  disable?: boolean;
12
+ addSwitch?: boolean;
12
13
  }
13
14
  export declare const TagField: (props: customTagProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.55",
3
+ "version": "1.1.56",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -6,6 +6,7 @@ import { TweenOneGroup } from 'rc-tween-one';
6
6
  import styles from './styles.module.scss';
7
7
  import classNames from 'classnames';
8
8
  import { t } from 'i18next';
9
+ import { Switch } from 'antd';
9
10
 
10
11
  export interface customTagProps extends TagProps {
11
12
  customTags?: string[];
@@ -14,6 +15,7 @@ export interface customTagProps extends TagProps {
14
15
  advancedTags?: { display: string; value: string }[];
15
16
  addExtraTags?: string;
16
17
  disable?: boolean;
18
+ addSwitch?: boolean;
17
19
  }
18
20
 
19
21
  export const TagField = (props: customTagProps) => {
@@ -22,6 +24,7 @@ export const TagField = (props: customTagProps) => {
22
24
  const [tags, setTags] = useState<string[]>(customTags.filter(tag => !tag.includes('=')));
23
25
  const [inputVisible, setInputVisible] = useState<boolean>(false);
24
26
  const [inputValue, setInputValue] = useState('');
27
+ // const [switchValue, setSwitchValue] = useState<boolean>(false);
25
28
  const inputRef = useRef<InputRef>(null);
26
29
  const [advancedTagList, setAdvancedTagList] = useState<Array<{ display: string; value: string }>>([]);
27
30
  const [allTags, setAllTags] = useState<string[]>(customTags.filter(tag => !tag.includes('=')));
@@ -57,7 +60,12 @@ export const TagField = (props: customTagProps) => {
57
60
  if (inputValue && allTags.indexOf(inputValue) === -1) {
58
61
  const [, value] = inputValue.split('=');
59
62
 
60
- setAllTags([...allTags, inputValue]);
63
+ const newAllTags = props.addSwitch ? [inputValue] : [...allTags, inputValue];
64
+ const newTags = props.addSwitch ? [inputValue] : [...tags, inputValue];
65
+
66
+ setAllTags(newAllTags);
67
+ setTags(newTags);
68
+
61
69
  const matchedFilter = advancedTags && advancedTags.find(filter => filter.display === inputValue.split('=')[0]);
62
70
 
63
71
  if (matchedFilter && !advancedTagList.some(tag => tag.display === inputValue)) {
@@ -67,6 +75,8 @@ export const TagField = (props: customTagProps) => {
67
75
  };
68
76
 
69
77
  setAdvancedTagList([...advancedTagList, newTag]);
78
+ } else if (props.addSwitch) {
79
+ setTags([inputValue]);
70
80
  } else {
71
81
  setTags([...tags, inputValue]);
72
82
  }
@@ -112,10 +122,11 @@ export const TagField = (props: customTagProps) => {
112
122
  useEffect(() => {
113
123
  // Adiciona a nova tag ao allTags usando a prop addExtraTags
114
124
  if (props.addExtraTags && typeof props.addExtraTags === "string") {
115
- setTags([...tags, props.addExtraTags]);
116
- setAllTags([...allTags, props.addExtraTags]);
125
+ const newTags = props.addSwitch ? [props.addExtraTags] : [...tags, props.addExtraTags];
126
+ setTags(newTags);
127
+ setAllTags(newTags);
117
128
  }
118
- }, [props.addExtraTags]);
129
+ }, [props.addExtraTags, props.addSwitch]);
119
130
 
120
131
  const forMap = (tag: string) => {
121
132
  const tagElem = (
@@ -150,24 +161,34 @@ export const TagField = (props: customTagProps) => {
150
161
 
151
162
  return (
152
163
  <div className={styles.tagfield}>
153
- {inputVisible && (
154
- <Input
155
- ref={inputRef}
156
- type="text"
157
- size="small"
158
- value={inputValue}
159
- onChange={handleInputChange}
160
- onKeyDown={handleKeyDown}
161
- onPressEnter={handleInputConfirm}
162
- className={styles['tagfield__input']}
163
- disabled={disable}
164
- />
165
- )}
166
- {!inputVisible && (
167
- <Tag onClick={showInput} className={classNames(styles['tagfield__creator'], 'site-tag-plus')}>
168
- <SearchOutlined /> {t('components.tag.search')}
169
- </Tag>
170
- )}
164
+ <div className={styles.switchInputContainer}>
165
+ {inputVisible && (
166
+ <Input
167
+ ref={inputRef}
168
+ type="text"
169
+ size="small"
170
+ value={inputValue}
171
+ onChange={handleInputChange}
172
+ onKeyDown={handleKeyDown}
173
+ onPressEnter={handleInputConfirm}
174
+ className={styles['tagfield__input']}
175
+ disabled={disable}
176
+ />
177
+ )}
178
+
179
+ {!inputVisible && (
180
+ <Tag onClick={showInput} className={classNames(styles['tagfield__creator'], 'site-tag-plus')}>
181
+ <SearchOutlined /> {t('components.tag.search')}
182
+ </Tag>
183
+ )}
184
+
185
+ {/* <Switch
186
+ checked={switchValue}
187
+ onChange={() => setSwitchValue(!switchValue)}
188
+ className={styles.switch}
189
+ /> */}
190
+ </div>
191
+
171
192
  {
172
193
  advancedTags &&
173
194
  <div style={{ marginTop: 16, marginBottom: 16 }} className={styles.advancedTagsWrapper}>
@@ -1,6 +1,12 @@
1
1
  .tagfield {
2
2
  contain: inline-size;
3
3
 
4
+ :global {
5
+ .ant-switch.ant-switch-checked .ant-switch-handle {
6
+ inset-inline-start: calc(100% - 14px);
7
+ }
8
+ }
9
+
4
10
  .tagsContainer {
5
11
  margin-top: 16px;
6
12
 
@@ -16,6 +22,7 @@
16
22
  gap: 12px;
17
23
  padding: 16px;
18
24
  margin-inline-end: 0;
25
+ width: 100%;
19
26
 
20
27
  :global {
21
28
  .ant-input {
@@ -43,14 +50,14 @@
43
50
  padding-right: 24px;
44
51
  min-height: 34px;
45
52
  }
46
-
53
+
47
54
  .anticon-close {
48
55
  color: var(--color-white);
49
56
  font-size: 12px;
50
57
  position: absolute;
51
58
  right: 4px;
52
59
  top: 10px;
53
-
60
+
54
61
  &:hover {
55
62
  color: var(--color-black);
56
63
  }
@@ -58,6 +65,46 @@
58
65
  }
59
66
  }
60
67
 
68
+ .switch {
69
+ background-color: var(--color-grey) !important;
70
+
71
+ &[aria-checked="true"] {
72
+ background: var(--color-orange) !important;
73
+ }
74
+
75
+ @media (max-width: 768px) {
76
+ min-width: 28px;
77
+ height: 16px;
78
+ line-height: 16px;
79
+
80
+ :global {
81
+ .ant-switch-handle {
82
+ width: 12px;
83
+ height: 12px;
84
+ }
85
+
86
+
87
+
88
+ .ant-switch-inner {
89
+ padding-inline-start: 18px;
90
+ padding-inline-end: 6px;
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ .switchInputContainer {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: 32px;
100
+ width: calc(100% - 40px);
101
+
102
+ @media (max-width: 768px) {
103
+ gap: 12px;
104
+ width: calc(100% - 20px);
105
+ }
106
+ }
107
+
61
108
  .advancedTagsWrapper {
62
109
  display: flex;
63
110
  gap: 12px;
@@ -74,4 +121,4 @@
74
121
  cursor: pointer;
75
122
  }
76
123
  }
77
- }
124
+ }