@ledgerhq/lumen-ui-react 0.1.53 → 0.1.55
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/lib/Components/core/Card/Card.d.ts +1 -1
- package/dist/lib/Components/core/Card/Card.d.ts.map +1 -1
- package/dist/lib/Components/core/Card/Card.js +138 -124
- package/dist/lib/Components/core/Card/types.d.ts +6 -0
- package/dist/lib/Components/core/Card/types.d.ts.map +1 -1
- package/dist/lib/Components/core/DataTable/DataTable.d.ts +1 -1
- package/dist/lib/Components/core/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/Components/core/DataTable/DataTable.js +4 -1
- package/dist/lib/Components/core/Dialog/DialogHeader/DialogHeader.js +4 -4
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.js +242 -97
- package/dist/lib/Components/core/SegmentedControl/SegmentedControlContext.d.ts +2 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/types.d.ts +4 -3
- package/dist/lib/Components/core/SegmentedControl/types.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/usePillElementLayoutEffect.js +13 -12
- package/dist/lib/Components/core/SegmentedControl/useScrollArrows.d.ts +16 -0
- package/dist/lib/Components/core/SegmentedControl/useScrollArrows.d.ts.map +1 -0
- package/dist/lib/Components/core/SegmentedControl/useScrollArrows.js +51 -0
- package/dist/lib/Components/core/Trend/Trend.d.ts.map +1 -1
- package/dist/lib/Components/core/Trend/Trend.js +21 -21
- package/dist/lib/Components/symbols/icons/CalendarRefresh.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/CalendarRefresh.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/CalendarRefresh.js +28 -0
- package/dist/lib/Components/symbols/icons/CodeShield.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/CodeShield.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/CodeShield.js +28 -0
- package/dist/lib/Components/symbols/icons/CoinStacked.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/CoinStacked.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/CoinStacked.js +28 -0
- package/dist/lib/Components/symbols/icons/Craft.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Craft.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Craft.js +28 -0
- package/dist/lib/Components/symbols/icons/Equal.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Equal.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Equal.js +27 -0
- package/dist/lib/Components/symbols/icons/File.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/File.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/File.js +28 -0
- package/dist/lib/Components/symbols/icons/FileShield.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/FileShield.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/FileShield.js +28 -0
- package/dist/lib/Components/symbols/icons/Fire.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Fire.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Fire.js +29 -0
- package/dist/lib/Components/symbols/icons/Handshake.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Handshake.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Handshake.js +28 -0
- package/dist/lib/Components/symbols/icons/MailShield.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/MailShield.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/MailShield.js +28 -0
- package/dist/lib/Components/symbols/icons/Merge.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Merge.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Merge.js +28 -0
- package/dist/lib/Components/symbols/icons/Minimize.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Minimize.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Minimize.js +28 -0
- package/dist/lib/Components/symbols/icons/Nested.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Nested.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Nested.js +28 -0
- package/dist/lib/Components/symbols/icons/NotEqual.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/NotEqual.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/NotEqual.js +27 -0
- package/dist/lib/Components/symbols/icons/PeopleShield.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/PeopleShield.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/PeopleShield.js +28 -0
- package/dist/lib/Components/symbols/icons/Pin.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Pin.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Pin.js +28 -0
- package/dist/lib/Components/symbols/icons/PinFill.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/PinFill.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/PinFill.js +25 -0
- package/dist/lib/Components/symbols/icons/Receive.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Receive.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Receive.js +28 -0
- package/dist/lib/Components/symbols/icons/Retry.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Retry.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Retry.js +28 -0
- package/dist/lib/Components/symbols/icons/Send.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Send.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Send.js +28 -0
- package/dist/lib/Components/symbols/icons/Servers.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/Servers.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/Servers.js +28 -0
- package/dist/lib/Components/symbols/icons/SubArrow.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/SubArrow.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/SubArrow.js +28 -0
- package/dist/lib/Components/symbols/icons/UsbCircleFill.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/UsbCircleFill.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/UsbCircleFill.js +36 -0
- package/dist/lib/Components/symbols/icons/WarningCircleFill.d.ts +29 -0
- package/dist/lib/Components/symbols/icons/WarningCircleFill.d.ts.map +1 -0
- package/dist/lib/Components/symbols/icons/WarningCircleFill.js +25 -0
- package/dist/lib/Components/symbols/index.d.ts +24 -0
- package/dist/lib/Components/symbols/index.d.ts.map +1 -1
- package/dist/lib/Components/symbols/index.js +554 -506
- package/dist/libs/utils-shared/dist/index.js +1 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { useSegmentedControlContext as
|
|
6
|
-
import { useSegmentedControlSelectedIndex as
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as o, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { cn as h, useDisabledContext as y } from "../../../../libs/utils-shared/dist/index.js";
|
|
3
|
+
import { cva as m } from "class-variance-authority";
|
|
4
|
+
import { useMemo as w, useRef as v } from "react";
|
|
5
|
+
import { useSegmentedControlContext as k, SegmentedControlContextProvider as N } from "./SegmentedControlContext.js";
|
|
6
|
+
import { useSegmentedControlSelectedIndex as R, usePillElementLayoutEffect as I } from "./usePillElementLayoutEffect.js";
|
|
7
|
+
import { useScrollArrows as j, useScrollSelectedIntoView as z } from "./useScrollArrows.js";
|
|
8
|
+
import { ChevronLeft as A } from "../../symbols/icons/ChevronLeft.js";
|
|
9
|
+
import { ChevronRight as L } from "../../symbols/icons/ChevronRight.js";
|
|
10
|
+
const f = {
|
|
11
|
+
root: m("relative flex-row items-center rounded-sm", {
|
|
9
12
|
variants: {
|
|
10
|
-
appearance: {
|
|
11
|
-
background: "bg-surface",
|
|
12
|
-
"no-background": "bg-transparent"
|
|
13
|
-
},
|
|
14
13
|
tabLayout: {
|
|
15
14
|
fit: "inline-flex",
|
|
16
|
-
fixed: "w-full"
|
|
15
|
+
fixed: "flex w-full"
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
}),
|
|
20
|
-
pill:
|
|
19
|
+
pill: m("pointer-events-none absolute top-0 left-0 z-0 rounded-sm", {
|
|
21
20
|
variants: {
|
|
22
21
|
disabled: {
|
|
23
22
|
true: "bg-base-transparent-pressed",
|
|
@@ -29,8 +28,9 @@ const p = {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
}),
|
|
32
|
-
item:
|
|
33
|
-
|
|
31
|
+
item: m(
|
|
32
|
+
// The focus ring is inset because the scroll container clips anything drawn outside the box.
|
|
33
|
+
"z-10 flex cursor-pointer flex-row items-center justify-center rounded-sm px-16 py-8 select-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus disabled:cursor-not-allowed",
|
|
34
34
|
{
|
|
35
35
|
variants: {
|
|
36
36
|
selected: {
|
|
@@ -51,112 +51,257 @@ const p = {
|
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
|
+
),
|
|
55
|
+
scrollArea: m("relative rounded-sm", {
|
|
56
|
+
variants: {
|
|
57
|
+
appearance: {
|
|
58
|
+
background: "bg-surface",
|
|
59
|
+
"no-background": "bg-transparent"
|
|
60
|
+
},
|
|
61
|
+
tabLayout: {
|
|
62
|
+
// Fit lets the segments size themselves, so the area must not stretch.
|
|
63
|
+
fit: "",
|
|
64
|
+
fixed: "w-full"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
arrow: m(
|
|
69
|
+
"absolute inset-y-0 z-20 flex cursor-pointer items-center justify-center rounded-sm py-8 text-muted transition-opacity duration-200 hover:text-muted-hover",
|
|
70
|
+
{
|
|
71
|
+
variants: {
|
|
72
|
+
visible: {
|
|
73
|
+
true: "opacity-100",
|
|
74
|
+
false: "pointer-events-none opacity-0"
|
|
75
|
+
},
|
|
76
|
+
side: {
|
|
77
|
+
left: "left-0 pr-16 pl-8",
|
|
78
|
+
right: "right-0 pr-8 pl-16"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
54
82
|
)
|
|
55
83
|
};
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
function B(e, t) {
|
|
85
|
+
return `linear-gradient(to right, ${e ? "transparent 0px, transparent 40px, black 72px" : "black 0px"}, ${t ? "black calc(100% - 72px), transparent calc(100% - 40px), transparent 100%" : "black 100%"})`;
|
|
86
|
+
}
|
|
87
|
+
function x({
|
|
88
|
+
side: e,
|
|
59
89
|
icon: t,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
...r
|
|
90
|
+
label: r,
|
|
91
|
+
visible: n,
|
|
92
|
+
onClick: a
|
|
64
93
|
}) {
|
|
65
|
-
|
|
66
|
-
|
|
94
|
+
return /* @__PURE__ */ o(
|
|
95
|
+
"button",
|
|
96
|
+
{
|
|
97
|
+
type: "button",
|
|
98
|
+
"aria-label": r,
|
|
99
|
+
"aria-hidden": !n,
|
|
100
|
+
tabIndex: -1,
|
|
101
|
+
disabled: !n,
|
|
102
|
+
onClick: a,
|
|
103
|
+
className: f.arrow({ visible: n, side: e }),
|
|
104
|
+
children: /* @__PURE__ */ o(t, { size: 20 })
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
function D({
|
|
109
|
+
appearance: e,
|
|
110
|
+
tabLayout: t,
|
|
111
|
+
className: r,
|
|
112
|
+
selectedIndex: n,
|
|
113
|
+
children: a,
|
|
114
|
+
...d
|
|
115
|
+
}) {
|
|
116
|
+
const l = v(null), { canScrollLeft: c, canScrollRight: s, scrollBy: u } = j(l);
|
|
117
|
+
z(l, n);
|
|
118
|
+
const i = c || s ? B(c, s) : void 0;
|
|
119
|
+
return /* @__PURE__ */ b(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
...d,
|
|
123
|
+
className: h(
|
|
124
|
+
f.scrollArea({ appearance: e, tabLayout: t }),
|
|
125
|
+
r
|
|
126
|
+
),
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ o(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
ref: l,
|
|
132
|
+
className: "scrollbar-none overflow-x-auto",
|
|
133
|
+
style: i ? { maskImage: i, WebkitMaskImage: i } : void 0,
|
|
134
|
+
children: a
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ o(
|
|
138
|
+
x,
|
|
139
|
+
{
|
|
140
|
+
side: "left",
|
|
141
|
+
icon: A,
|
|
142
|
+
label: "Scroll left",
|
|
143
|
+
visible: c,
|
|
144
|
+
onClick: () => u("left")
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ o(
|
|
148
|
+
x,
|
|
149
|
+
{
|
|
150
|
+
side: "right",
|
|
151
|
+
icon: L,
|
|
152
|
+
label: "Scroll right",
|
|
153
|
+
visible: s,
|
|
154
|
+
onClick: () => u("right")
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function M({
|
|
162
|
+
layout: e,
|
|
163
|
+
isReady: t,
|
|
164
|
+
disabled: r
|
|
165
|
+
}) {
|
|
166
|
+
return /* @__PURE__ */ o(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
"aria-hidden": !0,
|
|
170
|
+
className: f.pill({ disabled: r, isReady: t }),
|
|
171
|
+
style: {
|
|
172
|
+
width: e.width,
|
|
173
|
+
height: e.height,
|
|
174
|
+
transform: `translateX(${e.x}px)`
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function P({
|
|
180
|
+
tabLayout: e,
|
|
181
|
+
disabled: t,
|
|
182
|
+
selectedIndex: r,
|
|
183
|
+
children: n
|
|
184
|
+
}) {
|
|
185
|
+
const a = v(null), { pill: d, isReady: l } = I({
|
|
186
|
+
ref: a,
|
|
187
|
+
selectedIndex: r,
|
|
188
|
+
children: n
|
|
189
|
+
});
|
|
190
|
+
return /* @__PURE__ */ b(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
ref: a,
|
|
194
|
+
role: "radiogroup",
|
|
195
|
+
"aria-disabled": t,
|
|
196
|
+
className: f.root({ tabLayout: e }),
|
|
197
|
+
children: [
|
|
198
|
+
n,
|
|
199
|
+
/* @__PURE__ */ o(
|
|
200
|
+
M,
|
|
201
|
+
{
|
|
202
|
+
layout: d,
|
|
203
|
+
isReady: l,
|
|
204
|
+
disabled: t
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
function $({
|
|
212
|
+
value: e,
|
|
213
|
+
children: t,
|
|
214
|
+
icon: r,
|
|
215
|
+
trailingContent: n,
|
|
216
|
+
onClick: a,
|
|
217
|
+
className: d,
|
|
218
|
+
disabled: l,
|
|
219
|
+
...c
|
|
220
|
+
}) {
|
|
221
|
+
const {
|
|
222
|
+
selectedValue: s,
|
|
223
|
+
onSelectedChange: u,
|
|
224
|
+
disabled: i,
|
|
225
|
+
tabLayout: S
|
|
226
|
+
} = k(), g = s === e, p = w(() => !!(l || i), [l, i]);
|
|
227
|
+
return /* @__PURE__ */ o(
|
|
67
228
|
"button",
|
|
68
229
|
{
|
|
69
230
|
type: "button",
|
|
70
231
|
role: "radio",
|
|
71
|
-
"aria-checked":
|
|
72
|
-
"aria-disabled":
|
|
73
|
-
disabled:
|
|
74
|
-
onClick: (
|
|
75
|
-
|
|
232
|
+
"aria-checked": g,
|
|
233
|
+
"aria-disabled": p,
|
|
234
|
+
disabled: p,
|
|
235
|
+
onClick: (C) => {
|
|
236
|
+
p || (u(e), a?.(C));
|
|
76
237
|
},
|
|
77
|
-
className:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
238
|
+
className: h(
|
|
239
|
+
f.item({ selected: g, disabled: p }),
|
|
240
|
+
S === "fixed" && "min-w-0 flex-1",
|
|
241
|
+
d
|
|
81
242
|
),
|
|
82
|
-
...
|
|
83
|
-
children: /* @__PURE__ */
|
|
84
|
-
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
243
|
+
...c,
|
|
244
|
+
children: /* @__PURE__ */ b("span", { className: "inline-flex min-w-0 items-center justify-center gap-8", children: [
|
|
245
|
+
r && /* @__PURE__ */ o(r, { size: 16, className: "shrink-0" }),
|
|
246
|
+
/* @__PURE__ */ o("span", { className: "min-w-0 truncate", children: t }),
|
|
247
|
+
n
|
|
87
248
|
] })
|
|
88
249
|
}
|
|
89
250
|
);
|
|
90
251
|
}
|
|
91
|
-
function
|
|
92
|
-
selectedValue:
|
|
93
|
-
onSelectedChange:
|
|
94
|
-
children:
|
|
95
|
-
className:
|
|
96
|
-
disabled:
|
|
97
|
-
appearance:
|
|
98
|
-
tabLayout:
|
|
99
|
-
...
|
|
252
|
+
function E({
|
|
253
|
+
selectedValue: e,
|
|
254
|
+
onSelectedChange: t,
|
|
255
|
+
children: r,
|
|
256
|
+
className: n,
|
|
257
|
+
disabled: a,
|
|
258
|
+
appearance: d = "background",
|
|
259
|
+
tabLayout: l = "fixed",
|
|
260
|
+
...c
|
|
100
261
|
}) {
|
|
101
|
-
const
|
|
262
|
+
const s = y({
|
|
102
263
|
consumerName: "SegmentedControl",
|
|
103
|
-
mergeWith: { disabled:
|
|
104
|
-
}),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
children: t
|
|
111
|
-
});
|
|
112
|
-
return /* @__PURE__ */ a(
|
|
113
|
-
S,
|
|
264
|
+
mergeWith: { disabled: a }
|
|
265
|
+
}), u = R(
|
|
266
|
+
e,
|
|
267
|
+
r
|
|
268
|
+
);
|
|
269
|
+
return /* @__PURE__ */ o(
|
|
270
|
+
N,
|
|
114
271
|
{
|
|
115
272
|
value: {
|
|
116
|
-
selectedValue:
|
|
117
|
-
onSelectedChange: (
|
|
118
|
-
disabled:
|
|
119
|
-
tabLayout:
|
|
273
|
+
selectedValue: e,
|
|
274
|
+
onSelectedChange: (i) => t(i),
|
|
275
|
+
disabled: s,
|
|
276
|
+
tabLayout: l
|
|
120
277
|
},
|
|
121
|
-
children: /* @__PURE__ */
|
|
122
|
-
|
|
278
|
+
children: /* @__PURE__ */ o(
|
|
279
|
+
D,
|
|
123
280
|
{
|
|
124
|
-
...
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"div",
|
|
139
|
-
{
|
|
140
|
-
"aria-hidden": !0,
|
|
141
|
-
className: p.pill({ disabled: o, isReady: f }),
|
|
142
|
-
style: {
|
|
143
|
-
width: n.width,
|
|
144
|
-
height: n.height,
|
|
145
|
-
transform: `translateX(${n.x}px)`
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
)
|
|
149
|
-
]
|
|
281
|
+
...c,
|
|
282
|
+
appearance: d,
|
|
283
|
+
tabLayout: l,
|
|
284
|
+
className: n,
|
|
285
|
+
selectedIndex: u,
|
|
286
|
+
children: /* @__PURE__ */ o(
|
|
287
|
+
P,
|
|
288
|
+
{
|
|
289
|
+
tabLayout: l,
|
|
290
|
+
disabled: s,
|
|
291
|
+
selectedIndex: u,
|
|
292
|
+
children: r
|
|
293
|
+
}
|
|
294
|
+
)
|
|
150
295
|
}
|
|
151
296
|
)
|
|
152
297
|
}
|
|
153
298
|
);
|
|
154
299
|
}
|
|
155
|
-
function
|
|
156
|
-
return { SegmentedControl:
|
|
300
|
+
function O() {
|
|
301
|
+
return { SegmentedControl: E, SegmentedControlButton: $ };
|
|
157
302
|
}
|
|
158
303
|
export {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
304
|
+
E as SegmentedControl,
|
|
305
|
+
$ as SegmentedControlButton,
|
|
306
|
+
O as createSegmentedControl
|
|
162
307
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { SegmentedControlProps } from './types';
|
|
1
2
|
export type SegmentedControlContextValue = {
|
|
2
3
|
selectedValue: string;
|
|
3
4
|
onSelectedChange: (value: string) => void;
|
|
4
5
|
disabled: boolean;
|
|
5
|
-
tabLayout: '
|
|
6
|
+
tabLayout: NonNullable<SegmentedControlProps['tabLayout']>;
|
|
6
7
|
};
|
|
7
8
|
declare const SegmentedControlContextProvider: import('react').FC<{
|
|
8
9
|
children: import('react').ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControlContext.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/SegmentedControl/SegmentedControlContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SegmentedControlContext.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/SegmentedControl/SegmentedControlContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,4BAA4B,GAAG;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC;CAC5D,CAAC;AAEF,QAAA,MAAO,+BAA+B;;;EAC+B,CAAC;AAEtE,eAAO,MAAM,0BAA0B,oCAInC,CAAC;AAEL,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -21,11 +21,12 @@ export type SegmentedControlProps<T extends SegmentedControlValue = SegmentedCon
|
|
|
21
21
|
appearance?: 'background' | 'no-background';
|
|
22
22
|
/**
|
|
23
23
|
* Controls how tab widths are calculated.
|
|
24
|
-
* - "
|
|
25
|
-
* - "
|
|
24
|
+
* - `"fixed"`: all tabs share equal width, filling the container
|
|
25
|
+
* - `"fit"`: each tab sizes to its content; when tabs overflow the container,
|
|
26
|
+
* left/right arrow buttons appear automatically to scroll them into view
|
|
26
27
|
* @default 'fixed'
|
|
27
28
|
*/
|
|
28
|
-
tabLayout?: '
|
|
29
|
+
tabLayout?: 'fixed' | 'fit';
|
|
29
30
|
/**
|
|
30
31
|
* Segment buttons (SegmentedControlButton).
|
|
31
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/SegmentedControl/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACrD;IACF;;OAEG;IACH,aAAa,EAAE,CAAC,CAAC;IACjB;;OAEG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC;IAC5C
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/SegmentedControl/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACrD;IACF;;OAEG;IACH,aAAa,EAAE,CAAC,CAAC;IACjB;;OAEG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC;IAC5C;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEtD,KAAK,aAAa,GAAG,aAAa,CAAC;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,2BAA2B,CACrC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACrD;IACF;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;CAC7B,GAAG,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
function
|
|
1
|
+
import { useMemo as m, Children as h, isValidElement as y, useState as f, useLayoutEffect as p, useEffect as g } from "react";
|
|
2
|
+
function E({
|
|
3
3
|
ref: n,
|
|
4
4
|
selectedIndex: e,
|
|
5
5
|
children: r
|
|
6
6
|
}) {
|
|
7
|
-
const [
|
|
7
|
+
const [u, c] = f({ width: 0, height: 0, x: 0 }), [a, l] = f(!1);
|
|
8
8
|
return p(() => {
|
|
9
9
|
const t = n.current;
|
|
10
|
-
if (!t)
|
|
10
|
+
if (!t)
|
|
11
|
+
return;
|
|
11
12
|
const o = () => {
|
|
12
|
-
const
|
|
13
|
+
const d = Array.from(t.children).slice(0, -1), i = e >= 0 ? d[e] : void 0;
|
|
13
14
|
c({
|
|
14
15
|
width: i?.offsetWidth ?? 0,
|
|
15
|
-
height:
|
|
16
|
+
height: t.offsetHeight,
|
|
16
17
|
x: i?.offsetLeft ?? 0
|
|
17
18
|
});
|
|
18
19
|
};
|
|
19
20
|
if (o(), typeof ResizeObserver > "u") return;
|
|
20
21
|
const s = new ResizeObserver(o);
|
|
21
22
|
return s.observe(t), () => s.disconnect();
|
|
22
|
-
}, [r, e, n]),
|
|
23
|
+
}, [r, e, n]), g(() => {
|
|
23
24
|
const t = requestAnimationFrame(() => {
|
|
24
25
|
l(!0);
|
|
25
26
|
});
|
|
26
27
|
return () => cancelAnimationFrame(t);
|
|
27
|
-
}, []), { pill:
|
|
28
|
+
}, []), { pill: u, isReady: a };
|
|
28
29
|
}
|
|
29
30
|
function b(n, e) {
|
|
30
|
-
return
|
|
31
|
-
() =>
|
|
32
|
-
(r) =>
|
|
31
|
+
return m(
|
|
32
|
+
() => h.toArray(e).findIndex(
|
|
33
|
+
(r) => y(r) && r.props.value === n
|
|
33
34
|
),
|
|
34
35
|
[n, e]
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
E as usePillElementLayoutEffect,
|
|
39
40
|
b as useSegmentedControlSelectedIndex
|
|
40
41
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type ScrollDirection = 'left' | 'right';
|
|
3
|
+
/**
|
|
4
|
+
* Overflow state and the scroll action backing the left/right arrow buttons.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useScrollArrows(scrollRef: RefObject<HTMLDivElement | null>): {
|
|
7
|
+
canScrollLeft: boolean;
|
|
8
|
+
canScrollRight: boolean;
|
|
9
|
+
scrollBy: (direction: ScrollDirection) => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Centers the selected segment on mount only, so a later selection change never
|
|
13
|
+
* fights the scroll position the user set by hand.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useScrollSelectedIntoView(scrollRef: RefObject<HTMLDivElement | null>, selectedIndex: number): void;
|
|
16
|
+
//# sourceMappingURL=useScrollArrows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollArrows.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/SegmentedControl/useScrollArrows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AA8C/C;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG;IAC5E,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD,CAmBA;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,EAC3C,aAAa,EAAE,MAAM,GACpB,IAAI,CAmBN"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useCallback as u, useLayoutEffect as f, useState as i } from "react";
|
|
2
|
+
function a(n) {
|
|
3
|
+
const [o, r] = i(!1), [s, c] = i(!1), e = u(() => {
|
|
4
|
+
const t = n.current;
|
|
5
|
+
t && (r(t.scrollLeft > 0), c(t.scrollLeft + t.clientWidth < t.scrollWidth - 1));
|
|
6
|
+
}, [n]);
|
|
7
|
+
return f(() => {
|
|
8
|
+
const t = n.current;
|
|
9
|
+
if (!t)
|
|
10
|
+
return;
|
|
11
|
+
e(), t.addEventListener("scroll", e, { passive: !0 });
|
|
12
|
+
const l = new ResizeObserver(e);
|
|
13
|
+
return l.observe(t), t.firstElementChild instanceof HTMLElement && l.observe(t.firstElementChild), () => {
|
|
14
|
+
t.removeEventListener("scroll", e), l.disconnect();
|
|
15
|
+
};
|
|
16
|
+
}, [e, n]), { canScrollLeft: o, canScrollRight: s };
|
|
17
|
+
}
|
|
18
|
+
function S(n) {
|
|
19
|
+
const { canScrollLeft: o, canScrollRight: r } = a(n), s = u(
|
|
20
|
+
(c) => {
|
|
21
|
+
const e = n.current;
|
|
22
|
+
if (!e)
|
|
23
|
+
return;
|
|
24
|
+
const t = e.clientWidth / 2;
|
|
25
|
+
e.scrollBy({
|
|
26
|
+
left: c === "left" ? -t : t,
|
|
27
|
+
behavior: "smooth"
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
[n]
|
|
31
|
+
);
|
|
32
|
+
return { canScrollLeft: o, canScrollRight: r, scrollBy: s };
|
|
33
|
+
}
|
|
34
|
+
function d(n, o) {
|
|
35
|
+
f(() => {
|
|
36
|
+
if (o < 0)
|
|
37
|
+
return;
|
|
38
|
+
const r = n.current;
|
|
39
|
+
if (!r)
|
|
40
|
+
return;
|
|
41
|
+
const c = r.querySelectorAll('button[role="radio"]')[o];
|
|
42
|
+
if (c) {
|
|
43
|
+
const { offsetLeft: e, offsetWidth: t } = c, { clientWidth: l } = r;
|
|
44
|
+
r.scrollLeft = e - (l - t) / 2;
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
S as useScrollArrows,
|
|
50
|
+
d as useScrollSelectedIntoView
|
|
51
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trend.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Trend/Trend.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA+C1C,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAW,EACX,QAAQ,EAAE,YAAoB,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"Trend.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/Trend/Trend.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA+C1C,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAW,EACX,QAAQ,EAAE,YAAoB,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,UAAU,2CAuBZ"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useDisabledContext as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { useCommonTranslation as
|
|
5
|
-
import { TriangleDown as
|
|
6
|
-
import { TriangleUp as
|
|
7
|
-
function
|
|
1
|
+
import { jsxs as m, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useDisabledContext as u, cn as p } from "../../../../libs/utils-shared/dist/index.js";
|
|
3
|
+
import { cva as f } from "class-variance-authority";
|
|
4
|
+
import { useCommonTranslation as b } from "../../../../i18n/useCommonTranslation.js";
|
|
5
|
+
import { TriangleDown as v } from "../../symbols/icons/TriangleDown.js";
|
|
6
|
+
import { TriangleUp as g } from "../../symbols/icons/TriangleUp.js";
|
|
7
|
+
function x(e) {
|
|
8
8
|
return e === 0 ? "neutral" : e > 0 ? "positive" : "negative";
|
|
9
9
|
}
|
|
10
|
-
const T =
|
|
10
|
+
const T = f("inline-flex items-center", {
|
|
11
11
|
variants: {
|
|
12
12
|
size: {
|
|
13
13
|
md: "gap-2 body-2",
|
|
@@ -32,36 +32,36 @@ const T = b("inline-flex items-center", {
|
|
|
32
32
|
size: "md",
|
|
33
33
|
disabled: !1
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
35
|
+
}), V = {
|
|
36
36
|
md: 16,
|
|
37
37
|
sm: 12
|
|
38
|
-
},
|
|
39
|
-
positive:
|
|
40
|
-
negative:
|
|
38
|
+
}, h = {
|
|
39
|
+
positive: g,
|
|
40
|
+
negative: v,
|
|
41
41
|
neutral: null
|
|
42
42
|
};
|
|
43
43
|
function M({
|
|
44
44
|
value: e,
|
|
45
|
-
size:
|
|
45
|
+
size: t = "md",
|
|
46
46
|
disabled: r = !1,
|
|
47
47
|
className: o,
|
|
48
48
|
...l
|
|
49
49
|
}) {
|
|
50
|
-
const
|
|
50
|
+
const a = x(e), s = u({
|
|
51
51
|
consumerName: "Trend",
|
|
52
52
|
mergeWith: { disabled: r }
|
|
53
|
-
}), { t: d } =
|
|
54
|
-
return /* @__PURE__ */
|
|
53
|
+
}), { t: d } = b(), n = h[a], i = `${Math.abs(e).toFixed(2)}%`;
|
|
54
|
+
return /* @__PURE__ */ m(
|
|
55
55
|
"span",
|
|
56
56
|
{
|
|
57
|
-
"aria-label": d(`components.trend.${
|
|
58
|
-
value:
|
|
57
|
+
"aria-label": d(`components.trend.${a}AriaLabel`, {
|
|
58
|
+
value: i
|
|
59
59
|
}),
|
|
60
|
-
className: p(T({ size:
|
|
60
|
+
className: p(T({ size: t, variant: a, disabled: s }), o),
|
|
61
61
|
...l,
|
|
62
62
|
children: [
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
n && /* @__PURE__ */ c(n, { size: V[t], disabled: s }),
|
|
64
|
+
i
|
|
65
65
|
]
|
|
66
66
|
}
|
|
67
67
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CalendarRefresh icon component.
|
|
3
|
+
*
|
|
4
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
5
|
+
* to create a consistent icon interface. It supports all standard SVG props and additional
|
|
6
|
+
* size variants defined in the Icon component.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://ldls.vercel.app/?path=/story/react-icon--base&args=name:CalendarRefresh Storybook}
|
|
9
|
+
*
|
|
10
|
+
* @component
|
|
11
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
12
|
+
* @param {string} [className] - Additional CSS classes to apply to the icon.
|
|
13
|
+
* @param {React.SVGProps<SVGSVGElement>} [...props] - All standard SVG element props.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Basic usage with default size (24px)
|
|
17
|
+
* import { CalendarRefresh } from '@ledgerhq/lumen-ui-react/symbols';
|
|
18
|
+
*
|
|
19
|
+
* <CalendarRefresh />
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // With custom size and className
|
|
23
|
+
* <CalendarRefresh size={40} className="text-warning" />
|
|
24
|
+
*/
|
|
25
|
+
export declare const CalendarRefresh: {
|
|
26
|
+
({ ref, className, disabled, ...props }: Omit<import('../Icon').IconProps, "children">): import('react').FunctionComponentElement<import('../Icon').IconProps>;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=CalendarRefresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarRefresh.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/symbols/icons/CalendarRefresh.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe;;;CAiB3B,CAAC"}
|