@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,127 +1,136 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import { jsx as a, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as E, forwardRef as d, useContext as f, useRef as y, useEffect as F, useMemo as I, useCallback as H, createElement as z } from "react";
|
|
3
|
+
import { IconDotsHorizontal as M } from "@frontify/fondue-icons";
|
|
4
|
+
import * as m from "@radix-ui/react-tabs";
|
|
5
|
+
import { useControllableState as W } from "./fondue-components88.js";
|
|
6
|
+
import { Button as G } from "./fondue-components6.js";
|
|
7
|
+
import { Dropdown as c } from "./fondue-components11.js";
|
|
8
|
+
import { useFondueTheme as J } from "./fondue-components39.js";
|
|
9
|
+
import { useTabTriggers as K } from "./fondue-components103.js";
|
|
10
|
+
import n from "./fondue-components104.js";
|
|
11
|
+
const u = E({
|
|
12
|
+
value: "",
|
|
13
|
+
disabled: !1
|
|
14
|
+
});
|
|
15
|
+
u.displayName = "TabConfigContext";
|
|
16
|
+
const v = E({
|
|
17
|
+
addTrigger: () => {
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
v.displayName = "TabTriggerContext";
|
|
21
|
+
const L = ({
|
|
22
|
+
padding: t = "compact",
|
|
23
|
+
activeTab: o,
|
|
24
|
+
defaultActiveTab: s,
|
|
25
|
+
size: r = "medium",
|
|
26
|
+
onActiveTabChange: p,
|
|
27
|
+
children: T,
|
|
28
|
+
variant: i = "default",
|
|
29
|
+
withDivider: l = !1,
|
|
30
|
+
...D
|
|
31
|
+
}, P) => {
|
|
32
|
+
var w;
|
|
33
|
+
const { dir: j } = J(), [g, C] = W({
|
|
34
|
+
prop: o,
|
|
35
|
+
defaultProp: s,
|
|
36
|
+
onChange: p
|
|
37
|
+
}), h = H(
|
|
38
|
+
(e) => {
|
|
39
|
+
C(e);
|
|
40
|
+
},
|
|
41
|
+
[C]
|
|
42
|
+
), { triggerListRef: A, activeIndicatorRef: O, triggers: x, triggersOutOfView: N, addTrigger: R } = K({
|
|
43
|
+
activeTab: g
|
|
44
|
+
}), q = I(() => ({ addTrigger: R }), [R]), B = i === "pill" && l;
|
|
45
|
+
return /* @__PURE__ */ a(v.Provider, { value: q, children: /* @__PURE__ */ b(
|
|
46
|
+
m.Root,
|
|
42
47
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"data-
|
|
49
|
-
"data-
|
|
50
|
-
"data-
|
|
51
|
-
|
|
52
|
-
"data-test-id": c,
|
|
53
|
-
style: { "--max-rows": `${k}` },
|
|
48
|
+
ref: P,
|
|
49
|
+
dir: j,
|
|
50
|
+
className: n.root,
|
|
51
|
+
onValueChange: h,
|
|
52
|
+
value: g ?? ((w = x[0]) == null ? void 0 : w.value),
|
|
53
|
+
"data-tabs-content-padding": t,
|
|
54
|
+
"data-tabs-variant": i,
|
|
55
|
+
"data-tabs-with-divider": B,
|
|
56
|
+
...D,
|
|
54
57
|
children: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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",
|
|
58
|
+
/* @__PURE__ */ b("div", { className: n.triggerListWrapper, children: [
|
|
59
|
+
/* @__PURE__ */ a(m.List, { ref: A, "data-size": r, className: n.triggerList, children: x.map((e) => /* @__PURE__ */ z(
|
|
60
|
+
m.Trigger,
|
|
91
61
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
62
|
+
...e.props,
|
|
63
|
+
key: e.value,
|
|
64
|
+
value: e.value,
|
|
65
|
+
disabled: e.disabled,
|
|
66
|
+
className: n.trigger,
|
|
67
|
+
ref: e.ref
|
|
97
68
|
},
|
|
98
|
-
|
|
99
|
-
)),
|
|
100
|
-
|
|
69
|
+
e.element
|
|
70
|
+
)) }),
|
|
71
|
+
/* @__PURE__ */ b(c.Root, { children: [
|
|
72
|
+
N.length > 0 && /* @__PURE__ */ a(c.Trigger, { "data-test-id": "overflow-items-dropdown-trigger", children: /* @__PURE__ */ a(G, { emphasis: "default", aspect: "square", size: "small", children: /* @__PURE__ */ a(M, { size: 16 }) }) }),
|
|
73
|
+
/* @__PURE__ */ a(c.Content, { align: "end", "data-test-id": "overflow-items-dropdown-content", children: N.map((e) => /* @__PURE__ */ z(
|
|
74
|
+
c.Item,
|
|
75
|
+
{
|
|
76
|
+
...e.props,
|
|
77
|
+
disabled: e.disabled,
|
|
78
|
+
onSelect: () => h(e.value),
|
|
79
|
+
key: e.value
|
|
80
|
+
},
|
|
81
|
+
e.element
|
|
82
|
+
)) })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ a(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
"data-test-id": "active-tab-indicator",
|
|
88
|
+
ref: O,
|
|
89
|
+
className: n.activeIndicator
|
|
90
|
+
}
|
|
91
|
+
)
|
|
101
92
|
] }),
|
|
102
|
-
|
|
93
|
+
T
|
|
103
94
|
]
|
|
104
95
|
}
|
|
105
|
-
);
|
|
96
|
+
) });
|
|
97
|
+
};
|
|
98
|
+
L.displayName = "Tabs.Root";
|
|
99
|
+
const S = ({ children: t, value: o, disabled: s }) => {
|
|
100
|
+
const r = I(() => ({ value: o, disabled: s }), [o, s]);
|
|
101
|
+
return /* @__PURE__ */ a(u.Provider, { value: r, children: t });
|
|
102
|
+
};
|
|
103
|
+
S.displayName = "Tabs.Tab";
|
|
104
|
+
const V = ({ children: t, ...o }, s) => {
|
|
105
|
+
const { value: r, disabled: p } = f(u), { addTrigger: T } = f(v), i = y(null), l = y();
|
|
106
|
+
return F(() => {
|
|
107
|
+
T({
|
|
108
|
+
ref: i || s,
|
|
109
|
+
value: r ?? "",
|
|
110
|
+
disabled: p,
|
|
111
|
+
props: o,
|
|
112
|
+
element: t,
|
|
113
|
+
previousElement: l.current
|
|
114
|
+
}), l.current = t;
|
|
115
|
+
}, [t]), null;
|
|
116
|
+
};
|
|
117
|
+
V.displayName = "Tabs.Trigger";
|
|
118
|
+
const k = ({ children: t, ...o }, s) => {
|
|
119
|
+
const { value: r } = f(u);
|
|
120
|
+
return /* @__PURE__ */ a(m.Content, { ref: s, ...o, className: n.content, value: r ?? "", children: t });
|
|
121
|
+
};
|
|
122
|
+
k.displayName = "Tabs.Content";
|
|
123
|
+
const ae = {
|
|
124
|
+
Root: d(L),
|
|
125
|
+
Tab: d(S),
|
|
126
|
+
Trigger: d(V),
|
|
127
|
+
Content: d(k)
|
|
106
128
|
};
|
|
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;
|
|
122
129
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
ae as Tabs,
|
|
131
|
+
k as TabsContent,
|
|
132
|
+
L as TabsRoot,
|
|
133
|
+
S as TabsTab,
|
|
134
|
+
V as TabsTrigger
|
|
126
135
|
};
|
|
127
136
|
//# sourceMappingURL=fondue-components35.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components35.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":";;;;;AAiIO,MAAMA,IAAe,CACxB;AAAA,EACI,gBAAgBC,IAAa;AAAA,EAC7B,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAASC,IAAO;AAAA,EAChB,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,OAAOC;AAAA,EACP,GAAGC;AACP,GACAC,MACC;AACD,QAAMC,IAAMC,EAA4B,IAAI,GACtCC,IAAaD,EAAO,EAAK;AAE/B,EAAAE,EAAiCH,GAAKD,CAAY;AAElD,QAAM,CAACK,GAAOC,CAAQ,IAAIC,EAAST,KAAcX,KAAgB,EAAE,GAE7DqB,KAAWnB,KAAA,gBAAAA,EAAc,YAAW,UAAaJ,KAAa,CAAC,WAAW,OAAO,EAAE,SAASY,CAAM,GAElGY,IAAQ,MAAM;AAChB,IAAAH,EAAS,EAAE;AAAA,EACf,GAEMI,IAA2D,CAACC,MAAU;;AACxE,IAAIA,EAAM,QAAQ,YACdlB,KAAA,QAAAA,EAAiBkB,MAErBC,IAAAb,EAAM,cAAN,QAAAa,EAAA,KAAAb,GAAkBY;AAAA,EACtB;AAEA,SAAAE,EAAU,MAAM;AAEZ,IAAAP,EAASR,KAAcX,KAAgB,EAAE;AAAA,EAC7C,GAAG,CAACA,GAAcW,CAAU,CAAC,GAE7Be,EAAU,MAAM;;AACZ,IAAIvB,OACAsB,IAAAX,EAAI,YAAJ,QAAAW,EAAa;AAAA,EAErB,GAAG,CAACtB,CAAY,CAAC,GAGb,g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,KAAK7B;AAAA,IACL,WAAW,CAACe,EAAO,MAAMa,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,EAAA;AAAA;AAKxEF,EAAa,cAAc;AAE3B,MAAMI,IAA2BC,EAA+CnD,CAAY,GACtFoD,IAA2BD,EAA8CL,CAAY,GAG9EO,IAGTH;AACJG,EAAS,OAAOH;AAChBG,EAAS,OAAOD;"}
|
|
1
|
+
{"version":3,"file":"fondue-components35.js","sources":["../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDotsHorizontal } from '@frontify/fondue-icons';\nimport * as RadixTabs from '@radix-ui/react-tabs';\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { useControllableState } from '#/hooks/useControllableState';\n\nimport { Button } from '../Button/Button';\nimport { Dropdown } from '../Dropdown/Dropdown';\nimport { useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { useTabTriggers } from './hooks/useTabTriggers';\nimport styles from './styles/tabs.module.scss';\nimport { type TabTrigger } from './types';\n\nexport type TabsRootProps = {\n id?: string;\n children: ReactNode;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The default active tab\n * Used for uncontrolled components\n */\n defaultActiveTab?: string;\n /**\n * The controlled value of the active tab\n */\n activeTab?: string;\n /**\n * The height of the tabs\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /**\n * Event handler called when the active tab changes\n */\n onActiveTabChange?: (value: string) => void;\n /**\n * Select the used variant\n * @default 'default'\n */\n variant?: 'default' | 'pill';\n /**\n * Add a divider line below the tabs\n * Only available when variant is 'pill'\n * Useful for tabs placed inside Dialog content\n * @default false\n */\n withDivider?: boolean;\n};\n\nconst TabConfigContext = createContext<{\n value: string;\n disabled?: boolean;\n}>({\n value: '',\n disabled: false,\n});\nTabConfigContext.displayName = 'TabConfigContext';\n\nconst TabTriggerContext = createContext<{\n addTrigger: (trigger: TabTrigger) => void;\n}>({\n addTrigger: () => {},\n});\nTabTriggerContext.displayName = 'TabTriggerContext';\n\nexport const TabsRoot = (\n {\n padding = 'compact',\n activeTab: propsActiveTab,\n defaultActiveTab,\n size = 'medium',\n onActiveTabChange,\n children,\n variant = 'default',\n withDivider = false,\n ...props\n }: TabsRootProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { dir } = useFondueTheme();\n\n const [activeTab, setActiveTab] = useControllableState({\n prop: propsActiveTab,\n defaultProp: defaultActiveTab,\n onChange: onActiveTabChange,\n });\n\n const handleSetActiveTab = useCallback(\n (value: string) => {\n setActiveTab(value);\n },\n [setActiveTab],\n );\n\n const { triggerListRef, activeIndicatorRef, triggers, triggersOutOfView, addTrigger } = useTabTriggers({\n activeTab,\n });\n\n const contextValue = useMemo(() => ({ addTrigger }), [addTrigger]);\n\n // Only apply withDivider when variant is 'pill'\n const shouldShowDivider = variant === 'pill' && withDivider;\n\n return (\n <TabTriggerContext.Provider value={contextValue}>\n <RadixTabs.Root\n ref={ref}\n dir={dir}\n className={styles.root}\n onValueChange={handleSetActiveTab}\n value={activeTab ?? triggers[0]?.value}\n data-tabs-content-padding={padding}\n data-tabs-variant={variant}\n data-tabs-with-divider={shouldShowDivider}\n {...props}\n >\n <div className={styles.triggerListWrapper}>\n <RadixTabs.List ref={triggerListRef} data-size={size} className={styles.triggerList}>\n {triggers.map((trigger) => (\n <RadixTabs.Trigger\n {...trigger.props}\n key={trigger.value}\n value={trigger.value}\n disabled={trigger.disabled}\n className={styles.trigger}\n ref={trigger.ref}\n >\n {trigger.element}\n </RadixTabs.Trigger>\n ))}\n </RadixTabs.List>\n <Dropdown.Root>\n {triggersOutOfView.length > 0 && (\n <Dropdown.Trigger data-test-id=\"overflow-items-dropdown-trigger\">\n <Button emphasis=\"default\" aspect=\"square\" size=\"small\">\n <IconDotsHorizontal size={16} />\n </Button>\n </Dropdown.Trigger>\n )}\n <Dropdown.Content align=\"end\" data-test-id=\"overflow-items-dropdown-content\">\n {triggersOutOfView.map((trigger) => (\n <Dropdown.Item\n {...trigger.props}\n disabled={trigger.disabled}\n onSelect={() => handleSetActiveTab(trigger.value)}\n key={trigger.value}\n >\n {trigger.element}\n </Dropdown.Item>\n ))}\n </Dropdown.Content>\n </Dropdown.Root>\n <span\n data-test-id=\"active-tab-indicator\"\n ref={activeIndicatorRef}\n className={styles.activeIndicator}\n />\n </div>\n {children}\n </RadixTabs.Root>\n </TabTriggerContext.Provider>\n );\n};\nTabsRoot.displayName = 'Tabs.Root';\n\ntype TabsTabProps = {\n children: ReactNode;\n value: string;\n disabled?: boolean;\n};\n\nexport const TabsTab = ({ children, value, disabled }: TabsTabProps) => {\n const contextValue = useMemo(() => ({ value, disabled }), [value, disabled]);\n\n return <TabConfigContext.Provider value={contextValue}>{children}</TabConfigContext.Provider>;\n};\nTabsTab.displayName = 'Tabs.Tab';\n\ntype TabsTriggerProps = {\n children: ReactNode;\n};\n\nexport const TabsTrigger = ({ children, ...props }: TabsTriggerProps, ref: ForwardedRef<HTMLButtonElement>) => {\n const { value, disabled } = useContext(TabConfigContext);\n\n const { addTrigger } = useContext(TabTriggerContext);\n\n const localRef = useRef<HTMLButtonElement>(null);\n const previousElement = useRef<ReactNode>();\n\n useEffect(() => {\n addTrigger({\n ref: localRef || ref,\n value: value ?? '',\n disabled,\n props,\n element: children,\n previousElement: previousElement.current,\n });\n previousElement.current = children;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [children]);\n\n return null;\n};\nTabsTrigger.displayName = 'Tabs.Trigger';\n\ntype TabsContentProps = {\n children: ReactNode;\n asChild?: boolean;\n};\n\nexport const TabsContent = ({ children, ...itemProps }: TabsContentProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { value } = useContext(TabConfigContext);\n\n return (\n <RadixTabs.Content ref={ref} {...itemProps} className={styles.content} value={value ?? ''}>\n {children}\n </RadixTabs.Content>\n );\n};\nTabsContent.displayName = 'Tabs.Content';\n\nexport const Tabs = {\n Root: forwardRef<HTMLDivElement, TabsRootProps>(TabsRoot),\n Tab: forwardRef<HTMLDivElement, TabsTabProps>(TabsTab),\n Trigger: forwardRef<HTMLButtonElement, TabsTriggerProps>(TabsTrigger),\n Content: forwardRef<HTMLDivElement, TabsContentProps>(TabsContent),\n};\n"],"names":["TabConfigContext","createContext","TabTriggerContext","TabsRoot","padding","propsActiveTab","defaultActiveTab","size","onActiveTabChange","children","variant","withDivider","props","ref","dir","useFondueTheme","activeTab","setActiveTab","useControllableState","handleSetActiveTab","useCallback","value","triggerListRef","activeIndicatorRef","triggers","triggersOutOfView","addTrigger","useTabTriggers","contextValue","useMemo","shouldShowDivider","jsx","jsxs","RadixTabs","styles","_a","trigger","createElement","Dropdown","Button","IconDotsHorizontal","TabsTab","disabled","TabsTrigger","useContext","localRef","useRef","previousElement","useEffect","TabsContent","itemProps","Tabs","forwardRef"],"mappings":";;;;;;;;;;AAkEA,MAAMA,IAAmBC,EAGtB;AAAA,EACC,OAAO;AAAA,EACP,UAAU;AACd,CAAC;AACDD,EAAiB,cAAc;AAE/B,MAAME,IAAoBD,EAEvB;AAAA,EACC,YAAY,MAAM;AAAA,EAAC;AACvB,CAAC;AACDC,EAAkB,cAAc;AAEzB,MAAMC,IAAW,CACpB;AAAA,EACI,SAAAC,IAAU;AAAA,EACV,WAAWC;AAAA,EACX,kBAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,mBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,aAAAC,IAAc;AAAA,EACd,GAAGC;AACP,GACAC,MACC;;AACD,QAAM,EAAE,KAAAC,EAAA,IAAQC,EAAA,GAEV,CAACC,GAAWC,CAAY,IAAIC,EAAqB;AAAA,IACnD,MAAMb;AAAA,IACN,aAAaC;AAAA,IACb,UAAUE;AAAA,EAAA,CACb,GAEKW,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n(r.Provider, { value: c, children: /* @__PURE__ */ n(l, { dir: o, className: `${d[t]} fondue-theme-provider`, children: e }) });
|
|
34
|
-
};
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
|
+
import t from "./fondue-components105.js";
|
|
4
|
+
const n = p(
|
|
5
|
+
({
|
|
6
|
+
children: o,
|
|
7
|
+
as: a = "span",
|
|
8
|
+
size: r = "medium",
|
|
9
|
+
weight: s = "default",
|
|
10
|
+
color: i = "default",
|
|
11
|
+
boxColor: e,
|
|
12
|
+
className: m,
|
|
13
|
+
...d
|
|
14
|
+
}, f) => /* @__PURE__ */ l(
|
|
15
|
+
a,
|
|
16
|
+
{
|
|
17
|
+
"data-test-id": "text",
|
|
18
|
+
className: [
|
|
19
|
+
t.root,
|
|
20
|
+
t[`size-${r}`],
|
|
21
|
+
t[`weight-${s}`],
|
|
22
|
+
t[e ? `color-box-${e}` : `color-${i}`],
|
|
23
|
+
m
|
|
24
|
+
].filter(Boolean).join(" "),
|
|
25
|
+
ref: f,
|
|
26
|
+
...d,
|
|
27
|
+
children: o
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
n.displayName = "FondueText";
|
|
35
32
|
export {
|
|
36
|
-
|
|
37
|
-
y as ThemeProvider,
|
|
38
|
-
g as useFondueTheme
|
|
33
|
+
n as Text
|
|
39
34
|
};
|
|
40
35
|
//# sourceMappingURL=fondue-components36.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components36.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components36.js","sources":["../src/components/Text/Text.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode, forwardRef, type ForwardedRef, type HTMLAttributeAnchorTarget } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\n\nimport styles from './styles/text.module.scss';\n\ntype TextWeight = 'default' | 'strong' | 'x-strong';\ntype TextSize = 'x-small' | 'small' | 'medium' | 'large';\ntype TextColor = 'default' | 'weak' | 'disabled' | 'negative' | 'positive' | 'warning' | 'interactive';\ntype BoxColor = 'neutral' | 'selected' | 'disabled' | 'positive' | 'negative' | 'warning';\n\ntype TagType = 'a' | 'abbr' | 'address' | 'em' | 'label' | 'li' | 'span' | 'strong' | 'time' | 'p';\n\nexport type TextProps<TTag extends TagType = 'span'> = CommonAriaProps &\n TagProps<TTag> & {\n /**\n * Id of the element\n */\n id?: string;\n /**\n * Size of the text\n *\n * @default 'medium'\n */\n size?: TextSize;\n /**\n * Weight of the font\n *\n * @default 'default'\n */\n weight?: TextWeight;\n /**\n * The html element used to render\n *\n * @default 'span'\n */\n as?: TTag;\n /**\n * Color of the text\n *\n * @default 'default'\n */\n color?: TextColor;\n /**\n * The texts color when used within a box\n *\n * @description optional color prop that uses the inverse box color when accessibility contrast is needed\n **/\n boxColor?: BoxColor;\n className?: string;\n children?: ReactNode;\n };\n\ntype TagPropMap = {\n a: { href?: string; target: HTMLAttributeAnchorTarget; rel?: string; title?: string };\n abbr: { title?: string };\n address: object;\n em: object;\n label: { for?: string };\n li: { value?: string };\n p: object;\n span: object;\n strong: object;\n time: { dateTime?: string };\n};\ntype TagProps<TTag extends TagType> = TagPropMap[TTag];\n\ntype TextElementMap = {\n a: HTMLAnchorElement;\n abbr: HTMLElement;\n address: HTMLElement;\n em: HTMLElement;\n label: HTMLLabelElement;\n li: HTMLLIElement;\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n strong: HTMLElement;\n time: HTMLTimeElement;\n};\ntype TextElementType<TTag extends TagType> = TextElementMap[TTag];\n\nexport const Text = forwardRef(\n (\n {\n children,\n as: Tag = 'span',\n size = 'medium',\n weight = 'default',\n color = 'default',\n boxColor,\n className,\n ...props\n },\n ref,\n ) => (\n <Tag\n data-test-id=\"text\"\n className={[\n styles.root,\n styles[`size-${size}`],\n styles[`weight-${weight}`],\n styles[boxColor ? `color-box-${boxColor}` : `color-${color}`],\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n // @ts-expect-error ref can not be inferred properly by TS\n ref={ref}\n {...props}\n >\n {children}\n </Tag>\n ),\n) as (<TTag extends TagType = 'span'>(\n props: TextProps<TTag> & { ref?: ForwardedRef<TextElementType<TTag>> },\n) => JSX.Element) & { displayName: string };\n\nText.displayName = 'FondueText';\n"],"names":["Text","forwardRef","children","Tag","size","weight","color","boxColor","className","props","ref","jsx","styles"],"mappings":";;;AAmFO,MAAMA,IAAOC;AAAA,EAChB,CACI;AAAA,IACI,UAAAC;AAAA,IACA,IAAIC,IAAM;AAAA,IACV,MAAAC,IAAO;AAAA,IACP,QAAAC,IAAS;AAAA,IACT,OAAAC,IAAQ;AAAA,IACR,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEPC,MAEA,gBAAAC;AAAA,IAACR;AAAA,IAAA;AAAA,MACG,gBAAa;AAAA,MACb,WAAW;AAAA,QACPS,EAAO;AAAA,QACPA,EAAO,QAAQR,CAAI,EAAE;AAAA,QACrBQ,EAAO,UAAUP,CAAM,EAAE;AAAA,QACzBO,EAAOL,IAAW,aAAaA,CAAQ,KAAK,SAASD,CAAK,EAAE;AAAA,QAC5DE;AAAA,MAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,MAEb,KAAAE;AAAA,MACC,GAAGD;AAAA,MAEH,UAAAP;AAAA,IAAA;AAAA,EAAA;AAGb;AAIAF,EAAK,cAAc;"}
|
|
@@ -1,60 +1,85 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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,
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { IconCheckMark as w, IconExclamationMarkTriangle as h } from "@frontify/fondue-icons";
|
|
3
|
+
import { forwardRef as f, useRef as S } from "react";
|
|
4
|
+
import { LoadingCircle as T } from "./fondue-components21.js";
|
|
5
|
+
import a from "./fondue-components106.js";
|
|
6
|
+
const u = ({
|
|
7
|
+
children: s,
|
|
8
|
+
className: d,
|
|
9
|
+
status: e = "neutral",
|
|
10
|
+
"data-test-id": l = "fondue-text-input",
|
|
11
|
+
"aria-errormessage": R,
|
|
12
|
+
placeholder: c,
|
|
13
|
+
...r
|
|
14
|
+
}, N) => {
|
|
15
|
+
const n = S(!1);
|
|
16
|
+
return /* @__PURE__ */ m(
|
|
17
|
+
"div",
|
|
31
18
|
{
|
|
32
|
-
|
|
33
|
-
"data-
|
|
34
|
-
"data-
|
|
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),
|
|
19
|
+
className: [a.root, d].filter(Boolean).join(" "),
|
|
20
|
+
"data-status": e,
|
|
21
|
+
"data-test-id": l,
|
|
41
22
|
children: [
|
|
42
|
-
t,
|
|
43
|
-
/* @__PURE__ */
|
|
23
|
+
e === "loading" ? /* @__PURE__ */ t("div", { className: a.loadingStatus, "data-test-id": `${l}-loader`, children: /* @__PURE__ */ t(T, { size: "xx-small" }) }) : null,
|
|
24
|
+
/* @__PURE__ */ m("div", { className: a.inputWrapper, children: [
|
|
25
|
+
c && /* @__PURE__ */ t("div", { className: a.placeholder, children: c }),
|
|
26
|
+
/* @__PURE__ */ t(
|
|
27
|
+
"input",
|
|
28
|
+
{
|
|
29
|
+
onMouseDown: (o) => {
|
|
30
|
+
n.current = !0, o.currentTarget.dataset.showFocusRing = "false";
|
|
31
|
+
},
|
|
32
|
+
type: "text",
|
|
33
|
+
placeholder: c,
|
|
34
|
+
...r,
|
|
35
|
+
onFocus: (o) => {
|
|
36
|
+
var i;
|
|
37
|
+
n.current || (o.target.dataset.showFocusRing = "true"), (i = r.onFocus) == null || i.call(r, o);
|
|
38
|
+
},
|
|
39
|
+
onBlur: (o) => {
|
|
40
|
+
var i;
|
|
41
|
+
o.target.dataset.showFocusRing = "false", n.current = !1, (i = r.onBlur) == null || i.call(r, o);
|
|
42
|
+
},
|
|
43
|
+
ref: N,
|
|
44
|
+
className: a.input,
|
|
45
|
+
"aria-invalid": e === "error",
|
|
46
|
+
"aria-errormessage": e === "error" ? R : void 0
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] }),
|
|
50
|
+
e === "success" ? /* @__PURE__ */ t(w, { size: 16, className: a.iconSuccess, "data-test-id": `${l}-success-icon` }) : null,
|
|
51
|
+
e === "error" ? /* @__PURE__ */ t(
|
|
52
|
+
h,
|
|
53
|
+
{
|
|
54
|
+
size: 16,
|
|
55
|
+
className: a.iconError,
|
|
56
|
+
"data-test-id": `${l}-error-icon`
|
|
57
|
+
}
|
|
58
|
+
) : null,
|
|
59
|
+
s
|
|
44
60
|
]
|
|
45
61
|
}
|
|
46
|
-
)
|
|
47
|
-
};
|
|
48
|
-
m.displayName = "Tooltip.Content";
|
|
49
|
-
const w = {
|
|
50
|
-
Root: p,
|
|
51
|
-
Trigger: d(f),
|
|
52
|
-
Content: d(m)
|
|
62
|
+
);
|
|
53
63
|
};
|
|
64
|
+
u.displayName = "TextField.Root";
|
|
65
|
+
const x = ({ name: s, className: d, ...e }, l) => /* @__PURE__ */ t(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
"data-slot": !0,
|
|
69
|
+
"data-name": s,
|
|
70
|
+
"data-label-ignore-disabled": "true",
|
|
71
|
+
...e,
|
|
72
|
+
ref: l,
|
|
73
|
+
className: [a.slot, d].filter(Boolean).join(" ")
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
x.displayName = "TextField.Slot";
|
|
77
|
+
const g = f(u), v = f(x), F = g;
|
|
78
|
+
F.Root = g;
|
|
79
|
+
F.Slot = v;
|
|
54
80
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
f as TooltipTrigger
|
|
81
|
+
u as TextFieldRoot,
|
|
82
|
+
x as TextFieldSlot,
|
|
83
|
+
F as TextInput
|
|
59
84
|
};
|
|
60
85
|
//# sourceMappingURL=fondue-components37.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components37.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components37.js","sources":["../src/components/TextInput/TextInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useRef,\n type ChangeEvent,\n type FocusEvent,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\n\nimport { LoadingCircle } from '../LoadingCircle/LoadingCircle';\n\nimport styles from './styles/text.module.scss';\n\nexport type TextInputProps = {\n id?: string;\n name?: string;\n /**\n * The place where the input slots are placed\n */\n children?: ReactNode;\n /**\n * The default value of the text input\n * Used for uncontrolled components\n */\n defaultValue?: string | number;\n /**\n * The controlled value of the text input\n */\n value?: string | number;\n /**\n * Type of the text input\n * @default \"text\"\n */\n type?: 'email' | 'hidden' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url';\n /**\n * The placeholder in the text input\n */\n placeholder?: string;\n /**\n * Disable the text input\n * @default false\n */\n disabled?: boolean;\n /**\n * Make the text input required in form\n * @default false\n */\n required?: boolean;\n /**\n * Make the text input spell-checkable\n * @default true\n */\n spellCheck?: boolean;\n /**\n * Make the text input read-only\n * @default false\n */\n readOnly?: boolean;\n /**\n * Set the type of input so autocomplete can help the user\n * @default \"on\"\n */\n autoComplete?: string;\n /**\n * The maximum length of the text input\n */\n maxLength?: number;\n /**\n * Status of the text input\n * @default \"neutral\"\n */\n status?: 'neutral' | 'success' | 'error' | 'loading';\n className?: string;\n /**\n * Event handler called when the text input value changes\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text input is blurred\n */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLInputElement>) => void;\n 'data-test-id'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-errormessage'?: string;\n};\n\nexport const TextFieldRoot = (\n {\n children,\n className,\n status = 'neutral',\n 'data-test-id': dataTestId = 'fondue-text-input',\n 'aria-errormessage': ariaErrormessage,\n placeholder,\n ...inputProps\n }: TextInputProps,\n ref: ForwardedRef<HTMLInputElement>,\n) => {\n const wasClicked = useRef(false);\n\n return (\n <div\n className={[styles.root, className].filter(Boolean).join(' ')}\n data-status={status}\n data-test-id={dataTestId}\n >\n {status === 'loading' ? (\n <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`}>\n <LoadingCircle size=\"xx-small\" />\n </div>\n ) : null}\n <div className={styles.inputWrapper}>\n {placeholder && <div className={styles.placeholder}>{placeholder}</div>}\n <input\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n type=\"text\"\n placeholder={placeholder}\n {...inputProps}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n inputProps.onFocus?.(focusEvent);\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n inputProps.onBlur?.(blurEvent);\n }}\n ref={ref}\n className={styles.input}\n aria-invalid={status === 'error'}\n aria-errormessage={status === 'error' ? ariaErrormessage : undefined}\n />\n </div>\n\n {status === 'success' ? (\n <IconCheckMark size={16} className={styles.iconSuccess} data-test-id={`${dataTestId}-success-icon`} />\n ) : null}\n\n {status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n\n {children}\n </div>\n );\n};\nTextFieldRoot.displayName = 'TextField.Root';\n\nexport type TextFieldSlotProps = {\n children: ReactNode;\n name?: 'left' | 'right';\n className?: string;\n};\n\nexport const TextFieldSlot = (\n { name, className, ...slotProps }: TextFieldSlotProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-slot\n data-name={name}\n data-label-ignore-disabled=\"true\"\n {...slotProps}\n ref={forwardedRef}\n className={[styles.slot, className].filter(Boolean).join(' ')}\n />\n );\n};\n\nTextFieldSlot.displayName = 'TextField.Slot';\n\nconst ForwardedRefTextFieldRoot = forwardRef<HTMLInputElement, TextInputProps>(TextFieldRoot);\nconst ForwardedRefTextFieldSlot = forwardRef<HTMLDivElement, TextFieldSlotProps>(TextFieldSlot);\n// @ts-expect-error We support both single component (without slots) and compound components (with slots)\nexport const TextInput: typeof TextFieldRoot & {\n Root: typeof ForwardedRefTextFieldRoot;\n Slot: typeof ForwardedRefTextFieldSlot;\n} = ForwardedRefTextFieldRoot;\nTextInput.Root = ForwardedRefTextFieldRoot;\nTextInput.Slot = ForwardedRefTextFieldSlot;\n"],"names":["TextFieldRoot","children","className","status","dataTestId","ariaErrormessage","placeholder","inputProps","ref","wasClicked","useRef","jsxs","styles","jsx","LoadingCircle","mouseEvent","focusEvent","_a","blurEvent","IconCheckMark","IconExclamationMarkTriangle","TextFieldSlot","name","slotProps","forwardedRef","ForwardedRefTextFieldRoot","forwardRef","ForwardedRefTextFieldSlot","TextInput"],"mappings":";;;;;AA6GO,MAAMA,IAAgB,CACzB;AAAA,EACI,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,gBAAgBC,IAAa;AAAA,EAC7B,qBAAqBC;AAAA,EACrB,aAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACC;AACD,QAAMC,IAAaC,EAAO,EAAK;AAE/B,SACI,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,CAACC,EAAO,MAAMV,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,MAC5D,eAAaC;AAAA,MACb,gBAAcC;AAAA,MAEb,UAAA;AAAA,QAAAD,MAAW,YACR,gBAAAU,EAAC,OAAA,EAAI,WAAWD,EAAO,eAAe,gBAAc,GAAGR,CAAU,WAC7D,UAAA,gBAAAS,EAACC,GAAA,EAAc,MAAK,WAAA,CAAW,GACnC,IACA;AAAA,QACJ,gBAAAH,EAAC,OAAA,EAAI,WAAWC,EAAO,cAClB,UAAA;AAAA,UAAAN,KAAe,gBAAAO,EAAC,OAAA,EAAI,WAAWD,EAAO,aAAc,UAAAN,GAAY;AAAA,UACjE,gBAAAO;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,aAAa,CAACE,MAAe;AACzB,gBAAAN,EAAW,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