@ftdata/ui 0.0.13 → 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.
@@ -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
- export declare const SelectDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
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
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ftdata/ui",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -31,8 +31,8 @@
31
31
  "react-input-mask-next": "3.0.0-alpha.12",
32
32
  "react-select": "^5.10.2",
33
33
  "react-window": "^2.0.2",
34
- "@ftdata/f-tokens": "0.0.1",
35
- "@ftdata/f-icons": "0.0.2"
34
+ "@ftdata/f-icons": "0.0.2",
35
+ "@ftdata/f-tokens": "0.0.1"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"