fis-component 0.0.49 → 0.0.51
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 +9 -6
- 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/Pagination/styles.d.ts +2 -0
- package/dist/cjs/types/src/components/Portal/index.d.ts +2 -1
- package/dist/cjs/types/src/components/Select/types.d.ts +2 -1
- package/dist/esm/index.js +9 -6
- 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/Pagination/styles.d.ts +2 -0
- package/dist/esm/types/src/components/Portal/index.d.ts +2 -1
- package/dist/esm/types/src/components/Select/types.d.ts +2 -1
- package/dist/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export declare const SelectPageSizeSC: import("styled-components/dist/types").IS
|
|
|
11
11
|
positive?: boolean;
|
|
12
12
|
multiDisplayText?: (count: number) => string;
|
|
13
13
|
renderOption?: (option: import("../Select/types").SelectOption) => React.ReactNode;
|
|
14
|
+
portal?: boolean;
|
|
14
15
|
} & import("../Select/types").SingleSelect<string> & import("react").RefAttributes<HTMLInputElement>, "ref"> & {
|
|
15
16
|
ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
|
|
16
17
|
}) | (Omit<Partial<import("../Input/InputLabel").InputLabelProps> & Omit<import("../MenuSelect/types").MenuProps, "size" | "onClickMenu" | "groups" | "multi" | "selectedValues" | "onChangeSelected"> & Omit<import("../SelectItem").SelectFieldProps, "onChange" | "value"> & {
|
|
@@ -20,6 +21,7 @@ export declare const SelectPageSizeSC: import("styled-components/dist/types").IS
|
|
|
20
21
|
positive?: boolean;
|
|
21
22
|
multiDisplayText?: (count: number) => string;
|
|
22
23
|
renderOption?: (option: import("../Select/types").SelectOption) => React.ReactNode;
|
|
24
|
+
portal?: boolean;
|
|
23
25
|
} & import("../Select/types").MultiSelect<string> & import("react").RefAttributes<HTMLInputElement>, "ref"> & {
|
|
24
26
|
ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
|
|
25
27
|
}), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("../Select/types").SelectProps<string> & import("react").RefAttributes<HTMLInputElement>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -9,6 +9,7 @@ type Props = {
|
|
|
9
9
|
* The `container` will have the portal children appended to it.
|
|
10
10
|
*/
|
|
11
11
|
container?: HTMLElement | null;
|
|
12
|
+
portal?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare function Portal(
|
|
14
|
+
declare function Portal({ container, children, portal }: Props): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null;
|
|
14
15
|
export { Portal };
|
|
@@ -10,7 +10,7 @@ export interface SelectOption {
|
|
|
10
10
|
}[];
|
|
11
11
|
}
|
|
12
12
|
export type SingleSelect<T> = {
|
|
13
|
-
multi
|
|
13
|
+
multi?: boolean;
|
|
14
14
|
value: T;
|
|
15
15
|
onChange: (value: T) => void;
|
|
16
16
|
displayValue?: (value: SelectOption) => string;
|
|
@@ -28,4 +28,5 @@ export type SelectProps<T> = Partial<InputLabelProps> & Omit<MenuProps, "groups"
|
|
|
28
28
|
positive?: boolean;
|
|
29
29
|
multiDisplayText?: (count: number) => string;
|
|
30
30
|
renderOption?: (option: SelectOption) => React.ReactNode;
|
|
31
|
+
portal?: boolean;
|
|
31
32
|
} & (SingleSelect<T> | MultiSelect<T>);
|
package/dist/esm/index.js
CHANGED
|
@@ -69951,12 +69951,15 @@ function getDefaultContainer() {
|
|
|
69951
69951
|
rootPortal.setAttribute("id", rootId);
|
|
69952
69952
|
return document.body.appendChild(rootPortal);
|
|
69953
69953
|
}
|
|
69954
|
-
function Portal(
|
|
69954
|
+
function Portal({ container, children, portal }) {
|
|
69955
69955
|
const [mountNode, setMountNode] = useState(null);
|
|
69956
69956
|
useLayoutEffect$2(() => {
|
|
69957
|
-
setMountNode(
|
|
69958
|
-
}, [
|
|
69959
|
-
|
|
69957
|
+
setMountNode(container || getDefaultContainer());
|
|
69958
|
+
}, [container]);
|
|
69959
|
+
if (!portal) {
|
|
69960
|
+
return children || null;
|
|
69961
|
+
}
|
|
69962
|
+
return mountNode ? createPortal(children, mountNode) : null;
|
|
69960
69963
|
}
|
|
69961
69964
|
|
|
69962
69965
|
const DivChipButtonWrapperSC = styled.div `
|
|
@@ -73252,7 +73255,7 @@ function isMenuSize(value) {
|
|
|
73252
73255
|
return value === "sm" || value === "md";
|
|
73253
73256
|
}
|
|
73254
73257
|
|
|
73255
|
-
const FISSelect = forwardRef(({ className, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, ...restProps }, ref) => {
|
|
73258
|
+
const FISSelect = forwardRef(({ className, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, portal, ...restProps }, ref) => {
|
|
73256
73259
|
const [isOpen, setIsOpen] = useState(false);
|
|
73257
73260
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
73258
73261
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -73313,7 +73316,7 @@ const FISSelect = forwardRef(({ className, size = "md", options, value, disabled
|
|
|
73313
73316
|
onChange(newValues);
|
|
73314
73317
|
}
|
|
73315
73318
|
}, [multi, onChange, value]);
|
|
73316
|
-
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: selectedOptions, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { children: jsx(DivDropdownMenuSC, { ref: setPopperElement, style: { ...styles.popper, width: referenceElement?.offsetWidth }, ...attributes.popper, children: jsx(FISMenuSelect, { size: isMenuSize(size) ? size : "md", groups: options, placeholder: placeholderSearch, loading: loading, multi: multi, selectedValues: multi ? value : value ? [value] : [], onChangeSelected: (values) => {
|
|
73319
|
+
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: selectedOptions, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { portal: portal, children: jsx(DivDropdownMenuSC, { ref: setPopperElement, style: { ...styles.popper, width: referenceElement?.offsetWidth }, ...attributes.popper, children: jsx(FISMenuSelect, { size: isMenuSize(size) ? size : "md", groups: options, placeholder: placeholderSearch, loading: loading, multi: multi, selectedValues: multi ? value : value ? [value] : [], onChangeSelected: (values) => {
|
|
73317
73320
|
if (multi) {
|
|
73318
73321
|
onChange(values);
|
|
73319
73322
|
}
|