@frontify/fondue-components 1.3.5 → 1.5.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.
Files changed (76) hide show
  1. package/dist/fondue-components.js +15 -11
  2. package/dist/fondue-components.js.map +1 -1
  3. package/dist/fondue-components10.js +36 -44
  4. package/dist/fondue-components10.js.map +1 -1
  5. package/dist/fondue-components11.js +46 -72
  6. package/dist/fondue-components11.js.map +1 -1
  7. package/dist/fondue-components12.js +76 -45
  8. package/dist/fondue-components12.js.map +1 -1
  9. package/dist/fondue-components13.js +65 -11
  10. package/dist/fondue-components13.js.map +1 -1
  11. package/dist/fondue-components14.js +45 -154
  12. package/dist/fondue-components14.js.map +1 -1
  13. package/dist/fondue-components15.js +10 -116
  14. package/dist/fondue-components15.js.map +1 -1
  15. package/dist/fondue-components16.js +59 -22
  16. package/dist/fondue-components16.js.map +1 -1
  17. package/dist/fondue-components17.js +111 -14
  18. package/dist/fondue-components17.js.map +1 -1
  19. package/dist/fondue-components18.js +112 -24
  20. package/dist/fondue-components18.js.map +1 -1
  21. package/dist/fondue-components19.js +15 -54
  22. package/dist/fondue-components19.js.map +1 -1
  23. package/dist/fondue-components20.js +15 -17
  24. package/dist/fondue-components20.js.map +1 -1
  25. package/dist/fondue-components21.js +51 -26
  26. package/dist/fondue-components21.js.map +1 -1
  27. package/dist/fondue-components22.js +16 -24
  28. package/dist/fondue-components22.js.map +1 -1
  29. package/dist/fondue-components23.js +17 -9
  30. package/dist/fondue-components23.js.map +1 -1
  31. package/dist/fondue-components24.js +35 -6
  32. package/dist/fondue-components24.js.map +1 -1
  33. package/dist/fondue-components25.js +24 -14
  34. package/dist/fondue-components25.js.map +1 -1
  35. package/dist/fondue-components26.js +9 -2360
  36. package/dist/fondue-components26.js.map +1 -1
  37. package/dist/fondue-components27.js +105 -138
  38. package/dist/fondue-components27.js.map +1 -1
  39. package/dist/fondue-components28.js +12 -2
  40. package/dist/fondue-components28.js.map +1 -1
  41. package/dist/fondue-components29.js +38 -29
  42. package/dist/fondue-components29.js.map +1 -1
  43. package/dist/fondue-components3.js +4 -4
  44. package/dist/fondue-components30.js +11 -0
  45. package/dist/fondue-components30.js.map +1 -0
  46. package/dist/fondue-components31.js +24 -0
  47. package/dist/fondue-components31.js.map +1 -0
  48. package/dist/fondue-components32.js +59 -0
  49. package/dist/fondue-components32.js.map +1 -0
  50. package/dist/fondue-components33.js +21 -0
  51. package/dist/fondue-components33.js.map +1 -0
  52. package/dist/fondue-components34.js +18 -0
  53. package/dist/fondue-components34.js.map +1 -0
  54. package/dist/fondue-components35.js +5 -0
  55. package/dist/fondue-components35.js.map +1 -0
  56. package/dist/fondue-components36.js +2363 -0
  57. package/dist/fondue-components36.js.map +1 -0
  58. package/dist/fondue-components37.js +123 -0
  59. package/dist/fondue-components37.js.map +1 -0
  60. package/dist/fondue-components38.js +42 -0
  61. package/dist/fondue-components38.js.map +1 -0
  62. package/dist/fondue-components39.js +29 -0
  63. package/dist/fondue-components39.js.map +1 -0
  64. package/dist/fondue-components4.js +2 -2
  65. package/dist/fondue-components5.js +54 -50
  66. package/dist/fondue-components5.js.map +1 -1
  67. package/dist/fondue-components6.js +2 -2
  68. package/dist/fondue-components7.js +77 -50
  69. package/dist/fondue-components7.js.map +1 -1
  70. package/dist/fondue-components8.js +56 -22
  71. package/dist/fondue-components8.js.map +1 -1
  72. package/dist/fondue-components9.js +24 -39
  73. package/dist/fondue-components9.js.map +1 -1
  74. package/dist/index.d.ts +245 -3
  75. package/dist/style.css +1 -1
  76. package/package.json +45 -36
@@ -3,22 +3,26 @@ import { Button as e } from "./fondue-components3.js";
3
3
  import { Checkbox as m } from "./fondue-components4.js";
4
4
  import { Dialog as f } from "./fondue-components5.js";
5
5
  import { Divider as l } from "./fondue-components6.js";
6
- import { Flyout as a } from "./fondue-components7.js";
7
- import { Label as g } from "./fondue-components8.js";
8
- import { LoadingBar as b } from "./fondue-components9.js";
9
- import { SegmentedControl as C } from "./fondue-components10.js";
10
- import { TextInput as L } from "./fondue-components11.js";
11
- import { Tooltip as c } from "./fondue-components12.js";
6
+ import { Dropdown as a } from "./fondue-components7.js";
7
+ import { Flyout as g } from "./fondue-components8.js";
8
+ import { Label as D } from "./fondue-components9.js";
9
+ import { LoadingBar as c } from "./fondue-components10.js";
10
+ import { SegmentedControl as C } from "./fondue-components11.js";
11
+ import { Select as S } from "./fondue-components12.js";
12
+ import { TextInput as h } from "./fondue-components13.js";
13
+ import { Tooltip as v } from "./fondue-components14.js";
12
14
  export {
13
15
  e as Button,
14
16
  m as Checkbox,
15
17
  f as Dialog,
16
18
  l as Divider,
17
- a as Flyout,
18
- g as Label,
19
- b as LoadingBar,
19
+ a as Dropdown,
20
+ g as Flyout,
21
+ D as Label,
22
+ c as LoadingBar,
20
23
  C as SegmentedControl,
21
- L as TextInput,
22
- c as Tooltip
24
+ S as Select,
25
+ h as TextInput,
26
+ v as Tooltip
23
27
  };
