@frontify/fondue-components 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/fondue-components.js +32 -30
  2. package/dist/fondue-components.js.map +1 -1
  3. package/dist/fondue-components10.js +2 -2
  4. package/dist/fondue-components11.js +3 -3
  5. package/dist/fondue-components12.js +2 -2
  6. package/dist/fondue-components13.js +1 -1
  7. package/dist/fondue-components14.js +1 -1
  8. package/dist/fondue-components15.js +1 -1
  9. package/dist/fondue-components16.js +2 -2
  10. package/dist/fondue-components17.js +2 -2
  11. package/dist/fondue-components18.js +6 -6
  12. package/dist/fondue-components19.js +1 -1
  13. package/dist/fondue-components20.js +2 -2
  14. package/dist/fondue-components21.js +116 -65
  15. package/dist/fondue-components21.js.map +1 -1
  16. package/dist/fondue-components22.js +64 -41
  17. package/dist/fondue-components22.js.map +1 -1
  18. package/dist/fondue-components23.js +43 -32
  19. package/dist/fondue-components23.js.map +1 -1
  20. package/dist/fondue-components24.js +32 -5
  21. package/dist/fondue-components24.js.map +1 -1
  22. package/dist/fondue-components25.js +5 -12
  23. package/dist/fondue-components25.js.map +1 -1
  24. package/dist/fondue-components26.js +10 -153
  25. package/dist/fondue-components26.js.map +1 -1
  26. package/dist/fondue-components27.js +59 -22
  27. package/dist/fondue-components27.js.map +1 -1
  28. package/dist/fondue-components28.js +17 -17
  29. package/dist/fondue-components28.js.map +1 -1
  30. package/dist/fondue-components29.js +112 -15
  31. package/dist/fondue-components29.js.map +1 -1
  32. package/dist/fondue-components3.js +2 -2
  33. package/dist/fondue-components30.js +19 -30
  34. package/dist/fondue-components30.js.map +1 -1
  35. package/dist/fondue-components31.js +32 -28
  36. package/dist/fondue-components31.js.map +1 -1
  37. package/dist/fondue-components32.js +23 -125
  38. package/dist/fondue-components32.js.map +1 -1
  39. package/dist/fondue-components33.js +129 -20
  40. package/dist/fondue-components33.js.map +1 -1
  41. package/dist/fondue-components34.js +21 -45
  42. package/dist/fondue-components34.js.map +1 -1
  43. package/dist/fondue-components35.js +45 -28
  44. package/dist/fondue-components35.js.map +1 -1
  45. package/dist/fondue-components36.js +28 -15
  46. package/dist/fondue-components36.js.map +1 -1
  47. package/dist/fondue-components37.js +15 -60
  48. package/dist/fondue-components37.js.map +1 -1
  49. package/dist/fondue-components38.js +60 -15
  50. package/dist/fondue-components38.js.map +1 -1
  51. package/dist/fondue-components39.js +15 -19
  52. package/dist/fondue-components39.js.map +1 -1
  53. package/dist/fondue-components4.js +4 -4
  54. package/dist/fondue-components40.js +18 -4
  55. package/dist/fondue-components40.js.map +1 -1
  56. package/dist/fondue-components41.js +3 -11
  57. package/dist/fondue-components41.js.map +1 -1
  58. package/dist/fondue-components42.js +11 -3
  59. package/dist/fondue-components42.js.map +1 -1
  60. package/dist/fondue-components43.js +5 -35
  61. package/dist/fondue-components43.js.map +1 -1
  62. package/dist/fondue-components44.js +35 -13
  63. package/dist/fondue-components44.js.map +1 -1
  64. package/dist/fondue-components45.js +12 -4
  65. package/dist/fondue-components45.js.map +1 -1
  66. package/dist/fondue-components46.js +4 -24
  67. package/dist/fondue-components46.js.map +1 -1
  68. package/dist/fondue-components47.js +24 -16
  69. package/dist/fondue-components47.js.map +1 -1
  70. package/dist/fondue-components48.js +16 -139
  71. package/dist/fondue-components48.js.map +1 -1
  72. package/dist/fondue-components49.js +140 -16
  73. package/dist/fondue-components49.js.map +1 -1
  74. package/dist/fondue-components5.js +2 -2
  75. package/dist/fondue-components50.js +16 -72
  76. package/dist/fondue-components50.js.map +1 -1
  77. package/dist/fondue-components51.js +72 -8
  78. package/dist/fondue-components51.js.map +1 -1
  79. package/dist/fondue-components52.js +8 -33
  80. package/dist/fondue-components52.js.map +1 -1
  81. package/dist/fondue-components53.js +32 -48
  82. package/dist/fondue-components53.js.map +1 -1
  83. package/dist/fondue-components54.js +48 -10
  84. package/dist/fondue-components54.js.map +1 -1
  85. package/dist/fondue-components55.js +8 -10
  86. package/dist/fondue-components55.js.map +1 -1
  87. package/dist/fondue-components56.js +12 -17
  88. package/dist/fondue-components56.js.map +1 -1
  89. package/dist/fondue-components57.js +52 -6
  90. package/dist/fondue-components57.js.map +1 -1
  91. package/dist/fondue-components58.js +15 -2
  92. package/dist/fondue-components58.js.map +1 -1
  93. package/dist/fondue-components59.js +17 -10
  94. package/dist/fondue-components59.js.map +1 -1
  95. package/dist/fondue-components6.js +5 -5
  96. package/dist/fondue-components60.js +6 -38
  97. package/dist/fondue-components60.js.map +1 -1
  98. package/dist/fondue-components61.js +5 -0
  99. package/dist/fondue-components61.js.map +1 -0
  100. package/dist/fondue-components62.js +42 -0
  101. package/dist/fondue-components62.js.map +1 -0
  102. package/dist/fondue-components63.js +14 -0
  103. package/dist/fondue-components63.js.map +1 -0
  104. package/dist/fondue-components7.js +2 -2
  105. package/dist/fondue-components8.js +2 -2
  106. package/dist/fondue-components9.js +63 -60
  107. package/dist/fondue-components9.js.map +1 -1
  108. package/dist/index.d.ts +54 -0
  109. package/dist/style.css +1 -1
  110. package/package.json +2 -1
