fis-component 0.1.1 → 0.1.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.
- package/dist/cjs/index.js +107 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Breadcrumb/styles.d.ts +1 -0
- package/dist/cjs/types/src/components/Select/Select.stories.d.ts +4 -0
- package/dist/cjs/types/src/components/Select/types.d.ts +6 -0
- package/dist/cjs/types/src/components/SelectItem/styles.d.ts +1 -0
- package/dist/esm/index.js +107 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Breadcrumb/styles.d.ts +1 -0
- package/dist/esm/types/src/components/Select/Select.stories.d.ts +4 -0
- package/dist/esm/types/src/components/Select/types.d.ts +6 -0
- package/dist/esm/types/src/components/SelectItem/styles.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -5,3 +5,4 @@ export declare const ButtonItemSC: import("styled-components/dist/types").IStyle
|
|
|
5
5
|
$active?: boolean;
|
|
6
6
|
}>> & string;
|
|
7
7
|
export declare const DivIconDotSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
export declare const DivSeparatorIconSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -16,3 +16,7 @@ export declare const NumberType: import("@storybook/core/csf").AnnotatedStoryFn<
|
|
|
16
16
|
export declare const CustomMaxHeight: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
17
17
|
export declare const TextEllipsis: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
18
18
|
export declare const PlaceholderDemo: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
19
|
+
export declare const SimpleTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
20
|
+
export declare const CustomTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
21
|
+
export declare const SecondaryTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
22
|
+
export declare const MultiSelectWithTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, MultiSelectStoryProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InputLabelProps } from "../Input/InputLabel";
|
|
2
2
|
import { MenuProps } from "../MenuSelect/types";
|
|
3
3
|
import { SelectFieldProps } from "../SelectItem";
|
|
4
|
+
import { TooltipTitleCustom } from "../Tooltip";
|
|
4
5
|
export interface SelectOptionItem<T = string | number> {
|
|
5
6
|
label: string;
|
|
6
7
|
description?: string;
|
|
@@ -22,7 +23,12 @@ type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omi
|
|
|
22
23
|
portal?: boolean;
|
|
23
24
|
maxHeight?: string | number;
|
|
24
25
|
onPopupScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
|
26
|
+
onOpen?: () => void;
|
|
25
27
|
hideChip?: boolean;
|
|
28
|
+
/** Tooltip title content */
|
|
29
|
+
tooltipTitle?: TooltipTitleCustom | React.ReactNode;
|
|
30
|
+
/** Tooltip variant color */
|
|
31
|
+
tooltipVariant?: "primary" | "secondary";
|
|
26
32
|
};
|
|
27
33
|
export type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
|
|
28
34
|
multi?: false;
|
|
@@ -2,6 +2,7 @@ import { SelectSize } from ".";
|
|
|
2
2
|
interface SelectItemProps {
|
|
3
3
|
$size?: SelectSize;
|
|
4
4
|
$disabled?: boolean;
|
|
5
|
+
$activeDropdown?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const InputSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, SelectItemProps>> & string;
|
|
7
8
|
export declare const DivWrapperSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SelectItemProps>> & string;
|
package/dist/esm/index.js
CHANGED
|
@@ -60995,9 +60995,9 @@ const ButtonStyled = styled.button `
|
|
|
60995
60995
|
`}
|
|
60996
60996
|
|
|
60997
60997
|
&:disabled {
|
|
60998
|
-
background-color: ${getTheme("com/button/disable/background-color
|
|
60999
|
-
border-color: ${getTheme("com/button/disable/stroke-color")};
|
|
60998
|
+
background-color: ${getTheme("com/button/disable/background-color")};
|
|
61000
60999
|
color: ${getTheme("com/button/disable/icon-color")} !important;
|
|
61000
|
+
border: none;
|
|
61001
61001
|
}
|
|
61002
61002
|
|
|
61003
61003
|
${props.$loading &&
|
|
@@ -61565,12 +61565,12 @@ function PositiveIcon(props) {
|
|
|
61565
61565
|
}
|
|
61566
61566
|
|
|
61567
61567
|
function ArrowDownIcon(props) {
|
|
61568
|
-
const { width =
|
|
61568
|
+
const { width = 20, height = 20, ...rest } = props;
|
|
61569
61569
|
return (jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { clipPath: "url(#clip0_11182_21084)", children: jsx("path", { d: "M4.66666 6L8.66666 10L12.6667 6", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11182_21084", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.666656)" }) }) })] }));
|
|
61570
61570
|
}
|
|
61571
61571
|
|
|
61572
61572
|
function ArrowUpIcon(props) {
|
|
61573
|
-
const { width =
|
|
61573
|
+
const { width = 20, height = 20, ...rest } = props;
|
|
61574
61574
|
return (jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { clipPath: "url(#clip0_11028_8041)", children: jsx("path", { d: "M4.33331 10L8.33331 6L12.3333 10", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11028_8041", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.333313)" }) }) })] }));
|
|
61575
61575
|
}
|
|
61576
61576
|
|
|
@@ -63805,7 +63805,8 @@ const ButtonItemSC = styled.button `
|
|
|
63805
63805
|
|
|
63806
63806
|
&:focus-visible {
|
|
63807
63807
|
background-color: ${getTheme("com/focus-mark/background-color")};
|
|
63808
|
-
box-shadow:
|
|
63808
|
+
box-shadow:
|
|
63809
|
+
0 0 0 ${getTheme("sem/dimension/stroke-width/divider/lg")}
|
|
63809
63810
|
${getTheme("com/focus-mark/color-gap-spacing")},
|
|
63810
63811
|
0 0 0 4px ${getTheme("com/focus-mark/color-stroke")};
|
|
63811
63812
|
}
|
|
@@ -63821,16 +63822,19 @@ const DivIconDotSC = styled.div `
|
|
|
63821
63822
|
gap: ${getTheme("com/breadcrumbs/module/horizontal-gap")};
|
|
63822
63823
|
border-radius: ${getTheme("com/breadcrumbs/module/corner-radius")};
|
|
63823
63824
|
`;
|
|
63825
|
+
const DivSeparatorIconSC$1 = styled.div `
|
|
63826
|
+
color: ${getTheme("com/breadcrumbs/separated-icon/color-icon")};
|
|
63827
|
+
`;
|
|
63824
63828
|
|
|
63825
63829
|
const MAX_VISIBLE_ITEMS = 4;
|
|
63826
63830
|
const BreadcrumbItem = forwardRef(({ label, icon, active, onClick, ...rest }, ref) => {
|
|
63827
63831
|
return (jsxs(ButtonItemSC, { type: "button", ...rest, ref: ref, onClick: onClick, "$active": active, children: [icon && jsx(DivIconSC$3, { children: icon }), label && jsx(SpanLabelSC$1, { children: label })] }));
|
|
63828
63832
|
});
|
|
63829
|
-
const BreadcrumbEllipsis = () => (jsxs(Fragment, { children: [jsx(DivIconDotSC, { children: jsx(DotIcon, {}) }), jsx(SeparatorIcon, {})] }));
|
|
63833
|
+
const BreadcrumbEllipsis = () => (jsxs(Fragment, { children: [jsx(DivIconDotSC, { children: jsx(DotIcon, {}) }), jsx(DivSeparatorIconSC$1, { children: jsx(SeparatorIcon, {}) })] }));
|
|
63830
63834
|
const FISBreadcrumb = ({ items, className }) => {
|
|
63831
63835
|
if (items.length === 0)
|
|
63832
63836
|
return null;
|
|
63833
|
-
return (jsxs(DivContainerSC$9, { className: className, children: [items?.[0]?.icon && (jsxs(Fragment, { children: [jsx(FISIconButton, { size: "xs", icon: items?.[0]?.icon, variant: "tertiary-invisible", onClick: items[0].onClick }), jsx(SeparatorIcon, {})] })), items.length > MAX_VISIBLE_ITEMS ? (jsxs(Fragment, { children: [items.slice(1, 2).map((item, index) => (jsxs(React__default.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, index))), jsx(BreadcrumbEllipsis, {}), items.slice(-2).map((item, index) => (jsxs(React__default.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, `end-${index}`)))] })) : (jsx(Fragment, { children: items.slice(1).map((item, index) => (jsxs(React__default.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(SeparatorIcon, {})] }, index))) }))] }));
|
|
63837
|
+
return (jsxs(DivContainerSC$9, { className: className, children: [items?.[0]?.icon && (jsxs(Fragment, { children: [jsx(FISIconButton, { size: "xs", icon: items?.[0]?.icon, variant: "tertiary-invisible", onClick: items[0].onClick }), jsx(DivSeparatorIconSC$1, { children: jsx(SeparatorIcon, {}) })] })), items.length > MAX_VISIBLE_ITEMS ? (jsxs(Fragment, { children: [items.slice(1, 2).map((item, index) => (jsxs(React__default.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(DivSeparatorIconSC$1, { children: jsx(SeparatorIcon, {}) })] }, index))), jsx(BreadcrumbEllipsis, {}), items.slice(-2).map((item, index) => (jsxs(React__default.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(DivSeparatorIconSC$1, { children: jsx(SeparatorIcon, {}) })] }, `end-${index}`)))] })) : (jsx(Fragment, { children: items.slice(1).map((item, index) => (jsxs(React__default.Fragment, { children: [jsx(BreadcrumbItem, { ...item }), jsx(DivSeparatorIconSC$1, { children: jsx(SeparatorIcon, {}) })] }, index))) }))] }));
|
|
63834
63838
|
};
|
|
63835
63839
|
FISBreadcrumb.displayName = "FISBreadcrumb";
|
|
63836
63840
|
|
|
@@ -64808,7 +64812,7 @@ const DivContainerSC$7 = styled.div `
|
|
|
64808
64812
|
color: ${getTheme("com/input/field/negative/icon/color-icon/default")};
|
|
64809
64813
|
}
|
|
64810
64814
|
|
|
64811
|
-
&:hover {
|
|
64815
|
+
&:hover:not(:has(${InputSC$2}:disabled)):not(:has(.icon-suffix:hover)) {
|
|
64812
64816
|
outline-color: ${getTheme("com/input/field/negative/border/hover")};
|
|
64813
64817
|
background-color: ${getTheme("com/input/field/negative/background/hover")};
|
|
64814
64818
|
|
|
@@ -66529,7 +66533,7 @@ const DivContainerSC$4 = styled.div `
|
|
|
66529
66533
|
padding-bottom: ${getTheme("com/menu/bottom-padding")};
|
|
66530
66534
|
padding-left: ${getTheme("com/menu/left-padding")};
|
|
66531
66535
|
padding-right: ${getTheme("com/menu/right-padding")};
|
|
66532
|
-
gap: ${getTheme("com/menu/item/horizontal-gap")};
|
|
66536
|
+
/* gap: ${getTheme("com/menu/item/horizontal-gap")}; */
|
|
66533
66537
|
background-color: ${getTheme("com/menu/background-color")};
|
|
66534
66538
|
box-shadow: ${getTheme("Elevation/Level-2")};
|
|
66535
66539
|
`;
|
|
@@ -66540,6 +66544,7 @@ const DivLoaderSC = styled.div `
|
|
|
66540
66544
|
align-items: center;
|
|
66541
66545
|
justify-content: center;
|
|
66542
66546
|
gap: ${getTheme("com/menu/item/horizontal-gap")};
|
|
66547
|
+
height: ${getTheme("com/menu/height")};
|
|
66543
66548
|
`;
|
|
66544
66549
|
const DivIconDataSC = styled.div `
|
|
66545
66550
|
display: flex;
|
|
@@ -66559,8 +66564,8 @@ styled.div `
|
|
|
66559
66564
|
const DivWrapperSC$4 = styled.div `
|
|
66560
66565
|
display: flex;
|
|
66561
66566
|
flex-direction: column;
|
|
66562
|
-
gap: ${getTheme("com/menu/item/horizontal-gap")};
|
|
66563
|
-
|
|
66567
|
+
/* gap: ${getTheme("com/menu/item/horizontal-gap")}; */
|
|
66568
|
+
min-width: ${getTheme("com/menu/item/min-width")};
|
|
66564
66569
|
min-height: ${getTheme("com/menu/item/size-md/min-height")};
|
|
66565
66570
|
background-color: ${getTheme("com/menu/item/action/background-color/default")};
|
|
66566
66571
|
`;
|
|
@@ -67609,9 +67614,16 @@ FISMenuSection.displayName = "FISMenuSection";
|
|
|
67609
67614
|
|
|
67610
67615
|
const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, selectedValues = [], onChangeSelected, searchValue = "", onSearchChange, loading = false, noData = false, noResult = false, combobox, className, onClickMenu, loadingText = "Data loading...", noDataText = "No data", noResultText = "No result", removeSelectedText = "Remove selected", selectedGroupLabel = "Selected", maxHeight, onPopupScroll, }) => {
|
|
67611
67616
|
const [localSearch, setLocalSearch] = useState(searchValue);
|
|
67617
|
+
const [pendingSearch, setPendingSearch] = useState(null);
|
|
67612
67618
|
useEffect(() => {
|
|
67613
67619
|
setLocalSearch(searchValue);
|
|
67614
67620
|
}, [searchValue]);
|
|
67621
|
+
useEffect(() => {
|
|
67622
|
+
if (pendingSearch !== null) {
|
|
67623
|
+
setLocalSearch(pendingSearch);
|
|
67624
|
+
setPendingSearch(null);
|
|
67625
|
+
}
|
|
67626
|
+
}, [groups]);
|
|
67615
67627
|
const search = localSearch;
|
|
67616
67628
|
const filteredGroups = useMemo$1(() => {
|
|
67617
67629
|
let filteredItems = groups.map((group) => ({
|
|
@@ -67663,8 +67675,13 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67663
67675
|
const shouldShowNoResult = hasSearch && !hasFilteredResult;
|
|
67664
67676
|
const handleSearchChange = (e) => {
|
|
67665
67677
|
const value = e.target.value;
|
|
67666
|
-
|
|
67667
|
-
|
|
67678
|
+
if (onSearchChange) {
|
|
67679
|
+
setPendingSearch(value);
|
|
67680
|
+
onSearchChange(value);
|
|
67681
|
+
}
|
|
67682
|
+
else {
|
|
67683
|
+
setLocalSearch(value);
|
|
67684
|
+
}
|
|
67668
67685
|
};
|
|
67669
67686
|
const handleItemClick = (item) => {
|
|
67670
67687
|
if (multi) {
|
|
@@ -67688,7 +67705,7 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67688
67705
|
onClickMenu?.();
|
|
67689
67706
|
}
|
|
67690
67707
|
};
|
|
67691
|
-
return (jsxs(DivContainerSC$4, { "$maxHeight": maxHeight, className: className, children: [showInput && !combobox && (jsx(DivSearchSC, { children: jsx(FISInputText, { iconPrefix: jsx(SearchIcon, {}), placeholder: placeholder, value: search, onChange: handleSearchChange }) })),
|
|
67708
|
+
return (jsxs(DivContainerSC$4, { "$maxHeight": maxHeight, className: className, children: [showInput && !combobox && (jsx(DivSearchSC, { children: jsx(FISInputText, { iconPrefix: jsx(SearchIcon, {}), placeholder: placeholder, value: search, onChange: handleSearchChange }) })), loading && (jsxs(DivLoaderSC, { children: [jsx(FISProgressCircular, { size: size, variant: "indeterminate" }), jsx(PTitleSC$2, { children: loadingText })] })), !loading && noData && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoDataIcon, {}) }), jsx(PTitleSC$2, { children: noDataText })] })), !loading && !noData && (shouldShowNoResult || noResult) && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoResultIcon, {}) }), jsx(PTitleSC$2, { children: noResultText })] })), !shouldShowNoResult && !noData && !loading && (jsxs(Fragment, { children: [jsx(MenuContent, { "$removeSelectedGroup": !!removeSelectedGroup, onScroll: onPopupScroll, children: groupsToRender.map((group, index) => (jsxs(DivWrapperSC$4, { children: [index !== 0 && jsx(FISMenuSection, { withDivider: true }), group?.groupLabel && (jsx(FISMenuSection, { label: group?.groupLabel })), group.items.map((item, idx) => (jsx(FISTooltip, { title: item.label, variant: "primary", children: jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => handleItemClick(item), selected: selectedValues.includes(item.value), type: "select" }) }, idx)))] }, index))) }), removeSelectedGroup && (jsx(FixedBottomSection, { children: jsx(DivWrapperSC$4, { children: removeSelectedGroup.items.map((item, idx) => (jsx(FISTooltip, { title: item.label, variant: "primary", children: jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => onChangeSelected?.([]), type: "select", iconPrefix: jsx(RemoveIcon, {}), negative: true }) }, idx))) }) }))] }))] }));
|
|
67692
67709
|
};
|
|
67693
67710
|
FISMenuSelect.displayName = "FISMenuSelect";
|
|
67694
67711
|
|
|
@@ -73364,7 +73381,7 @@ const DivInputWrapperSC = styled.div `
|
|
|
73364
73381
|
`}
|
|
73365
73382
|
`;
|
|
73366
73383
|
const DivDropdownMenuSC = styled.div `
|
|
73367
|
-
|
|
73384
|
+
margin-top: ${getTheme("com/select/vertical-gap")};
|
|
73368
73385
|
`;
|
|
73369
73386
|
const SelectedTagsWrapper = styled.div `
|
|
73370
73387
|
display: flex;
|
|
@@ -73611,6 +73628,17 @@ const DivContainerSC = styled.div `
|
|
|
73611
73628
|
}
|
|
73612
73629
|
}
|
|
73613
73630
|
|
|
73631
|
+
&.activeDropdown {
|
|
73632
|
+
outline-color: ${getTheme("com/select/field/default/border/active")};
|
|
73633
|
+
background-color: ${getTheme("com/select/field/default/background/active")};
|
|
73634
|
+
box-shadow: 0 0 0 ${getTheme("com/actived-mark/gap-spacing")}
|
|
73635
|
+
${getTheme("com/actived-mark/color-gap-spacing")};
|
|
73636
|
+
|
|
73637
|
+
${DivIconPrefixSC} {
|
|
73638
|
+
color: ${getTheme("com/select/field/default/icon/color-icon/active")};
|
|
73639
|
+
}
|
|
73640
|
+
}
|
|
73641
|
+
|
|
73614
73642
|
// Design chưa có negative
|
|
73615
73643
|
&.negative {
|
|
73616
73644
|
outline-color: ${getTheme("com/input/field/negative/border/default")};
|
|
@@ -73628,6 +73656,13 @@ const DivContainerSC = styled.div `
|
|
|
73628
73656
|
${getTheme("com/actived-mark/color-gap-spacing-negative")};
|
|
73629
73657
|
}
|
|
73630
73658
|
|
|
73659
|
+
&.activeDropdown {
|
|
73660
|
+
outline-color: ${getTheme("com/input/field/negative/border/active")};
|
|
73661
|
+
background-color: ${getTheme("com/input/field/negative/background/active")};
|
|
73662
|
+
box-shadow: 0 0 0 ${getTheme("com/actived-mark/gap-spacing")}
|
|
73663
|
+
${getTheme("com/actived-mark/color-gap-spacing-negative")};
|
|
73664
|
+
}
|
|
73665
|
+
|
|
73631
73666
|
&::placeholder {
|
|
73632
73667
|
color: ${getTheme("com/input/field/negative/label/color-text/placeholder")};
|
|
73633
73668
|
}
|
|
@@ -73639,7 +73674,8 @@ const FISSelectItem = forwardRef((props, ref) => {
|
|
|
73639
73674
|
return (jsx(DivContainerSC, { className: classNames({
|
|
73640
73675
|
iconPrefix: iconPrefix,
|
|
73641
73676
|
negative: negative,
|
|
73642
|
-
|
|
73677
|
+
activeDropdown: activeDropdown,
|
|
73678
|
+
}), "$size": size, "$activeDropdown": activeDropdown, children: jsxs(DivWrapperSC, { children: [iconPrefix && (jsx(DivIconPrefixSC, { "$size": size, children: iconPrefix })), jsx(InputSC, { ...rest, ref: ref, disabled: disabled, "$size": size }), iconSuffix && (jsx(DivIconSuffixSC, { "$size": size, "$disabled": disabled, children: iconSuffix }))] }) }));
|
|
73643
73679
|
});
|
|
73644
73680
|
FISSelectItem.displayName = "FISSelectItem";
|
|
73645
73681
|
|
|
@@ -73647,11 +73683,25 @@ function isMenuSize(value) {
|
|
|
73647
73683
|
return value === "sm" || value === "md";
|
|
73648
73684
|
}
|
|
73649
73685
|
|
|
73650
|
-
const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholder, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal, maxHeight, onPopupScroll, hideChip, ...restProps }, ref) => {
|
|
73686
|
+
const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholder, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal, maxHeight, onPopupScroll, onOpen, hideChip, tooltipTitle, tooltipVariant = "primary", ...restProps }, ref) => {
|
|
73651
73687
|
const [isOpen, setIsOpen] = useState(false);
|
|
73652
73688
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
73653
73689
|
const [popperElement, setPopperElement] = useState(null);
|
|
73690
|
+
const [cachedSelectedItem, setCachedSelectedItem] = useState(null);
|
|
73654
73691
|
const isSelectingRef = useRef(false);
|
|
73692
|
+
const inputRef = useRef(null);
|
|
73693
|
+
// Expose focus and openDropdown methods via ref
|
|
73694
|
+
useImperativeHandle(ref, () => ({
|
|
73695
|
+
...inputRef.current,
|
|
73696
|
+
openDropdown: () => {
|
|
73697
|
+
if (!disabled && !isOpen) {
|
|
73698
|
+
setIsOpen(true);
|
|
73699
|
+
if (onOpen) {
|
|
73700
|
+
onOpen();
|
|
73701
|
+
}
|
|
73702
|
+
}
|
|
73703
|
+
},
|
|
73704
|
+
}));
|
|
73655
73705
|
const popperOptions = useMemo$1(() => ({
|
|
73656
73706
|
modifiers: [
|
|
73657
73707
|
{ name: "preventOverflow", options: { padding: 0, altAxis: true } },
|
|
@@ -73689,17 +73739,39 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73689
73739
|
: `Selected ${count.toString().padStart(2, "0")} option${count !== 1 ? "s" : ""}`;
|
|
73690
73740
|
}
|
|
73691
73741
|
else {
|
|
73692
|
-
|
|
73693
|
-
|
|
73694
|
-
|
|
73695
|
-
|
|
73742
|
+
if (value) {
|
|
73743
|
+
const firstItem = selectedItems[0];
|
|
73744
|
+
if (firstItem) {
|
|
73745
|
+
if (!cachedSelectedItem ||
|
|
73746
|
+
cachedSelectedItem.value !== firstItem.value) {
|
|
73747
|
+
setCachedSelectedItem(firstItem);
|
|
73748
|
+
}
|
|
73749
|
+
return displayValue?.(firstItem) || firstItem.label;
|
|
73750
|
+
}
|
|
73751
|
+
if (cachedSelectedItem) {
|
|
73752
|
+
return (displayValue?.(cachedSelectedItem) || cachedSelectedItem.label);
|
|
73753
|
+
}
|
|
73754
|
+
if (displayValue) {
|
|
73755
|
+
return displayValue({ label: String(value), value });
|
|
73756
|
+
}
|
|
73757
|
+
return String(value);
|
|
73758
|
+
}
|
|
73759
|
+
return "";
|
|
73696
73760
|
}
|
|
73697
|
-
}, [
|
|
73761
|
+
}, [
|
|
73762
|
+
multi,
|
|
73763
|
+
value,
|
|
73764
|
+
multiDisplayText,
|
|
73765
|
+
selectedItems,
|
|
73766
|
+
displayValue,
|
|
73767
|
+
cachedSelectedItem,
|
|
73768
|
+
]);
|
|
73698
73769
|
const handleToggle = useCallback(() => {
|
|
73699
73770
|
if (!disabled) {
|
|
73700
73771
|
setIsOpen((prev) => !prev);
|
|
73772
|
+
onOpen?.();
|
|
73701
73773
|
}
|
|
73702
|
-
}, [disabled]);
|
|
73774
|
+
}, [disabled, onOpen]);
|
|
73703
73775
|
const handleOptionRemove = useCallback((option) => {
|
|
73704
73776
|
if (multi && Array.isArray(value)) {
|
|
73705
73777
|
const newValues = value.filter((v) => v !== option.value);
|
|
@@ -73794,7 +73866,14 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73794
73866
|
return () => clearTimeout(timer);
|
|
73795
73867
|
}
|
|
73796
73868
|
}, [isOpen, multi]);
|
|
73797
|
-
|
|
73869
|
+
const renderSelectInput = () => {
|
|
73870
|
+
const selectInput = (jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, "$hasValue": !!value, children: jsx(FISSelectItem, { ...restProps, onBlur: handleBlur, ref: inputRef, size: size, placeholder: placeholder, iconSuffix: isOpen ? jsx(ArrowUpIcon, {}) : jsx(ArrowDownIcon, {}), value: computedDisplayValue, disabled: disabled, activeDropdown: isOpen, negative: negative }) }));
|
|
73871
|
+
if (tooltipTitle) {
|
|
73872
|
+
return (jsx(FISTooltip, { title: tooltipTitle, variant: tooltipVariant, smartPlacement: true, children: selectInput }));
|
|
73873
|
+
}
|
|
73874
|
+
return selectInput;
|
|
73875
|
+
};
|
|
73876
|
+
return (jsxs(DivWrapperSC$1, { className: className, style: style, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), renderSelectInput(), message && (jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && !hideChip && Array.isArray(value) && value.length > 0 && (jsx(SelectedTagsWrapper, { children: jsx(MultipleValue, { options: selectedItems, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { portal: portal, children: jsx(DivDropdownMenuSC, { ref: setPopperElement, style: {
|
|
73798
73877
|
...styles.popper,
|
|
73799
73878
|
width: referenceElement?.offsetWidth,
|
|
73800
73879
|
zIndex: 9999,
|
|
@@ -73885,8 +73964,11 @@ const PaginationAntdSC = styled(Pagination) `
|
|
|
73885
73964
|
&.ant-pagination-disabled .ant-pagination-next,
|
|
73886
73965
|
&.ant-pagination-disabled .ant-pagination-prev {
|
|
73887
73966
|
color: ${getTheme("com/button/disable/icon-color")} !important;
|
|
73888
|
-
border-color: ${getTheme("com/button/disable/stroke-color")} !important;
|
|
73889
73967
|
background-color: transparent !important;
|
|
73968
|
+
|
|
73969
|
+
button {
|
|
73970
|
+
border: none !important;
|
|
73971
|
+
}
|
|
73890
73972
|
}
|
|
73891
73973
|
|
|
73892
73974
|
&.ant-pagination-disabled .ant-pagination-item-active {
|