@antscorp/antsomi-ui 2.0.0 → 2.0.2

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 (38) hide show
  1. package/es/components/atoms/Avatar/Avatar.d.ts +2 -0
  2. package/es/components/atoms/Avatar/Avatar.js +1 -0
  3. package/es/components/atoms/Avatar/index.d.ts +1 -0
  4. package/es/components/atoms/Avatar/index.js +1 -0
  5. package/es/components/atoms/index.d.ts +1 -0
  6. package/es/components/atoms/index.js +1 -0
  7. package/es/components/icons/LazyIcon/LazyIcon.d.ts +1 -0
  8. package/es/components/icons/LazyIcon/LazyIcon.js +1 -0
  9. package/es/components/icons/PhoneIphoneIcon.d.ts +3 -0
  10. package/es/components/icons/PhoneIphoneIcon.js +8 -0
  11. package/es/components/icons/index.d.ts +1 -0
  12. package/es/components/icons/index.js +1 -0
  13. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +4 -0
  14. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +11 -15
  15. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +1 -0
  16. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +1 -1
  17. package/es/components/molecules/SearchPopover/SearchPopover.js +3 -2
  18. package/es/components/molecules/SearchPopover/components/PopoverAddField/PopoverAddField.js +11 -4
  19. package/es/components/molecules/SearchPopover/components/PopoverSelect/PopoverSelect.js +13 -12
  20. package/es/components/molecules/SearchPopover/components/PopoverSelect/styled.d.ts +4 -0
  21. package/es/components/molecules/SearchPopover/components/PopoverSelect/styled.js +53 -0
  22. package/es/components/molecules/SearchPopover/components/PopoverSelect/styles.scss +0 -52
  23. package/es/components/molecules/SearchPopover/styled.d.ts +2 -0
  24. package/es/components/molecules/SearchPopover/styled.js +27 -0
  25. package/es/components/molecules/SearchPopover/styles.scss +0 -24
  26. package/es/components/molecules/SearchPopover/types.d.ts +3 -1
  27. package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +1 -1
  28. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +11 -2
  29. package/es/components/molecules/VirtualizedMenu/styled.js +11 -6
  30. package/es/components/organism/Login/Login.js +2 -2
  31. package/es/components/organism/Login/components/ForgotPassword/ForgotPassword.js +3 -3
  32. package/es/components/organism/Login/components/LoginSelectPortal/Item/styled.js +2 -2
  33. package/es/components/organism/Login/components/LoginSelectPortal/LoginSelectPortal.js +2 -1
  34. package/es/components/organism/Login/components/LoginStep2/LoginStep2.js +9 -8
  35. package/es/components/organism/Login/components/SetupGGAuthenticator/SetupGGAuthenticator.js +1 -1
  36. package/es/components/organism/Login/components/SignIn/SignIn.js +1 -1
  37. package/es/components/organism/Login/styled.js +31 -5
  38. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ export { Avatar } from 'antd';
2
+ export type { AvatarProps } from 'antd';
@@ -0,0 +1 @@
1
+ export { Avatar } from 'antd';
@@ -0,0 +1 @@
1
+ export * from './Avatar';
@@ -0,0 +1 @@
1
+ export * from './Avatar';
@@ -42,6 +42,7 @@ export * from './Button';
42
42
  export * from './RateV2';
43
43
  export * from './Popover';
44
44
  export * from './Iframe';
45
+ export * from './Avatar';
45
46
  export type { SliderProps } from './Slider';
46
47
  export type { PaginationProps } from './Pagination';
47
48
  export type { InputDynamicProps } from './InputDynamic';
@@ -42,3 +42,4 @@ export * from './Button';
42
42
  export * from './RateV2';
43
43
  export * from './Popover';
44
44
  export * from './Iframe';
45
+ export * from './Avatar';
@@ -238,6 +238,7 @@ export declare const LazyIcon: {
238
238
  PersonAddDisabledIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
239
239
  PersonUserAccountIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
240
240
  PhoneCallbackIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
241
+ PhoneIphoneIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
241
242
  PivotTableChartIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
242
243
  PlaneIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
243
244
  Plannings30Icon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
@@ -242,6 +242,7 @@ export const LazyIcon = {
242
242
  PersonAddDisabledIcon: lazy(() => import('../PersonAddDisabledIcon').then(m => ({ default: m.PersonAddDisabledIcon }))),
243
243
  PersonUserAccountIcon: lazy(() => import('../PersonUserAccountIcon').then(m => ({ default: m.PersonUserAccountIcon }))),
244
244
  PhoneCallbackIcon: lazy(() => import('../PhoneCallbackIcon').then(m => ({ default: m.PhoneCallbackIcon }))),
245
+ PhoneIphoneIcon: lazy(() => import('../PhoneIphoneIcon').then(m => ({ default: m.PhoneIphoneIcon }))),
245
246
  PivotTableChartIcon: lazy(() => import('../PivotTableChartIcon').then(m => ({ default: m.PivotTableChartIcon }))),
246
247
  PlaneIcon: lazy(() => import('../PlaneIcon').then(m => ({ default: m.PlaneIcon }))),
247
248
  Plannings30Icon: lazy(() => import('../Plannings30Icon').then(m => ({ default: m.Plannings30Icon }))),
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const PhoneIphoneIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,8 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useIcon } from './hooks/useIcon';
3
+ export const PhoneIphoneIcon = forwardRef((props, ref) => {
4
+ const { width, height } = useIcon(props);
5
+ return (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor" }, props, { ref: ref, width: width, height: height }),
6
+ React.createElement("path", { d: "M0 0h24v24H0V0z", fill: "none" }),
7
+ React.createElement("path", { d: "M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1zm-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4.5-4H7V4h9v14z" })));
8
+ });
@@ -234,6 +234,7 @@ export { PenDrawingIcon } from './PenDrawingIcon';
234
234
  export { PersonAddDisabledIcon } from './PersonAddDisabledIcon';