24
28
  //# 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,50 +1,42 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import * as r from "@radix-ui/react-toggle-group";
3
- import { forwardRef as m } from "react";
4
- import { useControllableState as S } from "./fondue-components22.js";
5
- import { segmentedControlRootStyles as f, segmentedControlActiveIndicatorStyles as I, segmentedControlItemStyles as y, segmentedControlItemSeparatorStyles as N, segmentedControlItemLabelStyles as u, segmentedControlItemLabelActiveStyles as b, segmentedControlItemLabelInactiveStyles as h } from "./fondue-components23.js";
6
- const d = ({ children: e, value: o, defaultValue: s, onValueChange: c, ...a }, g) => {
7
- const [p, C] = S({
8
- prop: o,
9
- defaultProp: s,
10
- onChange: c
11
- });
12
- return /* @__PURE__ */ l(
13
- r.Root,
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import * as t from "@radix-ui/react-progress";
3
+ import { forwardRef as s } from "react";
4
+ import { loadingBarContainerStyles as g, loadingBarStyles as f } from "./fondue-components24.js";
5
+ const p = s(
6
+ ({
7
+ value: a,
8
+ max: r = 100,
9
+ rounded: d = !0,
10
+ style: o = "default",
11
+ size: e = "medium",
12
+ "data-test-id": n = "fondue-loading-bar",
13
+ ...l
14
+ }, m) => /* @__PURE__ */ i(
15
+ t.Root,
14
16
  {
15
- ref: g,
16
- ...a,
17
- className: f,
18
- onValueChange: (n) => {
19
- n && C(n);
17
+ ref: m,
18
+ "data-test-id": n,
19
+ className: g({ rounded: d, size: e, style: o }),
20
+ "aria-busy": a !== r,
21
+ value: a,
22
+ max: r,
23
+ style: {
24
+ "--loading-bar-value": a,
25
+ "--loading-bar-max": r,
26
+ "--loading-bar-proportion": "calc(var(--loading-bar-value) / var(--loading-bar-max))"
20
27
  },
21
- value: p,
22
- type: "single",
23
- asChild: !1,
24
- "aria-disabled": a.disabled,
25
- children: [
26
- e,
27
- /* @__PURE__ */ t("div", { className: I })
28
- ]
28
+ ...l,
29
+ children: /* @__PURE__ */ i(
30
+ t.Indicator,
31
+ {
32
+ className: f({ style: o, indeterminateState: a === null })
33
+ }
34
+ )
29
35
  }
30
- );
31
- };
32
- d.displayName = "SegmentedControl.Root";
33
- const i = ({ children: e, ...o }, s) => /* @__PURE__ */ l(r.Item, { ref: s, ...o, className: y, asChild: !1, children: [
34
- /* @__PURE__ */ t("span", { className: N }),
35
- /* @__PURE__ */ l("span", { className: u, children: [
36
- /* @__PURE__ */ t("span", { className: b, children: e }),
37
- /* @__PURE__ */ t("span", { className: h, children: e })
38
- ] })
39
- ] });
40
- i.displayName = "SegmentedControl.Item";
41
- const j = {
42
- Root: m(d),
43
- Item: m(i)
44
- };
36
+ )
37
+ );
38
+ p.displayName = "LoadingBar";
45
39
  export {
46
- j as SegmentedControl,
47
- i as SegmentedControlItem,
48
- d as SegmentedControlRoot
40
+ p as LoadingBar
49
41
  };
50
42
  //# sourceMappingURL=fondue-components10.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components10.js","sources":["../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { useControllableState } from '#/hooks/useControllableState';\n\nimport {\n segmentedControlActiveIndicatorStyles,\n segmentedControlItemLabelActiveStyles,\n segmentedControlItemLabelInactiveStyles,\n segmentedControlItemLabelStyles,\n segmentedControlItemSeparatorStyles,\n segmentedControlItemStyles,\n segmentedControlRootStyles,\n} from './styles/segmentedControlStyles';\n\nexport type SegmentedControlRootProps = {\n id?: string;\n children: ReactNode;\n /**\n * The default value of the segmented control\n * Used for uncontrolled components\n */\n defaultValue: string;\n /**\n * The controlled value of the segmented control\n */\n value?: string;\n /**\n * Event handler called when the value changes\n */\n onValueChange?: (value: string) => void;\n /**\n * Disable the segmented control\n * @default false\n */\n disabled?: boolean;\n};\n\nexport const SegmentedControlRoot = (\n { children, value: propsValue, defaultValue, onValueChange, ...rootProps }: SegmentedControlRootProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const [value, setValue] = useControllableState({\n prop: propsValue,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n return (\n <ToggleGroupPrimitive.Root\n ref={ref}\n {...rootProps}\n className={segmentedControlRootStyles}\n onValueChange={(value) => {\n if (value) {\n setValue(value);\n }\n }}\n value={value}\n type=\"single\"\n asChild={false}\n aria-disabled={rootProps.disabled}\n >\n {children}\n {/* Active indicator */}\n <div className={segmentedControlActiveIndicatorStyles} />\n </ToggleGroupPrimitive.Root>\n );\n};\nSegmentedControlRoot.displayName = 'SegmentedControl.Root';\n\ntype SegmentedControlItemProps = {\n children: ReactNode;\n value: string;\n};\n\nexport const SegmentedControlItem = (\n { children, ...itemProps }: SegmentedControlItemProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => (\n <ToggleGroupPrimitive.Item ref={ref} {...itemProps} className={segmentedControlItemStyles} asChild={false}>\n {/* Separator */}\n <span className={segmentedControlItemSeparatorStyles} />\n <span className={segmentedControlItemLabelStyles}>\n {/* Active children */}\n <span className={segmentedControlItemLabelActiveStyles}>{children}</span>\n\n {/* Inactive children */}\n <span className={segmentedControlItemLabelInactiveStyles}>{children}</span>\n </span>\n </ToggleGroupPrimitive.Item>\n);\nSegmentedControlItem.displayName = 'SegmentedControl.Item';\n\nexport const SegmentedControl = {\n Root: forwardRef<HTMLDivElement, SegmentedControlRootProps>(SegmentedControlRoot),\n Item: forwardRef<HTMLButtonElement, SegmentedControlItemProps>(SegmentedControlItem),\n};\n"],"names":["SegmentedControlRoot","children","propsValue","defaultValue","onValueChange","rootProps","ref","value","setValue","useControllableState","jsxs","ToggleGroupPrimitive","segmentedControlRootStyles","jsx","segmentedControlActiveIndicatorStyles","SegmentedControlItem","itemProps","segmentedControlItemStyles","segmentedControlItemSeparatorStyles","segmentedControlItemLabelStyles","segmentedControlItemLabelActiveStyles","segmentedControlItemLabelInactiveStyles","SegmentedControl","forwardRef"],"mappings":";;;;;AAwCa,MAAAA,IAAuB,CAChC,EAAE,UAAAC,GAAU,OAAOC,GAAY,cAAAC,GAAc,eAAAC,GAAe,GAAGC,EAAU,GACzEC,MACC;AACD,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAqB;AAAA,IAC3C,MAAMP;AAAA,IACN,aAAaC;AAAA,IACb,UAAUC;AAAA,EAAA,CACb;AAGG,SAAA,gBAAAM;AAAA,IAACC,EAAqB;AAAA,IAArB;AAAA,MACG,KAAAL;AAAA,MACC,GAAGD;AAAA,MACJ,WAAWO;AAAA,MACX,eAAe,CAACL,MAAU;AACtB,QAAIA,KACAC,EAASD,CAAK;AAAA,MAEtB;AAAA,MACA,OAAAA;AAAA,MACA,MAAK;AAAA,MACL,SAAS;AAAA,MACT,iBAAeF,EAAU;AAAA,MAExB,UAAA;AAAA,QAAAJ;AAAA,QAED,gBAAAY,EAAC,OAAI,EAAA,WAAWC,EAAuC,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnE;AACAd,EAAqB,cAAc;AAO5B,MAAMe,IAAuB,CAChC,EAAE,UAAAd,GAAU,GAAGe,EAAA,GACfV,MAEA,gBAAAI,EAACC,EAAqB,MAArB,EAA0B,KAAAL,GAAW,GAAGU,GAAW,WAAWC,GAA4B,SAAS,IAEhG,UAAA;AAAA,EAAC,gBAAAJ,EAAA,QAAA,EAAK,WAAWK,EAAqC,CAAA;AAAA,EACtD,gBAAAR,EAAC,QAAK,EAAA,WAAWS,GAEb,UAAA;AAAA,IAAC,gBAAAN,EAAA,QAAA,EAAK,WAAWO,GAAwC,UAAAnB,EAAS,CAAA;AAAA,IAGjE,gBAAAY,EAAA,QAAA,EAAK,WAAWQ,GAA0C,UAAApB,EAAS,CAAA;AAAA,EAAA,GACxE;AAAA,GACJ;AAEJc,EAAqB,cAAc;AAE5B,MAAMO,IAAmB;AAAA,EAC5B,MAAMC,EAAsDvB,CAAoB;AAAA,EAChF,MAAMuB,EAAyDR,CAAoB;AACvF;"}
1
+ {"version":3,"file":"fondue-components10.js","sources":["../src/components/LoadingBar/LoadingBar.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as ProgressRadixPrimitive from '@radix-ui/react-progress';\nimport { forwardRef, type CSSProperties, type ElementRef, type ForwardedRef } from 'react';\n\nimport { loadingBarContainerStyles, loadingBarStyles } from './styles/loadingBarStyles';\n\nexport type LoadingBarProps = {\n /**\n * The current value of the loading bar. If `null`, the loading bar will be in an indeterminate state.\n * @default null\n */\n value: number | null;\n /**\n * The maximum value of the loading bar\n * @default 100\n */\n max?: number;\n /**\n * @default 'fondue-loading-bar'\n */\n 'data-test-id'?: string;\n /**\n * Add rounded corners to the loading bar\n * @default true\n */\n rounded?: boolean;\n /**\n * The style of the loading bar\n * @default \"default\"\n */\n style?: 'default' | 'positive' | 'negative';\n /**\n * The size of the loading bar\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large' | 'x-large';\n /**\n * The label of the loading bar for accessibility purposes\n */\n getValueLabel?: (value: number, max: number) => string;\n} & ({ 'aria-label': string } | { 'aria-labelledby': string });\n\nexport const LoadingBar = forwardRef<ElementRef<typeof ProgressRadixPrimitive.Root>, LoadingBarProps>(\n (\n {\n value,\n max = 100,\n rounded = true,\n style = 'default',\n size = 'medium',\n 'data-test-id': dataTestId = 'fondue-loading-bar',\n ...props\n }: LoadingBarProps,\n ref: ForwardedRef<ElementRef<typeof ProgressRadixPrimitive.Root>>,\n ) => {\n return (\n <ProgressRadixPrimitive.Root\n ref={ref}\n data-test-id={dataTestId}\n className={loadingBarContainerStyles({ rounded, size, style })}\n aria-busy={value !== max}\n value={value}\n max={max}\n style={\n {\n '--loading-bar-value': value,\n '--loading-bar-max': max,\n '--loading-bar-proportion': 'calc(var(--loading-bar-value) / var(--loading-bar-max))',\n } as CSSProperties\n }\n {...props}\n >\n <ProgressRadixPrimitive.Indicator\n className={loadingBarStyles({ style, indeterminateState: value === null })}\n />\n </ProgressRadixPrimitive.Root>\n );\n },\n);\nLoadingBar.displayName = 'LoadingBar';\n"],"names":["LoadingBar","forwardRef","value","max","rounded","style","size","dataTestId","props","ref","jsx","ProgressRadixPrimitive","loadingBarContainerStyles","loadingBarStyles"],"mappings":";;;;AA2CO,MAAMA,IAAaC;AAAA,EACtB,CACI;AAAA,IACI,OAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,SAAAC,IAAU;AAAA,IACV,OAAAC,IAAQ;AAAA,IACR,MAAAC,IAAO;AAAA,IACP,gBAAgBC,IAAa;AAAA,IAC7B,GAAGC;AAAA,KAEPC,MAGI,gBAAAC;AAAA,IAACC,EAAuB;AAAA,IAAvB;AAAA,MACG,KAAAF;AAAA,MACA,gBAAcF;AAAA,MACd,WAAWK,EAA0B,EAAE,SAAAR,GAAS,MAAAE,GAAM,OAAAD,GAAO;AAAA,MAC7D,aAAWH,MAAUC;AAAA,MACrB,OAAAD;AAAA,MACA,KAAAC;AAAA,MACA,OACI;AAAA,QACI,uBAAuBD;AAAA,QACvB,qBAAqBC;AAAA,QACrB,4BAA4B;AAAA,MAChC;AAAA,MAEH,GAAGK;AAAA,MAEJ,UAAA,gBAAAE;AAAA,QAACC,EAAuB;AAAA,QAAvB;AAAA,UACG,WAAWE,EAAiB,EAAE,OAAAR,GAAO,oBAAoBH,MAAU,MAAM;AAAA,QAAA;AAAA,MAC7E;AAAA,IAAA;AAAA,EAAA;AAIhB;AACAF,EAAW,cAAc;"}
@@ -1,76 +1,50 @@
1
- import { jsxs as F, jsx as r } from "react/jsx-runtime";
2
- import { IconCheckMark as R, IconExclamationMarkTriangle as g } from "@frontify/fondue-icons";
3
- import { forwardRef as d, useRef as S } from "react";
4
- import { cn as n } from "./fondue-components13.js";
5
- import { rootStyles as N, loadingStatusStyles as h, inputStyles as y, slotStyles as T } from "./fondue-components24.js";
6
- const m = ({
7
- children: s,
8
- className: i,
9
- status: e = "neutral",
10
- "data-test-id": o = "fondue-text-input",
11
- ...t
12
- }, u) => {
13
- const c = S(!1);
14
- return /* @__PURE__ */ F("div", { className: n(N, i), "data-status": e, "data-test-id": o, children: [
15
- e === "loading" ? /* @__PURE__ */ r("div", { className: h, "data-test-id": `${o}-loader` }) : null,
16
- /* @__PURE__ */ r(
17
- "input",
18
- {
19
- onMouseDown: (a) => {
20
- c.current = !0, a.currentTarget.dataset.showFocusRing = "false";
21
- },
22
- type: "text",
23
- ...t,
24
- onFocus: (a) => {
25
- var l;
26
- c.current || (a.target.dataset.showFocusRing = "true"), (l = t.onFocus) == null || l.call(t, a);
27
- },
28
- onBlur: (a) => {
29
- var l;
30
- a.target.dataset.showFocusRing = "false", c.current = !1, (l = t.onBlur) == null || l.call(t, a);
31
- },
32
- ref: u,
33
- className: y,
34
- "aria-invalid": e === "error"
35
- }
36
- ),
37
- e === "success" ? /* @__PURE__ */ r(
38
- R,
39
- {
40
- size: 16,
41
- className: "tw-flex tw-text-text-positive tw-h-full tw-items-center tw-ml-3",
42
- "data-test-id": `${o}-success-icon`
43
- }
44
- ) : null,
45
- e === "error" ? /* @__PURE__ */ r(
46
- g,
47
- {
48
- size: 16,
49
- className: "tw-flex tw-text-text-negative tw-h-full tw-items-center tw-ml-3",
50
- "data-test-id": `${o}-error-icon`
51
- }
52
- ) : null,
53
- s
54
- ] });
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-toggle-group";
3
+ import { forwardRef as m } from "react";
4
+ import { useControllableState as S } from "./fondue-components25.js";
5
+ import { segmentedControlRootStyles as f, segmentedControlActiveIndicatorStyles as I, segmentedControlItemStyles as y, segmentedControlItemSeparatorStyles as N, segmentedControlItemLabelStyles as u, segmentedControlItemLabelActiveStyles as b, segmentedControlItemLabelInactiveStyles as h } from "./fondue-components26.js";
6
+ const d = ({ children: e, value: o, defaultValue: s, onValueChange: c, ...a }, g) => {
7
+ const [p, C] = S({
8
+ prop: o,
9
+ defaultProp: s,
10
+ onChange: c
11
+ });
12
+ return /* @__PURE__ */ l(
13
+ r.Root,
14
+ {
15
+ ref: g,
16
+ ...a,
17
+ className: f,
18
+ onValueChange: (n) => {
19
+ n && C(n);
20
+ },
21
+ value: p,
22
+ type: "single",
23
+ asChild: !1,
24
+ "aria-disabled": a.disabled,
25
+ children: [
26
+ e,
27
+ /* @__PURE__ */ t("div", { className: I })
28
+ ]
29
+ }
30
+ );
31
+ };
32
+ d.displayName = "SegmentedControl.Root";
33
+ const i = ({ children: e, ...o }, s) => /* @__PURE__ */ l(r.Item, { ref: s, ...o, className: y, asChild: !1, children: [
34
+ /* @__PURE__ */ t("span", { className: N }),
35
+ /* @__PURE__ */ l("span", { className: u, children: [
36
+ /* @__PURE__ */ t("span", { className: b, children: e }),
37
+ /* @__PURE__ */ t("span", { className: h, children: e })
38
+ ] })
39
+ ] });
40
+ i.displayName = "SegmentedControl.Item";
41
+ const j = {
42
+ Root: m(d),
43
+ Item: m(i)
55
44
  };
56
- m.displayName = "TextField.Root";
57
- const f = ({ name: s, className: i, ...e }, o) => /* @__PURE__ */ r(
58
- "div",
59
- {
60
- "data-slot": !0,
61
- "data-name": s,
62
- ...e,
63
- ref: o,
64
- className: n(T, i)
65
- }
66
- );
67
- f.displayName = "TextField.Slot";
68
- const x = d(m), k = d(f), w = x;
69
- w.Root = x;
70
- w.Slot = k;
71
45
  export {
72
- m as TextFieldRoot,
73
- f as TextFieldSlot,
74
- w as TextInput
46
+ j as SegmentedControl,
47
+ i as SegmentedControlItem,
48
+ d as SegmentedControlRoot
75
49
  };
76
50
  //# sourceMappingURL=fondue-components11.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components11.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 { inputStyles, loadingStatusStyles, rootStyles, slotStyles } from './styles/textInputStyles';\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(rootStyles, className)} data-status={status} data-test-id={dataTestId}>\n {status === 'loading' ? (\n <div className={loadingStatusStyles} 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={inputStyles}\n aria-invalid={status === 'error'}\n />\n\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className=\"tw-flex tw-text-text-positive tw-h-full tw-items-center tw-ml-3\"\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n\n {status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className=\"tw-flex tw-text-text-negative tw-h-full tw-items-center tw-ml-3\"\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(slotStyles, 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","rootStyles","loadingStatusStyles","jsx","mouseEvent","focusEvent","_a","blurEvent","inputStyles","IconCheckMark","IconExclamationMarkTriangle","TextFieldSlot","name","slotProps","forwardedRef","slotStyles","ForwardedRefTextFieldRoot","forwardRef","ForwardedRefTextFieldSlot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gBAAc,GAAGhB,CAAU;AAAA,MAAA;AAAA,IAAA,IAE/B;AAAA,IAEHH;AAAA,EACL,EAAA,CAAA;AAER;AACAD,EAAc,cAAc;AAQf,MAAAqB,IAAgB,CACzB,EAAE,MAAAC,GAAM,WAAApB,GAAW,GAAGqB,KACtBC,MAGI,gBAAAX;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,aAAW;AAAA,IACX,aAAWS;AAAA,IACV,GAAGC;AAAA,IACJ,KAAKC;AAAA,IACL,WAAWd,EAAGe,GAAYvB,CAAS;AAAA,EAAA;AAAA;AAK/CmB,EAAc,cAAc;AAE5B,MAAMK,IAA4BC,EAA6C3B,CAAa,GACtF4B,IAA4BD,EAA+CN,CAAa,GAEjFQ,IAGTH;AACJG,EAAU,OAAOH;AACjBG,EAAU,OAAOD;"}
1
+ {"version":3,"file":"fondue-components11.js","sources":["../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { useControllableState } from '#/hooks/useControllableState';\n\nimport {\n segmentedControlActiveIndicatorStyles,\n segmentedControlItemLabelActiveStyles,\n segmentedControlItemLabelInactiveStyles,\n segmentedControlItemLabelStyles,\n segmentedControlItemSeparatorStyles,\n segmentedControlItemStyles,\n segmentedControlRootStyles,\n} from './styles/segmentedControlStyles';\n\nexport type SegmentedControlRootProps = {\n id?: string;\n children: ReactNode;\n /**\n * The default value of the segmented control\n * Used for uncontrolled components\n */\n defaultValue: string;\n /**\n * The controlled value of the segmented control\n */\n value?: string;\n /**\n * Event handler called when the value changes\n */\n onValueChange?: (value: string) => void;\n /**\n * Disable the segmented control\n * @default false\n */\n disabled?: boolean;\n};\n\nexport const SegmentedControlRoot = (\n { children, value: propsValue, defaultValue, onValueChange, ...rootProps }: SegmentedControlRootProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const [value, setValue] = useControllableState({\n prop: propsValue,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n return (\n <ToggleGroupPrimitive.Root\n ref={ref}\n {...rootProps}\n className={segmentedControlRootStyles}\n onValueChange={(value) => {\n if (value) {\n setValue(value);\n }\n }}\n value={value}\n type=\"single\"\n asChild={false}\n aria-disabled={rootProps.disabled}\n >\n {children}\n {/* Active indicator */}\n <div className={segmentedControlActiveIndicatorStyles} />\n </ToggleGroupPrimitive.Root>\n );\n};\nSegmentedControlRoot.displayName = 'SegmentedControl.Root';\n\ntype SegmentedControlItemProps = {\n children: ReactNode;\n value: string;\n};\n\nexport const SegmentedControlItem = (\n { children, ...itemProps }: SegmentedControlItemProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => (\n <ToggleGroupPrimitive.Item ref={ref} {...itemProps} className={segmentedControlItemStyles} asChild={false}>\n {/* Separator */}\n <span className={segmentedControlItemSeparatorStyles} />\n <span className={segmentedControlItemLabelStyles}>\n {/* Active children */}\n <span className={segmentedControlItemLabelActiveStyles}>{children}</span>\n\n {/* Inactive children */}\n <span className={segmentedControlItemLabelInactiveStyles}>{children}</span>\n </span>\n </ToggleGroupPrimitive.Item>\n);\nSegmentedControlItem.displayName = 'SegmentedControl.Item';\n\nexport const SegmentedControl = {\n Root: forwardRef<HTMLDivElement, SegmentedControlRootProps>(SegmentedControlRoot),\n Item: forwardRef<HTMLButtonElement, SegmentedControlItemProps>(SegmentedControlItem),\n};\n"],"names":["SegmentedControlRoot","children","propsValue","defaultValue","onValueChange","rootProps","ref","value","setValue","useControllableState","jsxs","ToggleGroupPrimitive","segmentedControlRootStyles","jsx","segmentedControlActiveIndicatorStyles","SegmentedControlItem","itemProps","segmentedControlItemStyles","segmentedControlItemSeparatorStyles","segmentedControlItemLabelStyles","segmentedControlItemLabelActiveStyles","segmentedControlItemLabelInactiveStyles","SegmentedControl","forwardRef"],"mappings":";;;;;AAwCa,MAAAA,IAAuB,CAChC,EAAE,UAA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} from "react/jsx-runtime";
2
- import * as o from "@radix-ui/react-tooltip";
3
- import { forwardRef as l } from "react";
4
- import { cn as T } from "./fondue-components13.js";
5
- import { tooltipContentStyles as f, tooltipArrowStyles as g } from "./fondue-components25.js";
6
- const a = ({ children: i, enterDelay: e = 700 }) => /* @__PURE__ */ t(o.Provider, { children: /* @__PURE__ */ t(o.Root, { delayDuration: e, children: i }) });
7
- a.displayName = "Tooltip.Root";
8
- const d = ({ children: i, "data-test-id": e = "fondue-tooltip-content" }, r) => /* @__PURE__ */ t(o.Trigger, { "data-test-id": e, asChild: !0, ref: r, children: i });
9
- d.displayName = "Tooltip.Trigger";
10
- const s = ({
11
- children: i,
12
- className: e,
13
- maxWidth: r,
14
- "data-test-id": p = "fondue-tooltip-content",
15
- ...n
16
- }, m) => /* @__PURE__ */ t(o.Portal, { children: /* @__PURE__ */ c(
17
- o.Content,
18
- {
19
- "data-test-id": p,
20
- className: T(
21
- f({
22
- ...n
23
- }),
24
- e
25
- ),
26
- style: { maxWidth: r },
27
- collisionPadding: 16,
28
- sideOffset: 8,
29
- ref: m,
30
- ...n,
31
- children: [
32
- i,
33
- /* @__PURE__ */ t(o.Arrow, { asChild: !0, children: /* @__PURE__ */ t("div", { "aria-hidden": "true", className: g }) })
34
- ]
35
- }
36
- ) });
37
- s.displayName = "Tooltip.Content";
38
- const R = {
39
- Root: a,
40
- Trigger: l(d),
41
- Content: l(s)
1
+ import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
+ import { IconCaretDown as B } from "@frontify/fondue-icons";
3
+ import * as p from "@radix-ui/react-popover";
4
+ import { Slot as j } from "@radix-ui/react-slot";
5
+ import { useSelect as D } from "downshift";
6
+ import { forwardRef as M } from "react";
7
+ import { ForwardedRefCombobox as T } from "./fondue-components27.js";
8
+ import { ForwardedRefSelectItem as k, ForwardedRefSelectItemGroup as z } from "./fondue-components28.js";
9
+ import { SelectMenu as A } from "./fondue-components29.js";
10
+ import { ForwardedRefSelectSlot as O } from "./fondue-components30.js";
11
+ import r from "./fondue-components31.js";
12
+ import { useSelectData as V } from "./fondue-components32.js";
13
+ const n = ({
14
+ children: S,
15
+ onSelect: a,
16
+ value: f,
17
+ defaultValue: u,
18
+ placeholder: I = "",
19
+ disabled: m,
20
+ "aria-label": h,
21
+ "data-test-id": b = "fondue-select"
22
+ }, s) => {
23
+ const { inputSlots: g, menuSlots: N, items: x, clearButton: c, getItemByValue: i } = V(S), y = i(u), C = i(f), { getToggleButtonProps: R, getMenuProps: w, getItemProps: v, reset: F, selectedItem: l, isOpen: P, highlightedIndex: G } = D({
24
+ items: x,
25
+ defaultSelectedItem: y,
26
+ selectedItem: C,
27
+ onSelectedItemChange: ({ selectedItem: t }) => {
28
+ a && a(t.value);
29
+ },
30
+ itemToString: (t) => t ? t.label : ""
31
+ });
32
+ return /* @__PURE__ */ d(p.Root, { open: P, children: [
33
+ /* @__PURE__ */ o(p.Anchor, { asChild: !0, children: /* @__PURE__ */ d(
34
+ "div",
35
+ {
36
+ className: r.root,
37
+ "data-disabled": m,
38
+ "data-empty": !l,
39
+ "data-test-id": b,
40
+ ...m ? {} : R({
41
+ "aria-label": h,
42
+ ...s ? { ref: s } : {}
43
+ }),
44
+ children: [
45
+ /* @__PURE__ */ o("span", { className: r.input, children: l ? l.label : I }),
46
+ g,
47
+ c && /* @__PURE__ */ o(
48
+ j,
49
+ {
50
+ onClick: (t) => {
51
+ t.stopPropagation(), F();
52
+ },
53
+ className: r.clear,
54
+ children: c
55
+ }
56
+ ),
57
+ /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(B, { size: 16, className: r.caret }) })
58
+ ]
59
+ }
60
+ ) }),
61
+ /* @__PURE__ */ o(A, { highlightedIndex: G, getMenuProps: w, getItemProps: v, children: N })
62
+ ] });
42
63
  };
64
+ n.displayName = "Select";
65
+ const q = M(n), e = q;
66
+ e.displayName = "Select";
67
+ e.Combobox = T;
68
+ e.Combobox.displayName = "Select.Combobox";
69
+ e.Item = k;
70
+ e.Item.displayName = "Select.Item";
71
+ e.Group = z;
72
+ e.Group.displayName = "Select.Group";
73
+ e.Slot = O;
74
+ e.Slot.displayName = "Select.Slot";
43
75
  export {
44
- R as Tooltip,
45
- s as TooltipContent,
46
- a as TooltipRoot,
47
- d as TooltipTrigger
76
+ q as ForwardedRefSelect,
77
+ e as Select,
78
+ n as SelectInput
48
79
  };
49
80
  //# sourceMappingURL=fondue-components12.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components12.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 { tooltipArrowStyles, tooltipContentStyles } from './styles/tooltipStyles';\n\nexport type TooltipRootProps = {\n enterDelay?: number;\n children: Array<ReactElement<TooltipTriggerProps | TooltipContentProps>>;\n};\nexport type TooltipTriggerProps = { children: ReactNode; 'data-test-id'?: string };\nexport type TooltipContentProps = {\n /**\n * @default spacious\n */\n padding?: 'spacious' | 'compact';\n /**\n * Defines the preffered 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 TooltipRoot = ({ children, enterDelay = 700 }: TooltipRootProps) => {\n return (\n <RadixTooltip.Provider>\n <RadixTooltip.Root delayDuration={enterDelay}>{children}</RadixTooltip.Root>\n </RadixTooltip.Provider>\n );\n};\nTooltipRoot.displayName = 'Tooltip.Root';\n\nexport const TooltipTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-tooltip-content' }: TooltipTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixTooltip.Trigger data-test-id={dataTestId} asChild ref={ref}>\n {children}\n </RadixTooltip.Trigger>\n );\n};\nTooltipTrigger.displayName = 'Tooltip.Trigger';\n\nexport const TooltipContent = (\n {\n children,\n className,\n maxWidth,\n 'data-test-id': dataTestId = 'fondue-tooltip-content',\n ...props\n }: TooltipContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixTooltip.Portal>\n <RadixTooltip.Content\n data-test-id={dataTestId}\n className={cn(\n tooltipContentStyles({\n ...props,\n }),\n className,\n )}\n style={{ maxWidth }}\n collisionPadding={16}\n sideOffset={8}\n ref={ref}\n {...props}\n >\n {children}\n\n <RadixTooltip.Arrow asChild>\n <div aria-hidden=\"true\" className={tooltipArrowStyles} />\n </RadixTooltip.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","jsx","RadixTooltip","TooltipTrigger","dataTestId","ref","TooltipContent","className","maxWidth","props","jsxs","cn","tooltipContentStyles","tooltipArrowStyles","Tooltip","forwardRef"],"mappings":";;;;;AA6BO,MAAMA,IAAc,CAAC,EAAE,UAAAC,GAAU,YAAAC,IAAa,UAE7C,gBAAAC,EAACC,EAAa,UAAb,EACG,UAAA,gBAAAD,EAACC,EAAa,MAAb,EAAkB,eAAeF,GAAa,UAAAD,EAAS,CAAA,EAC5D,CAAA;AAGRD,EAAY,cAAc;AAEb,MAAAK,IAAiB,CAC1B,EAAE,UAAAJ,GAAU,gBAAgBK,IAAa,4BACzCC,MAGI,gBAAAJ,EAACC,EAAa,SAAb,EAAqB,gBAAcE,GAAY,SAAO,IAAC,KAAAC,GACnD,UAAAN,EACL,CAAA;AAGRI,EAAe,cAAc;AAEtB,MAAMG,IAAiB,CAC1B;AAAA,EACI,UAAAP;AAAA,EACA,WAAAQ;AAAA,EACA,UAAAC;AAAA,EACA,gBAAgBJ,IAAa;AAAA,EAC7B,GAAGK;AACP,GACAJ,MAGI,gBAAAJ,EAACC,EAAa,QAAb,EACG,UAAA,gBAAAQ;AAAA,EAACR,EAAa;AAAA,EAAb;AAAA,IACG,gBAAcE;AAAA,IACd,WAAWO;AAAA,MACPC,EAAqB;AAAA,QACjB,GAAGH;AAAA,MAAA,CACN;AAAA,MACDF;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAAC,EAAS;AAAA,IAClB,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,KAAAH;AAAA,IACC,GAAGI;AAAA,IAEH,UAAA;AAAA,MAAAV;AAAA,MAEA,gBAAAE,EAAAC,EAAa,OAAb,EAAmB,SAAO,IACvB,UAAC,gBAAAD,EAAA,OAAA,EAAI,eAAY,QAAO,WAAWY,EAAA,CAAoB,EAC3D,CAAA;AAAA,IAAA;AAAA,EAAA;AAER,EAAA,CAAA;AAGRP,EAAe,cAAc;AAEtB,MAAMQ,IAAU;AAAA,EACnB,MAAMhB;AAAA,EACN,SAASiB,EAAmDZ,CAAc;AAAA,EAC1E,SAASY,EAAgDT,CAAc;AAC3E;"}
1
+ {"version":3,"file":"fondue-components12.js","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useSelect } from 'downshift';\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefCombobox } from './Combobox';\nimport { ForwardedRefSelectItem, ForwardedRefSelectItemGroup } from './SelectItem';\nimport { SelectMenu } from './SelectMenu';\nimport { ForwardedRefSelectSlot } from './SelectSlot';\nimport styles from './styles/select.module.scss';\nimport { useSelectData } from './useSelectData';\n\nexport type SelectComponentProps = {\n /**\n * Children of the Select component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu.\n */\n children?: ReactNode;\n /**\n * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string) => void;\n /**\n * The active value in the select component. This is used to control the select externally.\n */\n value?: string;\n /**\n * The default value of the select component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the select component.\n */\n placeholder?: string;\n /**\n * Disables the select component.\n */\n disabled?: boolean;\n /**\n * The aria label of the select component.\n */\n 'aria-label'?: string;\n /**\n * The data test id of the select component.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectInput = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n disabled,\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'fondue-select',\n }: SelectComponentProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, clearButton, getItemByValue } = useSelectData(children);\n\n const defaultItem = getItemByValue(defaultValue);\n const activeItem = getItemByValue(value);\n\n const { getToggleButtonProps, getMenuProps, getItemProps, reset, selectedItem, isOpen, highlightedIndex } =\n useSelect({\n items,\n defaultSelectedItem: defaultItem,\n selectedItem: activeItem,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect && onSelect(selectedItem.value);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor asChild>\n <div\n className={styles.root}\n data-disabled={disabled}\n data-empty={!selectedItem}\n data-test-id={dataTestId}\n {...(disabled\n ? {}\n : getToggleButtonProps({\n 'aria-label': ariaLabel,\n ...(forwardedRef ? { ref: forwardedRef } : {}),\n }))}\n >\n <span className={styles.input}>{selectedItem ? selectedItem.label : placeholder}</span>\n {inputSlots}\n {clearButton && (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n >\n {clearButton}\n </RadixSlot>\n )}\n <div>\n <IconCaretDown size={16} className={styles.caret} />\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu highlightedIndex={highlightedIndex} getMenuProps={getMenuProps} getItemProps={getItemProps}>\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectInput.displayName = 'Select';\n\nexport const ForwardedRefSelect = forwardRef<HTMLDivElement, SelectComponentProps>(SelectInput);\n\n// @ts-expect-error We support both Select and Select.Combobox as the Root\nexport const Select: typeof SelectInput & {\n Combobox: typeof ForwardedRefCombobox;\n Item: typeof ForwardedRefSelectItem;\n Group: typeof ForwardedRefSelectItemGroup;\n Slot: typeof ForwardedRefSelectSlot;\n} = ForwardedRefSelect;\nSelect.displayName = 'Select';\nSelect.Combobox = ForwardedRefCombobox;\nSelect.Combobox.displayName = 'Select.Combobox';\nSelect.Item = ForwardedRefSelectItem;\nSelect.Item.displayName = 'Select.Item';\nSelect.Group = ForwardedRefSelectItemGroup;\nSelect.Group.displayName = 'Select.Group';\nSelect.Slot = ForwardedRefSelectSlot;\nSelect.Slot.displayName = 'Select.Slot';\n"],"names":["SelectInput","children","onSelect","value","defaultValue","placeholder","disabled","ariaLabel","dataTestId","forwardedRef","inputSlots","menuSlots","items","clearButton","getItemByValue","useSelectData","defaultItem","activeItem","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","useSelect","item","jsxs","RadixPopover","jsx","styles","RadixSlot","event","IconCaretDown","SelectMenu","ForwardedRefSelect","forwardRef","Select","ForwardedRefCombobox","ForwardedRefSelectItem","ForwardedRefSelectItemGroup","ForwardedRefSelectSlot"],"mappings":";;;;;;;;;;;;AAkDO,MAAMA,IAAc,CACvB;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC;AAAA,EACA,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,aAAAC,GAAa,gBAAAC,EAAe,IAAIC,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AA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,IAEC,gBAAAD,EAAAK,GAAA,EAAW,kBAAAV,GAAoC,cAAAL,GAA4B,cAAAC,GACvE,UACLT,GAAA;AAAA,EACJ,EAAA,CAAA;AAER;AACAX,EAAY,cAAc;AAEb,MAAAmC,IAAqBC,EAAiDpC,CAAW,GAGjFqC,IAKTF;AACJE,EAAO,cAAc;AACrBA,EAAO,WAAWC;AAClBD,EAAO,SAAS,cAAc;AAC9BA,EAAO,OAAOE;AACdF,EAAO,KAAK,cAAc;AAC1BA,EAAO,QAAQG;AACfH,EAAO,MAAM,cAAc;AAC3BA,EAAO,OAAOI;AACdJ,EAAO,KAAK,cAAc;"}
@@ -1,15 +1,69 @@
1
- import { extendTailwindMerge as e } from "./fondue-components26.js";
2
- import { tv as o } from "./fondue-components27.js";
3
- const r = e({
4
- prefix: "tw-",
5
- extend: {
6
- classGroups: {
7
- "font-size": ["text-body-x-small", "text-body-small", "text-body-medium", "text-body-large"]
8
- }
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-components15.js";
5
+ import r from "./fondue-components33.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)
9
58
  }
10
- }), m = (...t) => r(...t), x = (t) => o(t);
59
+ );
60
+ u.displayName = "TextField.Slot";
61
+ const x = n(f), T = n(u), F = x;
62
+ F.Root = x;
63
+ F.Slot = T;
11
64
  export {
12
- m as cn,
13
- x as sv
65
+ f as TextFieldRoot,
66
+ u as TextFieldSlot,
67
+ F as TextInput
14
68
  };
15
69
  //# sourceMappingURL=fondue-components13.js.map