@antscorp/antsomi-ui 2.0.71 → 2.0.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 (35) hide show
  1. package/es/components/atoms/SelectAssociatedTag/SelectAssociatedTag.d.ts +5 -0
  2. package/es/components/atoms/SelectAssociatedTag/SelectAssociatedTag.js +15 -0
  3. package/es/components/atoms/SelectAssociatedTag/SelectTag.d.ts +4 -0
  4. package/es/components/atoms/SelectAssociatedTag/SelectTag.js +26 -0
  5. package/es/components/atoms/SelectAssociatedTag/constants.d.ts +11 -0
  6. package/es/components/atoms/SelectAssociatedTag/constants.js +42 -0
  7. package/es/components/atoms/SelectAssociatedTag/index.d.ts +3 -0
  8. package/es/components/atoms/SelectAssociatedTag/index.js +2 -0
  9. package/es/components/atoms/SelectAssociatedTag/styled.d.ts +7 -0
  10. package/es/components/atoms/SelectAssociatedTag/styled.js +60 -0
  11. package/es/components/atoms/SelectAssociatedTag/types.d.ts +76 -0
  12. package/es/components/atoms/SelectAssociatedTag/types.js +1 -0
  13. package/es/components/atoms/index.d.ts +1 -0
  14. package/es/components/atoms/index.js +1 -0
  15. package/es/components/molecules/CodeStructure/CodeStructure.js +5 -1
  16. package/es/components/molecules/InputSelectAttribute/index.d.ts +25 -0
  17. package/es/components/molecules/InputSelectAttribute/index.js +124 -0
  18. package/es/components/molecules/InputSelectAttribute/styled.d.ts +14 -0
  19. package/es/components/molecules/InputSelectAttribute/styled.js +33 -0
  20. package/es/components/molecules/SearchPopover/utils.js +1 -1
  21. package/es/components/molecules/SelectV2/styled.d.ts +3 -1
  22. package/es/components/molecules/SelectV2/styled.js +2 -2
  23. package/es/components/molecules/TagifyInput/TagifyInput.js +169 -77
  24. package/es/components/molecules/TagifyInput/constants.d.ts +24 -2
  25. package/es/components/molecules/TagifyInput/constants.js +25 -2
  26. package/es/components/molecules/TagifyInput/patternHandlers.d.ts +12 -6
  27. package/es/components/molecules/TagifyInput/patternHandlers.js +88 -43
  28. package/es/components/molecules/TagifyInput/types.d.ts +24 -3
  29. package/es/components/molecules/TagifyInput/utils.d.ts +7 -1
  30. package/es/components/molecules/TagifyInput/utils.js +72 -4
  31. package/es/components/molecules/TagifyInput/utils.style.js +82 -96
  32. package/es/components/molecules/index.d.ts +1 -0
  33. package/es/components/molecules/index.js +1 -0
  34. package/es/components/organism/PreviewCollections/WhatsappMessage/Mobile.js +1 -1
  35. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import type { SelectAssociatedTagProps } from './types';
