@ledgerhq/lumen-ui-react 0.0.87 → 0.0.89

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 (44) hide show
  1. package/ai-rules/RULES.md +5 -1
  2. package/dist/i18n/locales/de.json.d.ts +3 -0
  3. package/dist/i18n/locales/de.json.js +1 -1
  4. package/dist/i18n/locales/en.json.d.ts +3 -0
  5. package/dist/i18n/locales/en.json.js +1 -1
  6. package/dist/i18n/locales/es.json.d.ts +3 -0
  7. package/dist/i18n/locales/es.json.js +1 -1
  8. package/dist/i18n/locales/fr.json.d.ts +3 -0
  9. package/dist/i18n/locales/fr.json.js +1 -1
  10. package/dist/i18n/locales/ja.json.d.ts +3 -0
  11. package/dist/i18n/locales/ja.json.js +1 -1
  12. package/dist/i18n/locales/ko.json.d.ts +3 -0
  13. package/dist/i18n/locales/ko.json.js +1 -1
  14. package/dist/i18n/locales/pt.json.d.ts +3 -0
  15. package/dist/i18n/locales/pt.json.js +1 -1
  16. package/dist/i18n/locales/ru.json.d.ts +3 -0
  17. package/dist/i18n/locales/ru.json.js +1 -1
  18. package/dist/i18n/locales/th.json.d.ts +3 -0
  19. package/dist/i18n/locales/th.json.js +1 -1
  20. package/dist/i18n/locales/tr.json.d.ts +3 -0
  21. package/dist/i18n/locales/tr.json.js +1 -1
  22. package/dist/i18n/locales/zh.json.d.ts +3 -0
  23. package/dist/i18n/locales/zh.json.js +1 -1
  24. package/dist/index.js +130 -128
  25. package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
  26. package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
  27. package/dist/lib/Components/AmountDisplay/AmountDisplay.js +82 -22
  28. package/dist/lib/Components/AmountDisplay/index.d.ts +1 -1
  29. package/dist/lib/Components/AmountDisplay/index.d.ts.map +1 -1
  30. package/dist/lib/Components/AmountDisplay/types.d.ts +10 -24
  31. package/dist/lib/Components/AmountDisplay/types.d.ts.map +1 -1
  32. package/dist/lib/Components/Dialog/Dialog.d.ts +1 -0
  33. package/dist/lib/Components/Dialog/Dialog.d.ts.map +1 -1
  34. package/dist/lib/Components/Dialog/DialogClose/DialogClose.d.ts +19 -0
  35. package/dist/lib/Components/Dialog/DialogClose/DialogClose.d.ts.map +1 -0
  36. package/dist/lib/Components/Dialog/DialogClose/DialogClose.js +8 -0
  37. package/dist/lib/Components/Dialog/DialogHeader/DialogHeader.d.ts.map +1 -1
  38. package/dist/lib/Components/Dialog/DialogHeader/DialogHeader.js +16 -15
  39. package/dist/lib/Components/Dialog/types.d.ts +22 -3
  40. package/dist/lib/Components/Dialog/types.d.ts.map +1 -1
  41. package/dist/lib/Components/Table/utils/useThrottledScrollBottom.js +4 -4
  42. package/dist/libs/utils-shared/dist/index.js +110 -92
  43. package/dist/package.json +1 -1
  44. package/package.json +1 -1
