fis-component 0.0.57 → 0.0.59
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 +21 -9
- 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/Input/InputDate/index.d.ts +10 -0
- 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 +21 -9
- 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/Input/InputDate/index.d.ts +10 -0
- 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 +21 -11
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InputFieldProps } from "../InputField";
|
|
2
|
+
import dayjs from "dayjs";
|
|
2
3
|
import { InputLabelProps } from "../InputLabel";
|
|
3
4
|
export interface InputDateProps extends Omit<InputFieldProps, "value" | "onChange">, Partial<InputLabelProps> {
|
|
4
5
|
/**Date value*/
|
|
@@ -11,6 +12,15 @@ export interface InputDateProps extends Omit<InputFieldProps, "value" | "onChang
|
|
|
11
12
|
positive?: boolean;
|
|
12
13
|
/** Handle on change action */
|
|
13
14
|
onChange?: (date: Date | null) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Function that returns the HTML element to render the popup container into.
|
|
17
|
+
* Useful for controlling where the date picker dropdown is attached in the DOM.
|
|
18
|
+
*/
|
|
19
|
+
getPopupContainer?: () => HTMLElement;
|
|
20
|
+
/**The minimum selectable date. Dates before this value will be disabled.*/
|
|
21
|
+
minDate?: dayjs.Dayjs | undefined;
|
|
22
|
+
/**The maximum selectable date. Dates after this value will be disabled.*/
|
|
23
|
+
maxDate?: dayjs.Dayjs | undefined;
|
|
14
24
|
}
|
|
15
25
|
declare const FISInputDate: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
26
|
export default FISInputDate;
|
|
@@ -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
|
@@ -62950,6 +62950,7 @@ const FISTab = ({ children, active: propActive, defaultActive, size = "md", clas
|
|
|
62950
62950
|
return (jsxs(DivTabItemSC, { ref: (el) => (tabRefs.current[value] = el), "$isActive": activeKey === value, "$disabled": disabled, "$size": size, className: itemClassName, "$fullWidth": fullWidth, onClick: () => handleTabClick(value, disabled), children: [startIcon, title && jsx(SpanContentSC$1, { children: title }), endIcon] }, value));
|
|
62951
62951
|
}), jsx(DivActiveIndicatorSC, { style: indicatorStyle })] }), activeContent && jsx("div", { className: contentClassName, children: activeContent })] }));
|
|
62952
62952
|
};
|
|
62953
|
+
FISTab.displayName = "FISTab";
|
|
62953
62954
|
|
|
62954
62955
|
const DivSegmentedContainerSC = styled.div `
|
|
62955
62956
|
width: 100%;
|
|
@@ -66337,7 +66338,7 @@ const PTitleSC$2 = styled.p `
|
|
|
66337
66338
|
${getTheme("Paragraph/Sm")}
|
|
66338
66339
|
color: ${getTheme("com/menu/item/action/label/color-text/default")};
|
|
66339
66340
|
`;
|
|
66340
|
-
styled.div `
|
|
66341
|
+
const DivWrapperMenuSC = styled.div `
|
|
66341
66342
|
display: flex;
|
|
66342
66343
|
flex-direction: column;
|
|
66343
66344
|
height: 100%;
|
|
@@ -67448,7 +67449,7 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
|
|
|
67448
67449
|
onClickMenu?.();
|
|
67449
67450
|
}
|
|
67450
67451
|
};
|
|
67451
|
-
return (
|
|
67452
|
+
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
67453
|
};
|
|
67453
67454
|
FISMenuSelect.displayName = "FISMenuSelect";
|
|
67454
67455
|
|
|
@@ -70912,6 +70913,19 @@ const FISInputTime = forwardRef((props, ref) => {
|
|
|
70912
70913
|
const [inputValue, setInputValue] = useState("");
|
|
70913
70914
|
const [timeValue, setTimeValue] = useState(null);
|
|
70914
70915
|
const [isOpen, setIsOpen] = useState(false);
|
|
70916
|
+
const containerRef = useRef(null);
|
|
70917
|
+
useEffect(() => {
|
|
70918
|
+
const handleClickOutside = (event) => {
|
|
70919
|
+
if (containerRef.current &&
|
|
70920
|
+
!containerRef.current.contains(event.target)) {
|
|
70921
|
+
setIsOpen(false);
|
|
70922
|
+
}
|
|
70923
|
+
};
|
|
70924
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
70925
|
+
return () => {
|
|
70926
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
70927
|
+
};
|
|
70928
|
+
}, []);
|
|
70915
70929
|
const handleTimeChange = (time) => {
|
|
70916
70930
|
setTimeValue(time);
|
|
70917
70931
|
setInputValue(time ? time.format(format) : "");
|
|
@@ -70936,7 +70950,7 @@ const FISInputTime = forwardRef((props, ref) => {
|
|
|
70936
70950
|
setIsOpen(open);
|
|
70937
70951
|
}
|
|
70938
70952
|
};
|
|
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({
|
|
70953
|
+
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
70954
|
disabled: disabled,
|
|
70941
70955
|
negative: negative,
|
|
70942
70956
|
positive: positive,
|
|
@@ -70987,7 +71001,7 @@ function mergeRefs(...refs) {
|
|
|
70987
71001
|
}
|
|
70988
71002
|
|
|
70989
71003
|
const FISInputDate = forwardRef((props, ref) => {
|
|
70990
|
-
const { value, textLabel = "", iconLabel, required, message = "", disabled, negative, positive, format = "DD/MM/YYYY", onClickIconLabel, onChange, ...restProps } = props;
|
|
71004
|
+
const { value, textLabel = "", iconLabel, required, message = "", disabled, negative, positive, format = "DD/MM/YYYY", onClickIconLabel, onChange, getPopupContainer, minDate, maxDate, ...restProps } = props;
|
|
70991
71005
|
const [open, setOpen] = useState(false);
|
|
70992
71006
|
const [inputValue, setInputValue] = useState(value ? dayjs(value).format(format) : "");
|
|
70993
71007
|
const [dateValue, setDateValue] = useState(value ? dayjs(value) : null);
|
|
@@ -71030,7 +71044,7 @@ const FISInputDate = forwardRef((props, ref) => {
|
|
|
71030
71044
|
onChange?.(null);
|
|
71031
71045
|
}
|
|
71032
71046
|
};
|
|
71033
|
-
return (jsxs(DivWrapperSC$2, { children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputWrapperSC$1, { children: [jsx(FISInputField, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: jsx(DateIcon, {}), value: inputValue, negative: negative, disabled: disabled, onFocus: () => setOpen(true), onChange: handleInputChange, onClickSuffix: () => setOpen(true) }), jsx(HiddenDatePickerSC, { open: open, value: dateValue, onChange: (value) => handleChange(value), onOpenChange: handleOpenChange, format: format })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
|
|
71047
|
+
return (jsxs(DivWrapperSC$2, { children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputWrapperSC$1, { children: [jsx(FISInputField, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: jsx(DateIcon, {}), value: inputValue, negative: negative, disabled: disabled, onFocus: () => setOpen(true), onChange: handleInputChange, onClickSuffix: () => setOpen(true) }), jsx(HiddenDatePickerSC, { open: open, value: dateValue, onChange: (value) => handleChange(value), onOpenChange: handleOpenChange, format: format, getPopupContainer: getPopupContainer, minDate: minDate, maxDate: maxDate })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
|
|
71034
71048
|
disabled,
|
|
71035
71049
|
negative,
|
|
71036
71050
|
positive,
|
|
@@ -73348,9 +73362,6 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73348
73362
|
const computedDisplayValue = useMemo$1(() => {
|
|
73349
73363
|
if (multi) {
|
|
73350
73364
|
const count = value.length;
|
|
73351
|
-
if (count === 0) {
|
|
73352
|
-
return "";
|
|
73353
|
-
}
|
|
73354
73365
|
return multiDisplayText
|
|
73355
73366
|
? multiDisplayText(count)
|
|
73356
73367
|
: `Selected ${count.toString().padStart(2, "0")} option${count !== 1 ? "s" : ""}`;
|
|
@@ -73552,6 +73563,7 @@ const PaginationAntdSC = styled(Pagination) `
|
|
|
73552
73563
|
`}
|
|
73553
73564
|
`;
|
|
73554
73565
|
const DivPaginationContainer = styled.div `
|
|
73566
|
+
width: 100%;
|
|
73555
73567
|
display: flex;
|
|
73556
73568
|
align-items: center;
|
|
73557
73569
|
justify-content: space-between;
|
|
@@ -73604,7 +73616,7 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
|
|
|
73604
73616
|
}
|
|
73605
73617
|
return originalElement;
|
|
73606
73618
|
};
|
|
73607
|
-
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: "
|
|
73619
|
+
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: [
|
|
73608
73620
|
{
|
|
73609
73621
|
groupLabel: "",
|
|
73610
73622
|
items: (rest.pageSizeOptions || [10, 20, 50, 100]).map((size) => ({
|