2
+ export declare const SelectAssociatedTag: {
3
+ (props: SelectAssociatedTagProps): import("react/jsx-runtime").JSX.Element;
4
+ defaultProps: SelectAssociatedTagProps;
5
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Components
3
+ import { StyledSpace } from './styled';
4
+ import { Divider } from 'antd';
5
+ import { Select } from '../../molecules';
6
+ import SelectTag from './SelectTag';
7
+ // Constants
8
+ import { defaultProps } from './constants';
9
+ export const SelectAssociatedTag = (props) => {
10
+ // Props
11
+ const { tagConfigs, style, status, selected, disabled, options, children, onSelect } = props;
12
+ const { tag, value } = selected || {};
13
+ return (_jsxs(StyledSpace, { className: `select-associated-tag ${status}`, style: style, children: [_jsx(SelectTag, { ...tagConfigs, selectedTag: tag }), _jsx(Divider, { type: "vertical", style: { margin: '0px 1px 0px 6px' }, className: "antsomi-divider-between-select" }), children ?? (_jsx(Select, { style: { width: '100%', height: '100%' }, value: value, disabled: disabled, options: options, onChange: onSelect }))] }));
14
+ };
15
+ SelectAssociatedTag.defaultProps = defaultProps;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TagConfigProps } from './types';
3
+ declare const _default: import("react").MemoExoticComponent<(props: TagConfigProps) => import("react/jsx-runtime").JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Libraries
3
+ import { memo, useMemo, useState } from 'react';
4
+ import { keyBy } from 'lodash';
5
+ // Components
6
+ import { Flex, Typography } from 'antd';
7
+ import { Popover } from '../Popover';
8
+ import { SelectedTag } from './styled';
9
+ const SelectTag = (props) => {
10
+ // Props
11
+ const { selectedTag, disabled, title, options, onSelect } = props;
12
+ // State
13
+ const [open, setOpen] = useState(false);
14
+ // Memoized
15
+ const mapOptsMemo = useMemo(() => keyBy(options, 'value'), [options]);
16
+ const selectedItem = useMemo(() => mapOptsMemo?.[selectedTag] || {}, [selectedTag, mapOptsMemo]);
17
+ const handleOpenChange = () => {
18
+ setOpen(!open);
19
+ };
20
+ const handleClick = (item) => {
21
+ setOpen(false);
22
+ onSelect(item);
23
+ };
24
+ return (_jsx(Popover, { open: open && !disabled, title: _jsx(Typography.Text, { style: { fontWeight: '400', maxWidth: 130 }, ellipsis: { tooltip: title }, children: title }), content: _jsx(Flex, { wrap: "wrap", gap: 6, style: { padding: '10px 0px' }, children: options?.map(item => (_jsx(SelectedTag, { "$color": item.color, "$background": item.background, ellipsis: { tooltip: item.label }, onClick: () => handleClick(item), children: item.label }, item.value))) }), placement: "bottomLeft", trigger: "click", overlayInnerStyle: { padding: 10, maxWidth: 150 }, onOpenChange: handleOpenChange, children: _jsx(SelectedTag, { "$color": selectedItem?.color, "$background": selectedItem?.background, ellipsis: { tooltip: selectedItem?.label }, children: selectedItem?.label }) }));
25
+ };
26
+ export default memo(SelectTag);
@@ -0,0 +1,11 @@
1
+ import type { SelectAssociatedTagProps, TagItem } from './types';
2
+ export declare const DEFAULT_TAGS: {
3
+ readonly RAW: "RAW";
4
+ readonly md5: "md5";
5
+ readonly sha_256: "sha_256";
6
+ readonly MD5: "MD5";
7
+ readonly SHA_256: "SHA_256";
8
+ };
9
+ export declare const DEFAULT_TAGS_OPTS: Record<string, TagItem>;
10
+ export declare const DEFAULT_TAGS_LIST: TagItem[];
11
+ export declare const defaultProps: SelectAssociatedTagProps;
@@ -0,0 +1,42 @@
1
+ // Constants
2
+ import { globalToken } from '@antscorp/antsomi-ui/es/constants';
3
+ // Locales
4
+ import { translations, translate } from '@antscorp/antsomi-locales';
5
+ export const DEFAULT_TAGS = {
6
+ RAW: 'RAW',
7
+ md5: 'md5',
8
+ sha_256: 'sha_256',
9
+ MD5: 'MD5',
10
+ SHA_256: 'SHA_256',
11
+ };
12
+ export const DEFAULT_TAGS_OPTS = {
13
+ RAW: { label: 'RAW', value: DEFAULT_TAGS.RAW, color: globalToken?.bw0, background: '#4CB4C9' },
14
+ md5: { label: 'md5', value: DEFAULT_TAGS.md5, color: globalToken?.bw0, background: '#3B8FDE' },
15
+ sha_256: {
16
+ label: 'sha-256',
17
+ value: DEFAULT_TAGS.sha_256,
18
+ color: globalToken?.bw0,
19
+ background: '#12B800',
20
+ },
21
+ MD5: { label: 'MD5', value: DEFAULT_TAGS.MD5, color: globalToken?.bw0, background: '#3B8FDE' },
22
+ SHA_265: {
23
+ label: 'SHA-256',
24
+ value: DEFAULT_TAGS.SHA_256,
25
+ color: globalToken?.bw0,
26
+ background: '#12B800',
27
+ },
28
+ };
29
+ export const DEFAULT_TAGS_LIST = Object.values(DEFAULT_TAGS_OPTS);
30
+ export const defaultProps = {
31
+ tagConfigs: {
32
+ options: DEFAULT_TAGS_LIST,
33
+ title: translate(translations._INFO_STORY_WAIT_FOR_HASH, 'Hash Method'),
34
+ onSelect: () => { },
35
+ },
36
+ selected: {
37
+ tag: DEFAULT_TAGS.RAW,
38
+ value: DEFAULT_TAGS.SHA_256,
39
+ },
40
+ options: DEFAULT_TAGS_LIST,
41
+ onSelect: () => { },
42
+ };
@@ -0,0 +1,3 @@
1
+ export { SelectAssociatedTag } from './SelectAssociatedTag';
2
+ export type { SelectAssociatedTagProps } from './types';
3
+ export * from './constants';
@@ -0,0 +1,2 @@
1
+ export { SelectAssociatedTag } from './SelectAssociatedTag';
2
+ export * from './constants';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import type { TagItem } from './types';
3
+ export declare const StyledSpace: import("styled-components").StyledComponent<import("react").FC<import("antd/es/space/Compact").SpaceCompactProps>, any, {}, never>;
4
+ export declare const SelectedTag: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/typography/Text").TextProps & import("react").RefAttributes<HTMLSpanElement>>, any, {
5
+ $background: TagItem['background'];
6
+ $color: TagItem['color'];
7
+ }, never>;
@@ -0,0 +1,60 @@
1
+ // Libraries
2
+ import styled from 'styled-components';
3
+ // Components
4
+ import { Space } from '../Space';
5
+ import { Typography } from 'antd';
6
+ // Constants
7
+ import { globalToken } from '@antscorp/antsomi-ui/es/constants';
8
+ export const StyledSpace = styled(Space.Compact) `
9
+ width: 100%;
10
+ height: 30px;
11
+ padding-left: 5px;
12
+ align-items: center;
13
+
14
+ border-bottom: 1px solid ${globalToken?.blue1};
15
+
16
+ &.select-associated-tag {
17
+ &.warning {
18
+ border-bottom-color: ${globalToken?.colorWarning};
19
+ }
20
+
21
+ &.error {
22
+ border-bottom-color: ${globalToken?.colorError};
23
+ }
24
+
25
+ &.success {
26
+ border-bottom-color: ${globalToken?.colorSuccess};
27
+ }
28
+ }
29
+
30
+ > div:last-child {
31
+ width: 100%;
32
+ }
33
+
34
+ .antsomi-divider.antsomi-divider-vertical {
35
+ height: 20px;
36
+ }
37
+
38
+ .antsomi-select-selector {
39
+ border: none !important;
40
+ }
41
+ `;
42
+ export const SelectedTag = styled(Typography.Text) `
43
+ border-radius: 3px;
44
+ height: 16px;
45
+ line-height: 16px;
46
+ padding-left: 3px;
47
+ padding-right: 3px;
48
+ flex-shrink: 0;
49
+ cursor: pointer;
50
+
51
+ background: ${props => props.$background};
52
+
53
+ &.antsomi-typography {
54
+ color: ${props => props.$color};
55
+
56
+ &.antsomi-typography-ellipsis {
57
+ max-width: 70px;
58
+ }
59
+ }
60
+ `;
@@ -0,0 +1,76 @@
1
+ import { Dictionary } from 'lodash';
2
+ import { CSSProperties, ReactNode } from 'react';
3
+ export type TagItem = {
4
+ label: string;
5
+ value: string;
6
+ background: CSSProperties['background'];
7
+ color: CSSProperties['color'];
8
+ };
9
+ export type Status = 'error' | 'warning' | 'success';
10
+ export interface TagConfigProps {
11
+ selectedTag: TagItem['value'];
12
+ title?: string;
13
+ disabled?: boolean;
14
+ options: TagItem[];
15
+ onSelect: (newItem: TagItem) => void;
16
+ }
17
+ export type SelectOption = {
18
+ label: string;
19
+ value: string;
20
+ };
21
+ /**
22
+ * Properties for the SelectAssociatedTag component.
23
+ */
24
+ export interface SelectAssociatedTagProps {
25
+ /**
26
+ * Configuration properties for tag options, excluding the selected tag.
27
+ * @type {Omit<TagConfigProps, 'selectedTag'>}
28
+ */
29
+ tagConfigs: Omit<TagConfigProps, 'selectedTag'>;
30
+ /**
31
+ * The currently selected tag and its associated value.
32
+ * @type {{ tag: string; value: string; }}
33
+ */
34
+ selected: {
35
+ /**
36
+ * The identifier for the selected tag.
37
+ * @type {string}
38
+ */
39
+ tag: string;
40
+ /**
41
+ * The value associated with the selected tag.
42
+ * @type {Dictionary<SelectOption>}
43
+ */
44
+ value: Dictionary<SelectOption>;
45
+ };
46
+ /**
47
+ * Whether the SelectAssociatedTag is disabled.
48
+ * @type {boolean}
49
+ */
50
+ disabled?: boolean;
51
+ /**
52
+ * The status of the SelectAssociatedTag, if any.
53
+ * @type {'error' | 'warning' | 'success' }
54
+ */
55
+ status?: Status;
56
+ /**
57
+ * A list of selectable options.
58
+ * @type {SelectOption[]}
59
+ */
60
+ options: SelectOption[];
61
+ /**
62
+ * The style object for the SelectAssociatedTag component.
63
+ * @type {CSSProperties}
64
+ */
65
+ style?: CSSProperties;
66
+ /**
67
+ * The children to be rendered inside the SelectAssociatedTag component.
68
+ * @type {ReactNode}
69
+ */
70
+ children?: ReactNode;
71
+ /**
72
+ * Callback function called when an option is selected.
73
+ * @type {(value: Dictionary<SelectOption>, option: SelectOption | SelectOption[]) => void}
74
+ */
75
+ onSelect: (value: Dictionary<SelectOption>, option: SelectOption | SelectOption[]) => void;
76
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -48,6 +48,7 @@ export * from './RateV2';
48
48
  export * from './Popover';
49
49
  export * from './Iframe';
50
50
  export * from './Avatar';
51
+ export * from './SelectAssociatedTag';
51
52
  export type { SliderProps } from './Slider';
52
53
  export type { PaginationProps } from './Pagination';
53
54
  export type { InputDynamicProps } from './InputDynamic';
@@ -48,3 +48,4 @@ export * from './RateV2';
48
48
  export * from './Popover';
49
49
  export * from './Iframe';
50
50
  export * from './Avatar';
51
+ export * from './SelectAssociatedTag';
@@ -1,10 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Libraries
3
3
  import { memo, useEffect } from 'react';
4
- import { Form, InputNumber, Radio, Select, Typography, Flex, Input, Row, Col } from 'antd';
4
+ import { Form, Typography, Flex, Row, Col } from 'antd';
5
5
  import { useImmer } from 'use-immer';
6
6
  import { translate, translations } from '@antscorp/antsomi-locales';
7
7
  import { isEmpty } from 'lodash';
8
+ // Components
9
+ import { Input, Radio } from '../../atoms';
10
+ import { InputNumber } from '../InputNumber';
11
+ import { Select } from '../Select';
8
12
  // Utils
9
13
  import { calculateTotalCodes, generateCodeWithPrefixAndSuffix, generateRandomCodeWithConfig, } from './utils';
10
14
  // Types
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ export type ValueType = 'input' | 'select';
3
+ type Value = {
4
+ source: any;
5
+ code: any;
6
+ } | string;
7
+ type Option = {
8
+ [key: string]: any;
9
+ label: string;
10
+ value: string;
11
+ };
12
+ export interface InputSelectAttributeProps {
13
+ sourceOptions: Option[];
14
+ mapCodeOptions: Record<string, Option[]>;
15
+ label?: string;
16
+ isErrorTag?: boolean;
17
+ errorMsg?: string;
18
+ value: Value;
19
+ onChange: (newValueData: {
20
+ value: Value;
21
+ valueType: ValueType;
22
+ }) => void;
23
+ }
24
+ declare const _default: import("react").MemoExoticComponent<(props: InputSelectAttributeProps) => import("react/jsx-runtime").JSX.Element>;
25
+ export default _default;
@@ -0,0 +1,124 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ // Libraries
3
+ import { memo, useCallback, useMemo, useState } from 'react';
4
+ import { get, has, keyBy, upperFirst } from 'lodash';
5
+ import { Flex, Form, Select, Tooltip, Typography } from 'antd';
6
+ // Translations
7
+ import { translate, translations } from '@antscorp/antsomi-ui/es/locales';
8
+ // Components
9
+ import Icon from '@antscorp/icons';
10
+ import { ModalV2 } from '../ModalV2';
11
+ import { StyledTag as Tag } from '@antscorp/antsomi-ui/es/components/molecules/SelectV2/styled';
12
+ import { StyledSelect } from './styled';
13
+ import { EmptyData } from '../EmptyData';
14
+ import { Dashboard30Icon, ErrorIcon } from '../../icons';
15
+ // Constants
16
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
17
+ import { TAG_TYPE } from '../TagifyInput';
18
+ const InputSelectAttribute = (props) => {
19
+ const { value, errorMsg, label, isErrorTag, sourceOptions = [], mapCodeOptions = {}, onChange, } = props;
20
+ const [form] = Form.useForm();
21
+ const sourceValue = Form.useWatch('source', form);
22
+ // States
23
+ const [openModal, setOpenModal] = useState(false);
24
+ const codeOptions = useMemo(() => {
25
+ if (sourceValue) {
26
+ return get(mapCodeOptions, sourceValue, []);
27
+ }
28
+ return [];
29
+ }, [sourceValue, mapCodeOptions]);
30
+ const initCodeTitleField = useMemo(() => {
31
+ if (sourceValue === TAG_TYPE.PROMOTION_CODE) {
32
+ return 'Allocated Code';
33
+ }
34
+ return upperFirst(translate(translations._ITEM_NAME_ATTRIBUTE, 'attribute'));
35
+ }, [sourceValue]);
36
+ const mapCodeBySource = useMemo(() => {
37
+ if (typeof value === 'string')
38
+ return {};
39
+ return keyBy(get(mapCodeOptions, value?.source, []), 'value');
40
+ }, [mapCodeOptions, value]);
41
+ const mapSourceOptions = useMemo(() => {
42
+ if (typeof value === 'string')
43
+ return {};
44
+ return keyBy(sourceOptions, 'value');
45
+ }, [sourceOptions, value]);
46
+ const getCodeDefaultBySource = useCallback((source) => get(mapCodeOptions, [source, '0', 'value'], ''), [mapCodeOptions]);
47
+ const onOpenModal = useCallback(() => {
48
+ if (value && typeof value !== 'string') {
49
+ const isExistCode = has(mapCodeBySource, [value?.code, 'label']);
50
+ const isExistSource = has(mapSourceOptions, [value?.source]);
51
+ form.setFieldsValue({
52
+ source: isExistSource ? value?.source : undefined,
53
+ code: isExistCode ? value?.code : undefined,
54
+ });
55
+ }
56
+ else {
57
+ const source = sourceOptions[0]?.value || '';
58
+ const code = getCodeDefaultBySource(source);
59
+ form.setFieldsValue({ source, code });
60
+ }
61
+ setOpenModal(true);
62
+ }, [value, mapCodeBySource, form, sourceOptions, mapSourceOptions, getCodeDefaultBySource]);
63
+ const onDeselect = useCallback(() => {
64
+ onChange({ value: '', valueType: 'input' });
65
+ }, [onChange]);
66
+ const onHideModal = useCallback(() => {
67
+ setOpenModal(false);
68
+ }, []);
69
+ const onAfterClose = useCallback(() => {
70
+ form.resetFields();
71
+ }, [form]);
72
+ const onOk = async () => {
73
+ try {
74
+ // Validate form fields before getting values
75
+ const values = await form.validateFields();
76
+ if (typeof values !== 'string') {
77
+ const newValue = {
78
+ source: values?.source,
79
+ code: values?.code,
80
+ };
81
+ onChange({ value: newValue, valueType: 'select' });
82
+ }
83
+ setOpenModal(false);
84
+ }
85
+ catch (errorInfo) {
86
+ // eslint-disable-next-line no-console
87
+ console.error('Validation Failed:', errorInfo);
88
+ }
89
+ };
90
+ const onChangeInput = useCallback((val) => {
91
+ onChange({ value: val, valueType: 'input' });
92
+ }, [onChange]);
93
+ const onValuesChange = useCallback((changedValues) => {
94
+ // If source changed -> set new code based on new source
95
+ if (changedValues?.source) {
96
+ const newCode = getCodeDefaultBySource(changedValues.source);
97
+ form.setFieldValue('code', newCode);
98
+ }
99
+ }, [form, getCodeDefaultBySource]);
100
+ const renderInput = () => {
101
+ let element = null;
102
+ const isObjValue = value && typeof value !== 'string';
103
+ if (openModal || isObjValue) {
104
+ element = (_jsxs("div", { style: {
105
+ display: 'flex',
106
+ alignItems: 'center',
107
+ justifyContent: 'space-between',
108
+ height: 32,
109
+ padding: '4px 12px 4px 4px',
110
+ borderBottom: `1px solid ${errorMsg ? THEME.token?.colorError : THEME.token?.blue1}`,
111
+ }, children: [_jsx("div", { style: { width: '100%', cursor: 'pointer' }, onClick: onOpenModal, children: isObjValue && (_jsx(Tag, { isError: isErrorTag, children: isErrorTag ? (_jsxs(Flex, { gap: 5, align: "center", children: ["Unknown", _jsx(Tooltip, { title: "The used dynamic content is removed", children: _jsx(ErrorIcon, { size: 16 }) })] })) : (_jsx(Typography.Text, { ellipsis: {
112
+ tooltip: get(mapCodeBySource, [value?.code, 'label'], value?.code),
113
+ }, style: { maxWidth: 150 }, children: get(mapCodeBySource, [value?.code, 'label'], value?.code) })) })) }), _jsx(Icon, { type: "icon-ants-remove", style: { fontSize: 10, color: '#222', cursor: 'pointer' }, onClick: onDeselect })] }));
114
+ }
115
+ else {
116
+ element = (_jsx(StyledSelect, { mode: "multiple", options: [{ value: '', label: 'Or select a field' }], notFoundContent: null, onSelect: onOpenModal, style: { width: '100%', borderTop: 'none', borderLeft: 'none', borderRight: 'none' }, onDeselect: onDeselect, autoClearSearchValue: false, searchValue: typeof value === 'string' ? value : '', onSearch: onChangeInput, status: errorMsg ? 'error' : undefined, placeholder: typeof value === 'string' ? value : translate(translations.inputYourValue.title), "$isPlaceholder": !value, "$isError": !!errorMsg, dropdownStyle: {
117
+ ...(openModal ? { display: 'none' } : {}),
118
+ } }));
119
+ }
120
+ return element;
121
+ };
122
+ return (_jsxs(_Fragment, { children: [renderInput(), errorMsg ? (_jsx(Typography.Text, { style: { marginLeft: 8, color: THEME.token?.red8, marginTop: 5 }, children: errorMsg })) : null, _jsx(ModalV2, { title: translate(translations._PREDICT_MODEL_SELECT_ATTRIBUTE, 'Select attribute'), okText: translate(translations._ACT_APPLY, 'Apply'), open: openModal, onOk: onOk, onCancel: onHideModal, afterClose: onAfterClose, destroyOnClose: true, centered: true, children: _jsxs(Form, { colon: false, form: form, onValuesChange: onValuesChange, children: [_jsx(Form.Item, { label: translate(translations._TITL_PERSONALIZATION_TYPE, 'Content Source'), name: "source", required: true, labelCol: { span: 6 }, labelAlign: "left", rules: [{ required: true, message: 'Please select field!' }], children: _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), options: sourceOptions, placeholder: "Please select an item" }) }), _jsx(Form.Item, { label: label || initCodeTitleField, required: true, labelCol: { span: 6 }, labelAlign: "left", name: "code", rules: [{ required: true, message: 'Please select field!' }], children: _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), notFoundContent: _jsx(EmptyData, { size: "small", icon: _jsx(Dashboard30Icon, {}), description: "No personalized content in this journey" }), placeholder: "Please select an item", options: codeOptions }) })] }) })] }));
123
+ };
124
+ export default memo(InputSelectAttribute);
@@ -0,0 +1,14 @@
1
+ export declare const StyledSelect: import("styled-components").StyledComponent<{
2
+ (props: import("@antscorp/antsomi-ui/es/components/molecules").SelectV2Props): import("react/jsx-runtime").JSX.Element;
3
+ defaultProps: {
4
+ suffixIcon: import("react/jsx-runtime").JSX.Element;
5
+ filterOption: (input: any, option: any) => boolean;
6
+ tagRender: (props: any) => import("react/jsx-runtime").JSX.Element;
7
+ containerStyle: {};
8
+ labelStyle: {};
9
+ clearIcon: import("react/jsx-runtime").JSX.Element;
10
+ };
11
+ }, any, {
12
+ $isPlaceholder?: any;
13
+ $isError?: boolean | undefined;
14
+ }, never>;
@@ -0,0 +1,33 @@
1
+ // Libraries
2
+ import styled, { css } from 'styled-components';
3
+ // Components
4
+ import { SelectV2 as Select } from '@antscorp/antsomi-ui/es/components/molecules';
5
+ // Constants
6
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
7
+ export const StyledSelect = styled(Select) `
8
+ .antsomi-select-selection-overflow .antsomi-select-selection-overflow-item {
9
+ flex: 1;
10
+
11
+ .antsomi-select-selection-search {
12
+ width: fit-content !important;
13
+ flex: 1;
14
+ }
15
+ }
16
+
17
+ ${({ $isError }) => $isError
18
+ ? css `
19
+ .antsomi-select-selector {
20
+ box-shadow: none !important;
21
+ }
22
+ `
23
+ : css ``}
24
+
25
+ .antsomi-select-selection-placeholder {
26
+ ${props => !props.$isPlaceholder
27
+ ? css `
28
+ color: rgba(0, 0, 0, 0.85);
29
+ font-size: ${THEME.token?.fontSize}px;
30
+ `
31
+ : css ``}
32
+ }
33
+ `;
@@ -14,7 +14,7 @@ export const defaultSearch = (opt, search, config) => {
14
14
  };
