@frontify/fondue-components 19.0.0 → 20.0.0-beta.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 (56) hide show
  1. package/dist/fondue-components10.js +18 -16
  2. package/dist/fondue-components10.js.map +1 -1
  3. package/dist/fondue-components16.js +13 -13
  4. package/dist/fondue-components16.js.map +1 -1
  5. package/dist/fondue-components25.js +57 -57
  6. package/dist/fondue-components25.js.map +1 -1
  7. package/dist/fondue-components28.js +14 -14
  8. package/dist/fondue-components28.js.map +1 -1
  9. package/dist/fondue-components29.js +6 -6
  10. package/dist/fondue-components29.js.map +1 -1
  11. package/dist/fondue-components31.js +5 -5
  12. package/dist/fondue-components32.js +2 -2
  13. package/dist/fondue-components33.js +1 -1
  14. package/dist/fondue-components34.js.map +1 -1
  15. package/dist/fondue-components37.js +28 -28
  16. package/dist/fondue-components37.js.map +1 -1
  17. package/dist/fondue-components38.js +18 -18
  18. package/dist/fondue-components38.js.map +1 -1
  19. package/dist/fondue-components39.js +19 -19
  20. package/dist/fondue-components39.js.map +1 -1
  21. package/dist/fondue-components40.js +8 -8
  22. package/dist/fondue-components40.js.map +1 -1
  23. package/dist/fondue-components44.js +1 -1
  24. package/dist/fondue-components48.js +4 -4
  25. package/dist/fondue-components49.js +2 -2
  26. package/dist/fondue-components49.js.map +1 -1
  27. package/dist/fondue-components51.js +7 -7
  28. package/dist/fondue-components53.js +12 -12
  29. package/dist/fondue-components55.js +16 -16
  30. package/dist/fondue-components56.js +7 -7
  31. package/dist/fondue-components56.js.map +1 -1
  32. package/dist/fondue-components57.js +4 -4
  33. package/dist/fondue-components58.js +6 -6
  34. package/dist/fondue-components61.js +1 -1
  35. package/dist/fondue-components66.js +21 -21
  36. package/dist/fondue-components68.js +1 -1
  37. package/dist/fondue-components69.js +2 -2
  38. package/dist/fondue-components71.js +6 -6
  39. package/dist/fondue-components72.js +25 -11
  40. package/dist/fondue-components72.js.map +1 -1
  41. package/dist/fondue-components74.js +3 -3
  42. package/dist/fondue-components75.js +23 -23
  43. package/dist/fondue-components76.js +4 -4
  44. package/dist/fondue-components77.js +6 -4
  45. package/dist/fondue-components77.js.map +1 -1
  46. package/dist/fondue-components78.js +4 -4
  47. package/dist/fondue-components79.js +5 -2
  48. package/dist/fondue-components79.js.map +1 -1
  49. package/dist/fondue-components80.js +4 -4
  50. package/dist/fondue-components80.js.map +1 -1
  51. package/dist/fondue-components81.js +2 -5
  52. package/dist/fondue-components81.js.map +1 -1
  53. package/dist/fondue-components82.js +10 -10
  54. package/dist/index.d.ts +9 -3
  55. package/dist/style.css +1 -1
  56. package/package.json +7 -5