@@ -1,18 +1,31 @@
1
- const n = "_content_1dnjb_6", t = "_header_1dnjb_50", e = "_footer_1dnjb_51", o = "_body_1dnjb_52", d = "_underlay_1dnjb_77", _ = "_sideContent_1dnjb_90", s = {
2
- content: n,
3
- header: t,
4
- footer: e,
5
- body: o,
6
- underlay: d,
7
- sideContent: _
8
- };
1
+ const u = 8;
2
+ function c(i) {
3
+ if (!window)
4
+ throw new Error("Window object not found, this method should be used in a browser environment");
5
+ i.style.maxHeight = "";
6
+ const { top: t, bottom: e } = i.getBoundingClientRect();
7
+ t - 8 < 0 ? i.style.maxHeight = `${e - 8}px` : e + 8 > window.innerHeight && (i.style.maxHeight = `${window.innerHeight - t - 8}px`);
8
+ }
9
+ function r(i) {
10
+ const t = i.getBoundingClientRect(), e = t.width > 0 && t.height > 0, n = window.getComputedStyle(i), o = n.display !== "none" && n.visibility !== "hidden" && parseFloat(n.opacity) !== 0, s = t.top < window.innerHeight && t.left < window.innerWidth && t.bottom > 0 && t.right > 0;
11
+ return e && o && s;
12
+ }
13
+ function a(i, t) {
14
+ t && (typeof t == "function" ? t(i.current) : t && "current" in t && (t.current = i.current));
15
+ }
16
+ function h(i) {
17
+ i.currentTarget.dataset.autoFocusVisible = "false";
18
+ }
19
+ function l(i) {
20
+ const t = i.relatedTarget;
21
+ t != null && t.dataset.autoFocusTrigger && (t.dataset.autoFocusVisible === "true" ? i.target.dataset.showFocusRing = "true" : i.target.dataset.showFocusRing = "false", t.dataset.autoFocusVisible = "true");
22
+ }
9
23
  export {
10
- o as body,
11
- n as content,
12
- s as default,
13
- e as footer,
14
- t as header,
15
- _ as sideContent,
16
- d as underlay
24
+ u as MAX_HEIGHT_MARGIN,
25
+ h as addAutoFocusAttribute,
26
+ l as addShowFocusRing,
27
+ r as isElementVisible,
28
+ c as setMaxHeightToAvailableSpace,
29
+ a as syncRefs
17
30
  };
18
31
  //# sourceMappingURL=fondue-components36.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components36.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"fondue-components36.js","sources":["../src/utilities/domUtilities.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type FocusEvent, type MouseEvent as ReactMouseEvent, type ForwardedRef, type RefObject } from 'react';\n\nexport const MAX_HEIGHT_MARGIN = 8;\n\n/**\n * Sets the maximum height for a dialog element based on its position on the viewport.\n * The function calculates the space below the dialog up to the bottom of the viewport window,\n * subtracting a default margin, and sets this value as the max-height style of the dialog.\n *\n * @param {HTMLElement} dialog - The dialog element whose maximum height is to be set.\n *\n * @example\n * // Suppose you have a dialog element with id 'my-dialog'.\n * const dialogElement = myDialogRef.current || document.getElementById('my-dialog');\n * // Setting its max height relative to its current position and the viewport's dimensions.\n * setMaxHeightToAvailableSpace(dialogElement);\n */\nexport function setMaxHeightToAvailableSpace(dialog: HTMLElement) {\n if (!window) {\n throw new Error('Window object not found, this method should be used in a browser environment');\n }\n\n dialog.style.maxHeight = '';\n\n const { top, bottom } = dialog.getBoundingClientRect();\n if (top - MAX_HEIGHT_MARGIN < 0) {\n // if the dialog is overflowing to the top\n dialog.style.maxHeight = `${bottom - MAX_HEIGHT_MARGIN}px`;\n } else if (bottom + MAX_HEIGHT_MARGIN > window.innerHeight) {\n // if the dialog is overflowing to the bottom\n dialog.style.maxHeight = `${window.innerHeight - top - MAX_HEIGHT_MARGIN}px`;\n }\n}\n\n/**\n * Checks if a specified HTML element is visible within the viewport.\n * Visibility is determined by several factors:\n * - The element must have non-zero dimensions.\n * - The element's computed style must not be `display: none`, `visibility: hidden`, or `opacity: 0`.\n * - The element must be within the bounds of the current viewport.\n *\n * @param {HTMLElement} element - The HTML element to check for visibility.\n * @returns {boolean} Returns true if the element is visible according to the criteria specified, otherwise returns false.\n */\nexport function isElementVisible(element: HTMLElement) {\n const rect = element.getBoundingClientRect();\n const hasSize = rect.width > 0 && rect.height > 0;\n\n const style = window.getComputedStyle(element);\n const isVisibleStyle = style.display !== 'none' && style.visibility !== 'hidden' && parseFloat(style.opacity) !== 0;\n\n // Check if the element is within the viewport\n const isInViewport =\n rect.top < window.innerHeight && rect.left < window.innerWidth && rect.bottom > 0 && rect.right > 0;\n\n return hasSize && isVisibleStyle && isInViewport;\n}\n\n/**\n * Assigns a local DOM ref to a forwarded ref.\n *\n * @param {RefObject<HTMLDivElement>} localRef - The local React reference to an HTMLDivElement.\n * @param {ForwardedRef<HTMLDivElement>} forwardedRef - The ref forwarded from a parent component.\n */\nexport function syncRefs(localRef: RefObject<HTMLDivElement>, forwardedRef: ForwardedRef<HTMLDivElement>) {\n if (!forwardedRef) {\n return;\n }\n\n if (typeof forwardedRef === 'function') {\n forwardedRef(localRef.current);\n } else if (forwardedRef && 'current' in forwardedRef) {\n forwardedRef.current = localRef.current;\n }\n}\n\n/**\n * Sets the 'autoFocusVisible' data attribute to 'false' on the current target of a mouse event.\n * This function is typically used to indicate that an element has been interacted with via mouse,\n * which should prevent the focus ring from being displayed when the element receives focus.\n *\n * @param mouseEvent - The mouse event object.\n */\nexport function addAutoFocusAttribute(mouseEvent: ReactMouseEvent<HTMLButtonElement, MouseEvent>) {\n mouseEvent.currentTarget.dataset.autoFocusVisible = 'false';\n}\n\n/**\n * Manages the focus ring visibility based on the previous focus state and the current focus event.\n * This function sets the 'showFocusRing' data attribute on the target element and updates the\n * 'autoFocusVisible' data attribute on the previously focused element.\n *\n * ! This function should be used in conjunction with the 'addAutoFocusAttribute' function and the autoFocusVisible data autoFocusTrigger.\n *\n * @param event - The focus event object.\n */\nexport function addShowFocusRing(event: FocusEvent<HTMLDivElement, HTMLElement>) {\n const triggerElement = event.relatedTarget;\n\n if (!triggerElement?.dataset.autoFocusTrigger) {\n return;\n }\n\n if (triggerElement.dataset.autoFocusVisible === 'true') {\n event.target.dataset.showFocusRing = 'true';\n } else {\n event.target.dataset.showFocusRing = 'false';\n }\n\n triggerElement.dataset.autoFocusVisible = 'true';\n}\n"],"names":["MAX_HEIGHT_MARGIN","setMaxHeightToAvailableSpace","dialog","top","bottom","isElementVisible","element","rect","hasSize","style","isVisibleStyle","isInViewport","syncRefs","localRef","forwardedRef","addAutoFocusAttribute","mouseEvent","addShowFocusRing","event","triggerElement"],"mappings":"AAIO,MAAMA,IAAoB;AAe1B,SAASC,EAA6BC,GAAqB;AAC9D,MAAI,CAAC;AACK,UAAA,IAAI,MAAM,8EAA8E;AAGlG,EAAAA,EAAO,MAAM,YAAY;AAEzB,QAAM,EAAE,KAAAC,GAAK,QAAAC,EAAO,IAAIF,EAAO,sBAAsB;AACjD,EAAAC,IAAM,IAAoB,IAE1BD,EAAO,MAAM,YAAY,GAAGE,IAAS,CAAiB,OAC/CA,IAAS,IAAoB,OAAO,gBAE3CF,EAAO,MAAM,YAAY,GAAG,OAAO,cAAcC,IAAM,CAAiB;AAEhF;AAYO,SAASE,EAAiBC,GAAsB;AAC7C,QAAAC,IAAOD,EAAQ,yBACfE,IAAUD,EAAK,QAAQ,KAAKA,EAAK,SAAS,GAE1CE,IAAQ,OAAO,iBAAiBH,CAAO,GACvCI,IAAiBD,EAAM,YAAY,UAAUA,EAAM,eAAe,YAAY,WAAWA,EAAM,OAAO,MAAM,GAG5GE,IACFJ,EAAK,MAAM,OAAO,eAAeA,EAAK,OAAO,OAAO,cAAcA,EAAK,SAAS,KAAKA,EAAK,QAAQ;AAEtG,SAAOC,KAAWE,KAAkBC;AACxC;AAQgB,SAAAC,EAASC,GAAqCC,GAA4C;AACtG,EAAKA,MAID,OAAOA,KAAiB,aACxBA,EAAaD,EAAS,OAAO,IACtBC,KAAgB,aAAaA,MACpCA,EAAa,UAAUD,EAAS;AAExC;AASO,SAASE,EAAsBC,GAA4D;AACnF,EAAAA,EAAA,cAAc,QAAQ,mBAAmB;AACxD;AAWO,SAASC,EAAiBC,GAAgD;AAC7E,QAAMC,IAAiBD,EAAM;AAEzB,EAACC,KAAA,QAAAA,EAAgB,QAAQ,qBAIzBA,EAAe,QAAQ,qBAAqB,SACtCD,EAAA,OAAO,QAAQ,gBAAgB,SAE/BA,EAAA,OAAO,QAAQ,gBAAgB,SAGzCC,EAAe,QAAQ,mBAAmB;AAC9C;"}