15
15
  export const calDefaultListHeightInPopover = (params) => {
16
16
  const { listLength, itemSpacing, itemSize } = params;
17
- const DEFAULT_NUM_ITEM_SHOWED = 6;
17
+ const DEFAULT_NUM_ITEM_SHOWED = 4;
18
18
  const itemLength = min([DEFAULT_NUM_ITEM_SHOWED, listLength]);
19
19
  return calInlineListSize(itemLength || 0, itemSize, itemSpacing);
20
20
  };
@@ -9,7 +9,9 @@ export declare const StyledSelect: import("styled-components").StyledComponent<(
9
9
  OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
10
10
  _InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/_util/type").AnyObject) => import("react").JSX.Element;
11
11
  }, any, {}, never>;
12
- export declare const StyledTag: import("styled-components").StyledComponent<import("antd").TagType, any, {}, never>;
12
+ export declare const StyledTag: import("styled-components").StyledComponent<import("antd").TagType, any, {
13
+ isError?: boolean | undefined;
14
+ }, never>;
13
15
  export declare const CloseButton: import("styled-components").StyledComponent<"div", any, {
14
16
  borderColor?: any;
15
17
  }, never>;
@@ -105,8 +105,8 @@ export const StyledTag = styled(Tag) `
105
105
  margin-right: 5px !important;
106
106
  padding: 5px 10px !important;
107
107
  border-radius: 15px !important;
108
- border: none !important;
109
- background-color: ${THEME.token?.blue2} !important;
108
+ border: ${p => (p.isError ? `1px solid ${THEME.token?.colorError}` : 'none')} !important;
109
+ background-color: ${p => (p.isError ? THEME.token?.bw0 : THEME.token?.blue2)} !important;
110
110
  cursor: pointer !important;
111
111
 
112
112
  .antsomi-tag-close-icon {