@ledgerhq/react-ui 0.2.0 → 0.5.0

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 (135) hide show
  1. package/README.md +47 -4
  2. package/assets/logos/LedgerLiveAltRegular.d.ts +0 -1
  3. package/assets/logos/LedgerLiveRegular.d.ts +0 -1
  4. package/components/Chart/index.d.ts +0 -1
  5. package/components/Chart/index.js +1 -1
  6. package/components/Table/Columns.d.ts +62 -13
  7. package/components/Table/Columns.js +8 -18
  8. package/components/Table/index.d.ts +47 -14
  9. package/components/Table/index.js +37 -20
  10. package/components/Table/stories.helper.js +19 -18
  11. package/components/Tag/index.d.ts +18 -5
  12. package/components/Tag/index.js +54 -21
  13. package/components/animations/GlitchText/index.d.ts +6 -0
  14. package/components/animations/GlitchText/index.js +35 -0
  15. package/components/asorted/Divider/index.d.ts +0 -1
  16. package/components/asorted/Divider/index.js +2 -2
  17. package/components/asorted/Icon/BoxedIcon.d.ts +48 -0
  18. package/components/asorted/Icon/BoxedIcon.js +58 -0
  19. package/components/asorted/Icon/Icon.d.ts +0 -1
  20. package/components/asorted/Icon/index.d.ts +2 -0
  21. package/components/asorted/Icon/index.js +2 -0
  22. package/components/asorted/Text/index.d.ts +6 -22
  23. package/components/asorted/Text/index.js +7 -16
  24. package/components/asorted/Text/styles.d.ts +2 -1
  25. package/components/asorted/Text/styles.js +21 -9
  26. package/components/asorted/index.d.ts +1 -1
  27. package/components/asorted/index.js +1 -1
  28. package/components/cards/Carousel/Slide.js +3 -3
  29. package/components/cards/Carousel/index.js +8 -8
  30. package/components/cta/Button/index.d.ts +16 -8
  31. package/components/cta/Button/index.js +76 -65
  32. package/components/cta/Link/index.d.ts +59 -2
  33. package/components/cta/Link/index.js +17 -12
  34. package/components/cta/Toggle/index.d.ts +0 -1
  35. package/components/cta/Toggle/index.js +1 -1
  36. package/components/form/BaseInput/index.d.ts +81 -11
  37. package/components/form/BaseInput/index.js +42 -19
  38. package/components/form/Checkbox/Checkbox.js +12 -9
  39. package/components/form/Dropdown/index.d.ts +0 -1
  40. package/components/form/Dropdown/index.js +2 -2
  41. package/components/form/LegendInput/index.d.ts +26 -2
  42. package/components/form/LegendInput/index.js +5 -4
  43. package/components/form/NumberInput/index.d.ts +25 -3
  44. package/components/form/NumberInput/index.js +19 -7
  45. package/components/form/QrCodeInput/index.d.ts +25 -3
  46. package/components/form/QrCodeInput/index.js +7 -6
  47. package/components/form/QuantityInput/index.d.ts +26 -4
  48. package/components/form/QuantityInput/index.js +9 -8
  49. package/components/form/Radio/RadioElement.d.ts +5 -2
  50. package/components/form/Radio/RadioElement.js +15 -13
  51. package/components/form/Radio/RadioListElement.d.ts +22 -0
  52. package/components/form/Radio/RadioListElement.js +63 -0
  53. package/components/form/Radio/index.d.ts +8 -1
  54. package/components/form/Radio/index.js +2 -0
  55. package/components/form/SearchInput/index.d.ts +24 -2
  56. package/components/form/SearchInput/index.js +4 -3
  57. package/components/form/SelectInput/Control.d.ts +2 -2
  58. package/components/form/SelectInput/Control.js +3 -7
  59. package/components/form/SelectInput/DropdownIndicator.d.ts +0 -1
  60. package/components/form/SelectInput/DropdownIndicator.js +1 -1
  61. package/components/form/SelectInput/IndicatorsContainer.d.ts +0 -1
  62. package/components/form/SelectInput/MenuList.d.ts +0 -1
  63. package/components/form/SelectInput/MenuList.js +1 -1
  64. package/components/form/SelectInput/Option.js +11 -11
  65. package/components/form/SelectInput/ValueContainer.js +1 -1
  66. package/components/form/SelectInput/index.d.ts +3 -2
  67. package/components/form/SelectInput/index.js +5 -5
  68. package/components/form/SplitInput/index.js +5 -5
  69. package/components/form/Switch/Switch.js +8 -8
  70. package/components/helpers.d.ts +2 -2
  71. package/components/layout/Box/index.d.ts +8 -0
  72. package/components/layout/Box/index.js +3 -0
  73. package/components/layout/Drawer/index.d.ts +13 -0
  74. package/components/layout/{Side/Side.js → Drawer/index.js} +12 -12
  75. package/components/layout/Flex/index.d.ts +7 -7
  76. package/components/layout/Flex/index.js +2 -11
  77. package/components/layout/Grid/index.d.ts +3 -2
  78. package/components/layout/Grid/index.js +3 -6
  79. package/components/layout/Popin/index.d.ts +27 -6
  80. package/components/layout/Popin/index.js +65 -41
  81. package/components/layout/Side/index.d.ts +0 -1
  82. package/components/layout/Side/index.js +2 -2
  83. package/components/layout/index.d.ts +2 -0
  84. package/components/layout/index.js +2 -0
  85. package/components/loaders/ProgressLoader/index.d.ts +0 -1
  86. package/components/loaders/ProgressLoader/index.js +3 -3
  87. package/components/message/Alert/index.d.ts +22 -3
  88. package/components/message/Alert/index.js +31 -23
  89. package/components/message/Log/index.js +1 -1
  90. package/components/message/Notification/Badge.js +2 -2
  91. package/components/message/Notification/index.js +4 -6
  92. package/components/message/StatusNotification/index.d.ts +11 -0
  93. package/components/message/StatusNotification/index.js +33 -0
  94. package/components/message/Tip/index.d.ts +7 -0
  95. package/components/message/Tip/index.js +43 -0
  96. package/components/message/Tooltip/index.d.ts +3 -3
  97. package/components/message/Tooltip/index.js +1 -1
  98. package/components/message/Tooltip/styles.js +3 -3
  99. package/components/message/index.d.ts +3 -0
  100. package/components/message/index.js +3 -0
  101. package/components/navigation/Aside/index.d.ts +5 -1
  102. package/components/navigation/Breadcrumb/index.js +6 -6
  103. package/components/navigation/Header/index.d.ts +3 -3
  104. package/components/navigation/progress/ProgressBar/Onboarding.d.ts +0 -1
  105. package/components/navigation/progress/ProgressBar/Onboarding.js +6 -6
  106. package/components/navigation/progress/Stepper/index.js +9 -9
  107. package/components/navigation/sideBar/Item/Item.d.ts +4 -3
  108. package/components/navigation/sideBar/Item/Item.js +34 -16
  109. package/components/navigation/sideBar/Logo/Logo.d.ts +0 -1
  110. package/components/navigation/sideBar/SideBar/SideBar.d.ts +1 -2
  111. package/components/navigation/sideBar/SideBar/SideBar.js +14 -6
  112. package/components/navigation/sideBar/Toggle/Toggle.d.ts +0 -1
  113. package/components/navigation/sideBar/Toggle/Toggle.js +2 -2
  114. package/components/styled.d.ts +16 -0
  115. package/components/styled.js +13 -0
  116. package/components/tabs/Bar/index.js +4 -4
  117. package/components/tabs/Chip/index.d.ts +13 -0
  118. package/components/tabs/Chip/index.js +21 -0
  119. package/components/tabs/Pill/index.js +7 -7
  120. package/components/tabs/Tabs/index.js +8 -7
  121. package/components/tabs/index.d.ts +2 -0
  122. package/components/tabs/index.js +2 -0
  123. package/package.json +4 -4
  124. package/styles/InvertTheme.d.ts +1 -8
  125. package/styles/StyleProvider.d.ts +3 -3
  126. package/styles/StyleProvider.js +3 -3
  127. package/styles/global.d.ts +1 -0
  128. package/styles/global.js +15 -36
  129. package/styles/index.d.ts +0 -1
  130. package/styles/index.js +0 -1
  131. package/styles/theme.d.ts +5 -2
  132. package/styles/theme.js +7 -8
  133. package/components/layout/Side/Side.d.ts +0 -13
  134. package/styles/reset.d.ts +0 -2
  135. package/styles/reset.js +0 -62
