@ledgerhq/react-ui 0.5.0 → 0.7.2

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.
Files changed (60) hide show
  1. package/components/asorted/Divider/index.d.ts +1 -1
  2. package/components/asorted/Icon/BoxedIcon.js +6 -2
  3. package/components/asorted/index.d.ts +1 -1
  4. package/components/asorted/index.js +1 -1
  5. package/components/cta/Button/index.d.ts +11 -8
  6. package/components/cta/Button/index.js +34 -23
  7. package/components/form/BaseInput/index.js +1 -1
  8. package/components/form/Dropdown/index.d.ts +3 -2
  9. package/components/form/Dropdown/index.js +9 -8
  10. package/components/form/DropdownGeneric/index.d.ts +42 -0
  11. package/components/form/DropdownGeneric/index.js +115 -0
  12. package/components/form/Radio/RadioElement.d.ts +3 -2
  13. package/components/form/Radio/RadioElement.js +72 -3
  14. package/components/form/Radio/index.d.ts +1 -1
  15. package/components/form/SelectInput/Control.d.ts +3 -9
  16. package/components/form/SelectInput/Control.js +2 -1
  17. package/components/form/SelectInput/DropdownIndicator.d.ts +3 -9
  18. package/components/form/SelectInput/IndicatorsContainer.d.ts +2 -5
  19. package/components/form/SelectInput/IndicatorsContainer.js +1 -1
  20. package/components/form/SelectInput/MenuList.d.ts +3 -9
  21. package/components/form/SelectInput/MenuList.js +2 -1
  22. package/components/form/SelectInput/Option.d.ts +6 -18
  23. package/components/form/SelectInput/ValueContainer.d.ts +5 -14
  24. package/components/form/SelectInput/ValueContainer.js +1 -1
  25. package/components/form/SelectInput/VirtualMenuList.d.ts +2 -5
  26. package/components/form/SelectInput/VirtualMenuList.js +2 -1
  27. package/components/form/SelectInput/index.d.ts +7 -16
  28. package/components/form/SelectInput/index.js +9 -1
  29. package/components/form/index.d.ts +1 -0
  30. package/components/form/index.js +1 -0
  31. package/components/layout/Drawer/index.d.ts +17 -2
  32. package/components/layout/Drawer/index.js +45 -36
  33. package/components/layout/Popin/index.d.ts +2 -1
  34. package/components/layout/Popin/index.js +10 -5
  35. package/components/loaders/InfiniteLoader/index.d.ts +8 -7
  36. package/components/loaders/InfiniteLoader/index.js +35 -9
  37. package/components/loaders/ProgressLoader/index.d.ts +22 -1
  38. package/components/loaders/ProgressLoader/index.js +10 -12
  39. package/components/message/Alert/index.d.ts +20 -11
  40. package/components/message/Alert/index.js +6 -7
  41. package/components/message/Log/index.d.ts +5 -2
  42. package/components/message/Log/index.js +3 -4
  43. package/components/navigation/FlowStepper/index.d.ts +77 -0
  44. package/components/navigation/FlowStepper/index.js +35 -0
  45. package/components/navigation/index.d.ts +1 -0
  46. package/components/navigation/index.js +1 -0
  47. package/components/navigation/progress/Stepper/index.d.ts +27 -10
  48. package/components/navigation/progress/Stepper/index.js +37 -18
  49. package/components/navigation/sideBar/SideBar/SideBar.js +9 -7
  50. package/index.d.ts +1 -1
  51. package/index.js +1 -1
  52. package/package.json +5 -5
  53. package/styles/InvertTheme.d.ts +4 -1
  54. package/styles/InvertTheme.js +5 -5
  55. package/styles/index.d.ts +1 -0
  56. package/styles/index.js +1 -0
  57. package/styles/theme.d.ts +1 -1
  58. package/styles/theme.js +7 -7
  59. package/components/loaders/InfiniteLoader/image.d.ts +0 -2
  60. package/components/loaders/InfiniteLoader/image.js +0 -1
@@ -1,10 +1,4 @@
1
- import { Styles, MenuListComponentProps, OptionTypeBase } from "react-select";
1
+ import { GroupBase, StylesConfig, MenuListProps } from "react-select";
2
2
  import { DefaultTheme } from "styled-components";
3
- export declare function getStyles<T extends OptionTypeBase = {
4
- label: string;
5
- value: string;
6
- }, M extends boolean = false>(theme: DefaultTheme): NonNullable<Styles<T, M>["menuList"]>;
7
- export declare function MenuList<T extends OptionTypeBase = {
8
- label: string;
9
- value: string;
10
- }, M extends boolean = false>(props: MenuListComponentProps<T, M>): JSX.Element;
3
+ export declare function getStyles<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>>(theme: DefaultTheme): NonNullable<StylesConfig<O, M, G>["menuList"]>;
4
+ export declare function MenuList<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>>(props: MenuListProps<O, M, G>): JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { components } from "react-select";
3
3
  export function getStyles(theme) {
4
- return (provided) => (Object.assign(Object.assign({}, provided), { display: "flex", flexDirection: "column", gap: theme.space[2], padding: theme.space[3], border: `1px solid ${theme.colors.neutral.c20}`, borderRadius: "8px", boxShadow: `0px 2px 12px rgba(0, 0, 0, 0.04)`, background: theme.colors.neutral.c00, color: theme.colors.neutral.c80 }));
4
+ const isLight = theme.colors.type === "light";
5
+ return (provided) => (Object.assign(Object.assign({}, provided), { display: "flex", flexDirection: "column", gap: theme.space[2], padding: theme.space[3], border: `1px solid ${theme.colors.neutral[isLight ? "c20" : "c30"]}`, borderRadius: "8px", boxShadow: `0px 6px 12px rgba(0, 0, 0, ${isLight ? 0.04 : 0.08})`, background: theme.colors.neutral[isLight ? "c00" : "c20"], color: theme.colors.neutral.c80 }));
5
6
  }
