@ledgerhq/lumen-ui-react 0.1.60 → 0.1.62

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 (89) hide show
  1. package/dist/index.js +150 -132
  2. package/dist/lib/Components/core/AmountInput/AmountInput.d.ts +1 -1
  3. package/dist/lib/Components/core/AmountInput/AmountInput.d.ts.map +1 -1
  4. package/dist/lib/Components/core/AmountInput/AmountInput.js +53 -51
  5. package/dist/lib/Components/core/AmountInput/useAmountInputValue/useAmountInputValue.js +3 -3
  6. package/dist/lib/Components/core/Avatar/resolveAvatarColor.js +2 -2
  7. package/dist/lib/Components/core/AvatarButton/AvatarButton.js +6 -6
  8. package/dist/lib/Components/core/Banner/Banner.js +8 -8
  9. package/dist/lib/Components/core/Button/Button.js +10 -10
  10. package/dist/lib/Components/core/Card/Card.js +6 -6
  11. package/dist/lib/Components/core/CardButton/CardButton.d.ts +2 -0
  12. package/dist/lib/Components/core/CardButton/CardButton.d.ts.map +1 -1
  13. package/dist/lib/Components/core/CardButton/CardButton.js +4 -4
  14. package/dist/lib/Components/core/DataTable/DataTable.js +7 -7
  15. package/dist/lib/Components/core/Divider/Divider.js +8 -8
  16. package/dist/lib/Components/core/DotCount/DotCount.js +3 -3
  17. package/dist/lib/Components/core/DotIcon/DotIcon.js +9 -9
  18. package/dist/lib/Components/core/DotSymbol/DotSymbol.js +16 -16
  19. package/dist/lib/Components/core/Link/Link.d.ts +1 -1
  20. package/dist/lib/Components/core/Link/Link.d.ts.map +1 -1
  21. package/dist/lib/Components/core/Link/Link.js +21 -20
  22. package/dist/lib/Components/core/Link/types.d.ts +1 -1
  23. package/dist/lib/Components/core/Link/types.d.ts.map +1 -1
  24. package/dist/lib/Components/core/ListItem/ListItem.js +4 -4
  25. package/dist/lib/Components/core/MediaBanner/MediaBanner.js +19 -19
  26. package/dist/lib/Components/core/MediaButton/MediaButton.js +2 -2
  27. package/dist/lib/Components/core/Menu/Menu.d.ts +3 -2
  28. package/dist/lib/Components/core/Menu/Menu.d.ts.map +1 -1
  29. package/dist/lib/Components/core/Menu/Menu.js +157 -108
  30. package/dist/lib/Components/core/Menu/types.d.ts +31 -0
  31. package/dist/lib/Components/core/Menu/types.d.ts.map +1 -1
  32. package/dist/lib/Components/core/NavBar/CoinCapsule.js +8 -8
  33. package/dist/lib/Components/core/Pagination/Pagination.js +14 -14
  34. package/dist/lib/Components/core/Popover/Popover.js +6 -6
  35. package/dist/lib/Components/core/SearchInput/SearchInput.js +5 -5
  36. package/dist/lib/Components/core/SegmentedControl/SegmentedControl.js +19 -19
  37. package/dist/lib/Components/core/Select/Select.js +8 -8
  38. package/dist/lib/Components/core/SideBar/SideBar.js +14 -14
  39. package/dist/lib/Components/core/Spinner/Spinner.js +4 -4
  40. package/dist/lib/Components/core/Spot/Spot.js +9 -9
  41. package/dist/lib/Components/core/Stepper/Stepper.d.ts +4 -3
  42. package/dist/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
  43. package/dist/lib/Components/core/Stepper/Stepper.js +137 -65
  44. package/dist/lib/Components/core/Stepper/types.d.ts +12 -2
  45. package/dist/lib/Components/core/Stepper/types.d.ts.map +1 -1
  46. package/dist/lib/Components/core/Switch/Switch.js +5 -5
  47. package/dist/lib/Components/core/Table/Table.js +9 -9
  48. package/dist/lib/Components/core/TileButton/TileButton.js +8 -8
  49. package/dist/lib/Components/core/Timeline/Timeline.d.ts +54 -0
  50. package/dist/lib/Components/core/Timeline/Timeline.d.ts.map +1 -0
  51. package/dist/lib/Components/core/Timeline/Timeline.js +228 -0
  52. package/dist/lib/Components/core/Timeline/index.d.ts +3 -0
  53. package/dist/lib/Components/core/Timeline/index.d.ts.map +1 -0
  54. package/dist/lib/Components/core/Timeline/types.d.ts +148 -0
  55. package/dist/lib/Components/core/Timeline/types.d.ts.map +1 -0
  56. package/dist/lib/Components/core/Toast/Toast.d.ts +25 -0
  57. package/dist/lib/Components/core/Toast/Toast.d.ts.map +1 -0
  58. package/dist/lib/Components/core/Toast/Toast.js +68 -0
  59. package/dist/lib/Components/core/Toast/Toaster.d.ts +27 -0
  60. package/dist/lib/Components/core/Toast/Toaster.d.ts.map +1 -0
  61. package/dist/lib/Components/core/Toast/Toaster.js +92 -0
  62. package/dist/lib/Components/core/Toast/hooks/useToastCollapse.d.ts +15 -0
  63. package/dist/lib/Components/core/Toast/hooks/useToastCollapse.d.ts.map +1 -0
  64. package/dist/lib/Components/core/Toast/hooks/useToastCollapse.js +15 -0
  65. package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.d.ts +24 -0
  66. package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.d.ts.map +1 -0
  67. package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.js +27 -0
  68. package/dist/lib/Components/core/Toast/index.d.ts +5 -0
  69. package/dist/lib/Components/core/Toast/index.d.ts.map +1 -0
  70. package/dist/lib/Components/core/Toast/styles.d.ts +20 -0
  71. package/dist/lib/Components/core/Toast/styles.d.ts.map +1 -0
  72. package/dist/lib/Components/core/Toast/styles.js +77 -0
  73. package/dist/lib/Components/core/Toast/types.d.ts +81 -0
  74. package/dist/lib/Components/core/Toast/types.d.ts.map +1 -0
  75. package/dist/lib/Components/core/Trend/Trend.js +2 -2
  76. package/dist/lib/Components/core/index.d.ts +2 -0
  77. package/dist/lib/Components/core/index.d.ts.map +1 -1
  78. package/dist/lib/Components/internal/BaseButton/BaseButton.js +2 -2
  79. package/dist/lib/Components/internal/BaseInput/BaseInput.js +9 -9
  80. package/dist/lib/Components/internal/BaseInput/BaseInputMultiline.js +12 -12
  81. package/dist/lib/Components/internal/BaseTag/BaseTag.js +8 -8
  82. package/dist/lib/Components/symbols/Icon/Icon.js +4 -4
  83. package/dist/lib/Components/symbols/Icon/createIcon.js +8 -8
  84. package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.js +6 -6
  85. package/dist/lib/Components/visualization/DonutChart/donutSizeContext.js +2 -2
  86. package/dist/lib/Components/visualization/Legend/Legend.js +8 -8
  87. package/dist/libs/utils-shared/dist/index.js +306 -141
  88. package/dist/package.json +3 -3
  89. package/package.json +3 -3
