@frontify/fondue-components 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/fondue-components.js +32 -30
  2. package/dist/fondue-components.js.map +1 -1
  3. package/dist/fondue-components10.js +2 -2
  4. package/dist/fondue-components11.js +3 -3
  5. package/dist/fondue-components12.js +2 -2
  6. package/dist/fondue-components13.js +1 -1
  7. package/dist/fondue-components14.js +1 -1
  8. package/dist/fondue-components15.js +1 -1
  9. package/dist/fondue-components16.js +2 -2
  10. package/dist/fondue-components17.js +2 -2
  11. package/dist/fondue-components18.js +6 -6
  12. package/dist/fondue-components19.js +1 -1
  13. package/dist/fondue-components20.js +2 -2
  14. package/dist/fondue-components21.js +116 -65
  15. package/dist/fondue-components21.js.map +1 -1
  16. package/dist/fondue-components22.js +64 -41
  17. package/dist/fondue-components22.js.map +1 -1
  18. package/dist/fondue-components23.js +43 -32
  19. package/dist/fondue-components23.js.map +1 -1
  20. package/dist/fondue-components24.js +32 -5
  21. package/dist/fondue-components24.js.map +1 -1
  22. package/dist/fondue-components25.js +5 -12
  23. package/dist/fondue-components25.js.map +1 -1
  24. package/dist/fondue-components26.js +10 -153
  25. package/dist/fondue-components26.js.map +1 -1
  26. package/dist/fondue-components27.js +59 -22
  27. package/dist/fondue-components27.js.map +1 -1
  28. package/dist/fondue-components28.js +17 -17
  29. package/dist/fondue-components28.js.map +1 -1
  30. package/dist/fondue-components29.js +112 -15
  31. package/dist/fondue-components29.js.map +1 -1
  32. package/dist/fondue-components3.js +2 -2
  33. package/dist/fondue-components30.js +19 -30
  34. package/dist/fondue-components30.js.map +1 -1
  35. package/dist/fondue-components31.js +32 -28
  36. package/dist/fondue-components31.js.map +1 -1
  37. package/dist/fondue-components32.js +23 -125
  38. package/dist/fondue-components32.js.map +1 -1
  39. package/dist/fondue-components33.js +129 -20
  40. package/dist/fondue-components33.js.map +1 -1
  41. package/dist/fondue-components34.js +21 -45
  42. package/dist/fondue-components34.js.map +1 -1
  43. package/dist/fondue-components35.js +45 -28
  44. package/dist/fondue-components35.js.map +1 -1
  45. package/dist/fondue-components36.js +28 -15
  46. package/dist/fondue-components36.js.map +1 -1
  47. package/dist/fondue-components37.js +15 -60
  48. package/dist/fondue-components37.js.map +1 -1
  49. package/dist/fondue-components38.js +60 -15
  50. package/dist/fondue-components38.js.map +1 -1
  51. package/dist/fondue-components39.js +15 -19
  52. package/dist/fondue-components39.js.map +1 -1
  53. package/dist/fondue-components4.js +4 -4
  54. package/dist/fondue-components40.js +18 -4
  55. package/dist/fondue-components40.js.map +1 -1
  56. package/dist/fondue-components41.js +3 -11
  57. package/dist/fondue-components41.js.map +1 -1
  58. package/dist/fondue-components42.js +11 -3
  59. package/dist/fondue-components42.js.map +1 -1
  60. package/dist/fondue-components43.js +5 -35
  61. package/dist/fondue-components43.js.map +1 -1
  62. package/dist/fondue-components44.js +35 -13
  63. package/dist/fondue-components44.js.map +1 -1
  64. package/dist/fondue-components45.js +12 -4
  65. package/dist/fondue-components45.js.map +1 -1
  66. package/dist/fondue-components46.js +4 -24
  67. package/dist/fondue-components46.js.map +1 -1
  68. package/dist/fondue-components47.js +24 -16
  69. package/dist/fondue-components47.js.map +1 -1
  70. package/dist/fondue-components48.js +16 -139
  71. package/dist/fondue-components48.js.map +1 -1
  72. package/dist/fondue-components49.js +140 -16
  73. package/dist/fondue-components49.js.map +1 -1
  74. package/dist/fondue-components5.js +2 -2
  75. package/dist/fondue-components50.js +16 -72
  76. package/dist/fondue-components50.js.map +1 -1
  77. package/dist/fondue-components51.js +72 -8
  78. package/dist/fondue-components51.js.map +1 -1
  79. package/dist/fondue-components52.js +8 -33
  80. package/dist/fondue-components52.js.map +1 -1
  81. package/dist/fondue-components53.js +32 -48
  82. package/dist/fondue-components53.js.map +1 -1
  83. package/dist/fondue-components54.js +48 -10
  84. package/dist/fondue-components54.js.map +1 -1
  85. package/dist/fondue-components55.js +8 -10
  86. package/dist/fondue-components55.js.map +1 -1
  87. package/dist/fondue-components56.js +12 -17
  88. package/dist/fondue-components56.js.map +1 -1
  89. package/dist/fondue-components57.js +52 -6
  90. package/dist/fondue-components57.js.map +1 -1
  91. package/dist/fondue-components58.js +15 -2
  92. package/dist/fondue-components58.js.map +1 -1
  93. package/dist/fondue-components59.js +17 -10
  94. package/dist/fondue-components59.js.map +1 -1
  95. package/dist/fondue-components6.js +5 -5
  96. package/dist/fondue-components60.js +6 -38
  97. package/dist/fondue-components60.js.map +1 -1
  98. package/dist/fondue-components61.js +5 -0
  99. package/dist/fondue-components61.js.map +1 -0
  100. package/dist/fondue-components62.js +42 -0
  101. package/dist/fondue-components62.js.map +1 -0
  102. package/dist/fondue-components63.js +14 -0
  103. package/dist/fondue-components63.js.map +1 -0
  104. package/dist/fondue-components7.js +2 -2
  105. package/dist/fondue-components8.js +2 -2
  106. package/dist/fondue-components9.js +63 -60
  107. package/dist/fondue-components9.js.map +1 -1
  108. package/dist/index.d.ts +54 -0
  109. package/dist/style.css +1 -1
  110. package/package.json +2 -1