@@ -1,12 +1,33 @@
1
1
  import React from "react";
2
- export interface WrapperProps {
3
- width?: number;
4
- height?: number;
5
- }
6
- export declare type PopinProps = WrapperProps & {
2
+ import { BaseStyledProps } from "../../styled";
3
+ export interface PopinProps extends BaseStyledProps {
7
4
  isOpen: boolean;
8
5
  children: React.ReactNode;
6
+ }
7
+ export declare type PopinHeaderProps = BaseStyledProps & {
9
8
  onClose?: () => void;
9
+ onBack?: () => void;
10
+ children: React.ReactNode;
11
+ };
12
+ declare const PopinWrapper: {
13
+ ({ children, ...popinProps }: PopinProps): React.ReactElement;
14
+ Header: ({ children, onClose, onBack, ...props }: PopinHeaderProps) => JSX.Element;
15
+ 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
+ columnGap?: string | number | undefined;
17
+ rowGap?: string | number | undefined;
18
+ color?: string | undefined;
19
+ } & {
20
+ as: string;
21
+ flexDirection: string;
22
+ flex: number;
23
+ overflow: string;
24
+ }, "overflow" | "p" | "color" | "as" | "size" | "rowGap" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "top" | "verticalAlign" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "flex" | "margin" | "padding" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "bg" | "borderX" | "borderY">;
25
+ Footer: 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>>> & {
26
+ columnGap?: string | number | undefined;
27
+ rowGap?: string | number | undefined;
28
+ color?: string | undefined;
29
+ } & {
30
+ as: string;
31
+ }, "overflow" | "p" | "color" | "as" | "size" | "rowGap" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "top" | "verticalAlign" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "flex" | "margin" | "padding" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "bg" | "borderX" | "borderY">;
10
32
  };
