@antscorp/antsomi-ui 2.0.65 → 2.0.66

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.
@@ -3,7 +3,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { SearchPopover } from '../../SearchPopover';
4
4
  import './styles.scss';
5
5
  import { Button, Checkbox } from '../../../../atoms';
6
- import { StyledAction, StyledFooter, StyledListFieldsWrapper } from './styled';
6
+ import { StyledAction, StyledFooter, StyledInputValue, StyledInputValueWrapper, StyledListFieldsWrapper, } from './styled';
7
7
  import { EmptyData } from '../../../EmptyData';
8
8
  import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
9
9
  import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
@@ -12,7 +12,7 @@ import { VirtualizedMenu } from '../../../VirtualizedMenu';
12
12
  import { ITEM_SIZE, ITEM_SPACING } from '../../../VirtualizedMenu/config';
13
13
  const { t } = i18nInstance;
14
14
  export const PopoverSelect = (props) => {
15
- const { open: openProp, selected, options: optionsProp = [], inputSearchProps = {}, children, showAllLabel = 'Show all', showSelectedLabel = 'Show selected', selectAllLabel = 'Select all', deselectAllLabel = 'Unselect all', menuProps = {}, isAllowEmpty = false, onCancel, onApply, onSearchPredicate, ...rest } = props;
15
+ const { open: openProp, selected, options: optionsProp = [], inputSearchProps = {}, children, showAllLabel = 'Show all', showSelectedLabel = 'Show selected', selectAllLabel = 'Select all', deselectAllLabel = 'Unselect all', menuProps = {}, isAllowEmpty = false, inputValue = false, onCancel, onApply, onSearchPredicate, onClickInputValue, ...rest } = props;
16
16
  const itemSize = menuProps.itemSize || ITEM_SIZE;
17
17
  const itemSpacing = menuProps.itemSpacing || ITEM_SPACING;
18
18
  const { value: searchValue, searchConfig, ...restInputSearchProps } = inputSearchProps;
@@ -99,6 +99,12 @@ export const PopoverSelect = (props) => {
99
99
  const handleOpenChange = (visible) => {
100
100
  setOpen(visible);
101
101
  };
102
+ const handleInputValue = () => {
103
+ if (typeof onClickInputValue === 'function') {
104
+ onClickInputValue();
105
+ }
106
+ setOpen(false);
107
+ };
102
108
  const renderCheckBoxLabel = (option) => {
103
109
  if (typeof option.label === 'function') {
104
110
  return option.label({ selected: selectedKeys.has(option.key) });
@@ -113,7 +119,7 @@ export const PopoverSelect = (props) => {
113
119
  listLength: filteredOptions.length,
114
120
  itemSize,
115
121
  itemSpacing,
116
- }), children: _jsx(VirtualizedMenu, { ...menuProps, itemSize: itemSize, items: items }) })) : (_jsx(EmptyData, { showIcon: false, description: t(translations.noData).toString() })), _jsxs(StyledFooter, { children: [_jsx(Button, { onClick: handleCancel, children: "Cancel" }), _jsx(Button, { onClick: handleApply, disabled: applyDisabled, type: "primary", children: "Apply" })] })] }), trigger: ['click'], open: open, inputSearchProps: {
122
+ }), children: _jsx(VirtualizedMenu, { ...menuProps, itemSize: itemSize, items: items }) })) : (_jsx(EmptyData, { showIcon: false, description: t(translations.noData).toString() })), inputValue && (_jsx(StyledInputValueWrapper, { children: _jsx(StyledInputValue, { onClick: handleInputValue, children: "Input value" }) })), _jsxs(StyledFooter, { children: [_jsx(Button, { onClick: handleCancel, children: "Cancel" }), _jsx(Button, { onClick: handleApply, disabled: applyDisabled, type: "primary", children: "Apply" })] })] }), trigger: ['click'], open: open, inputSearchProps: {
117
123
  ...restInputSearchProps,
118
124
  value: search,
119
125
  onAfterChange: handleOnSearch,
@@ -1,3 +1,5 @@
1
+ export declare const StyledInputValueWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const StyledInputValue: import("styled-components").StyledComponent<"div", any, {}, never>;
1
3
  export declare const StyledFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
2
4
  export declare const StyledAction: import("styled-components").StyledComponent<"div", any, {}, never>;
3
5
  export declare const StyledListFieldsWrapper: import("styled-components").StyledComponent<"div", any, {
@@ -1,4 +1,21 @@
1
1
  import styled from 'styled-components';
2
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
3
+ export const StyledInputValueWrapper = styled.div `
4
+ border-top: 1px solid var(--divider-1);
5
+ padding: 8px 0px;
6
+ `;
7
+ export const StyledInputValue = styled.div `
8
+ height: 30px;
9
+ width: 100%;
10
+ display: flex;
11
+ align-items: center;
12
+ padding: 0 10px;
13
+ cursor: pointer;
14
+
15
+ &:hover {
16
+ background-color: ${THEME?.components?.Menu?.itemHoverBg};
17
+ }
18
+ `;
2
19
  export const StyledFooter = styled.div `
3
20
  gap: 10px;
4
21
  padding: 10px;
@@ -32,9 +32,11 @@ export type PopoverSelectProps<TOption extends Option = Option> = SearchPopoverP
32
32
  deselectAllLabel: string;
33
33
  selectAllLabel: string;
34
34
  menuProps: Pick<MenuInlineProps, 'onClick' | 'inlineIndent' | 'inlinePadding' | 'itemSpacing' | 'className' | 'itemSize'>;
35
+ inputValue?: boolean;
35
36
  onSearchPredicate: (option: Option) => boolean;
36
37
  onCancel: () => void;
37
38
  onApply: (selected: string[]) => void;
39
+ onClickInputValue?: () => void;
38
40
  }>;
39
41
  export type PopoverAddFieldProps = Omit<PopoverSelectProps, 'options'> & {
40
42
  fields: Field[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "2.0.65",
3
+ "version": "2.0.66",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",