@ftdata/ui 0.0.12 → 0.0.14
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/components/MultiSelect/components/MultiSelectList/index.d.ts +2 -1
- package/dist/components/MultiSelect/components/MultiSelectList/index.js +2 -1
- package/dist/components/MultiSelect/components/MultiSelectList/style.d.ts +5 -1
- package/dist/components/MultiSelect/components/MultiSelectList/style.js +3 -1
- package/dist/components/MultiSelect/index.d.ts +2 -1
- package/dist/components/MultiSelect/index.js +3 -2
- package/dist/components/Select/List/index.d.ts +1 -0
- package/dist/components/Select/List/index.js +2 -1
- package/dist/components/Select/List/style.d.ts +5 -1
- package/dist/components/Select/List/style.js +3 -1
- package/dist/components/Select/index.d.ts +2 -1
- package/dist/components/Select/index.js +2 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ interface MultiSelectListProps {
|
|
|
6
6
|
addAll?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
7
7
|
translation: (key: string) => string;
|
|
8
8
|
onLoadMore?: () => Promise<void>;
|
|
9
|
+
dropdownPosition?: "top" | "bottom";
|
|
9
10
|
}
|
|
10
|
-
export default function MultiSelectList({ options, onClickOption, loading, addAll, translation, onLoadMore, }: MultiSelectListProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default function MultiSelectList({ options, onClickOption, loading, addAll, translation, onLoadMore, dropdownPosition, }: MultiSelectListProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -4,7 +4,7 @@ import Row from "./Row/index.js";
|
|
|
4
4
|
import { LoadingContainer, SelectDropdown } from "./style.js";
|
|
5
5
|
import Loading from "../../../Loading/index.js";
|
|
6
6
|
import { useCallback, useState } from "react";
|
|
7
|
-
function MultiSelectList({ options, onClickOption, loading, addAll, translation, onLoadMore }) {
|
|
7
|
+
function MultiSelectList({ options, onClickOption, loading, addAll, translation, onLoadMore, dropdownPosition = "bottom" }) {
|
|
8
8
|
const [lastIndex, setLastIndex] = useState(0);
|
|
9
9
|
const [loadingMore, setLoadingMore] = useState(false);
|
|
10
10
|
const selectAll = {
|
|
@@ -40,6 +40,7 @@ function MultiSelectList({ options, onClickOption, loading, addAll, translation,
|
|
|
40
40
|
label: "loading"
|
|
41
41
|
};
|
|
42
42
|
return /*#__PURE__*/ jsx(SelectDropdown, {
|
|
43
|
+
position: dropdownPosition,
|
|
43
44
|
children: loading ? /*#__PURE__*/ jsx(LoadingContainer, {
|
|
44
45
|
children: /*#__PURE__*/ jsx(Loading, {
|
|
45
46
|
size: "lg",
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
interface SelectDropdownProps {
|
|
2
|
+
position?: "top" | "bottom";
|
|
3
|
+
}
|
|
4
|
+
export declare const SelectDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SelectDropdownProps>> & string;
|
|
2
5
|
export declare const LoadingContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export {};
|
|
@@ -6,12 +6,14 @@ const SelectDropdown = styled_components.div`
|
|
|
6
6
|
box-shadow: 0px 2px 4px rgba(107, 117, 124, 0.32);
|
|
7
7
|
color: ${COLOR_NEUTRAL_DUSK};
|
|
8
8
|
position: absolute;
|
|
9
|
-
top: calc(100% + 0.5rem);
|
|
10
9
|
right: 0;
|
|
11
10
|
width: 100%;
|
|
12
11
|
height: auto;
|
|
13
12
|
z-index: 3;
|
|
14
13
|
|
|
14
|
+
top: ${({ position })=>"top" === position ? "auto" : "calc(100% + 0.5rem)"};
|
|
15
|
+
bottom: ${({ position })=>"top" === position ? "calc(100% + 0.5rem)" : "auto"};
|
|
16
|
+
|
|
15
17
|
& > div {
|
|
16
18
|
border-radius: 0.25rem;
|
|
17
19
|
}
|
|
@@ -23,5 +23,6 @@ export interface MultiSelectProps extends InputHTMLAttributes<HTMLDivElement> {
|
|
|
23
23
|
total?: number;
|
|
24
24
|
onLoadMore?: () => Promise<void>;
|
|
25
25
|
toggle?: (open: boolean) => void;
|
|
26
|
+
dropdownPosition?: "top" | "bottom";
|
|
26
27
|
}
|
|
27
|
-
export default function MultiSelect({ helpText, label, sublabel, required, disabled, feedback, helpIcon, name, translation, state, updateState, placeholder, max, loading, actions, selectAll, total, icon, onLoadMore, toggle, ...rest }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export default function MultiSelect({ helpText, label, sublabel, required, disabled, feedback, helpIcon, name, translation, state, updateState, placeholder, max, loading, actions, selectAll, total, icon, onLoadMore, toggle, dropdownPosition, ...rest }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,7 +15,7 @@ import { feedbackText } from "./helpers/feedbackText.js";
|
|
|
15
15
|
import { COLOR_NEUTRAL_DARK } from "@ftdata/f-tokens";
|
|
16
16
|
import RotateButton from "../fields/components/RotateButton/index.js";
|
|
17
17
|
import calcTextSize from "./helpers/calcTextSize.js";
|
|
18
|
-
function MultiSelect({ helpText, label, sublabel, required, disabled, feedback, helpIcon, name, translation, state, updateState, placeholder, max, loading, actions, selectAll, total, icon, onLoadMore, toggle, ...rest }) {
|
|
18
|
+
function MultiSelect({ helpText, label, sublabel, required, disabled, feedback, helpIcon, name, translation, state, updateState, placeholder, max, loading, actions, selectAll, total, icon, onLoadMore, toggle, dropdownPosition, ...rest }) {
|
|
19
19
|
const [showList, setShowList] = useState(false);
|
|
20
20
|
const [query, setQuery] = useState("");
|
|
21
21
|
const [inputSize, setInputSize] = useState(0);
|
|
@@ -216,7 +216,8 @@ function MultiSelect({ helpText, label, sublabel, required, disabled, feedback,
|
|
|
216
216
|
onClickOption: (e, option)=>handleAddOption(option),
|
|
217
217
|
loading: loading,
|
|
218
218
|
addAll: canShowSelectAll,
|
|
219
|
-
onLoadMore: onLoadMore
|
|
219
|
+
onLoadMore: onLoadMore,
|
|
220
|
+
dropdownPosition: dropdownPosition
|
|
220
221
|
})
|
|
221
222
|
]
|
|
222
223
|
}),
|
|
@@ -7,6 +7,7 @@ interface SelectListProps {
|
|
|
7
7
|
isLoading?: boolean;
|
|
8
8
|
handleCustomAction: (action: () => void) => void;
|
|
9
9
|
onLoadMore?: () => Promise<void>;
|
|
10
|
+
dropdownPosition?: "top" | "bottom";
|
|
10
11
|
}
|
|
11
12
|
declare const SelectList: React.FC<SelectListProps>;
|
|
12
13
|
export default SelectList;
|
|
@@ -5,7 +5,7 @@ import { LoadingContainer, SelectDropdown } from "./style.js";
|
|
|
5
5
|
import Loading from "../../Loading/index.js";
|
|
6
6
|
import { TooltipWrapper } from "../../TooltipWrapper/index.js";
|
|
7
7
|
import Row from "./Row/index.js";
|
|
8
|
-
const SelectList = ({ options, onClickOption, selectedOption, isLoading, onLoadMore, handleCustomAction })=>{
|
|
8
|
+
const SelectList = ({ options, onClickOption, selectedOption, isLoading, onLoadMore, handleCustomAction, dropdownPosition })=>{
|
|
9
9
|
const [lastIndex, setLastIndex] = useState(0);
|
|
10
10
|
const [loadingMore, setLoadingMore] = useState(false);
|
|
11
11
|
const OPTION_SIZE = 36;
|
|
@@ -30,6 +30,7 @@ const SelectList = ({ options, onClickOption, selectedOption, isLoading, onLoadM
|
|
|
30
30
|
lastIndex
|
|
31
31
|
]);
|
|
32
32
|
return /*#__PURE__*/ jsx(SelectDropdown, {
|
|
33
|
+
position: dropdownPosition,
|
|
33
34
|
children: isLoading ? /*#__PURE__*/ jsx(LoadingContainer, {
|
|
34
35
|
children: /*#__PURE__*/ jsx(Loading, {
|
|
35
36
|
size: "lg",
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
interface SelectDropdownProps {
|
|
2
|
+
position?: "top" | "bottom";
|
|
3
|
+
}
|
|
4
|
+
export declare const SelectDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SelectDropdownProps>> & string;
|
|
2
5
|
export declare const LoadingContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export {};
|
|
@@ -6,11 +6,13 @@ const SelectDropdown = styled_components.div`
|
|
|
6
6
|
box-shadow: 0px 2px 4px rgba(107, 117, 124, 0.32);
|
|
7
7
|
color: ${COLOR_NEUTRAL_DUSK};
|
|
8
8
|
position: absolute;
|
|
9
|
-
top: calc(100% + 0.5rem);
|
|
10
9
|
width: 100%;
|
|
11
10
|
height: auto;
|
|
12
11
|
z-index: 3;
|
|
13
12
|
|
|
13
|
+
top: ${({ position })=>"top" === position ? "auto" : "calc(100% + 0.5rem)"};
|
|
14
|
+
bottom: ${({ position })=>"top" === position ? "calc(100% + 0.5rem)" : "auto"};
|
|
15
|
+
|
|
14
16
|
.action {
|
|
15
17
|
span {
|
|
16
18
|
font-weight: 600;
|
|
@@ -28,7 +28,8 @@ export interface SelectProps extends InputPropsWithoutOnToggle {
|
|
|
28
28
|
setSelected: React.Dispatch<React.SetStateAction<ISelectOption | null>>;
|
|
29
29
|
onLoadMore?: () => Promise<void>;
|
|
30
30
|
onToggle?: (open: boolean) => void;
|
|
31
|
+
dropdownPosition?: "top" | "bottom";
|
|
31
32
|
}
|
|
32
|
-
export default function Select({ helpText, isError, isSuccess, label, name, isRequired, options, placeholder, icon, isLoading, search, t, variation, selected, setSelected, onLoadMore, onToggle, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export default function Select({ helpText, isError, isSuccess, label, name, isRequired, options, placeholder, icon, isLoading, search, t, variation, selected, setSelected, onLoadMore, onToggle, dropdownPosition, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
33
34
|
export declare const normalizeOptions: (options: ISelectOption[]) => ISelectOption[];
|
|
34
35
|
export {};
|
|
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
3
3
|
import { CavetButton, HelpText, IconContainer, InputWrapper, SelectContainer, StyledInput, StyledLabel } from "./styles.js";
|
|
4
4
|
import { Icon } from "@ftdata/f-icons";
|
|
5
5
|
import List from "./List/index.js";
|
|
6
|
-
function Select({ helpText, isError, isSuccess, label, name, isRequired, options, placeholder, icon, isLoading, search, t, variation = "default", selected, setSelected, onLoadMore, onToggle, ...rest }) {
|
|
6
|
+
function Select({ helpText, isError, isSuccess, label, name, isRequired, options, placeholder, icon, isLoading, search, t, variation = "default", selected, setSelected, onLoadMore, onToggle, dropdownPosition, ...rest }) {
|
|
7
7
|
const [showList, setShowList] = useState(false);
|
|
8
8
|
const [currentValue, setCurrentValue] = useState("");
|
|
9
9
|
const [filtered, setFiltered] = useState([]);
|
|
@@ -160,6 +160,7 @@ function Select({ helpText, isError, isSuccess, label, name, isRequired, options
|
|
|
160
160
|
})
|
|
161
161
|
}),
|
|
162
162
|
showList && /*#__PURE__*/ jsx(List, {
|
|
163
|
+
dropdownPosition: dropdownPosition,
|
|
163
164
|
options: computedOptions() || [
|
|
164
165
|
notFound
|
|
165
166
|
],
|