fis-component 0.0.71 → 0.0.73
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 +33 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Combobox/types.d.ts +1 -0
- package/dist/cjs/types/src/components/MenuSelect/styles.d.ts +3 -1
- package/dist/cjs/types/src/components/MenuSelect/types.d.ts +1 -0
- package/dist/cjs/types/src/components/Select/Select.stories.d.ts +2 -0
- package/dist/cjs/types/src/components/Select/types.d.ts +1 -0
- package/dist/esm/index.js +33 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Combobox/types.d.ts +1 -0
- package/dist/esm/types/src/components/MenuSelect/styles.d.ts +3 -1
- package/dist/esm/types/src/components/MenuSelect/types.d.ts +1 -0
- package/dist/esm/types/src/components/Select/Select.stories.d.ts +2 -0
- package/dist/esm/types/src/components/Select/types.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare const DivContainerSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
1
|
+
export declare const DivContainerSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
|
+
$maxHeight?: string | number;
|
|
3
|
+
}>> & string;
|
|
2
4
|
export declare const DivLoaderSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
5
|
export declare const DivIconDataSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
6
|
export declare const PTitleSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
@@ -13,3 +13,5 @@ export declare const Loading: import("@storybook/core/csf").AnnotatedStoryFn<imp
|
|
|
13
13
|
export declare const LargeSize: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
14
14
|
export declare const Disabled: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
15
15
|
export declare const NumberType: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, NumberSelectStoryProps>;
|
|
16
|
+
export declare const CustomMaxHeight: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
17
|
+
export declare const TextEllipsis: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
@@ -18,6 +18,7 @@ type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omi
|
|
|
18
18
|
multiDisplayText?: (count: number) => string;
|
|
19
19
|
renderOption?: (option: SelectOption<T>) => React.ReactNode;
|
|
20
20
|
portal?: boolean;
|
|
21
|
+
maxHeight?: string | number;
|
|
21
22
|
};
|
|
22
23
|
export type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
|
|
23
24
|
multi?: false;
|
package/dist/esm/index.js
CHANGED
|
@@ -66317,7 +66317,11 @@ const DivContainerSC$4 = styled.div `
|
|
|
66317
66317
|
flex-direction: column;
|
|
66318
66318
|
width: unset;
|
|
66319
66319
|
min-width: ${getTheme("com/menu/min-width")};
|
|
66320
|
-
max-height: ${
|
|
66320
|
+
max-height: ${({ $maxHeight }) => $maxHeight
|
|
66321
|
+
? typeof $maxHeight === "number"
|
|
66322
|
+
? `${$maxHeight}px`
|
|
66323
|
+
: $maxHeight
|
|
66324
|
+
: getTheme("com/menu/max-height")};
|
|
66321
66325
|
border-radius: ${getTheme("com/menu/corner-radius")};
|
|
66322
66326
|
border: ${getTheme("com/menu/border/stroke-width")} solid
|
|
66323
66327
|
${getTheme("com/menu/border/color-stroke")};
|
|
@@ -66425,6 +66429,7 @@ const DivContentSC$2 = styled.div `
|
|
|
66425
66429
|
flex-direction: column;
|
|
66426
66430
|
flex: 1;
|
|
66427
66431
|
gap: ${getTheme("com/menu/item/vertical-gap")};
|
|
66432
|
+
min-width: 0;
|
|
66428
66433
|
`;
|
|
66429
66434
|
const DivPrefixIconSC = styled.div `
|
|
66430
66435
|
display: flex;
|
|
@@ -66484,6 +66489,10 @@ const DivPrefixIconSC = styled.div `
|
|
|
66484
66489
|
`;
|
|
66485
66490
|
const PTitleSC$1 = styled.p `
|
|
66486
66491
|
margin: 0;
|
|
66492
|
+
white-space: nowrap;
|
|
66493
|
+
overflow: hidden;
|
|
66494
|
+
text-overflow: ellipsis;
|
|
66495
|
+
min-width: 0;
|
|
66487
66496
|
|
|
66488
66497
|
${(props) => {
|
|
66489
66498
|
switch (props.$type) {
|
|
@@ -66535,6 +66544,10 @@ const PTitleSC$1 = styled.p `
|
|
|
66535
66544
|
`;
|
|
66536
66545
|
const PDescriptionSC = styled.p `
|
|
66537
66546
|
margin: 0;
|
|
66547
|
+
white-space: nowrap;
|
|
66548
|
+
overflow: hidden;
|
|
66549
|
+
text-overflow: ellipsis;
|
|
66550
|
+
min-width: 0;
|
|
66538
66551
|
|
|
66539
66552
|
${(props) => {
|
|
66540
66553
|
switch (props.$type) {
|
|
@@ -67350,10 +67363,16 @@ const DivContentSC$1 = styled.div `
|
|
|
67350
67363
|
padding-bottom: ${getTheme("sem/dimension/padding/2xs")};
|
|
67351
67364
|
padding-left: ${getTheme("com/menu/group-label/horizontal-padding")};
|
|
67352
67365
|
gap: 8px;
|
|
67366
|
+
min-width: 0;
|
|
67353
67367
|
`;
|
|
67354
67368
|
const SectionLabel = styled.span `
|
|
67355
67369
|
${getTheme("Subheading/Sm")}
|
|
67356
67370
|
color: ${getTheme("com/menu/group-label/color-text")};
|
|
67371
|
+
white-space: nowrap;
|
|
67372
|
+
overflow: hidden;
|
|
67373
|
+
text-overflow: ellipsis;
|
|
67374
|
+
min-width: 0;
|
|
67375
|
+
flex: 1;
|
|
67357
67376
|
`;
|
|
67358
67377
|
const ActionLink = styled.a `
|
|
67359
67378
|
${getTheme("Paragraph/Sm")};
|
|
@@ -67377,7 +67396,7 @@ const FISMenuSection = ({ label, withAction = false, actionText, actionLabel = f
|
|
|
67377
67396
|
};
|
|
67378
67397
|
FISMenuSection.displayName = "FISMenuSection";
|
|
67379
67398
|
|
|
67380
|
-
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", }) => {
|
|
67399
|
+
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, }) => {
|
|
67381
67400
|
const [localSearch, setLocalSearch] = useState(searchValue);
|
|
67382
67401
|
useEffect(() => {
|
|
67383
67402
|
setLocalSearch(searchValue);
|
|
@@ -67458,7 +67477,7 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67458
67477
|
onClickMenu?.();
|
|
67459
67478
|
}
|
|
67460
67479
|
};
|
|
67461
|
-
return (jsxs(DivContainerSC$4, { className: className, children: [showInput && !combobox && (jsx(DivSearchSC, { children: jsx(FISInputText, { iconPrefix: jsx(SearchIcon, {}), placeholder: placeholder, value: search, onChange: handleSearchChange }) })), (shouldShowNoResult || noResult) && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoResultIcon, {}) }), jsx(PTitleSC$2, { children: noResultText })] })), noData && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoDataIcon, {}) }), jsx(PTitleSC$2, { children: noDataText })] })), loading && (jsxs(DivLoaderSC, { children: [jsx(FISProgressCircular, { size: size, variant: "indeterminate" }), jsx(PTitleSC$2, { children: loadingText })] })), !shouldShowNoResult && !noData && !loading && (jsxs(Fragment, { children: [jsx(MenuContent, { "$removeSelectedGroup": !!removeSelectedGroup, 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(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(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => onChangeSelected?.([]), type: "select", iconPrefix: jsx(RemoveIcon, {}), negative: true }, idx))) }) }))] }))] }));
|
|
67480
|
+
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 }) })), (shouldShowNoResult || noResult) && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoResultIcon, {}) }), jsx(PTitleSC$2, { children: noResultText })] })), noData && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoDataIcon, {}) }), jsx(PTitleSC$2, { children: noDataText })] })), loading && (jsxs(DivLoaderSC, { children: [jsx(FISProgressCircular, { size: size, variant: "indeterminate" }), jsx(PTitleSC$2, { children: loadingText })] })), !shouldShowNoResult && !noData && !loading && (jsxs(Fragment, { children: [jsx(MenuContent, { "$removeSelectedGroup": !!removeSelectedGroup, 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(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(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => onChangeSelected?.([]), type: "select", iconPrefix: jsx(RemoveIcon, {}), negative: true }, idx))) }) }))] }))] }));
|
|
67462
67481
|
};
|
|
67463
67482
|
FISMenuSelect.displayName = "FISMenuSelect";
|
|
67464
67483
|
|
|
@@ -70753,7 +70772,7 @@ const MultipleValue = ({ options, onRemove }) => {
|
|
|
70753
70772
|
return (jsxs(DivChipButtonWrapperSC, { ref: containerRef, children: [options.map((option, index) => (jsx(DivChipButtonSC, { "$isVisible": isVisible(option), children: jsx(FISChipButton, { ref: (el) => (tagRefs.current[index] = el), size: "xs", label: option.label, closeable: true, onClickClose: () => handleRemove(option) }, `${option.value}-${index}`) }))), hiddenTagCount > 0 && (jsx(DivTagSC, { "$isVisible": true, children: jsx(FISChipButton, { label: `+${hiddenTagCount}`, size: "xs" }) }))] }));
|
|
70754
70773
|
};
|
|
70755
70774
|
|
|
70756
|
-
const FISCombobox = forwardRef(({ className, options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, noResultText = "Không tìm thấy kết quả", ...restProps }, ref) => {
|
|
70775
|
+
const FISCombobox = forwardRef(({ className, options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, noResultText = "Không tìm thấy kết quả", maxHeight, ...restProps }, ref) => {
|
|
70757
70776
|
const [isOpen, setIsOpen] = useState(false);
|
|
70758
70777
|
const [searchValue, setSearchValue] = useState("");
|
|
70759
70778
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
@@ -70859,7 +70878,7 @@ const FISCombobox = forwardRef(({ className, options, value, disabled = false, t
|
|
|
70859
70878
|
}, [filteredOptions, searchValue]);
|
|
70860
70879
|
return (jsxs(DivWrapperSC$3, { className: className, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsx(DivInputWrapperSC$2, { ref: setReferenceElement, onClick: handleToggle, children: jsx(FISInputField, { ...restProps, ref: ref, iconSuffix: isOpen ? jsx(ArrowUpIcon, {}) : jsx(ArrowDownIcon, {}), value: isOpen && searchValue !== undefined
|
|
70861
70880
|
? searchValue
|
|
70862
|
-
: computedDisplayValue, disabled: disabled, onClickSuffix: handleToggle, onChange: handleInputChange, onKeyDown: handleInputKeyDown, "$isPointer": true }) }), message && (jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && value.length > 0 && (jsx(SelectedTagsWrapper$1, { children: jsx(MultipleValue, { options: selectedOptions, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { children: jsx(DivDropdownMenuSC$1, { ref: setPopperElement, style: { ...styles.popper, width: referenceElement?.offsetWidth }, ...attributes.popper, children: jsx(FISMenuSelect, { groups: filteredOptions, placeholder: placeholderSearch, loading: loading, multi: multi, combobox: true, noResult: hasNoResults, noResultText: noResultText, selectedValues: multi ? value : value ? [value] : [], onChangeSelected: (values) => {
|
|
70881
|
+
: computedDisplayValue, disabled: disabled, onClickSuffix: handleToggle, onChange: handleInputChange, onKeyDown: handleInputKeyDown, "$isPointer": true }) }), message && (jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && value.length > 0 && (jsx(SelectedTagsWrapper$1, { children: jsx(MultipleValue, { options: selectedOptions, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { children: jsx(DivDropdownMenuSC$1, { ref: setPopperElement, style: { ...styles.popper, width: referenceElement?.offsetWidth }, ...attributes.popper, children: jsx(FISMenuSelect, { groups: filteredOptions, placeholder: placeholderSearch, loading: loading, multi: multi, combobox: true, noResult: hasNoResults, noResultText: noResultText, maxHeight: maxHeight, selectedValues: multi ? value : value ? [value] : [], onChangeSelected: (values) => {
|
|
70863
70882
|
if (multi) {
|
|
70864
70883
|
onChange(values);
|
|
70865
70884
|
}
|
|
@@ -71800,7 +71819,7 @@ const DivSuffixIconSC = styled.div `
|
|
|
71800
71819
|
`;
|
|
71801
71820
|
|
|
71802
71821
|
const { RangePicker } = DatePicker;
|
|
71803
|
-
const FISDateRange = ({ placeholder = ["dd/mm/yyyy", "dd/mm/yyyy"], label, required
|
|
71822
|
+
const FISDateRange = ({ placeholder = ["dd/mm/yyyy", "dd/mm/yyyy"], label, required, message, negative, positive, disabled, ...rest }) => {
|
|
71804
71823
|
const [open, setOpen] = useState(false);
|
|
71805
71824
|
const handleOpenCalendar = () => {
|
|
71806
71825
|
setOpen(!open);
|
|
@@ -73110,6 +73129,10 @@ const InputSC = styled.input `
|
|
|
73110
73129
|
border: none;
|
|
73111
73130
|
background: transparent;
|
|
73112
73131
|
outline: none;
|
|
73132
|
+
white-space: nowrap;
|
|
73133
|
+
overflow: hidden;
|
|
73134
|
+
text-overflow: ellipsis;
|
|
73135
|
+
min-width: 0;
|
|
73113
73136
|
|
|
73114
73137
|
${(props) => {
|
|
73115
73138
|
switch (props.$size) {
|
|
@@ -73182,6 +73205,7 @@ const DivWrapperSC = styled.div `
|
|
|
73182
73205
|
justify-content: space-between;
|
|
73183
73206
|
padding-right: ${getTheme("com/select/field/right-padding")};
|
|
73184
73207
|
padding-left: ${getTheme("com/select/field/left-padding")};
|
|
73208
|
+
min-width: 0;
|
|
73185
73209
|
`;
|
|
73186
73210
|
const DivIconPrefixSC = styled.div `
|
|
73187
73211
|
display: flex;
|
|
@@ -73367,7 +73391,7 @@ function isMenuSize(value) {
|
|
|
73367
73391
|
return value === "sm" || value === "md";
|
|
73368
73392
|
}
|
|
73369
73393
|
|
|
73370
|
-
const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal, ...restProps }, ref) => {
|
|
73394
|
+
const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal, maxHeight, ...restProps }, ref) => {
|
|
73371
73395
|
const [isOpen, setIsOpen] = useState(false);
|
|
73372
73396
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
73373
73397
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -73478,6 +73502,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73478
73502
|
onClickMenu: handleMenuClick,
|
|
73479
73503
|
searchValue,
|
|
73480
73504
|
onSearchChange,
|
|
73505
|
+
maxHeight,
|
|
73481
73506
|
...restProps,
|
|
73482
73507
|
}), [
|
|
73483
73508
|
options,
|
|
@@ -73490,6 +73515,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73490
73515
|
handleMenuClick,
|
|
73491
73516
|
searchValue,
|
|
73492
73517
|
onSearchChange,
|
|
73518
|
+
maxHeight,
|
|
73493
73519
|
restProps,
|
|
73494
73520
|
]);
|
|
73495
73521
|
useEffect(() => {
|