11
- declare const PopinWrapper: ({ children, ...popinProps }: PopinProps) => React.ReactElement;
12
33
  export default PopinWrapper;
@@ -12,54 +12,75 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from "react";
13
13
  import ReactDOM from "react-dom";
14
14
  import styled from "styled-components";
15
+ import CloseIcon from "@ledgerhq/icons-ui/react/CloseRegular";
16
+ import ArrowLeftIcon from "@ledgerhq/icons-ui/react/ArrowLeftRegular";
17
+ import baseStyled from "../../styled";
18
+ import Flex from "../../layout/Flex";
15
19
  import Button from "../../cta/Button";
16
- import Close from "@ledgerhq/icons-ui/react/CloseRegular";
17
20
  import TransitionInOut from "../../transitions/TransitionInOut";
18
21
  import TransitionScale from "../../transitions/TransitionScale";
19
- const Container = styled.div `
20
- position: relative;
21
- width: 100%;
22
- height: 100%;
23
- background-color: ${(p) => p.theme.colors.palette.neutral.c00};
24
- padding: ${(p) => p.theme.space[6]}px;
22
+ const ICON_SIZE = 20;
23
+ const Wrapper = styled(Flex).attrs((p) => ({
24
+ flexDirection: "column",
25
+ alignItems: "stretch",
26
+ justifyContent: "space-between",
27
+ height: p.height || `${p.theme.sizes.drawer.popin.max.height}px`,
28
+ width: p.width || `${p.theme.sizes.drawer.popin.max.width}px`,
29
+ minHeight: `${p.theme.sizes.drawer.popin.min.height}px`,
30
+ minWidth: `${p.theme.sizes.drawer.popin.min.width}px`,
31
+ maxHeight: `${p.theme.sizes.drawer.popin.max.height}px`,
32
+ maxWidth: `${p.theme.sizes.drawer.popin.max.width}px`,
33
+ zIndex: p.theme.zIndexes[8],
34
+ p: p.p !== undefined ? p.p : p.theme.space[10],
35
+ rowGap: 6,
36
+ backgroundColor: p.theme.colors.neutral.c00,
37
+ })) ``;
38
+ const Overlay = styled(Flex).attrs((p) => ({
39
+ justifyContent: "center",
40
+ alignItems: "center",
41
+ width: "100vw",
42
+ height: "100vh",
43
+ zIndex: p.theme.zIndexes[8],
44
+ position: "fixed",
45
+ top: 0,
46
+ left: 0,
47
+ backgroundColor: p.theme.colors.neutral.c100a07,
48
+ })) ``;
49
+ const Header = baseStyled.section `
50
+ display: grid;
51
+ grid-template-columns: [icon] ${ICON_SIZE}px [title] 1fr [icon] ${ICON_SIZE}px;
52
+ column-gap: 12px;
25
53
  `;
26
- const Wrapper = styled.div `
27
- height: ${(p) => p.height || p.theme.sizes.drawer.popin.min.height}px;
28
- width: ${(p) => p.width || p.theme.sizes.drawer.popin.min.width}px;
29
- min-height: ${(p) => p.theme.sizes.drawer.popin.min.height}px;
30
- min-width: ${(p) => p.theme.sizes.drawer.popin.min.width}px;
31
- max-height: ${(p) => p.theme.sizes.drawer.popin.max.height}px;
32
- max-width: ${(p) => p.theme.sizes.drawer.popin.max.width}px;
54
+ const HeaderTitleContainer = styled(Flex).attrs(() => ({
55
+ justifyContent: "center",
56
+ })) ``;
57
+ const PopinBody = baseStyled(Flex).attrs({
58
+ as: "section",
59
+ flexDirection: "column",
60
+ flex: 1,
61
+ overflow: "auto",
62
+ }) ``;
63
+ const PopinFooter = baseStyled(Flex).attrs({ as: "section" }) ``;
64
+ const IconContainer = styled(Button.Unstyled) `
33
65
  display: flex;
34
- flex-direction: column;
35
- align-items: stretch;
36
- justify-content: space-between;
37
- z-index: ${(p) => p.theme.zIndexes[8]};
38
- `;
39
- const Overlay = styled.div `
40
- position: fixed;
41
- display: flex;
42
- justify-content: center;
43
66
  align-items: center;
44
- top: 0;
45
- left: 0;
46
- width: 100vw;
47
- height: 100vh;
48
- z-index: 999;
49
- background-color: ${(p) => p.theme.colors.palette.neutral.c100a07};
50
- `;
51
- const CloseButton = styled(Button) `
52
- position: absolute;
53
- top: ${(p) => p.theme.space[6]}px;
54
- right: ${(p) => p.theme.space[6]}px;
55
67
  `;
