@ledgerhq/lumen-ui-react 0.1.41 → 0.1.43
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/MediaButton/MediaButton.d.ts.map +1 -1
- package/dist/lib/Components/MediaButton/MediaButton.js +92 -38
- package/dist/lib/Components/Select/Select.js +1 -1
- package/dist/lib/Components/Select/useSelectItems/useSelectItems.js +18 -18
- package/dist/libs/utils-shared/dist/index.js +4 -3
- package/dist/package.json +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaButton.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/MediaButton/MediaButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MediaButton.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/MediaButton/MediaButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAiFhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,WAAW,GAAI,6IAYzB,gBAAgB,4CA6ClB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useDisabledContext as
|
|
3
|
-
import { Slot as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { baseButtonVariants as
|
|
6
|
-
import { ChevronDown as
|
|
7
|
-
const y =
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useDisabledContext as C, cn as u } from "../../../libs/utils-shared/dist/index.js";
|
|
3
|
+
import { Slot as g, Slottable as v } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as S } from "class-variance-authority";
|
|
5
|
+
import { baseButtonVariants as z } from "../Button/BaseButton.js";
|
|
6
|
+
import { ChevronDown as x } from "../../Symbols/Icons/ChevronDown.js";
|
|
7
|
+
const y = S("gap-8 body-2-semi-bold", {
|
|
8
8
|
variants: {
|
|
9
9
|
size: {
|
|
10
10
|
sm: "",
|
|
@@ -14,60 +14,114 @@ const y = C("gap-8 body-2-semi-bold", {
|
|
|
14
14
|
flat: "",
|
|
15
15
|
rounded: "",
|
|
16
16
|
none: ""
|
|
17
|
+
},
|
|
18
|
+
hasChevron: {
|
|
19
|
+
true: "",
|
|
20
|
+
false: ""
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
compoundVariants: [
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
{
|
|
25
|
+
size: "md",
|
|
26
|
+
leadingContentShape: ["flat", "none"],
|
|
27
|
+
hasChevron: !0,
|
|
28
|
+
class: "py-14 pr-12 pl-16"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
size: "sm",
|
|
32
|
+
leadingContentShape: ["flat", "none"],
|
|
33
|
+
hasChevron: !0,
|
|
34
|
+
class: "py-10 pr-8 pl-12"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
size: "md",
|
|
38
|
+
leadingContentShape: "rounded",
|
|
39
|
+
hasChevron: !0,
|
|
40
|
+
class: "py-8 pr-12 pl-8"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
size: "sm",
|
|
44
|
+
leadingContentShape: "rounded",
|
|
45
|
+
hasChevron: !0,
|
|
46
|
+
class: "p-8"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
size: "md",
|
|
50
|
+
leadingContentShape: "flat",
|
|
51
|
+
hasChevron: !1,
|
|
52
|
+
class: "px-16 py-12"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
size: "md",
|
|
56
|
+
leadingContentShape: "none",
|
|
57
|
+
hasChevron: !1,
|
|
58
|
+
class: "px-16 py-14"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
size: "sm",
|
|
62
|
+
leadingContentShape: ["flat", "none"],
|
|
63
|
+
hasChevron: !1,
|
|
64
|
+
class: "px-12 py-10"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
size: "md",
|
|
68
|
+
leadingContentShape: "rounded",
|
|
69
|
+
hasChevron: !1,
|
|
70
|
+
class: "py-8 pr-16 pl-8"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
size: "sm",
|
|
74
|
+
leadingContentShape: "rounded",
|
|
75
|
+
hasChevron: !1,
|
|
76
|
+
class: "py-8 pr-10 pl-8"
|
|
77
|
+
}
|
|
26
78
|
],
|
|
27
79
|
defaultVariants: {
|
|
28
80
|
size: "md",
|
|
29
|
-
leadingContentShape: "none"
|
|
81
|
+
leadingContentShape: "none",
|
|
82
|
+
hasChevron: !0
|
|
30
83
|
}
|
|
31
84
|
}), k = ({
|
|
32
|
-
ref:
|
|
33
|
-
className:
|
|
85
|
+
ref: r,
|
|
86
|
+
className: i,
|
|
34
87
|
appearance: p = "gray",
|
|
35
|
-
size:
|
|
36
|
-
disabled:
|
|
88
|
+
size: d = "md",
|
|
89
|
+
disabled: h = !1,
|
|
37
90
|
asChild: n = !1,
|
|
38
91
|
leadingContent: a,
|
|
39
|
-
leadingContentShape:
|
|
40
|
-
hideChevron:
|
|
41
|
-
children:
|
|
42
|
-
...
|
|
92
|
+
leadingContentShape: m = "flat",
|
|
93
|
+
hideChevron: s = !1,
|
|
94
|
+
children: t,
|
|
95
|
+
...c
|
|
43
96
|
}) => {
|
|
44
|
-
const
|
|
97
|
+
const o = C({
|
|
45
98
|
consumerName: "MediaButton",
|
|
46
|
-
mergeWith: { disabled:
|
|
47
|
-
}),
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
n ?
|
|
99
|
+
mergeWith: { disabled: h }
|
|
100
|
+
}), f = a ? m : "none";
|
|
101
|
+
return /* @__PURE__ */ l(
|
|
102
|
+
n ? g : "button",
|
|
50
103
|
{
|
|
51
|
-
ref:
|
|
104
|
+
ref: r,
|
|
52
105
|
className: u(
|
|
53
|
-
|
|
106
|
+
z({
|
|
54
107
|
appearance: p,
|
|
55
|
-
disabled:
|
|
108
|
+
disabled: o,
|
|
56
109
|
loading: !1
|
|
57
110
|
}),
|
|
58
111
|
y({
|
|
59
|
-
size:
|
|
60
|
-
leadingContentShape:
|
|
112
|
+
size: d,
|
|
113
|
+
leadingContentShape: f,
|
|
114
|
+
hasChevron: !s
|
|
61
115
|
}),
|
|
62
|
-
|
|
116
|
+
i
|
|
63
117
|
),
|
|
64
|
-
disabled:
|
|
65
|
-
...
|
|
118
|
+
disabled: o,
|
|
119
|
+
...c,
|
|
66
120
|
children: [
|
|
67
121
|
a && /* @__PURE__ */ e("span", { className: "inline-flex shrink-0 items-center", children: a }),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
n ? /* @__PURE__ */ e(
|
|
70
|
-
!
|
|
122
|
+
/* @__PURE__ */ l("span", { className: "flex items-center gap-2", children: [
|
|
123
|
+
n ? /* @__PURE__ */ e(v, { children: t }) : /* @__PURE__ */ e("span", { className: "line-clamp-1 text-left", children: t }),
|
|
124
|
+
!s && /* @__PURE__ */ e(x, { size: 20 })
|
|
71
125
|
] })
|
|
72
126
|
]
|
|
73
127
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { useState as b, useCallback as
|
|
2
|
-
import { useControllableState as
|
|
3
|
-
import { groupItemsByKey as
|
|
1
|
+
import { useState as b, useCallback as f, useMemo as u } from "react";
|
|
2
|
+
import { useControllableState as v } from "../../../../utils/useControllableState/useControllableState.js";
|
|
3
|
+
import { groupItemsByKey as d, defaultLabelFilter as x } from "../utils/groupItems.js";
|
|
4
4
|
function B({
|
|
5
5
|
items: r,
|
|
6
6
|
filter: s,
|
|
7
|
-
filteredItems:
|
|
8
|
-
searchValue:
|
|
7
|
+
filteredItems: a,
|
|
8
|
+
searchValue: m,
|
|
9
9
|
defaultSearchValue: p,
|
|
10
10
|
onSearchValueChange: S
|
|
11
11
|
}) {
|
|
12
|
-
const [c, h] = b(!1), [t,
|
|
13
|
-
prop:
|
|
12
|
+
const [c, h] = b(!1), [t, i] = v({
|
|
13
|
+
prop: m,
|
|
14
14
|
defaultProp: p ?? "",
|
|
15
15
|
onChange: S
|
|
16
|
-
}), g =
|
|
16
|
+
}), g = f(() => (h(!0), () => h(!1)), []), V = f(
|
|
17
17
|
(e) => {
|
|
18
|
-
|
|
18
|
+
i(e);
|
|
19
19
|
},
|
|
20
|
-
[
|
|
21
|
-
),
|
|
22
|
-
() => r.some((e) => e.group
|
|
20
|
+
[i]
|
|
21
|
+
), l = c ? s === void 0 ? x : s : null, n = u(
|
|
22
|
+
() => r.some((e) => e.group !== void 0),
|
|
23
23
|
[r]
|
|
24
|
-
),
|
|
25
|
-
() => n ?
|
|
24
|
+
), o = u(
|
|
25
|
+
() => n ? d(r) : null,
|
|
26
26
|
[r, n]
|
|
27
|
-
), C = u(() => !
|
|
27
|
+
), C = u(() => !l || !t.trim() ? o ?? r : o ? o.map((e) => ({
|
|
28
28
|
...e,
|
|
29
|
-
items: e.items.filter((F) =>
|
|
30
|
-
})).filter((e) => e.items.length > 0) : r.filter((e) =>
|
|
29
|
+
items: e.items.filter((F) => l(F, t))
|
|
30
|
+
})).filter((e) => e.items.length > 0) : r.filter((e) => l(e, t)), [o, r, t, l]), I = u(() => a ? n ? d(a) : a : null, [a, n]) ?? C;
|
|
31
31
|
return {
|
|
32
32
|
isGrouped: n,
|
|
33
|
-
groupedItems:
|
|
33
|
+
groupedItems: o,
|
|
34
34
|
filteredItemsForRoot: I,
|
|
35
35
|
resolvedSearchValue: t,
|
|
36
36
|
searchMounted: c,
|
|
@@ -30,13 +30,14 @@ function H(e, t = {}) {
|
|
|
30
30
|
return n = n.replace(/\D/g, ""), a > 0 && n.length > a && (n = n.slice(0, a)), s ? w(n) : n;
|
|
31
31
|
n === "." && (n = "0.");
|
|
32
32
|
const c = n.indexOf(".");
|
|
33
|
-
if (c
|
|
33
|
+
if (c === -1)
|
|
34
|
+
a > 0 && n.length > a && (n = n.slice(0, a));
|
|
35
|
+
else {
|
|
34
36
|
let u = n.slice(0, c), d = n.slice(c + 1).replace(/\./g, "");
|
|
35
37
|
a > 0 && u.length > a && (u = u.slice(0, a)), d = d.slice(0, i), u === "" && (u = "0");
|
|
36
38
|
const h = r.endsWith(".") || n.endsWith(".");
|
|
37
39
|
n = d.length > 0 ? `${u}.${d}` : h ? `${u}.` : u;
|
|
38
|
-
}
|
|
39
|
-
a > 0 && n.length > a && (n = n.slice(0, a));
|
|
40
|
+
}
|
|
40
41
|
return s ? w(n) : n;
|
|
41
42
|
}
|
|
42
43
|
function F(e, t) {
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@ledgerhq/lumen-utils-shared": "0.1.
|
|
44
|
+
"@ledgerhq/lumen-utils-shared": "0.1.6",
|
|
45
45
|
"i18next": "^23.7.0",
|
|
46
46
|
"react-i18next": "^14.0.0"
|
|
47
47
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
55
55
|
"class-variance-authority": "^0.7.1",
|
|
56
56
|
"@tanstack/react-table": "^8.21.3",
|
|
57
|
-
"@ledgerhq/lumen-design-core": "0.1.
|
|
57
|
+
"@ledgerhq/lumen-design-core": "0.1.18",
|
|
58
58
|
"clsx": "^2.1.1",
|
|
59
59
|
"react": "^18.0.0 || ^19.0.0",
|
|
60
60
|
"react-dom": "^18.0.0 || ^19.0.0",
|