fis-component 0.1.0 → 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 +108 -26
- 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 +108 -26
- 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
package/dist/cjs/index.js
CHANGED
|
@@ -61015,9 +61015,9 @@ const ButtonStyled = styled.button `
|
|
|
61015
61015
|
`}
|
|
61016
61016
|
|
|
61017
61017
|
&:disabled {
|
|
61018
|
-
background-color: ${getTheme("com/button/disable/background-color
|
|
61019
|
-
border-color: ${getTheme("com/button/disable/stroke-color")};
|
|
61018
|
+
background-color: ${getTheme("com/button/disable/background-color")};
|
|
61020
61019
|
color: ${getTheme("com/button/disable/icon-color")} !important;
|
|
61020
|
+
border: none;
|
|
61021
61021
|
}
|
|
61022
61022
|
|
|
61023
61023
|
${props.$loading &&
|
|
@@ -61585,12 +61585,12 @@ function PositiveIcon(props) {
|
|
|
61585
61585
|
}
|
|
61586
61586
|
|
|
61587
61587
|
function ArrowDownIcon(props) {
|
|
61588
|
-
const { width =
|
|
61588
|
+
const { width = 20, height = 20, ...rest } = props;
|
|
61589
61589
|
return (jsxRuntime.jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsxRuntime.jsx("g", { clipPath: "url(#clip0_11182_21084)", children: jsxRuntime.jsx("path", { d: "M4.66666 6L8.66666 10L12.6667 6", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_11182_21084", children: jsxRuntime.jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.666656)" }) }) })] }));
|
|
61590
61590
|
}
|
|
61591
61591
|
|
|
61592
61592
|
function ArrowUpIcon(props) {
|
|
61593
|
-
const { width =
|
|
61593
|
+
const { width = 20, height = 20, ...rest } = props;
|
|
61594
61594
|
return (jsxRuntime.jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsxRuntime.jsx("g", { clipPath: "url(#clip0_11028_8041)", children: jsxRuntime.jsx("path", { d: "M4.33331 10L8.33331 6L12.3333 10", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_11028_8041", children: jsxRuntime.jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.333313)" }) }) })] }));
|
|
61595
61595
|
}
|
|
61596
61596
|
|
|
@@ -63825,7 +63825,8 @@ const ButtonItemSC = styled.button `
|
|
|
63825
63825
|
|
|
63826
63826
|
&:focus-visible {
|
|
63827
63827
|
background-color: ${getTheme("com/focus-mark/background-color")};
|
|
63828
|
-
box-shadow:
|
|
63828
|
+
box-shadow:
|
|
63829
|
+
0 0 0 ${getTheme("sem/dimension/stroke-width/divider/lg")}
|
|
63829
63830
|
${getTheme("com/focus-mark/color-gap-spacing")},
|
|
63830
63831
|
0 0 0 4px ${getTheme("com/focus-mark/color-stroke")};
|
|
63831
63832
|
}
|
|
@@ -63841,16 +63842,19 @@ const DivIconDotSC = styled.div `
|
|
|
63841
63842
|
gap: ${getTheme("com/breadcrumbs/module/horizontal-gap")};
|
|
63842
63843
|
border-radius: ${getTheme("com/breadcrumbs/module/corner-radius")};
|
|
63843
63844
|
`;
|
|
63845
|
+
const DivSeparatorIconSC$1 = styled.div `
|
|
63846
|
+
color: ${getTheme("com/breadcrumbs/separated-icon/color-icon")};
|
|
63847
|
+
`;
|
|
63844
63848
|
|
|
63845
63849
|
const MAX_VISIBLE_ITEMS = 4;
|
|
63846
63850
|
const BreadcrumbItem = React.forwardRef(({ label, icon, active, onClick, ...rest }, ref) => {
|
|
63847
63851
|
return (jsxRuntime.jsxs(ButtonItemSC, { type: "button", ...rest, ref: ref, onClick: onClick, "$active": active, children: [icon && jsxRuntime.jsx(DivIconSC$3, { children: icon }), label && jsxRuntime.jsx(SpanLabelSC$1, { children: label })] }));
|
|
63848
63852
|
});
|
|
63849
|
-
const BreadcrumbEllipsis = () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DivIconDotSC, { children: jsxRuntime.jsx(DotIcon, {}) }), jsxRuntime.jsx(SeparatorIcon, {})] }));
|
|
63853
|
+
const BreadcrumbEllipsis = () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DivIconDotSC, { children: jsxRuntime.jsx(DotIcon, {}) }), jsxRuntime.jsx(DivSeparatorIconSC$1, { children: jsxRuntime.jsx(SeparatorIcon, {}) })] }));
|
|
63850
63854
|
const FISBreadcrumb = ({ items, className }) => {
|
|
63851
63855
|
if (items.length === 0)
|
|
63852
63856
|
return null;
|
|
63853
|
-
return (jsxRuntime.jsxs(DivContainerSC$9, { className: className, children: [items?.[0]?.icon && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(FISIconButton, { size: "xs", icon: items?.[0]?.icon, variant: "tertiary-invisible", onClick: items[0].onClick }), jsxRuntime.jsx(SeparatorIcon, {})] })), items.length > MAX_VISIBLE_ITEMS ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [items.slice(1, 2).map((item, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(BreadcrumbItem, { ...item }), jsxRuntime.jsx(SeparatorIcon, {})] }, index))), jsxRuntime.jsx(BreadcrumbEllipsis, {}), items.slice(-2).map((item, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(BreadcrumbItem, { ...item }), jsxRuntime.jsx(SeparatorIcon, {})] }, `end-${index}`)))] })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: items.slice(1).map((item, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(BreadcrumbItem, { ...item }), jsxRuntime.jsx(SeparatorIcon, {})] }, index))) }))] }));
|
|
63857
|
+
return (jsxRuntime.jsxs(DivContainerSC$9, { className: className, children: [items?.[0]?.icon && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(FISIconButton, { size: "xs", icon: items?.[0]?.icon, variant: "tertiary-invisible", onClick: items[0].onClick }), jsxRuntime.jsx(DivSeparatorIconSC$1, { children: jsxRuntime.jsx(SeparatorIcon, {}) })] })), items.length > MAX_VISIBLE_ITEMS ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [items.slice(1, 2).map((item, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(BreadcrumbItem, { ...item }), jsxRuntime.jsx(DivSeparatorIconSC$1, { children: jsxRuntime.jsx(SeparatorIcon, {}) })] }, index))), jsxRuntime.jsx(BreadcrumbEllipsis, {}), items.slice(-2).map((item, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(BreadcrumbItem, { ...item }), jsxRuntime.jsx(DivSeparatorIconSC$1, { children: jsxRuntime.jsx(SeparatorIcon, {}) })] }, `end-${index}`)))] })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: items.slice(1).map((item, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(BreadcrumbItem, { ...item }), jsxRuntime.jsx(DivSeparatorIconSC$1, { children: jsxRuntime.jsx(SeparatorIcon, {}) })] }, index))) }))] }));
|
|
63854
63858
|
};
|
|
63855
63859
|
FISBreadcrumb.displayName = "FISBreadcrumb";
|
|
63856
63860
|
|
|
@@ -64828,7 +64832,7 @@ const DivContainerSC$7 = styled.div `
|
|
|
64828
64832
|
color: ${getTheme("com/input/field/negative/icon/color-icon/default")};
|
|
64829
64833
|
}
|
|
64830
64834
|
|
|
64831
|
-
&:hover {
|
|
64835
|
+
&:hover:not(:has(${InputSC$2}:disabled)):not(:has(.icon-suffix:hover)) {
|
|
64832
64836
|
outline-color: ${getTheme("com/input/field/negative/border/hover")};
|
|
64833
64837
|
background-color: ${getTheme("com/input/field/negative/background/hover")};
|
|
64834
64838
|
|
|
@@ -66112,7 +66116,7 @@ const FISInputArea = React.forwardRef((props, ref) => {
|
|
|
66112
66116
|
"input-area-lg": size === "lg",
|
|
66113
66117
|
"input-area-icon": iconSuffix,
|
|
66114
66118
|
negative,
|
|
66115
|
-
}), style: { width: fixedWidth ? `${fixedWidth}px` : "auto" }, children: [jsxRuntime.jsx(TextAreaSC, { ...rest, onChange: handleChange, onKeyDown: handleKeyPress, ref: mergeRefs(ref, inputRef), disabled: disabled, className: classNames({
|
|
66119
|
+
}), style: { width: fixedWidth ? `${fixedWidth}px` : "auto" }, children: [jsxRuntime.jsx(TextAreaSC, { ...rest, onChange: handleChange, onKeyDown: handleKeyPress, ref: mergeRefs(ref, inputRef), disabled: disabled, maxLength: maxLength, className: classNames({
|
|
66116
66120
|
negative,
|
|
66117
66121
|
"input-area-lg": size === "lg",
|
|
66118
66122
|
"input-area-icon": iconSuffix,
|
|
@@ -66549,7 +66553,7 @@ const DivContainerSC$4 = styled.div `
|
|
|
66549
66553
|
padding-bottom: ${getTheme("com/menu/bottom-padding")};
|
|
66550
66554
|
padding-left: ${getTheme("com/menu/left-padding")};
|
|
66551
66555
|
padding-right: ${getTheme("com/menu/right-padding")};
|
|
66552
|
-
gap: ${getTheme("com/menu/item/horizontal-gap")};
|
|
66556
|
+
/* gap: ${getTheme("com/menu/item/horizontal-gap")}; */
|
|
66553
66557
|
background-color: ${getTheme("com/menu/background-color")};
|
|
66554
66558
|
box-shadow: ${getTheme("Elevation/Level-2")};
|
|
66555
66559
|
`;
|
|
@@ -66560,6 +66564,7 @@ const DivLoaderSC = styled.div `
|
|
|
66560
66564
|
align-items: center;
|
|
66561
66565
|
justify-content: center;
|
|
66562
66566
|
gap: ${getTheme("com/menu/item/horizontal-gap")};
|
|
66567
|
+
height: ${getTheme("com/menu/height")};
|
|
66563
66568
|
`;
|
|
66564
66569
|
const DivIconDataSC = styled.div `
|
|
66565
66570
|
display: flex;
|
|
@@ -66579,8 +66584,8 @@ styled.div `
|
|
|
66579
66584
|
const DivWrapperSC$4 = styled.div `
|
|
66580
66585
|
display: flex;
|
|
66581
66586
|
flex-direction: column;
|
|
66582
|
-
gap: ${getTheme("com/menu/item/horizontal-gap")};
|
|
66583
|
-
|
|
66587
|
+
/* gap: ${getTheme("com/menu/item/horizontal-gap")}; */
|
|
66588
|
+
min-width: ${getTheme("com/menu/item/min-width")};
|
|
66584
66589
|
min-height: ${getTheme("com/menu/item/size-md/min-height")};
|
|
66585
66590
|
background-color: ${getTheme("com/menu/item/action/background-color/default")};
|
|
66586
66591
|
`;
|
|
@@ -67629,9 +67634,16 @@ FISMenuSection.displayName = "FISMenuSection";
|
|
|
67629
67634
|
|
|
67630
67635
|
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, }) => {
|
|
67631
67636
|
const [localSearch, setLocalSearch] = React.useState(searchValue);
|
|
67637
|
+
const [pendingSearch, setPendingSearch] = React.useState(null);
|
|
67632
67638
|
React.useEffect(() => {
|
|
67633
67639
|
setLocalSearch(searchValue);
|
|
67634
67640
|
}, [searchValue]);
|
|
67641
|
+
React.useEffect(() => {
|
|
67642
|
+
if (pendingSearch !== null) {
|
|
67643
|
+
setLocalSearch(pendingSearch);
|
|
67644
|
+
setPendingSearch(null);
|
|
67645
|
+
}
|
|
67646
|
+
}, [groups]);
|
|
67635
67647
|
const search = localSearch;
|
|
67636
67648
|
const filteredGroups = React.useMemo(() => {
|
|
67637
67649
|
let filteredItems = groups.map((group) => ({
|
|
@@ -67683,8 +67695,13 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67683
67695
|
const shouldShowNoResult = hasSearch && !hasFilteredResult;
|
|
67684
67696
|
const handleSearchChange = (e) => {
|
|
67685
67697
|
const value = e.target.value;
|
|
67686
|
-
|
|
67687
|
-
|
|
67698
|
+
if (onSearchChange) {
|
|
67699
|
+
setPendingSearch(value);
|
|
67700
|
+
onSearchChange(value);
|
|
67701
|
+
}
|
|
67702
|
+
else {
|
|
67703
|
+
setLocalSearch(value);
|
|
67704
|
+
}
|
|
67688
67705
|
};
|
|
67689
67706
|
const handleItemClick = (item) => {
|
|
67690
67707
|
if (multi) {
|
|
@@ -67708,7 +67725,7 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67708
67725
|
onClickMenu?.();
|
|
67709
67726
|
}
|
|
67710
67727
|
};
|
|
67711
|
-
return (jsxRuntime.jsxs(DivContainerSC$4, { "$maxHeight": maxHeight, className: className, children: [showInput && !combobox && (jsxRuntime.jsx(DivSearchSC, { children: jsxRuntime.jsx(FISInputText, { iconPrefix: jsxRuntime.jsx(SearchIcon, {}), placeholder: placeholder, value: search, onChange: handleSearchChange }) })),
|
|
67728
|
+
return (jsxRuntime.jsxs(DivContainerSC$4, { "$maxHeight": maxHeight, className: className, children: [showInput && !combobox && (jsxRuntime.jsx(DivSearchSC, { children: jsxRuntime.jsx(FISInputText, { iconPrefix: jsxRuntime.jsx(SearchIcon, {}), placeholder: placeholder, value: search, onChange: handleSearchChange }) })), loading && (jsxRuntime.jsxs(DivLoaderSC, { children: [jsxRuntime.jsx(FISProgressCircular, { size: size, variant: "indeterminate" }), jsxRuntime.jsx(PTitleSC$2, { children: loadingText })] })), !loading && noData && (jsxRuntime.jsxs(DivLoaderSC, { children: [jsxRuntime.jsx(DivIconDataSC, { children: jsxRuntime.jsx(NoDataIcon, {}) }), jsxRuntime.jsx(PTitleSC$2, { children: noDataText })] })), !loading && !noData && (shouldShowNoResult || noResult) && (jsxRuntime.jsxs(DivLoaderSC, { children: [jsxRuntime.jsx(DivIconDataSC, { children: jsxRuntime.jsx(NoResultIcon, {}) }), jsxRuntime.jsx(PTitleSC$2, { children: noResultText })] })), !shouldShowNoResult && !noData && !loading && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MenuContent, { "$removeSelectedGroup": !!removeSelectedGroup, onScroll: onPopupScroll, children: groupsToRender.map((group, index) => (jsxRuntime.jsxs(DivWrapperSC$4, { children: [index !== 0 && jsxRuntime.jsx(FISMenuSection, { withDivider: true }), group?.groupLabel && (jsxRuntime.jsx(FISMenuSection, { label: group?.groupLabel })), group.items.map((item, idx) => (jsxRuntime.jsx(FISTooltip, { title: item.label, variant: "primary", children: jsxRuntime.jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => handleItemClick(item), selected: selectedValues.includes(item.value), type: "select" }) }, idx)))] }, index))) }), removeSelectedGroup && (jsxRuntime.jsx(FixedBottomSection, { children: jsxRuntime.jsx(DivWrapperSC$4, { children: removeSelectedGroup.items.map((item, idx) => (jsxRuntime.jsx(FISTooltip, { title: item.label, variant: "primary", children: jsxRuntime.jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => onChangeSelected?.([]), type: "select", iconPrefix: jsxRuntime.jsx(RemoveIcon, {}), negative: true }) }, idx))) }) }))] }))] }));
|
|
67712
67729
|
};
|
|
67713
67730
|
FISMenuSelect.displayName = "FISMenuSelect";
|
|
67714
67731
|
|
|
@@ -73384,7 +73401,7 @@ const DivInputWrapperSC = styled.div `
|
|
|
73384
73401
|
`}
|
|
73385
73402
|
`;
|
|
73386
73403
|
const DivDropdownMenuSC = styled.div `
|
|
73387
|
-
|
|
73404
|
+
margin-top: ${getTheme("com/select/vertical-gap")};
|
|
73388
73405
|
`;
|
|
73389
73406
|
const SelectedTagsWrapper = styled.div `
|
|
73390
73407
|
display: flex;
|
|
@@ -73631,6 +73648,17 @@ const DivContainerSC = styled.div `
|
|
|
73631
73648
|
}
|
|
73632
73649
|
}
|
|
73633
73650
|
|
|
73651
|
+
&.activeDropdown {
|
|
73652
|
+
outline-color: ${getTheme("com/select/field/default/border/active")};
|
|
73653
|
+
background-color: ${getTheme("com/select/field/default/background/active")};
|
|
73654
|
+
box-shadow: 0 0 0 ${getTheme("com/actived-mark/gap-spacing")}
|
|
73655
|
+
${getTheme("com/actived-mark/color-gap-spacing")};
|
|
73656
|
+
|
|
73657
|
+
${DivIconPrefixSC} {
|
|
73658
|
+
color: ${getTheme("com/select/field/default/icon/color-icon/active")};
|
|
73659
|
+
}
|
|
73660
|
+
}
|
|
73661
|
+
|
|
73634
73662
|
// Design chưa có negative
|
|
73635
73663
|
&.negative {
|
|
73636
73664
|
outline-color: ${getTheme("com/input/field/negative/border/default")};
|
|
@@ -73648,6 +73676,13 @@ const DivContainerSC = styled.div `
|
|
|
73648
73676
|
${getTheme("com/actived-mark/color-gap-spacing-negative")};
|
|
73649
73677
|
}
|
|
73650
73678
|
|
|
73679
|
+
&.activeDropdown {
|
|
73680
|
+
outline-color: ${getTheme("com/input/field/negative/border/active")};
|
|
73681
|
+
background-color: ${getTheme("com/input/field/negative/background/active")};
|
|
73682
|
+
box-shadow: 0 0 0 ${getTheme("com/actived-mark/gap-spacing")}
|
|
73683
|
+
${getTheme("com/actived-mark/color-gap-spacing-negative")};
|
|
73684
|
+
}
|
|
73685
|
+
|
|
73651
73686
|
&::placeholder {
|
|
73652
73687
|
color: ${getTheme("com/input/field/negative/label/color-text/placeholder")};
|
|
73653
73688
|
}
|
|
@@ -73659,7 +73694,8 @@ const FISSelectItem = React.forwardRef((props, ref) => {
|
|
|
73659
73694
|
return (jsxRuntime.jsx(DivContainerSC, { className: classNames({
|
|
73660
73695
|
iconPrefix: iconPrefix,
|
|
73661
73696
|
negative: negative,
|
|
73662
|
-
|
|
73697
|
+
activeDropdown: activeDropdown,
|
|
73698
|
+
}), "$size": size, "$activeDropdown": activeDropdown, children: jsxRuntime.jsxs(DivWrapperSC, { children: [iconPrefix && (jsxRuntime.jsx(DivIconPrefixSC, { "$size": size, children: iconPrefix })), jsxRuntime.jsx(InputSC, { ...rest, ref: ref, disabled: disabled, "$size": size }), iconSuffix && (jsxRuntime.jsx(DivIconSuffixSC, { "$size": size, "$disabled": disabled, children: iconSuffix }))] }) }));
|
|
73663
73699
|
});
|
|
73664
73700
|
FISSelectItem.displayName = "FISSelectItem";
|
|
73665
73701
|
|
|
@@ -73667,11 +73703,25 @@ function isMenuSize(value) {
|
|
|
73667
73703
|
return value === "sm" || value === "md";
|
|
73668
73704
|
}
|
|
73669
73705
|
|
|
73670
|
-
const FISSelect = React.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) => {
|
|
73706
|
+
const FISSelect = React.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) => {
|
|
73671
73707
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
73672
73708
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
73673
73709
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
73710
|
+
const [cachedSelectedItem, setCachedSelectedItem] = React.useState(null);
|
|
73674
73711
|
const isSelectingRef = React.useRef(false);
|
|
73712
|
+
const inputRef = React.useRef(null);
|
|
73713
|
+
// Expose focus and openDropdown methods via ref
|
|
73714
|
+
React.useImperativeHandle(ref, () => ({
|
|
73715
|
+
...inputRef.current,
|
|
73716
|
+
openDropdown: () => {
|
|
73717
|
+
if (!disabled && !isOpen) {
|
|
73718
|
+
setIsOpen(true);
|
|
73719
|
+
if (onOpen) {
|
|
73720
|
+
onOpen();
|
|
73721
|
+
}
|
|
73722
|
+
}
|
|
73723
|
+
},
|
|
73724
|
+
}));
|
|
73675
73725
|
const popperOptions = React.useMemo(() => ({
|
|
73676
73726
|
modifiers: [
|
|
73677
73727
|
{ name: "preventOverflow", options: { padding: 0, altAxis: true } },
|
|
@@ -73709,17 +73759,39 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73709
73759
|
: `Selected ${count.toString().padStart(2, "0")} option${count !== 1 ? "s" : ""}`;
|
|
73710
73760
|
}
|
|
73711
73761
|
else {
|
|
73712
|
-
|
|
73713
|
-
|
|
73714
|
-
|
|
73715
|
-
|
|
73762
|
+
if (value) {
|
|
73763
|
+
const firstItem = selectedItems[0];
|
|
73764
|
+
if (firstItem) {
|
|
73765
|
+
if (!cachedSelectedItem ||
|
|
73766
|
+
cachedSelectedItem.value !== firstItem.value) {
|
|
73767
|
+
setCachedSelectedItem(firstItem);
|
|
73768
|
+
}
|
|
73769
|
+
return displayValue?.(firstItem) || firstItem.label;
|
|
73770
|
+
}
|
|
73771
|
+
if (cachedSelectedItem) {
|
|
73772
|
+
return (displayValue?.(cachedSelectedItem) || cachedSelectedItem.label);
|
|
73773
|
+
}
|
|
73774
|
+
if (displayValue) {
|
|
73775
|
+
return displayValue({ label: String(value), value });
|
|
73776
|
+
}
|
|
73777
|
+
return String(value);
|
|
73778
|
+
}
|
|
73779
|
+
return "";
|
|
73716
73780
|
}
|
|
73717
|
-
}, [
|
|
73781
|
+
}, [
|
|
73782
|
+
multi,
|
|
73783
|
+
value,
|
|
73784
|
+
multiDisplayText,
|
|
73785
|
+
selectedItems,
|
|
73786
|
+
displayValue,
|
|
73787
|
+
cachedSelectedItem,
|
|
73788
|
+
]);
|
|
73718
73789
|
const handleToggle = React.useCallback(() => {
|
|
73719
73790
|
if (!disabled) {
|
|
73720
73791
|
setIsOpen((prev) => !prev);
|
|
73792
|
+
onOpen?.();
|
|
73721
73793
|
}
|
|
73722
|
-
}, [disabled]);
|
|
73794
|
+
}, [disabled, onOpen]);
|
|
73723
73795
|
const handleOptionRemove = React.useCallback((option) => {
|
|
73724
73796
|
if (multi && Array.isArray(value)) {
|
|
73725
73797
|
const newValues = value.filter((v) => v !== option.value);
|
|
@@ -73814,7 +73886,14 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73814
73886
|
return () => clearTimeout(timer);
|
|
73815
73887
|
}
|
|
73816
73888
|
}, [isOpen, multi]);
|
|
73817
|
-
|
|
73889
|
+
const renderSelectInput = () => {
|
|
73890
|
+
const selectInput = (jsxRuntime.jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, "$hasValue": !!value, children: jsxRuntime.jsx(FISSelectItem, { ...restProps, onBlur: handleBlur, ref: inputRef, size: size, placeholder: placeholder, iconSuffix: isOpen ? jsxRuntime.jsx(ArrowUpIcon, {}) : jsxRuntime.jsx(ArrowDownIcon, {}), value: computedDisplayValue, disabled: disabled, activeDropdown: isOpen, negative: negative }) }));
|
|
73891
|
+
if (tooltipTitle) {
|
|
73892
|
+
return (jsxRuntime.jsx(FISTooltip, { title: tooltipTitle, variant: tooltipVariant, smartPlacement: true, children: selectInput }));
|
|
73893
|
+
}
|
|
73894
|
+
return selectInput;
|
|
73895
|
+
};
|
|
73896
|
+
return (jsxRuntime.jsxs(DivWrapperSC$1, { className: className, style: style, children: [(textLabel || iconLabel) && (jsxRuntime.jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), renderSelectInput(), message && (jsxRuntime.jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && !hideChip && Array.isArray(value) && value.length > 0 && (jsxRuntime.jsx(SelectedTagsWrapper, { children: jsxRuntime.jsx(MultipleValue, { options: selectedItems, onRemove: handleOptionRemove }) })), isOpen && (jsxRuntime.jsx(Portal, { portal: portal, children: jsxRuntime.jsx(DivDropdownMenuSC, { ref: setPopperElement, style: {
|
|
73818
73897
|
...styles.popper,
|
|
73819
73898
|
width: referenceElement?.offsetWidth,
|
|
73820
73899
|
zIndex: 9999,
|
|
@@ -73905,8 +73984,11 @@ const PaginationAntdSC = styled(Pagination) `
|
|
|
73905
73984
|
&.ant-pagination-disabled .ant-pagination-next,
|
|
73906
73985
|
&.ant-pagination-disabled .ant-pagination-prev {
|
|
73907
73986
|
color: ${getTheme("com/button/disable/icon-color")} !important;
|
|
73908
|
-
border-color: ${getTheme("com/button/disable/stroke-color")} !important;
|
|
73909
73987
|
background-color: transparent !important;
|
|
73988
|
+
|
|
73989
|
+
button {
|
|
73990
|
+
border: none !important;
|
|
73991
|
+
}
|
|
73910
73992
|
}
|
|
73911
73993
|
|
|
73912
73994
|
&.ant-pagination-disabled .ant-pagination-item-active {
|