@@ -1,63 +1,18 @@
1
- import { sv as t } from "./fondue-components25.js";
2
- const i = t({
3
- base: "tw-flex tw-self-stretch tw-justify-center ",
4
- variants: {
5
- direction: {
6
- horizontal: "tw-flex-col tw-h-0 tw-border-t tw-w-full",
7
- vertical: "tw-flex-row tw-w-0 tw-border-r tw-h-full "
8
- },
9
- color: {
10
- weak: "tw-border-line-weak",
11
- default: "tw-border-line",
12
- strong: "tw-border-line-strong",
13
- "x-strong": "tw-border-x-line-strong"
14
- },
15
- variant: {
16
- solid: "tw-border-solid",
17
- dashed: "tw-border-dashed",
18
- noline: "tw-border-none"
19
- }
20
- },
21
- compoundVariants: [
22
- {
23
- direction: "horizontal",
24
- padding: "small",
25
- class: "tw-my-4"
26
- },
27
- {
28
- direction: "horizontal",
29
- padding: "medium",
30
- class: "tw-my-7"
31
- },
32
- {
33
- direction: "horizontal",
34
- padding: "large",
35
- class: "tw-my-12"
36
- },
37
- {
38
- direction: "vertical",
39
- padding: "small",
40
- class: "tw-mx-4"
41
- },
42
- {
43
- direction: "vertical",
44
- padding: "medium",
45
- class: "tw-mx-7"
46
- },
47
- {
48
- direction: "vertical",
49
- padding: "large",
50
- class: "tw-mx-12"
51
- }
52
- ],
53
- defaultVariants: {
54
- padding: "medium",
55
- direction: "horizontal",
56
- color: "default",
57
- variant: "solid"
58
- }
59
- });
1
+ const n = "_content_1dnjb_6", t = "_header_1dnjb_50", e = "_footer_1dnjb_51", o = "_body_1dnjb_52", d = "_underlay_1dnjb_77", _ = "_sideContent_1dnjb_90", s = {
2
+ content: n,
3
+ header: t,
4
+ footer: e,
5
+ body: o,
6
+ underlay: d,
7
+ sideContent: _
8
+ };
60
9
  export {
61
- i as dividerStyles
10
+ o as body,
11
+ n as content,
12
+ s as default,
13
+ e as footer,
14
+ t as header,
15
+ _ as sideContent,
16
+ d as underlay
62
17
  };