235
235
  export { PersonUserAccountIcon } from './PersonUserAccountIcon';
236
236
  export { PhoneCallbackIcon } from './PhoneCallbackIcon';
237
+ export { PhoneIphoneIcon } from './PhoneIphoneIcon';
237
238
  export { PivotTableChartIcon } from './PivotTableChartIcon';
238
239
  export { PlaneIcon } from './PlaneIcon';
239
240
  export { Plannings30Icon } from './Plannings30Icon';
@@ -234,6 +234,7 @@ export { PenDrawingIcon } from './PenDrawingIcon';
234
234
  export { PersonAddDisabledIcon } from './PersonAddDisabledIcon';
235
235
  export { PersonUserAccountIcon } from './PersonUserAccountIcon';
236
236
  export { PhoneCallbackIcon } from './PhoneCallbackIcon';
237
+ export { PhoneIphoneIcon } from './PhoneIphoneIcon';
237
238
  export { PivotTableChartIcon } from './PivotTableChartIcon';
238
239
  export { PlaneIcon } from './PlaneIcon';
239
240
  export { Plannings30Icon } from './Plannings30Icon';
@@ -22,6 +22,10 @@ export interface AdvancedPickerProps {
22
22
  showTime?: boolean;
23
23
  timezone?: string;
24
24
  isViewMode?: boolean;
25
+ /**
26
+ * Only show fixed calendar (hide dynamic and )
27
+ */
28
+ onlyShowFixed?: boolean;
25
29
  onUpdatedNewDate?: ({ date, option }: {
26
30
  date: string;
27
31
  option: TOption;
@@ -30,7 +30,7 @@ const { Text } = Typography;
30
30
  export const AdvancedPicker = props => {
31
31
  var _a, _b;
32
32
  // Props
33
- const { label, inputStyle, popupStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, timezone, isViewMode, onUpdatedNewDate, onApply, } = props;
33
+ const { label, inputStyle, popupStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, timezone, isViewMode, onlyShowFixed, onUpdatedNewDate, onApply, } = props;
34
34
  // Memo
35
35
  const newDateTypes = useMemo(() => {
36
36
  if (dateTypeKeysShow && dateTypeKeysShow.length) {
@@ -66,6 +66,7 @@ export const AdvancedPicker = props => {
66
66
  dateDisplay: dayjs().tz(timezone).format(format),
67
67
  });
68
68
  const { isOpen, option, date, dateDisplay } = state;
69
+ const isShowFixed = option.dateType.value === 'fixed' || onlyShowFixed;
69
70
  const currDate = dayjs(date, format);
70
71
  const currWeek = currDate.isoWeek();
71
72
  const currDay = currDate.day();
@@ -219,13 +220,9 @@ export const AdvancedPicker = props => {
219
220
  try {
220
221
  const draftOption = {
221
222
  dateType: option.dateType.value,
222
- calculationDate: option.dateType.value === 'fixed'
223
- ? ''
224
- : option.calculationDate.value,
225
- calculationType: option.dateType.value === 'fixed'
226
- ? ''
227
- : option.calculationType.value,
228
- value: option.dateType.value === 'fixed' ? 0 : option.value,
223
+ calculationDate: isShowFixed ? '' : option.calculationDate.value,
224
+ calculationType: isShowFixed ? '' : option.calculationType.value,
225
+ value: isShowFixed ? 0 : option.value,
229
226
  };
230
227
  setState(state => (Object.assign(Object.assign({}, state), { optionSelected: option, dateDisplay: date, isOpen: false })));
231
228
  if (typeof onApply === 'function') {
@@ -262,8 +259,8 @@ export const AdvancedPicker = props => {
262
259
  React.createElement(Space, null,
263
260
  React.createElement(Button, { type: "primary", onClick: () => onClickApply() }, "Apply"),
264
261
  React.createElement(Button, { type: "default", onClick: () => toggleOpenDropdown(false) }, "Cancel")),
265
- option.dateType.value === 'fixed' && React.createElement(Button, { onClick: () => onClickNow() }, "Now"))));
266
- const renderDateTypeOptions = () => (React.createElement(Select, { getPopupContainer: triggerNode => triggerNode.parentNode, options: newDateTypes, value: option.dateType.value, onChange: value => {
262
+ isShowFixed && React.createElement(Button, { onClick: () => onClickNow() }, "Now"))));
263
+ const renderDateTypeOptions = () => onlyShowFixed ? null : (React.createElement(Select, { getPopupContainer: triggerNode => triggerNode.parentNode, options: newDateTypes, value: option.dateType.value, onChange: value => {
267
264
  const dateType = newDateTypes.find(dateType => dateType.value === value);
268
265
  onChangeOption({ dateType });
269
266
  // toggleOpenDropdown(true);
@@ -312,7 +309,7 @@ export const AdvancedPicker = props => {
312
309
  React.createElement(DropdownLabel, { valueType: valueType, date: date, format: format, type: type, showTime: showTime, operatorKey: operatorKey, formatInputDisplay: formatInputDisplay })),
313
310
  React.createElement(DropdownContent, { className: "dropdown-content" },
314
311
  renderDateTypeOptions(),
315
- option.dateType.value === 'fixed' ? (React.createElement(React.Fragment, null,
312
+ isShowFixed ? (React.createElement(React.Fragment, null,
316
313
  valueType === 'MONTH_DAY' ? (React.createElement("div", { className: "month-controller" },
317
314
  React.createElement(Icon, { type: "icon-ants-angle-left", style: { fontSize: '14px', color: '#D2D2D2' }, onClick: () => setCurrMonthSelected(prev => (prev === 0 ? 11 : prev - 1)) }),
318
315
  MONTH_LABEL_FULL[currMonthSelected],
@@ -383,10 +380,9 @@ export const AdvancedPicker = props => {
383
380
  return (React.createElement(Space, { direction: "vertical", size: 5, className: "antsomi-advanced-picker-container", ref: ref },
384
381
  !!label && typeof label === 'string' ? (React.createElement(Text, { style: { color: '#666666' } }, label)) : (label),
385
382
  React.createElement("span", { className: "date-picker__title--view-mode" }, selectedDateTitle)));
386
- return (React.createElement(Space, { direction: "vertical", size: 5, className: "antsomi-advanced-picker-container", ref: ref },
383
+ return (React.createElement(Space, { direction: "vertical", size: 5, className: "antsomi-advanced-picker-container", ref: onlyShowFixed ? undefined : ref },
387
384
  !!label && typeof label === 'string' ? (React.createElement(Text, { style: { color: '#666666' } }, label)) : (label),
388
- option.dateType.value === 'fixed' &&
389
- !['WEEK', 'DAY_OF_WEEK', 'MONTH_DAY', 'DAY'].includes(valueType) ? (React.createElement(Tooltip, { title: selectedDateTitle },
385
+ isShowFixed && !['WEEK', 'DAY_OF_WEEK', 'MONTH_DAY', 'DAY'].includes(valueType) ? (React.createElement(Tooltip, { title: selectedDateTitle },
390
386
  React.createElement(DatePicker, { disabled: disabled, open: !disabled && isOpen, popupStyle: popupStyle, allowClear: false, inputReadOnly: true, style: Object.assign({ textOverflow: 'ellipsis' }, inputStyle), status: errorMessage ? 'error' : '', inputRender: () => (React.createElement(DatePickerCustomInput, { readOnly: true, placeholder: "Select Date", value: selectedDateTitle, onClick: () => toggleOpenDropdown() })), value: currDate,
391
387
  // style={{
392
388
  // width: 120,
@@ -408,7 +404,7 @@ export const AdvancedPicker = props => {
408
404
  React.createElement(ErrorMessage, { errorMessage: errorMessage })),
409
405
  renderDropdownFooter()),
410
406
  React.createElement(Divider, null),
411
- timeFormat && valueType !== 'HOUR' && valueType !== 'MINUTE' ? (React.createElement(TimeLabel, { "$width": timeFormat.length * 30, "$isRangePicker": operatorKey === 'between' },
407
+ timeFormat && valueType !== 'HOUR' && valueType !== 'MINUTE' ? (React.createElement(TimeLabel, { "$width": timeFormat.length * 30, "$isRangePicker": operatorKey === 'between', "$onlyShowFixed": onlyShowFixed },
412
408
  ['HH', 'HHmm', 'HHmmss'].includes(timeFormat) ? React.createElement("span", null, "Hours") : null,
413
409
  ['HHmm', 'HHmmss', 'mm'].includes(timeFormat) ? React.createElement("span", null, "Minutes") : null,
414
410
  timeFormat === 'HHmmss' ? React.createElement("span", null, "Seconds") : null)) : null));
@@ -10,4 +10,5 @@ export declare const CalendarIconWrapper: import("styled-components").StyledComp
10
10
  export declare const TimeLabel: import("styled-components").StyledComponent<"div", any, {
11
11
  $width: number;
12
12
  $isRangePicker: boolean;
13
+ $onlyShowFixed?: boolean | undefined;
13
14
  }, never>;
@@ -102,7 +102,7 @@ export const TimeLabel = styled.div `
102
102
  position: absolute;
103
103
  right: 0;
104
104
  /* top: 120px; */
105
- top: ${props => (props.$isRangePicker ? '140px' : '120px')};
105
+ top: ${({ $isRangePicker, $onlyShowFixed }) => $onlyShowFixed ? '81px' : $isRangePicker ? '140px' : '120px'};
106
106
  height: 39.1px;
107
107
  width: ${props => `${props.$width}px`};
108
108
  /* width: 180px; */
@@ -11,13 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from 'react';
13
13
  import { Popover } from 'antd';
14
- import { Input, Icon } from '../../atoms';
14
+ import { Icon } from '../../atoms';
15
15
  import './styles.scss';
16
16
  import clsx from 'clsx';
17
+ import { StyledInput } from './styled';
17
18
  export const SearchPopover = (props) => {
18
19
  const { inputSearchProps = {} } = props, popoverProps = __rest(props, ["inputSearchProps"]);
19
20
  const { overlayClassName, arrow = false, children, content, trigger = ['click'] } = popoverProps, restPopoverProps = __rest(popoverProps, ["overlayClassName", "arrow", "children", "content", "trigger"]);
20
21
  return (React.createElement(Popover, Object.assign({ trigger: trigger, arrow: arrow }, restPopoverProps, { overlayClassName: clsx('search-popover-overlay', overlayClassName), overlay: true, content: React.createElement(React.Fragment, null,
21
- React.createElement(Input, Object.assign({ placeholder: (inputSearchProps === null || inputSearchProps === void 0 ? void 0 : inputSearchProps.placeholder) || 'Search...', bordered: false }, inputSearchProps, { addonAfter: React.createElement(Icon, { type: "icon-ants-search-2" }), withWrapper: false })),
22
+ React.createElement(StyledInput, Object.assign({ placeholder: (inputSearchProps === null || inputSearchProps === void 0 ? void 0 : inputSearchProps.placeholder) || 'Search...', bordered: false }, inputSearchProps, { addonAfter: React.createElement(Icon, { type: "icon-ants-search-2" }), withWrapper: false })),
22
23
  content) }), children));
23
24
  };
@@ -9,16 +9,14 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import React, { useMemo } from 'react';
12
+ import React, { useCallback, useMemo } from 'react';
13
13
  import clsx from 'clsx';
14
14
  import { renderIconField } from '../../utils';
15
15
  import { PopoverSelect } from '../PopoverSelect';
16
+ import { Typography } from 'antd';
16
17
  export const PopoverAddField = (props) => {
17
18
  const { fields, onSearchPredicate, className } = props, rest = __rest(props, ["fields", "onSearchPredicate", "className"]);
18
19
  const originalFieldByKey = useMemo(() => new Map(fields.map(field => [field.key, field])), [fields]);
19
- const options = useMemo(() => fields.map(field => (Object.assign(Object.assign({}, field), { label: (React.createElement(React.Fragment, null,
20
- field.dataType && renderIconField(field.dataType),
21
- field.label)) }))), [fields]);
22
20
  const handleOnSearchPredicate = (field) => {
23
21
  const originalField = originalFieldByKey.get(field.key);
24
22
  if (!originalField)
@@ -28,5 +26,14 @@ export const PopoverAddField = (props) => {
28
26
  }
29
27
  return true;
30
28
  };
29
+ const options = useCallback((params) => fields.map(field => (Object.assign(Object.assign({}, field), { label: (React.createElement(React.Fragment, null,
30
+ field.dataType && renderIconField(field.dataType),
31
+ typeof field.label === 'string' && (React.createElement(Typography.Text, { ellipsis: {
32
+ tooltip: true,
33
+ } }, field.label)),
34
+ typeof field.label === 'function' &&
35
+ field.label({
36
+ selected: params.selected.includes(field.key),
37
+ }))) }))), [fields]);
31
38
  return (React.createElement(PopoverSelect, Object.assign({}, rest, { options: options, onSearchPredicate: handleOnSearchPredicate, className: clsx(className, 'ants-popover-add-fields') })));
32
39
  };
@@ -12,14 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React, { useEffect, useMemo, useRef, useState } from 'react';
13
13
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
14
14
  import { SearchPopover } from '../../SearchPopover';
15
- import { Button, Checkbox, Menu } from 'antd';
16
15
  import './styles.scss';
17
16
  import { searchStringQuery } from '@antscorp/antsomi-ui/es/utils';
18
- import { Icon } from '../../../../atoms';
19
- import Scrollbars from 'react-custom-scrollbars';
17
+ import { Button, Checkbox, Icon } from '../../../../atoms';
18
+ import { StyledAction, StyledFooter, StyledListFieldsWrapper } from './styled';
19
+ import { List } from 'antd';
20
20
  export const PopoverSelect = (props) => {
21
21
  var _a, _b;
22
- const { open: openProp, selected, options = [], onCancel, onApply, inputSearchProps = {}, children, showAllLabel = 'Show all', showSelectedLabel = 'Show selected', selectAllLabel = 'Select all', deselectAllLabel = 'Unselect all', onSearchPredicate } = props, rest = __rest(props, ["open", "selected", "options", "onCancel", "onApply", "inputSearchProps", "children", "showAllLabel", "showSelectedLabel", "selectAllLabel", "deselectAllLabel", "onSearchPredicate"]);
22
+ const { open: openProp, selected, options: optionsProp = [], onCancel, onApply, inputSearchProps = {}, children, showAllLabel = 'Show all', showSelectedLabel = 'Show selected', selectAllLabel = 'Select all', deselectAllLabel = 'Unselect all', onSearchPredicate } = props, rest = __rest(props, ["open", "selected", "options", "onCancel", "onApply", "inputSearchProps", "children", "showAllLabel", "showSelectedLabel", "selectAllLabel", "deselectAllLabel", "onSearchPredicate"]);
23
23
  const { value: searchValue } = inputSearchProps, restInputSearchProps = __rest(inputSearchProps, ["value"]);
24
24
  const refOnSearchPredicate = useRef(onSearchPredicate);
25
25
  useEffect(() => {
@@ -30,6 +30,9 @@ export const PopoverSelect = (props) => {
30
30
  const [search, setSearch] = useState('');
31
31
  const [showSelected, setShowSelected] = useState(false);
32
32
  const applyDisabled = selectedKeys.size === 0;
33
+ const options = useMemo(() => typeof optionsProp === 'function'
34
+ ? optionsProp({ selected: [...selectedKeys] })
35
+ : optionsProp, [optionsProp, selectedKeys]);
33
36
  useEffect(() => {
34
37
  if (openProp !== undefined) {
35
38
  setOpen(openProp);
@@ -114,15 +117,13 @@ export const PopoverSelect = (props) => {
114
117
  return option.label;
115
118
  };
116
119
  return (React.createElement(SearchPopover, Object.assign({}, rest, { content: React.createElement(React.Fragment, null,
117
- !!options.length && (React.createElement("div", { className: "actions" },
120
+ !!optionsProp.length && (React.createElement(StyledAction, null,
118
121
  React.createElement(Button, { type: "link", size: "small", onClick: () => setShowSelected(current => !current) }, showSelected ? showAllLabel : showSelectedLabel),
119
- selectedKeys.size === options.length ? (React.createElement(Button, { type: "link", onClick: handleDeselectAll }, deselectAllLabel)) : (React.createElement(Button, { type: "link", onClick: handleSelectAll }, selectAllLabel)))),
120
- !!filteredField.length && (React.createElement(Scrollbars, { autoHeight: true, autoHeightMax: 260 },
121
- React.createElement(Menu, { className: "list-fields", selectable: false, items: filteredField.map(option => ({
122
- key: option.key,
123
- label: (React.createElement(Checkbox, { onChange: e => handleToggleField(option, e.target.checked), checked: selectedKeys.has(option.key) }, renderCheckBoxLabel(option))),
124
- })) }))),
125
- React.createElement("div", { className: "footer" },
122
+ selectedKeys.size === optionsProp.length ? (React.createElement(Button, { type: "link", onClick: handleDeselectAll }, deselectAllLabel)) : (React.createElement(Button, { type: "link", onClick: handleSelectAll }, selectAllLabel)))),
123
+ !!filteredField.length && (React.createElement(StyledListFieldsWrapper, { autoHeight: true, autoHeightMax: 260 },
124
+ React.createElement(List, { bordered: false, dataSource: filteredField, renderItem: option => (React.createElement(List.Item, null,
125
+ React.createElement(Checkbox, { onChange: e => handleToggleField(option, e.target.checked), checked: selectedKeys.has(option.key) }, renderCheckBoxLabel(option)))) }))),
126
+ React.createElement(StyledFooter, null,
126
127
  React.createElement(Button, { onClick: handleCancel }, "Cancel"),
127
128
  React.createElement(Button, { onClick: handleApply, disabled: applyDisabled, type: "primary" }, "Apply"))), overlayInnerStyle: {
128
129
  '--item-padding': `${((_b = (_a = THEME.components) === null || _a === void 0 ? void 0 : _a.Menu) === null || _b === void 0 ? void 0 : _b.itemPaddingInline) || 10}px`,
@@ -0,0 +1,4 @@
1
+ import Scrollbars from 'react-custom-scrollbars';
2
+ export declare const StyledFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const StyledAction: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const StyledListFieldsWrapper: import("styled-components").StyledComponent<typeof Scrollbars, any, {}, never>;
@@ -0,0 +1,53 @@
1
+ var _a, _b;
2
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
3
+ import Scrollbars from 'react-custom-scrollbars';
4
+ import styled from 'styled-components';
5
+ export const StyledFooter = styled.div `
6
+ gap: 10px;
7
+ padding: 10px;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: flex-end;
11
+ `;
12
+ export const StyledAction = styled.div `
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: space-between;
16
+ gap: 10px;
17
+ padding: 5px 0px;
18
+
19
+ > button {
20
+ height: 30px;
21
+ padding: 0 10px;
22
+ }
23
+ `;
24
+ export const StyledListFieldsWrapper = styled(Scrollbars) `
25
+ .antsomi-list-items {
26
+ border-bottom: 1px solid var(--divider-1);
27
+
28
+ > .antsomi-list-item {
29
+ padding: 0;
30
+ border-bottom: 0;
31
+ height: ${((_b = (_a = THEME.components) === null || _a === void 0 ? void 0 : _a.Menu) === null || _b === void 0 ? void 0 : _b.itemHeight) || 35}px;
32
+
33
+ > .antsomi-checkbox-wrapper {
34
+ padding: 0 var(--item-padding);
35
+ display: flex;
36
+ align-items: center;
37
+ width: 100%;
38
+ height: 100%;
39
+
40
+ span:nth-child(2) {
41
+ > i {
42
+ min-width: 20px;
43
+ text-align: center;
44
+ }
45
+
46
+ display: flex;
47
+ align-items: center;
48
+ gap: 6px;
49
+ }
50
+ }
51
+ }
52
+ }
53
+ `;
@@ -2,58 +2,6 @@
2
2
  &.antsomi-popover {
3
3
  .antsomi-popover-inner {
4
4
  min-width: 300px;
5
-
6
- .antsomi-popover-inner-content {
7
- .antsomi-menu.list-fields {
8
- border-bottom: 1px solid var(--divider-1);
9
-
10
- > .antsomi-menu-item {
11
- padding: 0;
12
-
13
- > .antsomi-menu-title-content {
14
- > .antsomi-checkbox-wrapper {
15
- padding: 0 var(--item-padding);
16
- display: flex;
17
- align-items: center;
18
- width: 100%;
19
- height: 100%;
20
-
21
- span:nth-child(2) {
22
- > i {
23
- min-width: 20px;
24
- text-align: center;
25
- }
26
-
27
- display: flex;
28
- align-items: center;
29
- gap: 6px;
30
- }
31
- }
32
- }
33
- }
34
- }
35
-
36
- > .actions {
37
- display: flex;
38
- align-items: center;
39
- justify-content: space-between;
40
- gap: 10px;
41
- padding: 5px 0px;
42
-
43
- > button {
44
- height: 30px;
45
- padding: 0 10px;
46
- }
47
- }
48
-
49
- > .footer {
50
- gap: 10px;
51
- padding: 10px;
52
- display: flex;
53
- align-items: center;
54
- justify-content: flex-end;
55
- }
56
- }
57
5
  }
58
6
  }
59
7
  }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledInput: import("styled-components").StyledComponent<import("react").ComponentType<any> | keyof import("react").JSX.IntrinsicElements, any, any, any>;
@@ -0,0 +1,27 @@
1
+ import styled from 'styled-components';
2
+ import { Input } from '../../atoms';
3
+ export const StyledInput = styled(Input) `
4
+ &.antsomi-input-group-wrapper {
5
+ padding: 8px 10px;
6
+ border-bottom: 1px solid var(--divider-1);
7
+
8
+ .antsomi-input {
9
+ padding-left: 0;
10
+ padding-right: 0;
11
+ }
12
+
13
+ .antsomi-input-group-addon {
14
+ border: none;
15
+ background: transparent;
16
+ font-size: 20px;
17
+ padding: 0;
18
+ min-width: 25px;
19
+
20
+ > i {
21
+ font-size: 24px;
22
+ color: #595959;
23
+ cursor: pointer;
24
+ }
25
+ }
26
+ }
27
+ `;
@@ -2,30 +2,6 @@
2
2
  &.antsomi-popover {
3
3
  .antsomi-popover-inner {
4
4
  padding: 0;
5
-
6
- .antsomi-input-group-wrapper {
7
- padding: 8px 10px;
8
- border-bottom: 1px solid var(--divider-1);
9
-
10
- .antsomi-input {
11
- padding-left: 0;
12
- padding-right: 0;
13
- }
14
-
15
- .antsomi-input-group-addon {
16
- border: none;
17
- background: transparent;
18
- font-size: 20px;
19
- padding: 0;
20
- min-width: 25px;
21
-
22
- > i {
23
- font-size: 24px;
24
- color: #595959;
25
- cursor: pointer;
26
- }
27
- }
28
- }
29
5
  }
30
6
  }
31
7
  }
@@ -14,7 +14,9 @@ export type Field = Option & {
14
14
  dataType?: string | number;
15
15
  };
16
16
  export type PopoverSelectProps<TOption extends Option = Option> = SearchPopoverProps & Partial<{
17
- options: TOption[];
17
+ options: TOption[] | ((info: {
18
+ selected: string[];
19
+ }) => TOption[]);
18
20
  selected: string[];
19
21
  onCancel: () => void;
20
22
  onApply: (selected: string[]) => void;
@@ -21,5 +21,5 @@ export const Item = memo((props) => {
21
21
  'item-disabled': item === null || item === void 0 ? void 0 : item.disabled,
22
22
  }, className), style: style, onClick: handleOnClick },
23
23
  React.createElement("div", { className: "item-label" }, renderLabel()),
24
- !!((_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length) && (React.createElement("div", { className: "sub-menu-arrow" }, expandIcon || React.createElement(Icon, { type: "icon-ants-expand-more" })))));
24
+ !!((_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length) && (React.createElement("div", { className: "item-actions" }, expandIcon || React.createElement(Icon, { type: "icon-ants-expand-more" })))));
25
25
  });
@@ -96,8 +96,17 @@ export const MenuInline = (props) => {
96
96
  const itemStyle = Object.assign(Object.assign({}, style), { paddingLeft: indentSize + inlinePadding, paddingRight: inlinePadding, top: Number(style.top) + itemSpacing, height: Number(style.height) - itemSpacing });
97
97
  return (React.createElement(Item, { className: clsx({
98
98
  'item-selected': selectedKeys.has(item.key),
99
+ 'item-expanded': openKeys.has(item.key),
99
100
  }, item.className), onClick: handleClickItem(item, index), style: itemStyle, item: item }));
100
- }, [flattenItems, handleClickItem, inlinePadding, inlineIndent, itemSpacing, selectedKeys]);
101
+ }, [
102
+ flattenItems,
103
+ handleClickItem,
104
+ inlinePadding,
105
+ inlineIndent,
106
+ itemSpacing,
107
+ selectedKeys,
108
+ openKeys,
109
+ ]);
101
110
  // console.log('render');
102
- return (React.createElement(AutoSizer, null, autoSize => (React.createElement(VirtualizedMenuContainer, { className: clsx(`menu-${MODE.Inline}`, className), itemSize: () => itemSize + itemSpacing, itemCount: flattenItems.length, height: autoSize.scaledHeight, width: autoSize.scaledWidth, innerElementType: innerElementType, useIsScrolling: true }, renderItem))));
111
+ return (React.createElement(AutoSizer, null, autoSize => (React.createElement(VirtualizedMenuContainer, { className: clsx(`menu-${MODE.Inline}`, className), itemSize: () => itemSize + itemSpacing, itemCount: flattenItems.length, height: autoSize.height, width: autoSize.width, innerElementType: innerElementType, useIsScrolling: true }, renderItem))));
103
112
  };
@@ -35,7 +35,7 @@ export const MenuItemRoot = styled.div `
35
35
  overflow: hidden;
36
36
  }
37
37
 
38
- > .sub-menu-arrow {
38
+ > .item-actions {
39
39
  display: flex;
40
40
  align-items: center;
41
41
  justify-content: center;
@@ -50,15 +50,20 @@ export const MenuItemRoot = styled.div `
50
50
  background-color: ${(_f = (_e = THEME.components) === null || _e === void 0 ? void 0 : _e.Menu) === null || _f === void 0 ? void 0 : _f.itemActiveBg};
51
51
  }
52
52
 
53
+ &.item-expanded {
54
+ > .item-actions {
55
+ > i[type='icon-ants-expand-more'] {
56
+ rotate: 180deg;
57
+ transition: rotate 2s;
58
+ }
59
+ }
60
+ }
61
+
53
62
  &:hover:not(.item-disabled, .item-selected) {
54
63
  background-color: ${(_h = (_g = THEME.components) === null || _g === void 0 ? void 0 : _g.Menu) === null || _h === void 0 ? void 0 : _h.itemHoverBg};
55
64
  }
56
65
  `;
57
66
  export const VirtualizedMenuContainer = styled(VariableSizeList) `
58
67
  font-size: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.fontSize}px;
59
- overflow: hidden !important;
60
-
61
- &:hover {
62
- overflow: auto !important;
63
- }
68
+ scrollbar-gutter: stable;
64
69
  `;
@@ -694,7 +694,7 @@ export const Login = props => {
694
694
  }
695
695
  };
696
696
  return (React.createElement(CookiesProvider, null,
697
- React.createElement(LoginMain, { justify: isMobile ? 'center' : 'start' },
698
- React.createElement(WrapperLogin, { isMobile: isMobile, vertical: true, align: "center", gap: 40, flex: 1, ref: loginRef }, renderMain()),
697
+ React.createElement(LoginMain, { justify: isMobile ? 'center' : 'start', id: "login_container" },
698
+ React.createElement(WrapperLogin, { isMobile: isMobile, vertical: true, align: "center", gap: 40, flex: 1, ref: loginRef, id: "login_main" }, renderMain()),
699
699
  !isMobile && React.createElement(LoginBannerZone, { className: "login-banner-zone", id: "login_banner_zone" }))));
700
700
  };
@@ -177,16 +177,16 @@ const ForgotPassword = props => {
177
177
  });
178
178
  errorRef.current.email = false;
179
179
  setLoginError('');
180
- } }),
180
+ }, status: errorRef.current.email && state.errors.email ? 'error' : undefined }),
181
181
  errorRef.current.email && state.errors.email ? (React.createElement(Text, { type: "danger", style: { marginTop: 5 } }, state.errors.email)) : null,
182
182
  state.loginError && (React.createElement(Text, { type: "danger", style: { marginTop: 5 } }, state.loginError))),
183
- React.createElement(Flex, { vertical: true, gap: 15 },
183
+ React.createElement(Flex, { vertical: true, gap: 5 },
184
184
  React.createElement(Flex, { justify: "center", style: {
185
185
  transform: isMobile ? 'scale(1)' : `scale(${scaleCaptcha})`,
186
186
  transformOrigin: !isMobile ? '' : '0 0',
187
187
  } },
188
188
  React.createElement(ReCAPTCHA, { sitekey: reCaptchaKey, onChange: onCaptchaChange, onExpired: onExpiredCaptcha, size: "normal" })),
189
- state.errors.captcha && (React.createElement(Text, { type: "danger", style: { marginTop: 10 } }, "Please verify you are human"))),
189
+ state.errors.captcha && React.createElement(Text, { type: "danger" }, "Please verify you are human")),
190
190
  React.createElement(Flex, { vertical: true, gap: isMobile ? 30 : 15, style: { paddingBottom: 40 } },
191
191
  React.createElement(StyleButton, { isMobile: isMobile, onClick: signIn, type: "primary" }, "Continue"),
192
192
  React.createElement(StyleButton, { isMobile: isMobile, type: "text", onClick: handleBack }, "Back to login"))))), isShowLogo: false, footer: null }));
@@ -19,8 +19,8 @@ export const WrapperItem = styled.div `
19
19
  object-fit: contain;
20
20
  }
21
21
 
22
- :hover {
23
- background-color: #f2f9ff;
22
+ &:hover {
23
+ background-color: #f2f9ff !important;
24
24
  }
25
25
 
26
26
  .antsomi-typography {
@@ -178,8 +178,9 @@ export const LoginSelectPortal = props => {
178
178
  color: '#595959',
179
179
  fontSize: 11,
180
180
  } }, "No portal matches your keyword"))) : (React.createElement(Scrollbars, { style: {
181
- height: 514,
181
+ height: `calc(100vh - 410px)`,
182
182
  width: '100%',
183
+ minHeight: `145px`,
183
184
  } },
184
185
  React.createElement(WrapperList, null,
185
186
  React.createElement(Row, { gutter: [20, 20] }, filterListNetworks.map((network) => (React.createElement(Col, { span: 12 },
@@ -125,14 +125,15 @@ export const LoginStep2 = props => {
125
125
  React.createElement(Text, { isMobile: isMobile },
126
126
  "Open Google Authenticator and enter the code from ",
127
127
  React.createElement("b", null, "antsomi.com"))) })),
128
- React.createElement(Flex, { vertical: true, gap: isMobile ? 20 : 5 },
129
- React.createElement(StyleInput, { isMobile: isMobile, maxLength: 6, placeholder: "Input your code", value: state.code, onChange: e => {
130
- setState(draft => {
131
- draft.code = e.target.value;
132
- });
133
- errorRef.current = true;
134
- } }),
135
- errorRef.current && state.codeError ? (React.createElement(TextAntsomiUI, { type: "danger" }, "Invalid code, please try again")) : null,
128
+ React.createElement(Flex, { vertical: true, gap: isMobile ? 20 : 11 },
129
+ React.createElement(Flex, { vertical: true, gap: 10 },
130
+ React.createElement(StyleInput, { isMobile: isMobile, maxLength: 6, placeholder: "Input your code", value: state.code, onChange: e => {
131
+ setState(draft => {
132
+ draft.code = e.target.value;
133
+ });
134
+ errorRef.current = true;
135
+ }, status: errorRef.current && state.codeError ? 'error' : undefined }),
136
+ errorRef.current && state.codeError ? (React.createElement(TextAntsomiUI, { type: "danger" }, "Invalid code, please try again")) : null),
136
137
  React.createElement(Checkbox, { checked: state.isTrust, onChange: e => {
137
138
  setState(draft => {
138
139
  draft.isTrust = e.target.checked;
@@ -114,7 +114,7 @@ const SetupGGAuthenticator = props => {
114
114
  if (e.target.value.trim().length) {
115
115
  setCodeError(false);
116
116
  }
117
- } }),
117
+ }, status: errorRef.current && codeError ? 'error' : '' }),
118
118
  errorRef.current && codeError ? (React.createElement(TextAntsomiUI, { type: "danger" }, "Invalid code, please try again")) : null)), footer: React.createElement(Flex, { vertical: true, gap: 92 },
119
119
  React.createElement(Flex, { vertical: true, gap: isMobile ? 30 : 15 },
120
120
  React.createElement(StyleButton, { isMobile: isMobile, loading: isLoading, type: "primary", onClick: updateG2FA }, "Complete"),
@@ -86,7 +86,7 @@ export const SignIn = props => {
86
86
  } })) : (React.createElement(Icon, { type: "icon-ants-invisible", style: {
87
87
  color: '#595959',
88
88
  } })) })),
89
- loginError && React.createElement("span", { style: { color: 'red' } }, "Email or password is invalid"),
89
+ loginError && (React.createElement("span", { style: { color: 'red', fontSize: 11 } }, "Email or password is invalid")),
90
90
  React.createElement(Flex, { style: { width: '100%', marginTop: '40px' }, vertical: true, className: "" },
91
91
  React.createElement(Form.Item, null,
92
92
  React.createElement(StyleButton, { isMobile: isMobile, type: "primary", htmlType: "submit", style: { width: '100%', marginBottom: isMobile ? 15 : 0 }, loading: isLoading }, "Sign in")),
@@ -2,21 +2,31 @@ import { Button, Flex, Form, Input } from 'antd';
2
2
  import styled from 'styled-components';
3
3
  export const LoginMain = styled(Flex) `
4
4
  background: #eaf1fb;
5
+
5
6
  height: 100vh;
7
+ max-height: 100vh;
8
+
6
9
  width: 100%;
10
+
11
+ overflow: hidden;
7
12
  `;
8
13
  export const LoginBannerZone = styled.div `
9
14
  display: flex;
10
15
  flex: 2;
16
+ z-index: 1;
17
+
18
+ min-width: calc(100vw - 404px);
19
+ max-width: calc(100vw - 300px);
11
20
  `;
12
21
  export const WrapperLogin = styled(Flex) `
13
22
  height: 100%;
14
23
  overflow-y: auto;
15
24
  background-color: white;
25
+ z-index: 5;
16
26
 
17
27
  width: ${props => (props.isMobile ? '100%' : '')};
18
28
  min-width: ${props => (props.isMobile ? '100%' : '300px')};
19
- max-width: ${props => (props.isMobile ? '100%' : '400px')};
29
+ max-width: ${props => (props.isMobile ? '100%' : '404px')};
20
30
 
21
31
  ${(props) => !props.isMobile ? 'box-shadow: 3px 0px 9px 0px #002e5926' : ''}
22
32
  `;
@@ -63,8 +73,12 @@ export const AvatarImage = styled.img `
63
73
  `;
64
74
  export const StyledForm = styled(Form) `
65
75
  input {
66
- height: ${(props) => (props.isMobile ? ' 44px' : '30px')};
67
- font-size: ${(props) => (props.isMobile ? ' 16px !important' : '12px')};
76
+ height: ${(props) => (props.isMobile ? ' 44px' : '36px')};
77
+ font-size: ${(props) => props.isMobile ? ' 16px !important' : '14px !important'};
78
+
79
+ &::placeholder {
80
+ font-size: ${(props) => props.isMobile ? ' 16px !important' : '14px !important'};
81
+ }
68
82
  }
69
83
 
70
84
  input:-webkit-autofill,
@@ -76,12 +90,20 @@ export const StyledForm = styled(Form) `
76
90
  }
77
91
 
78
92
  .antsomi-input-password-icon {
79
- font-size: ${(props) => (props.isMobile ? ' 24px' : '15px')};
93
+ font-size: ${(props) => (props.isMobile ? ' 24px' : '14px')};
94
+
95
+ &:hover {
96
+ cursor: pointer;
97
+ }
80
98
  }
81
99
 
82
100
  .antsomi-input-affix-wrapper {
83
101
  padding: 0 10px !important;
84
- font-size: ${(props) => (props.isMobile ? ' 16px !important' : '12px')};
102
+ font-size: ${(props) => props.isMobile ? ' 16px !important' : '14px !important'};
103
+
104
+ &::placeholder {
105
+ font-size: ${(props) => props.isMobile ? ' 16px !important' : '14px !important'};
106
+ }
85
107
  }
86
108
 
87
109
  .antsomi-form-item-explain-error {
@@ -91,6 +113,10 @@ export const StyledForm = styled(Form) `
91
113
  export const StyleInput = styled(Input) `
92
114
  height: ${(props) => props.isMobile ? ' 44px !important' : '36px !important'};
93
115
  font-size: ${(props) => props.isMobile ? ' 16px !important' : '14px !important'};
116
+
117
+ &::placeholder {
118
+ font-size: ${(props) => props.isMobile ? ' 16px !important' : '14px !important'};
119
+ }
94
120
  `;
95
121
  export const StyleButton = styled(Button) `
96
122
  height: ${(props) => props.isMobile ? ' 44px !important' : '40px !important'};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",