@@ -1,26 +1,86 @@
1
- import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
- import { cn as m } from "../../../libs/utils-shared/dist/index.js";
3
- const o = ({
4
- value: n,
5
- formatter: c,
6
- hidden: r = !1,
7
- loading: i = !1,
8
- className: t,
9
- ...l
1
+ import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
+ import { useSplitText as g, buildAriaLabel as v, cn as o } from "../../../libs/utils-shared/dist/index.js";
3
+ import { memo as N } from "react";
4
+ import { useCommonTranslation as D } from "../../../i18n/useCommonTranslation.js";
5
+ const P = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], A = N(({ value: i, animate: l }) => /* @__PURE__ */ n("div", { className: o("relative overflow-hidden"), children: [
6
+ /* @__PURE__ */ a("span", { className: "invisible", children: "0" }),
7
+ /* @__PURE__ */ a(
8
+ "span",
9
+ {
10
+ className: o(
11
+ "absolute inset-x-0 top-0 flex flex-col items-center justify-center",
12
+ l && "transition-transform duration-600 ease-in-out"
13
+ ),
14
+ style: {
15
+ transform: `translateY(-${i * 10}%)`
16
+ },
17
+ children: P.map((t, s) => /* @__PURE__ */ a("span", { children: t }, s))
18
+ }
19
+ )
20
+ ] })), T = ({
21
+ value: i,
22
+ formatter: l,
23
+ hidden: t = !1,
24
+ loading: s = !1,
25
+ animate: u = !0,
26
+ className: f,
27
+ ...x
10
28
  }) => {
11
- const e = c(n);
12
- return /* @__PURE__ */ s("div", { className: m(i && "animate-pulse", t), ...l, children: [
13
- /* @__PURE__ */ s("span", { className: "heading-1-semi-bold text-base", children: [
14
- (e.currencyPosition === void 0 || e.currencyPosition === "start") && /* @__PURE__ */ a("span", { className: "me-4", children: e.currencyText }),
15
- /* @__PURE__ */ a("span", { children: r ? "••••" : e.integerPart })
16
- ] }),
17
- /* @__PURE__ */ s("span", { className: "heading-2-semi-bold text-muted", children: [
18
- e.decimalPart && !r && /* @__PURE__ */ a("span", { children: (e.decimalSeparator || ".") + e.decimalPart }),
19
- e.currencyPosition === "end" && /* @__PURE__ */ a("span", { className: "ms-4", children: e.currencyText })
20
- ] })
21
- ] });
29
+ const e = l(i), c = g(e), { t: h } = D(), y = v(
30
+ e,
31
+ t,
32
+ h("components.amountDisplay.amountHiddenAriaLabel")
33
+ ), m = (d) => {
34
+ let p = d.filter((r) => r.type === "digit").length;
35
+ return d.map((r, b) => r.type === "separator" ? /* @__PURE__ */ a("span", { children: r.value }, `sep-${b}`) : (p--, /* @__PURE__ */ a(
36
+ A,
37
+ {
38
+ value: parseInt(r.value, 10),
39
+ animate: u
40
+ },
41
+ p
42
+ )));
43
+ };
44
+ return /* @__PURE__ */ n(
45
+ "div",
46
+ {
47
+ className: o(
48
+ s && "animate-pulse",
49
+ "relative inline-flex items-end",
50
+ f
51
+ ),
52
+ "aria-label": y,
53
+ "aria-busy": s,
54
+ ...x,
55
+ children: [
56
+ /* @__PURE__ */ n(
57
+ "span",
58
+ {
59
+ className: "inline-flex flex-row mask-fade-y heading-1-semi-bold text-base",
60
+ "aria-hidden": "true",
61
+ children: [
62
+ e.currencyPosition === "start" && /* @__PURE__ */ a("span", { className: "me-4", children: e.currencyText }),
63
+ t ? /* @__PURE__ */ a("span", { children: "••••" }) : m(c.integerPart)
64
+ ]
65
+ }
66
+ ),
67
+ /* @__PURE__ */ n(
68
+ "span",
69
+ {
70
+ className: "inline-flex flex-row mask-fade-y pb-2 heading-2-semi-bold text-muted",
71
+ "aria-hidden": "true",
72
+ children: [
73
+ !t && e.decimalPart && /* @__PURE__ */ a("span", { children: e.decimalSeparator }),
74
+ e.decimalPart && !t && m(c.decimalPart),
75
+ e.currencyPosition === "end" && /* @__PURE__ */ a("span", { className: "ms-4", children: e.currencyText })
76
+ ]
77
+ }
78
+ )
79
+ ]
80
+ }
81
+ );
22
82
  };
23
- o.displayName = "AmountDisplay";
83
+ T.displayName = "AmountDisplay";
24
84
  export {
25
- o as AmountDisplay
85
+ T as AmountDisplay
26
86
  };
@@ -1,3 +1,3 @@
1
1
  export { AmountDisplay } from './AmountDisplay';
2
- export * from './types';
2
+ export type { AmountDisplayProps, FormattedValue } from './types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/AmountDisplay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/AmountDisplay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
@@ -1,28 +1,9 @@
1
+ import { FormattedValue, SplitChar } from '@ledgerhq/lumen-utils-shared';
1
2
  import { ComponentPropsWithRef } from 'react';
2
- export type FormattedValue = {
3
- /**
4
- * The whole number portion of the amount (e.g., "1234" from 1234.56)
5
- */
6
- integerPart: string;
7
- /**
8
- * The fractional portion of the amount without the separator (e.g., "56" from 1234.56)
9
- * @optional
10
- */
11
- decimalPart?: string;
12
- /**
13
- * The currency text or symbol (e.g., "$", "USD", "€", "BTC")
14
- */
15
- currencyText: string;
16
- /**
17
- * The character which separates integer and fractional parts.
18
- */
19
- decimalSeparator: '.' | ',';
20
- /**
21
- * Position of the currency text relative to the amount.
22
- * @optional
23
- * @default 'start'
24
- */
25
- currencyPosition?: 'start' | 'end';
3
+ export type { FormattedValue, SplitChar };
4
+ export type DigitStripProps = {
5
+ value: number;
6
+ animate: boolean;
26
7
  };
27
8
  /**
28
9
  * Props for the AmountDisplay component.
@@ -48,5 +29,10 @@ export type AmountDisplayProps = {
48
29
  * @default false
49
30
  */
50
31
  loading?: boolean;
32
+ /**
33
+ * Whether the odometer animation should play on value change or not
34
+ * @default true
35
+ */
36
+ animate?: boolean;
51
37
  } & ComponentPropsWithRef<'div'>;
52
38
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/AmountDisplay/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,gBAAgB,EAAE,GAAG,GAAG,GAAG,CAAC;IAC5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,cAAc,CAAC;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/AmountDisplay/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,cAAc,CAAC;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC"}
@@ -51,6 +51,7 @@ export declare function Dialog({ height, ...props }: DialogProps): import("react
51
51
  * </DialogTrigger>
52
52
  */
53
53
  export declare function DialogTrigger({ ...props }: DialogTriggerProps): import("react/jsx-runtime").JSX.Element;
54
+ export { DialogClose } from './DialogClose/DialogClose';
54
55
  /**
55
56
  * The content container that displays the dialog information.
56
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAGjB,WAAW,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AS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAkBpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU;oEAOpB,eAAe;;CAoBjB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY;6CAKtB,iBAAiB;;CAWnB,CAAC;AAGF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { DialogCloseProps } from '../types';
2
+ /**
3
+ * A button that closes the dialog when interacted with.
4
+ *
5
+ * This component wraps any interactive element and makes it dismiss the dialog
6
+ * when clicked. It is typically used inside the dialog content to provide
7
+ * an explicit close action, such as a "Cancel" or "Done" button.
8
+ *
9
+ * @see {@link https://ldls.vercel.app/?path=/docs/containment-dialog-overview--docs Storybook}
10
+ *
11
+ * @example
12
+ * import { DialogClose, Button } from '@ledgerhq/lumen-ui-react';
13
+ *
14
+ * <DialogClose asChild>
15
+ * <Button>Cancel</Button>
16
+ * </DialogClose>
17
+ */
18
+ export declare function DialogClose(props: DialogCloseProps): import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=DialogClose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogClose.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Dialog/DialogClose/DialogClose.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAElD"}
@@ -0,0 +1,8 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-dialog";
3
+ function l(o) {
4
+ return /* @__PURE__ */ i(r.Close, { "data-slot": "dialog-close", ...o });
5
+ }
6
+ export {
7
+ l as DialogClose
8
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"DialogHeader.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Dialog/DialogHeader/DialogHeader.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAgJ7C,eAAO,MAAM,YAAY;wDAMtB,iBAAiB;;CAqBnB,CAAC"}
1
+ {"version":3,"file":"DialogHeader.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Dialog/DialogHeader/DialogHeader.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAkJ7C,eAAO,MAAM,YAAY;wDAMtB,iBAAiB;;CAqBnB,CAAC"}
@@ -2,11 +2,12 @@ import { jsxs as i, Fragment as s, jsx as e } from "react/jsx-runtime";
2
2
  import { cn as c } from "../../../../libs/utils-shared/dist/index.js";
3
3
  import * as h from "@radix-ui/react-dialog";
4
4
  import { cva as N } from "class-variance-authority";
5
- import { useCommonTranslation as x } from "../../../../i18n/useCommonTranslation.js";
6
- import { IconButton as g } from "../../IconButton/IconButton.js";
5
+ import { useCommonTranslation as g } from "../../../../i18n/useCommonTranslation.js";
6
+ import { IconButton as x } from "../../IconButton/IconButton.js";
7
7
  import { ArrowLeft as b } from "../../../Symbols/Icons/ArrowLeft.js";
8
- import { Close as v } from "../../../Symbols/Icons/Close.js";
9
- const D = N("flex px-24 text-base", {
8
+ import { DialogClose as v } from "../DialogClose/DialogClose.js";
9
+ import { Close as D } from "../../../Symbols/Icons/Close.js";
10
+ const C = N("flex px-24 text-base", {
10
11
  variants: {
11
12
  appearance: {
12
13
  compact: "mb-12 h-64 min-h-64 flex-row items-center gap-12",
@@ -14,9 +15,9 @@ const D = N("flex px-24 text-base", {
14
15
  }
15
16
  }
16
17
  }), d = ({ onBack: r }) => {
17
- const { t: a } = x();
18
+ const { t: a } = g();
18
19
  return /* @__PURE__ */ e(
19
- g,
20
+ x,
20
21
  {
21
22
  appearance: "no-background",
22
23
  size: "sm",
@@ -27,18 +28,18 @@ const D = N("flex px-24 text-base", {
27
28
  }
28
29
  );
29
30
  }, p = ({ onClose: r }) => {
30
- const { t: a } = x();
31
- return /* @__PURE__ */ e(
32
- g,
31
+ const { t: a } = g();
32
+ return /* @__PURE__ */ e(v, { asChild: !0, children: /* @__PURE__ */ e(
33
+ x,
33
34
  {
34
35
  appearance: "gray",
35
36
  size: "xs",
36
- icon: v,
37
+ icon: D,
37
38
  onClick: r,
38
39
  className: "-mr-8 shrink-0",
39
40
  "aria-label": a("components.dialogHeader.closeAriaLabel")
40
41
  }
41
- );
42
+ ) });
42
43
  }, y = ({ hidden: r, className: a, ...o }) => /* @__PURE__ */ e(
43
44
  h.Title,
44
45
  {
@@ -66,7 +67,7 @@ const D = N("flex px-24 text-base", {
66
67
  "div",
67
68
  {
68
69
  ref: r,
69
- className: D({ appearance: o, className: a }),
70
+ className: C({ appearance: o, className: a }),
70
71
  ...u,
71
72
  children: [
72
73
  o === "compact" && /* @__PURE__ */ i(s, { children: [
@@ -99,7 +100,7 @@ const D = N("flex px-24 text-base", {
99
100
  }
100
101
  );
101
102
  f.displayName = "DialogHeaderComponent";
102
- const C = ({
103
+ const w = ({
103
104
  ref: r,
104
105
  title: a = "",
105
106
  description: o,
@@ -119,7 +120,7 @@ const C = ({
119
120
  /* @__PURE__ */ e(y, { hidden: !0, children: a }),
120
121
  o && /* @__PURE__ */ e(H, { hidden: !0, children: o })
121
122
  ] });
122
- C.displayName = "DialogHeader";
123
+ w.displayName = "DialogHeader";
123
124
  export {
124
- C as DialogHeader
125
+ w as DialogHeader
125
126
  };
@@ -108,9 +108,20 @@ export type DialogHeaderProps = {
108
108
  */
109
109
  description?: string;
110
110
  /**
111
- * Callback function to handle close action.
112
- */
113
- onClose: () => void;
111
+ * Optional callback fired as a side-effect when the close button is clicked.
112
+ *
113
+ * Clicking the close button triggers the underlying Radix `DialogClose`
114
+ * behavior:
115
+ * - In uncontrolled mode (using `defaultOpen` and not controlling `open`),
116
+ * the dialog will close automatically.
117
+ * - In controlled mode (when the `open` prop is provided), it will call
118
+ * `onOpenChange(false)` and consumers are responsible for updating their
119
+ * `open` state for the dialog to actually close.
120
+ *
121
+ * Use this callback for analytics, cleanup, or syncing additional
122
+ * controlled state.
123
+ */
124
+ onClose?: () => void;
114
125
  /**
115
126
  * Optional callback for back navigation.
116
127
  */
@@ -146,4 +157,12 @@ export type DialogFooterProps = {
146
157
  */
147
158
  className?: string;
148
159
  } & ComponentPropsWithRef<'div'>;
160
+ export type DialogCloseProps = {
161
+ /**
162
+ * Change the default rendered element for the one passed as a child,
163
+ * merging their props and behavior.
164
+ * @default false
165
+ */
166
+ asChild?: boolean;
167
+ } & ComponentPropsWithRef<'button'>;
149
168
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Dialog/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,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CAAC,CAAC;AAEjC,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAEjC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC"}
@@ -17,21 +17,21 @@ const m = 150, E = ({
17
17
  [n]
18
18
  ), e = u(t), l = u(c);
19
19
  e.current = t, l.current = c;
20
- const f = u(null), T = L(() => {
20
+ const f = u(null), i = L(() => {
21
21
  if (!t)
22
22
  return;
23
23
  const r = h((s) => {
24
24
  l.current || !e.current || E({ element: s, threshold: o }) && e.current();
25
25
  }, m);
26
26
  return f.current = r, (s) => {
27
- const i = s.currentTarget;
28
- i && r(i);
27
+ const T = s.currentTarget;
28
+ T && r(T);
29
29
  };
30
30
  }, [t, o]);
31
31
  return _(() => () => {
32
32
  var r;
33
33
  (r = f.current) == null || r.cancel();
34
- }, [T]), T;
34
+ }, [i]), i;
35
35
  };
36
36
  export {
37
37
  E as isScrolledToBottom,