63
18
  //# sourceMappingURL=fondue-components37.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components37.js","sources":["../src/components/Divider/styles/dividerStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const dividerStyles = sv({\n base: 'tw-flex tw-self-stretch tw-justify-center ',\n variants: {\n direction: {\n horizontal: 'tw-flex-col tw-h-0 tw-border-t tw-w-full',\n vertical: 'tw-flex-row tw-w-0 tw-border-r tw-h-full ',\n },\n color: {\n weak: 'tw-border-line-weak',\n default: 'tw-border-line',\n strong: 'tw-border-line-strong',\n 'x-strong': 'tw-border-x-line-strong',\n },\n variant: {\n solid: 'tw-border-solid',\n dashed: 'tw-border-dashed',\n noline: 'tw-border-none',\n },\n },\n compoundVariants: [\n {\n direction: 'horizontal',\n padding: 'small',\n class: 'tw-my-4',\n },\n {\n direction: 'horizontal',\n padding: 'medium',\n class: 'tw-my-7',\n },\n {\n direction: 'horizontal',\n padding: 'large',\n class: 'tw-my-12',\n },\n {\n direction: 'vertical',\n padding: 'small',\n class: 'tw-mx-4',\n },\n {\n direction: 'vertical',\n padding: 'medium',\n class: 'tw-mx-7',\n },\n {\n direction: 'vertical',\n padding: 'large',\n class: 'tw-mx-12',\n },\n ],\n defaultVariants: {\n padding: 'medium',\n direction: 'horizontal',\n color: 'default',\n variant: 'solid',\n },\n});\n"],"names":["dividerStyles","sv"],"mappings":";AAIO,MAAMA,IAAgBC,EAAG;AAAA,EAC5B,MAAM;AAAA,EACN,UAAU;AAAA,IACN,WAAW;AAAA,MACP,YAAY;AAAA,MACZ,UAAU;AAAA,IACd;AAAA,IACA,OAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB;AAAA,IACA,SAAS;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,IACZ;AAAA,EACJ;AAAA,EACA,kBAAkB;AAAA,IACd;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EACA,iBAAiB;AAAA,IACb,SAAS;AAAA,IACT,WAAW;AAAA,IACX,OAAO;AAAA,IACP,SAAS;AAAA,EACb;AACJ,CAAC;"}