@@ -0,0 +1,68 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { cn as l } from "../../../../libs/utils-shared/dist/index.js";
3
+ import { toastVariants as x } from "./styles.js";
4
+ import { useCommonTranslation as N } from "../../../../i18n/useCommonTranslation.js";
5
+ import { Spinner as v } from "../Spinner/Spinner.js";
6
+ import { Button as u } from "../Button/Button.js";
7
+ import { IconButton as k } from "../IconButton/IconButton.js";
8
+ import { Close as b } from "../../symbols/icons/Close.js";
9
+ import { DeleteCircleFill as w } from "../../symbols/icons/DeleteCircleFill.js";
10
+ import { WarningFill as z } from "../../symbols/icons/WarningFill.js";
11
+ import { CheckmarkCircleFill as C } from "../../symbols/icons/CheckmarkCircleFill.js";
12
+ const g = {
13
+ success: /* @__PURE__ */ e(C, { size: 20, className: "text-success-on-interactive" }),
14
+ warning: /* @__PURE__ */ e(z, { size: 20, className: "text-warning-on-interactive" }),
15
+ error: /* @__PURE__ */ e(w, { size: 20, className: "text-error-on-interactive" })
16
+ }, V = ({
17
+ ref: n,
18
+ appearance: s = "info",
19
+ loading: i = !1,
20
+ title: m,
21
+ action: r,
22
+ onClose: o,
23
+ closeAriaLabel: c,
24
+ className: f,
25
+ role: p,
26
+ ...d
27
+ }) => {
28
+ const { t: h } = N(), t = i || s !== "info";
29
+ return /* @__PURE__ */ a(
30
+ "div",
31
+ {
32
+ ref: n,
33
+ role: p ?? (s === "error" || s === "warning" ? "alert" : "status"),
34
+ className: l(x({ hasLeading: t }), f),
35
+ ...d,
36
+ children: [
37
+ i ? /* @__PURE__ */ e("div", { className: "pt-10", children: /* @__PURE__ */ e(v, { size: 20, className: "shrink-0 text-on-interactive" }) }) : s !== "info" && /* @__PURE__ */ e("span", { className: "flex shrink-0 pt-10", children: g[s] }),
38
+ /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-1 flex-wrap items-start gap-8", children: [
39
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-auto pt-10 pr-16 last:pb-10", children: /* @__PURE__ */ e("p", { className: "line-clamp-5 body-2", children: m }) }),
40
+ r && /* @__PURE__ */ e(
41
+ u,
42
+ {
43
+ appearance: "base",
44
+ size: "sm",
45
+ className: l("shrink-0", t && "-ml-16"),
46
+ onClick: r.onAction,
47
+ children: r.label
48
+ }
49
+ )
50
+ ] }),
51
+ o && /* @__PURE__ */ e(
52
+ k,
53
+ {
54
+ appearance: "base",
55
+ size: "sm",
56
+ className: "shrink-0",
57
+ icon: b,
58
+ onClick: () => o(),
59
+ "aria-label": c || h("common.closeAriaLabel")
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ };
66
+ export {
67
+ V as Toast
68
+ };
@@ -0,0 +1,27 @@
1
+ import { ToasterProps } from './types';
2
+ /**
3
+ * Subscribes to the module-level toast store and renders the queue viewport
4
+ * in a portal on `document.body`. Mount it once, anywhere in the tree — it
5
+ * takes no children. `toast.*` from `@ledgerhq/lumen-utils-shared` works even
6
+ * before this mounts, or from outside the React tree entirely.
7
+ *
8
+ * Mount exactly one `<Toaster />` for the whole app. Every instance renders
9
+ * the full queue, so a second one duplicates every toast on screen — mounting
10
+ * more than one logs a console warning.
11
+ *
12
+ * @see {@link https://ldls.vercel.app/?path=/docs/react-toast--docs Guidelines}
13
+ *
14
+ * @example
15
+ * import { Toaster } from '@ledgerhq/lumen-ui-react';
16
+ *
17
+ * function App() {
18
+ * return (
19
+ * <>
20
+ * <Toaster position="bottom-right" maxItems={3} />
21
+ * <Routes />
22
+ * </>
23
+ * );
24
+ * }
25
+ */
26
+ export declare const Toaster: ({ maxItems, position, insets, durations, }: ToasterProps) => import('react').ReactPortal | null;
27
+ //# sourceMappingURL=Toaster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Toast/Toaster.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAa,YAAY,EAAiB,MAAM,SAAS,CAAC;AAqDtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,GAAI,4CAKrB,YAAY,uCA+Cd,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { toastStore as n, resolveMaxItems as v, useToastBacklog as g, resolveDurationMs as b, useToastLifecycle as T } from "../../../../libs/utils-shared/dist/index.js";
3
+ import { useSyncExternalStore as S, useState as x, useEffect as y } from "react";
4
+ import { createPortal as M } from "react-dom";
5
+ import { useToastCollapse as V } from "./hooks/useToastCollapse.js";
6
+ import { useToastViewportPause as E } from "./hooks/useToastViewportPause.js";
7
+ import { positionVariants as w, collapseVariants as C, slideExitVariants as I, queuedEnterVariants as N, slideEnterVariants as P } from "./styles.js";
8
+ import { Toast as W } from "./Toast.js";
9
+ const q = ({
10
+ item: t,
11
+ durationMs: s,
12
+ queued: o,
13
+ position: r,
14
+ paused: c,
15
+ onDismiss: d
16
+ }) => {
17
+ const e = t.exiting ?? !1, { contentRef: u, height: p } = V();
18
+ T({ durationMs: s, paused: c, exiting: e, onDismiss: d });
19
+ const a = r.startsWith("top") ? "top" : "bottom", m = () => e ? I({ position: r }) : o ? N({ edge: a }) : P({ position: r });
20
+ return /* @__PURE__ */ l(
21
+ "div",
22
+ {
23
+ "data-slot": "toast-collapse",
24
+ className: C({ edge: a, exiting: e }),
25
+ style: { height: e ? 0 : p },
26
+ children: /* @__PURE__ */ l(
27
+ "div",
28
+ {
29
+ ref: u,
30
+ "data-slot": "toast-item",
31
+ className: m(),
32
+ style: e ? { animationFillMode: "forwards" } : void 0,
33
+ children: /* @__PURE__ */ l(
34
+ W,
35
+ {
36
+ appearance: t.appearance,
37
+ loading: t.loading,
38
+ title: t.title,
39
+ action: t.action,
40
+ onClose: t.dismissible ? d : void 0
41
+ }
42
+ )
43
+ }
44
+ )
45
+ }
46
+ );
47
+ }, G = ({
48
+ maxItems: t = 3,
49
+ position: s = "bottom-right",
50
+ insets: o = {},
51
+ durations: r
52
+ }) => {
53
+ const c = S(
54
+ n.subscribe,
55
+ n.getSnapshot,
56
+ n.getServerSnapshot
57
+ ), [d, e] = x(!1), { paused: u, viewportProps: p } = E();
58
+ y(() => (e(!0), n.registerRenderer()), []);
59
+ const a = v(t), m = c.slice(0, a), h = g(c, a), f = s.startsWith("top");
60
+ return d ? M(
61
+ /* @__PURE__ */ l(
62
+ "div",
63
+ {
64
+ "data-slot": "toast-viewport",
65
+ className: w({ position: s }),
66
+ style: {
67
+ left: o.left,
68
+ right: o.right,
69
+ top: f ? o.top : void 0,
70
+ bottom: f ? void 0 : o.bottom
71
+ },
72
+ ...p,
73
+ children: m.map((i) => /* @__PURE__ */ l(
74
+ q,
75
+ {
76
+ item: i,
77
+ durationMs: b(i, r),
78
+ queued: h(i.id),
79
+ position: s,
80
+ paused: u,
81
+ onDismiss: () => n.dismiss(i.id)
82
+ },
83
+ i.id
84
+ ))
85
+ }
86
+ ),
87
+ document.body
88
+ ) : null;
89
+ };
90
+ export {
91
+ G as Toaster
92
+ };
@@ -0,0 +1,15 @@
1
+ import { RefObject } from 'react';
2
+ type UseToastCollapseReturn = {
3
+ contentRef: RefObject<HTMLDivElement | null>;
4
+ height: number | undefined;
5
+ };
6
+ /**
7
+ * Measures the toast content so the collapse slot can animate its height.
8
+ * `height` stays `undefined` until the first observation, leaving the slot
9
+ * at its intrinsic size.
10
+ *
11
+ * @internal
12
+ */
13
+ export declare const useToastCollapse: () => UseToastCollapseReturn;
14
+ export {};
15
+ //# sourceMappingURL=useToastCollapse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToastCollapse.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/core/Toast/hooks/useToastCollapse.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpE,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,QAAO,sBAgBnC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { useRef as c, useState as u, useEffect as i } from "react";
2
+ const f = 8, d = () => {
3
+ const e = c(null), [s, r] = u(null);
4
+ return i(() => {
5
+ const t = e.current;
6
+ if (!t || typeof ResizeObserver > "u") return;
7
+ const n = new ResizeObserver(([o]) => {
8
+ r(o.contentRect.height + f);
9
+ });
10
+ return n.observe(t), () => n.disconnect();
11
+ }, []), { contentRef: e, height: s ?? void 0 };
12
+ };
13
+ export {
14
+ d as useToastCollapse
15
+ };
@@ -0,0 +1,24 @@
1
+ import { FocusEvent } from 'react';
2
+ type ToastViewportPauseProps = {
3
+ onMouseEnter: () => void;
4
+ onMouseLeave: () => void;
5
+ onPointerDown: () => void;
6
+ onPointerUp: () => void;
7
+ onPointerCancel: () => void;
8
+ onFocus: () => void;
9
+ onBlur: (event: FocusEvent<HTMLDivElement>) => void;
10
+ };
11
+ type UseToastViewportPauseReturn = {
12
+ paused: boolean;
13
+ viewportProps: ToastViewportPauseProps;
14
+ };
15
+ /**
16
+ * Pauses toast timers while the pointer rests on the viewport, or while
17
+ * keyboard focus is inside it. A pointer press does not count as focus, so
18
+ * clicking an action does not keep the toast open after the pointer leaves.
19
+ *
20
+ * @internal
21
+ */
22
+ export declare const useToastViewportPause: () => UseToastViewportPauseReturn;
23
+ export {};
24
+ //# sourceMappingURL=useToastViewportPause.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToastViewportPause.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/core/Toast/hooks/useToastViewportPause.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1D,KAAK,uBAAuB,GAAG;IAC7B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,uBAAuB,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAO,2BA8BxC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { useState as s, useRef as i } from "react";
2
+ const f = () => {
3
+ const [u, t] = s(!1), [a, e] = s(!1), r = i(!1), o = () => {
4
+ r.current = !1;
5
+ };
6
+ return {
7
+ paused: u || a,
8
+ viewportProps: {
9
+ onMouseEnter: () => t(!0),
10
+ onMouseLeave: () => t(!1),
11
+ onPointerDown: () => {
12
+ r.current = !0, e(!1);
13
+ },
14
+ onPointerUp: o,
15
+ onPointerCancel: o,
16
+ onFocus: () => {
17
+ r.current || e(!0);
18
+ },
19
+ onBlur: (n) => {
20
+ n.currentTarget.contains(n.relatedTarget) || e(!1);
21
+ }
22
+ }
23
+ };
24
+ };
25
+ export {
26
+ f as useToastViewportPause
27
+ };
@@ -0,0 +1,5 @@
1
+ export { toast } from '@ledgerhq/lumen-utils-shared';
2
+ export { Toast } from './Toast';
3
+ export { Toaster } from './Toaster';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ export declare const toastVariants: (props?: ({
2
+ hasLeading?: boolean | null | undefined;
3
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
4
+ export declare const positionVariants: (props?: ({
5
+ position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export declare const collapseVariants: (props?: ({
8
+ edge?: "bottom" | "top" | null | undefined;
9
+ exiting?: boolean | null | undefined;
10
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
11
+ export declare const slideEnterVariants: (props?: ({
12
+ position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | null | undefined;
13
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
14
+ export declare const queuedEnterVariants: (props?: ({
15
+ edge?: "bottom" | "top" | null | undefined;
16
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
17
+ export declare const slideExitVariants: (props?: ({
18
+ position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | null | undefined;
19
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
20
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Toast/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;8EAUzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;8EAc5B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;8EAc5B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;8EAW7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;8EAO9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;8EAW5B,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { cva as t } from "class-variance-authority";
2
+ const o = t(
3
+ "flex min-h-56 w-full items-start gap-8 rounded-md bg-interactive py-8 pr-10 text-on-interactive",
4
+ {
5
+ variants: {
6
+ hasLeading: {
7
+ true: "pl-12",
8
+ false: "pl-16"
9
+ }
10
+ }
11
+ }
12
+ ), i = t(
13
+ "pointer-events-none fixed inset-x-24 z-toast flex",
14
+ {
15
+ variants: {
16
+ position: {
17
+ "top-left": "top-24 flex-col items-start",
18
+ "top-center": "top-24 flex-col items-center",
19
+ "top-right": "top-24 flex-col items-end",
20
+ "bottom-left": "bottom-24 flex-col-reverse items-start",
21
+ "bottom-center": "bottom-24 flex-col-reverse items-center",
22
+ "bottom-right": "bottom-24 flex-col-reverse items-end"
23
+ }
24
+ }
25
+ }
26
+ ), n = t(
27
+ "pointer-events-auto flex w-full max-w-400 flex-col transition-[height] duration-300 ease-out",
28
+ {
29
+ variants: {
30
+ edge: {
31
+ top: "justify-start",
32
+ bottom: "justify-end"
33
+ },
34
+ exiting: {
35
+ true: "z-0",
36
+ false: "z-10"
37
+ }
38
+ }
39
+ }
40
+ ), a = t("", {
41
+ variants: {
42
+ position: {
43
+ "top-left": "animate-slide-in-from-left",
44
+ "top-center": "animate-slide-in-from-top",
45
+ "top-right": "animate-slide-in-from-right",
46
+ "bottom-left": "animate-slide-in-from-left",
47
+ "bottom-center": "animate-slide-in-from-bottom",
48
+ "bottom-right": "animate-slide-in-from-right"
49
+ }
50
+ }
51
+ }), s = t("", {
52
+ variants: {
53
+ edge: {
54
+ top: "animate-slide-in-from-bottom",
55
+ bottom: "animate-slide-in-from-top"
56
+ }
57
+ }
58
+ }), r = t("", {
59
+ variants: {
60
+ position: {
61
+ "top-left": "animate-slide-out-to-left",
62
+ "top-center": "animate-slide-out-to-top",
63
+ "top-right": "animate-slide-out-to-right",
64
+ "bottom-left": "animate-slide-out-to-left",
65
+ "bottom-center": "animate-slide-out-to-bottom",
66
+ "bottom-right": "animate-slide-out-to-right"
67
+ }
68
+ }
69
+ });
70
+ export {
71
+ n as collapseVariants,
72
+ i as positionVariants,
73
+ s as queuedEnterVariants,
74
+ a as slideEnterVariants,
75
+ r as slideExitVariants,
76
+ o as toastVariants
77
+ };
@@ -0,0 +1,81 @@
1
+ import { ToastAction, ToastAppearance } from '@ledgerhq/lumen-utils-shared';
2
+ import { ComponentPropsWithRef } from 'react';
3
+ export type { ToastAction, ToastAppearance, ToastController, ToastItem, ToastNotifyOptions, ToastPromiseOptions, ToastPromiseState, ToastUpdateOptions, } from '@ledgerhq/lumen-utils-shared';
4
+ /**
5
+ * Corner or edge the queue is anchored to. Items enter from the same edge.
6
+ */
7
+ export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
8
+ /**
9
+ * Props for the presentational `Toast` item.
10
+ */
11
+ export type ToastProps = {
12
+ /**
13
+ * The status of the toast, driving the leading icon.
14
+ * @default info
15
+ */
16
+ appearance?: ToastAppearance;
17
+ /**
18
+ * Replaces the leading status icon with a spinner.
19
+ * @default false
20
+ */
21
+ loading?: boolean;
22
+ /**
23
+ * The main text. Wraps over up to five lines, then truncates.
24
+ * @required
25
+ */
26
+ title: string;
27
+ /**
28
+ * Optional trailing action button. Pressing it does not dismiss the toast.
29
+ * It wraps onto its own row, aligned with the title, when it cannot share
30
+ * the title's row.
31
+ */
32
+ action?: ToastAction;
33
+ /**
34
+ * Optional close handler. When provided, a close button is rendered, pinned
35
+ * to the top right whatever the title and action wrap to.
36
+ */
37
+ onClose?: () => void;
38
+ /**
39
+ * Accessible label for the close button.
40
+ */
41
+ closeAriaLabel?: string;
42
+ } & Omit<ComponentPropsWithRef<'div'>, 'title'>;
43
+ /**
44
+ * Distance from each viewport edge, in px, replacing the default gap on that
45
+ * edge — e.g. the height of a sticky composer plus some breathing room.
46
+ * `top` and `bottom` apply only to the edge matching `position`; the other is
47
+ * ignored. Unset edges keep the default gap.
48
+ */
49
+ export type ToastInsets = {
50
+ top?: number;
51
+ left?: number;
52
+ bottom?: number;
53
+ right?: number;
54
+ };
55
+ /**
56
+ * Props for `Toaster`.
57
+ */
58
+ export type ToasterProps = {
59
+ /**
60
+ * Maximum number of toasts visible at once. Must be a positive integer.
61
+ * Extra items wait in a FIFO backlog and appear as visible slots free up.
62
+ * @default 3
63
+ */
64
+ maxItems?: number;
65
+ /**
66
+ * The corner or edge the queue is anchored to.
67
+ * @default bottom-right
68
+ */
69
+ position?: ToastPosition;
70
+ /**
71
+ * Per-edge distance from the viewport edge, overriding the default gap, so
72
+ * the queue stays clear of fixed UI such as a composer or a bottom bar.
73
+ * @default {}
74
+ */
75
+ insets?: ToastInsets;
76
+ /**
77
+ * Per-appearance duration overrides, layered over the Lumen status defaults.
78
+ */
79
+ durations?: Partial<Record<ToastAppearance, number>>;
80
+ };
81
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Toast/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,YAAY,EACV,WAAW,EACX,eAAe,EACf,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;CACtD,CAAC"}
@@ -40,7 +40,7 @@ const T = f("inline-flex items-center", {
40
40
  negative: v,
41
41
  neutral: null
42
42
  };
43
- function M({
43
+ function L({
44
44
  value: e,
45
45
  size: t = "md",
46
46
  disabled: r = !1,
@@ -67,5 +67,5 @@ function M({
67
67
  );
68
68
  }
69
69
  export {
70
- M as Trend
70
+ L as Trend
71
71
  };
@@ -47,6 +47,8 @@ export * from './Tag';
47
47
  export * from './TextInput';
48
48
  export * from './Tile';
49
49
  export * from './TileButton';
50
+ export * from './Timeline';
51
+ export * from './Toast';
50
52
  export * from './Tooltip';
51
53
  export * from './Trend';
52
54
  export * from './ThemeProvider';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AA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AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
@@ -65,7 +65,7 @@ const N = l(
65
65
  true: "text-disabled"
66
66
  }
67
67
  }
68
- }), C = ({
68
+ }), M = ({
69
69
  ref: c,
70
70
  className: u,
71
71
  appearance: a = "base",
@@ -122,6 +122,6 @@ const N = l(
122
122
  );
123
123
  };
124
124
  export {
125
- C as BaseButton,
125
+ M as BaseButton,
126
126
  N as baseButtonVariants
127
127
  };
@@ -79,33 +79,33 @@ const ue = O(
79
79
  currentValue: z,
80
80
  hasContent: M,
81
81
  handleChange: T,
82
- handleClear: E
82
+ handleClear: X
83
83
  } = ie({
84
84
  value: i.value,
85
85
  defaultValue: i.defaultValue,
86
86
  onChange: R,
87
87
  onClear: j,
88
88
  ref: w
89
- }), G = ee(), c = x || `input-${G}`, J = D ?? (n === "error" ? !0 : void 0), { inputPlaceholder: K, labelStaysFloatedWithPlaceholder: Q } = _({
89
+ }), E = ee(), c = x || `input-${E}`, G = D ?? (n === "error" ? !0 : void 0), { inputPlaceholder: J, labelStaysFloatedWithPlaceholder: K } = _({
90
90
  label: t,
91
91
  placeholder: S
92
- }), U = M && !h && !m && !F, X = z.length, p = !!(r && r > 0), g = `${c}-helper`, o = !!l, b = {
92
+ }), Q = M && !h && !m && !F, U = z.length, p = !!(r && r > 0), g = `${c}-helper`, o = !!l, b = {
93
93
  id: c,
94
94
  disabled: h,
95
95
  readOnly: m,
96
- placeholder: K,
97
- "aria-invalid": J,
96
+ placeholder: J,
97
+ "aria-invalid": G,
98
98
  "aria-describedby": o ? g : void 0,
99
99
  hasLabel: !!t,
100
100
  className: L,
101
101
  onChange: T
102
- }, u = U ? /* @__PURE__ */ e(
102
+ }, u = Q ? /* @__PURE__ */ e(
103
103
  le,
104
104
  {
105
105
  iconType: "filled",
106
106
  icon: ce,
107
107
  size: 20,
108
- onClick: E,
108
+ onClick: X,
109
109
  "aria-label": k("components.baseInput.clearInputAriaLabel")
110
110
  }
111
111
  ) : N;
@@ -156,7 +156,7 @@ const ue = O(
156
156
  {
157
157
  htmlFor: c,
158
158
  status: n,
159
- floated: Q,
159
+ floated: K,
160
160
  multiline: s,
161
161
  className: V,
162
162
  children: t
@@ -182,7 +182,7 @@ const ue = O(
182
182
  status: n
183
183
  }
184
184
  ),
185
- p && r != null && /* @__PURE__ */ e(te, { count: X, maxCount: r })
185
+ p && r != null && /* @__PURE__ */ e(te, { count: U, maxCount: r })
186
186
  ]
187
187
  }
188
188
  )
@@ -25,11 +25,11 @@ const c = x(
25
25
  scrollbarWidth: "auto"
26
26
  }
27
27
  }
28
- ), R = (s, r) => {
28
+ ), R = (s, a) => {
29
29
  const t = v(!1), o = (e) => {
30
- const a = e.target, n = "isComposing" in e.nativeEvent && e.nativeEvent.isComposing === !0;
31
- t.current = !n && a.value.endsWith(`
32
- `) && a.selectionStart === a.value.length, r?.(e);
30
+ const r = e.target, n = "isComposing" in e.nativeEvent && e.nativeEvent.isComposing === !0;
31
+ t.current = !n && r.value.endsWith(`
32
+ `) && r.selectionStart === r.value.length, a?.(e);
33
33
  };
34
34
  return w(() => {
35
35
  if (!t.current) return;
@@ -37,13 +37,13 @@ const c = x(
37
37
  const e = s.current;
38
38
  !e || document.activeElement !== e || (e.scrollTop = e.scrollHeight);
39
39
  }), o;
40
- }, I = ({
40
+ }, z = ({
41
41
  ref: s,
42
- className: r,
42
+ className: a,
43
43
  hasLabel: t = !1,
44
44
  minLines: o = 1,
45
45
  maxLines: e,
46
- scrollbarWidth: a = "auto",
46
+ scrollbarWidth: r = "auto",
47
47
  onChange: n,
48
48
  ...d
49
49
  }) => {
@@ -59,9 +59,9 @@ const c = x(
59
59
  rows: o,
60
60
  className: u(
61
61
  "peer",
62
- c({ hasLabel: t, scrollbarWidth: a }),
62
+ c({ hasLabel: t, scrollbarWidth: r }),
63
63
  t && "mt-16",
64
- r
64
+ a
65
65
  ),
66
66
  onChange: h,
67
67
  ...d
@@ -75,8 +75,8 @@ const c = x(
75
75
  readOnly: !0,
76
76
  tabIndex: -1,
77
77
  className: u(
78
- c({ hasLabel: t, scrollbarWidth: a }),
79
- r,
78
+ c({ hasLabel: t, scrollbarWidth: r }),
79
+ a,
80
80
  "invisible absolute top-0 left-0 h-0 transform-gpu overflow-hidden py-0"
81
81
  )
82
82
  }
@@ -84,5 +84,5 @@ const c = x(
84
84
  ] });
85
85
  };
86
86
  export {
87
- I as BaseInputMultiline
87
+ z as BaseInputMultiline
88
88
  };