6
7
  export function MenuList(props) {
7
8
  return React.createElement(components.MenuList, Object.assign({}, props), props.children);
@@ -1,20 +1,8 @@
1
1
  import React from "react";
2
- import { Styles, OptionProps, OptionTypeBase } from "react-select";
3
- export declare function getStyles<T extends OptionTypeBase = {
4
- label: string;
5
- value: string;
6
- }, M extends boolean = false>(): NonNullable<Styles<T, M>["option"]>;
7
- export declare type ExtraProps<T extends OptionTypeBase = {
8
- label: string;
9
- value: string;
10
- }, M extends boolean = false> = {
11
- render?: (props: React.PropsWithChildren<OptionProps<T, M>>) => React.ReactNode;
2
+ import { GroupBase, StylesConfig, OptionProps } from "react-select";
3
+ export declare function getStyles<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>>(): NonNullable<StylesConfig<O, M, G>["option"]>;
4
+ export declare type ExtraProps<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>> = {
5
+ render?: (props: React.PropsWithChildren<OptionProps<O, M, G>>) => React.ReactNode;
12
6
  };
13
- export declare type Props<T extends OptionTypeBase = {
14
- label: string;
15
- value: string;
16
- }, M extends boolean = false> = OptionProps<T, M> & ExtraProps<T, M>;
17
- export declare function Option<T extends OptionTypeBase = {
18
- label: string;
19
- value: string;
20
- }, M extends boolean = false>(props: Props<T, M>): JSX.Element;
7
+ export declare type Props<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>> = OptionProps<O, M, G> & ExtraProps<O, M, G>;
8
+ export declare function Option<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>>(props: Props<O, M, G>): JSX.Element;
@@ -1,17 +1,8 @@
1
1
  import React from "react";
2
- import { Styles, ValueContainerProps, OptionTypeBase } from "react-select";
3
- export declare function getStyles<T extends OptionTypeBase = {
4
- label: string;
5
- value: string;
6
- }, M extends boolean = false>(): Styles<T, M>["valueContainer"];
7
- declare type ExtraProps<T extends OptionTypeBase = {
8
- label: string;
9
- value: string;
10
- }, M extends boolean = false> = {
11
- render?: (props: React.PropsWithChildren<ValueContainerProps<T, M>>) => React.ReactNode;
2
+ import { GroupBase, StylesConfig, ValueContainerProps } from "react-select";
3
+ export declare function getStyles<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>>(): StylesConfig<O, M, G>["valueContainer"];
4
+ declare type ExtraProps<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>> = {
5
+ render?: (props: React.PropsWithChildren<ValueContainerProps<O, M, G>>) => React.ReactNode;
12
6
  };
13
- export declare function ValueContainer<T extends OptionTypeBase = {
14
- label: string;
15
- value: string;
16
- }, M extends boolean = false>(props: ValueContainerProps<T, M> & ExtraProps<T, M>): JSX.Element;
7
+ export declare function ValueContainer<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>>(props: ValueContainerProps<O, M, G> & ExtraProps<O, M, G>): JSX.Element;
17
8
  export {};
@@ -7,5 +7,5 @@ export function getStyles() {
7
7
  export function ValueContainer(props) {
8
8
  const color = props.selectProps.isDisabled ? "neutral.c60" : "neutral.c100";
9
9
  return (React.createElement(components.ValueContainer, Object.assign({}, props),
10
- React.createElement(Text, { as: "div", variant: "paragraph", color: color }, props.render ? props.render(props) : props.children)));
10
+ React.createElement(Text, { as: "div", variant: "paragraph", color: color, style: { display: "inherit", alignItems: "center" } }, props.render ? props.render(props) : props.children)));
11
11
  }
@@ -1,10 +1,7 @@
1
1
  import React from "react";
2
- import { MenuListComponentProps, OptionTypeBase } from "react-select";
2
+ import { GroupBase, MenuListProps } from "react-select";
3
3
  export declare type RowProps = React.PropsWithChildren<{
4
4
  style: React.CSSProperties;
5
5
  }>;
6
6
  export declare const VirtualRow: React.MemoExoticComponent<({ style, children }: RowProps) => JSX.Element>;
7
- export declare function VirtualMenuList<T extends OptionTypeBase = {
8
- label: string;
9
- value: string;
10
- }, M extends boolean = false>(props: MenuListComponentProps<T, M>): React.ReactElement;
7
+ export declare function VirtualMenuList<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>>(props: MenuListProps<O, M, G>): React.ReactElement;
@@ -3,7 +3,8 @@ import { components } from "react-select";
3
3
  import { FixedSizeList as List } from "react-window";
4
4
  export const VirtualRow = memo(({ style, children }) => (React.createElement("div", { style: style }, children)));
5
5
  export function VirtualMenuList(props) {
6
- const { children, options, maxHeight, getValue, getStyles, selectProps: { noOptionsMessage, rowHeight }, } = props;
6
+ const { children, options, maxHeight, getValue, getStyles, selectProps } = props;
7
+ const { noOptionsMessage, rowHeight = 0 } = selectProps;
7
8
  const listRef = useRef();
8
9
  const [value] = getValue();
9
10
  const initialOffset = options.indexOf(value) * rowHeight;
@@ -1,23 +1,14 @@
1
1
  import React from "react";
2
- import { Props as SelectProps, OptionTypeBase, Styles } from "react-select";
3
- export declare type SelfProps<T extends OptionTypeBase = {
4
- label: string;
5
- value: string;
6
- }, M extends boolean = false> = {
2
+ import { Props as SelectProps, ControlProps, IndicatorsContainerProps, GroupBase, StylesConfig } from "react-select";
3
+ export declare type SelfProps<O, M extends boolean, G extends GroupBase<O>> = {
7
4
  error?: string;
8
- renderLeft?: (props: Props<T, M>) => React.ReactNode;
9
- renderRight?: (props: Props<T, M>) => React.ReactNode;
5
+ renderLeft?: (props: ControlProps<O, M, G>) => React.ReactNode;
6
+ renderRight?: (props: IndicatorsContainerProps<O, M, G>) => React.ReactNode;
10
7
  rowHeight?: number;
11
8
  unwrapped?: boolean;
12
- extendStyles?: (styles: Styles<T, M>) => Styles<T, M>;
9
+ extendStyles?: (styles: StylesConfig<O, M, G>) => StylesConfig<O, M, G>;
13
10
  };
14
- export declare type Props<T extends OptionTypeBase = {
15
- label: string;
16
- value: string;
17
- }, M extends boolean = false> = SelectProps<T, M> & SelfProps<T, M>;
18
- declare function SelectInput<T extends OptionTypeBase = {
19
- label: string;
20
- value: string;
21
- }, M extends boolean = false>({ error, rowHeight, unwrapped, extendStyles, ...props }: Props<T, M>): JSX.Element;
11
+ export declare type Props<O = unknown, M extends boolean = false, G extends GroupBase<O> = GroupBase<O>> = SelectProps<O, M, G> & SelfProps<O, M, G>;
12
+ declare function SelectInput<O, M extends boolean, G extends GroupBase<O>>({ error, rowHeight, unwrapped, extendStyles, ...props }: Props<O, M, G>): JSX.Element;
22
13
  declare const _default: typeof SelectInput;
23
14
  export default _default;
@@ -28,6 +28,12 @@ const stylesFn = (theme) => ({
28
28
  input: (provided) => (Object.assign(Object.assign({}, provided), { color: theme.colors.neutral.c100 })),
29
29
  placeholder: (provided) => (Object.assign(Object.assign({}, provided), { color: theme.colors.neutral.c60 })),
30
30
  singleValue: (provided) => (Object.assign(Object.assign({}, provided), { color: "inherit" })),
31
+ multiValue: (provided) => (Object.assign(Object.assign({}, provided), { backgroundColor: theme.colors.primary.c20, borderRadius: theme.radii[1] })),
32
+ multiValueLabel: (provided) => (Object.assign(Object.assign({}, provided), { color: theme.colors.neutral.c100 })),
33
+ multiValueRemove: (provided) => (Object.assign(Object.assign({}, provided), { cursor: "pointer", ":hover": {
34
+ color: theme.colors.error.c100,
35
+ backgroundColor: theme.colors.error.c30,
36
+ } })),
31
37
  menu: (provided) => (Object.assign(Object.assign({}, provided), { border: 0, boxShadow: "none", background: "none" })),
32
38
  });
33
39
  function SelectInput(_a) {
@@ -35,7 +41,9 @@ function SelectInput(_a) {
35
41
  const theme = useTheme();
36
42
  const styles = useMemo(() => (extendStyles ? extendStyles(stylesFn(theme)) : stylesFn(theme)), [theme, extendStyles]);
37
43
  const { isDisabled, components = {} } = props;
38
- const innerContent = (React.createElement(Select, Object.assign({}, props, { error: error, styles: Object.assign(Object.assign({}, styles), props.styles), classNamePrefix: "react-select", rowHeight: rowHeight, components: Object.assign({ Control: ControlModule.Control, ValueContainer: ValueContainerModule.ValueContainer, IndicatorsContainer, DropdownIndicator: DropdownIndicatorModule.DropdownIndicator, MenuList: MenuListModule.MenuList, Option: OptionModule.Option, IndicatorSeparator: null }, components) })));
44
+ const innerContent = (React.createElement(Select, Object.assign({}, props, { styles: Object.assign(Object.assign({}, styles), props.styles), classNamePrefix: "react-select", components: Object.assign({ Control: ControlModule.Control, ValueContainer: ValueContainerModule.ValueContainer, IndicatorsContainer, DropdownIndicator: DropdownIndicatorModule.DropdownIndicator, MenuList: MenuListModule.MenuList, Option: OptionModule.Option, IndicatorSeparator: null }, components),
45
+ // @ts-expect-error We want to be able to pass extra props here…
46
+ rowHeight: rowHeight })));
39
47
  if (unwrapped)
40
48
  return innerContent;
41
49
  return (React.createElement("div", null,
@@ -1,6 +1,7 @@
1
1
  export { default as Input } from "./BaseInput";
2
2
  export { default as Checkbox } from "./Checkbox";
3
3
  export { default as Dropdown } from "./Dropdown";
4
+ export { default as DropdownGeneric } from "./DropdownGeneric";
4
5
  export { default as LegendInput } from "./LegendInput";
5
6
  export { default as NumberInput } from "./NumberInput";
6
7
  export { default as QrCodeInput } from "./QrCodeInput";
@@ -1,6 +1,7 @@
1
1
  export { default as Input } from "./BaseInput";
2
2
  export { default as Checkbox } from "./Checkbox";
3
3
  export { default as Dropdown } from "./Dropdown";
4
+ export { default as DropdownGeneric } from "./DropdownGeneric";
4
5
  export { default as LegendInput } from "./LegendInput";
5
6
  export { default as NumberInput } from "./NumberInput";
6
7
  export { default as QrCodeInput } from "./QrCodeInput";
@@ -1,13 +1,28 @@
1
1
  import React from "react";
2
+ import { FlexBoxProps } from "../Flex";
3
+ import { Props as DividerProps } from "../../asorted/Divider";
4
+ export declare enum Direction {
5
+ Left = "left",
6
+ Right = "right"
7
+ }
2
8
  export interface DrawerProps {
3
9
  isOpen: boolean;
4
10
  children: React.ReactNode;
5
11
  title?: React.ReactNode;
12
+ footer?: React.ReactNode;
6
13
  big?: boolean;
14
+ ignoreBackdropClick?: boolean;
15
+ backgroundColor?: string;
7
16
  onClose: () => void;
8
17
  onBack?: () => void;
9
18
  setTransitionsEnabled?: (arg0: boolean) => void;
10
19
  hideNavigation?: boolean;
20
+ menuPortalTarget?: Element | null;
21
+ direction?: Direction;
22
+ extraContainerProps?: Partial<FlexBoxProps>;
23
+ extraHeaderProps?: Partial<FlexBoxProps>;
24
+ extraFooterProps?: Partial<FlexBoxProps>;
25
+ extraFooterDividerProps?: Partial<DividerProps>;
11
26
  }
12
- declare const Drawer: ({ children, ...sideProps }: DrawerProps) => React.ReactElement;
13
- export default Drawer;
27
+ declare const _default: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<HTMLDivElement>>;
28
+ export default _default;
@@ -13,29 +13,25 @@ import React, { useCallback } from "react";
13
13
  import ReactDOM from "react-dom";
14
14
  import styled from "styled-components";
15
15
  import FlexBox from "../Flex";
16
- import Close from "@ledgerhq/icons-ui/react/CloseRegular";
16
+ import Divider from "../../asorted/Divider";
17
+ import Close from "@ledgerhq/icons-ui/react/CloseMedium";
17
18
  import ArrowLeft from "@ledgerhq/icons-ui/react/ArrowLeftRegular";
18
19
  import TransitionSlide from "../../transitions/TransitionSlide";
19
20
  import TransitionInOut from "../../transitions/TransitionInOut";
20
21
  import Text from "../../asorted/Text";
22
+ export var Direction;
23
+ (function (Direction) {
24
+ Direction["Left"] = "left";
25
+ Direction["Right"] = "right";
26
+ })(Direction || (Direction = {}));
21
27
  const Container = styled(FlexBox) `
22
28
  width: 100%;
23
29
  height: 100%;
24
30
  flex-direction: column;
25
- background-color: ${(p) => p.theme.colors.neutral.c00};
26
- padding: ${(p) => p.theme.space[6]}px ${(p) => p.theme.space[12]}px;
27
31
  `;
28
- const Header = styled(FlexBox) `
29
- display: flex;
30
- flex-direction: row;
31
- justify-content: space-between;
32
- align-items: center;
33
- min-height: ${(p) => p.theme.space[15]}px;
34
- `;
35
- const Wrapper = styled.div `
32
+ const Wrapper = styled(FlexBox) `
36
33
  height: 100%;
37
34
  width: ${(p) => p.big ? p.theme.sizes.drawer.side.big.width : p.theme.sizes.drawer.side.small.width}px;
38
- display: flex;
39
35
  flex-direction: column;
40
36
  align-items: stretch;
41
37
  justify-content: space-between;
@@ -44,19 +40,15 @@ const Wrapper = styled.div `
44
40
  const Overlay = styled.div `
45
41
  display: flex;
46
42
  position: fixed;
47
- justify-content: flex-end;
43
+ justify-content: ${(p) => (p.direction === Direction.Left ? "flex-end" : "flex-start")};
48
44
  top: 0;
49
45
  left: 0;
50
46
  width: 100vw;
51
47
  height: 100vh;
52
48
  z-index: 999;
53
- background-color: ${(p) => p.theme.colors.neutral.c100a07};
49
+ background-color: ${(p) => p.theme.colors.constant.overlay};
54
50
  `;
55
- const ScrollWrapper = styled.div `
56
- overflow: scroll;
57
- position: relative;
58
- flex: 1;
59
-
51
+ const ScrollWrapper = styled(FlexBox) `
60
52
  &::-webkit-scrollbar {
61
53
  display: none;
62
54
  }
@@ -70,27 +62,44 @@ const Button = styled.button `
70
62
  cursor: pointer;
71
63
  color: ${(p) => p.theme.colors.neutral.c100};
72
64
  `;
73
- const DrawerContent = ({ isOpen, title, children, big, onClose, setTransitionsEnabled = () => 0, onBack, hideNavigation = true, }) => {
65
+ const DrawerContent = React.forwardRef(({ isOpen, title, children, footer, big, onClose, backgroundColor, setTransitionsEnabled = () => 0, onBack, extraContainerProps, extraHeaderProps, extraFooterProps, extraFooterDividerProps, ignoreBackdropClick = false, hideNavigation = true, direction = Direction.Left, }, ref) => {
74
66
  const disableChildAnimations = useCallback(() => setTransitionsEnabled(false), [setTransitionsEnabled]);
75
67
  const enableChildAnimations = useCallback(() => setTransitionsEnabled(true), [setTransitionsEnabled]);
68
+ const handleBackdropClick = useCallback(() => {
69
+ if (!ignoreBackdropClick) {
70
+ onClose();
71
+ }
72
+ }, [onClose, ignoreBackdropClick]);
73
+ const stopClickPropagation = useCallback((e) => {
74
+ e.stopPropagation();
75
+ }, []);
76
76
  return (React.createElement(TransitionInOut, { in: isOpen, appear: true, mountOnEnter: true, unmountOnExit: true, onEntering: disableChildAnimations, onEntered: enableChildAnimations, onExiting: disableChildAnimations },
77
- React.createElement(Overlay, null,
78
- React.createElement(TransitionSlide, { in: isOpen, fixed: true, reverseExit: true, appear: true, mountOnEnter: true, unmountOnExit: true },
79
- React.createElement(Wrapper, { big: big },
77
+ React.createElement(Overlay, { direction: direction, onClick: handleBackdropClick, ref: ref },
78
+ React.createElement(TransitionSlide, { in: isOpen, direction: direction, fixed: true, reverseExit: true, appear: true, mountOnEnter: true, unmountOnExit: true },
79
+ React.createElement(Wrapper, { big: big, onClick: stopClickPropagation, backgroundColor: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : "neutral.c00" },
80
80
  React.createElement(Container, null,
81
- React.createElement(Header, null,
81
+ React.createElement(FlexBox, Object.assign({ justifyContent: "space-between", alignItems: "center", p: 12, pb: 10 }, extraHeaderProps),
82
82
  !hideNavigation && (React.createElement(React.Fragment, null, onBack != null ? (React.createElement(Button, { onClick: onBack },
83
83
  React.createElement(ArrowLeft, { size: 21 }))) : (React.createElement(ButtonPlaceholder, null)))),
84
- (React.createElement(Text, { variant: "h5", flexShrink: 1 }, title)) || React.createElement("div", null),
85
- React.createElement(Button, { onClick: onClose },
86
- React.createElement(Close, null))),
87
- React.createElement(ScrollWrapper, null, children)))))));
88
- };
89
- const Drawer = (_a) => {
90
- var { children } = _a, sideProps = __rest(_a, ["children"]);
91
- const $root = React.useMemo(() => document.querySelector("#ll-side-root"), []);
92
- if ($root === null)
93
- throw new Error("side root cannot be found");
94
- return ReactDOM.createPortal(React.createElement(DrawerContent, Object.assign({}, sideProps), children), $root);
84
+ (React.createElement(Text, { variant: "h3", flex: 1, textAlign: "center" }, title)) || React.createElement("div", null),
85
+ React.createElement(FlexBox, { alignSelf: "flex-start" },
86
+ React.createElement(Button, { onClick: onClose },
87
+ React.createElement(Close, null)))),
88
+ React.createElement(ScrollWrapper, Object.assign({ flexDirection: "column", alignItems: "stretch", overflow: "scroll", position: "relative", p: 12, pt: 0, flex: 1 }, extraContainerProps), children),
89
+ footer && (React.createElement(React.Fragment, null,
90
+ React.createElement(Divider, Object.assign({ variant: "light" }, extraFooterDividerProps)),
91
+ React.createElement(FlexBox, Object.assign({ alignItems: "center", py: 8, px: 12 }, extraFooterProps), footer)))))))));
92
+ });
93
+ const Drawer = (_a, ref) => {
94
+ var { children, menuPortalTarget } = _a, sideProps = __rest(_a, ["children", "menuPortalTarget"]);
95
+ const $root = React.useMemo(() => menuPortalTarget === undefined && typeof document !== undefined
96
+ ? document.querySelector("body")
97
+ : menuPortalTarget, [menuPortalTarget]);
98
+ if (!$root) {
99
+ return (React.createElement(DrawerContent, Object.assign({ ref: ref }, sideProps), children));
100
+ }
101
+ else {
102
+ return ReactDOM.createPortal(React.createElement(DrawerContent, Object.assign({ ref: ref }, sideProps), children), $root);
103
+ }
95
104
  };
96
- export default Drawer;
105
+ export default React.forwardRef(Drawer);
@@ -3,6 +3,7 @@ import { BaseStyledProps } from "../../styled";
3
3
  export interface PopinProps extends BaseStyledProps {
4
4
  isOpen: boolean;
5
5
  children: React.ReactNode;
6
+ menuPortalTarget?: Element | null;
6
7
  }
7
8
  export declare type PopinHeaderProps = BaseStyledProps & {
8
9
  onClose?: () => void;
@@ -10,7 +11,7 @@ export declare type PopinHeaderProps = BaseStyledProps & {
10
11
  children: React.ReactNode;
11
12
  };
12
13
  declare const PopinWrapper: {
13
- ({ children, ...popinProps }: PopinProps): React.ReactElement;
14
+ ({ children, menuPortalTarget, ...popinProps }: PopinProps): React.ReactElement;
14
15
  Header: ({ children, onClose, onBack, ...props }: PopinHeaderProps) => JSX.Element;
15
16
  Body: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").BorderProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>> & import("styled-system").OverflowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
16
17
  columnGap?: string | number | undefined;
@@ -82,11 +82,16 @@ const Popin = (_a) => {
82
82
  React.createElement(Wrapper, Object.assign({ width: width, height: height }, props), children)))));
83
83
  };
84
84
  const PopinWrapper = (_a) => {
85
- var { children } = _a, popinProps = __rest(_a, ["children"]);
86
- const $root = React.useMemo(() => document.querySelector("#ll-popin-root"), []);
87
- if ($root === null)
88
- throw new Error("popin root cannot be found");
89
- return ReactDOM.createPortal(React.createElement(Popin, Object.assign({}, popinProps), children), $root);
85
+ var { children, menuPortalTarget } = _a, popinProps = __rest(_a, ["children", "menuPortalTarget"]);
86
+ const $root = React.useMemo(() => menuPortalTarget === undefined && typeof document !== undefined
87
+ ? document.querySelector("body")
88
+ : menuPortalTarget, [menuPortalTarget]);
89
+ if (!$root) {
90
+ return React.createElement(Popin, Object.assign({}, popinProps), children);
91
+ }
92
+ else {
93
+ return ReactDOM.createPortal(React.createElement(Popin, Object.assign({}, popinProps), children), $root);
94
+ }
90
95
  };
91
96
  PopinWrapper.Header = PopinHeader;
92
97
  PopinWrapper.Body = PopinBody;
@@ -1,7 +1,8 @@
1
- declare const InfiniteLoader: import("styled-components").StyledComponent<"img", import("styled-components").DefaultTheme, {
2
- alt: "loading...";
3
- src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABECAYAAAA4E5OyAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABGvSURBVHgB1Vx9jB3Vdf+dO/Pe2w/veo3jYFQcsJvEmIJUgiMaEtE4xh9AsE0Dq6pVK/VDLeGvqpUqRVUbo/bfqlWiVrRqFZKoquSgYDvEwRhiSClSUqQ0KHECiQifAWPir9317r73Zk7OuffcO/PWNt61d23vsWbvfN6Z85tzfufcc+eZcJHkO7t4xVQfrkeB1bL5fiKsZoCkXQmWVtZl2zHjCAgTujjCy50uXsibOLzp0/QyLoIQFkj27uWBFmN9k7GuIHxUFF0idyNpnSrvQbBtPZ/J73cepNCFrrt4niyHyxIvSPuDY2387+gojWMBZN4B2b+Xr8sYN4syt4kyS1gVUpU5KOfvSZWiHJ7BA+EMILZjtl9XHOw8Ck89UZR4rl3gkbvvpZ9iHmXeAPn2Hl7bZeyQHtchWIFXRN+8PyEqqq5BoY0WoZbgosvMAEYOJCuSE/w5iH3ofsL3ZfnSpu30fcyDXDAg+3fzKlHgd0XhdWT9xYdOLkHeRTxIHqCyOq5tGc+PytbcyQCJylMNQPi+7bj0/6y41D9v/Qy9hQuQ8wbEc0SJjfJgd5v/e17wHEH2kDWlVQlVioPLeAWpV8FkITUX8W6CyrL8erSwxEkc1uFPxn9u3EH/gfOU8wLkucf5iolpPCAXr/IKGBAIWrmy4oDTrMS7zgxATGkXlRLJgArcWj96fuatI4KDKkKZeepzvFV0cf/5WMucATmwl3+LC9wnTzFANV8uecZbCwAkAo2mTWRvPwJQBrMnA4pLZIlQqwjjosWZ4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kBoqJf+0rHh3wIdlVuoq7jt7PqSyMl2qKoslx5QxCHoJT1ynZ98KNWoK28dbQ7YZ8AFRQVEFoBjyB91XUCon/2aQEDAzrDZKBK5FGgsrxahoVKNvzR7Ih91r+o2qDfhGTw34Uk6+iGT6GzWmhmc5XMQKqHbA9iVq0rMFrpF1dQcvQSp067CkrbA0VqHU5aAdqpNSgYfQaYKi/nBnCmwrUTE8CUrcv0wKlbR88cUS4IEBX9UEaK0T8U0+9EXlBv6RpIRVA4WQdHd6mBEAO/KqMGodyRXKZ+s2aYePfnKjitXktpx8kDU1XCKamVKCiShLllI8JP/Rib6zf3cwJERf9TguGVeEbYbzKSqquIsspXai4SxVuMRqQ8cMjMvrvVz8zIf5Kg5xhKaiG+jbzRCXziJBUX6wpuYqC0Gui8PY6j55P/nDPKvJc88Qh/SCzgg+4MA0KO4bhGwg2dHi7Ted7C7FOtsB1CaSl8pa4W8g0XIlCj8JbWE3ZLDbu2rynraizDOU58fBvGz5ZnLCggKs/t4v7xBtaKkiuihaToUloFLguWEZX2uQk8KXtlJY8oMwNB+xTeKDTSSFSBJFs6jVqq8qp4w8DQUNyMwEjbyjE58DqOr/9z6uAC5IIBieJ/ktbBGulwJOUnXIXctG1vXa+JgOS2L1lKGFB618q6ZhUKRt5rJU1tp4RFJnB8tlHkXDJvgEQ5uIuXdHOsktXlolDmwSmCktFq6i6lYTfui27iATEw4jnat253BRCaRiEWdTJbhokN8/xp+bwDEuXgTs6Lm7BcRpkjOh8s4bmlirZFwZarrEctJGaqXnmu+EO3s76wLsl2MdzAyaNjmPzezzC+cyeVWABZMEBmiv4EVQYVLWHW4ZzRX4afo2USKRreLcxShAqndV3C3ykhzPbxdzC16kZMrF9/YdwwW/kVde7c2j1PF5EAAAAASUVORK5CYII=";
4
- width: "28";
5
- height: "28";
6
- }, "height" | "width" | "alt" | "src">;
7
- export default InfiniteLoader;
1
+ import React from "react";
2
+ import { SizeProps } from "styled-system";
3
+ declare const Loader: import("styled-components").StyledComponent<"svg", import("styled-components").DefaultTheme, SizeProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Height<import("styled-system").TLengthStyledSystem>>, never>;
4
+ export declare type Props = React.ComponentProps<typeof Loader> & {
5
+ color?: string;
6
+ };
7
+ export default function InfiniteLoader({ size, color, ...extraProps }: Props): JSX.Element;
8
+ export {};
@@ -1,5 +1,17 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from "react";
1
13
  import styled, { keyframes } from "styled-components";
2
- import image from "./image";
14
+ import { system, size } from "styled-system";
3
15
  const rotate = keyframes `
4
16
  0% {
5
17
  transform: rotate(0deg);
@@ -8,13 +20,27 @@ const rotate = keyframes `
8
20
  transform: rotate(360deg);
9
21
  }
10
22
  `;
11
- const InfiniteLoader = styled.img.attrs({
12
- alt: "loading...",
13
- src: `data:image/png;base64,${image}`,
14
- width: "28",
15
- height: "28",
16
- }) `
23
+ const Loader = styled.svg `
17
24
  animation: ${rotate} 1s linear infinite;
18
- transition: 100ms linear transform;
25
+ ${size}
26
+ ${system({
27
+ stroke: {
28
+ property: "stroke",
29
+ scale: "colors",
30
+ },
31
+ })}
19
32
  `;
20
- export default InfiniteLoader;
33
+ export default function InfiniteLoader(_a) {
34
+ var { size = 38, color = "primary.c50" } = _a, extraProps = __rest(_a, ["size", "color"]);
35
+ return (React.createElement(Loader, Object.assign({ size: size, stroke: color, viewBox: "0 0 38 38", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, extraProps),
36
+ React.createElement("linearGradient", { id: "gradient-start", gradientUnits: "userSpaceOnUse", gradientTransform: "rotate(-20)" },
37
+ React.createElement("stop", { offset: "0", stopColor: "white", stopOpacity: "0.5" }),
38
+ React.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "1" })),
39
+ React.createElement("linearGradient", { id: "gradient-end", gradientUnits: "userSpaceOnUse", gradientTransform: "rotate(-20)" },
40
+ React.createElement("stop", { offset: "0", stopColor: "white", stopOpacity: "0.5" }),
41
+ React.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })),
42
+ React.createElement("mask", { id: "gradient-mask", maskUnits: "userSpaceOnUse" },
43
+ React.createElement("rect", { x: "-0", y: "-4", width: "44", height: "22", strokeWidth: "0", fill: "url(#gradient-start)", transform: "rotate(10)" }),
44
+ React.createElement("rect", { x: "0", y: "18", width: "44", height: "21", strokeWidth: "0", fill: "url(#gradient-end)", transform: "rotate(10)" })),
45
+ React.createElement("path", { d: "M34.8807 20.9499C35.3608 17.0398 34.3815 13.09 32.1304 9.85712C29.8793 6.6242 26.5146 4.33541 22.6808 3.42914C18.847 2.52287 14.8136 3.06283 11.3532 4.94559C7.89277 6.82836 5.24858 9.92158 3.92708 13.6328C2.60558 17.344 2.69968 21.4123 4.19135 25.0584C5.68302 28.7045 8.4674 31.6722 12.0112 33.3929C15.5549 35.1137 19.609 35.4666 23.3968 34.384C27.1846 33.3015 30.4398 30.8596 32.5391 27.526", strokeWidth: "6", strokeLinecap: "round", strokeLinejoin: "round", mask: "url(#gradient-mask)" })));
46
+ }
@@ -11,5 +11,26 @@ export interface Props {
11
11
  * Progress of the loader, in percent, between 0 and 100.
12
12
  */
13
13
  progress?: number;
14
+ /**
15
+ * Whether to display the progress, defaults to true.
16
+ */
17
+ showPercentage?: boolean;
18
+ /**
19
+ * Percentage text color
20
+ */
21
+ textColor?: string;
22
+ /**
23
+ * Front stroke color.
24
+ */
25
+ frontStrokeColor?: string;
26
+ /**
27
+ * Front stroke linecap.
28
+ * https://developer.mozilla.org/fr/docs/Web/SVG/Attribute/stroke-linecap
29
+ */
30
+ frontStrokeLinecap?: "butt" | "round";
31
+ /**
32
+ * Background stroke color.
33
+ */
34
+ backgroundStrokeColor?: string;
14
35
  }
15
- export default function ProgressLoader({ radius, stroke, progress, }: Props): JSX.Element;
36
+ export default function ProgressLoader({ radius, stroke, progress, showPercentage, textColor, frontStrokeColor, frontStrokeLinecap, backgroundStrokeColor, }: Props): JSX.Element;
@@ -11,14 +11,12 @@ const StyledCircle = styled.circle.attrs({
11
11
  transform-origin: 50% 50%;
12
12
  `;
13
13
  const StyledCircleBackground = styled(StyledCircle).attrs((props) => ({
14
- stroke: props.theme.colors.primary.c20,
14
+ stroke: props.stroke || props.theme.colors.primary.c20,
15
15
  })) ``;
16
16
  const StyledCircleFront = styled(StyledCircle).attrs((props) => ({
17
- stroke: props.theme.colors.primary.c60,
17
+ stroke: props.stroke || props.theme.colors.primary.c60,
18
18
  })) ``;
19
- const StyledCenteredText = styled(Text).attrs({
20
- color: "primary.c80",
21
- }) `
19
+ const StyledCenteredText = styled(Text) `
22
20
  position: absolute;
23
21
  top: 50%;
24
22
  left: 50%;
@@ -29,18 +27,18 @@ const StyledProgressLoaderContainer = styled.div `
29
27
  display: flex;
30
28
  position: absolute;
31
29
  `;
32
- function ProgressCircleSvg({ radius, stroke, progress, }) {
30
+ function ProgressCircleSvg({ radius, stroke, progress, backgroundStrokeColor, frontStrokeColor, frontStrokeLinecap, }) {
33
31
  const normalizedRadius = radius - stroke / 2;
34
32
  const circumference = normalizedRadius * 2 * Math.PI;
35
33
  const strokeDashoffset = circumference - (progress / 100) * circumference;
36
34
  return (React.createElement("svg", { height: radius * 2, width: radius * 2 },
37
- React.createElement(StyledCircleBackground, { strokeWidth: stroke, strokeDasharray: circumference + " " + circumference, style: { strokeDashoffset: 0 }, r: normalizedRadius }),
38
- React.createElement(StyledCircleFront, { strokeWidth: stroke, strokeDasharray: circumference + " " + circumference, style: { strokeDashoffset }, r: normalizedRadius })));
35
+ React.createElement(StyledCircleBackground, { strokeWidth: stroke, strokeDasharray: circumference + " " + circumference, style: { strokeDashoffset: 0 }, stroke: backgroundStrokeColor, r: normalizedRadius }),
36
+ React.createElement(StyledCircleFront, { strokeWidth: stroke, strokeDasharray: circumference + " " + circumference, style: { strokeDashoffset }, stroke: frontStrokeColor, strokeLinecap: frontStrokeLinecap, r: normalizedRadius })));
39
37
  }
40
- export default function ProgressLoader({ radius = 32, stroke = 6, progress = 0, }) {
38
+ export default function ProgressLoader({ radius = 32, stroke = 6, progress = 0, showPercentage = true, textColor, frontStrokeColor, frontStrokeLinecap, backgroundStrokeColor, }) {
41
39
  return (React.createElement(StyledProgressLoaderContainer, null,
42
- React.createElement(StyledCenteredText, { variant: "body" },
40
+ showPercentage && (React.createElement(StyledCenteredText, { variant: "body", color: textColor || "primary.c80" },
43
41
  progress,
44
- "%"),
45
- React.createElement(ProgressCircleSvg, { radius: radius, stroke: stroke, progress: progress })));
42
+ "%")),
43
+ React.createElement(ProgressCircleSvg, { radius: radius, stroke: stroke, progress: progress, frontStrokeColor: frontStrokeColor, frontStrokeLinecap: frontStrokeLinecap, backgroundStrokeColor: backgroundStrokeColor })));
46
44
  }
@@ -1,28 +1,37 @@
1
1
  import { TextVariants } from "../../../styles/theme";
2
2
  declare type AlertType = "info" | "warning" | "error";
3
+ declare type RenderProps = (props: {
4
+ color: string;
5
+ textProps: {
6
+ variant?: TextVariants;
7
+ fontWeight?: string;
8
+ };
9
+ }) => JSX.Element;
3
10
  export interface AlertProps {
4
11
  /**
5
- * Affects the colors of the background & text and what icon can be displayed
12
+ * Affects the colors of the background & text and what icon can be displayed.
6
13
  */
7
14
  type?: AlertType;
8
15
  /**
9
- * Title of the Alert
16
+ * Title of the Alert.
10
17
  */
11
18
  title?: string;
12
19
  /**
13
- * Method for rendering additional content under the title `{ color: string; textProps: { variant?: TextVariants; fontWeight?: string } }` is passed as props to easily style text elements
20
+ * Method for rendering additional content under the title. `{ color: string; textProps: { variant?: TextVariants; fontWeight?: string } }` is passed as props to easily style text elements.
14
21
  */
15
- renderContent?: (props: {
16
- color: string;
17
- textProps: {
18
- variant?: TextVariants;
19
- fontWeight?: string;
20
- };
21
- }) => JSX.Element;
22
+ renderContent?: RenderProps;
23
+ /**
24
+ * Method for rendering additional content to the right. `{ color: string; textProps: { variant?: TextVariants; fontWeight?: string } }` is passed as props to easily style text elements.
25
+ */
26
+ renderRight?: RenderProps;
27
+ /**
28
+ * Additional props to be passed to the top level container (containing icon + content).
29
+ */
30
+ containerProps?: Record<string, unknown>;
22
31
  /**
23
32
  * Whether or not to display an icon
24
33
  */
25
34
  showIcon?: boolean;
26
35
  }
27
- export default function Alert({ type, title, showIcon, renderContent, }: AlertProps): JSX.Element;
36
+ export default function Alert({ type, title, showIcon, renderContent, renderRight, containerProps, }: AlertProps): JSX.Element;
28
37
  export {};