@@ -3,42 +3,44 @@ import { Box as t } from "./fondue-components3.js";
3
3
  import { Button as x } from "./fondue-components4.js";
4
4
  import { Checkbox as f } from "./fondue-components5.js";
5
5
  import { ColorPicker as l } from "./fondue-components6.js";
6
- import { Dialog as c } from "./fondue-components7.js";
7
- import { Divider as S } from "./fondue-components8.js";
8
- import { Dropdown as g } from "./fondue-components9.js";
9
- import { Flex as B } from "./fondue-components10.js";
10
- import { Flyout as D } from "./fondue-components11.js";
11
- import { Grid as h } from "./fondue-components12.js";
12
- import { Label as w } from "./fondue-components13.js";
13
- import { LoadingBar as L } from "./fondue-components14.js";
14
- import { ScrollArea as v } from "./fondue-components15.js";
15
- import { Section as A } from "./fondue-components16.js";
16
- import { SegmentedControl as I } from "./fondue-components17.js";
17
- import { Select as j } from "./fondue-components18.js";
18
- import { Slider as s } from "./fondue-components19.js";
6
+ import { Dialog as a } from "./fondue-components7.js";
7
+ import { Divider as d } from "./fondue-components8.js";
8
+ import { Dropdown as b } from "./fondue-components9.js";
9
+ import { Flex as u } from "./fondue-components10.js";
10
+ import { Flyout as C } from "./fondue-components11.js";
11
+ import { Grid as T } from "./fondue-components12.js";
12
+ import { Label as k } from "./fondue-components13.js";
13
+ import { LoadingBar as F } from "./fondue-components14.js";
14
+ import { ScrollArea as s } from "./fondue-components15.js";
15
+ import { Section as y } from "./fondue-components16.js";
16
+ import { SegmentedControl as G } from "./fondue-components17.js";
17
+ import { Select as P } from "./fondue-components18.js";
18
+ import { Slider as q } from "./fondue-components19.js";
19
19
  import { Switch as E } from "./fondue-components20.js";
20
- import { TextInput as J } from "./fondue-components21.js";
21
- import { Tooltip as M } from "./fondue-components22.js";
20
+ import { Tabs as J } from "./fondue-components21.js";
21
+ import { TextInput as M } from "./fondue-components22.js";
22
+ import { Tooltip as O } from "./fondue-components23.js";
22
23
  export {
23
24
  t as Box,
24
25
  x as Button,
25
26
  f as Checkbox,
26
27
  l as ColorPicker,
27
- c as Dialog,
28
- S as Divider,
29
- g as Dropdown,
30
- B as Flex,
31
- D as Flyout,
32
- h as Grid,
33
- w as Label,
34
- L as LoadingBar,
35
- v as ScrollArea,
36
- A as Section,
37
- I as SegmentedControl,
38
- j as Select,
39
- s as Slider,
28
+ a as Dialog,
29
+ d as Divider,
30
+ b as Dropdown,
31
+ u as Flex,
32
+ C as Flyout,
33
+ T as Grid,
34
+ k as Label,
35
+ F as LoadingBar,
36
+ s as ScrollArea,
37
+ y as Section,
38
+ G as SegmentedControl,
39
+ P as Select,
40
+ q as Slider,
40
41
  E as Switch,
41
- J as TextInput,
42
- M as Tooltip
42
+ J as Tabs,
43
+ M as TextInput,
44
+ O as Tooltip
43
45
  };
44
46
  //# sourceMappingURL=fondue-components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { propsToCssVariables as a } from "./fondue-components23.js";