@@ -1,39 +1,41 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import * as n from "@radix-ui/react-separator";
3
- import { forwardRef as p } from "react";
4
- import { cn as f } from "./fondue-components36.js";
5
- import { dividerStyles as l } from "./fondue-components49.js";
6
- const c = p(
2
+ import * as p from "@radix-ui/react-separator";
3
+ import { forwardRef as f } from "react";
4
+ import { cn as l } from "./fondue-components36.js";
5
+ import { dividerStyles as c } from "./fondue-components49.js";
6
+ const v = f(
7
7
  ({
8
8
  "data-test-id": o = "fondue-divider",
9
9
  direction: t = "horizontal",
10
10
  className: i,
11
11
  variant: e,
12
12
  as: d = "div",
13
- ...a
14
- }, m) => {
15
- const s = d;
13
+ decorative: a,
14
+ ...m
15
+ }, s) => {
16
+ const n = d;
16
17
  return /* @__PURE__ */ r(
17
- n.Root,
18
+ p.Root,
18
19
  {
19
- ref: m,
20
- className: f(
21
- l({
20
+ ref: s,
21
+ className: l(
22
+ c({
22
23
  direction: t,
23
24
  variant: e,
24
- ...a
25
+ ...m
25
26
  }),
26
27
  i
27
28
  ),
28
29
  "data-test-id": o,
30
+ decorative: a,
29
31
  asChild: !0,
30
- children: /* @__PURE__ */ r(s, {})
32
+ children: /* @__PURE__ */ r(n, {})
31
33
  }
32
34
  );
33
35
  }
34
36
  );
35
- c.displayName = "Divider";
37
+ v.displayName = "Divider";
36
38
  export {
37
- c as Divider
39
+ v as Divider
38
40
  };
39
41
  //# sourceMappingURL=fondue-components10.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components10.js","sources":["../src/components/Divider/Divider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as Separator from '@radix-ui/react-separator';\nimport { forwardRef, type ForwardedRef, type ReactElement } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nimport { dividerStyles } from './styles/dividerStyles';\n\ntype DividerStyle = 'noline' | 'dashed' | 'solid';\ntype DividerPadding = 'none' | 'small' | 'medium' | 'large';\ntype DividerDirection = 'horizontal' | 'vertical';\ntype DividerColor = 'weak' | 'default' | 'strong' | 'x-strong';\n\nexport type DividerProps = {\n /**\n * The style of the divider\n * @default \"solid\"\n */\n variant?: DividerStyle;\n /**\n * The padding of the divider\n * @default \"medium\"\n */\n padding?: DividerPadding;\n /**\n * The color of the divider\n * @default \"default\"\n */\n color?: DividerColor;\n /**\n * The direction of the divider\n * @default \"horizontal\"\n */\n direction?: DividerDirection;\n /**\n * The html element to be used\n * @default \"div\"\n */\n as?: 'div' | 'li';\n 'data-test-id'?: string;\n className?: string;\n};\n\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(\n (\n {\n 'data-test-id': dataTestId = 'fondue-divider',\n direction = 'horizontal',\n className,\n variant,\n as = 'div',\n ...props\n }: DividerProps,\n ref: ForwardedRef<HTMLDivElement | null>,\n ): ReactElement => {\n const Component = as;\n\n return (\n <Separator.Root\n ref={ref}\n className={cn(\n dividerStyles({\n direction,\n variant,\n ...props,\n }),\n className,\n )}\n data-test-id={dataTestId}\n asChild\n >\n <Component />\n </Separator.Root>\n );\n },\n);\n\nDivider.displayName = 'Divider';\n"],"names":["Divider","forwardRef","dataTestId","direction","className","variant","as","props","ref","Component","jsx","Separator","cn","dividerStyles"],"mappings":";;;;;AA4CO,MAAMA,IAAUC;AAAA,EACnB,CACI;AAAA,IACI,gBAAgBC,IAAa;AAAA,IAC7B,WAAAC,IAAY;AAAA,IACZ,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,IAAAC,IAAK;AAAA,IACL,GAAGC;AAAA,KAEPC,MACe;AACf,UAAMC,IAAYH;AAGd,WAAA,gBAAAI;AAAA,MAACC,EAAU;AAAA,MAAV;AAAA,QACG,KAAAH;AAAA,QACA,WAAWI;AAAA,UACPC,EAAc;AAAA,YACV,WAAAV;AAAA,YACA,SAAAE;AAAA,YACA,GAAGE;AAAA,UAAA,CACN;AAAA,UACDH;AAAA,QACJ;AAAA,QACA,gBAAcF;AAAA,QACd,SAAO;AAAA,QAEP,4BAACO,GAAU,CAAA,CAAA;AAAA,MAAA;AAAA,IACf;AAAA,EAAA;AAGZ;AAEAT,EAAQ,cAAc;"}
1
+ {"version":3,"file":"fondue-components10.js","sources":["../src/components/Divider/Divider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as Separator from '@radix-ui/react-separator';\nimport { forwardRef, type ForwardedRef, type ReactElement } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nimport { dividerStyles } from './styles/dividerStyles';\n\ntype DividerStyle = 'noline' | 'dashed' | 'solid';\ntype DividerPadding = 'none' | 'small' | 'medium' | 'large';\ntype DividerDirection = 'horizontal' | 'vertical';\ntype DividerColor = 'weak' | 'default' | 'strong' | 'x-strong';\n\nexport type DividerProps = {\n /**\n * The style of the divider\n * @default \"solid\"\n */\n variant?: DividerStyle;\n /**\n * The padding of the divider\n * @default \"medium\"\n */\n padding?: DividerPadding;\n /**\n * The color of the divider\n * @default \"default\"\n */\n color?: DividerColor;\n /**\n * The direction of the divider\n * @default \"horizontal\"\n */\n direction?: DividerDirection;\n /**\n * The html element to be used\n * @default \"div\"\n */\n as?: 'div' | 'li';\n /**\n * When `true`, signifies that it is purely visual, carries no semantic\n * meaning, and ensures it is not present in the accessibility tree.\n * @default false\n */\n decorative?: boolean;\n 'data-test-id'?: string;\n className?: string;\n};\n\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(\n (\n {\n 'data-test-id': dataTestId = 'fondue-divider',\n direction = 'horizontal',\n className,\n variant,\n as = 'div',\n decorative,\n ...props\n }: DividerProps,\n ref: ForwardedRef<HTMLDivElement | null>,\n ): ReactElement => {\n const Component = as;\n\n return (\n <Separator.Root\n ref={ref}\n className={cn(\n dividerStyles({\n direction,\n variant,\n ...props,\n }),\n className,\n )}\n data-test-id={dataTestId}\n decorative={decorative}\n asChild\n >\n <Component />\n </Separator.Root>\n );\n },\n);\n\nDivider.displayName = 'Divider';\n"],"names":["Divider","forwardRef","dataTestId","direction","className","variant","as","decorative","props","ref","Component","jsx","Separator","cn","dividerStyles"],"mappings":";;;;;AAkDO,MAAMA,IAAUC;AAAA,EACnB,CACI;AAAA,IACI,gBAAgBC,IAAa;AAAA,IAC7B,WAAAC,IAAY;AAAA,IACZ,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,IAAAC,IAAK;AAAA,IACL,YAAAC;AAAA,IACA,GAAGC;AAAA,KAEPC,MACe;AACf,UAAMC,IAAYJ;AAGd,WAAA,gBAAAK;AAAA,MAACC,EAAU;AAAA,MAAV;AAAA,QACG,KAAAH;AAAA,QACA,WAAWI;AAAA,UACPC,EAAc;AAAA,YACV,WAAAX;AAAA,YACA,SAAAE;AAAA,YACA,GAAGG;AAAA,UAAA,CACN;AAAA,UACDJ;AAAA,QACJ;AAAA,QACA,gBAAcF;AAAA,QACd,YAAAK;AAAA,QACA,SAAO;AAAA,QAEP,4BAACG,GAAU,CAAA,CAAA;AAAA,MAAA;AAAA,IACf;AAAA,EAAA;AAGZ;AAEAV,EAAQ,cAAc;"}
@@ -1,31 +1,31 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import * as n from "@radix-ui/react-label";
3
- import { forwardRef as s } from "react";
4
- import { cn as w } from "./fondue-components36.js";
5
- const m = ({ className: r, "data-test-id": d = "fondue-label", ...a }, i) => /* @__PURE__ */ l(
3
+ import { forwardRef as m } from "react";
4
+ import { cn as s } from "./fondue-components36.js";
5
+ const w = ({ className: o, "data-test-id": d = "fondue-label", ...r }, i) => /* @__PURE__ */ l(
6
6
  n.Root,
7
7
  {
8
8
  ref: i,
9
- "data-required": a.required,
10
- className: w(
11
- 'tw-group tw-flex tw-gap-1 tw-font-body--stack tw-font-normal peer-data-[state="checked"]:tw-font-medium peer-data-[state="indeterminate"]:tw-font-medium tw-text-body-medium tw-text-text-weak peer-hover:tw-text-text has-[+_*_input:hover:not(:disabled)]:tw-text-text tw-transition-colors',
9
+ "data-required": r.required,
10
+ className: s(
11
+ 'tw-group tw-flex tw-gap-1 tw-font-primary tw-font-normal peer-data-[state="checked"]:tw-font-medium peer-data-[state="indeterminate"]:tw-font-medium tw-body-small tw-text-secondary peer-hover:tw-text-primary has-[+_*_input:hover:not(:disabled)]:tw-text-primary tw-transition-colors',
12
12
  // Disabled state if siblings has disabled state
13
- "has-[+_*_:disabled]:tw-text-text-disabled has-[~_:disabled]:tw-cursor-not-allowed peer-disabled:tw-text-text-disabled peer-disabled:tw-cursor-not-allowed",
13
+ "has-[+_*_:disabled]:tw-text-disabled has-[~_:disabled]:tw-cursor-not-allowed peer-disabled:tw-text-disabled peer-disabled:tw-cursor-not-allowed",
14
14
  // Required asterisk
15
- 'after:tw-hidden data-[required="true"]:after:tw-flex after:tw-content-["*"] after:-tw-ml-1 after:tw-font-body--stack after:tw-text-body-small after:tw-font-medium after:tw-text-text-negative group-hover:tw-text-text-negative-hover',
16
- r
15
+ 'after:tw-hidden data-[required="true"]:after:tw-flex after:tw-content-["*"] after:-tw-ml-1 after:tw-font-primary after:tw-text-small after:tw-font-medium after:tw-text-error group-hover:tw-text-error-hover',
16
+ o
17
17
  ),
18
18
  "data-test-id": d,
19
19
  onClick: (t) => {
20
- const o = t.target.getAttribute("for"), e = o ? document.getElementById(o) : null;
20
+ const a = t.target.getAttribute("for"), e = a ? document.getElementById(a) : null;
21
21
  e && e.getAttribute("role") === "combobox" && (t.preventDefault(), t.stopPropagation(), e.click());
22
22
  },
23
- ...a
23
+ ...r
24
24
  }
25
- ), f = s(m);
25
+ ), f = m(w);
26
26
  f.displayName = "Label";
27
27
  export {
28
28
  f as Label,
29
- m as LabelComponent
29
+ w as LabelComponent
30
30
  };
31
31
  //# sourceMappingURL=fondue-components16.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components16.js","sources":["../src/components/Label/Label.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { type ForwardedRef, forwardRef, type MouseEventHandler, type ReactNode } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nexport type LabelProps = {\n id?: string;\n children: ReactNode;\n /**\n * The id of the input element the label is associated with\n */\n htmlFor: string;\n /**\n * Add an asterisk to the label to indicate it is required\n * @default false\n */\n required?: boolean;\n className?: string;\n onClick?: MouseEventHandler<HTMLLabelElement>;\n 'data-test-id'?: string;\n};\n\nexport const LabelComponent = (\n { className, 'data-test-id': dataTestId = 'fondue-label', ...props }: LabelProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) => {\n return (\n <LabelPrimitive.Root\n ref={ref}\n data-required={props.required}\n className={cn(\n 'tw-group tw-flex tw-gap-1 tw-font-body--stack tw-font-normal peer-data-[state=\"checked\"]:tw-font-medium peer-data-[state=\"indeterminate\"]:tw-font-medium tw-text-body-medium tw-text-text-weak peer-hover:tw-text-text has-[+_*_input:hover:not(:disabled)]:tw-text-text tw-transition-colors',\n // Disabled state if siblings has disabled state\n 'has-[+_*_:disabled]:tw-text-text-disabled has-[~_:disabled]:tw-cursor-not-allowed peer-disabled:tw-text-text-disabled peer-disabled:tw-cursor-not-allowed',\n // Required asterisk\n 'after:tw-hidden data-[required=\"true\"]:after:tw-flex after:tw-content-[\"*\"] after:-tw-ml-1 after:tw-font-body--stack after:tw-text-body-small after:tw-font-medium after:tw-text-text-negative group-hover:tw-text-text-negative-hover',\n className,\n )}\n data-test-id={dataTestId}\n onClick={(event) => {\n // Add support of Select component, Radix only allows native `select`\n // but we use `div[role=combobox]` because of downshift\n // https://github.com/radix-ui/primitives/blob/6e75e117977c9e6ffa939e6951a707f16ba0f95e/packages/react/label/src/label.tsx#L22\n const targetId = (event.target as HTMLElement).getAttribute('for');\n const target = targetId ? document.getElementById(targetId) : null;\n\n if (target && target.getAttribute('role') === 'combobox') {\n event.preventDefault();\n event.stopPropagation();\n target.click();\n }\n }}\n {...props}\n />\n );\n};\n\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(LabelComponent);\nLabel.displayName = 'Label';\n"],"names":["LabelComponent","className","dataTestId","props","ref","jsx","LabelPrimitive","cn","event","targetId","target","Label","forwardRef"],"mappings":";;;;AAwBa,MAAAA,IAAiB,CAC1B,EAAE,WAAAC,GAAW,gBAAgBC,IAAa,gBAAgB,GAAGC,EAAM,GACnEC,MAGI,gBAAAC;AAAA,EAACC,EAAe;AAAA,EAAf;AAAA,IACG,KAAAF;AAAA,IACA,iBAAeD,EAAM;AAAA,IACrB,WAAWI;AAAA,MACP;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,MACAN;AAAA,IACJ;AAAA,IACA,gBAAcC;AAAA,IACd,SAAS,CAACM,MAAU;AAIhB,YAAMC,IAAYD,EAAM,OAAuB,aAAa,KAAK,GAC3DE,IAASD,IAAW,SAAS,eAAeA,CAAQ,IAAI;AAE9D,MAAIC,KAAUA,EAAO,aAAa,MAAM,MAAM,eAC1CF,EAAM,eAAe,GACrBA,EAAM,gBAAgB,GACtBE,EAAO,MAAM;AAAA,IAErB;AAAA,IACC,GAAGP;AAAA,EAAA;AACR,GAIKQ,IAAQC,EAAyCZ,CAAc;AAC5EW,EAAM,cAAc;"}
1
+ {"version":3,"file":"fondue-components16.js","sources":["../src/components/Label/Label.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { type ForwardedRef, forwardRef, type MouseEventHandler, type ReactNode } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nexport type LabelProps = {\n id?: string;\n children: ReactNode;\n /**\n * The id of the input element the label is associated with\n */\n htmlFor: string;\n /**\n * Add an asterisk to the label to indicate it is required\n * @default false\n */\n required?: boolean;\n className?: string;\n onClick?: MouseEventHandler<HTMLLabelElement>;\n 'data-test-id'?: string;\n};\n\nexport const LabelComponent = (\n { className, 'data-test-id': dataTestId = 'fondue-label', ...props }: LabelProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) => {\n return (\n <LabelPrimitive.Root\n ref={ref}\n data-required={props.required}\n className={cn(\n 'tw-group tw-flex tw-gap-1 tw-font-primary tw-font-normal peer-data-[state=\"checked\"]:tw-font-medium peer-data-[state=\"indeterminate\"]:tw-font-medium tw-body-small tw-text-secondary peer-hover:tw-text-primary has-[+_*_input:hover:not(:disabled)]:tw-text-primary tw-transition-colors',\n // Disabled state if siblings has disabled state\n 'has-[+_*_:disabled]:tw-text-disabled has-[~_:disabled]:tw-cursor-not-allowed peer-disabled:tw-text-disabled peer-disabled:tw-cursor-not-allowed',\n // Required asterisk\n 'after:tw-hidden data-[required=\"true\"]:after:tw-flex after:tw-content-[\"*\"] after:-tw-ml-1 after:tw-font-primary after:tw-text-small after:tw-font-medium after:tw-text-error group-hover:tw-text-error-hover',\n className,\n )}\n data-test-id={dataTestId}\n onClick={(event) => {\n // Add support of Select component, Radix only allows native `select`\n // but we use `div[role=combobox]` because of downshift\n // https://github.com/radix-ui/primitives/blob/6e75e117977c9e6ffa939e6951a707f16ba0f95e/packages/react/label/src/label.tsx#L22\n const targetId = (event.target as HTMLElement).getAttribute('for');\n const target = targetId ? document.getElementById(targetId) : null;\n\n if (target && target.getAttribute('role') === 'combobox') {\n event.preventDefault();\n event.stopPropagation();\n target.click();\n }\n }}\n {...props}\n />\n );\n};\n\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(LabelComponent);\nLabel.displayName = 'Label';\n"],"names":["LabelComponent","className","dataTestId","props","ref","jsx","LabelPrimitive","cn","event","targetId","target","Label","forwardRef"],"mappings":";;;;AAwBa,MAAAA,IAAiB,CAC1B,EAAE,WAAAC,GAAW,gBAAgBC,IAAa,gBAAgB,GAAGC,EAAM,GACnEC,MAGI,gBAAAC;AAAA,EAACC,EAAe;AAAA,EAAf;AAAA,IACG,KAAAF;AAAA,IACA,iBAAeD,EAAM;AAAA,IACrB,WAAWI;AAAA,MACP;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,MACAN;AAAA,IACJ;AAAA,IACA,gBAAcC;AAAA,IACd,SAAS,CAACM,MAAU;AAIhB,YAAMC,IAAYD,EAAM,OAAuB,aAAa,KAAK,GAC3DE,IAASD,IAAW,SAAS,eAAeA,CAAQ,IAAI;AAE9D,MAAIC,KAAUA,EAAO,aAAa,MAAM,MAAM,eAC1CF,EAAM,eAAe,GACrBA,EAAM,gBAAgB,GACtBE,EAAO,MAAM;AAAA,IAErB;AAAA,IACC,GAAGP;AAAA,EAAA;AACR,GAIKQ,IAAQC,EAAyCZ,CAAc;AAC5EW,EAAM,cAAc;"}
@@ -1,155 +1,155 @@
1
1
  import { jsx as t, jsxs as p } from "react/jsx-runtime";
2
- import { IconArrowUp as A, IconArrowDown as K, IconArrowBidirectional as h } from "@frontify/fondue-icons";
3
- import { forwardRef as b, useRef as w, useMemo as j } from "react";
2
+ import { IconArrowUp as A, IconArrowDown as K, IconArrowBidirectional as E } from "@frontify/fondue-icons";
3
+ import { forwardRef as b, useRef as w, useMemo as h } from "react";
4
4
  import { useSyncRefs as g } from "./fondue-components46.js";
5
5
  import { useTextTruncation as N } from "./fondue-components70.js";
6
- import { Box as L } from "./fondue-components5.js";
7
- import { LoadingCircle as S } from "./fondue-components18.js";
8
- import i from "./fondue-components71.js";
9
- import { handleKeyDown as $ } from "./fondue-components72.js";
6
+ import { Box as j } from "./fondue-components5.js";
7
+ import { LoadingCircle as L } from "./fondue-components18.js";
8
+ import o from "./fondue-components71.js";
9
+ import { handleKeyDown as S, isEventFromInteractiveElement as $ } from "./fondue-components72.js";
10
10
  const R = b(
11
- ({ layout: a = "auto", fontSize: e = "medium", sticky: d, children: r, ...o }, l) => /* @__PURE__ */ t("div", { onKeyDown: $, role: "grid", tabIndex: -1, children: /* @__PURE__ */ t(
11
+ ({ layout: a = "auto", fontSize: e = "medium", sticky: d, children: s, ...n }, l) => /* @__PURE__ */ t("div", { onKeyDown: S, role: "grid", tabIndex: -1, children: /* @__PURE__ */ t(
12
12
  "table",
13
13
  {
14
14
  ref: l,
15
- className: i.table,
15
+ className: o.table,
16
16
  "data-layout": a,
17
17
  "data-font-size": e,
18
18
  "data-sticky": d,
19
- ...o,
20
- children: r
19
+ ...n,
20
+ children: s
21
21
  }
22
22
  ) })
23
23
  );
24
24
  R.displayName = "Table.Root";
25
- const C = b(({ children: a }, e) => /* @__PURE__ */ t("caption", { ref: e, className: i.caption, children: a }));
26
- C.displayName = "Table.Caption";
27
- const x = b(
28
- ({ children: a, "aria-label": e, "aria-busy": d }, r) => /* @__PURE__ */ t("thead", { ref: r, className: i.header, "aria-label": e, "aria-busy": d, children: a })
25
+ const v = b(({ children: a }, e) => /* @__PURE__ */ t("caption", { ref: e, className: o.caption, children: a }));
26
+ v.displayName = "Table.Caption";
27
+ const C = b(
28
+ ({ children: a, "aria-label": e, "aria-busy": d }, s) => /* @__PURE__ */ t("thead", { ref: s, className: o.header, "aria-label": e, "aria-busy": d, children: a })
29
29
  );
30
- x.displayName = "Table.Header";
31
- const v = b(
30
+ C.displayName = "Table.Header";
31
+ const x = b(
32
32
  ({
33
33
  noShrink: a = !1,
34
34
  truncate: e = !1,
35
35
  align: d = "left",
36
- scope: r = "col",
37
- sortTranslations: o,
36
+ scope: s = "col",
37
+ sortTranslations: n,
38
38
  sortDirection: l,
39
39
  colSpan: c,
40
40
  width: m,
41
41
  state: f = "idle",
42
42
  loadingStateAriaLabel: u,
43
- onSortChange: s,
44
- children: n
43
+ onSortChange: i,
44
+ children: r
45
45
  }, k) => {
46
46
  const y = w(null);
47
47
  g(y, k), N(y);
48
- const z = j(() => typeof n == "string" ? l === "ascending" ? (o == null ? void 0 : o.sortDescending) ?? `Sort by ${n} descending` : (o == null ? void 0 : o.sortAscending) ?? `Sort by ${n} ascending` : l === "ascending" ? "Sort descending" : "Sort ascending", [n, l, o]), B = () => {
49
- if (!s)
48
+ const z = h(() => typeof r == "string" ? l === "ascending" ? (n == null ? void 0 : n.sortDescending) ?? `Sort by ${r} descending` : (n == null ? void 0 : n.sortAscending) ?? `Sort by ${r} ascending` : l === "ascending" ? "Sort descending" : "Sort ascending", [r, l, n]), B = () => {
49
+ if (!i)
50
50
  return;
51
- s(l === void 0 || l === "descending" ? "ascending" : "descending");
51
+ i(l === void 0 || l === "descending" ? "ascending" : "descending");
52
52
  };
53
53
  return /* @__PURE__ */ t(
54
54
  "th",
55
55
  {
56
56
  ref: y,
57
57
  style: { width: m },
58
- className: i.headerCell,
59
- scope: r,
58
+ className: o.headerCell,
59
+ scope: s,
60
60
  colSpan: c,
61
61
  "data-align": d,
62
62
  "data-truncate": e,
63
63
  "data-no-shrink": a,
64
- "data-sortable": !!s,
65
- "aria-sort": s ? l || "none" : void 0,
66
- children: f === "loading" ? /* @__PURE__ */ p("div", { className: i.cellContent, "aria-live": "polite", "aria-label": u, children: [
67
- typeof n == "string" && e ? /* @__PURE__ */ t("span", { className: i.buttonText, children: n }) : n,
68
- /* @__PURE__ */ t(S, { "data-test-id": "fondue-loading-circle", size: "xx-small" })
69
- ] }) : s ? /* @__PURE__ */ p(
64
+ "data-sortable": !!i,
65
+ "aria-sort": i ? l || "none" : void 0,
66
+ children: f === "loading" ? /* @__PURE__ */ p("div", { className: o.cellContent, "aria-live": "polite", "aria-label": u, children: [
67
+ typeof r == "string" && e ? /* @__PURE__ */ t("span", { className: o.buttonText, children: r }) : r,
68
+ /* @__PURE__ */ t(L, { "data-test-id": "fondue-loading-circle", size: "xx-small" })
69
+ ] }) : i ? /* @__PURE__ */ p(
70
70
  "button",
71
71
  {
72
- className: i.cellContent,
72
+ className: o.cellContent,
73
73
  "aria-label": z,
74
74
  "data-active": !!l,
75
75
  onClick: B,
76
76
  children: [
77
- typeof n == "string" && e ? /* @__PURE__ */ t("span", { className: i.buttonText, children: n }) : n,
78
- /* @__PURE__ */ t(L, { width: 3, children: l === "ascending" ? /* @__PURE__ */ t(A, { size: "12" }) : l === "descending" ? /* @__PURE__ */ t(K, { size: "12" }) : /* @__PURE__ */ t(h, { className: i.sortIndicator, size: "12" }) })
77
+ typeof r == "string" && e ? /* @__PURE__ */ t("span", { className: o.buttonText, children: r }) : r,
78
+ /* @__PURE__ */ t(j, { width: 3, children: l === "ascending" ? /* @__PURE__ */ t(A, { size: "12" }) : l === "descending" ? /* @__PURE__ */ t(K, { size: "12" }) : /* @__PURE__ */ t(E, { className: o.sortIndicator, size: "12" }) })
79
79
  ]
80
80
  }
81
- ) : n
81
+ ) : r
82
82
  }
83
83
  );
84
84
  }
85
85
  );
86
- v.displayName = "Table.HeaderCell";
86
+ x.displayName = "Table.HeaderCell";
87
87
  const T = b(
88
- ({ children: a, "aria-busy": e }, d) => /* @__PURE__ */ t("tbody", { ref: d, className: i.body, "aria-busy": e, children: a })
88
+ ({ children: a, "aria-busy": e }, d) => /* @__PURE__ */ t("tbody", { ref: d, className: o.body, "aria-busy": e, children: a })
89
89
  );
90
90
  T.displayName = "Table.Body";
91
91
  const I = b(
92
- ({ disabled: a = !1, selected: e = !1, onClick: d, children: r, "aria-label": o, "data-test-id": l }, c) => {
93
- const m = d !== void 0 && !a, f = () => {
94
- a || d && d(e);
95
- }, u = (s) => {
96
- m && (s.key === "Enter" || s.key === " ") && (s.preventDefault(), f());
92
+ ({ disabled: a = !1, selected: e = !1, onClick: d, children: s, "aria-label": n, "data-test-id": l }, c) => {
93
+ const m = d !== void 0 && !a, f = (i) => {
94
+ a || d && !$(i) && d(e);
95
+ }, u = (i) => {
96
+ m && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), f());
97
97
  };
98
98
  return /* @__PURE__ */ t(
99
99
  "tr",
100
100
  {
101
101
  ref: c,
102
- className: i.row,
102
+ className: o.row,
103
103
  tabIndex: 0,
104
104
  role: m ? "button" : "row",
105
105
  "data-disabled": a,
106
106
  "data-interactive": m,
107
107
  "data-selected": e,
108
108
  "aria-disabled": a,
109
- "aria-label": o,
109
+ "aria-label": n,
110
110
  "aria-selected": e,
111
111
  onClick: m ? f : void 0,
112
112
  onKeyDown: m ? u : void 0,
113
113
  "data-test-id": l,
114
- children: r
114
+ children: s
115
115
  }
116
116
  );
117
117
  }
118
118
  );
119
119
  I.displayName = "Table.Row";
120
120
  const H = b(
121
- ({ colSpan: a, truncate: e, align: d = "left", children: r, "aria-label": o }, l) => {
121
+ ({ colSpan: a, truncate: e, align: d = "left", children: s, "aria-label": n }, l) => {
122
122
  const c = w(null);
123
123
  return g(c, l), N(c), /* @__PURE__ */ t(
124
124
  "td",
125
125
  {
126
126
  ref: c,
127
- className: i.rowCell,
127
+ className: o.rowCell,
128
128
  colSpan: a,
129
129
  "data-align": d,
130
130
  "data-truncate": e,
131
- "aria-label": o,
132
- children: r
131
+ "aria-label": n,
132
+ children: s
133
133
  }
134
134
  );
135
135
  }
136
136
  );
137
137
  H.displayName = "Table.RowCell";
138
- const Q = {
138
+ const V = {
139
139
  Root: R,
140
- Caption: C,
141
- Header: x,
142
- HeaderCell: v,
140
+ Caption: v,
141
+ Header: C,
142
+ HeaderCell: x,
143
143
  Body: T,
144
144
  Row: I,
145
145
  RowCell: H
146
146
  };
147
147
  export {
148
- Q as Table,
148
+ V as Table,
149
149
  T as TableBody,
150
- C as TableCaption,
151
- x as TableHeader,
152
- v as TableHeaderCell,
150
+ v as TableCaption,
151
+ C as TableHeader,
152
+ x as TableHeaderCell,
153
153
  R as TableRoot,
154
154
  I as TableRow,
155
155
  H as TableRowCell
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components25.js","sources":["../src/components/Table/Table.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconArrowBidirectional, IconArrowDown, IconArrowUp } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useMemo,\n useRef,\n type CSSProperties,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { useTextTruncation } from '#/hooks/useTextTruncation';\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport { Box } from '../Box/Box';\nimport { LoadingCircle } from '../LoadingCircle/LoadingCircle';\n\nimport styles from './styles/table.module.scss';\nimport { handleKeyDown } from './utils';\n\ntype TableRootProps = {\n /**\n * Whether the table should have a fixed or auto layout\n * @default 'auto'\n */\n layout?: 'auto' | 'fixed';\n /**\n * Font size of the table content\n * @default 'small'\n */\n fontSize?: 'small' | 'medium';\n /**\n * Whether header should stick to the top when scrolling\n */\n sticky?: 'head' | 'col' | 'both';\n children: ReactNode;\n} & CommonAriaAttrs;\n\nexport const TableRoot = forwardRef<HTMLTableElement, TableRootProps>(\n ({ layout = 'auto', fontSize = 'medium', sticky, children, ...props }, ref) => {\n return (\n <div onKeyDown={handleKeyDown} role=\"grid\" tabIndex={-1}>\n <table\n ref={ref}\n className={styles.table}\n data-layout={layout}\n data-font-size={fontSize}\n data-sticky={sticky}\n {...props}\n >\n {children}\n </table>\n </div>\n );\n },\n);\nTableRoot.displayName = 'Table.Root';\n\nexport const TableCaption = forwardRef<HTMLTableCaptionElement, { children: ReactNode }>(({ children }, ref) => {\n return (\n <caption ref={ref} className={styles.caption}>\n {children}\n </caption>\n );\n});\nTableCaption.displayName = 'Table.Caption';\n\ntype TableHeaderProps = {\n children: ReactNode;\n 'aria-label'?: string;\n 'aria-busy'?: boolean;\n};\n\nexport const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({ children, 'aria-label': ariaLabel, 'aria-busy': ariaBusy }, ref) => {\n return (\n <thead ref={ref} className={styles.header} aria-label={ariaLabel} aria-busy={ariaBusy}>\n {children}\n </thead>\n );\n },\n);\nTableHeader.displayName = 'Table.Header';\n\ntype SortDirection = 'ascending' | 'descending' | undefined;\ntype HorizontalAlignment = 'left' | 'center' | 'right';\n\ntype TableHeaderCellProps = {\n /**\n * Scope of the column\n * @default 'col'\n */\n scope?: HTMLTableCellElement['scope'];\n /**\n * Number of columns the cell should span\n */\n colSpan?: HTMLTableCellElement['colSpan'];\n /**\n * Width of the column\n */\n width?: CSSProperties['width'];\n /**\n * Current sort direction of the column\n */\n sortDirection?: SortDirection;\n /**\n * Horizontal alignment of the content\n * @default 'left'\n */\n align?: HorizontalAlignment;\n /**\n * Whether to truncate content with ellipsis when it overflows\n * @default false\n */\n truncate?: boolean;\n /**\n * Aria label for asceding/descending sort. Variables: {column} - column name\n * @default \"Sort by {column} ascending/descending\"\n */\n sortTranslations?: {\n sortAscending?: string;\n sortDescending?: string;\n };\n /**\n * Whether the column should have a minimum width\n * @default false\n */\n noShrink?: boolean;\n /**\n * State of the cell, used for displaying loading state\n * @default 'idle'\n */\n state?: 'idle' | 'loading';\n /**\n * The aria-label to be applied when state='loading'\n */\n loadingStateAriaLabel?: string;\n /**\n * Handler called when the sort direction changes\n * @param direction - The new sort direction\n */\n onSortChange?: (direction: SortDirection) => void;\n children: ReactNode;\n};\n\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(\n (\n {\n noShrink = false,\n truncate = false,\n align = 'left',\n scope = 'col',\n sortTranslations,\n sortDirection,\n colSpan,\n width,\n state = 'idle',\n loadingStateAriaLabel,\n onSortChange,\n children,\n },\n ref,\n ) => {\n const cellRef = useRef<HTMLTableCellElement>(null);\n useSyncRefs<HTMLTableCellElement>(cellRef, ref);\n\n useTextTruncation(cellRef);\n\n const sortLabel = useMemo(() => {\n if (typeof children === 'string') {\n if (sortDirection === 'ascending') {\n return sortTranslations?.sortDescending ?? `Sort by ${children} descending`;\n }\n return sortTranslations?.sortAscending ?? `Sort by ${children} ascending`;\n }\n\n return sortDirection === 'ascending' ? 'Sort descending' : 'Sort ascending';\n }, [children, sortDirection, sortTranslations]);\n\n const handleSortChange = () => {\n if (!onSortChange) {\n return;\n }\n\n const newDirection: SortDirection =\n sortDirection === undefined || sortDirection === 'descending' ? 'ascending' : 'descending';\n\n onSortChange(newDirection);\n };\n\n return (\n <th\n ref={cellRef}\n style={{ width }}\n className={styles.headerCell}\n scope={scope}\n colSpan={colSpan}\n data-align={align}\n data-truncate={truncate}\n data-no-shrink={noShrink}\n data-sortable={!!onSortChange}\n aria-sort={onSortChange ? sortDirection || 'none' : undefined}\n >\n {state === 'loading' ? (\n <div className={styles.cellContent} aria-live=\"polite\" aria-label={loadingStateAriaLabel}>\n {typeof children === 'string' && truncate ? (\n <span className={styles.buttonText}>{children}</span>\n ) : (\n children\n )}\n <LoadingCircle data-test-id=\"fondue-loading-circle\" size=\"xx-small\" />\n </div>\n ) : onSortChange ? (\n <button\n className={styles.cellContent}\n aria-label={sortLabel}\n data-active={!!sortDirection}\n onClick={handleSortChange}\n >\n {typeof children === 'string' && truncate ? (\n <span className={styles.buttonText}>{children}</span>\n ) : (\n children\n )}\n <Box width={3}>\n {sortDirection === 'ascending' ? (\n <IconArrowUp size=\"12\" />\n ) : sortDirection === 'descending' ? (\n <IconArrowDown size=\"12\" />\n ) : (\n <IconArrowBidirectional className={styles.sortIndicator} size=\"12\" />\n )}\n </Box>\n </button>\n ) : (\n children\n )}\n </th>\n );\n },\n);\nTableHeaderCell.displayName = 'Table.HeaderCell';\n\ntype TableBodyProps = {\n children: ReactNode;\n 'aria-busy'?: boolean;\n};\n\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({ children, 'aria-busy': ariaBusy }, ref) => {\n return (\n <tbody ref={ref} className={styles.body} aria-busy={ariaBusy}>\n {children}\n </tbody>\n );\n },\n);\nTableBody.displayName = 'Table.Body';\n\ntype BaseTableRowProps = {\n /**\n * Whether the row is in a selected state\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to disable interactions for this row\n * @default false\n */\n disabled?: boolean;\n /**\n * Content to be rendered within the row\n */\n children: ReactNode;\n /**\n * Accessible label for the row\n */\n 'aria-label'?: string;\n 'data-test-id'?: string;\n};\n\ntype ClickableTableRowProps = BaseTableRowProps & {\n /**\n * Handler called when the row is clicked or activated via keyboard\n * If provided, the row will be hoverable and interactive\n */\n onClick: (selected: boolean) => void;\n onNavigate?: never;\n href?: never;\n};\n\ntype NavigableTableRowProps = BaseTableRowProps & {\n onClick?: never;\n /**\n * Handler called when the row is clicked or activated via keyboard for navigation\n * Must be provided together with href\n */\n onNavigate: (href: string) => void;\n /**\n * URL associated with this row for navigation\n * Must be provided together with onNavigate\n */\n href: string;\n};\n\ntype NonInteractiveTableRowProps = BaseTableRowProps & {\n onClick?: never;\n onNavigate?: never;\n href?: never;\n};\n\ntype TableRowProps = ClickableTableRowProps | NavigableTableRowProps | NonInteractiveTableRowProps;\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { disabled = false, selected = false, onClick, children, 'aria-label': ariaLabel, 'data-test-id': dataTestId },\n ref,\n ) => {\n const isInteractive = onClick !== undefined && !disabled;\n\n const handleClick = () => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(selected);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTableRowElement>) => {\n if (!isInteractive) {\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClick();\n }\n };\n\n return (\n <tr\n ref={ref}\n className={styles.row}\n tabIndex={0}\n role={isInteractive ? 'button' : 'row'}\n data-disabled={disabled}\n data-interactive={isInteractive}\n data-selected={selected}\n aria-disabled={disabled}\n aria-label={ariaLabel}\n aria-selected={selected}\n onClick={isInteractive ? handleClick : undefined}\n onKeyDown={isInteractive ? handleKeyDown : undefined}\n data-test-id={dataTestId}\n >\n {children}\n </tr>\n );\n },\n);\nTableRow.displayName = 'Table.Row';\n\ntype TableRowCellProps = {\n /**\n * Number of columns the cell should span\n */\n colSpan?: HTMLTableCellElement['colSpan'];\n /**\n * Whether to truncate content with ellipsis when it overflows\n * @default false\n */\n truncate?: boolean;\n /**\n * Horizontal alignment of the content\n * @default 'left'\n */\n align?: HorizontalAlignment;\n children: ReactNode;\n 'aria-label'?: string;\n};\n\nexport const TableRowCell = forwardRef<HTMLTableCellElement, TableRowCellProps>(\n ({ colSpan, truncate, align = 'left', children, 'aria-label': ariaLabel }, ref): ReactElement => {\n const cellRef = useRef<HTMLTableCellElement>(null);\n useSyncRefs<HTMLTableCellElement>(cellRef, ref);\n\n useTextTruncation(cellRef);\n\n return (\n <td\n ref={cellRef}\n className={styles.rowCell}\n colSpan={colSpan}\n data-align={align}\n data-truncate={truncate}\n aria-label={ariaLabel}\n >\n {children}\n </td>\n );\n },\n);\nTableRowCell.displayName = 'Table.RowCell';\n\nexport const Table = {\n Root: TableRoot,\n Caption: TableCaption,\n Header: TableHeader,\n HeaderCell: TableHeaderCell,\n Body: TableBody,\n Row: TableRow,\n RowCell: TableRowCell,\n};\n"],"names":["TableRoot","forwardRef","layout","fontSize","sticky","children","props","ref","handleKeyDown","jsx","styles","TableCaption","TableHeader","ariaLabel","ariaBusy","TableHeaderCell","noShrink","truncate","align","scope","sortTranslations","sortDirection","colSpan","width","state","loadingStateAriaLabel","onSortChange","cellRef","useRef","useSyncRefs","useTextTruncation","sortLabel","useMemo","handleSortChange","jsxs","LoadingCircle","Box","IconArrowUp","IconArrowDown","IconArrowBidirectional","TableBody","TableRow","disabled","selected","onClick","dataTestId","isInteractive","handleClick","event","TableRowCell","Table"],"mappings":";;;;;;;;;AAyCO,MAAMA,IAAYC;AAAA,EACrB,CAAC,EAAE,QAAAC,IAAS,QAAQ,UAAAC,IAAW,UAAU,QAAAC,GAAQ,UAAAC,GAAU,GAAGC,EAAM,GAAGC,wBAE9D,OAAI,EAAA,WAAWC,GAAe,MAAK,QAAO,UAAU,IACjD,UAAA,gBAAAC;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AE,SAAAqB,GAAS,UAAAL,GAAU,OAAAC,IAAQ,QAAQ,UAAAb,GAAU,cAAcQ,EAAU,GAAGN,MAAsB;AACvF,UAAAoB,IAAUC,EAA6B,IAAI;AACjD,WAAAC,EAAkCF,GAASpB,CAAG,GAE9CuB,EAAkBH,CAAO,GAGrB,gBAAAlB;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAKkB;AAAA,QACL,WAAWjB,EAAO;AAAA,QAClB,SAAAY;AAAA,QACA,cAAYJ;AAAA,QACZ,iBAAeD;AAAA,QACf,cAAYJ;AAAA,QAEX,UAAAR;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGZ;AACA4C,EAAa,cAAc;AAEpB,MAAMC,IAAQ;AAAA,EACjB,MAAMlD;AAAA,EACN,SAASW;AAAA,EACT,QAAQC;AAAA,EACR,YAAYG;AAAA,EACZ,MAAMyB;AAAA,EACN,KAAKC;AAAA,EACL,SAASQ;AACb;"}
1
+ {"version":3,"file":"fondue-components25.js","sources":["../src/components/Table/Table.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconArrowBidirectional, IconArrowDown, IconArrowUp } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useMemo,\n useRef,\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { useTextTruncation } from '#/hooks/useTextTruncation';\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport { Box } from '../Box/Box';\nimport { LoadingCircle } from '../LoadingCircle/LoadingCircle';\n\nimport styles from './styles/table.module.scss';\nimport { handleKeyDown, isEventFromInteractiveElement } from './utils';\n\ntype TableRootProps = {\n /**\n * Whether the table should have a fixed or auto layout\n * @default 'auto'\n */\n layout?: 'auto' | 'fixed';\n /**\n * Font size of the table content\n * @default 'small'\n */\n fontSize?: 'small' | 'medium';\n /**\n * Whether header should stick to the top when scrolling\n */\n sticky?: 'head' | 'col' | 'both';\n children: ReactNode;\n} & CommonAriaAttrs;\n\nexport const TableRoot = forwardRef<HTMLTableElement, TableRootProps>(\n ({ layout = 'auto', fontSize = 'medium', sticky, children, ...props }, ref) => {\n return (\n <div onKeyDown={handleKeyDown} role=\"grid\" tabIndex={-1}>\n <table\n ref={ref}\n className={styles.table}\n data-layout={layout}\n data-font-size={fontSize}\n data-sticky={sticky}\n {...props}\n >\n {children}\n </table>\n </div>\n );\n },\n);\nTableRoot.displayName = 'Table.Root';\n\nexport const TableCaption = forwardRef<HTMLTableCaptionElement, { children: ReactNode }>(({ children }, ref) => {\n return (\n <caption ref={ref} className={styles.caption}>\n {children}\n </caption>\n );\n});\nTableCaption.displayName = 'Table.Caption';\n\ntype TableHeaderProps = {\n children: ReactNode;\n 'aria-label'?: string;\n 'aria-busy'?: boolean;\n};\n\nexport const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({ children, 'aria-label': ariaLabel, 'aria-busy': ariaBusy }, ref) => {\n return (\n <thead ref={ref} className={styles.header} aria-label={ariaLabel} aria-busy={ariaBusy}>\n {children}\n </thead>\n );\n },\n);\nTableHeader.displayName = 'Table.Header';\n\ntype SortDirection = 'ascending' | 'descending' | undefined;\ntype HorizontalAlignment = 'left' | 'center' | 'right';\n\ntype TableHeaderCellProps = {\n /**\n * Scope of the column\n * @default 'col'\n */\n scope?: HTMLTableCellElement['scope'];\n /**\n * Number of columns the cell should span\n */\n colSpan?: HTMLTableCellElement['colSpan'];\n /**\n * Width of the column\n */\n width?: CSSProperties['width'];\n /**\n * Current sort direction of the column\n */\n sortDirection?: SortDirection;\n /**\n * Horizontal alignment of the content\n * @default 'left'\n */\n align?: HorizontalAlignment;\n /**\n * Whether to truncate content with ellipsis when it overflows\n * @default false\n */\n truncate?: boolean;\n /**\n * Aria label for asceding/descending sort. Variables: {column} - column name\n * @default \"Sort by {column} ascending/descending\"\n */\n sortTranslations?: {\n sortAscending?: string;\n sortDescending?: string;\n };\n /**\n * Whether the column should have a minimum width\n * @default false\n */\n noShrink?: boolean;\n /**\n * State of the cell, used for displaying loading state\n * @default 'idle'\n */\n state?: 'idle' | 'loading';\n /**\n * The aria-label to be applied when state='loading'\n */\n loadingStateAriaLabel?: string;\n /**\n * Handler called when the sort direction changes\n * @param direction - The new sort direction\n */\n onSortChange?: (direction: SortDirection) => void;\n children: ReactNode;\n};\n\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(\n (\n {\n noShrink = false,\n truncate = false,\n align = 'left',\n scope = 'col',\n sortTranslations,\n sortDirection,\n colSpan,\n width,\n state = 'idle',\n loadingStateAriaLabel,\n onSortChange,\n children,\n },\n ref,\n ) => {\n const cellRef = useRef<HTMLTableCellElement>(null);\n useSyncRefs<HTMLTableCellElement>(cellRef, ref);\n\n useTextTruncation(cellRef);\n\n const sortLabel = useMemo(() => {\n if (typeof children === 'string') {\n if (sortDirection === 'ascending') {\n return sortTranslations?.sortDescending ?? `Sort by ${children} descending`;\n }\n return sortTranslations?.sortAscending ?? `Sort by ${children} ascending`;\n }\n\n return sortDirection === 'ascending' ? 'Sort descending' : 'Sort ascending';\n }, [children, sortDirection, sortTranslations]);\n\n const handleSortChange = () => {\n if (!onSortChange) {\n return;\n }\n\n const newDirection: SortDirection =\n sortDirection === undefined || sortDirection === 'descending' ? 'ascending' : 'descending';\n\n onSortChange(newDirection);\n };\n\n return (\n <th\n ref={cellRef}\n style={{ width }}\n className={styles.headerCell}\n scope={scope}\n colSpan={colSpan}\n data-align={align}\n data-truncate={truncate}\n data-no-shrink={noShrink}\n data-sortable={!!onSortChange}\n aria-sort={onSortChange ? sortDirection || 'none' : undefined}\n >\n {state === 'loading' ? (\n <div className={styles.cellContent} aria-live=\"polite\" aria-label={loadingStateAriaLabel}>\n {typeof children === 'string' && truncate ? (\n <span className={styles.buttonText}>{children}</span>\n ) : (\n children\n )}\n <LoadingCircle data-test-id=\"fondue-loading-circle\" size=\"xx-small\" />\n </div>\n ) : onSortChange ? (\n <button\n className={styles.cellContent}\n aria-label={sortLabel}\n data-active={!!sortDirection}\n onClick={handleSortChange}\n >\n {typeof children === 'string' && truncate ? (\n <span className={styles.buttonText}>{children}</span>\n ) : (\n children\n )}\n <Box width={3}>\n {sortDirection === 'ascending' ? (\n <IconArrowUp size=\"12\" />\n ) : sortDirection === 'descending' ? (\n <IconArrowDown size=\"12\" />\n ) : (\n <IconArrowBidirectional className={styles.sortIndicator} size=\"12\" />\n )}\n </Box>\n </button>\n ) : (\n children\n )}\n </th>\n );\n },\n);\nTableHeaderCell.displayName = 'Table.HeaderCell';\n\ntype TableBodyProps = {\n children: ReactNode;\n 'aria-busy'?: boolean;\n};\n\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({ children, 'aria-busy': ariaBusy }, ref) => {\n return (\n <tbody ref={ref} className={styles.body} aria-busy={ariaBusy}>\n {children}\n </tbody>\n );\n },\n);\nTableBody.displayName = 'Table.Body';\n\ntype BaseTableRowProps = {\n /**\n * Whether the row is in a selected state\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to disable interactions for this row\n * @default false\n */\n disabled?: boolean;\n /**\n * Content to be rendered within the row\n */\n children: ReactNode;\n /**\n * Accessible label for the row\n */\n 'aria-label'?: string;\n 'data-test-id'?: string;\n};\n\ntype ClickableTableRowProps = BaseTableRowProps & {\n /**\n * Handler called when the row is clicked or activated via keyboard\n * If provided, the row will be hoverable and interactive\n */\n onClick: (selected: boolean) => void;\n onNavigate?: never;\n href?: never;\n};\n\ntype NavigableTableRowProps = BaseTableRowProps & {\n onClick?: never;\n /**\n * Handler called when the row is clicked or activated via keyboard for navigation\n * Must be provided together with href\n */\n onNavigate: (href: string) => void;\n /**\n * URL associated with this row for navigation\n * Must be provided together with onNavigate\n */\n href: string;\n};\n\ntype NonInteractiveTableRowProps = BaseTableRowProps & {\n onClick?: never;\n onNavigate?: never;\n href?: never;\n};\n\ntype TableRowProps = ClickableTableRowProps | NavigableTableRowProps | NonInteractiveTableRowProps;\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { disabled = false, selected = false, onClick, children, 'aria-label': ariaLabel, 'data-test-id': dataTestId },\n ref,\n ) => {\n const isInteractive = onClick !== undefined && !disabled;\n\n const handleClick = (event?: MouseEvent) => {\n if (disabled) {\n return;\n }\n\n if (onClick && !isEventFromInteractiveElement(event)) {\n onClick(selected);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTableRowElement>) => {\n if (!isInteractive) {\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClick();\n }\n };\n\n return (\n <tr\n ref={ref}\n className={styles.row}\n tabIndex={0}\n role={isInteractive ? 'button' : 'row'}\n data-disabled={disabled}\n data-interactive={isInteractive}\n data-selected={selected}\n aria-disabled={disabled}\n aria-label={ariaLabel}\n aria-selected={selected}\n onClick={isInteractive ? handleClick : undefined}\n onKeyDown={isInteractive ? handleKeyDown : undefined}\n data-test-id={dataTestId}\n >\n {children}\n </tr>\n );\n },\n);\nTableRow.displayName = 'Table.Row';\n\ntype TableRowCellProps = {\n /**\n * Number of columns the cell should span\n */\n colSpan?: HTMLTableCellElement['colSpan'];\n /**\n * Whether to truncate content with ellipsis when it overflows\n * @default false\n */\n truncate?: boolean;\n /**\n * Horizontal alignment of the content\n * @default 'left'\n */\n align?: HorizontalAlignment;\n children: ReactNode;\n 'aria-label'?: string;\n};\n\nexport const TableRowCell = forwardRef<HTMLTableCellElement, TableRowCellProps>(\n ({ colSpan, truncate, align = 'left', children, 'aria-label': ariaLabel }, ref): ReactElement => {\n const cellRef = useRef<HTMLTableCellElement>(null);\n useSyncRefs<HTMLTableCellElement>(cellRef, ref);\n\n useTextTruncation(cellRef);\n\n return (\n <td\n ref={cellRef}\n className={styles.rowCell}\n colSpan={colSpan}\n data-align={align}\n data-truncate={truncate}\n aria-label={ariaLabel}\n >\n {children}\n </td>\n );\n },\n);\nTableRowCell.displayName = 'Table.RowCell';\n\nexport const Table = {\n Root: TableRoot,\n Caption: TableCaption,\n Header: TableHeader,\n HeaderCell: TableHeaderCell,\n Body: TableBody,\n Row: TableRow,\n RowCell: TableRowCell,\n};\n"],"names":["TableRoot","forwardRef","layout","fontSize","sticky","children","props","ref","handleKeyDown","jsx","styles","TableCaption","TableHeader","ariaLabel","ariaBusy","TableHeaderCell","noShrink","truncate","align","scope","sortTranslations","sortDirection","colSpan","width","state","loadingStateAriaLabel","onSortChange","cellRef","useRef","useSyncRefs","useTextTruncation","sortLabel","useMemo","handleSortChange","jsxs","LoadingCircle","Box","IconArrowUp","IconArrowDown","IconArrowBidirectional","TableBody","TableRow","disabled","selected","onClick","dataTestId","isInteractive","handleClick","event","isEventFromInteractiveElement","TableRowCell","Table"],"mappings":";;;;;;;;;AA0CO,MAAMA,IAAYC;AAAA,EACrB,CAAC,EAAE,QAAAC,IAAS,QAAQ,UAAAC,IAAW,UAAU,QAAAC,GAAQ,UAAAC,GAAU,GAAGC,EAAM,GAAGC,wBAE9D,OAAI,EAAA,WAAWC,GAAe,MAAK,QAAO,UAAU,IACjD,UAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAAF;AAAA,MACA,WAAWG,EAAO;AAAA,MAClB,eAAaR;AAAA,MACb,kBAAgBC;AAAA,MAChB,eAAaC;AAAA,MACZ,GAAGE;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA,GAET;AAGZ;AACAL,EAAU,cAAc;AAEjB,MAAMW,IAAeV,EAA6D,CAAC,EAAE,UAAAI,EAAA,GAAYE,wBAE/F,WAAQ,EAAA,KAAAA,GAAU,WAAWG,EAAO,SAChC,UAAAL,GACL,CAEP;AACDM,EAAa,cAAc;AAQpB,MAAMC,IAAcX;AAAA,EACvB,CAAC,EAAE,UAAAI,GAAU,cAAcQ,GAAW,aAAaC,KAAYP,MAEvD,gBAAAE,EAAC,SAAM,EAAA,KAAAF,GAAU,WAAWG,EAAO,QAAQ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AASW;AAAA,EACT,QAAQC;AAAA,EACR,YAAYG;AAAA,EACZ,MAAMyB;AAAA,EACN,KAAKC;AAAA,EACL,SAASS;AACb;"}
@@ -6,36 +6,36 @@ import r from "./fondue-components76.js";
6
6
  const f = ({
7
7
  children: c,
8
8
  className: d,
9
- status: e = "neutral",
9
+ status: o = "neutral",
10
10
  "data-test-id": a = "fondue-text-input",
11
11
  ...t
12
12
  }, R) => {
13
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,
14
+ return /* @__PURE__ */ g("div", { className: m(r.root, d), "data-status": o, "data-test-id": a, children: [
15
+ o === "loading" ? /* @__PURE__ */ s("div", { className: r.loadingStatus, "data-test-id": `${a}-loader` }) : null,
16
16
  /* @__PURE__ */ s(
17
17
  "input",
18
18
  {
19
- onMouseDown: (o) => {
20
- i.current = !0, o.currentTarget.dataset.showFocusRing = "false";
19
+ onMouseDown: (e) => {
20
+ i.current = !0, e.currentTarget.dataset.showFocusRing = "false";
21
21
  },
22
22
  type: "text",
23
23
  ...t,
24
- onFocus: (o) => {
24
+ onFocus: (e) => {
25
25
  var l;
26
- i.current || (o.target.dataset.showFocusRing = "true"), (l = t.onFocus) == null || l.call(t, o);
26
+ console.log("focusEvent", e), i.current || (e.target.dataset.showFocusRing = "true"), (l = t.onFocus) == null || l.call(t, e);
27
27
  },
28
- onBlur: (o) => {
28
+ onBlur: (e) => {
29
29
  var l;
30
- o.target.dataset.showFocusRing = "false", i.current = !1, (l = t.onBlur) == null || l.call(t, o);
30
+ e.target.dataset.showFocusRing = "false", i.current = !1, (l = t.onBlur) == null || l.call(t, e);
31
31
  },
32
32
  ref: R,
33
33
  className: r.input,
34
- "aria-invalid": e === "error"
34
+ "aria-invalid": o === "error"
35
35
  }
36
36
  ),
37
- e === "success" ? /* @__PURE__ */ s(w, { size: 16, className: r.iconSuccess, "data-test-id": `${a}-success-icon` }) : null,
38
- e === "error" ? /* @__PURE__ */ s(
37
+ o === "success" ? /* @__PURE__ */ s(w, { size: 16, className: r.iconSuccess, "data-test-id": `${a}-success-icon` }) : null,
38
+ o === "error" ? /* @__PURE__ */ s(
39
39
  N,
40
40
  {
41
41
  size: 16,
@@ -47,12 +47,12 @@ const f = ({
47
47
  ] });
48
48
  };
49
49
  f.displayName = "TextField.Root";
50
- const u = ({ name: c, className: d, ...e }, a) => /* @__PURE__ */ s(
50
+ const u = ({ name: c, className: d, ...o }, a) => /* @__PURE__ */ s(
51
51
  "div",
52
52
  {
53
53
  "data-slot": !0,
54
54
  "data-name": c,
55
- ...e,
55
+ ...o,
56
56
  ref: a,
57
57
  className: m(r.slot, d)
58
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components28.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 type FocusEvent,\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: FocusEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLInputElement>) => void;\n 'data-test-id'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\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":";;;;;AA4GO,MAAMA,IAAgB,CACzB;AAAA,EACI,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,gBA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,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;AACxC;AAIRiB,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-components28.js","sources":["../src/components/TextInput/TextInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useRef,\n type ChangeEvent,\n type FocusEvent,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\n\nimport { 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: FocusEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLInputElement>) => void;\n 'data-test-id'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\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 console.log('focusEvent', 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":";;;;;AA4GO,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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AAGmB,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;AACxC;AAIRiB,EAAc,cAAc;AAE5B,MAAMI,IAA4BC,EAA6CxB,CAAa,GACtFyB,IAA4BD,EAA+CL,CAAa,GAEjFO,IAGTH;AACJG,EAAU,OAAOH;AACjBG,EAAU,OAAOD;"}
@@ -1,14 +1,14 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import n from "./fondue-components77.js";
2
+ import s from "./fondue-components77.js";
3
3
  import { Slot as i } from "@radix-ui/react-slot";
4
4
  import { createContext as l, useContext as c } from "react";
5
- const t = l("light"), f = () => c(t), h = ({ children: r, theme: e = "light", asChild: m = !1 }) => {
6
- const s = m ? i : "div";
7
- return /* @__PURE__ */ o(t.Provider, { value: e, children: /* @__PURE__ */ o(s, { className: n[e], children: r }) });
5
+ const t = l("light"), h = () => c(t), a = ({ children: r, theme: e = "light", asChild: m = !1 }) => {
6
+ const n = m ? i : "div";
7
+ return /* @__PURE__ */ o(t.Provider, { value: e, children: /* @__PURE__ */ o(n, { className: `${s[e]} fondue-theme-provider`, children: r }) });
8
8
  };
9
9
  export {
10
10
  t as ThemeContext,
11
- h as ThemeProvider,
12
- f as useFondueTheme
11
+ a as ThemeProvider,
12
+ h as useFondueTheme
13
13
  };
14
14
  //# sourceMappingURL=fondue-components29.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components29.js","sources":["../src/components/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport styles from '@frontify/fondue-tokens/theme-tokens';\nimport { Slot } from '@radix-ui/react-slot';\nimport { createContext, useContext, type ReactNode } from 'react';\n\ntype AvailableTheme = keyof typeof styles;\n\ntype ThemeProviderProps = {\n children: ReactNode;\n /**\n * The theme to apply\n * @default \"light\"\n * */\n theme: AvailableTheme;\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default false\n */\n asChild?: boolean;\n};\n\nexport const ThemeContext = createContext<AvailableTheme>('light');\n\nexport const useFondueTheme = () => {\n return useContext(ThemeContext);\n};\n\nexport const ThemeProvider = ({ children, theme = 'light', asChild = false }: ThemeProviderProps) => {\n const Comp = asChild ? Slot : 'div';\n return (\n <ThemeContext.Provider value={theme}>\n <Comp className={styles[theme]}>{children}</Comp>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","useFondueTheme","useContext","ThemeProvider","children","theme","asChild","Comp","Slot","jsx","styles"],"mappings":";;;;AAsBa,MAAAA,IAAeC,EAA8B,OAAO,GAEpDC,IAAiB,MACnBC,EAAWH,CAAY,GAGrBI,IAAgB,CAAC,EAAE,UAAAC,GAAU,OAAAC,IAAQ,SAAS,SAAAC,IAAU,SAAgC;AAC3F,QAAAC,IAAOD,IAAUE,IAAO;AAC9B,SACK,gBAAAC,EAAAV,EAAa,UAAb,EAAsB,OAAOM,GAC1B,UAAC,gBAAAI,EAAAF,GAAA,EAAK,WAAWG,EAAOL,CAAK,GAAI,UAAAD,EAAS,CAAA,GAC9C;AAER;"}
1
+ {"version":3,"file":"fondue-components29.js","sources":["../src/components/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport styles from '@frontify/fondue-tokens/themes';\nimport { Slot } from '@radix-ui/react-slot';\nimport { createContext, useContext, type ReactNode } from 'react';\n\ntype AvailableTheme = keyof typeof styles;\n\ntype ThemeProviderProps = {\n children: ReactNode;\n /**\n * The theme to apply\n * @default \"light\"\n * */\n theme: AvailableTheme;\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default false\n */\n asChild?: boolean;\n};\n\nexport const ThemeContext = createContext<AvailableTheme>('light');\n\nexport const useFondueTheme = () => {\n return useContext(ThemeContext);\n};\n\nexport const ThemeProvider = ({ children, theme = 'light', asChild = false }: ThemeProviderProps) => {\n const Comp = asChild ? Slot : 'div';\n return (\n <ThemeContext.Provider value={theme}>\n <Comp className={`${styles[theme]} fondue-theme-provider`}>{children}</Comp>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","useFondueTheme","useContext","ThemeProvider","children","theme","asChild","Comp","Slot","jsx","styles"],"mappings":";;;;AAsBa,MAAAA,IAAeC,EAA8B,OAAO,GAEpDC,IAAiB,MACnBC,EAAWH,CAAY,GAGrBI,IAAgB,CAAC,EAAE,UAAAC,GAAU,OAAAC,IAAQ,SAAS,SAAAC,IAAU,SAAgC;AAC3F,QAAAC,IAAOD,IAAUE,IAAO;AAC9B,SACK,gBAAAC,EAAAV,EAAa,UAAb,EAAsB,OAAOM,GAC1B,UAAA,gBAAAI,EAACF,GAAK,EAAA,WAAW,GAAGG,EAAOL,CAAK,CAAC,0BAA2B,UAAAD,EAAS,CAAA,GACzE;AAER;"}
@@ -1,14 +1,14 @@
1
- const o = "_root_1f8r4_2", c = "_accordionItem_1f8r4_7", n = "_accordionTrigger_1f8r4_13", r = "_accordionCaret_1f8r4_31", t = "_accordionContent_1f8r4_35", e = "_accordionContentText_1f8r4_62", a = {
1
+ const o = "_root_buef8_2", c = "_accordionItem_buef8_7", n = "_accordionTrigger_buef8_13", t = "_accordionCaret_buef8_31", r = "_accordionContent_buef8_35", e = "_accordionContentText_buef8_62", a = {
2
2
  root: o,
3
3
  accordionItem: c,
4
4
  accordionTrigger: n,
5
- accordionCaret: r,
6
- accordionContent: t,
5
+ accordionCaret: t,
6
+ accordionContent: r,
7
7
  accordionContentText: e
8
8
  };
9
9
  export {
10
- r as accordionCaret,
11
- t as accordionContent,
10
+ t as accordionCaret,
11
+ r as accordionContent,
12
12
  e as accordionContentText,
13
13
  c as accordionItem,
14
14
  n as accordionTrigger,