fis-component 0.0.56 → 0.0.58
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 +20 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Combobox/types.d.ts +1 -1
- package/dist/cjs/types/src/components/MenuSelect/types.d.ts +3 -3
- package/dist/cjs/types/src/components/Select/Select.stories.d.ts +2 -0
- package/dist/cjs/types/src/components/Select/index.d.ts +1 -1
- package/dist/cjs/types/src/components/Select/types.d.ts +5 -5
- package/dist/esm/index.js +20 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Combobox/types.d.ts +1 -1
- package/dist/esm/types/src/components/MenuSelect/types.d.ts +3 -3
- package/dist/esm/types/src/components/Select/Select.stories.d.ts +2 -0
- package/dist/esm/types/src/components/Select/index.d.ts +1 -1
- package/dist/esm/types/src/components/Select/types.d.ts +5 -5
- package/dist/index.d.ts +10 -10
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface MenuItem {
|
|
2
2
|
label: string;
|
|
3
3
|
description?: string;
|
|
4
|
-
value: string;
|
|
4
|
+
value: string | number;
|
|
5
5
|
}
|
|
6
6
|
export interface MenuGroup {
|
|
7
7
|
groupLabel?: string;
|
|
@@ -16,8 +16,8 @@ export interface MenuProps {
|
|
|
16
16
|
multi?: boolean;
|
|
17
17
|
searchValue?: string;
|
|
18
18
|
onSearchChange?: (value: string) => void;
|
|
19
|
-
selectedValues?: string[];
|
|
20
|
-
onChangeSelected?: (values: string[]) => void;
|
|
19
|
+
selectedValues?: (string | number)[];
|
|
20
|
+
onChangeSelected?: (values: (string | number)[]) => void;
|
|
21
21
|
loading?: boolean;
|
|
22
22
|
noData?: boolean;
|
|
23
23
|
noResult?: boolean;
|
|
@@ -2,6 +2,7 @@ import { Meta } from "@storybook/react";
|
|
|
2
2
|
import { SelectProps } from "./types";
|
|
3
3
|
type SingleSelectStoryProps = SelectProps<string>;
|
|
4
4
|
type MultiSelectStoryProps = SelectProps<string>;
|
|
5
|
+
type NumberSelectStoryProps = SelectProps<number>;
|
|
5
6
|
declare const _default: Meta<SingleSelectStoryProps>;
|
|
6
7
|
export default _default;
|
|
7
8
|
export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
@@ -11,3 +12,4 @@ export declare const WithValidation: import("@storybook/core/csf").AnnotatedStor
|
|
|
11
12
|
export declare const Loading: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
12
13
|
export declare const LargeSize: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
13
14
|
export declare const Disabled: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
15
|
+
export declare const NumberType: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, NumberSelectStoryProps>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SelectProps } from "./types";
|
|
2
|
-
declare const FISSelect: import("react").ForwardRefExoticComponent<SelectProps<string> & import("react").RefAttributes<HTMLInputElement>>;
|
|
2
|
+
declare const FISSelect: import("react").ForwardRefExoticComponent<SelectProps<string | number> & import("react").RefAttributes<HTMLInputElement>>;
|
|
3
3
|
export default FISSelect;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputLabelProps } from "../Input/InputLabel";
|
|
2
2
|
import { MenuProps } from "../MenuSelect/types";
|
|
3
3
|
import { SelectFieldProps } from "../SelectItem";
|
|
4
|
-
export interface SelectOption<T = string> {
|
|
4
|
+
export interface SelectOption<T = string | number> {
|
|
5
5
|
groupLabel?: string;
|
|
6
6
|
items: {
|
|
7
7
|
label: string;
|
|
@@ -9,7 +9,7 @@ export interface SelectOption<T = string> {
|
|
|
9
9
|
value: T;
|
|
10
10
|
}[];
|
|
11
11
|
}
|
|
12
|
-
type BaseSelectProps<T> = Partial<InputLabelProps> & Omit<MenuProps, "groups" | "multi" | "selectedValues" | "onChangeSelected" | "onClickMenu" | "size"> & Omit<SelectFieldProps, "value" | "onChange"> & {
|
|
12
|
+
type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omit<MenuProps, "groups" | "multi" | "selectedValues" | "onChangeSelected" | "onClickMenu" | "size"> & Omit<SelectFieldProps, "value" | "onChange"> & {
|
|
13
13
|
options: SelectOption<T>[];
|
|
14
14
|
message?: string;
|
|
15
15
|
disabled?: boolean;
|
|
@@ -19,17 +19,17 @@ type BaseSelectProps<T> = Partial<InputLabelProps> & Omit<MenuProps, "groups" |
|
|
|
19
19
|
renderOption?: (option: SelectOption<T>) => React.ReactNode;
|
|
20
20
|
portal?: boolean;
|
|
21
21
|
};
|
|
22
|
-
export type SingleSelectProps<T> = BaseSelectProps<T> & {
|
|
22
|
+
export type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
|
|
23
23
|
multi?: false;
|
|
24
24
|
value: T;
|
|
25
25
|
onChange: (value: T) => void;
|
|
26
26
|
displayValue?: (value: SelectOption<T>) => string;
|
|
27
27
|
};
|
|
28
|
-
export type MultiSelectProps<T> = BaseSelectProps<T> & {
|
|
28
|
+
export type MultiSelectProps<T extends string | number> = BaseSelectProps<T> & {
|
|
29
29
|
multi: true;
|
|
30
30
|
value: T[];
|
|
31
31
|
onChange: (value: T[]) => void;
|
|
32
32
|
displayValue?: (value: SelectOption<T>[]) => string;
|
|
33
33
|
};
|
|
34
|
-
export type SelectProps<T> = SingleSelectProps<T> | MultiSelectProps<T>;
|
|
34
|
+
export type SelectProps<T extends string | number> = SingleSelectProps<T> | MultiSelectProps<T>;
|
|
35
35
|
export {};
|
package/dist/esm/index.js
CHANGED
|
@@ -66337,7 +66337,7 @@ const PTitleSC$2 = styled.p `
|
|
|
66337
66337
|
${getTheme("Paragraph/Sm")}
|
|
66338
66338
|
color: ${getTheme("com/menu/item/action/label/color-text/default")};
|
|
66339
66339
|
`;
|
|
66340
|
-
styled.div `
|
|
66340
|
+
const DivWrapperMenuSC = styled.div `
|
|
66341
66341
|
display: flex;
|
|
66342
66342
|
flex-direction: column;
|
|
66343
66343
|
height: 100%;
|
|
@@ -67448,7 +67448,7 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67448
67448
|
onClickMenu?.();
|
|
67449
67449
|
}
|
|
67450
67450
|
};
|
|
67451
|
-
return (
|
|
67451
|
+
return (jsx(DivContainerSC$4, { className: className, children: jsxs(DivWrapperMenuSC, { 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))) }) }))] }))] }) }));
|
|
67452
67452
|
};
|
|
67453
67453
|
FISMenuSelect.displayName = "FISMenuSelect";
|
|
67454
67454
|
|
|
@@ -70912,6 +70912,19 @@ const FISInputTime = forwardRef((props, ref) => {
|
|
|
70912
70912
|
const [inputValue, setInputValue] = useState("");
|
|
70913
70913
|
const [timeValue, setTimeValue] = useState(null);
|
|
70914
70914
|
const [isOpen, setIsOpen] = useState(false);
|
|
70915
|
+
const containerRef = useRef(null);
|
|
70916
|
+
useEffect(() => {
|
|
70917
|
+
const handleClickOutside = (event) => {
|
|
70918
|
+
if (containerRef.current &&
|
|
70919
|
+
!containerRef.current.contains(event.target)) {
|
|
70920
|
+
setIsOpen(false);
|
|
70921
|
+
}
|
|
70922
|
+
};
|
|
70923
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
70924
|
+
return () => {
|
|
70925
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
70926
|
+
};
|
|
70927
|
+
}, []);
|
|
70915
70928
|
const handleTimeChange = (time) => {
|
|
70916
70929
|
setTimeValue(time);
|
|
70917
70930
|
setInputValue(time ? time.format(format) : "");
|
|
@@ -70936,7 +70949,7 @@ const FISInputTime = forwardRef((props, ref) => {
|
|
|
70936
70949
|
setIsOpen(open);
|
|
70937
70950
|
}
|
|
70938
70951
|
};
|
|
70939
|
-
return (jsxs(DivContainerSC$2, { className: className, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputTimeSC, { children: [jsx(FISInputField, { ...rest, ref: ref, typeSuffix: "icon", iconSuffix: jsx(TimeIcon, {}), negative: negative, value: inputValue, onChange: handleInputChange, onFocus: handleClickInput, onClickSuffix: handleClickInput }), jsx(HiddenTimePickerSC, { format: format, value: timeValue, onChange: handleTimeChange, open: isOpen, onOpenChange: handleOpenChange, getPopupContainer: (triggerNode) => triggerNode.parentElement || document.body })] }), message && (jsx(DivHintWrapperSC, { children: jsx(SpanHintSC, { className: classNames({
|
|
70952
|
+
return (jsxs(DivContainerSC$2, { className: className, ref: containerRef, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputTimeSC, { children: [jsx(FISInputField, { ...rest, ref: ref, typeSuffix: "icon", iconSuffix: jsx(TimeIcon, {}), negative: negative, value: inputValue, onChange: handleInputChange, onFocus: handleClickInput, onClickSuffix: handleClickInput }), jsx(HiddenTimePickerSC, { format: format, value: timeValue, onChange: handleTimeChange, open: isOpen, onOpenChange: handleOpenChange, getPopupContainer: (triggerNode) => triggerNode.parentElement || document.body })] }), message && (jsx(DivHintWrapperSC, { children: jsx(SpanHintSC, { className: classNames({
|
|
70940
70953
|
disabled: disabled,
|
|
70941
70954
|
negative: negative,
|
|
70942
70955
|
positive: positive,
|
|
@@ -73291,7 +73304,7 @@ function isMenuSize(value) {
|
|
|
73291
73304
|
return value === "sm" || value === "md";
|
|
73292
73305
|
}
|
|
73293
73306
|
|
|
73294
|
-
const FISSelect = forwardRef(({ className, 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) => {
|
|
73307
|
+
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) => {
|
|
73295
73308
|
const [isOpen, setIsOpen] = useState(false);
|
|
73296
73309
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
73297
73310
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -73348,9 +73361,6 @@ const FISSelect = forwardRef(({ className, size = "md", options, value, disabled
|
|
|
73348
73361
|
const computedDisplayValue = useMemo$1(() => {
|
|
73349
73362
|
if (multi) {
|
|
73350
73363
|
const count = value.length;
|
|
73351
|
-
if (count === 0) {
|
|
73352
|
-
return "";
|
|
73353
|
-
}
|
|
73354
73364
|
return multiDisplayText
|
|
73355
73365
|
? multiDisplayText(count)
|
|
73356
73366
|
: `Selected ${count.toString().padStart(2, "0")} option${count !== 1 ? "s" : ""}`;
|
|
@@ -73426,7 +73436,7 @@ const FISSelect = forwardRef(({ className, size = "md", options, value, disabled
|
|
|
73426
73436
|
document.addEventListener("mousedown", handleClickOutside);
|
|
73427
73437
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
73428
73438
|
}, [referenceElement, popperElement]);
|
|
73429
|
-
return (jsxs(DivWrapperSC$1, { className: className, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, children: jsx(FISSelectItem, { ...restProps, ref: ref, size: size, iconSuffix: isOpen ? jsx(ArrowUpIcon, {}) : jsx(ArrowDownIcon, {}), value: computedDisplayValue, disabled: disabled, activeDropdown: isOpen }) }), message && (jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && value.length > 0 && (jsx(SelectedTagsWrapper, { children: jsx(MultipleValue, { options: selectedItems, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { portal: portal, children: jsx(DivDropdownMenuSC, { ref: setPopperElement, style: {
|
|
73439
|
+
return (jsxs(DivWrapperSC$1, { className: className, style: style, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, children: jsx(FISSelectItem, { ...restProps, ref: ref, size: size, iconSuffix: isOpen ? jsx(ArrowUpIcon, {}) : jsx(ArrowDownIcon, {}), value: computedDisplayValue, disabled: disabled, activeDropdown: isOpen }) }), message && (jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && value.length > 0 && (jsx(SelectedTagsWrapper, { children: jsx(MultipleValue, { options: selectedItems, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { portal: portal, children: jsx(DivDropdownMenuSC, { ref: setPopperElement, style: {
|
|
73430
73440
|
...styles.popper,
|
|
73431
73441
|
width: referenceElement?.offsetWidth,
|
|
73432
73442
|
zIndex: 9999,
|
|
@@ -73450,7 +73460,6 @@ const useToast = () => {
|
|
|
73450
73460
|
return context;
|
|
73451
73461
|
};
|
|
73452
73462
|
|
|
73453
|
-
// import FISSelect from "../Select";
|
|
73454
73463
|
const PaginationAntdSC = styled(Pagination) `
|
|
73455
73464
|
display: flex;
|
|
73456
73465
|
align-items: center;
|
|
@@ -73553,6 +73562,7 @@ const PaginationAntdSC = styled(Pagination) `
|
|
|
73553
73562
|
`}
|
|
73554
73563
|
`;
|
|
73555
73564
|
const DivPaginationContainer = styled.div `
|
|
73565
|
+
width: 100%;
|
|
73556
73566
|
display: flex;
|
|
73557
73567
|
align-items: center;
|
|
73558
73568
|
justify-content: space-between;
|
|
@@ -73574,10 +73584,6 @@ const SpanTotalSC = styled.span `
|
|
|
73574
73584
|
${getTheme("Paragraph/Sm")};
|
|
73575
73585
|
color: ${getTheme("com/pagination/range-number/label/color-text")} !important;
|
|
73576
73586
|
`;
|
|
73577
|
-
// export const SelectPageSizeSC = styled(FISSelect)`
|
|
73578
|
-
// // fixed
|
|
73579
|
-
// width: 100px;
|
|
73580
|
-
// `;
|
|
73581
73587
|
|
|
73582
73588
|
const LIMIT_DEFAULT = 10;
|
|
73583
73589
|
const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minimize, recordCounted, onIconPageRecordClick, showTotal, ...rest }) => {
|
|
@@ -73609,7 +73615,7 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
|
|
|
73609
73615
|
}
|
|
73610
73616
|
return originalElement;
|
|
73611
73617
|
};
|
|
73612
|
-
return (jsxs(DivPaginationContainer, { children: [jsx(SpanTotalSC, { children: showTotal ? showTotal(total, rangeRecords) : defaultShowTotal }), jsxs(DivPaginationContent, { children: [jsx(PaginationAntdSC, { ...mergedProps, "$minimize": Boolean(minimize), showSizeChanger: false, itemRender: itemRender }), jsx(FISSelect, { size: "xs", options: [
|
|
73618
|
+
return (jsxs(DivPaginationContainer, { children: [jsx(SpanTotalSC, { children: showTotal ? showTotal(total, rangeRecords) : defaultShowTotal }), jsxs(DivPaginationContent, { children: [jsx(PaginationAntdSC, { ...mergedProps, "$minimize": Boolean(minimize), showSizeChanger: false, itemRender: itemRender }), jsx(FISSelect, { style: { width: "94px" }, size: "xs", options: [
|
|
73613
73619
|
{
|
|
73614
73620
|
groupLabel: "",
|
|
73615
73621
|
items: (rest.pageSizeOptions || [10, 20, 50, 100]).map((size) => ({
|