3
- import i from "./fondue-components40.js";
2
+ import { propsToCssVariables as a } from "./fondue-components24.js";
3
+ import i from "./fondue-components41.js";
4
4
  const l = ({
5
5
  as: t = "div",
6
6
  "data-test-id": s = "fondue-flex",
@@ -2,9 +2,9 @@ import { jsx as a, jsxs as v } from "react/jsx-runtime";
2
2
  import { IconCross as x } from "@frontify/fondue-icons";
3
3
  import * as d from "@radix-ui/react-popover";
4
4
  import { forwardRef as r, useRef as C } from "react";
5
- import { usePreventDropdownOverflow as w } from "./fondue-components38.js";
6
- import { addAutoFocusAttribute as b, syncRefs as n, addShowFocusRing as A } from "./fondue-components35.js";
7
- import u from "./fondue-components41.js";
5
+ import { usePreventDropdownOverflow as w } from "./fondue-components39.js";
6
+ import { addAutoFocusAttribute as b, syncRefs as n, addShowFocusRing as A } from "./fondue-components36.js";
7
+ import u from "./fondue-components42.js";
8
8
  const c = ({ children: t, ...o }) => /* @__PURE__ */ a(d.Root, { ...o, children: t });
9
9
  c.displayName = "Flyout.Root";
10
10
  const y = ({ asChild: t = !0, children: o, "data-test-id": e = "fondue-flyout-trigger" }, s) => /* @__PURE__ */ a(
@@ -1,6 +1,6 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { propsToCssVariables as a } from "./fondue-components23.js";
3
- import e from "./fondue-components42.js";
2
+ import { propsToCssVariables as a } from "./fondue-components24.js";
3
+ import e from "./fondue-components43.js";
4
4
  const d = ({
5
5
  as: s = "div",
6
6
  "data-test-id": t = "fondue-grid",
@@ -1,7 +1,7 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import * as d from "@radix-ui/react-label";
3
3
  import { forwardRef as i } from "react";
4
- import { cn as n } from "./fondue-components25.js";
4
+ import { cn as n } from "./fondue-components26.js";
5
5
  const s = ({ className: e, "data-test-id": a = "fondue-label", ...t }, r) => /* @__PURE__ */ o(
6
6
  d.Root,
7
7
  {
@@ -1,7 +1,7 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import * as t from "@radix-ui/react-progress";
3
3
  import { forwardRef as m } from "react";
4
- import { loadingBarContainerStyles as g, loadingBarStyles as f } from "./fondue-components43.js";
4
+ import { loadingBarContainerStyles as g, loadingBarStyles as f } from "./fondue-components44.js";
5
5
  const p = m(
6
6
  ({
7
7
  value: a,
@@ -1,7 +1,7 @@
1
1
  import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
2
  import * as o from "@radix-ui/react-scroll-area";
3
3
  import { forwardRef as n } from "react";
4
- import l from "./fondue-components44.js";
4
+ import l from "./fondue-components45.js";
5
5
  const b = ({
6
6
  type: t,
7
7
  maxHeight: e = "100%",
@@ -1,6 +1,6 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { propsToCssVariables as r } from "./fondue-components23.js";
3
- import i from "./fondue-components45.js";
2
+ import { propsToCssVariables as r } from "./fondue-components24.js";
3
+ import i from "./fondue-components46.js";
4
4
  const a = ({ "data-test-id": t = "fondue-section", children: o, ...s }) => /* @__PURE__ */ e("section", { className: i.root, "data-test-id": t, style: r(s), children: o });
5
5
  a.displayName = "Section";
6
6
  export {
@@ -1,8 +1,8 @@
1
1
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
2
  import * as i from "@radix-ui/react-toggle-group";
3
3
  import { forwardRef as n } from "react";
4
- import { useControllableState as N } from "./fondue-components46.js";
5
- import e from "./fondue-components47.js";
4
+ import { useControllableState as N } from "./fondue-components47.js";
5
+ import e from "./fondue-components48.js";
6
6
  const d = ({ children: a, value: o, defaultValue: s, onValueChange: p, ...m }, f) => {
7
7
  const [g, C] = N({
8
8
  prop: o,
@@ -4,12 +4,12 @@ import * as S from "@radix-ui/react-popover";
4
4
  import { Slot as H } from "@radix-ui/react-slot";
5
5
  import { useSelect as T } from "downshift";
6
6
  import { forwardRef as V, useRef as $, useState as A } from "react";
7
- import { ForwardedRefCombobox as q } from "./fondue-components48.js";
8
- import { ForwardedRefSelectItem as J, ForwardedRefSelectItemGroup as K } from "./fondue-components49.js";
9
- import { SelectMenu as L } from "./fondue-components50.js";
10
- import { ForwardedRefSelectSlot as Q } from "./fondue-components51.js";
11
- import a from "./fondue-components52.js";
12
- import { useSelectData as U } from "./fondue-components53.js";
7
+ import { ForwardedRefCombobox as q } from "./fondue-components49.js";
8
+ import { ForwardedRefSelectItem as J, ForwardedRefSelectItemGroup as K } from "./fondue-components50.js";
9
+ import { SelectMenu as L } from "./fondue-components51.js";
10
+ import { ForwardedRefSelectSlot as Q } from "./fondue-components52.js";
11
+ import a from "./fondue-components53.js";
12
+ import { useSelectData as U } from "./fondue-components54.js";
13
13
  const g = ({
14
14
  children: h,
15
15
  onSelect: i,
@@ -1,7 +1,7 @@
1
1
  import { jsxs as f, jsx as s } from "react/jsx-runtime";
2
2
  import * as e from "@radix-ui/react-slider";
3
3
  import { forwardRef as h, useRef as R } from "react";
4
- import r from "./fondue-components54.js";
4
+ import r from "./fondue-components55.js";
5
5
  const g = ({
6
6
  value: a,
7
7
  defaultValue: n = [0],
@@ -1,8 +1,8 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import * as o from "@radix-ui/react-switch";
3
3
  import { forwardRef as l } from "react";
4
- import { cn as f } from "./fondue-components25.js";
5
- import t from "./fondue-components55.js";
4
+ import { cn as f } from "./fondue-components26.js";
5
+ import t from "./fondue-components56.js";
6
6
  const n = ({
7
7
  value: a,
8
8
  defaultValue: i,
@@ -1,69 +1,120 @@
1
- import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
- import { IconCheckMark as w, IconExclamationMarkTriangle as N } from "@frontify/fondue-icons";
3
- import { forwardRef as n, useRef as S } from "react";
4
- import { cn as m } from "./fondue-components25.js";
5
- import r from "./fondue-components56.js";
6
- const f = ({
7
- children: c,
8
- className: d,
9
- status: e = "neutral",
10
- "data-test-id": a = "fondue-text-input",
11
- ...t
12
- }, R) => {
13
- const i = S(!1);
14
- return /* @__PURE__ */ g("div", { className: m(r.root, d), "data-status": e, "data-test-id": a, children: [
15
- e === "loading" ? /* @__PURE__ */ s("div", { className: r.loadingStatus, "data-test-id": `${a}-loader` }) : null,
16
- /* @__PURE__ */ s(
17
- "input",
18
- {
19
- onMouseDown: (o) => {
20
- i.current = !0, o.currentTarget.dataset.showFocusRing = "false";
21
- },
22
- type: "text",
23
- ...t,
24
- onFocus: (o) => {
25
- var l;
26
- i.current || (o.target.dataset.showFocusRing = "true"), (l = t.onFocus) == null || l.call(t, o);
27
- },
28
- onBlur: (o) => {
29
- var l;
30
- o.target.dataset.showFocusRing = "false", i.current = !1, (l = t.onBlur) == null || l.call(t, o);
31
- },
32
- ref: R,
33
- className: r.input,
34
- "aria-invalid": e === "error"
35
- }
36
- ),
37
- e === "success" ? /* @__PURE__ */ s(w, { size: 16, className: r.iconSuccess, "data-test-id": `${a}-success-icon` }) : null,
38
- e === "error" ? /* @__PURE__ */ s(
39
- N,
40
- {
41
- size: 16,
42
- className: r.iconError,
43
- "data-test-id": `${a}-error-icon`
44
- }
45
- ) : null,
46
- c
47
- ] });
48
- };
49
- f.displayName = "TextField.Root";
50
- const u = ({ name: c, className: d, ...e }, a) => /* @__PURE__ */ s(
51
- "div",
52
- {
53
- "data-slot": !0,
54
- "data-name": c,
55
- ...e,
56
- ref: a,
57
- className: m(r.slot, d)
1
+ import { jsx as a, jsxs as T } from "react/jsx-runtime";
2
+ import { createContext as x, forwardRef as l, useCallback as j, createElement as N, useContext as b, useRef as A, useEffect as D } from "react";
3
+ import { IconDotsHorizontal as E } from "@frontify/fondue-icons";
4
+ import * as d from "@radix-ui/react-tabs";
5
+ import { useControllableState as O } from "./fondue-components47.js";
6
+ import { Button as V } from "./fondue-components4.js";
7
+ import { Dropdown as i } from "./fondue-components9.js";
8
+ import { useTabTriggers as q } from "./fondue-components57.js";
9
+ import r from "./fondue-components58.js";
10
+ const f = x({
11
+ value: "",
12
+ disabled: !1
13
+ }), w = x({
14
+ addTrigger: () => {
58
15
  }
59
- );
60
- u.displayName = "TextField.Slot";
61
- const x = n(f), T = n(u), F = x;
62
- F.Root = x;
63
- F.Slot = T;
16
+ }), y = ({
17
+ children: t,
18
+ activeTab: o,
19
+ defaultActiveTab: s,
20
+ onActiveTabChange: n,
21
+ size: c = "medium",
22
+ ...m
23
+ }, u) => {
24
+ var R;
25
+ const [v, g] = O({
26
+ prop: o,
27
+ defaultProp: s,
28
+ onChange: n
29
+ }), C = j(
30
+ (e) => {
31
+ g(e);
32
+ },
33
+ [g]
34
+ ), { triggerListRef: k, activeIndicatorRef: P, triggers: p, triggersOutOfView: h, addTrigger: S } = q({
35
+ activeTab: v
36
+ });
37
+ return console.log(p), /* @__PURE__ */ a(w.Provider, { value: { addTrigger: S }, children: /* @__PURE__ */ T(
38
+ d.Root,
39
+ {
40
+ ref: u,
41
+ className: r.root,
42
+ onValueChange: C,
43
+ value: v ?? ((R = p[0]) == null ? void 0 : R.value),
44
+ ...m,
45
+ children: [
46
+ /* @__PURE__ */ T("div", { className: r.triggerListWrapper, children: [
47
+ /* @__PURE__ */ a(d.List, { ref: k, "data-size": c, className: r.triggerList, children: p.map((e) => /* @__PURE__ */ N(
48
+ d.Trigger,
49
+ {
50
+ ...e.props,
51
+ key: e.value,
52
+ value: e.value,
53
+ disabled: e.disabled,
54
+ className: r.trigger,
55
+ ref: e.ref
56
+ },
57
+ e.element
58
+ )) }),
59
+ /* @__PURE__ */ T(i.Root, { children: [
60
+ h.length > 0 && /* @__PURE__ */ a(i.Trigger, { "data-test-id": "overflow-items-dropdown-trigger", children: /* @__PURE__ */ a(V, { emphasis: "default", aspect: "square", size: "small", children: /* @__PURE__ */ a(E, { size: 16 }) }) }),
61
+ /* @__PURE__ */ a(i.Content, { align: "end", "data-test-id": "overflow-items-dropdown-content", children: h.map((e) => /* @__PURE__ */ N(
62
+ i.Item,
63
+ {
64
+ ...e.props,
65
+ disabled: e.disabled,
66
+ onSelect: () => C(e.value),
67
+ key: e.value
68
+ },
69
+ e.element
70
+ )) })
71
+ ] }),
72
+ /* @__PURE__ */ a(
73
+ "span",
74
+ {
75
+ "data-test-id": "active-tab-indicator",
76
+ ref: P,
77
+ className: r.activeIndicator
78
+ }
79
+ )
80
+ ] }),
81
+ t
82
+ ]
83
+ }
84
+ ) });
85
+ };
86
+ y.displayName = "Tabs.Root";
87
+ const z = ({ children: t, value: o, disabled: s }) => /* @__PURE__ */ a(f.Provider, { value: { value: o, disabled: s }, children: t });
88
+ z.displayName = "Tabs.Tab";
89
+ const I = ({ children: t, ...o }, s) => {
90
+ const { value: n, disabled: c } = b(f), { addTrigger: m } = b(w), u = A(null);
91
+ return D(() => {
92
+ m({
93
+ ref: u || s,
94
+ value: n ?? "",
95
+ disabled: c,
96
+ props: o,
97
+ element: t
98
+ });
99
+ }, []), null;
100
+ };
101
+ I.displayName = "Tabs.Trigger";
102
+ const L = ({ children: t, ...o }, s) => {
103
+ const { value: n } = b(f);
104
+ return /* @__PURE__ */ a(d.Content, { ref: s, ...o, className: r.content, value: n ?? "", children: t });
105
+ };
106
+ L.displayName = "Tabs.Content";
107
+ const Q = {
108
+ Root: l(y),
109
+ Tab: l(z),
110
+ Trigger: l(I),
111
+ Content: l(L)
112
+ };
64
113
  export {
65
- f as TextFieldRoot,
66
- u as TextFieldSlot,
67
- F as TextInput
114
+ Q as Tabs,
115
+ L as TabsContent,
116
+ y as TabsRoot,
117
+ z as TabsTab,
118
+ I as TabsTrigger
68
119
  };
69
120
  //# sourceMappingURL=fondue-components21.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components21.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 ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\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?: 'date' | '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: ChangeEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: (event: ChangeEvent<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};\n\nexport const TextFieldRoot = (\n {\n children,\n className,\n status = 'neutral',\n 'data-test-id': dataTestId = 'fondue-text-input',\n ...inputProps\n }: TextInputProps,\n ref: ForwardedRef<HTMLInputElement>,\n) => {\n const wasClicked = useRef(false);\n\n return (\n <div className={cn(styles.root, className)} data-status={status} data-test-id={dataTestId}>\n {status === 'loading' ? (\n <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`} />\n ) : null}\n <input\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n type=\"text\"\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 />\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={true}\n data-name={name}\n {...slotProps}\n ref={forwardedRef}\n className={cn(styles.slot, className)}\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","inputProps","ref","wasClicked","useRef","jsxs","cn","styles","jsx","mouseEvent","focusEvent","_a","blurEvent","IconCheckMark","IconExclamationMarkTriangle","TextFieldSlot","name","slotProps","forwardedRef","ForwardedRefTextFieldRoot","forwardRef","ForwardedRefTextFieldSlot","TextInput"],"mappings":";;;;;AA2GO,MAAMA,IAAgB,CACzB;AAAA,EACI,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACK,QAAAC,IAAaC,EAAO,EAAK;AAG3B,SAAA,gBAAAC,EAAC,OAAI,EAAA,WAAWC,EAAGC,EAAO,MAAMT,CAAS,GAAG,eAAaC,GAAQ,gBAAcC,GAC1E,UAAA;AAAA,IAAWD,MAAA,YACP,gBAAAS,EAAA,OAAA,EAAI,WAAWD,EAAO,eAAe,gBAAc,GAAGP,CAAU,UAAA,CAAW,IAC5E;AAAA,IACJ,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,aAAa,CAACC,MAAe;AACzB,UAAAN,EAAW,UAAU,IACVM,EAAA,cAAc,QAAQ,gBAAgB;AAAA,QACrD;AAAA,QACA,MAAK;AAAA,QACJ,GAAGR;AAAA,QACJ,SAAS,CAACS,MAAe;;AACjB,UAACP,EAAW,YACDO,EAAA,OAAO,QAAQ,gBAAgB,UAE9CC,IAAAV,EAAW,YAAX,QAAAU,EAAA,KAAAV,GAAqBS;AAAA,QACzB;AAAA,QACA,QAAQ,CAACE,MAAc;;AACT,UAAAA,EAAA,OAAO,QAAQ,gBAAgB,SACzCT,EAAW,UAAU,KACrBQ,IAAAV,EAAW,WAAX,QAAAU,EAAA,KAAAV,GAAoBW;AAAA,QACxB;AAAA,QACA,KAAAV;AAAA,QACA,WAAWK,EAAO;AAAA,QAClB,gBAAcR,MAAW;AAAA,MAAA;AAAA,IAC7B;AAAA,IAECA,MAAW,YACP,gBAAAS,EAAAK,GAAA,EAAc,MAAM,IAAI,WAAWN,EAAO,aAAa,gBAAc,GAAGP,CAAU,gBAAiB,CAAA,IACpG;AAAA,IAEHD,MAAW,UACR,gBAAAS;AAAA,MAACM;AAAA,MAAA;AAAA,QACG,MAAM;AAAA,QACN,WAAWP,EAAO;AAAA,QAClB,gBAAc,GAAGP,CAAU;AAAA,MAAA;AAAA,IAAA,IAE/B;AAAA,IAEHH;AAAA,EACL,EAAA,CAAA;AAER;AACAD,EAAc,cAAc;AAQf,MAAAmB,IAAgB,CACzB,EAAE,MAAAC,GAAM,WAAAlB,GAAW,GAAGmB,KACtBC,MAGI,gBAAAV;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,aAAW;AAAA,IACX,aAAWQ;AAAA,IACV,GAAGC;AAAA,IACJ,KAAKC;AAAA,IACL,WAAWZ,EAAGC,EAAO,MAAMT,CAAS;AAAA,EAAA;AAAA;AAKhDiB,EAAc,cAAc;AAE5B,MAAMI,IAA4BC,EAA6CxB,CAAa,GACtFyB,IAA4BD,EAA+CL,CAAa,GAEjFO,IAGTH;AACJG,EAAU,OAAOH;AACjBG,EAAU,OAAOD;"}
1
+ {"version":3,"file":"fondue-components21.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 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';\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 * 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\nconst TabConfigContext = createContext<{\n value: string;\n disabled?: boolean;\n}>({\n value: '',\n disabled: false,\n});\n\nconst TabTriggerContext = createContext<{\n addTrigger: (trigger: TabTrigger) => void;\n}>({\n addTrigger: () => {},\n});\n\nexport const TabsRoot = (\n {\n children,\n activeTab: propsActiveTab,\n defaultActiveTab,\n onActiveTabChange,\n size = 'medium',\n ...props\n }: TabsRootProps,\n ref: ForwardedRef<HTMLDivElement>,\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 console.log(triggers);\n\n return (\n <TabTriggerContext.Provider value={{ addTrigger }}>\n <RadixTabs.Root\n ref={ref}\n className={styles.root}\n onValueChange={handleSetActiveTab}\n value={activeTab ?? triggers[0]?.value}\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 <TabConfigContext.Provider value={{ value, disabled }}>{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\n useEffect(() => {\n addTrigger({\n ref: localRef || ref,\n value: value ?? '',\n disabled,\n props,\n element: children,\n });\n }, []);\n\n return null;\n};\nTabsTrigger.displayName = 'Tabs.Trigger';\n\ntype TabsContentProps = {\n children: ReactNode;\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","children","propsActiveTab","defaultActiveTab","onActiveTabChange","size","props","ref","activeTab","setActiveTab","useControllableState","handleSetActiveTab","useCallback","value","triggerListRef","activeIndicatorRef","triggers","triggersOutOfView","addTrigger","useTabTriggers","jsxs","RadixTabs","styles","_a","jsx","trigger","createElement","Dropdown","Button","IconDotsHorizontal","TabsTab","disabled","TabsTrigger","useContext","localRef","useRef","useEffect","TabsContent","itemProps","Tabs","forwardRef"],"mappings":"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"}
@@ -1,46 +1,69 @@
1
- import { jsx as a, jsxs as g } from "react/jsx-runtime";
2
- import * as o from "@radix-ui/react-tooltip";
3
- import { forwardRef as s } from "react";
4
- import { cn as T } from "./fondue-components25.js";
5
- import n from "./fondue-components57.js";
6
- const d = ({ children: t, enterDelay: r = 700, open: i, onOpenChange: e }) => /* @__PURE__ */ a(o.Provider, { children: /* @__PURE__ */ a(o.Root, { delayDuration: r, open: i, onOpenChange: e, children: t }) });
7
- d.displayName = "Tooltip.Root";
8
- const l = ({ asChild: t = !1, children: r, "data-test-id": i = "fondue-tooltip-trigger" }, e) => /* @__PURE__ */ a(o.Trigger, { "data-test-id": i, asChild: t, ref: e, children: r });
9
- l.displayName = "Tooltip.Trigger";
10
- const p = ({
11
- children: t,
12
- className: r,
13
- maxWidth: i,
14
- "data-test-id": e = "fondue-tooltip-content",
15
- padding: m = "spacious",
16
- ...c
17
- }, f) => /* @__PURE__ */ a(o.Portal, { children: /* @__PURE__ */ g(
18
- o.Content,
1
+ import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
+ import { IconCheckMark as w, IconExclamationMarkTriangle as N } from "@frontify/fondue-icons";
3
+ import { forwardRef as n, useRef as S } from "react";
4
+ import { cn as m } from "./fondue-components26.js";
5
+ import r from "./fondue-components59.js";
6
+ const f = ({
7
+ children: c,
8
+ className: d,
9
+ status: e = "neutral",
10
+ "data-test-id": a = "fondue-text-input",
11
+ ...t
12
+ }, R) => {
13
+ const i = S(!1);
14
+ return /* @__PURE__ */ g("div", { className: m(r.root, d), "data-status": e, "data-test-id": a, children: [
15
+ e === "loading" ? /* @__PURE__ */ s("div", { className: r.loadingStatus, "data-test-id": `${a}-loader` }) : null,
16
+ /* @__PURE__ */ s(
17
+ "input",
18
+ {
19
+ onMouseDown: (o) => {
20
+ i.current = !0, o.currentTarget.dataset.showFocusRing = "false";
21
+ },
22
+ type: "text",
23
+ ...t,
24
+ onFocus: (o) => {
25
+ var l;
26
+ i.current || (o.target.dataset.showFocusRing = "true"), (l = t.onFocus) == null || l.call(t, o);
27
+ },
28
+ onBlur: (o) => {
29
+ var l;
30
+ o.target.dataset.showFocusRing = "false", i.current = !1, (l = t.onBlur) == null || l.call(t, o);
31
+ },
32
+ ref: R,
33
+ className: r.input,
34
+ "aria-invalid": e === "error"
35
+ }
36
+ ),
37
+ e === "success" ? /* @__PURE__ */ s(w, { size: 16, className: r.iconSuccess, "data-test-id": `${a}-success-icon` }) : null,
38
+ e === "error" ? /* @__PURE__ */ s(
39
+ N,
40
+ {
41
+ size: 16,
42
+ className: r.iconError,
43
+ "data-test-id": `${a}-error-icon`
44
+ }
45
+ ) : null,
46
+ c
47
+ ] });
48
+ };
49
+ f.displayName = "TextField.Root";
50
+ const u = ({ name: c, className: d, ...e }, a) => /* @__PURE__ */ s(
51
+ "div",
19
52
  {
20
- "data-test-id": e,
21
- "data-tooltip-spacing": m,
22
- className: T(n.root, r),
23
- style: { maxWidth: i },
24
- collisionPadding: 16,
25
- sideOffset: 8,
26
- ref: f,
27
- ...c,
28
- children: [
29
- t,
30
- /* @__PURE__ */ a(o.Arrow, { "aria-hidden": "true", className: n.arrow })
31
- ]
53
+ "data-slot": !0,
54
+ "data-name": c,
55
+ ...e,
56
+ ref: a,
57
+ className: m(r.slot, d)
32
58
  }
33
- ) });
34
- p.displayName = "Tooltip.Content";
35
- const h = {
36
- Root: d,
37
- Trigger: s(l),
38
- Content: s(p)
39
- };
59
+ );
60
+ u.displayName = "TextField.Slot";
61
+ const x = n(f), T = n(u), F = x;
62
+ F.Root = x;
63
+ F.Slot = T;
40
64
  export {
41
- h as Tooltip,
42
- p as TooltipContent,
43
- d as TooltipRoot,
44
- l as TooltipTrigger
65
+ f as TextFieldRoot,
66
+ u as TextFieldSlot,
67
+ F as TextInput
45
68
  };
46
69
  //# sourceMappingURL=fondue-components22.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components22.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 { cn } from '#/utilities/styleUtilities';\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 data-test-id={dataTestId} asChild={asChild} ref={ref}>\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 ...props\n }: TooltipContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixTooltip.Portal>\n <RadixTooltip.Content\n data-test-id={dataTestId}\n data-tooltip-spacing={padding}\n className={cn(styles.root, className)}\n style={{ maxWidth }}\n collisionPadding={16}\n sideOffset={8}\n ref={ref}\n {...props}\n >\n {children}\n <RadixTooltip.Arrow aria-hidden=\"true\" className={styles.arrow} />\n </RadixTooltip.Content>\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","props","jsxs","cn","styles","Tooltip","forwardRef"],"mappings":";;;;;AA0Ba,MAAAA,IAAc,CAAC,EAAE,UAAAC,GAAU,YAAAC,IAAa,KAAK,MAAAC,GAAM,cAAAC,QAEvD,gBAAAC,EAAAC,EAAa,UAAb,EACG,UAAC,gBAAAD,EAAAC,EAAa,MAAb,EAAkB,eAAeJ,GAAY,MAAAC,GAAY,cAAAC,GACrD,UAAAH,GACL,EACJ,CAAA;AAGRD,EAAY,cAAc;AAYb,MAAAO,IAAiB,CAC1B,EAAE,SAAAC,IAAU,IAAO,UAAAP,GAAU,gBAAgBQ,IAAa,yBAAyB,GACnFC,MAGI,gBAAAL,EAACC,EAAa,SAAb,EAAqB,gBAAcG,GAAY,SAAAD,GAAkB,KAAAE,GAC7D,UAAAT,EACL,CAAA;AAGRM,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,GAAGC;AACP,GACAL,MAGI,gBAAAL,EAACC,EAAa,QAAb,EACG,UAAA,gBAAAU;AAAA,EAACV,EAAa;AAAA,EAAb;AAAA,IACG,gBAAcG;AAAA,IACd,wBAAsBK;AAAA,IACtB,WAAWG,EAAGC,EAAO,MAAMN,CAAS;AAAA,IACpC,OAAO,EAAE,UAAAC,EAAS;AAAA,IAClB,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,KAAAH;AAAA,IACC,GAAGK;AAAA,IAEH,UAAA;AAAA,MAAAd;AAAA,MACD,gBAAAI,EAACC,EAAa,OAAb,EAAmB,eAAY,QAAO,WAAWY,EAAO,OAAO;AAAA,IAAA;AAAA,EAAA;AAExE,EAAA,CAAA;AAGRP,EAAe,cAAc;AAEtB,MAAMQ,IAAU;AAAA,EACnB,MAAMnB;AAAA,EACN,SAASoB,EAAmDb,CAAc;AAAA,EAC1E,SAASa,EAAgDT,CAAc;AAC3E;"}
1
+ {"version":3,"file":"fondue-components22.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 ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\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?: 'date' | '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: ChangeEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: (event: ChangeEvent<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};\n\nexport const TextFieldRoot = (\n {\n children,\n className,\n status = 'neutral',\n 'data-test-id': dataTestId = 'fondue-text-input',\n ...inputProps\n }: TextInputProps,\n ref: ForwardedRef<HTMLInputElement>,\n) => {\n const wasClicked = useRef(false);\n\n return (\n <div className={cn(styles.root, className)} data-status={status} data-test-id={dataTestId}>\n {status === 'loading' ? (\n <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`} />\n ) : null}\n <input\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n type=\"text\"\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 />\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={true}\n data-name={name}\n {...slotProps}\n ref={forwardedRef}\n className={cn(styles.slot, className)}\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","inputProps","ref","wasClicked","useRef","jsxs","cn","styles","jsx","mouseEvent","focusEvent","_a","blurEvent","IconCheckMark","IconExclamationMarkTriangle","TextFieldSlot","name","slotProps","forwardedRef","ForwardedRefTextFieldRoot","forwardRef","ForwardedRefTextFieldSlot","TextInput"],"mappings":";;;;;AA2GO,MAAMA,IAAgB,CACzB;AAAA,EACI,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACK,QAAAC,IAAaC,EAAO,EAAK;AAG3B,SAAA,gBAAAC,EAAC,OAAI,EAAA,WAAWC,EAAGC,EAAO,MAAMT,CAAS,GAAG,eAAaC,GAAQ,gBAAcC,GAC1E,UAAA;AAAA,IAAWD,MAAA,YACP,gBAAAS,EAAA,OAAA,EAAI,WAAWD,EAAO,eAAe,gBAAc,GAAGP,CAAU,UAAA,CAAW,IAC5E;AAAA,IACJ,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,aAAa,CAACC,MAAe;AACzB,UAAAN,EAAW,UAAU,IACVM,EAAA,cAAc,QAAQ,gBAAgB;AAAA,QACrD;AAAA,QACA,MAAK;AAAA,QACJ,GAAGR;AAAA,QACJ,SAAS,CAACS,MAAe;;AACjB,UAACP,EAAW,YACDO,EAAA,OAAO,QAAQ,gBAAgB,UAE9CC,IAAAV,EAAW,YAAX,QAAAU,EAAA,KAAAV,GAAqBS;AAAA,QACzB;AAAA,QACA,QAAQ,CAACE,MAAc;;AACT,UAAAA,EAAA,OAAO,QAAQ,gBAAgB,SACzCT,EAAW,UAAU,KACrBQ,IAAAV,EAAW,WAAX,QAAAU,EAAA,KAAAV,GAAoBW;AAAA,QACxB;AAAA,QACA,KAAAV;AAAA,QACA,WAAWK,EAAO;AAAA,QAClB,gBAAcR,MAAW;AAAA,MAAA;AAAA,IAC7B;AAAA,IAECA,MAAW,YACP,gBAAAS,EAAAK,GAAA,EAAc,MAAM,IAAI,WAAWN,EAAO,aAAa,gBAAc,GAAGP,CAAU,gBAAiB,CAAA,IACpG;AAAA,IAEHD,MAAW,UACR,gBAAAS;AAAA,MAACM;AAAA,MAAA;AAAA,QACG,MAAM;AAAA,QACN,WAAWP,EAAO;AAAA,QAClB,gBAAc,GAAGP,CAAU;AAAA,MAAA;AAAA,IAAA,IAE/B;AAAA,IAEHH;AAAA,EACL,EAAA,CAAA;AAER;AACAD,EAAc,cAAc;AAQf,MAAAmB,IAAgB,CACzB,EAAE,MAAAC,GAAM,WAAAlB,GAAW,GAAGmB,KACtBC,MAGI,gBAAAV;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,aAAW;AAAA,IACX,aAAWQ;AAAA,IACV,GAAGC;AAAA,IACJ,KAAKC;AAAA,IACL,WAAWZ,EAAGC,EAAO,MAAMT,CAAS;AAAA,EAAA;AAAA;AAKhDiB,EAAc,cAAc;AAE5B,MAAMI,IAA4BC,EAA6CxB,CAAa,GACtFyB,IAA4BD,EAA+CL,CAAa,GAEjFO,IAGTH;AACJG,EAAU,OAAOH;AACjBG,EAAU,OAAOD;"}