1
+ {"version":3,"file":"fondue-components37.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,18 +1,63 @@
1
- import { useCallback as r, useLayoutEffect as n } from "react";
2
- import { isElementVisible as i, setMaxHeightToAvailableSpace as o } from "./fondue-components35.js";
3
- function u(t) {
4
- const e = r(() => {
5
- requestAnimationFrame(() => {
6
- t.current && i(t.current) && o(t.current);
7
- });
8
- }, [t]);
9
- return n(() => (e(), window.addEventListener("resize", e), () => {
10
- window.removeEventListener("resize", e);
11
- }), [e]), {
12
- setMaxHeight: e
13
- };
14
- }
1
+ import { sv as t } from "./fondue-components26.js";
2
+ const i = t({
3
+ base: "tw-flex tw-self-stretch tw-justify-center ",
4
+ variants: {
5
+ direction: {
6
+ horizontal: "tw-flex-col tw-h-0 tw-border-t tw-w-full",
7
+ vertical: "tw-flex-row tw-w-0 tw-border-r tw-h-full "
8
+ },
9
+ color: {
10
+ weak: "tw-border-line-weak",
11
+ default: "tw-border-line",
12
+ strong: "tw-border-line-strong",
13
+ "x-strong": "tw-border-x-line-strong"
14
+ },
15
+ variant: {
16
+ solid: "tw-border-solid",
17
+ dashed: "tw-border-dashed",
18
+ noline: "tw-border-none"
19
+ }
20
+ },
21
+ compoundVariants: [
22
+ {
23
+ direction: "horizontal",
24
+ padding: "small",
25
+ class: "tw-my-4"
26
+ },
27
+ {
28
+ direction: "horizontal",
29
+ padding: "medium",
30
+ class: "tw-my-7"
31
+ },
32
+ {
33
+ direction: "horizontal",
34
+ padding: "large",
35
+ class: "tw-my-12"
36
+ },
37
+ {
38
+ direction: "vertical",
39
+ padding: "small",
40
+ class: "tw-mx-4"
41
+ },
42
+ {
43
+ direction: "vertical",
44
+ padding: "medium",
45
+ class: "tw-mx-7"
46
+ },
47
+ {
48
+ direction: "vertical",
49
+ padding: "large",
50
+ class: "tw-mx-12"
51
+ }
52
+ ],
53
+ defaultVariants: {
54
+ padding: "medium",
55
+ direction: "horizontal",
56
+ color: "default",
57
+ variant: "solid"
58
+ }
59
+ });
15
60
  export {
16
- u as usePreventDropdownOverflow
61
+ i as dividerStyles
17
62
  };
18
63
  //# sourceMappingURL=fondue-components38.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components38.js","sources":["../src/hooks/usePreventDropdownOverflow.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RefObject, useCallback, useLayoutEffect } from 'react';\n\nimport { isElementVisible, setMaxHeightToAvailableSpace } from '#/utilities/domUtilities';\n\n/**\n * Custom hook to dynamically adjust the maximum height of an HTMLElement\n * based on the window's resize events. This function provides an object\n * containing the `setMaxHeight` method to manually trigger\n * the maximum height adjustment if needed.\n *\n * ! Note: Components utilizing this hook should have tests in place to verify\n * ! that in each scenario, the height is correctly adjusted accodrding to the\n * ! requirements of the component and the viewport.\n *\n * @param {RefObject<HTMLElement | null>} ref - A reference to the HTMLElement.\n * @returns {Object} An object containing `setMaxHeight` method.\n */\nexport function usePreventDropdownOverflow(ref: RefObject<HTMLElement | null>) {\n const setMaxHeight = useCallback(() => {\n requestAnimationFrame(() => {\n if (ref.current && isElementVisible(ref.current)) {\n setMaxHeightToAvailableSpace(ref.current);\n }\n });\n }, [ref]);\n\n useLayoutEffect(() => {\n setMaxHeight();\n window.addEventListener('resize', setMaxHeight);\n return () => {\n window.removeEventListener('resize', setMaxHeight);\n };\n }, [setMaxHeight]);\n\n return {\n setMaxHeight,\n };\n}\n"],"names":["usePreventDropdownOverflow","ref","setMaxHeight","useCallback","isElementVisible","setMaxHeightToAvailableSpace","useLayoutEffect"],"mappings":";;AAmBO,SAASA,EAA2BC,GAAoC;AACrE,QAAAC,IAAeC,EAAY,MAAM;AACnC,0BAAsB,MAAM;AACxB,MAAIF,EAAI,WAAWG,EAAiBH,EAAI,OAAO,KAC3CI,EAA6BJ,EAAI,OAAO;AAAA,IAC5C,CACH;AAAA,EAAA,GACF,CAACA,CAAG,CAAC;AAER,SAAAK,EAAgB,OACCJ,KACN,OAAA,iBAAiB,UAAUA,CAAY,GACvC,MAAM;AACF,WAAA,oBAAoB,UAAUA,CAAY;AAAA,EAAA,IAEtD,CAACA,CAAY,CAAC,GAEV;AAAA,IACH,cAAAA;AAAA,EAAA;AAER;"}
1
+ {"version":3,"file":"fondue-components38.js","sources":["../src/components/Divider/styles/dividerStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const dividerStyles = sv({\n base: 'tw-flex tw-self-stretch tw-justify-center ',\n variants: {\n direction: {\n horizontal: 'tw-flex-col tw-h-0 tw-border-t tw-w-full',\n vertical: 'tw-flex-row tw-w-0 tw-border-r tw-h-full ',\n },\n color: {\n weak: 'tw-border-line-weak',\n default: 'tw-border-line',\n strong: 'tw-border-line-strong',\n 'x-strong': 'tw-border-x-line-strong',\n },\n variant: {\n solid: 'tw-border-solid',\n dashed: 'tw-border-dashed',\n noline: 'tw-border-none',\n },\n },\n compoundVariants: [\n {\n direction: 'horizontal',\n padding: 'small',\n class: 'tw-my-4',\n },\n {\n direction: 'horizontal',\n padding: 'medium',\n class: 'tw-my-7',\n },\n {\n direction: 'horizontal',\n padding: 'large',\n class: 'tw-my-12',\n },\n {\n direction: 'vertical',\n padding: 'small',\n class: 'tw-mx-4',\n },\n {\n direction: 'vertical',\n padding: 'medium',\n class: 'tw-mx-7',\n },\n {\n direction: 'vertical',\n padding: 'large',\n class: 'tw-mx-12',\n },\n ],\n defaultVariants: {\n padding: 'medium',\n direction: 'horizontal',\n color: 'default',\n variant: 'solid',\n },\n});\n"],"names":["dividerStyles","sv"],"mappings":";AAIO,MAAMA,IAAgBC,EAAG;AAAA,EAC5B,MAAM;AAAA,EACN,UAAU;AAAA,IACN,WAAW;AAAA,MACP,YAAY;AAAA,MACZ,UAAU;AAAA,IACd;AAAA,IACA,OAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB;AAAA,IACA,SAAS;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,IACZ;AAAA,EACJ;AAAA,EACA,kBAAkB;AAAA,IACd;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EACA,iBAAiB;AAAA,IACb,SAAS;AAAA,IACT,WAAW;AAAA,IACX,OAAO;AAAA,IACP,SAAS;AAAA,EACb;AACJ,CAAC;"}
@@ -1,22 +1,18 @@
1
- const t = "_content_1m5jw_5", n = "_subContent_1m5jw_6", o = "_item_1m5jw_32", e = "_subTrigger_1m5jw_33", s = "_itemContent_1m5jw_72", _ = "_subMenuIndicator_1m5jw_79", u = "_group_1m5jw_85", c = "_slot_1m5jw_92", m = {
2
- content: t,
3
- subContent: n,
4
- item: o,
5
- subTrigger: e,
6
- itemContent: s,
7
- subMenuIndicator: _,
8
- group: u,
9
- slot: c
10
- };
1
+ import { useCallback as r, useLayoutEffect as n } from "react";
2
+ import { isElementVisible as i, setMaxHeightToAvailableSpace as o } from "./fondue-components36.js";
3
+ function u(t) {
4
+ const e = r(() => {
5
+ requestAnimationFrame(() => {
6
+ t.current && i(t.current) && o(t.current);
7
+ });
8
+ }, [t]);
9
+ return n(() => (e(), window.addEventListener("resize", e), () => {
10
+ window.removeEventListener("resize", e);
11
+ }), [e]), {
12
+ setMaxHeight: e
13
+ };
14
+ }
11
15
  export {
12
- t as content,
13
- m as default,
14
- u as group,
15
- o as item,
16
- s as itemContent,
17
- c as slot,
18
- n as subContent,
19
- _ as subMenuIndicator,
20
- e as subTrigger
16
+ u as usePreventDropdownOverflow
21
17
  };
22
18
  //# sourceMappingURL=fondue-components39.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components39.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components39.js","sources":["../src/hooks/usePreventDropdownOverflow.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RefObject, useCallback, useLayoutEffect } from 'react';\n\nimport { isElementVisible, setMaxHeightToAvailableSpace } from '#/utilities/domUtilities';\n\n/**\n * Custom hook to dynamically adjust the maximum height of an HTMLElement\n * based on the window's resize events. This function provides an object\n * containing the `setMaxHeight` method to manually trigger\n * the maximum height adjustment if needed.\n *\n * ! Note: Components utilizing this hook should have tests in place to verify\n * ! that in each scenario, the height is correctly adjusted accodrding to the\n * ! requirements of the component and the viewport.\n *\n * @param {RefObject<HTMLElement | null>} ref - A reference to the HTMLElement.\n * @returns {Object} An object containing `setMaxHeight` method.\n */\nexport function usePreventDropdownOverflow(ref: RefObject<HTMLElement | null>) {\n const setMaxHeight = useCallback(() => {\n requestAnimationFrame(() => {\n if (ref.current && isElementVisible(ref.current)) {\n setMaxHeightToAvailableSpace(ref.current);\n }\n });\n }, [ref]);\n\n useLayoutEffect(() => {\n setMaxHeight();\n window.addEventListener('resize', setMaxHeight);\n return () => {\n window.removeEventListener('resize', setMaxHeight);\n };\n }, [setMaxHeight]);\n\n return {\n setMaxHeight,\n };\n}\n"],"names":["usePreventDropdownOverflow","ref","setMaxHeight","useCallback","isElementVisible","setMaxHeightToAvailableSpace","useLayoutEffect"],"mappings":";;AAmBO,SAASA,EAA2BC,GAAoC;AACrE,QAAAC,IAAeC,EAAY,MAAM;AACnC,0BAAsB,MAAM;AACxB,MAAIF,EAAI,WAAWG,EAAiBH,EAAI,OAAO,KAC3CI,EAA6BJ,EAAI,OAAO;AAAA,IAC5C,CACH;AAAA,EAAA,GACF,CAACA,CAAG,CAAC;AAER,SAAAK,EAAgB,OACCJ,KACN,OAAA,iBAAiB,UAAUA,CAAY,GACvC,MAAM;AACF,WAAA,oBAAoB,UAAUA,CAAY;AAAA,EAAA,IAEtD,CAACA,CAAY,CAAC,GAEV;AAAA,IACH,cAAAA;AAAA,EAAA;AAER;"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
2
  import { forwardRef as b } from "react";
3
- import { cn as y } from "./fondue-components25.js";
4
- import { buttonStyles as r } from "./fondue-components26.js";
5
- import { iconStyles as x } from "./fondue-components27.js";
6
- import { textStyles as S } from "./fondue-components28.js";
3
+ import { cn as y } from "./fondue-components26.js";
4
+ import { buttonStyles as r } from "./fondue-components27.js";
5
+ import { iconStyles as x } from "./fondue-components28.js";
6
+ import { textStyles as S } from "./fondue-components29.js";
7
7
  const k = b(
8
8
  ({
9
9
  children: u,
@@ -1,8 +1,22 @@
1
- const o = "_root_gh190_5", t = {
2
- root: o
1
+ const t = "_content_1nvda_5", n = "_subContent_1nvda_6", o = "_item_1nvda_19", e = "_subTrigger_1nvda_41", s = "_itemContent_1nvda_85", _ = "_subMenuIndicator_1nvda_96", u = "_group_1nvda_102", c = "_slot_1nvda_109", a = {
2
+ content: t,
3
+ subContent: n,
4
+ item: o,
5
+ subTrigger: e,
6
+ itemContent: s,
7
+ subMenuIndicator: _,
8
+ group: u,
9
+ slot: c
3
10
  };
4
11
  export {
5
- t as default,
6
- o as root
12
+ t as content,
13
+ a as default,
14
+ u as group,
15
+ o as item,
16
+ s as itemContent,
17
+ c as slot,
18
+ n as subContent,
19
+ _ as subMenuIndicator,
20
+ e as subTrigger
7
21
  };
8
22
  //# sourceMappingURL=fondue-components40.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components40.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"fondue-components40.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -1,16 +1,8 @@
1
- const o = "_root_1t27u_5", t = "_header_1t27u_48", e = "_body_1t27u_68", _ = "_footer_1t27u_86", s = "_close_1t27u_106", r = {
2
- root: o,
3
- header: t,
4
- body: e,
5
- footer: _,
6
- close: s
1
+ const o = "_root_gh190_5", t = {
2
+ root: o
7
3
  };
8
4
  export {
9
- e as body,
10
- s as close,
11
- r as default,
12
- _ as footer,
13
- t as header,
5
+ t as default,
14
6
  o as root
15
7
  };
16
8
  //# sourceMappingURL=fondue-components41.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components41.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"fondue-components41.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,8 +1,16 @@
1
- const o = "_root_umks5_5", t = {
2
- root: o
1
+ const o = "_root_1t27u_5", t = "_header_1t27u_48", e = "_body_1t27u_68", _ = "_footer_1t27u_86", s = "_close_1t27u_106", r = {
2
+ root: o,
3
+ header: t,
4
+ body: e,
5
+ footer: _,
6
+ close: s
3
7
  };
4
8
  export {
5
- t as default,
9
+ e as body,
10
+ s as close,
11
+ r as default,
12
+ _ as footer,
13
+ t as header,
6
14
  o as root
7
15
  };
8
16
  //# sourceMappingURL=fondue-components42.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components42.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"fondue-components42.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,38 +1,8 @@
1
- import { sv as t } from "./fondue-components25.js";
2
- const i = t({
3
- base: "tw-relative tw-w-full tw-overflow-hidden",
4
- variants: {
5
- rounded: {
6
- true: "tw-rounded"
7
- },
8
- size: {
9
- small: "tw-h-1",
10
- medium: "tw-h-2",
11
- large: "tw-h-3",
12
- "x-large": "tw-h-4"
13
- },
14
- variant: {
15
- default: "tw-bg-box-selected",
16
- positive: "tw-bg-box-positive",
17
- negative: "tw-bg-box-negative"
18
- }
19
- }
20
- }), a = t({
21
- base: "tw-h-full tw-w-full",
22
- variants: {
23
- variant: {
24
- default: "tw-bg-text-interactive",
25
- positive: "tw-bg-text-positive",
26
- negative: "tw-bg-text-negative"
27
- },
28
- indeterminateState: {
29
- true: "tw-animate-loading-bar-infinite tw-origin-left-right",
30
- false: "tw-transition-all tw-origin-left tw-scale-x-[--loading-bar-proportion]"
31
- }
32
- }
33
- });
1
+ const o = "_root_umks5_5", t = {
2
+ root: o
3
+ };
34
4
  export {
35
- i as loadingBarContainerStyles,
36
- a as loadingBarStyles
5
+ t as default,
6
+ o as root
37
7
  };
38
8
  //# sourceMappingURL=fondue-components43.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components43.js","sources":["../src/components/LoadingBar/styles/loadingBarStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const loadingBarContainerStyles = sv({\n base: 'tw-relative tw-w-full tw-overflow-hidden',\n variants: {\n rounded: {\n true: 'tw-rounded',\n },\n size: {\n small: 'tw-h-1',\n medium: 'tw-h-2',\n large: 'tw-h-3',\n 'x-large': 'tw-h-4',\n },\n variant: {\n default: 'tw-bg-box-selected',\n positive: 'tw-bg-box-positive',\n negative: 'tw-bg-box-negative',\n },\n },\n});\n\nexport const loadingBarStyles = sv({\n base: 'tw-h-full tw-w-full',\n variants: {\n variant: {\n default: 'tw-bg-text-interactive',\n positive: 'tw-bg-text-positive',\n negative: 'tw-bg-text-negative',\n },\n indeterminateState: {\n true: 'tw-animate-loading-bar-infinite tw-origin-left-right',\n false: 'tw-transition-all tw-origin-left tw-scale-x-[--loading-bar-proportion]',\n },\n },\n});\n"],"names":["loadingBarContainerStyles","sv","loadingBarStyles"],"mappings":";AAIO,MAAMA,IAA4BC,EAAG;AAAA,EACxC,MAAM;AAAA,EACN,UAAU;AAAA,IACN,SAAS;AAAA,MACL,MAAM;AAAA,IACV;AAAA,IACA,MAAM;AAAA,MACF,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAW;AAAA,IACf;AAAA,IACA,SAAS;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IACd;AAAA,EACJ;AACJ,CAAC,GAEYC,IAAmBD,EAAG;AAAA,EAC/B,MAAM;AAAA,EACN,UAAU;AAAA,IACN,SAAS;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IACd;AAAA,IACA,oBAAoB;AAAA,MAChB,MAAM;AAAA,MACN,OAAO;AAAA,IACX;AAAA,EACJ;AACJ,CAAC;"}
1
+ {"version":3,"file":"fondue-components43.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,16 +1,38 @@
1
- const o = "_root_1qzyp_3", r = "_viewport_1qzyp_10", t = "_scrollbar_1qzyp_16", _ = "_thumb_1qzyp_42", c = "_corner_1qzyp_61", s = {
2
- root: o,
3
- viewport: r,
4
- scrollbar: t,
5
- thumb: _,
6
- corner: c
7
- };
1
+ import { sv as t } from "./fondue-components26.js";
2
+ const i = t({
3
+ base: "tw-relative tw-w-full tw-overflow-hidden",
4
+ variants: {
5
+ rounded: {
6
+ true: "tw-rounded"
7
+ },
8
+ size: {
9
+ small: "tw-h-1",
10
+ medium: "tw-h-2",
11
+ large: "tw-h-3",
12
+ "x-large": "tw-h-4"
13
+ },
14
+ variant: {
15
+ default: "tw-bg-box-selected",
16
+ positive: "tw-bg-box-positive",
17
+ negative: "tw-bg-box-negative"
18
+ }
19
+ }
20
+ }), a = t({
21
+ base: "tw-h-full tw-w-full",
22
+ variants: {
23
+ variant: {
24
+ default: "tw-bg-text-interactive",
25
+ positive: "tw-bg-text-positive",
26
+ negative: "tw-bg-text-negative"
27
+ },
28
+ indeterminateState: {
29
+ true: "tw-animate-loading-bar-infinite tw-origin-left-right",
30
+ false: "tw-transition-all tw-origin-left tw-scale-x-[--loading-bar-proportion]"
31
+ }
32
+ }
33
+ });
8
34
  export {
9
- c as corner,
10
- s as default,
11
- o as root,
12
- t as scrollbar,
13
- _ as thumb,
14
- r as viewport
35
+ i as loadingBarContainerStyles,
36
+ a as loadingBarStyles
15
37
  };
16
38
  //# sourceMappingURL=fondue-components44.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components44.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"fondue-components44.js","sources":["../src/components/LoadingBar/styles/loadingBarStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const loadingBarContainerStyles = sv({\n base: 'tw-relative tw-w-full tw-overflow-hidden',\n variants: {\n rounded: {\n true: 'tw-rounded',\n },\n size: {\n small: 'tw-h-1',\n medium: 'tw-h-2',\n large: 'tw-h-3',\n 'x-large': 'tw-h-4',\n },\n variant: {\n default: 'tw-bg-box-selected',\n positive: 'tw-bg-box-positive',\n negative: 'tw-bg-box-negative',\n },\n },\n});\n\nexport const loadingBarStyles = sv({\n base: 'tw-h-full tw-w-full',\n variants: {\n variant: {\n default: 'tw-bg-text-interactive',\n positive: 'tw-bg-text-positive',\n negative: 'tw-bg-text-negative',\n },\n indeterminateState: {\n true: 'tw-animate-loading-bar-infinite tw-origin-left-right',\n false: 'tw-transition-all tw-origin-left tw-scale-x-[--loading-bar-proportion]',\n },\n },\n});\n"],"names":["loadingBarContainerStyles","sv","loadingBarStyles"],"mappings":";AAIO,MAAMA,IAA4BC,EAAG;AAAA,EACxC,MAAM;AAAA,EACN,UAAU;AAAA,IACN,SAAS;AAAA,MACL,MAAM;AAAA,IACV;AAAA,IACA,MAAM;AAAA,MACF,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAW;AAAA,IACf;AAAA,IACA,SAAS;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IACd;AAAA,EACJ;AACJ,CAAC,GAEYC,IAAmBD,EAAG;AAAA,EAC/B,MAAM;AAAA,EACN,UAAU;AAAA,IACN,SAAS;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IACd;AAAA,IACA,oBAAoB;AAAA,MAChB,MAAM;AAAA,MACN,OAAO;AAAA,IACX;AAAA,EACJ;AACJ,CAAC;"}
@@ -1,8 +1,16 @@
1
- const o = "_root_yrjuz_5", t = {
2
- root: o
1
+ const o = "_root_1baw4_3", r = "_viewport_1baw4_10", t = "_scrollbar_1baw4_16", _ = "_thumb_1baw4_48", c = "_corner_1baw4_67", s = {
2
+ root: o,
3
+ viewport: r,
4
+ scrollbar: t,
5
+ thumb: _,
6
+ corner: c
3
7
  };
4
8
  export {
5
- t as default,
6
- o as root
9
+ c as corner,
10
+ s as default,
11
+ o as root,
12
+ t as scrollbar,
13
+ _ as thumb,
14
+ r as viewport
7
15
  };
8
16
  //# sourceMappingURL=fondue-components45.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components45.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"fondue-components45.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,28 +1,8 @@
1
- import { useMemo as f, useCallback as d, useState as v, useRef as S, useEffect as m } from "react";
2
- const U = ({
3
- prop: e,
4
- defaultProp: n,
5
- onChange: s = () => {
6
- }
7
- }) => {
8
- const [o, c] = b({ defaultProp: n, onChange: s }), t = e !== void 0, i = t ? e : o, r = f(() => s, [s]), a = d(
9
- (l) => {
10
- if (t) {
11
- const u = typeof l == "function" ? l(e) : l;
12
- u !== e && r(u);
13
- } else
14
- c(l);
15
- },
16
- [t, e, c, r]
17
- );
18
- return [i, a];
19
- }, b = ({ defaultProp: e, onChange: n }) => {
20
- const s = v(e), [o] = s, c = S(o), t = f(() => n, [n]);
21
- return m(() => {
22
- c.current !== o && (t == null || t(o), c.current = o);
23
- }, [o, c, t]), s;
1
+ const o = "_root_yrjuz_5", t = {
2
+ root: o
24
3
  };
25
4
  export {
26
- U as useControllableState
5
+ t as default,
6
+ o as root
27
7
  };
28
8
  //# sourceMappingURL=fondue-components46.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components46.js","sources":["../src/hooks/useControllableState.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Dispatch, type SetStateAction, useCallback, useMemo, useState, useRef, useEffect } from 'react';\n\n// Radix UI handy hook for handling controlled and uncontrolled state\n// Source: https://github.com/radix-ui/primitives/blob/main/packages/react/use-controllable-state/src/useControllableState.tsx\n\ntype UseControllableStateParams<TValue> = {\n prop?: TValue;\n defaultProp?: TValue;\n onChange?: (state: TValue) => void;\n};\n\ntype SetStateFn<T> = (prevState?: T) => T;\n\nexport const useControllableState = <TValue>({\n prop,\n defaultProp,\n onChange = () => {},\n}: UseControllableStateParams<TValue>) => {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });\n const isControlled = prop !== undefined;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useMemo(() => onChange, [onChange]);\n\n const setValue: Dispatch<SetStateAction<TValue | undefined>> = useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue as SetStateFn<TValue>;\n const value = typeof nextValue === 'function' ? setter(prop) : nextValue;\n if (value !== prop) {\n handleChange(value as TValue);\n }\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange],\n );\n\n return [value, setValue] as const;\n};\n\nconst useUncontrolledState = <TValue>({ defaultProp, onChange }: Omit<UseControllableStateParams<TValue>, 'prop'>) => {\n const uncontrolledState = useState<TValue | undefined>(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = useRef(value);\n const handleChange = useMemo(() => onChange, [onChange]);\n\n useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange?.(value as TValue);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n\n return uncontrolledState;\n};\n"],"names":["useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","value","handleChange","useMemo","setValue","useCallback","nextValue","uncontrolledState","useState","prevValueRef","useRef","useEffect"],"mappings":";AAeO,MAAMA,IAAuB,CAAS;AAAA,EACzC,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC,IAAW,MAAM;AAAA,EAAC;AACtB,MAA0C;AAChC,QAAA,CAACC,GAAkBC,CAAmB,IAAIC,EAAqB,EAAE,aAAAJ,GAAa,UAAAC,GAAU,GACxFI,IAAeN,MAAS,QACxBO,IAAQD,IAAeN,IAAOG,GAC9BK,IAAeC,EAAQ,MAAMP,GAAU,CAACA,CAAQ,CAAC,GAEjDQ,IAAyDC;AAAA,IAC3D,CAACC,MAAc;AACX,UAAIN,GAAc;AAEd,cAAMC,IAAQ,OAAOK,KAAc,aADpBA,EACwCZ,CAAI,IAAIY;AAC/D,QAAIL,MAAUP,KACVQ,EAAaD,CAAe;AAAA,MAChC;AAEA,QAAAH,EAAoBQ,CAAS;AAAA,IAErC;AAAA,IACA,CAACN,GAAcN,GAAMI,GAAqBI,CAAY;AAAA,EAAA;AAGnD,SAAA,CAACD,GAAOG,CAAQ;AAC3B,GAEML,IAAuB,CAAS,EAAE,aAAAJ,GAAa,UAAAC,QAAiE;AAC5G,QAAAW,IAAoBC,EAA6Bb,CAAW,GAC5D,CAACM,CAAK,IAAIM,GACVE,IAAeC,EAAOT,CAAK,GAC3BC,IAAeC,EAAQ,MAAMP,GAAU,CAACA,CAAQ,CAAC;AAEvD,SAAAe,EAAU,MAAM;AACR,IAAAF,EAAa,YAAYR,MACzBC,KAAA,QAAAA,EAAeD,IACfQ,EAAa,UAAUR;AAAA,EAE5B,GAAA,CAACA,GAAOQ,GAAcP,CAAY,CAAC,GAE/BK;AACX;"}
1
+ {"version":3,"file":"fondue-components46.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,20 +1,28 @@
1
- const t = "_root_1ioi3_5", i = "_item_1ioi3_26", e = "_itemLabel_1ioi3_46", o = "_itemLabelActive_1ioi3_65", a = "_itemLabelInactive_1ioi3_88", _ = "_activeIndicator_1ioi3_112", c = "_separator_1ioi3_203", n = {
2
- root: t,
3
- item: i,
4
- itemLabel: e,
5
- itemLabelActive: o,
6
- itemLabelInactive: a,
7
- activeIndicator: _,
8
- separator: c
1
+ import { useMemo as f, useCallback as d, useState as v, useRef as S, useEffect as m } from "react";
2
+ const U = ({
3
+ prop: e,
4
+ defaultProp: n,
5
+ onChange: s = () => {
6
+ }
7
+ }) => {
8
+ const [o, c] = b({ defaultProp: n, onChange: s }), t = e !== void 0, i = t ? e : o, r = f(() => s, [s]), a = d(
9
+ (l) => {
10
+ if (t) {
11
+ const u = typeof l == "function" ? l(e) : l;
12
+ u !== e && r(u);
13
+ } else
14
+ c(l);
15
+ },
16
+ [t, e, c, r]
17
+ );
18
+ return [i, a];
19
+ }, b = ({ defaultProp: e, onChange: n }) => {
20
+ const s = v(e), [o] = s, c = S(o), t = f(() => n, [n]);
21
+ return m(() => {
22
+ c.current !== o && (t == null || t(o), c.current = o);
23
+ }, [o, c, t]), s;
9
24
  };
10
25
  export {
11
- _ as activeIndicator,
12
- n as default,
13
- i as item,
14
- e as itemLabel,
15
- o as itemLabelActive,
16
- a as itemLabelInactive,
17
- t as root,
18
- c as separator
26
+ U as useControllableState
19
27
  };
20
28
  //# sourceMappingURL=fondue-components47.js.map