@antscorp/antsomi-ui 1.3.5-beta.880 → 1.3.5-beta.881

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 (105) hide show
  1. package/es/__tests__/fileMock.test.d.ts +2 -0
  2. package/es/__tests__/fileMock.test.js +2 -0
  3. package/es/__tests__/styleMock.test.d.ts +1 -0
  4. package/es/__tests__/styleMock.test.js +2 -0
  5. package/es/assets/images/error-icon.png +0 -0
  6. package/es/components/atoms/NotificationStatus/NotificationStatus.d.ts +12 -0
  7. package/es/components/atoms/NotificationStatus/NotificationStatus.js +27 -0
  8. package/es/components/atoms/NotificationStatus/constants/index.d.ts +15 -0
  9. package/es/components/atoms/NotificationStatus/constants/index.js +15 -0
  10. package/es/components/atoms/NotificationStatus/index.d.ts +1 -0
  11. package/es/components/atoms/NotificationStatus/index.js +1 -0
  12. package/es/components/atoms/NotificationStatus/styled.d.ts +3 -0
  13. package/es/components/atoms/NotificationStatus/styled.js +14 -0
  14. package/es/components/atoms/Popover/styled.d.ts +4 -0
  15. package/es/components/atoms/Popover/styled.js +5 -0
  16. package/es/components/atoms/SlideBar/SlideBar.js +1 -3
  17. package/es/components/atoms/Slider/index.js +8 -3
  18. package/es/components/atoms/index.d.ts +1 -0
  19. package/es/components/atoms/index.js +1 -0
  20. package/es/components/icons/IpRestrictionIcon.d.ts +3 -0
  21. package/es/components/icons/IpRestrictionIcon.js +7 -0
  22. package/es/components/icons/LazyIcon/LazyIcon.d.ts +1 -0
  23. package/es/components/icons/LazyIcon/LazyIcon.js +1 -0
  24. package/es/components/icons/index.d.ts +1 -0
  25. package/es/components/icons/index.js +1 -0
  26. package/es/components/molecules/AccountSelection/AccountListing.js +1 -1
  27. package/es/components/molecules/AccountSelection/index.d.ts +1 -2
  28. package/es/components/molecules/CalendarSelection/CalendarSelection.js +4 -5
  29. package/es/components/molecules/ColorPicker/CustomPicker/index.js +2 -2
  30. package/es/components/molecules/ColorPicker/index.d.ts +1 -0
  31. package/es/components/molecules/ColorPicker/index.js +3 -2
  32. package/es/components/molecules/DrawerDetail/DrawerDetail.js +3 -3
  33. package/es/components/molecules/EditableName/EditableName.js +1 -1
  34. package/es/components/molecules/FontSetting/index.js +2 -2
  35. package/es/components/molecules/MatchAnySelect/MatchesAnySelect.js +6 -2
  36. package/es/components/molecules/RequestAccess/RequestAccess.d.ts +1 -0
  37. package/es/components/molecules/RequestAccess/RequestAccess.js +5 -10
  38. package/es/components/molecules/RichMenu/RichMenuBlock/constants.js +1 -1
  39. package/es/components/molecules/SearchPopover/components/PopoverSelect/PopoverSelect.js +4 -2
  40. package/es/components/molecules/SelectAccount/ButtonViewAll.js +14 -6
  41. package/es/components/molecules/SelectAccount/Content.js +3 -2
  42. package/es/components/molecules/SelectAccount/styled.js +4 -0
  43. package/es/components/molecules/SelectAccount/type.d.ts +2 -0
  44. package/es/components/molecules/TagifyInput/TagifyInput.js +369 -224
  45. package/es/components/molecules/TagifyInput/constants.d.ts +21 -2
  46. package/es/components/molecules/TagifyInput/constants.js +21 -2
  47. package/es/components/molecules/TagifyInput/patternHandlers.d.ts +3 -1
  48. package/es/components/molecules/TagifyInput/patternHandlers.js +22 -4
  49. package/es/components/molecules/TagifyInput/styled.js +1 -0
  50. package/es/components/molecules/TagifyInput/types.d.ts +2 -0
  51. package/es/components/molecules/TagifyInput/utils.d.ts +20 -0
  52. package/es/components/molecules/TagifyInput/utils.js +41 -3
  53. package/es/components/molecules/TagifyInput/utils.style.js +64 -1
  54. package/es/components/molecules/TemplateSaveAs/styled.js +1 -1
  55. package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +1 -1
  56. package/es/components/molecules/UploadImage/MediaThumb.d.ts +8 -0
  57. package/es/components/molecules/UploadImage/MediaThumb.js +15 -0
  58. package/es/components/molecules/UploadImage/VideoThumbnail.d.ts +4 -0
  59. package/es/components/molecules/UploadImage/VideoThumbnail.js +40 -0
  60. package/es/components/molecules/UploadImage/index.d.ts +1 -0
  61. package/es/components/molecules/UploadImage/index.js +41 -4
  62. package/es/components/molecules/index.d.ts +1 -1
  63. package/es/components/molecules/index.js +1 -1
  64. package/es/components/organism/AccountSharing/styled.js +12 -2
  65. package/es/components/organism/ContentSources/Settings.d.ts +3 -0
  66. package/es/components/organism/ContentSources/Settings.js +1 -1
  67. package/es/components/organism/ContentSources/index.d.ts +3 -0
  68. package/es/components/organism/ContentSources/index.js +4 -3
  69. package/es/components/organism/DataTable/utils/filter.d.ts +1 -1
  70. package/es/components/organism/GenerativeInsights/constants.d.ts +1 -0
  71. package/es/components/organism/GenerativeInsights/constants.js +1 -0
  72. package/es/components/organism/GenerativeInsights/index.d.ts +11 -0
  73. package/es/components/organism/GenerativeInsights/index.js +54 -0
  74. package/es/components/organism/GenerativeInsights/styled.d.ts +12 -0
  75. package/es/components/organism/GenerativeInsights/styled.js +65 -0
  76. package/es/components/organism/GenerativeInsights/utils.d.ts +13 -0
  77. package/es/components/organism/GenerativeInsights/utils.js +49 -0
  78. package/es/components/organism/LeftMenu/utils/index.js +7 -5
  79. package/es/components/organism/index.d.ts +1 -0
  80. package/es/components/organism/index.js +1 -0
  81. package/es/components/template/Layout/Layout.js +51 -7
  82. package/es/components/template/Layout/constants/menuCode.d.ts +1 -0
  83. package/es/components/template/Layout/constants/menuCode.js +1 -0
  84. package/es/components/template/Layout/constants/permission.d.ts +0 -1
  85. package/es/components/template/Layout/constants/permission.js +1 -1
  86. package/es/components/template/Layout/utils/permission.js +1 -0
  87. package/es/constants/queries.d.ts +1 -0
  88. package/es/constants/queries.js +1 -0
  89. package/es/locales/en/translation.json +1 -1
  90. package/es/locales/ja/google-sheet.json +26 -26
  91. package/es/locales/vi/google-sheet.json +1 -1
  92. package/es/providers/ConfigProvider/GlobalStyle.js +29 -1
  93. package/es/queries/Account/useGetAccountList.js +1 -1
  94. package/es/queries/Media/index.d.ts +1 -0
  95. package/es/queries/Media/index.js +1 -0
  96. package/es/queries/Media/useGetListingSavedMedia.d.ts +12 -0
  97. package/es/queries/Media/useGetListingSavedMedia.js +15 -0
  98. package/es/queries/index.d.ts +1 -0
  99. package/es/queries/index.js +1 -0
  100. package/es/services/Permission/index.d.ts +16 -0
  101. package/es/services/Permission/index.js +35 -0
  102. package/es/test.d.ts +0 -11
  103. package/es/test.js +138 -377
  104. package/package.json +4 -3
  105. package/es/stories/assets/code-brackets.svg +0 -1