56
- const Popin = ({ isOpen, children, width, height, onClose = () => { } }) => (React.createElement(TransitionInOut, { in: isOpen, appear: true, mountOnEnter: true, unmountOnExit: true },
57
- React.createElement(Overlay, null,
58
- React.createElement(TransitionScale, { in: isOpen, appear: true },
59
- React.createElement(Wrapper, { width: width, height: height },
60
- React.createElement(Container, null,
61
- React.createElement(CloseButton, { Icon: Close, onClick: onClose }),
62
- children))))));
68
+ const PopinHeader = (_a) => {
69
+ var { children, onClose, onBack } = _a, props = __rest(_a, ["children", "onClose", "onBack"]);
70
+ return (React.createElement(Header, Object.assign({}, props),
71
+ React.createElement(Flex, null, onBack ? (React.createElement(IconContainer, { onClick: onBack },
72
+ React.createElement(ArrowLeftIcon, { size: ICON_SIZE, color: "neutral.c100" }))) : null),
73
+ React.createElement(HeaderTitleContainer, null, children),
74
+ React.createElement(Flex, null, onClose ? (React.createElement(IconContainer, { onClick: onClose },
75
+ React.createElement(CloseIcon, { size: ICON_SIZE, color: "neutral.c100" }))) : null)));
76
+ };
77
+ const Popin = (_a) => {
78
+ var { isOpen, children, width, height } = _a, props = __rest(_a, ["isOpen", "children", "width", "height"]);
79
+ return (React.createElement(TransitionInOut, { in: isOpen, appear: true, mountOnEnter: true, unmountOnExit: true },
80
+ React.createElement(Overlay, null,
81
+ React.createElement(TransitionScale, { in: isOpen, appear: true },
82
+ React.createElement(Wrapper, Object.assign({ width: width, height: height }, props), children)))));
83
+ };
63
84
  const PopinWrapper = (_a) => {
64
85
  var { children } = _a, popinProps = __rest(_a, ["children"]);
65
86
  const $root = React.useMemo(() => document.querySelector("#ll-popin-root"), []);
@@ -67,4 +88,7 @@ const PopinWrapper = (_a) => {
67
88
  throw new Error("popin root cannot be found");
68
89
  return ReactDOM.createPortal(React.createElement(Popin, Object.assign({}, popinProps), children), $root);
69
90
  };
91
+ PopinWrapper.Header = PopinHeader;
92
+ PopinWrapper.Body = PopinBody;
93
+ PopinWrapper.Footer = PopinFooter;
70
94
  export default PopinWrapper;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface SideProps {
3
2
  onBack?: () => void;
4
3
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useCallback, useEffect, useState } from "react";
2
2
  import { TransitionGroup } from "react-transition-group";
3
- import Side from "./Side";
3
+ import Drawer from "../Drawer";
4
4
  import TransitionSlide from "../../transitions/TransitionSlide";
5
5
  import { useSide } from "./Provider";
6
6
  export const SideWrapper = (props) => {
@@ -39,7 +39,7 @@ export const SideWrapper = (props) => {
39
39
  const onBack = (_a = state === null || state === void 0 ? void 0 : state.props) === null || _a === void 0 ? void 0 : _a.onBack;
40
40
  onBack && onBack();
41
41
  }, [state === null || state === void 0 ? void 0 : state.props]);
42
- return (React.createElement(Side, Object.assign({}, props, { isOpen: !!state.open, onClose: onClose, onBack: ((_a = state === null || state === void 0 ? void 0 : state.props) === null || _a === void 0 ? void 0 : _a.onBack) ? wrappedOnBack : undefined, setTransitionsEnabled: setTransitionsEnabled }),
42
+ return (React.createElement(Drawer, Object.assign({}, props, { isOpen: !!state.open, onClose: onClose, onBack: ((_a = state === null || state === void 0 ? void 0 : state.props) === null || _a === void 0 ? void 0 : _a.onBack) ? wrappedOnBack : undefined, setTransitionsEnabled: setTransitionsEnabled, hideNavigation: false }),
43
43
  React.createElement(TransitionGroup, { enter: transitionsEnabled, exit: transitionsEnabled, component: null }, queue.map(({ Component, props, key }) => (React.createElement(TransitionSlide, { key: key, direction: direction }, Component && React.createElement(Component, Object.assign({}, props))))))));
44
44
  };
45
45
  export default SideWrapper;
@@ -1,4 +1,6 @@
1
1
  export { default as Flex } from "./Flex";
2
+ export { default as Box } from "./Box";
2
3
  export { default as Grid } from "./Grid";
3
4
  export { default as Popin } from "./Popin";
4
5
  export { default as Side } from "./Side";
6
+ export { default as Drawer } from "./Drawer";
@@ -1,4 +1,6 @@
1
1
  export { default as Flex } from "./Flex";
2
+ export { default as Box } from "./Box";
2
3
  export { default as Grid } from "./Grid";
3
4
  export { default as Popin } from "./Popin";
4
5
  export { default as Side } from "./Side";
6
+ export { default as Drawer } from "./Drawer";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface Props {
3
2
  /**
4
3
  * Radius of the progress ring.
@@ -11,13 +11,13 @@ 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.palette.primary.c20,
14
+ stroke: props.theme.colors.primary.c20,
15
15
  })) ``;
16
16
  const StyledCircleFront = styled(StyledCircle).attrs((props) => ({
17
- stroke: props.theme.colors.palette.primary.c60,
17
+ stroke: props.theme.colors.primary.c60,
18
18
  })) ``;
19
19
  const StyledCenteredText = styled(Text).attrs({
20
- color: "palette.primary.c80",
20
+ color: "primary.c80",
21
21
  }) `
22
22
  position: absolute;
23
23
  top: 50%;
@@ -1,9 +1,28 @@
1
- /// <reference types="react" />
1
+ import { TextVariants } from "../../../styles/theme";
2
2
  declare type AlertType = "info" | "warning" | "error";
3
3
  export interface AlertProps {
4
+ /**
5
+ * Affects the colors of the background & text and what icon can be displayed
6
+ */
4
7
  type?: AlertType;
5
- title: string;
8
+ /**
9
+ * Title of the Alert
10
+ */
11
+ title?: string;
12
+ /**
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
14
+ */
15
+ renderContent?: (props: {
16
+ color: string;
17
+ textProps: {
18
+ variant?: TextVariants;
19
+ fontWeight?: string;
20
+ };
21
+ }) => JSX.Element;
22
+ /**
23
+ * Whether or not to display an icon
24
+ */
6
25
  showIcon?: boolean;
7
26
  }
8
- export default function Alert({ type, title, showIcon }: AlertProps): JSX.Element;
27
+ export default function Alert({ type, title, showIcon, renderContent, }: AlertProps): JSX.Element;
9
28
  export {};
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
- import styled, { css } from "styled-components";
2
+ import styled, { useTheme } from "styled-components";
3
3
  import Text from "../../asorted/Text";
4
+ import Flex from "../../layout/Flex";
4
5
  import ShieldSecurityMedium from "@ledgerhq/icons-ui/react/ShieldSecurityMedium";
5
6
  import CircledCrossMedium from "@ledgerhq/icons-ui/react/CircledCrossMedium";
6
7
  import CircledAlertMedium from "@ledgerhq/icons-ui/react/CircledAlertMedium";
@@ -14,35 +15,42 @@ const icons = {
14
15
  warning: React.createElement(CircledAlertMedium, { size: 20 }),
15
16
  error: React.createElement(CircledCrossMedium, { size: 20 }),
16
17
  };
17
- const StyledAlertContainer = styled.div `
18
- ${(p) => {
19
- switch (p.type) {
18
+ const getColors = ({ theme, type }) => {
19
+ switch (type) {
20
20
  case "warning":
21
- return css `
22
- background: ${p.theme.colors.palette.warning.c30};
23
- color: ${p.theme.colors.palette.warning.c100};
24
- `;
21
+ return {
22
+ background: theme.colors.warning.c30,
23
+ color: theme.colors.warning.c100,
24
+ };
25
25
  case "error":
26
- return css `
27
- background: ${p.theme.colors.palette.error.c30};
28
- color: ${p.theme.colors.palette.error.c100};
29
- `;
26
+ return {
27
+ background: theme.colors.error.c30,
28
+ color: theme.colors.error.c100,
29
+ };
30
30
  case "info":
31
31
  default:
32
- return css `
33
- background: ${p.theme.colors.palette.primary.c20};
34
- color: ${p.theme.colors.palette.primary.c90};
35
- `;
32
+ return {
33
+ background: theme.colors.primary.c20,
34
+ color: theme.colors.primary.c90,
35
+ };
36
36
  }
37
- }}
38
-
37
+ };
38
+ const StyledAlertContainer = styled(Flex).attrs(() => ({
39
+ padding: 6,
40
+ })) `
39
41
  border-radius: ${(p) => `${p.theme.radii[1]}px`};
40
- padding: 16px;
41
- display: flex;
42
42
  align-items: center;
43
43
  `;
44
- export default function Alert({ type = "info", title, showIcon = true }) {
45
- return (React.createElement(StyledAlertContainer, { type: type },
44
+ export default function Alert({ type = "info", title, showIcon = true, renderContent, }) {
45
+ const theme = useTheme();
46
+ const { color, background } = getColors({ theme, type });
47
+ const textProps = {
48
+ variant: "paragraph",
49
+ fontWeight: "medium",
50
+ };
51
+ return (React.createElement(StyledAlertContainer, { color: color, backgroundColor: background },
46
52
  showIcon && !!icons[type] && React.createElement(StyledIconContainer, null, icons[type]),
47
- React.createElement(Text, { variant: "body", color: "inherit" }, title)));
53
+ React.createElement(Flex, { flexDirection: "column", alignItems: "flex-start", rowGap: "6px" },
54
+ title && (React.createElement(Text, Object.assign({}, textProps, { color: "inherit" }), title)),
55
+ renderContent && renderContent({ color, textProps }))));
48
56
  }
@@ -19,7 +19,7 @@ const Container = styled(FlexBox) `
19
19
  flex-wrap: wrap;
20
20
  align-items: stretch;
21
21
  min-height: ${(p) => p.theme.space[12]}px;
22
- color: ${(p) => p.theme.colors.palette.neutral.c100};
22
+ color: ${(p) => p.theme.colors.neutral.c100};
23
23
  `;
24
24
  const TextContainer = styled(FlexBox).attrs(() => ({
25
25
  flex: "1",
@@ -20,14 +20,14 @@ const ActiveCircle = styled.div `
20
20
  width: 10px;
21
21
  border-radius: 9999px;
22
22
  box-sizing: content-box;
23
- background-color: ${(p) => p.theme.colors.palette.error.c100};
23
+ background-color: ${(p) => p.theme.colors.error.c100};
24
24
 
25
25
  border: 2px solid
26
26
  var(
27
27
  --notification-badge-border,
28
28
  ${(p) => {
29
29
  /* The CSS variable is dynamically set by the Notification component */
30
- return p.theme.colors.palette.background.main;
30
+ return p.theme.colors.background.main;
31
31
  }}
32
32
  );
33
33
  `;
@@ -23,11 +23,9 @@ const Container = styled(FlexBox).attrs({
23
23
  }) `
24
24
  --notification-badge-border: ${(p) => {
25
25
  /* Set a CSS variable that will be consumed by the Badge component */
26
- return p.hasBackground
27
- ? p.theme.colors.palette.neutral.c30
28
- : p.theme.colors.palette.background.main;
26
+ return p.hasBackground ? p.theme.colors.neutral.c30 : p.theme.colors.background.main;
29
27
  }};
30
- background-color: ${(p) => p.hasBackground ? p.theme.colors.palette.neutral.c30 : "transparent"};
28
+ background-color: ${(p) => (p.hasBackground ? p.theme.colors.neutral.c30 : "transparent")};
31
29
 
32
30
  border-radius: 8px;
33
31
  `;
@@ -36,8 +34,8 @@ function Notification(_a) {
36
34
  return (React.createElement(Container, Object.assign({ hasBackground: hasBackground }, containerProps),
37
35
  badge,
38
36
  React.createElement(FlexBox, { flexDirection: "column", rowGap: 3, flex: "auto" },
39
- React.createElement(Text, { variant: "large", fontWeight: "medium", color: "palette.neutral.c100" }, title),
40
- description && (React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "palette.neutral.c80" }, description)),
37
+ React.createElement(Text, { variant: "large", fontWeight: "medium", color: "neutral.c100" }, title),
38
+ description && (React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "neutral.c80", whiteSpace: "pre-wrap" }, description)),
41
39
  link && (React.createElement(FlexBox, { justifyContent: "flex-start" },
42
40
  React.createElement(Link, { onClick: (event) => onLinkClick && onLinkClick(event), Icon: ExternalLinkMedium }, link))))));
43
41
  }
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { FlexBoxProps } from "../../layout/Flex";
3
+ interface ContainerProps extends FlexBoxProps {
4
+ hasBorder?: boolean;
5
+ }
6
+ export interface Props extends ContainerProps {
7
+ text: string;
8
+ badge: React.ReactNode;
9
+ }
10
+ declare function StatusNotification({ text, badge, hasBorder, ...containerProps }: Props): JSX.Element;
11
+ export default StatusNotification;
@@ -0,0 +1,33 @@
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";
13
+ import styled from "styled-components";
14
+ import FlexBox from "../../layout/Flex";
15
+ import Log from "../Log/";
16
+ const Container = styled(FlexBox).attrs({
17
+ p: 8,
18
+ rowGap: 9,
19
+ alignItems: "center",
20
+ flexDirection: "column",
21
+ }) `
22
+ border-width: 1px;
23
+ border-style: ${(p) => (p.hasBorder ? "solid" : "none")};
24
+ border-radius: 8px;
25
+ border-color: ${(p) => p.theme.colors.neutral.c40};
26
+ `;
27
+ function StatusNotification(_a) {
28
+ var { text, badge, hasBorder = false } = _a, containerProps = __rest(_a, ["text", "badge", "hasBorder"]);
29
+ return (React.createElement(Container, Object.assign({ hasBorder: hasBorder }, containerProps),
30
+ badge,
31
+ React.createElement(Log, null, text)));
32
+ }
33
+ export default StatusNotification;
@@ -0,0 +1,7 @@
1
+ declare type TipType = "success" | "warning" | "error";
2
+ export interface TipProps {
3
+ type?: TipType;
4
+ label: string;
5
+ }
6
+ export default function Tip({ type, label }: TipProps): JSX.Element;
7
+ export {};
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import styled, { css } from "styled-components";
3
+ import Text from "../../asorted/Text";
4
+ import { CheckAloneMedium, CloseMedium, CircledAlertMedium } from "@ledgerhq/icons-ui/react";
5
+ import { Flex } from "../../layout";
6
+ const icons = {
7
+ success: React.createElement(CheckAloneMedium, { size: 16 }),
8
+ warning: React.createElement(CircledAlertMedium, { size: 16 }),
9
+ error: React.createElement(CloseMedium, { size: 16 }),
10
+ };
11
+ const StyledIconContainer = styled.div `
12
+ ${(p) => {
13
+ switch (p.type) {
14
+ case "warning":
15
+ return css `
16
+ background: ${p.theme.colors.warning.c10};
17
+ color: ${p.theme.colors.warning.c100};
18
+ `;
19
+ case "error":
20
+ return css `
21
+ background: ${p.theme.colors.error.c10};
22
+ color: ${p.theme.colors.error.c100};
23
+ `;
24
+ case "success":
25
+ default:
26
+ return css `
27
+ background: ${p.theme.colors.success.c30};
28
+ color: ${p.theme.colors.success.c100};
29
+ `;
30
+ }
31
+ }}
32
+
33
+ border-radius: ${(p) => `${p.theme.radii[1]}px`};
34
+ margin-right ${(p) => `${p.theme.space[6]}px`};
35
+ padding: 6px;
36
+ display: flex;
37
+ align-items: center;
38
+ `;
39
+ export default function Tip({ type, label }) {
40
+ return (React.createElement(Flex, { alignItems: "center" },
41
+ type && React.createElement(StyledIconContainer, { type: type }, icons[type]),
42
+ React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "neutral.c100", flexShrink: 1 }, label)));
43
+ }
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { TippyProps } from "@tippyjs/react";
3
2
  declare type Placement = "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "auto" | "auto-start" | "auto-end";
4
- export declare type Props = TippyProps & {
3
+ export interface Props extends TippyProps {
4
+ /** The preferred placement of the tippy. */
5
5
  placement?: Placement;
6
- };
6
+ }
7
7
  export default function Tooltip(props: Props): JSX.Element | null;
8
8
  export {};
@@ -36,6 +36,6 @@ const Wrapper = forwardRef((props, ref) => {
36
36
  });
37
37
  export default function Tooltip(props) {
38
38
  const { content, placement = "auto", children } = props, rest = __rest(props, ["content", "placement", "children"]);
39
- return (React.createElement(Tippy, Object.assign({}, rest, { placement: placement, content: React.createElement(Text, { fontWeight: "medium", variant: "paragraph", color: "palette.neutral.c00" }, content) }),
39
+ return (React.createElement(Tippy, Object.assign({}, rest, { placement: placement, content: React.createElement(Text, { fontWeight: "medium", variant: "paragraph", color: "neutral.c00" }, content) }),
40
40
  React.createElement(Wrapper, { children: children })));
41
41
  }
@@ -10,8 +10,8 @@ export default css `
10
10
 
11
11
  .tippy-box {
12
12
  position: relative;
13
- background-color: ${(p) => p.theme.colors.palette.neutral.c100};
14
- color: ${(p) => p.theme.colors.palette.neutral.c00};
13
+ background-color: ${(p) => p.theme.colors.neutral.c100};
14
+ color: ${(p) => p.theme.colors.neutral.c00};
15
15
  border-radius: 4px;
16
16
  font-size: 14px;
17
17
  line-height: 1.4;
@@ -72,7 +72,7 @@ export default css `
72
72
  .tippy-arrow {
73
73
  width: 16px;
74
74
  height: 16px;
75
- color: ${(p) => p.theme.colors.palette.neutral.c100};
75
+ color: ${(p) => p.theme.colors.neutral.c100};
76
76
  }
77
77
 
78
78
  .tippy-arrow:before {
@@ -1,4 +1,7 @@
1
1
  export { default as Alert } from "./Alert";
2
2
  export { default as Log } from "./Log";
3
3
  export { default as Notification } from "./Notification";
4
+ export { default as Badge } from "./Notification/Badge";
4
5
  export { default as Tooltip } from "./Tooltip";
6
+ export { default as Tip } from "./Tip";
7
+ export { default as StatusNotification } from "./StatusNotification";
@@ -1,4 +1,7 @@
1
1
  export { default as Alert } from "./Alert";
2
2
  export { default as Log } from "./Log";
3
3
  export { default as Notification } from "./Notification";
4
+ export { default as Badge } from "./Notification/Badge";
4
5
  export { default as Tooltip } from "./Tooltip";
6
+ export { default as Tip } from "./Tip";
7
+ export { default as StatusNotification } from "./StatusNotification";
@@ -6,6 +6,10 @@ export declare type Props = React.PropsWithChildren<{
6
6
  }> & React.ComponentProps<typeof Wrapper>;
7
7
  interface ExtraWrapperProps extends ColorProps, LayoutProps, TypographyProps {
8
8
  }
9
- declare const Wrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../layout/Flex").FlexBoxProps & ExtraWrapperProps, never>;
9
+ declare const Wrapper: 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>>> & ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & 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>>> & {
10
+ columnGap?: string | number | undefined;
11
+ rowGap?: string | number | undefined;
12
+ color?: string | undefined;
13
+ } & ExtraWrapperProps, "overflow" | "p" | "color" | "size" | "rowGap" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "top" | "verticalAlign" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "flex" | "margin" | "padding" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "bg" | "borderX" | "borderY">;
10
14
  export default function Aside({ header, footer, children, ...props }: Props): JSX.Element;
11
15
  export {};
@@ -7,14 +7,14 @@ import * as ControlModule from "../../form/SelectInput/Control";
7
7
  const Link = styled(Text).attrs({
8
8
  ff: "Inter|SemiBold",
9
9
  fontSize: 3,
10
- color: "palette.neutral.c80",
10
+ color: "neutral.c80",
11
11
  tabIndex: 0,
12
12
  }) `
13
13
  cursor: pointer;
14
14
  :hover,
15
15
  :active,
16
16
  :focus {
17
- color: ${(p) => p.theme.colors.palette.neutral.c100};
17
+ color: ${(p) => p.theme.colors.neutral.c100};
18
18
  text-decoration: underline;
19
19
  }
20
20
  `;
@@ -26,11 +26,11 @@ export default memo(function Breadcrumb({ segments, onChange }) {
26
26
  const [contents] = segments.reduce(([renderArray, valuesArray], segment, index) => {
27
27
  const values = [...valuesArray];
28
28
  renderArray.push(React.createElement(React.Fragment, null,
29
- index > 0 ? (React.createElement(Text, { fontWeight: "semiBold", color: "palette.neutral.c40", variant: "paragraph" }, "/")) : null,
29
+ index > 0 ? (React.createElement(Text, { fontWeight: "semiBold", color: "neutral.c40", variant: "paragraph" }, "/")) : null,
30
30
  isMultiSegment(segment) ? (React.createElement(Dropdown, { label: "", options: segment.options, value: segment.value, onChange: (elt) => elt && onChange([...values, elt.value]), styles: {
31
- control: (provided, state) => (Object.assign(Object.assign({}, ControlModule.getStyles()(provided, state)), { cursor: "pointer" })),
32
- singleValue: (provided) => (Object.assign(Object.assign({}, provided), { margin: 0, top: undefined, position: undefined, overflow: undefined, maxWidth: undefined, transform: undefined, color: theme.colors.palette.neutral.c80, ":hover": {
33
- color: theme.colors.palette.neutral.c100,
31
+ control: (provided, state) => (Object.assign(Object.assign({}, ControlModule.getStyles(theme)(provided, state)), { cursor: "pointer" })),
32
+ singleValue: (provided) => (Object.assign(Object.assign({}, provided), { margin: 0, top: undefined, position: undefined, overflow: undefined, maxWidth: undefined, transform: undefined, color: theme.colors.neutral.c80, ":hover": {
33
+ color: theme.colors.neutral.c100,
34
34
  textDecoration: "underline",
35
35
  } })),
36
36
  } })) : (React.createElement(Link, { onKeyDown: (event) => ["Enter", " "].includes(event.key) && onChange([...values, segment.value]), onClick: () => onChange([...values, segment.value]) }, segment.label))));
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import FlexBox from "../../layout/Flex";
3
3
  export declare type Props = {
4
- left: React.ReactNode;
5
- right: React.ReactNode;
6
- children: React.ReactNode;
4
+ left?: React.ReactNode;
5
+ right?: React.ReactNode;
6
+ children?: React.ReactNode;
7
7
  } & React.ComponentProps<typeof FlexBox>;
8
8
  export default function ({ left, right, children, ...rest }: Props): JSX.Element;