fis-component 0.1.1 → 0.1.3
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 +109 -28
- 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 +109 -28
- 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
|
|
|
@@ -62172,9 +62172,9 @@ const ButtonSC = styled.button `
|
|
|
62172
62172
|
`}
|
|
62173
62173
|
|
|
62174
62174
|
&:disabled {
|
|
62175
|
-
background-color: ${getTheme("com/button/disable/background-color
|
|
62176
|
-
|
|
62177
|
-
|
|
62175
|
+
background-color: ${getTheme("com/button/disable/background-color")};
|
|
62176
|
+
color: ${getTheme("com/button/disable/icon-color")} !important;
|
|
62177
|
+
border: none;
|
|
62178
62178
|
|
|
62179
62179
|
${SpanIconSC$2} {
|
|
62180
62180
|
color: ${getTheme("com/button/disable/icon-color")};
|
|
@@ -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,7 @@ styled.div `
|
|
|
66559
66564
|
const DivWrapperSC$4 = styled.div `
|
|
66560
66565
|
display: flex;
|
|
66561
66566
|
flex-direction: column;
|
|
66562
|
-
gap: ${getTheme("
|
|
66563
|
-
/* min-width: ${getTheme("com/menu/item/min-width")}; */
|
|
66567
|
+
gap: ${getTheme("sem/dimension/gap/xs")};
|
|
66564
66568
|
min-height: ${getTheme("com/menu/item/size-md/min-height")};
|
|
66565
66569
|
background-color: ${getTheme("com/menu/item/action/background-color/default")};
|
|
66566
66570
|
`;
|
|
@@ -67609,9 +67613,16 @@ FISMenuSection.displayName = "FISMenuSection";
|
|
|
67609
67613
|
|
|
67610
67614
|
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
67615
|
const [localSearch, setLocalSearch] = useState(searchValue);
|
|
67616
|
+
const [pendingSearch, setPendingSearch] = useState(null);
|
|
67612
67617
|
useEffect(() => {
|
|
67613
67618
|
setLocalSearch(searchValue);
|
|
67614
67619
|
}, [searchValue]);
|
|
67620
|
+
useEffect(() => {
|
|
67621
|
+
if (pendingSearch !== null) {
|
|
67622
|
+
setLocalSearch(pendingSearch);
|
|
67623
|
+
setPendingSearch(null);
|
|
67624
|
+
}
|
|
67625
|
+
}, [groups]);
|
|
67615
67626
|
const search = localSearch;
|
|
67616
67627
|
const filteredGroups = useMemo$1(() => {
|
|
67617
67628
|
let filteredItems = groups.map((group) => ({
|
|
@@ -67663,8 +67674,13 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67663
67674
|
const shouldShowNoResult = hasSearch && !hasFilteredResult;
|
|
67664
67675
|
const handleSearchChange = (e) => {
|
|
67665
67676
|
const value = e.target.value;
|
|
67666
|
-
|
|
67667
|
-
|
|
67677
|
+
if (onSearchChange) {
|
|
67678
|
+
setPendingSearch(value);
|
|
67679
|
+
onSearchChange(value);
|
|
67680
|
+
}
|
|
67681
|
+
else {
|
|
67682
|
+
setLocalSearch(value);
|
|
67683
|
+
}
|
|
67668
67684
|
};
|
|
67669
67685
|
const handleItemClick = (item) => {
|
|
67670
67686
|
if (multi) {
|
|
@@ -67688,7 +67704,7 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67688
67704
|
onClickMenu?.();
|
|
67689
67705
|
}
|
|
67690
67706
|
};
|
|
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 }) })),
|
|
67707
|
+
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
67708
|
};
|
|
67693
67709
|
FISMenuSelect.displayName = "FISMenuSelect";
|
|
67694
67710
|
|
|
@@ -73364,7 +73380,7 @@ const DivInputWrapperSC = styled.div `
|
|
|
73364
73380
|
`}
|
|
73365
73381
|
`;
|
|
73366
73382
|
const DivDropdownMenuSC = styled.div `
|
|
73367
|
-
|
|
73383
|
+
margin-top: ${getTheme("com/select/vertical-gap")};
|
|
73368
73384
|
`;
|
|
73369
73385
|
const SelectedTagsWrapper = styled.div `
|
|
73370
73386
|
display: flex;
|
|
@@ -73611,6 +73627,17 @@ const DivContainerSC = styled.div `
|
|
|
73611
73627
|
}
|
|
73612
73628
|
}
|
|
73613
73629
|
|
|
73630
|
+
&.activeDropdown {
|
|
73631
|
+
outline-color: ${getTheme("com/select/field/default/border/active")};
|
|
73632
|
+
background-color: ${getTheme("com/select/field/default/background/active")};
|
|
73633
|
+
box-shadow: 0 0 0 ${getTheme("com/actived-mark/gap-spacing")}
|
|
73634
|
+
${getTheme("com/actived-mark/color-gap-spacing")};
|
|
73635
|
+
|
|
73636
|
+
${DivIconPrefixSC} {
|
|
73637
|
+
color: ${getTheme("com/select/field/default/icon/color-icon/active")};
|
|
73638
|
+
}
|
|
73639
|
+
}
|
|
73640
|
+
|
|
73614
73641
|
// Design chưa có negative
|
|
73615
73642
|
&.negative {
|
|
73616
73643
|
outline-color: ${getTheme("com/input/field/negative/border/default")};
|
|
@@ -73628,6 +73655,13 @@ const DivContainerSC = styled.div `
|
|
|
73628
73655
|
${getTheme("com/actived-mark/color-gap-spacing-negative")};
|
|
73629
73656
|
}
|
|
73630
73657
|
|
|
73658
|
+
&.activeDropdown {
|
|
73659
|
+
outline-color: ${getTheme("com/input/field/negative/border/active")};
|
|
73660
|
+
background-color: ${getTheme("com/input/field/negative/background/active")};
|
|
73661
|
+
box-shadow: 0 0 0 ${getTheme("com/actived-mark/gap-spacing")}
|
|
73662
|
+
${getTheme("com/actived-mark/color-gap-spacing-negative")};
|
|
73663
|
+
}
|
|
73664
|
+
|
|
73631
73665
|
&::placeholder {
|
|
73632
73666
|
color: ${getTheme("com/input/field/negative/label/color-text/placeholder")};
|
|
73633
73667
|
}
|
|
@@ -73639,7 +73673,8 @@ const FISSelectItem = forwardRef((props, ref) => {
|
|
|
73639
73673
|
return (jsx(DivContainerSC, { className: classNames({
|
|
73640
73674
|
iconPrefix: iconPrefix,
|
|
73641
73675
|
negative: negative,
|
|
73642
|
-
|
|
73676
|
+
activeDropdown: activeDropdown,
|
|
73677
|
+
}), "$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
73678
|
});
|
|
73644
73679
|
FISSelectItem.displayName = "FISSelectItem";
|
|
73645
73680
|
|
|
@@ -73647,11 +73682,25 @@ function isMenuSize(value) {
|
|
|
73647
73682
|
return value === "sm" || value === "md";
|
|
73648
73683
|
}
|
|
73649
73684
|
|
|
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) => {
|
|
73685
|
+
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
73686
|
const [isOpen, setIsOpen] = useState(false);
|
|
73652
73687
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
73653
73688
|
const [popperElement, setPopperElement] = useState(null);
|
|
73689
|
+
const [cachedSelectedItem, setCachedSelectedItem] = useState(null);
|
|
73654
73690
|
const isSelectingRef = useRef(false);
|
|
73691
|
+
const inputRef = useRef(null);
|
|
73692
|
+
// Expose focus and openDropdown methods via ref
|
|
73693
|
+
useImperativeHandle(ref, () => ({
|
|
73694
|
+
...inputRef.current,
|
|
73695
|
+
openDropdown: () => {
|
|
73696
|
+
if (!disabled && !isOpen) {
|
|
73697
|
+
setIsOpen(true);
|
|
73698
|
+
if (onOpen) {
|
|
73699
|
+
onOpen();
|
|
73700
|
+
}
|
|
73701
|
+
}
|
|
73702
|
+
},
|
|
73703
|
+
}));
|
|
73655
73704
|
const popperOptions = useMemo$1(() => ({
|
|
73656
73705
|
modifiers: [
|
|
73657
73706
|
{ name: "preventOverflow", options: { padding: 0, altAxis: true } },
|
|
@@ -73689,17 +73738,39 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73689
73738
|
: `Selected ${count.toString().padStart(2, "0")} option${count !== 1 ? "s" : ""}`;
|
|
73690
73739
|
}
|
|
73691
73740
|
else {
|
|
73692
|
-
|
|
73693
|
-
|
|
73694
|
-
|
|
73695
|
-
|
|
73741
|
+
if (value) {
|
|
73742
|
+
const firstItem = selectedItems[0];
|
|
73743
|
+
if (firstItem) {
|
|
73744
|
+
if (!cachedSelectedItem ||
|
|
73745
|
+
cachedSelectedItem.value !== firstItem.value) {
|
|
73746
|
+
setCachedSelectedItem(firstItem);
|
|
73747
|
+
}
|
|
73748
|
+
return displayValue?.(firstItem) || firstItem.label;
|
|
73749
|
+
}
|
|
73750
|
+
if (cachedSelectedItem) {
|
|
73751
|
+
return (displayValue?.(cachedSelectedItem) || cachedSelectedItem.label);
|
|
73752
|
+
}
|
|
73753
|
+
if (displayValue) {
|
|
73754
|
+
return displayValue({ label: String(value), value });
|
|
73755
|
+
}
|
|
73756
|
+
return String(value);
|
|
73757
|
+
}
|
|
73758
|
+
return "";
|
|
73696
73759
|
}
|
|
73697
|
-
}, [
|
|
73760
|
+
}, [
|
|
73761
|
+
multi,
|
|
73762
|
+
value,
|
|
73763
|
+
multiDisplayText,
|
|
73764
|
+
selectedItems,
|
|
73765
|
+
displayValue,
|
|
73766
|
+
cachedSelectedItem,
|
|
73767
|
+
]);
|
|
73698
73768
|
const handleToggle = useCallback(() => {
|
|
73699
73769
|
if (!disabled) {
|
|
73700
73770
|
setIsOpen((prev) => !prev);
|
|
73771
|
+
onOpen?.();
|
|
73701
73772
|
}
|
|
73702
|
-
}, [disabled]);
|
|
73773
|
+
}, [disabled, onOpen]);
|
|
73703
73774
|
const handleOptionRemove = useCallback((option) => {
|
|
73704
73775
|
if (multi && Array.isArray(value)) {
|
|
73705
73776
|
const newValues = value.filter((v) => v !== option.value);
|
|
@@ -73794,7 +73865,14 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73794
73865
|
return () => clearTimeout(timer);
|
|
73795
73866
|
}
|
|
73796
73867
|
}, [isOpen, multi]);
|
|
73797
|
-
|
|
73868
|
+
const renderSelectInput = () => {
|
|
73869
|
+
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 }) }));
|
|
73870
|
+
if (tooltipTitle) {
|
|
73871
|
+
return (jsx(FISTooltip, { title: tooltipTitle, variant: tooltipVariant, smartPlacement: true, children: selectInput }));
|
|
73872
|
+
}
|
|
73873
|
+
return selectInput;
|
|
73874
|
+
};
|
|
73875
|
+
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
73876
|
...styles.popper,
|
|
73799
73877
|
width: referenceElement?.offsetWidth,
|
|
73800
73878
|
zIndex: 9999,
|
|
@@ -73885,8 +73963,11 @@ const PaginationAntdSC = styled(Pagination) `
|
|
|
73885
73963
|
&.ant-pagination-disabled .ant-pagination-next,
|
|
73886
73964
|
&.ant-pagination-disabled .ant-pagination-prev {
|
|
73887
73965
|
color: ${getTheme("com/button/disable/icon-color")} !important;
|
|
73888
|
-
border-color: ${getTheme("com/button/disable/stroke-color")} !important;
|
|
73889
73966
|
background-color: transparent !important;
|
|
73967
|
+
|
|
73968
|
+
button {
|
|
73969
|
+
border: none !important;
|
|
73970
|
+
}
|
|
73890
73971
|
}
|
|
73891
73972
|
|
|
73892
73973
|
&.ant-pagination-disabled .ant-pagination-item-active {
|