@@ -0,0 +1,2 @@
1
+ declare const _exports: string;
2
+ export = _exports;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = 'test-file-stub';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = {};
Binary file
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ type TNotification = {
3
+ title: string;
4
+ message?: string;
5
+ type: 'success' | 'error';
6
+ timeout?: number;
7
+ };
8
+ declare const useNotificationStatus: () => {
9
+ contextHolder: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
10
+ showNotification: ({ title, message, type, timeout, }: TNotification) => void;
11
+ };
12
+ export default useNotificationStatus;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { notification } from 'antd';
3
+ import { MAP_BY_TYPE, STYLE_NOTIFICATION } from './constants';
4
+ import { Content, Title } from './styled';
5
+ import { Icon } from '../Icon';
6
+ const useNotificationStatus = () => {
7
+ const [api, contextHolder] = notification.useNotification();
8
+ const showNotification = ({ title = '', message = '', type = 'success', timeout = 4, }) => {
9
+ const info = MAP_BY_TYPE[type];
10
+ return api[type]({
11
+ message: _jsx(Title, { color: info.color, children: title }),
12
+ description: _jsx(Content, { children: message }),
13
+ duration: timeout,
14
+ style: {
15
+ ...STYLE_NOTIFICATION,
16
+ borderLeft: `4px solid ${info.color}`,
17
+ },
18
+ placement: 'bottomLeft',
19
+ closeIcon: _jsx(Icon, { size: 14, color: "#595959", type: "icon-ants-remove-slim" }),
20
+ });
21
+ };
22
+ return {
23
+ contextHolder,
24
+ showNotification,
25
+ };
26
+ };
27
+ export default useNotificationStatus;
@@ -0,0 +1,15 @@
1
+ export declare const MAP_BY_TYPE: {
2
+ readonly success: {
3
+ readonly color: "#12B800";
4
+ };
5
+ readonly error: {
6
+ readonly color: "#ef3340";
7
+ };
8
+ };
9
+ export declare const STYLE_NOTIFICATION: {
10
+ display: string;
11
+ alignItems: string;
12
+ gap: string;
13
+ padding: string;
14
+ borderRadius: string;
15
+ };
@@ -0,0 +1,15 @@
1
+ export const MAP_BY_TYPE = {
2
+ success: {
3
+ color: '#12B800',
4
+ },
5
+ error: {
6
+ color: '#ef3340',
7
+ },
8
+ };
9
+ export const STYLE_NOTIFICATION = {
10
+ display: 'flex',
11
+ alignItems: 'center',
12
+ gap: '10px',
13
+ padding: '15px',
14
+ borderRadius: '10px',
15
+ };
@@ -0,0 +1 @@
1
+ export { default as useNotificationStatus } from './NotificationStatus';
@@ -0,0 +1 @@
1
+ export { default as useNotificationStatus } from './NotificationStatus';
@@ -0,0 +1,3 @@
1
+ export declare const Title: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const WrapperIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const Content: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,14 @@
1
+ import styled from 'styled-components';
2
+ export const Title = styled.div `
3
+ font-weight: bold;
4
+ font-size: 14px;
5
+ line-height: 20px;
6
+ color: ${props => props.color || '#000'};
7
+ `;
8
+ export const WrapperIcon = styled.div `
9
+ display: flex;
10
+ align-items: center;
11
+ `;
12
+ export const Content = styled.div `
13
+ color: #7f7f7f;
14
+ `;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const PopoverWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").PopoverProps & import("react").RefAttributes<unknown>> & {
3
+ _InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/popover/PurePanel").PurePanelProps>;
4
+ }, any, {}, never>;
@@ -0,0 +1,5 @@
1
+ // Libraries
2
+ import styled from 'styled-components';
3
+ // Components
4
+ import { Popover as AntdPopover } from 'antd';
5
+ export const PopoverWrapper = styled(AntdPopover) ``;
@@ -270,9 +270,7 @@ export const SlideBar = props => {
270
270
  fontSize: `${BTN_ADD_SIZE}px`,
271
271
  cursor: disabledAdd ? 'not-allowed' : 'pointer',
272
272
  color: disabledAdd ? THEME.token?.colorTextDisabled : THEME.token?.colorPrimary,
273
- },
274
- // disabled={disabledAdd}
275
- onClick: (e) => {
273
+ }, onClick: (e) => {
276
274
  e.stopPropagation();
277
275
  if (!disabledAdd) {
278
276
  handleAddSlide();
@@ -10,11 +10,16 @@ export const Slider = memo(props => {
10
10
  const { range, value, min = 0, max = 0, className, tooltipVisible = false } = props;
11
11
  const isNegative = useMemo(() => !!(!range && min < 0), [range, min]);
12
12
  const calculateWidth = useMemo(() => ((value || 0) * 100) / (Math.abs(max) + Math.abs(min) || 1), [min, max, value]);
13
- const restProps = tooltipVisible === 'default' ? omit(props, ['tooltipVisible']) : props;
13
+ // const restProps = tooltipVisible === 'default' ? omit(props, ['tooltipVisible']) : props;
14
+ const restProps = omit(props, ['tooltipVisible']);
14
15
  if (isNegative) {
15
- return (_jsx(SliderWrapper, { isNegative: true, width: calculateWidth, className: className, children: _jsx(AntdSlider, { ...omit(restProps, ['marks', 'className']), marks: {
16
+ return (_jsx(SliderWrapper, { isNegative: true, width: calculateWidth, className: className, children: _jsx(AntdSlider, { ...omit(restProps, ['marks', 'className']), tooltip: tooltipVisible !== 'default' && {
17
+ open: tooltipVisible,
18
+ }, marks: {
16
19
  0: ' ',
17
20
  } }) }));
18
21
  }
19
- return (_jsx(SliderWrapper, { className: className, children: _jsx(AntdSlider, { ...restProps }) }));
22
+ return (_jsx(SliderWrapper, { className: className, children: _jsx(AntdSlider, { ...restProps, tooltip: tooltipVisible !== 'default' && {
23
+ open: tooltipVisible,
24
+ } }) }));
20
25
  });
@@ -46,6 +46,7 @@ export * from './RateV2';
46
46
  export * from './Popover';
47
47
  export * from './Iframe';
48
48
  export * from './Avatar';
49
+ export * from './NotificationStatus';
49
50
  export type { SliderProps } from './Slider';
50
51
  export type { PaginationProps } from './Pagination';
51
52
  export type { InputDynamicProps } from './InputDynamic';
@@ -46,3 +46,4 @@ export * from './RateV2';
46
46
  export * from './Popover';
47
47
  export * from './Iframe';
48
48
  export * from './Avatar';
49
+ export * from './NotificationStatus';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const IpRestrictionIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { useIcon } from './hooks/useIcon';
4
+ export const IpRestrictionIcon = forwardRef((props, ref) => {
5
+ const { width, height } = useIcon(props);
6
+ return (_jsx("svg", { viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, ref: ref, width: width, height: height, children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M21.9688 8.98438C21.9688 5.09375 18.875 2 14.9844 2C11.0938 2 8 5.09375 8 8.98438C8 12.9947 12.0754 18.4546 14 20.8095V22.1707C13.1476 22.472 12.472 23.1476 12.1707 24H8C7.44772 24 7 24.4477 7 25C7 25.5523 7.44772 26 8 26H12.1707C12.5825 27.1652 13.6938 28 15 28C16.3062 28 17.4175 27.1652 17.8293 26H22C22.5523 26 23 25.5523 23 25C23 24.4477 22.5523 24 22 24H17.8293C17.528 23.1476 16.8524 22.472 16 22.1707V20.7713C17.9371 18.3959 21.9688 12.9731 21.9688 8.98438ZM14.9844 18.875C12.9219 16.2031 9.96875 11.8438 9.96875 8.98438C9.96875 6.21875 12.2188 3.96875 14.9844 3.96875C17.75 3.96875 20 6.21875 20 8.98438C20 11.8438 17.0938 16.1562 14.9844 18.875ZM14.9844 11.4688C13.625 11.4688 12.5 10.3438 12.5 8.98438C12.5 7.625 13.625 6.5 14.9844 6.5C16.3438 6.5 17.4688 7.625 17.4688 8.98438C17.4688 10.3438 16.3438 11.4688 14.9844 11.4688Z", fill: "currentColor" }) }));
7
+ });
@@ -208,6 +208,7 @@ export declare const LazyIcon: {
208
208
  InteractiveIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
209
209
  InvisibleIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
210
210
  InvitePeopleIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
211
+ IpRestrictionIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
211
212
  IssueBugIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
212
213
  ItemRecommendationIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
213
214
  JourneyTactic30Icon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
@@ -214,6 +214,7 @@ export const LazyIcon = {
214
214
  InteractiveIcon: lazy(() => import('../InteractiveIcon').then(m => ({ default: m.InteractiveIcon }))),
215
215
  InvisibleIcon: lazy(() => import('../InvisibleIcon').then(m => ({ default: m.InvisibleIcon }))),
216
216
  InvitePeopleIcon: lazy(() => import('../InvitePeopleIcon').then(m => ({ default: m.InvitePeopleIcon }))),
217
+ IpRestrictionIcon: lazy(() => import('../IpRestrictionIcon').then(m => ({ default: m.IpRestrictionIcon }))),
217
218
  IssueBugIcon: lazy(() => import('../IssueBugIcon').then(m => ({ default: m.IssueBugIcon }))),
218
219
  ItemRecommendationIcon: lazy(() => import('../ItemRecommendationIcon').then(m => ({ default: m.ItemRecommendationIcon }))),
219
220
  JourneyTactic30Icon: lazy(() => import('../JourneyTactic30Icon').then(m => ({ default: m.JourneyTactic30Icon }))),
@@ -206,6 +206,7 @@ export { Integration30Icon } from './Integration30Icon';
206
206
  export { InteractiveIcon } from './InteractiveIcon';
207
207
  export { InvisibleIcon } from './InvisibleIcon';
208
208
  export { InvitePeopleIcon } from './InvitePeopleIcon';
209
+ export { IpRestrictionIcon } from './IpRestrictionIcon';
209
210
  export { IssueBugIcon } from './IssueBugIcon';
210
211
  export { ItemRecommendationIcon } from './ItemRecommendationIcon';
211
212
  export { JourneyTactic30Icon } from './JourneyTactic30Icon';
@@ -206,6 +206,7 @@ export { Integration30Icon } from './Integration30Icon';
206
206
  export { InteractiveIcon } from './InteractiveIcon';
207
207
  export { InvisibleIcon } from './InvisibleIcon';
208
208
  export { InvitePeopleIcon } from './InvitePeopleIcon';
209
+ export { IpRestrictionIcon } from './IpRestrictionIcon';
209
210
  export { IssueBugIcon } from './IssueBugIcon';
210
211
  export { ItemRecommendationIcon } from './ItemRecommendationIcon';
211
212
  export { JourneyTactic30Icon } from './JourneyTactic30Icon';
@@ -33,7 +33,7 @@ export const AccountListing = React.forwardRef((props, ref) => {
33
33
  },
34
34
  // eslint-disable-next-line react-hooks/exhaustive-deps
35
35
  [onChange, recentData]);
36
- return (_jsxs(AccountSelectionStyled, { className: className, children: [_jsx(Input, { placeholder: "Search", suffix: _jsx(Icon, { type: "icon-ants-search-2", style: { fontSize: '24px', color: THEME.token?.bw8 } }), value: searchValue, onChange: event => setSearchValue(event.target.value) }), _jsx("div", { className: "account-list", children: _jsx("ul", { children: _jsxs(Scrollbars, { style: { width: '100%', height: showAllAccount ? '364px' : '410px' }, children: [recentData?.value?.length ? (_jsxs(_Fragment, { children: [_jsx(Text, { className: "recent-text", children: "Recent" }), recentData?.value
36
+ return (_jsxs(AccountSelectionStyled, { className: className, children: [_jsx(Input, { placeholder: "Search", suffix: _jsx(Icon, { type: "icon-ants-search-2", style: { fontSize: '24px', color: THEME.token?.bw8 } }), value: searchValue, onChange: event => setSearchValue(event.target.value) }), _jsx("div", { className: "account-list", children: _jsx("ul", { children: _jsxs(Scrollbars, { style: { width: '100%', height: showAllAccount ? '364px' : '410px' }, children: [recentData?.value?.length && recentData?.value?.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { className: "recent-text", children: "Recent" }), recentData?.value
37
37
  .map(accountId => accountData?.find(account => account.userId === accountId))
38
38
  .filter((accountId, index, self) => Boolean(accountId) && index === self.indexOf(accountId))
39
39
  .map(account => (_jsx(AccountItem, { userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: +currentAccount === account.userId }, account.userId))), _jsx(Divider, { style: { margin: '8px 0', color: THEME.token?.bw3 } })] })) : null, accountData
@@ -1,4 +1,3 @@
1
1
  export { AccountSelection, type AccountSelectionProps } from './AccountSelection';
2
- export { AccountListing } from './AccountListing';
3
- export type { AccountListingHandle } from './AccountListing';
2
+ export { AccountListing, type AccountListingHandle } from './AccountListing';
4
3
  export { useAccountSelection } from './hooks';
@@ -10,16 +10,15 @@ import { LOCAL_TIMEZONE, RANGE_LIMIT } from './constants';
10
10
  import { initState, resetValue } from './actions';
11
11
  import { useTriggerOut } from './hooks/useTriggerOut';
12
12
  export const CalendarSelection = props => {
13
- const initialed = useRef(false);
13
+ const initialized = useRef(false);
14
14
  const { value, rangeLimit = RANGE_LIMIT, timezone = LOCAL_TIMEZONE, timeDisplayProps, popoverProps, rangePickerProps, onChange, } = props;
15
15
  const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
16
16
  useLayoutEffect(() => {
17
- if (!value)
17
+ if (!value || initialized.current)
18
18
  return;
19
- const needTriggerOut = !initialed.current;
20
- // console.log({ needTriggerOut });
19
+ const needTriggerOut = !initialized.current;
21
20
  dispatch(initState(value, needTriggerOut));
22
- initialed.current = true;
21
+ initialized.current = true;
23
22
  }, [value]);
24
23
  useLayoutEffect(() => {
25
24
  if (!state.open) {
@@ -42,7 +42,7 @@ const styleContainAlpha = {
42
42
  };
43
43
  const CustomPicker = props => {
44
44
  // Props
45
- const { className, style, children, onChange, onChangeComplete, presetColors, ...restOf } = props;
45
+ const { className, style, children, isHideAlpha, onChange, onChangeComplete, presetColors, ...restOf } = props;
46
46
  // State
47
47
  const [isShowRgbaInput, setShowRgbaInput] = useState(true);
48
48
  const onChangeRgbaColor = (key, value) => {
@@ -68,7 +68,7 @@ const CustomPicker = props => {
68
68
  width: '100%',
69
69
  height: 12,
70
70
  marginTop: 10,
71
- }, children: _jsx(Alpha, { ...restOf, pointer: HuePointer, onChange: onChange }) })] })] }), _jsxs("div", { style: { ...wrapperStyling, paddingBottom: 15 }, children: [_jsx(Icon, { type: "icon-ants-unfold-more", style: { cursor: 'pointer', fontSize: '20px' }, onClick: () => setShowRgbaInput(!isShowRgbaInput) }), isShowRgbaInput ? (_jsxs("div", { style: rgbaInputStyling, children: [_jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.r, controls: false, onChange: value => onChangeRgbaColor('r', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "R" })] }), _jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.g, controls: false, onChange: value => onChangeRgbaColor('g', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "G" })] }), _jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.b, controls: false, onChange: value => onChangeRgbaColor('b', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "B" })] }), _jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.a, controls: false, onChange: value => onChangeRgbaColor('a', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "A" })] })] })) : (_jsxs(EditableInputWrapper, { children: [_jsx(EditableInput, { value: props.color, onChange: onChange }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "HEX" })] })), _jsx(Button, { onClick: () => {
71
+ }, children: _jsx(Alpha, { ...restOf, pointer: HuePointer, onChange: onChange }) })] })] }), _jsxs("div", { style: { ...wrapperStyling, paddingBottom: 15 }, children: [_jsx(Icon, { type: "icon-ants-unfold-more", style: { cursor: 'pointer', fontSize: '20px' }, onClick: () => setShowRgbaInput(!isShowRgbaInput) }), isShowRgbaInput ? (_jsxs("div", { style: rgbaInputStyling, children: [_jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.r, controls: false, onChange: value => onChangeRgbaColor('r', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "R" })] }), _jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.g, controls: false, onChange: value => onChangeRgbaColor('g', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "G" })] }), _jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.b, controls: false, onChange: value => onChangeRgbaColor('b', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "B" })] }), !isHideAlpha && (_jsxs("div", { style: rgbaStyling, children: [_jsx(InputNumberWrapper, { value: props.rgb?.a, controls: false, onChange: value => onChangeRgbaColor('a', value) }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "A" })] }))] })) : (_jsxs(EditableInputWrapper, { children: [_jsx(EditableInput, { value: props.color, onChange: onChange }), _jsx(Text, { style: { position: 'absolute', bottom: '-20px' }, children: "HEX" })] })), _jsx(Button, { onClick: () => {
72
72
  setShowRgbaInput(true);
73
73
  onChange('rgba(0, 0, 0, 0)');
74
74
  }, children: "Clear" })] }), presetColors ? (_jsxs("div", { children: [_jsx(Divider, {}), presetColors] })) : null] }));
