@ledgerhq/lumen-ui-react 0.1.61 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -63
- package/dist/lib/Components/core/AddressInput/AddressInput.js +1 -1
- package/dist/lib/Components/core/AmountDisplay/AmountDisplay.js +1 -1
- package/dist/lib/Components/core/AmountInput/AmountInput.js +17 -17
- package/dist/lib/Components/core/AmountInput/useAmountInputValue/useAmountInputValue.js +3 -3
- package/dist/lib/Components/core/Avatar/Avatar.js +7 -7
- package/dist/lib/Components/core/Avatar/resolveAvatarColor.js +2 -2
- package/dist/lib/Components/core/AvatarButton/AvatarButton.js +2 -2
- package/dist/lib/Components/core/Banner/Banner.js +9 -9
- package/dist/lib/Components/core/Button/Button.js +4 -4
- package/dist/lib/Components/core/Card/Card.js +15 -15
- package/dist/lib/Components/core/CardButton/CardButton.d.ts +2 -0
- package/dist/lib/Components/core/CardButton/CardButton.d.ts.map +1 -1
- package/dist/lib/Components/core/CardButton/CardButton.js +4 -4
- package/dist/lib/Components/core/ContentBanner/ContentBanner.js +1 -1
- package/dist/lib/Components/core/DataTable/DataTable.js +42 -42
- package/dist/lib/Components/core/Dialog/DialogHeader/DialogHeader.js +1 -1
- package/dist/lib/Components/core/Divider/Divider.js +4 -4
- package/dist/lib/Components/core/DotCount/DotCount.js +3 -3
- package/dist/lib/Components/core/DotIcon/DotIcon.js +11 -11
- package/dist/lib/Components/core/DotSymbol/DotSymbol.js +7 -7
- package/dist/lib/Components/core/Link/Link.d.ts +1 -1
- package/dist/lib/Components/core/Link/Link.d.ts.map +1 -1
- package/dist/lib/Components/core/Link/Link.js +25 -23
- package/dist/lib/Components/core/Link/types.d.ts +1 -1
- package/dist/lib/Components/core/Link/types.d.ts.map +1 -1
- package/dist/lib/Components/core/ListItem/ListItem.js +8 -8
- package/dist/lib/Components/core/MediaBanner/MediaBanner.js +4 -4
- package/dist/lib/Components/core/MediaCard/MediaCard.js +1 -1
- package/dist/lib/Components/core/MediaImage/MediaImage.js +5 -5
- package/dist/lib/Components/core/Menu/Menu.js +25 -25
- package/dist/lib/Components/core/NavBar/CoinCapsule.js +4 -4
- package/dist/lib/Components/core/NavBar/NavBar.js +3 -3
- package/dist/lib/Components/core/PageIndicator/PageIndicator.js +5 -5
- package/dist/lib/Components/core/Pagination/Pagination.js +1 -1
- package/dist/lib/Components/core/Popover/Popover.js +13 -13
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.js +80 -84
- package/dist/lib/Components/core/Select/Select.d.ts.map +1 -1
- package/dist/lib/Components/core/Select/Select.js +108 -107
- package/dist/lib/Components/core/SideBar/SideBar.js +33 -33
- package/dist/lib/Components/core/Spinner/Spinner.js +1 -1
- package/dist/lib/Components/core/Spot/Spot.js +13 -13
- package/dist/lib/Components/core/Stepper/Stepper.d.ts +4 -3
- package/dist/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
- package/dist/lib/Components/core/Stepper/Stepper.js +137 -62
- package/dist/lib/Components/core/Stepper/types.d.ts +12 -2
- package/dist/lib/Components/core/Stepper/types.d.ts.map +1 -1
- package/dist/lib/Components/core/Subheader/Subheader.d.ts.map +1 -1
- package/dist/lib/Components/core/Subheader/Subheader.js +33 -29
- package/dist/lib/Components/core/Table/Table.js +10 -10
- package/dist/lib/Components/core/ThemeProvider/ThemeProvider.js +6 -6
- package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts +1 -1
- package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts.map +1 -1
- package/dist/lib/Components/core/Timeline/Timeline.d.ts +54 -0
- package/dist/lib/Components/core/Timeline/Timeline.d.ts.map +1 -0
- package/dist/lib/Components/core/Timeline/Timeline.js +228 -0
- package/dist/lib/Components/core/Timeline/index.d.ts +3 -0
- package/dist/lib/Components/core/Timeline/index.d.ts.map +1 -0
- package/dist/lib/Components/core/Timeline/types.d.ts +148 -0
- package/dist/lib/Components/core/Timeline/types.d.ts.map +1 -0
- package/dist/lib/Components/core/Toast/Toast.d.ts +25 -0
- package/dist/lib/Components/core/Toast/Toast.d.ts.map +1 -0
- package/dist/lib/Components/core/Toast/Toast.js +68 -0
- package/dist/lib/Components/core/Toast/Toaster.d.ts +27 -0
- package/dist/lib/Components/core/Toast/Toaster.d.ts.map +1 -0
- package/dist/lib/Components/core/Toast/Toaster.js +92 -0
- package/dist/lib/Components/core/Toast/hooks/useToastCollapse.d.ts +15 -0
- package/dist/lib/Components/core/Toast/hooks/useToastCollapse.d.ts.map +1 -0
- package/dist/lib/Components/core/Toast/hooks/useToastCollapse.js +15 -0
- package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.d.ts +24 -0
- package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.d.ts.map +1 -0
- package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.js +27 -0
- package/dist/lib/Components/core/Toast/index.d.ts +5 -0
- package/dist/lib/Components/core/Toast/index.d.ts.map +1 -0
- package/dist/lib/Components/core/Toast/styles.d.ts +20 -0
- package/dist/lib/Components/core/Toast/styles.d.ts.map +1 -0
- package/dist/lib/Components/core/Toast/styles.js +77 -0
- package/dist/lib/Components/core/Toast/types.d.ts +81 -0
- package/dist/lib/Components/core/Toast/types.d.ts.map +1 -0
- package/dist/lib/Components/core/Trend/Trend.js +3 -3
- package/dist/lib/Components/core/index.d.ts +2 -0
- package/dist/lib/Components/core/index.d.ts.map +1 -1
- package/dist/lib/Components/internal/BaseButton/BaseButton.js +7 -7
- package/dist/lib/Components/internal/BaseInput/BaseInput.js +22 -22
- package/dist/lib/Components/internal/BaseInput/BaseInputMultiline.js +12 -12
- package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/useAutosizeTextarea.js +4 -4
- package/dist/lib/Components/internal/BaseTag/BaseTag.js +4 -4
- package/dist/lib/Components/symbols/Icon/createIcon.js +3 -3
- package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -1
- package/dist/lib/Components/visualization/CartesianChart/CartesianChart.js +36 -35
- package/dist/lib/Components/visualization/CartesianChart/types.d.ts +1 -1
- package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -1
- package/dist/lib/Components/visualization/DonutChart/DonutChart.js +31 -31
- package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.js +2 -2
- package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -1
- package/dist/lib/Components/visualization/DonutChart/DonutRing.js +13 -12
- package/dist/lib/Components/visualization/DonutChart/types.d.ts +1 -1
- package/dist/lib/Components/visualization/Legend/Legend.d.ts +1 -1
- package/dist/lib/Components/visualization/Legend/Legend.d.ts.map +1 -1
- package/dist/lib/Components/visualization/Legend/Legend.js +6 -10
- package/dist/lib/Components/visualization/Legend/types.d.ts +2 -2
- package/dist/lib/Components/visualization/LineChart/LineChart.d.ts +1 -1
- package/dist/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -1
- package/dist/lib/Components/visualization/LineChart/LineChart.js +90 -84
- package/dist/lib/Components/visualization/LineChart/types.d.ts +1 -1
- package/dist/lib/Components/visualization/LineChart/utils.d.ts +2 -1
- package/dist/lib/Components/visualization/LineChart/utils.d.ts.map +1 -1
- package/dist/lib/Components/visualization/LineChart/utils.js +23 -22
- package/dist/lib/Components/visualization/config.d.ts +0 -3
- package/dist/lib/Components/visualization/config.d.ts.map +1 -1
- package/dist/lib/Components/visualization/config.js +3 -6
- package/dist/libs/utils-shared/dist/index.js +353 -140
- package/dist/package.json +4 -6
- package/dist/translations/index.d.ts +3 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/{i18n → translations}/languages.d.ts +0 -5
- package/dist/translations/languages.d.ts.map +1 -0
- package/dist/{i18n → translations}/languages.js +1 -2
- package/dist/{i18n → translations}/locales/en.json.d.ts +11 -0
- package/dist/{i18n → translations}/locales/en.json.js +2 -2
- package/dist/translations/translations.d.ts +727 -0
- package/dist/translations/translations.d.ts.map +1 -0
- package/dist/translations/translations.js +22 -0
- package/package.json +4 -6
- package/dist/_virtual/dynamic-import-helper.js +0 -9
- package/dist/i18n/I18nProvider.d.ts +0 -8
- package/dist/i18n/I18nProvider.d.ts.map +0 -1
- package/dist/i18n/I18nProvider.js +0 -14
- package/dist/i18n/i18n.d.ts +0 -12
- package/dist/i18n/i18n.d.ts.map +0 -1
- package/dist/i18n/i18n.js +0 -42
- package/dist/i18n/index.d.ts +0 -4
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/languages.d.ts.map +0 -1
- package/dist/i18n/useCommonTranslation.d.ts +0 -2
- package/dist/i18n/useCommonTranslation.d.ts.map +0 -1
- package/dist/i18n/useCommonTranslation.js +0 -6
- package/dist/node_modules/i18next/dist/esm/i18next.js +0 -1479
- package/dist/node_modules/react-i18next/dist/es/I18nextProvider.js +0 -19
- package/dist/node_modules/react-i18next/dist/es/context.js +0 -17
- package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -22
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -8
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -11
- package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -25
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -65
- package/dist/node_modules/react-i18next/dist/es/utils.js +0 -57
- /package/dist/{i18n → translations}/locales/de.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/de.json.js +0 -0
- /package/dist/{i18n → translations}/locales/es.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/es.json.js +0 -0
- /package/dist/{i18n → translations}/locales/fr.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/fr.json.js +0 -0
- /package/dist/{i18n → translations}/locales/ja.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/ja.json.js +0 -0
- /package/dist/{i18n → translations}/locales/ko.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/ko.json.js +0 -0
- /package/dist/{i18n → translations}/locales/pt.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/pt.json.js +0 -0
- /package/dist/{i18n → translations}/locales/ru.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/ru.json.js +0 -0
- /package/dist/{i18n → translations}/locales/th.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/th.json.js +0 -0
- /package/dist/{i18n → translations}/locales/tr.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/tr.json.js +0 -0
- /package/dist/{i18n → translations}/locales/zh.json.d.ts +0 -0
- /package/dist/{i18n → translations}/locales/zh.json.js +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { TimelineItemCaptionProps, TimelineItemBodyProps, TimelineItemDescriptionProps, TimelineItemHeaderProps, TimelineItemLeadingProps, TimelineItemLeadingRowProps, TimelineItemProps, TimelineItemTitleProps, TimelineItemTrailingProps, TimelineProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Vertical timeline. Lays out its items and holds no state of its own.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <Timeline>
|
|
7
|
+
* <TimelineItem>
|
|
8
|
+
* <TimelineItemHeader>
|
|
9
|
+
* <TimelineItemLeading>
|
|
10
|
+
* <TimelineItemTitle>Payment confirmed</TimelineItemTitle>
|
|
11
|
+
* </TimelineItemLeading>
|
|
12
|
+
* </TimelineItemHeader>
|
|
13
|
+
* </TimelineItem>
|
|
14
|
+
* </Timeline>
|
|
15
|
+
*/
|
|
16
|
+
export declare const Timeline: ({ ref, children, className, ...props }: TimelineProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* One row of a timeline. Draws the indicator from `status` and the connector
|
|
19
|
+
* to the neighbouring items.
|
|
20
|
+
*/
|
|
21
|
+
export declare const TimelineItem: ({ ref, status, children, className, ...props }: TimelineItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Row beside the indicator. Holds the leading column and the trailing slot.
|
|
24
|
+
*/
|
|
25
|
+
export declare const TimelineItemHeader: ({ ref, children, className, ...props }: TimelineItemHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Caption, title, and description column.
|
|
28
|
+
*/
|
|
29
|
+
export declare const TimelineItemLeading: ({ ref, children, className, ...props }: TimelineItemLeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* Horizontal row for a title or description beside a tag.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TimelineItemLeadingRow: ({ ref, children, className, ...props }: TimelineItemLeadingRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Overline above the title.
|
|
36
|
+
*/
|
|
37
|
+
export declare const TimelineItemCaption: ({ ref, children, className, ...props }: TimelineItemCaptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Title. An `idle` item uses the muted tone.
|
|
40
|
+
*/
|
|
41
|
+
export declare const TimelineItemTitle: ({ ref, children, className, ...props }: TimelineItemTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* Description under the title.
|
|
44
|
+
*/
|
|
45
|
+
export declare const TimelineItemDescription: ({ ref, children, className, ...props }: TimelineItemDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* End-aligned slot in the header.
|
|
48
|
+
*/
|
|
49
|
+
export declare const TimelineItemTrailing: ({ ref, children, className, ...props }: TimelineItemTrailingProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
/**
|
|
51
|
+
* Block under the header, indented past the indicator.
|
|
52
|
+
*/
|
|
53
|
+
export declare const TimelineItemBody: ({ ref, children, className, ...props }: TimelineItemBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
//# sourceMappingURL=Timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeline.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Timeline/Timeline.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,iBAAiB,EAEjB,sBAAsB,EACtB,yBAAyB,EACzB,aAAa,EACd,MAAM,SAAS,CAAC;AAmEjB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,GAAI,wCAKtB,aAAa,4CAUf,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,gDAM1B,iBAAiB,4CAiBnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,wCAKhC,uBAAuB,4CAmBzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,wCAKjC,wBAAwB,4CAU1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,wCAKpC,2BAA2B,4CAU7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,wCAKjC,wBAAwB,4CAU1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,wCAK/B,sBAAsB,4CAexB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,wCAKrC,4BAA4B,4CAU9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,wCAKlC,yBAAyB,4CAa3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,wCAK9B,qBAAqB,4CAUvB,CAAC"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { cn as s, createSafeContext as d } from "../../../../libs/utils-shared/dist/index.js";
|
|
3
|
+
import { cva as o } from "class-variance-authority";
|
|
4
|
+
import { Spinner as c } from "../Spinner/Spinner.js";
|
|
5
|
+
import { ClockFill as u } from "../../symbols/icons/ClockFill.js";
|
|
6
|
+
import { DeleteCircleFill as x } from "../../symbols/icons/DeleteCircleFill.js";
|
|
7
|
+
import { CheckmarkCircleFill as f } from "../../symbols/icons/CheckmarkCircleFill.js";
|
|
8
|
+
const [p, m] = d("TimelineItem"), N = o("min-w-0 truncate body-2-semi-bold", {
|
|
9
|
+
variants: {
|
|
10
|
+
muted: {
|
|
11
|
+
true: "text-muted",
|
|
12
|
+
false: "text-base"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}), h = /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "size-12 rounded-full bg-muted-pressed" }), b = {
|
|
16
|
+
success: /* @__PURE__ */ t(f, { "aria-hidden": !0, className: "text-success", size: 24 }),
|
|
17
|
+
error: /* @__PURE__ */ t(x, { "aria-hidden": !0, className: "text-error", size: 24 }),
|
|
18
|
+
pending: /* @__PURE__ */ t(u, { "aria-hidden": !0, className: "text-muted", size: 24 }),
|
|
19
|
+
loading: /* @__PURE__ */ t(c, { className: "text-muted", size: 24 }),
|
|
20
|
+
idle: /* @__PURE__ */ t(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
"aria-hidden": !0,
|
|
24
|
+
className: "size-20 rounded-full border-2 border-muted-subtle-hover"
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}, v = ({ status: e }) => /* @__PURE__ */ t(
|
|
28
|
+
"span",
|
|
29
|
+
{
|
|
30
|
+
className: "mt-16 flex size-32 shrink-0 items-center justify-center self-start",
|
|
31
|
+
"data-testid": `timeline-indicator-${e ?? "neutral"}`,
|
|
32
|
+
children: e ? b[e] : h
|
|
33
|
+
}
|
|
34
|
+
), T = () => /* @__PURE__ */ l(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
"aria-hidden": !0,
|
|
38
|
+
className: "pointer-events-none absolute inset-y-0 start-0 flex w-32 flex-col items-center",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ t(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
className: "h-16 w-0 shrink-0 border-l-2 border-muted-subtle-hover group-first/item:invisible",
|
|
44
|
+
"data-line": "in"
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ t("span", { className: "h-32 shrink-0" }),
|
|
48
|
+
/* @__PURE__ */ t(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
className: "w-0 flex-1 border-l-2 border-muted-subtle-hover group-last/item:hidden",
|
|
52
|
+
"data-line": "out"
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
), R = ({
|
|
58
|
+
ref: e,
|
|
59
|
+
children: i,
|
|
60
|
+
className: n,
|
|
61
|
+
...r
|
|
62
|
+
}) => /* @__PURE__ */ t(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
ref: e,
|
|
66
|
+
className: s("flex w-full min-w-0 flex-col", n),
|
|
67
|
+
...r,
|
|
68
|
+
children: i
|
|
69
|
+
}
|
|
70
|
+
), j = ({
|
|
71
|
+
ref: e,
|
|
72
|
+
status: i,
|
|
73
|
+
children: n,
|
|
74
|
+
className: r,
|
|
75
|
+
...a
|
|
76
|
+
}) => /* @__PURE__ */ t(p, { value: { status: i }, children: /* @__PURE__ */ l(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
ref: e,
|
|
80
|
+
"data-testid": "timeline-item",
|
|
81
|
+
className: s(
|
|
82
|
+
"group/item relative flex w-full min-w-0 flex-col",
|
|
83
|
+
r
|
|
84
|
+
),
|
|
85
|
+
...a,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ t(T, {}),
|
|
88
|
+
n
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
) }), F = ({
|
|
92
|
+
ref: e,
|
|
93
|
+
children: i,
|
|
94
|
+
className: n,
|
|
95
|
+
...r
|
|
96
|
+
}) => {
|
|
97
|
+
const { status: a } = m({
|
|
98
|
+
consumerName: "TimelineItemHeader",
|
|
99
|
+
contextRequired: !0
|
|
100
|
+
});
|
|
101
|
+
return /* @__PURE__ */ l(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
ref: e,
|
|
105
|
+
className: s(
|
|
106
|
+
"flex min-h-64 w-full min-w-0 items-center gap-8",
|
|
107
|
+
n
|
|
108
|
+
),
|
|
109
|
+
...r,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ t(v, { status: a }),
|
|
112
|
+
i
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}, S = ({
|
|
117
|
+
ref: e,
|
|
118
|
+
children: i,
|
|
119
|
+
className: n,
|
|
120
|
+
...r
|
|
121
|
+
}) => /* @__PURE__ */ t(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
ref: e,
|
|
125
|
+
className: s("flex min-w-0 flex-1 flex-col gap-2", n),
|
|
126
|
+
...r,
|
|
127
|
+
children: i
|
|
128
|
+
}
|
|
129
|
+
), q = ({
|
|
130
|
+
ref: e,
|
|
131
|
+
children: i,
|
|
132
|
+
className: n,
|
|
133
|
+
...r
|
|
134
|
+
}) => /* @__PURE__ */ t(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
ref: e,
|
|
138
|
+
className: s("flex min-w-0 items-center gap-4", n),
|
|
139
|
+
...r,
|
|
140
|
+
children: i
|
|
141
|
+
}
|
|
142
|
+
), B = ({
|
|
143
|
+
ref: e,
|
|
144
|
+
children: i,
|
|
145
|
+
className: n,
|
|
146
|
+
...r
|
|
147
|
+
}) => /* @__PURE__ */ t(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
ref: e,
|
|
151
|
+
className: s("min-w-0 truncate body-4 text-muted", n),
|
|
152
|
+
...r,
|
|
153
|
+
children: i
|
|
154
|
+
}
|
|
155
|
+
), D = ({
|
|
156
|
+
ref: e,
|
|
157
|
+
children: i,
|
|
158
|
+
className: n,
|
|
159
|
+
...r
|
|
160
|
+
}) => {
|
|
161
|
+
const { status: a } = m({
|
|
162
|
+
consumerName: "TimelineItemTitle",
|
|
163
|
+
contextRequired: !0
|
|
164
|
+
});
|
|
165
|
+
return /* @__PURE__ */ t(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
ref: e,
|
|
169
|
+
className: s(N({ muted: a === "idle" }), n),
|
|
170
|
+
...r,
|
|
171
|
+
children: i
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}, H = ({
|
|
175
|
+
ref: e,
|
|
176
|
+
children: i,
|
|
177
|
+
className: n,
|
|
178
|
+
...r
|
|
179
|
+
}) => /* @__PURE__ */ t(
|
|
180
|
+
"div",
|
|
181
|
+
{
|
|
182
|
+
ref: e,
|
|
183
|
+
className: s("min-w-0 truncate body-3 text-muted", n),
|
|
184
|
+
...r,
|
|
185
|
+
children: i
|
|
186
|
+
}
|
|
187
|
+
), L = ({
|
|
188
|
+
ref: e,
|
|
189
|
+
children: i,
|
|
190
|
+
className: n,
|
|
191
|
+
...r
|
|
192
|
+
}) => /* @__PURE__ */ t(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
ref: e,
|
|
196
|
+
className: s(
|
|
197
|
+
"ms-auto flex shrink-0 flex-col items-end text-end body-2-semi-bold text-base",
|
|
198
|
+
n
|
|
199
|
+
),
|
|
200
|
+
...r,
|
|
201
|
+
children: i
|
|
202
|
+
}
|
|
203
|
+
), P = ({
|
|
204
|
+
ref: e,
|
|
205
|
+
children: i,
|
|
206
|
+
className: n,
|
|
207
|
+
...r
|
|
208
|
+
}) => /* @__PURE__ */ t(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
ref: e,
|
|
212
|
+
className: s("ms-40 min-w-0 pt-8 pb-12 body-3 text-muted", n),
|
|
213
|
+
...r,
|
|
214
|
+
children: i
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
export {
|
|
218
|
+
R as Timeline,
|
|
219
|
+
j as TimelineItem,
|
|
220
|
+
P as TimelineItemBody,
|
|
221
|
+
B as TimelineItemCaption,
|
|
222
|
+
H as TimelineItemDescription,
|
|
223
|
+
F as TimelineItemHeader,
|
|
224
|
+
S as TimelineItemLeading,
|
|
225
|
+
q as TimelineItemLeadingRow,
|
|
226
|
+
D as TimelineItemTitle,
|
|
227
|
+
L as TimelineItemTrailing
|
|
228
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Timeline/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export type TimelineItemStatus = 'idle' | 'success' | 'error' | 'pending' | 'loading';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Timeline root.
|
|
5
|
+
*/
|
|
6
|
+
export type TimelineProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The timeline items.
|
|
9
|
+
* @required
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Custom classname.
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
17
|
+
/**
|
|
18
|
+
* Props for one timeline item.
|
|
19
|
+
*/
|
|
20
|
+
export type TimelineItemProps = {
|
|
21
|
+
/**
|
|
22
|
+
* Indicator and title tone. Omit it for a neutral item.
|
|
23
|
+
* @default undefined
|
|
24
|
+
*/
|
|
25
|
+
status?: TimelineItemStatus;
|
|
26
|
+
/**
|
|
27
|
+
* Header and content of the item.
|
|
28
|
+
* @required
|
|
29
|
+
*/
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Custom classname.
|
|
33
|
+
*/
|
|
34
|
+
className?: string;
|
|
35
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
36
|
+
/**
|
|
37
|
+
* Props for the row beside the indicator.
|
|
38
|
+
*/
|
|
39
|
+
export type TimelineItemHeaderProps = {
|
|
40
|
+
/**
|
|
41
|
+
* Leading and trailing parts.
|
|
42
|
+
* @required
|
|
43
|
+
*/
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Custom classname.
|
|
47
|
+
*/
|
|
48
|
+
className?: string;
|
|
49
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
50
|
+
/**
|
|
51
|
+
* Props for the text column opposite the trailing slot.
|
|
52
|
+
*/
|
|
53
|
+
export type TimelineItemLeadingProps = {
|
|
54
|
+
/**
|
|
55
|
+
* Caption, title, and description.
|
|
56
|
+
* @required
|
|
57
|
+
*/
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* Custom classname.
|
|
61
|
+
*/
|
|
62
|
+
className?: string;
|
|
63
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
64
|
+
/**
|
|
65
|
+
* Props for a horizontal row inside the leading column.
|
|
66
|
+
*/
|
|
67
|
+
export type TimelineItemLeadingRowProps = {
|
|
68
|
+
/**
|
|
69
|
+
* A title or description beside an optional tag.
|
|
70
|
+
* @required
|
|
71
|
+
*/
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Custom classname.
|
|
75
|
+
*/
|
|
76
|
+
className?: string;
|
|
77
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
78
|
+
/**
|
|
79
|
+
* Props for the overline above the title.
|
|
80
|
+
*/
|
|
81
|
+
export type TimelineItemCaptionProps = {
|
|
82
|
+
/**
|
|
83
|
+
* Overline text. A date is the common case.
|
|
84
|
+
* @required
|
|
85
|
+
*/
|
|
86
|
+
children: ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Custom classname.
|
|
89
|
+
*/
|
|
90
|
+
className?: string;
|
|
91
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
92
|
+
/**
|
|
93
|
+
* Props for the item title.
|
|
94
|
+
*/
|
|
95
|
+
export type TimelineItemTitleProps = {
|
|
96
|
+
/**
|
|
97
|
+
* Title text.
|
|
98
|
+
* @required
|
|
99
|
+
*/
|
|
100
|
+
children: ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* Custom classname.
|
|
103
|
+
*/
|
|
104
|
+
className?: string;
|
|
105
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
106
|
+
/**
|
|
107
|
+
* Props for the description under the title.
|
|
108
|
+
*/
|
|
109
|
+
export type TimelineItemDescriptionProps = {
|
|
110
|
+
/**
|
|
111
|
+
* Description text.
|
|
112
|
+
* @required
|
|
113
|
+
*/
|
|
114
|
+
children: ReactNode;
|
|
115
|
+
/**
|
|
116
|
+
* Custom classname.
|
|
117
|
+
*/
|
|
118
|
+
className?: string;
|
|
119
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
120
|
+
/**
|
|
121
|
+
* Props for the end-aligned header slot.
|
|
122
|
+
*/
|
|
123
|
+
export type TimelineItemTrailingProps = {
|
|
124
|
+
/**
|
|
125
|
+
* Amount, tag, or text.
|
|
126
|
+
* @required
|
|
127
|
+
*/
|
|
128
|
+
children: ReactNode;
|
|
129
|
+
/**
|
|
130
|
+
* Custom classname.
|
|
131
|
+
*/
|
|
132
|
+
className?: string;
|
|
133
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
134
|
+
/**
|
|
135
|
+
* Props for the block under the header.
|
|
136
|
+
*/
|
|
137
|
+
export type TimelineItemBodyProps = {
|
|
138
|
+
/**
|
|
139
|
+
* Content indented past the indicator.
|
|
140
|
+
* @required
|
|
141
|
+
*/
|
|
142
|
+
children: ReactNode;
|
|
143
|
+
/**
|
|
144
|
+
* Custom classname.
|
|
145
|
+
*/
|
|
146
|
+
className?: string;
|
|
147
|
+
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
|
|
148
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Timeline/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToastProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A single toast item: an inverted, compact surface with a status icon or
|
|
4
|
+
* spinner, a title, an optional trailing action and a close button.
|
|
5
|
+
*
|
|
6
|
+
* This is the presentational piece. For the queue, timing and imperative API,
|
|
7
|
+
* use `Toaster` + `toast`.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/react-toast--docs Guidelines}
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* import { Toast } from '@ledgerhq/lumen-ui-react';
|
|
13
|
+
*
|
|
14
|
+
* <Toast appearance="success" title="Payment done" onClose={() => {}} />
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Loading with an action
|
|
18
|
+
* <Toast
|
|
19
|
+
* loading
|
|
20
|
+
* title="Uploading…"
|
|
21
|
+
* action={{ label: 'Cancel', onAction: () => {} }}
|
|
22
|
+
* />
|
|
23
|
+
*/
|
|
24
|
+
export declare const Toast: ({ ref, appearance, loading, title, action, onClose, closeAriaLabel, className, role, ...props }: ToastProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Toast/Toast.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,SAAS,CAAC;AAU3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,KAAK,GAAI,iGAWnB,UAAU,4CAqDZ,CAAC"}
|
|
@@ -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 N } from "./styles.js";
|
|
4
|
+
import { useCommonTranslation as x } from "../../../../translations/translations.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 } = x(), 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(N({ 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 q, slideExitVariants as C, queuedEnterVariants as I, slideEnterVariants as N } from "./styles.js";
|
|
8
|
+
import { Toast as P } 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 ? C({ position: r }) : o ? I({ edge: a }) : N({ position: r });
|
|
20
|
+
return /* @__PURE__ */ l(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
"data-slot": "toast-collapse",
|
|
24
|
+
className: q({ 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
|
+
P,
|
|
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
|
+
}, H = ({
|
|
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
|
+
H 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
|