@frontify/fondue-components 27.0.1 → 29.0.0
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/fondue-components.js +62 -56
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +1 -1
- package/dist/fondue-components100.js +23 -6
- package/dist/fondue-components100.js.map +1 -1
- package/dist/fondue-components101.js +34 -12
- package/dist/fondue-components101.js.map +1 -1
- package/dist/fondue-components102.js +10 -70
- package/dist/fondue-components102.js.map +1 -1
- package/dist/fondue-components103.js +67 -14
- package/dist/fondue-components103.js.map +1 -1
- package/dist/fondue-components104.js +15 -7
- package/dist/fondue-components104.js.map +1 -1
- package/dist/fondue-components105.js +25 -88
- package/dist/fondue-components105.js.map +1 -1
- package/dist/fondue-components106.js +18 -80
- package/dist/fondue-components106.js.map +1 -1
- package/dist/fondue-components107.js +24 -30
- package/dist/fondue-components107.js.map +1 -1
- package/dist/fondue-components108.js +8 -20
- package/dist/fondue-components108.js.map +1 -1
- package/dist/fondue-components109.js +30 -39
- package/dist/fondue-components109.js.map +1 -1
- package/dist/fondue-components11.js +3 -3
- package/dist/fondue-components110.js +10 -0
- package/dist/fondue-components110.js.map +1 -0
- package/dist/fondue-components111.js +8 -0
- package/dist/fondue-components111.js.map +1 -0
- package/dist/fondue-components112.js +8 -0
- package/dist/fondue-components112.js.map +1 -0
- package/dist/fondue-components113.js +20 -0
- package/dist/fondue-components113.js.map +1 -0
- package/dist/fondue-components114.js +17 -0
- package/dist/fondue-components114.js.map +1 -0
- package/dist/fondue-components115.js +18 -0
- package/dist/fondue-components115.js.map +1 -0
- package/dist/fondue-components116.js +114 -0
- package/dist/fondue-components116.js.map +1 -0
- package/dist/fondue-components117.js +16 -0
- package/dist/fondue-components117.js.map +1 -0
- package/dist/fondue-components118.js +20 -0
- package/dist/fondue-components118.js.map +1 -0
- package/dist/fondue-components119.js +16 -0
- package/dist/fondue-components119.js.map +1 -0
- package/dist/fondue-components12.js +7 -37
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components120.js +130 -0
- package/dist/fondue-components120.js.map +1 -0
- package/dist/fondue-components121.js +14 -0
- package/dist/fondue-components121.js.map +1 -0
- package/dist/fondue-components122.js +39 -0
- package/dist/fondue-components122.js.map +1 -0
- package/dist/fondue-components123.js +220 -0
- package/dist/fondue-components123.js.map +1 -0
- package/dist/fondue-components124.js +22 -0
- package/dist/fondue-components124.js.map +1 -0
- package/dist/fondue-components125.js +20 -0
- package/dist/fondue-components125.js.map +1 -0
- package/dist/fondue-components126.js +154 -0
- package/dist/fondue-components126.js.map +1 -0
- package/dist/fondue-components127.js +48 -0
- package/dist/fondue-components127.js.map +1 -0
- package/dist/fondue-components128.js +173 -0
- package/dist/fondue-components128.js.map +1 -0
- package/dist/fondue-components129.js +63 -0
- package/dist/fondue-components129.js.map +1 -0
- package/dist/fondue-components13.js +59 -118
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components130.js +12 -0
- package/dist/fondue-components130.js.map +1 -0
- package/dist/fondue-components131.js +259 -0
- package/dist/fondue-components131.js.map +1 -0
- package/dist/fondue-components132.js +32 -0
- package/dist/fondue-components132.js.map +1 -0
- package/dist/fondue-components134.js +44 -0
- package/dist/fondue-components134.js.map +1 -0
- package/dist/fondue-components135.js +9 -0
- package/dist/fondue-components135.js.map +1 -0
- package/dist/fondue-components136.js +15 -0
- package/dist/fondue-components136.js.map +1 -0
- package/dist/fondue-components137.js +74 -0
- package/dist/fondue-components137.js.map +1 -0
- package/dist/fondue-components138.js +18 -0
- package/dist/fondue-components138.js.map +1 -0
- package/dist/fondue-components139.js +10 -0
- package/dist/fondue-components139.js.map +1 -0
- package/dist/fondue-components14.js +21 -21
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components140.js +92 -0
- package/dist/fondue-components140.js.map +1 -0
- package/dist/fondue-components141.js +84 -0
- package/dist/fondue-components141.js.map +1 -0
- package/dist/fondue-components142.js +34 -0
- package/dist/fondue-components142.js.map +1 -0
- package/dist/fondue-components143.js +22 -0
- package/dist/fondue-components143.js.map +1 -0
- package/dist/fondue-components144.js +73 -0
- package/dist/fondue-components144.js.map +1 -0
- package/dist/fondue-components145.js +1355 -0
- package/dist/fondue-components145.js.map +1 -0
- package/dist/fondue-components146.js +944 -0
- package/dist/fondue-components146.js.map +1 -0
- package/dist/fondue-components147.js +201 -0
- package/dist/fondue-components147.js.map +1 -0
- package/dist/fondue-components148.js +24 -0
- package/dist/fondue-components148.js.map +1 -0
- package/dist/fondue-components149.js +43 -0
- package/dist/fondue-components149.js.map +1 -0
- package/dist/fondue-components15.js +121 -45
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components150.js +71 -0
- package/dist/fondue-components150.js.map +1 -0
- package/dist/fondue-components151.js +34 -0
- package/dist/fondue-components151.js.map +1 -0
- package/dist/fondue-components152.js +12 -0
- package/dist/fondue-components152.js.map +1 -0
- package/dist/fondue-components153.js +156 -0
- package/dist/fondue-components153.js.map +1 -0
- package/dist/fondue-components154.js +111 -0
- package/dist/fondue-components154.js.map +1 -0
- package/dist/fondue-components155.js +19 -0
- package/dist/fondue-components155.js.map +1 -0
- package/dist/fondue-components156.js +19 -0
- package/dist/fondue-components156.js.map +1 -0
- package/dist/fondue-components157.js +32 -0
- package/dist/fondue-components157.js.map +1 -0
- package/dist/fondue-components158.js +16 -0
- package/dist/fondue-components158.js.map +1 -0
- package/dist/fondue-components159.js +10 -0
- package/dist/fondue-components159.js.map +1 -0
- package/dist/fondue-components16.js +35 -41
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +44 -56
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +40 -41
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +56 -19
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +42 -45
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +18 -71
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +46 -17
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +68 -75
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +70 -32
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +17 -54
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +77 -23
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +34 -53
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +52 -97
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +23 -33
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +52 -193
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +89 -135
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +30 -130
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +191 -27
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +144 -79
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +125 -116
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +32 -37
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +77 -52
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +123 -20
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +34 -21
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +3 -3
- package/dist/fondue-components40.js +56 -7
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +20 -8
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +26 -41
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +7 -4
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +8 -4
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +41 -13
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +5 -32
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +4 -53
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +12 -130
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +32 -21
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +54 -53
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +130 -7
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +21 -13
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +53 -17
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +7 -4
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +13 -18
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +16 -18
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +1 -1
- package/dist/fondue-components58.js +18 -13
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +18 -4
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +1 -1
- package/dist/fondue-components60.js +43 -17
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +24 -10
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +22 -36
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +6 -6
- package/dist/fondue-components64.js +1 -1
- package/dist/fondue-components65.js +10 -10
- package/dist/fondue-components66.js +3 -7
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +16 -11
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +10 -4
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +36 -24
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +1 -1
- package/dist/fondue-components70.js +6 -16
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +5 -20
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +13 -20
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +52 -20
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +44 -20
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +6 -19
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +6 -8
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +13 -11
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +27 -10
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +13 -7
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +4 -12
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +12 -22
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +48 -34
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +22 -10
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +623 -62
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +8 -14
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +12 -24
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +4 -18
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +24 -24
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +16 -8
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +5 -5
- package/dist/fondue-components90.js +20 -26
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +20 -7
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +20 -5
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +20 -5
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +19 -17
- package/dist/fondue-components94.js.map +1 -1
- package/dist/fondue-components95.js +8 -217
- package/dist/fondue-components95.js.map +1 -1
- package/dist/fondue-components96.js +10 -18
- package/dist/fondue-components96.js.map +1 -1
- package/dist/fondue-components97.js +10 -16
- package/dist/fondue-components97.js.map +1 -1
- package/dist/fondue-components98.js +6 -150
- package/dist/fondue-components98.js.map +1 -1
- package/dist/fondue-components99.js +12 -44
- package/dist/fondue-components99.js.map +1 -1
- package/dist/index.d.ts +201 -26
- package/dist/style.css +1 -1
- package/package.json +7 -3
|
@@ -1,24 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as F, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { IconCheckMark as J, IconExclamationMarkTriangle as L, IconCross as Q } from "@frontify/fondue-icons";
|
|
3
|
+
import { forwardRef as B, useRef as y, useState as U, useEffect as z } from "react";
|
|
4
|
+
import { useSyncRefs as X } from "./fondue-components54.js";
|
|
5
|
+
import o from "./fondue-components107.js";
|
|
6
|
+
const D = ({
|
|
7
|
+
"data-test-id": c = "fondue-textarea",
|
|
8
|
+
autocomplete: i,
|
|
9
|
+
autosize: u,
|
|
10
|
+
children: m,
|
|
11
|
+
clearable: f,
|
|
12
|
+
decorator: h,
|
|
13
|
+
defaultValue: g,
|
|
14
|
+
disabled: n,
|
|
15
|
+
extraActions: r,
|
|
16
|
+
focusOnMount: v,
|
|
17
|
+
minRows: M = 1,
|
|
18
|
+
maxRows: k,
|
|
19
|
+
onEnterPressed: w,
|
|
20
|
+
readOnly: d,
|
|
21
|
+
resizable: $,
|
|
22
|
+
selectable: b = !0,
|
|
23
|
+
status: s = "default",
|
|
24
|
+
value: N,
|
|
25
|
+
...l
|
|
26
|
+
}, W) => {
|
|
27
|
+
const R = y(null), T = y(!1);
|
|
28
|
+
X(R, W);
|
|
29
|
+
const [x, S] = U(N ?? g ?? ""), C = (r == null ? void 0 : r.length) !== void 0 || f || ["success", "error"].includes(s), q = () => {
|
|
30
|
+
S("");
|
|
31
|
+
}, G = (a) => {
|
|
32
|
+
var t;
|
|
33
|
+
a.key === "Enter" && (w == null || w(a)), (t = l.onKeyDown) == null || t.call(l, a);
|
|
34
|
+
};
|
|
35
|
+
return z(() => {
|
|
36
|
+
S(N ?? g ?? "");
|
|
37
|
+
}, [g, N]), z(() => {
|
|
38
|
+
var a;
|
|
39
|
+
v && ((a = R.current) == null || a.focus());
|
|
40
|
+
}, [v]), /* @__PURE__ */ F(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: o.root,
|
|
44
|
+
"data-autosize": u,
|
|
45
|
+
"data-clearable": f,
|
|
46
|
+
"data-disabled": n || d,
|
|
47
|
+
"data-has-decorator": !!h,
|
|
48
|
+
"data-has-tools": C,
|
|
49
|
+
"data-resizable": $,
|
|
50
|
+
"data-status": s,
|
|
51
|
+
"data-max-rows": !!k,
|
|
52
|
+
"data-test-id": c,
|
|
53
|
+
style: { "--max-rows": `${k}` },
|
|
54
|
+
children: [
|
|
55
|
+
h ? /* @__PURE__ */ e("div", { className: o.decorator, children: h }) : null,
|
|
56
|
+
/* @__PURE__ */ e("div", { className: o.textareaWrapper, "data-replicated-value": x, children: /* @__PURE__ */ e(
|
|
57
|
+
"textarea",
|
|
58
|
+
{
|
|
59
|
+
...l,
|
|
60
|
+
onMouseDown: (a) => {
|
|
61
|
+
T.current = !0, a.currentTarget.dataset.showFocusRing = "false";
|
|
62
|
+
},
|
|
63
|
+
onFocus: (a) => {
|
|
64
|
+
var t;
|
|
65
|
+
T.current || (a.target.dataset.showFocusRing = "true"), (t = l.onFocus) == null || t.call(l, a);
|
|
66
|
+
},
|
|
67
|
+
onBlur: (a) => {
|
|
68
|
+
var t;
|
|
69
|
+
a.target.dataset.showFocusRing = "false", T.current = !1, (t = l.onBlur) == null || t.call(l, a);
|
|
70
|
+
},
|
|
71
|
+
autoComplete: i ? "on" : "off",
|
|
72
|
+
className: o.textarea,
|
|
73
|
+
disabled: n,
|
|
74
|
+
onKeyDown: G,
|
|
75
|
+
onInput: (a) => S(a.currentTarget.value),
|
|
76
|
+
onSelect: (a) => {
|
|
77
|
+
b || (a.currentTarget.selectionStart = a.currentTarget.selectionEnd);
|
|
78
|
+
},
|
|
79
|
+
readOnly: d,
|
|
80
|
+
ref: R,
|
|
81
|
+
rows: M,
|
|
82
|
+
value: x
|
|
83
|
+
}
|
|
84
|
+
) }),
|
|
85
|
+
s === "loading" && /* @__PURE__ */ e("div", { className: o.loadingStatus, "data-test-id": `${c}-loader` }),
|
|
86
|
+
C && /* @__PURE__ */ F("div", { className: o.tools, children: [
|
|
87
|
+
s === "success" && /* @__PURE__ */ e("div", { className: o.success, children: /* @__PURE__ */ e(J, { size: 20 }) }),
|
|
88
|
+
s === "error" && /* @__PURE__ */ e("div", { className: o[s], children: /* @__PURE__ */ e(L, { size: 20 }) }),
|
|
89
|
+
r == null ? void 0 : r.map(({ icon: a, title: t, callback: H }) => /* @__PURE__ */ e(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
className: o.toolsButton,
|
|
93
|
+
disabled: n || d,
|
|
94
|
+
onClick: H,
|
|
95
|
+
title: t,
|
|
96
|
+
children: a
|
|
97
|
+
},
|
|
98
|
+
t
|
|
99
|
+
)),
|
|
100
|
+
f && /* @__PURE__ */ e("button", { className: o.toolsButton, onClick: q, disabled: n || d, children: /* @__PURE__ */ e(Q, { size: 20, fill: "currentColor" }) })
|
|
101
|
+
] }),
|
|
102
|
+
m
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
11
106
|
};
|
|
107
|
+
D.displayName = "Textarea.Root";
|
|
108
|
+
const j = ({ name: c, className: i, ...u }, m) => /* @__PURE__ */ e(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
"data-slot": !0,
|
|
112
|
+
"data-name": c,
|
|
113
|
+
...u,
|
|
114
|
+
ref: m,
|
|
115
|
+
className: [o.slot, i].filter(Boolean).join(" ")
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
j.displayName = "Textarea.Slot";
|
|
119
|
+
const I = B(D), Y = B(j), K = I;
|
|
120
|
+
K.Root = I;
|
|
121
|
+
K.Slot = Y;
|
|
12
122
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
r as accordionHeader,
|
|
17
|
-
c as accordionItem,
|
|
18
|
-
t as accordionSlot,
|
|
19
|
-
n as accordionTrigger,
|
|
20
|
-
a as accordionTriggerContent,
|
|
21
|
-
_ as default,
|
|
22
|
-
o as root
|
|
123
|
+
K as Textarea,
|
|
124
|
+
D as TextareaRoot,
|
|
125
|
+
j as TextareaSlot
|
|
23
126
|
};
|
|
24
127
|
//# sourceMappingURL=fondue-components38.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components38.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"fondue-components38.js","sources":["../src/components/Textarea/Textarea.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconCross, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type ChangeEventHandler,\n type CSSProperties,\n type FocusEventHandler,\n type ForwardedRef,\n type KeyboardEventHandler,\n type ReactElement,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\n\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\n\nimport styles from './styles/textarea.module.scss';\n\n/**\n * @deprecated Use Textarea.Slot instead for custom actions\n */\nexport type ExtraAction = {\n icon: ReactElement;\n title: string;\n callback: () => void;\n};\n\ntype Status = 'default' | 'loading' | 'success' | 'error';\n\ntype TextareaProps = {\n /**\n * The id of the textarea\n */\n id?: string;\n /**\n * The place where the textarea slots are placed\n */\n children?: ReactNode;\n /**\n * If `true`, Textarea will have `autoComplete` functionality\n */\n autocomplete?: boolean;\n /**\n * If `true`, component rendered is a auto sizing Textarea\n */\n autosize?: boolean;\n /**\n * Render `clear` button to clear input on click\n */\n clearable?: boolean;\n /**\n * A `ReactElement` that will be rendered at the start of the `Textarea`\n */\n decorator?: ReactElement;\n /**\n * Initial value\n */\n defaultValue?: string;\n disabled?: boolean;\n /**\n * Collection of extra actions the input can preform\n * @deprecated Use Textarea.Slot instead for custom actions\n */\n extraActions?: ExtraAction[];\n /**\n * If `true`, Textarea will be focused on mount\n */\n focusOnMount?: boolean;\n /**\n * If autosize is false, this is used as rows property for default textarea\n * @default 1\n */\n minRows?: number;\n /**\n * If `autosize` is `false`, this property is ignored\n */\n maxRows?: number;\n /**\n * Event handler called when the textarea value changes\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is blurred\n */\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when Enter is pressed\n */\n onEnterPressed?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLTextAreaElement>) => void;\n /**\n * If `true`, Textarea will be required\n */\n required?: boolean;\n /**\n * The test id of the textarea\n */\n 'data-test-id'?: string;\n placeholder?: string;\n readOnly?: boolean;\n resizable?: boolean;\n selectable?: boolean;\n /**\n * The current status of the input. It will trigger the corresponding icon to be appended to the Textarea.\n * @default 'default'\n */\n status?: Status;\n value?: string;\n};\n\nexport const TextareaRoot = (\n {\n 'data-test-id': dataTestId = 'fondue-textarea',\n autocomplete,\n autosize,\n children,\n clearable,\n decorator,\n defaultValue,\n disabled,\n extraActions,\n focusOnMount,\n minRows: rows = 1,\n maxRows,\n onEnterPressed,\n readOnly,\n resizable,\n selectable = true,\n status = 'default',\n value: inputValue,\n ...props\n }: TextareaProps,\n forwardedRef: ForwardedRef<HTMLTextAreaElement>,\n) => {\n const ref = useRef<HTMLTextAreaElement>(null);\n const wasClicked = useRef(false);\n\n useSyncRefs<HTMLTextAreaElement>(ref, forwardedRef);\n\n const [value, setValue] = useState(inputValue ?? defaultValue ?? '');\n\n const hasTools = extraActions?.length !== undefined || clearable || ['success', 'error'].includes(status);\n\n const clear = () => {\n setValue('');\n };\n\n const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (event) => {\n if (event.key === 'Enter') {\n onEnterPressed?.(event);\n }\n props.onKeyDown?.(event);\n };\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setValue(inputValue ?? defaultValue ?? '');\n }, [defaultValue, inputValue]);\n\n useEffect(() => {\n if (focusOnMount) {\n ref.current?.focus();\n }\n }, [focusOnMount]);\n\n return (\n <div\n className={styles.root}\n data-autosize={autosize}\n data-clearable={clearable}\n data-disabled={disabled || readOnly}\n data-has-decorator={decorator ? true : false}\n data-has-tools={hasTools}\n data-resizable={resizable}\n data-status={status}\n data-max-rows={!!maxRows}\n data-test-id={dataTestId}\n style={{ '--max-rows': `${maxRows}` } as CSSProperties}\n >\n {decorator ? <div className={styles.decorator}>{decorator}</div> : null}\n <div className={styles.textareaWrapper} data-replicated-value={value}>\n <textarea\n {...props}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n props.onFocus?.(focusEvent);\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n props.onBlur?.(blurEvent);\n }}\n autoComplete={autocomplete ? 'on' : 'off'}\n className={styles.textarea}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onInput={(event) => setValue(event.currentTarget.value)}\n onSelect={(event) => {\n if (!selectable) {\n event.currentTarget.selectionStart = event.currentTarget.selectionEnd;\n }\n }}\n readOnly={readOnly}\n ref={ref}\n rows={rows}\n value={value}\n ></textarea>\n </div>\n {status === 'loading' && <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`} />}\n {hasTools && (\n <div className={styles.tools}>\n {status === 'success' && (\n <div className={styles.success}>\n <IconCheckMark size={20} />\n </div>\n )}\n {status === 'error' && (\n <div className={styles[status]}>\n <IconExclamationMarkTriangle size={20} />\n </div>\n )}\n {extraActions?.map(({ icon, title, callback }) => (\n <button\n className={styles.toolsButton}\n disabled={disabled || readOnly}\n key={title}\n onClick={callback}\n title={title}\n >\n {icon}\n </button>\n ))}\n {clearable && (\n <button className={styles.toolsButton} onClick={clear} disabled={disabled || readOnly}>\n <IconCross size={20} fill=\"currentColor\" />\n </button>\n )}\n </div>\n )}\n {children}\n </div>\n );\n};\nTextareaRoot.displayName = 'Textarea.Root';\n\nexport type TextareaSlotProps = {\n children: ReactNode;\n name?: 'left' | 'right';\n className?: string;\n};\n\nexport const TextareaSlot = (\n { name, className, ...slotProps }: TextareaSlotProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-slot\n data-name={name}\n {...slotProps}\n ref={forwardedRef}\n className={[styles.slot, className].filter(Boolean).join(' ')}\n />\n );\n};\n\nTextareaSlot.displayName = 'Textarea.Slot';\n\nconst ForwardedRefTextareaRoot = forwardRef<HTMLTextAreaElement, TextareaProps>(TextareaRoot);\nconst ForwardedRefTextareaSlot = forwardRef<HTMLDivElement, TextareaSlotProps>(TextareaSlot);\n\n// @ts-expect-error We support both single component (without slots) and compound components (with slots)\nexport const Textarea: typeof TextareaRoot & {\n Root: typeof ForwardedRefTextareaRoot;\n Slot: typeof ForwardedRefTextareaSlot;\n} = ForwardedRefTextareaRoot;\nTextarea.Root = ForwardedRefTextareaRoot;\nTextarea.Slot = ForwardedRefTextareaSlot;\n"],"names":["TextareaRoot","dataTestId","autocomplete","autosize","children","clearable","decorator","defaultValue","disabled","extraActions","focusOnMount","rows","maxRows","onEnterPressed","readOnly","resizable","selectable","status","inputValue","props","forwardedRef","ref","useRef","wasClicked","useSyncRefs","value","setValue","useState","hasTools","clear","handleKeyDown","event","_a","useEffect","jsxs","styles","jsx","mouseEvent","focusEvent","blurEvent","IconCheckMark","IconExclamationMarkTriangle","icon","title","callback","IconCross","TextareaSlot","name","className","slotProps","ForwardedRefTextareaRoot","forwardRef","ForwardedRefTextareaSlot","Textarea"],"mappings":"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"}
|
|
@@ -1,27 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import d from "./fondue-components108.js";
|
|
3
|
+
import { Slot as p } from "@radix-ui/react-slot";
|
|
4
|
+
import { createContext as u, useContext as a, useMemo as x } from "react";
|
|
5
|
+
import { enUS as s } from "./fondue-components109.js";
|
|
6
|
+
const r = u({
|
|
7
|
+
theme: "light",
|
|
8
|
+
dir: "ltr",
|
|
9
|
+
translations: s
|
|
10
|
+
});
|
|
11
|
+
r.displayName = "ThemeContext";
|
|
12
|
+
const g = () => {
|
|
13
|
+
const e = a(r);
|
|
5
14
|
return {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
(o, e) => {
|
|
9
|
-
const n = r[o];
|
|
10
|
-
if (n === void 0)
|
|
11
|
-
return process.env.NODE_ENV !== "production" && console.warn(`[Fondue] Translation key "${o}" not found`), o;
|
|
12
|
-
if (typeof n != "string")
|
|
13
|
-
return process.env.NODE_ENV !== "production" && console.warn(`[Fondue] Translation value for key "${o}" is not a string`), o;
|
|
14
|
-
let t = n;
|
|
15
|
-
if (e)
|
|
16
|
-
for (const [s, a] of Object.entries(e))
|
|
17
|
-
t = t.replaceAll(`\${${s}}`, a);
|
|
18
|
-
return t;
|
|
19
|
-
},
|
|
20
|
-
[r]
|
|
21
|
-
)
|
|
15
|
+
...e,
|
|
16
|
+
dir: e.dir || "ltr"
|
|
22
17
|
};
|
|
18
|
+
}, y = ({
|
|
19
|
+
children: e,
|
|
20
|
+
theme: t = "light",
|
|
21
|
+
dir: o = "ltr",
|
|
22
|
+
translations: m = s,
|
|
23
|
+
asChild: i = !1
|
|
24
|
+
}) => {
|
|
25
|
+
const l = i ? p : "div", c = x(
|
|
26
|
+
() => ({
|
|
27
|
+
theme: t,
|
|
28
|
+
dir: o,
|
|
29
|
+
translations: m
|
|
30
|
+
}),
|
|
31
|
+
[o, t, m]
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ n(r.Provider, { value: c, children: /* @__PURE__ */ n(l, { dir: o, className: `${d[t]} fondue-theme-provider`, children: e }) });
|
|
23
34
|
};
|
|
24
35
|
export {
|
|
25
|
-
|
|
36
|
+
r as ThemeContext,
|
|
37
|
+
y as ThemeProvider,
|
|
38
|
+
g as useFondueTheme
|
|
26
39
|
};
|
|
27
40
|
//# sourceMappingURL=fondue-components39.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components39.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components39.js","sources":["../src/components/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport styles from '@frontify/fondue-tokens/themes';\nimport { Slot } from '@radix-ui/react-slot';\nimport { createContext, useContext, useMemo, type ReactNode } from 'react';\n\nimport { enUS, type Translations } from '../../locales';\n\ntype AvailableTheme = keyof typeof styles;\n\ntype ThemeProviderProps = {\n children: ReactNode;\n /**\n * The theme to apply\n * @default \"light\"\n * */\n theme?: AvailableTheme;\n /**\n * Direction to apply to the theme\n * @default \"ltr\"\n */\n dir?: 'ltr' | 'rtl';\n /**\n * Translations object to use for component strings.\n * Import from '@frontify/fondue/components/locales' or provide your own.\n * Must be a complete Translations object.\n * @default \"enUS\"\n * @example\n * ```tsx\n * import { deDE } from '@frontify/fondue/components/locales';\n * <ThemeProvider translations={deDE}>...</ThemeProvider>\n * ```\n */\n translations?: Translations;\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default false\n */\n asChild?: boolean;\n};\n\ntype ThemeContextValue = {\n theme: AvailableTheme;\n dir: 'ltr' | 'rtl';\n translations: Translations;\n};\n\nexport const ThemeContext = createContext<ThemeContextValue>({\n theme: 'light',\n dir: 'ltr',\n translations: enUS,\n});\nThemeContext.displayName = 'ThemeContext';\n\nexport const useFondueTheme = () => {\n const context = useContext(ThemeContext);\n // Ensure we always have a valid direction, defaulting to 'ltr' if not provided\n return {\n ...context,\n dir: context.dir || 'ltr',\n };\n};\n\nexport const ThemeProvider = ({\n children,\n theme = 'light',\n dir = 'ltr',\n translations = enUS,\n asChild = false,\n}: ThemeProviderProps) => {\n const Comp = asChild ? Slot : 'div';\n\n const contextValue = useMemo(\n () => ({\n theme,\n dir,\n translations,\n }),\n [dir, theme, translations],\n );\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <Comp dir={dir} className={`${styles[theme]} fondue-theme-provider`}>\n {children}\n </Comp>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","enUS","useFondueTheme","context","useContext","ThemeProvider","children","theme","dir","translations","asChild","Comp","Slot","contextValue","useMemo","jsx","styles"],"mappings":";;;;;AA+CO,MAAMA,IAAeC,EAAiC;AAAA,EACzD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,cAAcC;AAClB,CAAC;AACDF,EAAa,cAAc;AAEpB,MAAMG,IAAiB,MAAM;AAChC,QAAMC,IAAUC,EAAWL,CAAY;AAEvC,SAAO;AAAA,IACH,GAAGI;AAAA,IACH,KAAKA,EAAQ,OAAO;AAAA,EAAA;AAE5B,GAEaE,IAAgB,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,KAAAC,IAAM;AAAA,EACN,cAAAC,IAAeR;AAAA,EACf,SAAAS,IAAU;AACd,MAA0B;AACtB,QAAMC,IAAOD,IAAUE,IAAO,OAExBC,IAAeC;AAAA,IACjB,OAAO;AAAA,MACH,OAAAP;AAAA,MACA,KAAAC;AAAA,MACA,cAAAC;AAAA,IAAA;AAAA,IAEJ,CAACD,GAAKD,GAAOE,CAAY;AAAA,EAAA;AAG7B,2BACKV,EAAa,UAAb,EAAsB,OAAOc,GAC1B,UAAA,gBAAAE,EAACJ,GAAA,EAAK,KAAAH,GAAU,WAAW,GAAGQ,EAAOT,CAAK,CAAC,0BACtC,UAAAD,GACL,GACJ;AAER;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t, jsxs as p, Fragment as B } from "react/jsx-runtime";
|
|
2
2
|
import { IconCross as y } from "@frontify/fondue-icons";
|
|
3
|
-
import { useTranslation as v } from "./fondue-
|
|
4
|
-
import { BadgeStatus as x } from "./fondue-
|
|
5
|
-
import l from "./fondue-
|
|
3
|
+
import { useTranslation as v } from "./fondue-components42.js";
|
|
4
|
+
import { BadgeStatus as x } from "./fondue-components43.js";
|
|
5
|
+
import l from "./fondue-components44.js";
|
|
6
6
|
const S = ({
|
|
7
7
|
"aria-label": a,
|
|
8
8
|
"data-test-id": e = "badge",
|
|
@@ -1,11 +1,60 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as o, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "@radix-ui/react-tooltip";
|
|
3
|
+
import { forwardRef as d } from "react";
|
|
4
|
+
import { useFondueTheme as R, ThemeProvider as N } from "./fondue-components39.js";
|
|
5
|
+
import s from "./fondue-components110.js";
|
|
6
|
+
const p = ({ children: t, enterDelay: e = 700, open: i, onOpenChange: n }) => /* @__PURE__ */ o(r.Provider, { children: /* @__PURE__ */ o(r.Root, { delayDuration: e, open: i, onOpenChange: n, children: t }) });
|
|
7
|
+
p.displayName = "Tooltip.Root";
|
|
8
|
+
const f = ({ asChild: t = !1, children: e, "data-test-id": i = "fondue-tooltip-trigger" }, n) => /* @__PURE__ */ o(
|
|
9
|
+
r.Trigger,
|
|
10
|
+
{
|
|
11
|
+
"data-tooltip-trigger": !0,
|
|
12
|
+
"data-test-id": i,
|
|
13
|
+
type: t ? void 0 : "button",
|
|
14
|
+
asChild: t,
|
|
15
|
+
ref: n,
|
|
16
|
+
children: e
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
f.displayName = "Tooltip.Trigger";
|
|
20
|
+
const m = ({
|
|
21
|
+
children: t,
|
|
22
|
+
className: e,
|
|
23
|
+
maxWidth: i,
|
|
24
|
+
"data-test-id": n = "fondue-tooltip-content",
|
|
25
|
+
padding: g = "spacious",
|
|
26
|
+
side: u
|
|
27
|
+
}, c) => {
|
|
28
|
+
const { theme: T, dir: l } = R(), h = (a) => !a || l === "ltr" ? a : a === "left" ? "right" : a === "right" ? "left" : a;
|
|
29
|
+
return /* @__PURE__ */ o(r.Portal, { children: /* @__PURE__ */ o(N, { theme: T, dir: l, children: /* @__PURE__ */ y(
|
|
30
|
+
r.Content,
|
|
31
|
+
{
|
|
32
|
+
dir: l,
|
|
33
|
+
"data-test-id": n,
|
|
34
|
+
"data-tooltip-spacing": g,
|
|
35
|
+
className: [s.root, e].filter(Boolean).join(" "),
|
|
36
|
+
style: { maxWidth: i },
|
|
37
|
+
collisionPadding: 16,
|
|
38
|
+
sideOffset: 8,
|
|
39
|
+
ref: c,
|
|
40
|
+
side: h(u),
|
|
41
|
+
children: [
|
|
42
|
+
t,
|
|
43
|
+
/* @__PURE__ */ o(r.Arrow, { "aria-hidden": "true", className: s.arrow })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
) }) });
|
|
47
|
+
};
|
|
48
|
+
m.displayName = "Tooltip.Content";
|
|
49
|
+
const w = {
|
|
50
|
+
Root: p,
|
|
51
|
+
Trigger: d(f),
|
|
52
|
+
Content: d(m)
|
|
7
53
|
};
|
|
8
54
|
export {
|
|
9
|
-
|
|
55
|
+
w as Tooltip,
|
|
56
|
+
m as TooltipContent,
|
|
57
|
+
p as TooltipRoot,
|
|
58
|
+
f as TooltipTrigger
|
|
10
59
|
};
|
|
11
60
|
//# sourceMappingURL=fondue-components40.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components40.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components40.js","sources":["../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixTooltip from '@radix-ui/react-tooltip';\nimport { forwardRef, type ForwardedRef, type ReactElement, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/tooltip.module.scss';\n\nexport type TooltipRootProps = {\n /**\n * Sets the open state of the tooltip.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the tooltip changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The delay in milliseconds before the tooltip appears.\n * @default 700\n */\n enterDelay?: number;\n children: Array<ReactElement<TooltipTriggerProps | TooltipContentProps>>;\n};\n\nexport const TooltipRoot = ({ children, enterDelay = 700, open, onOpenChange }: TooltipRootProps) => {\n return (\n <RadixTooltip.Provider>\n <RadixTooltip.Root delayDuration={enterDelay} open={open} onOpenChange={onOpenChange}>\n {children}\n </RadixTooltip.Root>\n </RadixTooltip.Provider>\n );\n};\nTooltipRoot.displayName = 'Tooltip.Root';\n\nexport type TooltipTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default false\n */\n asChild?: boolean;\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const TooltipTrigger = (\n { asChild = false, children, 'data-test-id': dataTestId = 'fondue-tooltip-trigger' }: TooltipTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixTooltip.Trigger\n data-tooltip-trigger\n data-test-id={dataTestId}\n type={!asChild ? 'button' : undefined}\n asChild={asChild}\n ref={ref}\n >\n {children}\n </RadixTooltip.Trigger>\n );\n};\nTooltipTrigger.displayName = 'Tooltip.Trigger';\n\nexport type TooltipContentProps = {\n /**\n * @default \"spacious\"\n */\n padding?: 'spacious' | 'compact';\n /**\n * Defines the preferred side of the tooltip. It will not be respected if there are collisions with the viewport.\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n maxWidth?: string;\n className?: string;\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const TooltipContent = (\n {\n children,\n className,\n maxWidth,\n 'data-test-id': dataTestId = 'fondue-tooltip-content',\n padding = 'spacious',\n side,\n }: TooltipContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n const getAdjustedSide = (side?: 'top' | 'right' | 'bottom' | 'left') => {\n if (!side || dir === 'ltr') {\n return side;\n }\n\n if (side === 'left') {\n return 'right';\n }\n if (side === 'right') {\n return 'left';\n }\n\n return side;\n };\n\n return (\n <RadixTooltip.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixTooltip.Content\n dir={dir}\n data-test-id={dataTestId}\n data-tooltip-spacing={padding}\n className={[styles.root, className].filter(Boolean).join(' ')}\n style={{ maxWidth }}\n collisionPadding={16}\n sideOffset={8}\n ref={ref}\n side={getAdjustedSide(side)}\n >\n {children}\n <RadixTooltip.Arrow aria-hidden=\"true\" className={styles.arrow} />\n </RadixTooltip.Content>\n </ThemeProvider>\n </RadixTooltip.Portal>\n );\n};\nTooltipContent.displayName = 'Tooltip.Content';\n\nexport const Tooltip = {\n Root: TooltipRoot,\n Trigger: forwardRef<HTMLButtonElement, TooltipTriggerProps>(TooltipTrigger),\n Content: forwardRef<HTMLDivElement, TooltipContentProps>(TooltipContent),\n};\n"],"names":["TooltipRoot","children","enterDelay","open","onOpenChange","jsx","RadixTooltip","TooltipTrigger","asChild","dataTestId","ref","TooltipContent","className","maxWidth","padding","side","theme","dir","useFondueTheme","getAdjustedSide","ThemeProvider","jsxs","styles","Tooltip","forwardRef"],"mappings":";;;;;AA0BO,MAAMA,IAAc,CAAC,EAAE,UAAAC,GAAU,YAAAC,IAAa,KAAK,MAAAC,GAAM,cAAAC,QAExD,gBAAAC,EAACC,EAAa,UAAb,EACG,UAAA,gBAAAD,EAACC,EAAa,MAAb,EAAkB,eAAeJ,GAAY,MAAAC,GAAY,cAAAC,GACrD,UAAAH,GACL,GACJ;AAGRD,EAAY,cAAc;AAYnB,MAAMO,IAAiB,CAC1B,EAAE,SAAAC,IAAU,IAAO,UAAAP,GAAU,gBAAgBQ,IAAa,yBAAA,GAC1DC,MAGI,gBAAAL;AAAA,EAACC,EAAa;AAAA,EAAb;AAAA,IACG,wBAAoB;AAAA,IACpB,gBAAcG;AAAA,IACd,MAAOD,IAAqB,SAAX;AAAA,IACjB,SAAAA;AAAA,IACA,KAAAE;AAAA,IAEC,UAAAT;AAAA,EAAA;AAAA;AAIbM,EAAe,cAAc;AAiBtB,MAAMI,IAAiB,CAC1B;AAAA,EACI,UAAAV;AAAA,EACA,WAAAW;AAAA,EACA,UAAAC;AAAA,EACA,gBAAgBJ,IAAa;AAAA,EAC7B,SAAAK,IAAU;AAAA,EACV,MAAAC;AACJ,GACAL,MACC;AACD,QAAM,EAAE,OAAAM,GAAO,KAAAC,EAAA,IAAQC,EAAA,GAEjBC,IAAkB,CAACJ,MACjB,CAACA,KAAQE,MAAQ,QACVF,IAGPA,MAAS,SACF,UAEPA,MAAS,UACF,SAGJA;AAGX,2BACKT,EAAa,QAAb,EACG,UAAA,gBAAAD,EAACe,GAAA,EAAc,OAAAJ,GAAc,KAAAC,GACzB,UAAA,gBAAAI;AAAA,IAACf,EAAa;AAAA,IAAb;AAAA,MACG,KAAAW;AAAA,MACA,gBAAcR;AAAA,MACd,wBAAsBK;AAAA,MACtB,WAAW,CAACQ,EAAO,MAAMV,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,MAC5D,OAAO,EAAE,UAAAC,EAAA;AAAA,MACT,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,KAAAH;AAAA,MACA,MAAMS,EAAgBJ,CAAI;AAAA,MAEzB,UAAA;AAAA,QAAAd;AAAA,QACD,gBAAAI,EAACC,EAAa,OAAb,EAAmB,eAAY,QAAO,WAAWgB,EAAO,MAAA,CAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAExE,EAAA,CACJ;AAER;AACAX,EAAe,cAAc;AAEtB,MAAMY,IAAU;AAAA,EACnB,MAAMvB;AAAA,EACN,SAASwB,EAAmDjB,CAAc;AAAA,EAC1E,SAASiB,EAAgDb,CAAc;AAC3E;"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const o = "_root_vsckf_2", c = "_accordionItem_vsckf_23", n = "_accordionTrigger_vsckf_29", r = "_accordionHeader_vsckf_34", t = "_accordionSlot_vsckf_42", e = "_accordionCaret_vsckf_70", a = "_accordionTriggerContent_vsckf_78", i = "_accordionContent_vsckf_83", d = "_accordionContentText_vsckf_112", _ = {
|
|
2
|
+
root: o,
|
|
3
|
+
accordionItem: c,
|
|
4
|
+
accordionTrigger: n,
|
|
5
|
+
accordionHeader: r,
|
|
6
|
+
accordionSlot: t,
|
|
7
|
+
accordionCaret: e,
|
|
8
|
+
accordionTriggerContent: a,
|
|
9
|
+
accordionContent: i,
|
|
10
|
+
accordionContentText: d
|
|
5
11
|
};
|
|
6
12
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
e as accordionCaret,
|
|
14
|
+
i as accordionContent,
|
|
15
|
+
d as accordionContentText,
|
|
16
|
+
r as accordionHeader,
|
|
17
|
+
c as accordionItem,
|
|
18
|
+
t as accordionSlot,
|
|
19
|
+
n as accordionTrigger,
|
|
20
|
+
a as accordionTriggerContent,
|
|
21
|
+
_ as default,
|
|
22
|
+
o as root
|
|
11
23
|
};
|
|
12
24
|
//# sourceMappingURL=fondue-components41.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components41.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components41.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,44 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
n.push([r, i]);
|
|
27
|
-
for (const e of d[r] ?? [])
|
|
28
|
-
n.push([e, i]);
|
|
29
|
-
return n;
|
|
30
|
-
}, []).reduce((n, [r, i]) => {
|
|
31
|
-
if (g(r))
|
|
32
|
-
return n;
|
|
33
|
-
const e = r in t ? t[r] : r in m ? m[r] : r, p = e == null ? void 0 : e.replaceAll(/([\da-z]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
34
|
-
if (typeof i == "object")
|
|
35
|
-
for (const [f, s] of Object.entries(i))
|
|
36
|
-
s !== void 0 && (n[`--${f}-${p}`] = a(r, s));
|
|
37
|
-
else
|
|
38
|
-
n[`--${p}`] = a(r, i);
|
|
39
|
-
return n;
|
|
40
|
-
}, {});
|
|
1
|
+
import { useContext as i, useCallback as l } from "react";
|
|
2
|
+
import { ThemeContext as u } from "./fondue-components39.js";
|
|
3
|
+
const d = () => {
|
|
4
|
+
const {
|
|
5
|
+
translations: { translationStrings: r }
|
|
6
|
+
} = i(u);
|
|
7
|
+
return {
|
|
8
|
+
/** Translation function */
|
|
9
|
+
t: l(
|
|
10
|
+
(n, e) => {
|
|
11
|
+
const t = r[n];
|
|
12
|
+
if (t === void 0)
|
|
13
|
+
return process.env.NODE_ENV !== "production" && console.warn(`[Fondue] Translation key "${n}" not found`), n;
|
|
14
|
+
if (typeof t != "string")
|
|
15
|
+
return process.env.NODE_ENV !== "production" && console.warn(`[Fondue] Translation value for key "${n}" is not a string`), n;
|
|
16
|
+
let o = t;
|
|
17
|
+
if (e)
|
|
18
|
+
for (const [s, a] of Object.entries(e))
|
|
19
|
+
o = o.replaceAll(`\${${s}}`, a);
|
|
20
|
+
return o;
|
|
21
|
+
},
|
|
22
|
+
[r]
|
|
23
|
+
)
|
|
24
|
+
};
|
|
25
|
+
};
|
|
41
26
|
export {
|
|
42
|
-
|
|
27
|
+
d as useTranslation
|
|
43
28
|
};
|
|
44
29
|
//# sourceMappingURL=fondue-components42.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components42.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components42.js","sources":["../src/hooks/useTranslation.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback, useContext } from 'react';\n\nimport { ThemeContext } from '../components/ThemeProvider/ThemeProvider';\n\n/**\n * Hook to access translation functionality.\n *\n * @returns Object containing translation function\n *\n * @example\n * ```tsx\n * const { t } = useTranslation();\n *\n * // Simple translation\n * const label = t('ColorPicker_selectColor');\n *\n * // Translation with variables\n * const sortLabel = t('Table_sortByAscending', { column: 'Name' });\n * ```\n */\nexport const useTranslation = () => {\n const {\n translations: { translationStrings: translations },\n } = useContext(ThemeContext);\n\n /**\n * Translates a key to its localized string value.\n * Keys follow the format ComponentName_localLabelName[_moreLocalLabelName]\n * and support variable interpolation using ${variable} syntax.\n *\n * @param key - The translation key (e.g., 'ColorPicker_selectColor')\n * @param variables - Optional variables to interpolate into the translation\n * @returns The translated string, or the key itself if translation is not found\n */\n const t = useCallback(\n (key: keyof typeof translations, variables?: Record<string, string>): string => {\n // Direct lookup for flat keys\n const value = translations[key];\n\n if (value === undefined) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Fondue] Translation key \"${key}\" not found`);\n }\n return key;\n }\n\n if (typeof value !== 'string') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Fondue] Translation value for key \"${key}\" is not a string`);\n }\n return key;\n }\n\n let text = value;\n\n // Variable interpolation: replace ${variable} with actual values\n if (variables) {\n for (const [varKey, varValue] of Object.entries(variables)) {\n text = text.replaceAll(`\\${${varKey}}`, varValue);\n }\n }\n\n return text;\n },\n [translations],\n );\n\n return {\n /** Translation function */\n t,\n };\n};\n"],"names":["useTranslation","translations","useContext","ThemeContext","useCallback","key","variables","value","text","varKey","varValue"],"mappings":";;AAsBO,MAAMA,IAAiB,MAAM;AAChC,QAAM;AAAA,IACF,cAAc,EAAE,oBAAoBC,EAAA;AAAA,EAAa,IACjDC,EAAWC,CAAY;AA4C3B,SAAO;AAAA;AAAA,IAEH,GAnCMC;AAAA,MACN,CAACC,GAAgCC,MAA+C;AAE5E,cAAMC,IAAQN,EAAaI,CAAG;AAE9B,YAAIE,MAAU;AACV,iBAAI,QAAQ,IAAI,aAAa,gBACzB,QAAQ,KAAK,6BAA6BF,CAAG,aAAa,GAEvDA;AAGX,YAAI,OAAOE,KAAU;AACjB,iBAAI,QAAQ,IAAI,aAAa,gBACzB,QAAQ,KAAK,uCAAuCF,CAAG,mBAAmB,GAEvEA;AAGX,YAAIG,IAAOD;AAGX,YAAID;AACA,qBAAW,CAACG,GAAQC,CAAQ,KAAK,OAAO,QAAQJ,CAAS;AACrD,YAAAE,IAAOA,EAAK,WAAW,MAAMC,CAAM,KAAKC,CAAQ;AAIxD,eAAOF;AAAA,MACX;AAAA,MACA,CAACP,CAAY;AAAA,IAAA;AAAA,EAKb;AAER;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import s from "./fondue-components111.js";
|
|
3
|
+
import { colorToCss as e } from "./fondue-components112.js";
|
|
4
|
+
const a = ["default", "positive", "highlight", "warning", "negative"], i = (t) => typeof t == "string" && a.includes(t), p = ({ status: t }) => {
|
|
5
|
+
const o = i(t) ? { "data-status": t } : { style: { backgroundColor: typeof t == "string" ? t : e(t) || "transparent" } };
|
|
6
|
+
return /* @__PURE__ */ r("div", { "data-test-id": "badge-status", className: s.root, ...o });
|
|
3
7
|
};
|
|
4
8
|
export {
|
|
5
|
-
|
|
6
|
-
o as root
|
|
9
|
+
p as BadgeStatus
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=fondue-components43.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components43.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
1
|
+
{"version":3,"file":"fondue-components43.js","sources":["../src/components/Badge/BadgeStatus.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport styles from './styles/badgestatus.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss } from './utils';\n\ntype BadgeStatusType = 'default' | 'positive' | 'highlight' | 'warning' | 'negative';\n\nconst badgeStatusMap = ['default', 'positive', 'highlight', 'warning', 'negative'];\n\nexport type BadgeStatusProps = { status: BadgeStatusType } | { status: RgbaColor | string };\n\nconst isBadgeStatusType = (value: RgbaColor | string): value is BadgeStatusType =>\n typeof value === 'string' && badgeStatusMap.includes(value);\n\nexport const BadgeStatus = ({ status }: BadgeStatusProps) => {\n const colorProps = isBadgeStatusType(status)\n ? { 'data-status': status }\n : { style: { backgroundColor: typeof status === 'string' ? status : colorToCss(status) || 'transparent' } };\n\n return <div data-test-id=\"badge-status\" className={styles.root} {...colorProps}></div>;\n};\n"],"names":["badgeStatusMap","isBadgeStatusType","value","BadgeStatus","status","colorProps","colorToCss","jsx","styles"],"mappings":";;;AAQA,MAAMA,IAAiB,CAAC,WAAW,YAAY,aAAa,WAAW,UAAU,GAI3EC,IAAoB,CAACC,MACvB,OAAOA,KAAU,YAAYF,EAAe,SAASE,CAAK,GAEjDC,IAAc,CAAC,EAAE,QAAAC,QAA+B;AACzD,QAAMC,IAAaJ,EAAkBG,CAAM,IACrC,EAAE,eAAeA,EAAA,IACjB,EAAE,OAAO,EAAE,iBAAiB,OAAOA,KAAW,WAAWA,IAASE,EAAWF,CAAM,KAAK,gBAAc;AAE5G,SAAO,gBAAAG,EAAC,SAAI,gBAAa,gBAAe,WAAWC,EAAO,MAAO,GAAGH,GAAY;AACpF;"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
1
|
+
const s = "_root_xdptq_3", t = "_inner_xdptq_30", o = "_dismiss_xdptq_175", n = {
|
|
2
|
+
root: s,
|
|
3
|
+
inner: t,
|
|
4
|
+
dismiss: o
|
|
3
5
|
};
|
|
4
6
|
export {
|
|
5
|
-
|
|
6
|
-
o as
|
|
7
|
+
n as default,
|
|
8
|
+
o as dismiss,
|
|
9
|
+
t as inner,
|
|
10
|
+
s as root
|
|
7
11
|
};
|
|
8
12
|
//# sourceMappingURL=fondue-components44.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components44.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components44.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|