@@ -3,6 +3,7 @@ export interface ColorPickerProps {
3
3
  className?: string;
4
4
  color?: string;
5
5
  presetColors?: any[] | ReactNode;
6
+ isHideAlpha?: boolean;
6
7
  defaultColor?: string;
7
8
  icon?: React.ReactNode | string;
8
9
  onChange?: (color: string) => void;
@@ -22,7 +22,7 @@ const styleBtnColor = {
22
22
  };
23
23
  export const ColorPicker = props => {
24
24
  // Props
25
- const { className = '', defaultColor = '#000000', presetColors, positionInput = 'left', icon, showInput = true, style = {}, } = props;
25
+ const { className = '', defaultColor = '#000000', presetColors, positionInput = 'left', icon, showInput = true, style = {}, isHideAlpha, } = props;
26
26
  const { onChange = () => { } } = props;
27
27
  // States
28
28
  const [color, setColor] = useState(defaultColor);
@@ -71,7 +71,7 @@ export const ColorPicker = props => {
71
71
  const onPopoverVisibleChange = visible => {
72
72
  setPopoverVisible(visible);
73
73
  };
74
- return (_jsxs(ColorPickerWrapper, { className: `antsomi-color-picker ${className || ''}`, style: style, children: [showInput && positionInput === 'left' && (_jsx(Input, { style: { textTransform: 'uppercase' }, value: color, onChange: onChangeColorInput })), _jsx(Popover, { arrow: true, content: _jsx(CustomPicker, { color: color, presetColors: presetColors, onChange: onChangeColorPicker, onChangeComplete: onChangeComplete }), trigger: "click", open: popoverVisible, getPopupContainer: triggerNode => triggerNode, onOpenChange: onPopoverVisibleChange, children: _jsx("div", { className: "antsomi-popover-button", style: styleBtnColor, children: iconNode || (_jsx("span", { style: {
74
+ return (_jsxs(ColorPickerWrapper, { className: `antsomi-color-picker ${className || ''}`, style: style, children: [showInput && positionInput === 'left' && (_jsx(Input, { style: { textTransform: 'uppercase' }, value: color, onChange: onChangeColorInput })), _jsx(Popover, { arrow: true, content: _jsx(CustomPicker, { color: color, presetColors: presetColors, isHideAlpha: isHideAlpha, onChange: onChangeColorPicker, onChangeComplete: onChangeComplete }), trigger: "click", open: popoverVisible, getPopupContainer: triggerNode => triggerNode, onOpenChange: onPopoverVisibleChange, children: _jsx("div", { className: "antsomi-popover-button", style: styleBtnColor, children: iconNode || (_jsx("span", { style: {
75
75
  backgroundColor: color,
76
76
  display: 'block',
77
77
  width: 20,
@@ -83,6 +83,7 @@ ColorPicker.defaultProps = {
83
83
  className: '',
84
84
  color: '#000000',
85
85
  defaultColor: '#000000',
86
+ isHideAlpha: false,
86
87
  onChange: () => { },
87
88
  showInput: true,
88
89
  positionInput: 'left',
@@ -16,7 +16,7 @@ import { safeParseJson } from '@antscorp/antsomi-ui/es/utils';
16
16
  import { POST_MESSAGE_TYPES } from '@antscorp/antsomi-ui/es/constants';
17
17
  export const DrawerDetail = props => {
18
18
  // Props
19
- const { width, fullScreen: fullScreenProp = false, children, menuProps, closeIconProps, maxWidth, minWidth, defaultSize = 'max', headerProps, name, destroyOnClose = true, onToggleCollapse, ...restProps } = props;
19
+ const { width, fullScreen: fullScreenProp = false, children, menuProps, closeIconProps, maxWidth, minWidth, defaultSize = 'max', headerProps, name, destroyOnClose = true, mask = false, onToggleCollapse, ...restProps } = props;
20
20
  const { show: showMenu = true, showExpandButton = true, showClose = true, items, selectedKeys, footer, onClick = () => { }, } = menuProps || {};
21
21
  const { children: headerChildren, ...restOfHeaderProps } = headerProps || {};
22
22
  const { onClose = () => { } } = props;
@@ -120,7 +120,7 @@ export const DrawerDetail = props => {
120
120
  motionAppear: false,
121
121
  motionEnter: false,
122
122
  motionLeave: false,
123
- }, classNames: {
123
+ }, mask: mask, classNames: {
124
124
  body: 'drawer-detail-body',
125
125
  }, contentWrapperStyle: {
126
126
  transition: 'none',
@@ -131,5 +131,5 @@ export const DrawerDetail = props => {
131
131
  onClose(e);
132
132
  }, children: _jsx(Icon, { type: "icon-ants-remove-slim", size: 14 }) })), showExpandButton && !fullScreen && (_jsx(ToggleDrawerSizeButton, { style: {
133
133
  ...(!showMenu && { background: '#ffffff' }),
134
- }, onClick: () => handleToggleDrawerSize(), collapse: collapseDrawer })), showMenu && (_jsxs(LeftMenu, { className: "animate__animated animate__fadeIn", children: [_jsxs("div", { children: [showClose && (_jsx(CloseBtn, { onClick: onClose, children: _jsx(Icon, { type: "icon-ants-remove-slim", size: 14 }) })), _jsx(Flex, { vertical: true, gap: 10, align: "center", justify: "center", children: items?.map((item) => (_jsx(Tooltip, { title: item?.label, mouseEnterDelay: 0.3, placement: "right", children: _jsx(MenuItem, { className: selectedKeys?.includes(item.key) ? 'active' : '', onClick: () => onClick && onClick(item), children: item.icon }, item?.key) }, item?.key))) })] }), _jsx(MenuFooter, { children: footer })] })), _jsxs(Content, { className: "drawer-detail-content", children: [headerProps?.children && (_jsx(DrawerHeader, { align: "center", ...restOfHeaderProps, children: headerChildren })), children] })] }));
134
+ }, onClick: () => handleToggleDrawerSize(), collapse: collapseDrawer })), showMenu && (_jsxs(LeftMenu, { "data-test": "left-menu", className: "animate__animated animate__fadeIn", children: [_jsxs("div", { children: [showClose && (_jsx(CloseBtn, { "data-test": "close-btn", onClick: onClose, children: _jsx(Icon, { type: "icon-ants-remove-slim", size: 14 }) })), _jsx(Flex, { vertical: true, gap: 10, align: "center", justify: "center", children: items?.map((item) => (_jsx(Tooltip, { title: item?.label, mouseEnterDelay: 0.3, placement: "right", children: _jsx(MenuItem, { className: selectedKeys?.includes(item.key) ? 'active' : '', onClick: () => onClick && onClick(item), children: item.icon }, item?.key) }, item?.key))) })] }), _jsx(MenuFooter, { children: footer })] })), _jsxs(Content, { className: "drawer-detail-content", children: [headerProps?.children && (_jsx(DrawerHeader, { align: "center", ...restOfHeaderProps, children: headerChildren })), children] })] }));
135
135
  };
@@ -52,7 +52,7 @@ export const EditableName = React.forwardRef((props, ref) => {
52
52
  inputRefElement?.input?.removeEventListener('wheel', preventWheel);
53
53
  };
54
54
  }, []);
55
- return (_jsxs(InputWrapperStyled, { className: className || '', style: style, ref: componentInViewRef, children: [_jsx(Tooltip, { title: value || internalValue, children: _jsx(Input, { readOnly: readonly, ref: inputRef, style: { width: inputWidth + 2 }, defaultValue: defaultValue.current, value: value, onChange: event => {
55
+ return (_jsxs(InputWrapperStyled, { "data-test": props['data-test'] || 'editable-name', className: className || '', style: style, ref: componentInViewRef, children: [_jsx(Tooltip, { title: value || internalValue, children: _jsx(Input, { readOnly: readonly, ref: inputRef, style: { width: inputWidth + 2 }, defaultValue: defaultValue.current, value: value, onChange: event => {
56
56
  const newValue = event.target.value;
57
57
  if (spanRef.current)
58
58
  spanRef.current.innerText = newValue;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
2
+ import React, { useMemo } from 'react';
3
3
  /* Components */
4
4
  import { Space } from '@antscorp/antsomi-ui/es/components/atoms/Space';
5
5
  import { Switch } from '@antscorp/antsomi-ui/es/components/atoms/Switch';
@@ -35,7 +35,7 @@ export const FontSettingEdit = ({ settings, styles, showSettings, onChange, }) =
35
35
  [settings]);
36
36
  const filteredSetting = useMemo(() => {
37
37
  if (!showSettings || showSettings?.length === 0) {
38
- return Object.keys(settingMap).map(keySetting => settingMap[keySetting]);
38
+ return Object.keys(settingMap).map(keySetting => (_jsx(React.Fragment, { children: settingMap[keySetting] }, keySetting)));
39
39
  }
40
40
  return showSettings.map(keySetting => settingMap[keySetting]);
41
41
  }, [showSettings, settingMap]);
@@ -54,7 +54,11 @@ export function MatchesAny(props) {
54
54
  threshold: 0,
55
55
  initialIsIntersecting: false,
56
56
  onChange(isIntersecting) {
57
- if (isIntersecting) {
57
+ // Only load more items if the search input is empty and not in external search mode.
58
+ // This prevents loading more items when the user is searching for something specific.
59
+ const isNoNeedToLoadMore = !!searchValue && !isExternalSearch;
60
+ if (isIntersecting && !isNoNeedToLoadMore) {
61
+ // Load more items when the user reaches the end of the list.
58
62
  onLoadMore();
59
63
  }
60
64
  },
@@ -379,5 +383,5 @@ export function MatchesAnySelect(props) {
379
383
  ...dropdownStyle,
380
384
  display: 'none',
381
385
  padding: 0,
382
- }, loading: loading, status: props.status || (error ? 'error' : undefined), ...restProps }), !!error && _jsx(Text, { className: 'ant-form-item-explain-error', type: 'danger', children: error })] }) }));
386
+ }, loading: loading, status: props.status || (error ? 'error' : undefined), ...restProps }), !!error && (_jsx(Text, { className: "ant-form-item-explain-error", type: "danger", children: error }))] }) }));
383
387
  }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface RequestAccessProps {
3
+ fullscreen?: boolean;
3
4
  className?: string;
4
5
  placeholder?: string;
5
6
  deniedTitle?: string;
@@ -1,15 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useState } from 'react';
3
3
  import { Button, Flex, TextArea, Typography } from '@antscorp/antsomi-ui/es/components';
4
+ import { translate as t, translations } from '@antscorp/antsomi-locales';
4
5
  // Styled
5
6
  import { RequestAccessStyled } from './styled';
6
- // Translate
7
- import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
8
- import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
9
7
  import { BlockIcon } from '../../icons';
10
- const { t } = i18nInstance;
11
8
  export const RequestAccess = props => {
12
- const { className, placeholder = t(translations.requestAccess.placeholder), deniedTitle = t(translations.requestAccess.deniedTitle), deniedSubTitle = t(translations.requestAccess.deniedSubTitle), sentTitle = t(translations.requestAccess.sentTitle), sentSubTitle = t(translations.requestAccess.sentSubTitle), requestText = t(translations.requestAccess.requestText), switchAccountText = t(translations.requestAccess.switchAccountText), onRequest, onSwitchAccount, } = props;
9
+ const { fullscreen, className, placeholder = t(translations.requestAccess.placeholder), deniedTitle = t(translations.requestAccess.deniedTitle), deniedSubTitle = t(translations.requestAccess.deniedSubTitle), sentTitle = t(translations.requestAccess.sentTitle), sentSubTitle = t(translations.requestAccess.sentSubTitle), requestText = t(translations.requestAccess.requestText), switchAccountText = t(translations.requestAccess.switchAccountText), onRequest, onSwitchAccount, } = props;
13
10
  const [isSentRequest, setIsSentRequest] = useState(false);
14
11
  const [isLoading, setIsLoading] = useState(false);
15
12
  const messageRef = useRef(null);
@@ -19,10 +16,8 @@ export const RequestAccess = props => {
19
16
  try {
20
17
  setIsLoading(true);
21
18
  onRequest(message)
22
- .then(data => {
23
- if (data) {
24
- setIsSentRequest(true);
25
- }
19
+ .then(() => {
20
+ setIsSentRequest(true);
26
21
  })
27
22
  .finally(() => setIsLoading(false));
28
23
  }
@@ -36,5 +31,5 @@ export const RequestAccess = props => {
36
31
  if (onSwitchAccount)
37
32
  onSwitchAccount();
38
33
  };
39
- return (_jsx(RequestAccessStyled, { className: `antsomi-request-access ${className || ''}`, children: _jsxs(Flex, { vertical: true, gap: 20, children: [_jsxs(Flex, { vertical: true, gap: 5, children: [_jsx(Typography.Text, { className: "denied-title", children: isSentRequest ? (sentTitle) : (_jsxs(_Fragment, { children: [deniedTitle, _jsx(BlockIcon, {})] })) }), _jsx(Typography.Text, { className: "denied-sub-title", children: isSentRequest ? sentSubTitle : deniedSubTitle })] }), !isSentRequest ? (_jsx(TextArea, { style: { resize: 'none' }, placeholder: placeholder, ref: messageRef })) : null, _jsxs(Flex, { className: "action-buttons", gap: 10, children: [isSentRequest ? null : (_jsx(Button, { onClick: handleClickRequest, type: "primary", loading: isLoading, children: requestText })), _jsx(Button, { onClick: handleSwitchAccount, children: switchAccountText })] })] }) }));
34
+ return (_jsx(RequestAccessStyled, { className: `antsomi-request-access ${className || ''}`, style: fullscreen ? { inset: 0, height: '100vh' } : {}, children: _jsxs(Flex, { vertical: true, gap: 20, children: [_jsxs(Flex, { vertical: true, gap: 5, children: [_jsx(Typography.Text, { className: "denied-title", children: isSentRequest ? (sentTitle) : (_jsxs(_Fragment, { children: [deniedTitle, _jsx(BlockIcon, {})] })) }), _jsx(Typography.Text, { className: "denied-sub-title", children: isSentRequest ? sentSubTitle : deniedSubTitle })] }), !isSentRequest ? (_jsx(TextArea, { style: { resize: 'none' }, placeholder: placeholder, ref: messageRef })) : null, _jsxs(Flex, { className: "action-buttons", gap: 10, children: [isSentRequest ? null : (_jsx(Button, { onClick: handleClickRequest, type: "primary", loading: isLoading, children: requestText })), _jsx(Button, { onClick: handleSwitchAccount, children: switchAccountText })] })] }) }));
40
35
  };
@@ -721,7 +721,7 @@ export const SAMPLE_RICHMENU = {
721
721
  displayDefault: true,
722
722
  },
723
723
  image: {
724
- imageUrl: 'https://sandbox-st-media-template.antsomi.com/upload/2024/01/04/8d8cf39a-748f-435c-b6c6-b71b5facc739.gif',
724
+ imageUrl: 'https://s.cystack.net/portal/organizations/487b0f9dd9d8543312dc25e32ac71e4f/logo.jpg',
725
725
  imageStyles: {
726
726
  borderTopLeftRadius: '0px',
727
727
  borderTopRightRadius: '0px',
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { SearchPopover } from '../../SearchPopover';
4
4
  import './styles.scss';
5
- import { Button, Checkbox } from '../../../../atoms';
5
+ import { Button, Checkbox, Typography } from '../../../../atoms';
6
6
  import { StyledAction, StyledFooter, StyledListFieldsWrapper } from './styled';
7
7
  import { EmptyData } from '../../../EmptyData';
8
8
  import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
@@ -103,7 +103,9 @@ export const PopoverSelect = (props) => {
103
103
  if (typeof option.label === 'function') {
104
104
  return option.label({ selected: selectedKeys.has(option.key) });
105
105
  }
106
- return option.label;
106
+ return (_jsx(Typography.Text, { ellipsis: {
107
+ tooltip: option.label,
108
+ }, style: { maxWidth: 310 }, children: option.label }));
107
109
  };
108
110
  const items = filteredOptions.map(opt => ({
109
111
  key: opt.key,
@@ -1,20 +1,28 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Libraries
3
- import { useContext } from 'react';
3
+ import { useContext, useState } from 'react';
4
4
  // Context
5
5
  import { SelectAccountContext } from './context';
6
6
  // Components
7
7
  import { ButtonViewAllStyled, ViewAllWrapper } from './styled';
8
- import { Popover } from '../../atoms';
8
+ import { Icon, Input, Popover } from '../../atoms';
9
9
  import AccountChip from './AccountChip';
10
+ import { searchStringQuery } from '@antscorp/antsomi-ui/es/utils';
10
11
  const ButtonViewAll = () => {
11
12
  const { state, dispatch } = useContext(SelectAccountContext);
12
- const { usersSelected, nameKey, userIdKey, users, styles } = state;
13
+ const { usersSelected, nameKey, userIdKey, users, styles, showSearchViewAll } = state;
14
+ const [search, setSearch] = useState('');
15
+ const searchedUsers = showSearchViewAll
16
+ ? usersSelected.filter(id => {
17
+ const user = users.find(u => u?.[userIdKey] === id);
18
+ return searchStringQuery(user?.[nameKey], search);
19
+ })
20
+ : usersSelected;
13
21
  const handleRemove = ({ userId, index }) => {
14
22
  dispatch({ type: 'REMOVE_USER', payload: { userId, index } });
15
23
  };
16
- const contentViewAll = () => (_jsxs(ViewAllWrapper, { children: [state.showOwnerDefault && _jsx(AccountChip, { label: "Owner", user: {}, value: "owner", disabled: true }), state.type === 'group'
17
- ? usersSelected?.map((id, index) => {
24
+ const contentViewAll = () => (_jsxs(ViewAllWrapper, { children: [showSearchViewAll && (_jsx(Input, { value: search, placeholder: "Search", suffix: _jsx(Icon, { type: "icon-ants-search-2" }), onAfterChange: value => setSearch(value), debounce: 500 })), state.showOwnerDefault && _jsx(AccountChip, { label: "Owner", user: {}, value: "owner", disabled: true }), state.type === 'group'
25
+ ? searchedUsers?.map((id, index) => {
18
26
  const group = state.listAccountGroup.find(u => u?.[state?.groupIdKey] === id);
19
27
  if (!group) {
20
28
  const user = users.find(u => u?.[userIdKey] === id);
@@ -24,7 +32,7 @@ const ButtonViewAll = () => {
24
32
  }
25
33
  return (_jsx(AccountChip, { user: group, value: group?.[state.groupIdKey], label: group?.[state?.groupNameKey], onRemove: () => handleRemove({ userId: group?.[state.groupIdKey], index }) }, group?.[state.groupIdKey]));
26
34
  })
27
- : usersSelected?.map((id, index) => {
35
+ : searchedUsers?.map((id, index) => {
28
36
  const user = users.find(u => u?.[userIdKey] === id);
29
37
  return (_jsx(AccountChip, { user: user, value: user?.[userIdKey], label: user?.[nameKey], onRemove: () => handleRemove({ userId: user?.[userIdKey], index }) }, user?.[userIdKey]));
30
38
  })] }));
@@ -10,10 +10,11 @@ import ButtonAdd from './ButtonAdd';
10
10
  import ButtonViewAll from './ButtonViewAll';
11
11
  export const Content = () => {
12
12
  const { state, dispatch } = useContext(SelectAccountContext);
13
- const { usersSelected, nameKey, userIdKey, users, disabled, className, styles } = state;
13
+ const { usersSelected, nameKey, userIdKey, users, disabled, className, styles, hideAddButton } = state;
14
14
  const handleRemove = ({ userId, index }) => {
15
15
  dispatch({ type: 'REMOVE_USER', payload: { userId, index } });
16
16
  };
17
+ const isHideAddButton = hideAddButton || state?.isViewMode || (state?.onlyOne && usersSelected?.length);
17
18
  return (_jsxs(Wrapper, { className: `select-account ${className}`, style: { ...(styles?.wrapper || {}) }, disabled: !!disabled, children: [state.showOwnerDefault && _jsx(AccountChip, { label: "Owner", user: {}, value: "owner", disabled: true }), state.type === 'group'
18
19
  ? usersSelected?.map((id, index) => {
19
20
  if (index >= state?.limitShow)
@@ -34,5 +35,5 @@ export const Content = () => {
34
35
  if (!user)
35
36
  return null;
36
37
  return (_jsx(AccountChip, { user: user, value: user?.[userIdKey], label: user?.[nameKey], onRemove: () => handleRemove({ userId: user?.[userIdKey], index }) }, user?.[userIdKey]));
37
- }), state?.usersSelected?.length > state?.limitShow && _jsx(ButtonViewAll, {}), !state?.isViewMode && (!state?.onlyOne || !usersSelected?.length) && _jsx(ButtonAdd, {})] }));
38
+ }), state?.usersSelected?.length > state?.limitShow && _jsx(ButtonViewAll, {}), isHideAddButton ? null : _jsx(ButtonAdd, {})] }));
38
39
  };
@@ -136,6 +136,10 @@ export const ViewAllWrapper = styled.div `
136
136
  flex-wrap: wrap;
137
137
  max-width: 300px;
138
138
  padding: 15px;
139
+
140
+ .input__wrapper {
141
+ width: 100%;
142
+ }
139
143
  `;
140
144
  export const ItemOnlyOne = styled.div `
141
145
  padding: 8px 10px;
@@ -31,6 +31,8 @@ export type SelectAccountProps = {
31
31
  disabledAccount?: any[];
32
32
  limit?: number;
33
33
  limitShow?: number;
34
+ hideAddButton?: boolean;
35
+ showSearchViewAll?: boolean;
34
36
  className?: string;
35
37
  styles?: {
36
38
  wrapper?: React.CSSProperties;