@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.
- package/dist/fondue-components.js +32 -30
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +2 -2
- package/dist/fondue-components11.js +3 -3
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components13.js +1 -1
- package/dist/fondue-components14.js +1 -1
- package/dist/fondue-components15.js +1 -1
- package/dist/fondue-components16.js +2 -2
- package/dist/fondue-components17.js +2 -2
- package/dist/fondue-components18.js +6 -6
- package/dist/fondue-components19.js +1 -1
- package/dist/fondue-components20.js +2 -2
- package/dist/fondue-components21.js +116 -65
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +64 -41
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +43 -32
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +32 -5
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +5 -12
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +10 -153
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +59 -22
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +17 -17
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +112 -15
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +2 -2
- package/dist/fondue-components30.js +19 -30
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +32 -28
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +23 -125
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +129 -20
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +21 -45
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +45 -28
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +28 -15
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +15 -60
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +60 -15
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +15 -19
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +4 -4
- package/dist/fondue-components40.js +18 -4
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +3 -11
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +11 -3
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +5 -35
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +35 -13
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +12 -4
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +4 -24
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +24 -16
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +16 -139
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +140 -16
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +16 -72
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +72 -8
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +8 -33
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +32 -48
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +48 -10
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +8 -10
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +12 -17
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +52 -6
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +15 -2
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +17 -10
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +5 -5
- package/dist/fondue-components60.js +6 -38
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +5 -0
- package/dist/fondue-components61.js.map +1 -0
- package/dist/fondue-components62.js +42 -0
- package/dist/fondue-components62.js.map +1 -0
- package/dist/fondue-components63.js +14 -0
- package/dist/fondue-components63.js.map +1 -0
- package/dist/fondue-components7.js +2 -2
- package/dist/fondue-components8.js +2 -2
- package/dist/fondue-components9.js +63 -60
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +54 -0
- package/dist/style.css +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Children as a, isValidElement as u, cloneElement as f } from "react";
|
|
2
|
+
import { ForwardedRefSelectItem as E } from "./fondue-components50.js";
|
|
3
|
+
const g = ({
|
|
4
|
+
children: r,
|
|
5
|
+
value: o,
|
|
6
|
+
label: s
|
|
7
|
+
}) => r && typeof r == "string" ? {
|
|
8
|
+
value: o || r,
|
|
9
|
+
label: s || r
|
|
10
|
+
} : {
|
|
11
|
+
value: o || "",
|
|
12
|
+
label: s || o || ""
|
|
13
|
+
}, w = (r, o) => u(r) && r.type === o, y = (r, o, s, p = 0) => {
|
|
14
|
+
const n = [];
|
|
15
|
+
let t = 0;
|
|
16
|
+
return a.forEach(r, (e) => {
|
|
17
|
+
if (w(e, E) && u(e))
|
|
18
|
+
g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(o(e, p + t)), t++);
|
|
19
|
+
else if (u(e) && (e != null && e.props.children)) {
|
|
20
|
+
const { parsedChildren: m, subElementCount: C } = y(
|
|
21
|
+
e.props.children,
|
|
22
|
+
o,
|
|
23
|
+
"",
|
|
24
|
+
p + t
|
|
25
|
+
);
|
|
26
|
+
e = f(e, {
|
|
27
|
+
children: m,
|
|
28
|
+
key: `group-${p + t}`
|
|
29
|
+
}), n.push(e), t += C;
|
|
30
|
+
} else
|
|
31
|
+
n.push(e);
|
|
32
|
+
}), {
|
|
33
|
+
parsedChildren: n,
|
|
34
|
+
subElementCount: t
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
g as getSelectOptionValue,
|
|
39
|
+
w as isReactLeaf,
|
|
40
|
+
y as recursiveMap
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=fondue-components62.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fondue-components62.js","sources":["../src/components/Select/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n type JSXElementConstructor,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\n\n/**\n * Extracts and returns an object containing `value` and `label` from a given SelectItemProps object.\n * It prioritizes explicit `value` and `label` properties but will fall back to using `children` as the value or label if necessary.\n *\n * @param {SelectItemProps} props - The properties of a select item, which include potential children, value, and label.\n * @returns {{ value: string; label: string }} An object containing `value` and `label` as strings.\n *\n * @example\n * // Returns { value: 'option1', label: 'Option 1' }\n * getSelectOptionValue({ value: 'option1', label: 'Option 1' });\n *\n * @example\n * // Uses children as the value and label when they are not explicitly provided\n * // Returns { value: 'Default', label: 'Default' }\n * getSelectOptionValue({ children: 'Default' });\n */\nexport const getSelectOptionValue = ({\n children,\n value,\n label,\n}: SelectItemProps): {\n value: string;\n label: string;\n} => {\n if (children && typeof children === 'string') {\n return {\n value: value ? value : children,\n label: label ? label : children,\n };\n }\n\n return {\n value: value || '',\n label: label ? label : value || '',\n };\n};\n/**\n * Determines if the child is a leaf node of React, meaning it has one final child of a native type;\n *\n * @param {ReactNode} child - The React child node to check.\n * @param {JSXElementConstructor<never>} Component - The React component constructor used for comparison.\n * @returns {boolean} Returns true if the `child` is a valid React element of the specified `Component` type.\n *\n * @example\n * // Assuming ForwardedRefSelectItem is a component that renders an <input> element\n * // Returns true\n * isReactLeaf(<ForwardedRefSelectItem />, ForwardedRefSelectItem);\n *\n * @example\n * // Returns false for non-matching types or non-leaf components\n * isReactLeaf(<div><ForwardedRefSelectItem /></div>, ForwardedRefSelectItem);\n */\nexport const isReactLeaf = (child: ReactNode, Component: JSXElementConstructor<never>): child is ReactElement =>\n isValidElement(child) && child.type === Component;\n\n/**\n * Recursively maps through React children, applying a callback to each child that meets the specified conditions.\n * This function is useful for deeply nested structures where modifications or checks are needed at multiple levels.\n *\n * @param {ReactNode} children - The children to be recursively processed.\n * @param {function(ReactNode, number): ReactNode} callback - A function that is called for each child that meets the condition. It receives the child and its index, and returns a React node.\n * @param {string} [filterText=''] - Optional text used to filter children based on their properties.\n * @param {number} [nextIndex=0] - The starting index for numbering children, defaults to 0.\n * @returns {{ parsedChildren: ReactNode[], subElementCount: number }} An object containing the transformed children array and the count of all processed sub-elements.\n *\n * @example\n * // Example usage in a select component where only items containing a certain text are modified\n * recursiveMap(children, (child, index) => React.cloneElement(child, { extraProp: 'value' }), 'specific text');\n *\n * @example\n * // Nested structure transformation, adding class names based on index\n * recursiveMap(children, (child, index) => React.cloneElement(child, { className: `item-${index}` }));\n */\nexport const recursiveMap = (\n children: ReactNode,\n callback: (child: ReactNode, nextIndex: number) => ReactNode,\n filterText?: string,\n nextIndex: number = 0,\n): {\n parsedChildren: ReactNode[];\n subElementCount: number;\n} => {\n const resultingChildren: ReactNode[] = [];\n let itemCounter = 0;\n Children.forEach(children, (child) => {\n if (isReactLeaf(child, ForwardedRefSelectItem) && isValidElement<SelectItemProps>(child)) {\n if (\n getSelectOptionValue(child.props)\n .label.toLowerCase()\n .includes(filterText?.toLowerCase() || '')\n ) {\n resultingChildren.push(callback(child, nextIndex + itemCounter));\n itemCounter++;\n }\n } else if (isValidElement<{ children: ReactNode }>(child) && child?.props.children) {\n const { parsedChildren, subElementCount } = recursiveMap(\n child.props.children,\n callback,\n '',\n nextIndex + itemCounter,\n );\n child = cloneElement(child, {\n children: parsedChildren,\n key: `group-${nextIndex + itemCounter}`,\n });\n resultingChildren.push(child);\n itemCounter += subElementCount;\n } else {\n resultingChildren.push(child);\n }\n });\n return {\n parsedChildren: resultingChildren,\n subElementCount: itemCounter,\n };\n};\n"],"names":["getSelectOptionValue","children","value","label","isReactLeaf","child","Component","isValidElement","recursiveMap","callback","filterText","nextIndex","resultingChildren","itemCounter","Children","ForwardedRefSelectItem","parsedChildren","subElementCount","cloneElement"],"mappings":";;AA6BO,MAAMA,IAAuB,CAAC;AAAA,EACjC,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AACJ,MAIQF,KAAY,OAAOA,KAAa,WACzB;AAAA,EACH,OAAOC,KAAgBD;AAAA,EACvB,OAAOE,KAAgBF;AAAA,IAIxB;AAAA,EACH,OAAOC,KAAS;AAAA,EAChB,OAAOC,KAAgBD,KAAS;AAAA,GAmB3BE,IAAc,CAACC,GAAkBC,MAC1CC,EAAeF,CAAK,KAAKA,EAAM,SAASC,GAoB/BE,IAAe,CACxBP,GACAQ,GACAC,GACAC,IAAoB,MAInB;AACD,QAAMC,IAAiC,CAAA;AACvC,MAAIC,IAAc;AACT,SAAAC,EAAA,QAAQb,GAAU,CAACI,MAAU;AAClC,QAAID,EAAYC,GAAOU,CAAsB,KAAKR,EAAgCF,CAAK;AACnF,MACIL,EAAqBK,EAAM,KAAK,EAC3B,MAAM,cACN,UAASK,KAAA,gBAAAA,EAAY,kBAAiB,EAAE,MAE7CE,EAAkB,KAAKH,EAASJ,GAAOM,IAAYE,CAAW,CAAC,GAC/DA;AAAA,aAEGN,EAAwCF,CAAK,MAAKA,KAAA,QAAAA,EAAO,MAAM,WAAU;AAC1E,YAAA,EAAE,gBAAAW,GAAgB,iBAAAC,EAAA,IAAoBT;AAAA,QACxCH,EAAM,MAAM;AAAA,QACZI;AAAA,QACA;AAAA,QACAE,IAAYE;AAAA,MAAA;AAEhB,MAAAR,IAAQa,EAAab,GAAO;AAAA,QACxB,UAAUW;AAAA,QACV,KAAK,SAASL,IAAYE,CAAW;AAAA,MAAA,CACxC,GACDD,EAAkB,KAAKP,CAAK,GACbQ,KAAAI;AAAA,IAAA;AAEf,MAAAL,EAAkB,KAAKP,CAAK;AAAA,EAChC,CACH,GACM;AAAA,IACH,gBAAgBO;AAAA,IAChB,iBAAiBC;AAAA,EAAA;AAEzB;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const o = "_root_18q6l_5", c = "_colorName_18q6l_60", t = "_colorIndicator_18q6l_64", r = "_caret_18q6l_70", l = {
|
|
2
|
+
root: o,
|
|
3
|
+
colorName: c,
|
|
4
|
+
colorIndicator: t,
|
|
5
|
+
caret: r
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
r as caret,
|
|
9
|
+
t as colorIndicator,
|
|
10
|
+
c as colorName,
|
|
11
|
+
l as default,
|
|
12
|
+
o as root
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=fondue-components63.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fondue-components63.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -2,8 +2,8 @@ import { jsx as a, jsxs as T } from "react/jsx-runtime";
|
|
|
2
2
|
import { IconCross as F } from "@frontify/fondue-icons";
|
|
3
3
|
import * as i from "@radix-ui/react-dialog";
|
|
4
4
|
import { createContext as M, forwardRef as l, useContext as S } from "react";
|
|
5
|
-
import { addAutoFocusAttribute as B, addShowFocusRing as H } from "./fondue-
|
|
6
|
-
import r from "./fondue-
|
|
5
|
+
import { addAutoFocusAttribute as B, addShowFocusRing as H } from "./fondue-components36.js";
|
|
6
|
+
import r from "./fondue-components37.js";
|
|
7
7
|
const n = M({ isModal: !1 }), g = ({ children: t, ...o }) => /* @__PURE__ */ a(n.Provider, { value: { isModal: o.modal ?? !1 }, children: /* @__PURE__ */ a(i.Root, { ...o, children: t }) });
|
|
8
8
|
g.displayName = "Dialog.Root";
|
|
9
9
|
const c = ({ asChild: t = !0, children: o, "data-test-id": e = "fondue-dialog-trigger" }, d) => /* @__PURE__ */ a(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "@radix-ui/react-separator";
|
|
3
3
|
import { forwardRef as p } from "react";
|
|
4
|
-
import { cn as f } from "./fondue-
|
|
5
|
-
import { dividerStyles as n } from "./fondue-
|
|
4
|
+
import { cn as f } from "./fondue-components26.js";
|
|
5
|
+
import { dividerStyles as n } from "./fondue-components38.js";
|
|
6
6
|
const r = ({
|
|
7
7
|
"data-test-id": o = "fondue-divider",
|
|
8
8
|
direction: t = "horizontal",
|
|
@@ -1,106 +1,109 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { IconCaretRight as
|
|
1
|
+
import { jsx as e, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { IconCaretRight as h } from "@frontify/fondue-icons";
|
|
3
3
|
import * as d from "@radix-ui/react-dropdown-menu";
|
|
4
|
-
import { forwardRef as s, useRef as
|
|
5
|
-
import { usePreventDropdownOverflow as
|
|
6
|
-
import { syncRefs as
|
|
7
|
-
import a from "./fondue-
|
|
8
|
-
const
|
|
4
|
+
import { forwardRef as s, useRef as l } from "react";
|
|
5
|
+
import { usePreventDropdownOverflow as v } from "./fondue-components39.js";
|
|
6
|
+
import { syncRefs as f } from "./fondue-components36.js";
|
|
7
|
+
import a from "./fondue-components40.js";
|
|
8
|
+
const g = ({
|
|
9
9
|
children: o,
|
|
10
10
|
open: t,
|
|
11
11
|
onOpenChange: r,
|
|
12
12
|
"data-test-id": n = "fondue-dropdown"
|
|
13
13
|
}) => /* @__PURE__ */ e(d.Root, { open: t, onOpenChange: r, "data-test-id": n, children: o });
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
14
|
+
g.displayName = "Dropdown.Root";
|
|
15
|
+
const D = ({ asChild: o = !0, children: t, "data-test-id": r = "fondue-dropdown-trigger" }, n) => /* @__PURE__ */ e(d.Trigger, { asChild: o, "data-test-id": r, ref: n, children: t });
|
|
16
|
+
D.displayName = "Dropdown.Trigger";
|
|
17
|
+
const b = ({
|
|
18
18
|
onOpen: o,
|
|
19
19
|
onClose: t,
|
|
20
20
|
side: r = "bottom",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
padding: n = "comfortable",
|
|
22
|
+
align: p = "start",
|
|
23
|
+
children: u,
|
|
24
|
+
"data-test-id": c = "fondue-dropdown-content"
|
|
25
|
+
}, m) => {
|
|
26
|
+
const i = l(null), w = l(!1), { setMaxHeight: F } = v(i);
|
|
25
27
|
return /* @__PURE__ */ e(d.Portal, { children: /* @__PURE__ */ e(
|
|
26
28
|
d.Content,
|
|
27
29
|
{
|
|
28
|
-
align:
|
|
30
|
+
align: p,
|
|
29
31
|
collisionPadding: 8,
|
|
30
32
|
sideOffset: 8,
|
|
31
33
|
side: r,
|
|
32
34
|
className: a.content,
|
|
33
|
-
"data-
|
|
35
|
+
"data-padding": n,
|
|
36
|
+
"data-test-id": c,
|
|
34
37
|
ref: i,
|
|
35
38
|
onCloseAutoFocus: () => {
|
|
36
|
-
|
|
39
|
+
f(i, m), t && t(), w.current = !1;
|
|
37
40
|
},
|
|
38
41
|
onFocus: () => {
|
|
39
|
-
w.current || (
|
|
42
|
+
w.current || (F(), f(i, m), o && o(), w.current = !0);
|
|
40
43
|
},
|
|
41
|
-
children:
|
|
44
|
+
children: u
|
|
42
45
|
}
|
|
43
46
|
) });
|
|
44
47
|
};
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
48
|
+
b.displayName = "Dropdown.Content";
|
|
49
|
+
const N = ({ children: o, "data-test-id": t = "fondue-dropdown-group" }, r) => /* @__PURE__ */ e(d.Group, { className: a.group, "data-test-id": t, ref: r, children: o });
|
|
50
|
+
N.displayName = "Dropdown.Group";
|
|
51
|
+
const S = ({
|
|
49
52
|
children: o,
|
|
50
53
|
"data-test-id": t = "fondue-dropdown-submenu"
|
|
51
54
|
}) => /* @__PURE__ */ e(d.Sub, { "data-test-id": t, children: o });
|
|
52
|
-
|
|
53
|
-
const
|
|
55
|
+
S.displayName = "Dropdown.SubMenu";
|
|
56
|
+
const R = ({ children: o, "data-test-id": t = "fondue-dropdown-subtrigger" }, r) => /* @__PURE__ */ I(d.SubTrigger, { className: a.subTrigger, "data-test-id": t, ref: r, children: [
|
|
54
57
|
/* @__PURE__ */ e("div", { className: a.itemContent, children: o }),
|
|
55
|
-
/* @__PURE__ */ e(
|
|
58
|
+
/* @__PURE__ */ e(h, { className: a.subMenuIndicator, size: 16 })
|
|
56
59
|
] });
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const
|
|
60
|
+
R.displayName = "Dropdown.SubTrigger";
|
|
61
|
+
const C = ({ children: o, "data-test-id": t = "fondue-dropdown-subcontent" }, r) => /* @__PURE__ */ e(d.Portal, { children: /* @__PURE__ */ e(d.SubContent, { className: a.subContent, "data-test-id": t, ref: r, children: o }) });
|
|
62
|
+
C.displayName = "Dropdown.SubContent";
|
|
63
|
+
const y = ({
|
|
61
64
|
children: o,
|
|
62
65
|
disabled: t,
|
|
63
66
|
textValue: r,
|
|
64
67
|
onSelect: n,
|
|
65
|
-
"data-test-id":
|
|
66
|
-
...
|
|
67
|
-
},
|
|
68
|
+
"data-test-id": p = "fondue-dropdown-subtrigger",
|
|
69
|
+
...u
|
|
70
|
+
}, c) => /* @__PURE__ */ e(
|
|
68
71
|
d.Item,
|
|
69
72
|
{
|
|
70
73
|
onSelect: n,
|
|
71
74
|
className: a.item,
|
|
72
75
|
textValue: r,
|
|
73
|
-
"data-test-id":
|
|
74
|
-
ref:
|
|
76
|
+
"data-test-id": p,
|
|
77
|
+
ref: c,
|
|
75
78
|
disabled: t,
|
|
76
|
-
...
|
|
79
|
+
...u,
|
|
77
80
|
children: /* @__PURE__ */ e("div", { className: a.itemContent, children: o })
|
|
78
81
|
}
|
|
79
82
|
);
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
Root:
|
|
85
|
-
Trigger:
|
|
86
|
-
Content:
|
|
87
|
-
Group:
|
|
88
|
-
SubMenu:
|
|
89
|
-
SubTrigger:
|
|
90
|
-
SubContent:
|
|
91
|
-
Item:
|
|
92
|
-
Slot:
|
|
83
|
+
y.displayName = "Dropdown.Item";
|
|
84
|
+
const T = ({ children: o, name: t, "data-test-id": r = "fondue-dropdown-slot" }, n) => /* @__PURE__ */ e("div", { "data-name": t, className: a.slot, "data-test-id": r, ref: n, children: o });
|
|
85
|
+
T.displayName = "Dropdown.Slot";
|
|
86
|
+
const x = s(D), G = s(b), M = s(N), P = s(R), j = s(C), O = s(y), z = s(T), J = {
|
|
87
|
+
Root: g,
|
|
88
|
+
Trigger: x,
|
|
89
|
+
Content: G,
|
|
90
|
+
Group: M,
|
|
91
|
+
SubMenu: S,
|
|
92
|
+
SubTrigger: P,
|
|
93
|
+
SubContent: j,
|
|
94
|
+
Item: O,
|
|
95
|
+
Slot: z
|
|
93
96
|
};
|
|
94
97
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
J as Dropdown,
|
|
99
|
+
b as DropdownContent,
|
|
100
|
+
N as DropdownGroup,
|
|
101
|
+
y as DropdownItem,
|
|
102
|
+
g as DropdownRoot,
|
|
103
|
+
T as DropdownSlot,
|
|
104
|
+
C as DropdownSubContent,
|
|
105
|
+
S as DropdownSubMenu,
|
|
106
|
+
R as DropdownSubTrigger,
|
|
107
|
+
D as DropdownTrigger
|
|
105
108
|
};
|
|
106
109
|
//# sourceMappingURL=fondue-components9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretRight } from '@frontify/fondue-icons';\nimport * as RadixDropdown from '@radix-ui/react-dropdown-menu';\nimport { forwardRef, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { usePreventDropdownOverflow } from '#/hooks/usePreventDropdownOverflow';\nimport { syncRefs } from '#/utilities/domUtilities';\n\nimport styles from './styles/dropdown.module.scss';\n\nexport type DropdownRootProps = {\n children?: ReactNode;\n /**\n * Controls the open state of the dropdown.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the dropdown changes.\n */\n onOpenChange?: (open: boolean) => void;\n 'data-test-id'?: string;\n};\n\nexport const DropdownRoot = ({\n children,\n open,\n onOpenChange,\n 'data-test-id': dataTestId = 'fondue-dropdown',\n}: DropdownRootProps) => {\n return (\n <RadixDropdown.Root open={open} onOpenChange={onOpenChange} data-test-id={dataTestId}>\n {children}\n </RadixDropdown.Root>\n );\n};\nDropdownRoot.displayName = 'Dropdown.Root';\n\nexport type DropdownTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dropdown-trigger' }: DropdownTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDropdown.Trigger asChild={asChild} data-test-id={dataTestId} ref={ref}>\n {children}\n </RadixDropdown.Trigger>\n );\n};\nDropdownTrigger.displayName = 'Dropdown.Trigger';\n\nexport type DropdownContentProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n onOpen?: () => void;\n onClose?: () => void;\n /**\n * Defines the preferred side of the dropdown. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const DropdownContent = (\n {\n onOpen,\n onClose,\n side = 'bottom',\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-content',\n }: DropdownContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const localRef = useRef(null);\n const dropdownIsOpen = useRef(false);\n\n const { setMaxHeight } = usePreventDropdownOverflow(localRef);\n\n return (\n <RadixDropdown.Portal>\n <RadixDropdown.Content\n align=\"start\"\n collisionPadding={8}\n sideOffset={8}\n side={side}\n className={styles.content}\n data-test-id={dataTestId}\n ref={localRef}\n onCloseAutoFocus={() => {\n syncRefs(localRef, ref);\n onClose && onClose();\n dropdownIsOpen.current = false;\n }}\n onFocus={() => {\n if (!dropdownIsOpen.current) {\n setMaxHeight();\n syncRefs(localRef, ref);\n onOpen && onOpen();\n dropdownIsOpen.current = true;\n }\n }}\n >\n {children}\n </RadixDropdown.Content>\n </RadixDropdown.Portal>\n );\n};\nDropdownContent.displayName = 'Dropdown.Content';\n\nexport type DropdownGroupProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownGroup = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-group' }: DropdownGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.Group className={styles.group} data-test-id={dataTestId} ref={ref}>\n {children}\n </RadixDropdown.Group>\n );\n};\nDropdownGroup.displayName = 'Dropdown.Group';\n\nexport type DropdownSubMenuProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubMenu = ({\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-submenu',\n}: DropdownSubMenuProps) => {\n return <RadixDropdown.Sub data-test-id={dataTestId}>{children}</RadixDropdown.Sub>;\n};\nDropdownSubMenu.displayName = 'Dropdown.SubMenu';\n\nexport type DropdownSubTriggerProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger' }: DropdownSubTriggerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.SubTrigger className={styles.subTrigger} data-test-id={dataTestId} ref={ref}>\n <div className={styles.itemContent}>{children}</div>\n <IconCaretRight className={styles.subMenuIndicator} size={16} />\n </RadixDropdown.SubTrigger>\n );\n};\nDropdownSubTrigger.displayName = 'Dropdown.SubTrigger';\n\nexport type DropdownSubContentProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subcontent' }: DropdownSubContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.Portal>\n <RadixDropdown.SubContent className={styles.subContent} data-test-id={dataTestId} ref={ref}>\n {children}\n </RadixDropdown.SubContent>\n </RadixDropdown.Portal>\n );\n};\nDropdownSubContent.displayName = 'Dropdown.SubContent';\n\nexport type DropdownItemProps = {\n children: ReactNode;\n /**\n * Disables the item.\n */\n disabled?: boolean;\n /**\n * The text value of the item that is passed to the onSelect callback.\n */\n textValue?: string;\n /**\n * Callback that is called when the item is selected.\n */\n onSelect?: (event: Event) => void;\n 'data-test-id'?: string;\n};\n\nexport const DropdownItem = (\n {\n children,\n disabled,\n textValue,\n onSelect,\n 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger',\n ...props\n }: DropdownItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.Item\n onSelect={onSelect}\n className={styles.item}\n textValue={textValue}\n data-test-id={dataTestId}\n ref={ref}\n disabled={disabled}\n {...props}\n >\n <div className={styles.itemContent}>{children}</div>\n </RadixDropdown.Item>\n );\n};\nDropdownItem.displayName = 'Dropdown.Item';\n\nexport type DropdownSlotProps = { children: ReactNode; name?: 'left' | 'right'; 'data-test-id'?: string };\n\nexport const DropdownSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-dropdown-slot' }: DropdownSlotProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-name={name} className={styles.slot} data-test-id={dataTestId} ref={ref}>\n {children}\n </div>\n );\n};\nDropdownSlot.displayName = 'Dropdown.Slot';\n\nconst ForwardedRefDropdownTrigger = forwardRef<HTMLButtonElement, DropdownTriggerProps>(DropdownTrigger);\nconst ForwardedRefDropdownContent = forwardRef<HTMLDivElement, DropdownContentProps>(DropdownContent);\nconst ForwardedRefDropdownGroup = forwardRef<HTMLDivElement, DropdownGroupProps>(DropdownGroup);\nconst ForwardedRefDropdownSubTrigger = forwardRef<HTMLDivElement, DropdownSubTriggerProps>(DropdownSubTrigger);\nconst ForwardedRefDropdownSubContent = forwardRef<HTMLDivElement, DropdownSubContentProps>(DropdownSubContent);\nconst ForwardedRefDropdownItem = forwardRef<HTMLDivElement, DropdownItemProps>(DropdownItem);\nconst ForwardedRefDropdownSlot = forwardRef<HTMLDivElement, DropdownSlotProps>(DropdownSlot);\n\nexport const Dropdown = {\n Root: DropdownRoot,\n Trigger: ForwardedRefDropdownTrigger,\n Content: ForwardedRefDropdownContent,\n Group: ForwardedRefDropdownGroup,\n SubMenu: DropdownSubMenu,\n SubTrigger: ForwardedRefDropdownSubTrigger,\n SubContent: ForwardedRefDropdownSubContent,\n Item: ForwardedRefDropdownItem,\n Slot: ForwardedRefDropdownSlot,\n};\n"],"names":["DropdownRoot","children","open","onOpenChange","dataTestId","jsx","RadixDropdown","DropdownTrigger","asChild","ref","DropdownContent","onOpen","onClose","side","localRef","useRef","dropdownIsOpen","setMaxHeight","usePreventDropdownOverflow","styles","syncRefs","DropdownGroup","DropdownSubMenu","DropdownSubTrigger","jsxs","IconCaretRight","DropdownSubContent","DropdownItem","disabled","textValue","onSelect","props","DropdownSlot","name","ForwardedRefDropdownTrigger","forwardRef","ForwardedRefDropdownContent","ForwardedRefDropdownGroup","ForwardedRefDropdownSubTrigger","ForwardedRefDropdownSubContent","ForwardedRefDropdownItem","ForwardedRefDropdownSlot","Dropdown"],"mappings":";;;;;;;AAwBO,MAAMA,IAAe,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAgBC,IAAa;AACjC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AAA,EAAI,WAAWc,EAAO,aAAc,UAAAlB,GAAS;AAAA,EAAA;AAAA;AAI1D0B,EAAa,cAAc;AAId,MAAAK,IAAe,CACxB,EAAE,UAAA/B,GAAU,MAAAgC,GAAM,gBAAgB7B,IAAa,uBAAuB,GACtEK,MAGI,gBAAAJ,EAAC,OAAI,EAAA,aAAW4B,GAAM,WAAWd,EAAO,MAAM,gBAAcf,GAAY,KAAAK,GACnE,UAAAR,EACL,CAAA;AAGR+B,EAAa,cAAc;AAE3B,MAAME,IAA8BC,EAAoD5B,CAAe,GACjG6B,IAA8BD,EAAiDzB,CAAe,GAC9F2B,IAA4BF,EAA+Cd,CAAa,GACxFiB,IAAiCH,EAAoDZ,CAAkB,GACvGgB,IAAiCJ,EAAoDT,CAAkB,GACvGc,IAA2BL,EAA8CR,CAAY,GACrFc,IAA2BN,EAA8CH,CAAY,GAE9EU,IAAW;AAAA,EACpB,MAAM1C;AAAA,EACN,SAASkC;AAAA,EACT,SAASE;AAAA,EACT,OAAOC;AAAA,EACP,SAASf;AAAA,EACT,YAAYgB;AAAA,EACZ,YAAYC;AAAA,EACZ,MAAMC;AAAA,EACN,MAAMC;AACV;"}
|
|
1
|
+
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretRight } from '@frontify/fondue-icons';\nimport * as RadixDropdown from '@radix-ui/react-dropdown-menu';\nimport { forwardRef, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { usePreventDropdownOverflow } from '#/hooks/usePreventDropdownOverflow';\nimport { syncRefs } from '#/utilities/domUtilities';\n\nimport styles from './styles/dropdown.module.scss';\n\nexport type DropdownRootProps = {\n children?: ReactNode;\n /**\n * Controls the open state of the dropdown.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the dropdown changes.\n */\n onOpenChange?: (open: boolean) => void;\n 'data-test-id'?: string;\n};\n\nexport const DropdownRoot = ({\n children,\n open,\n onOpenChange,\n 'data-test-id': dataTestId = 'fondue-dropdown',\n}: DropdownRootProps) => {\n return (\n <RadixDropdown.Root open={open} onOpenChange={onOpenChange} data-test-id={dataTestId}>\n {children}\n </RadixDropdown.Root>\n );\n};\nDropdownRoot.displayName = 'Dropdown.Root';\n\nexport type DropdownTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dropdown-trigger' }: DropdownTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDropdown.Trigger asChild={asChild} data-test-id={dataTestId} ref={ref}>\n {children}\n </RadixDropdown.Trigger>\n );\n};\nDropdownTrigger.displayName = 'Dropdown.Trigger';\n\nexport type DropdownContentProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n onOpen?: () => void;\n onClose?: () => void;\n /**\n * The vertical padding around each dropdown item.\n * @default \"comfortable\"\n */\n padding?: 'comfortable' | 'compact';\n /**\n * Defines the alignment of the dropdown.\n * @default \"start\"\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Defines the preferred side of the dropdown. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const DropdownContent = (\n {\n onOpen,\n onClose,\n side = 'bottom',\n padding = 'comfortable',\n align = 'start',\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-content',\n }: DropdownContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const localRef = useRef(null);\n const dropdownIsOpen = useRef(false);\n\n const { setMaxHeight } = usePreventDropdownOverflow(localRef);\n\n return (\n <RadixDropdown.Portal>\n <RadixDropdown.Content\n align={align}\n collisionPadding={8}\n sideOffset={8}\n side={side}\n className={styles.content}\n data-padding={padding}\n data-test-id={dataTestId}\n ref={localRef}\n onCloseAutoFocus={() => {\n syncRefs(localRef, ref);\n onClose && onClose();\n dropdownIsOpen.current = false;\n }}\n onFocus={() => {\n if (!dropdownIsOpen.current) {\n setMaxHeight();\n syncRefs(localRef, ref);\n onOpen && onOpen();\n dropdownIsOpen.current = true;\n }\n }}\n >\n {children}\n </RadixDropdown.Content>\n </RadixDropdown.Portal>\n );\n};\nDropdownContent.displayName = 'Dropdown.Content';\n\nexport type DropdownGroupProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownGroup = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-group' }: DropdownGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.Group className={styles.group} data-test-id={dataTestId} ref={ref}>\n {children}\n </RadixDropdown.Group>\n );\n};\nDropdownGroup.displayName = 'Dropdown.Group';\n\nexport type DropdownSubMenuProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubMenu = ({\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-submenu',\n}: DropdownSubMenuProps) => {\n return <RadixDropdown.Sub data-test-id={dataTestId}>{children}</RadixDropdown.Sub>;\n};\nDropdownSubMenu.displayName = 'Dropdown.SubMenu';\n\nexport type DropdownSubTriggerProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger' }: DropdownSubTriggerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.SubTrigger className={styles.subTrigger} data-test-id={dataTestId} ref={ref}>\n <div className={styles.itemContent}>{children}</div>\n <IconCaretRight className={styles.subMenuIndicator} size={16} />\n </RadixDropdown.SubTrigger>\n );\n};\nDropdownSubTrigger.displayName = 'Dropdown.SubTrigger';\n\nexport type DropdownSubContentProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subcontent' }: DropdownSubContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.Portal>\n <RadixDropdown.SubContent className={styles.subContent} data-test-id={dataTestId} ref={ref}>\n {children}\n </RadixDropdown.SubContent>\n </RadixDropdown.Portal>\n );\n};\nDropdownSubContent.displayName = 'Dropdown.SubContent';\n\nexport type DropdownItemProps = {\n children: ReactNode;\n /**\n * Disables the item.\n */\n disabled?: boolean;\n /**\n * The text value of the item that is passed to the onSelect callback.\n */\n textValue?: string;\n /**\n * Callback that is called when the item is selected.\n */\n onSelect?: (event: Event) => void;\n 'data-test-id'?: string;\n};\n\nexport const DropdownItem = (\n {\n children,\n disabled,\n textValue,\n onSelect,\n 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger',\n ...props\n }: DropdownItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDropdown.Item\n onSelect={onSelect}\n className={styles.item}\n textValue={textValue}\n data-test-id={dataTestId}\n ref={ref}\n disabled={disabled}\n {...props}\n >\n <div className={styles.itemContent}>{children}</div>\n </RadixDropdown.Item>\n );\n};\nDropdownItem.displayName = 'Dropdown.Item';\n\nexport type DropdownSlotProps = { children: ReactNode; name?: 'left' | 'right'; 'data-test-id'?: string };\n\nexport const DropdownSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-dropdown-slot' }: DropdownSlotProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-name={name} className={styles.slot} data-test-id={dataTestId} ref={ref}>\n {children}\n </div>\n );\n};\nDropdownSlot.displayName = 'Dropdown.Slot';\n\nconst ForwardedRefDropdownTrigger = forwardRef<HTMLButtonElement, DropdownTriggerProps>(DropdownTrigger);\nconst ForwardedRefDropdownContent = forwardRef<HTMLDivElement, DropdownContentProps>(DropdownContent);\nconst ForwardedRefDropdownGroup = forwardRef<HTMLDivElement, DropdownGroupProps>(DropdownGroup);\nconst ForwardedRefDropdownSubTrigger = forwardRef<HTMLDivElement, DropdownSubTriggerProps>(DropdownSubTrigger);\nconst ForwardedRefDropdownSubContent = forwardRef<HTMLDivElement, DropdownSubContentProps>(DropdownSubContent);\nconst ForwardedRefDropdownItem = forwardRef<HTMLDivElement, DropdownItemProps>(DropdownItem);\nconst ForwardedRefDropdownSlot = forwardRef<HTMLDivElement, DropdownSlotProps>(DropdownSlot);\n\nexport const Dropdown = {\n Root: DropdownRoot,\n Trigger: ForwardedRefDropdownTrigger,\n Content: ForwardedRefDropdownContent,\n Group: ForwardedRefDropdownGroup,\n SubMenu: DropdownSubMenu,\n SubTrigger: ForwardedRefDropdownSubTrigger,\n SubContent: ForwardedRefDropdownSubContent,\n Item: ForwardedRefDropdownItem,\n Slot: ForwardedRefDropdownSlot,\n};\n"],"names":["DropdownRoot","children","open","onOpenChange","dataTestId","jsx","RadixDropdown","DropdownTrigger","asChild","ref","DropdownContent","onOpen","onClose","side","padding","align","localRef","useRef","dropdownIsOpen","setMaxHeight","usePreventDropdownOverflow","styles","syncRefs","DropdownGroup","DropdownSubMenu","DropdownSubTrigger","jsxs","IconCaretRight","DropdownSubContent","DropdownItem","disabled","textValue","onSelect","props","DropdownSlot","name","ForwardedRefDropdownTrigger","forwardRef","ForwardedRefDropdownContent","ForwardedRefDropdownGroup","ForwardedRefDropdownSubTrigger","ForwardedRefDropdownSubContent","ForwardedRefDropdownItem","ForwardedRefDropdownSlot","Dropdown"],"mappings":";;;;;;;AAwBO,MAAMA,IAAe,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAgBC,IAAa;AACjC,MAEQ,gBAAAC,EAACC,EAAc,MAAd,EAAmB,MAAAJ,GAAY,cAAAC,GAA4B,gBAAcC,GACrE,UAAAH,EACL,CAAA;AAGRD,EAAa,cAAc;AAYd,MAAAO,IAAkB,CAC3B,EAAE,SAAAC,IAAU,IAAM,UAAAP,GAAU,gBAAgBG,IAAa,0BAA0B,GACnFK,MAGI,gBAAAJ,EAACC,EAAc,SAAd,EAA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AGI,gBAAAJ,EAAC,OAAI,EAAA,aAAW8B,GAAM,WAAWd,EAAO,MAAM,gBAAcjB,GAAY,KAAAK,GACnE,UAAAR,EACL,CAAA;AAGRiC,EAAa,cAAc;AAE3B,MAAME,IAA8BC,EAAoD9B,CAAe,GACjG+B,IAA8BD,EAAiD3B,CAAe,GAC9F6B,IAA4BF,EAA+Cd,CAAa,GACxFiB,IAAiCH,EAAoDZ,CAAkB,GACvGgB,IAAiCJ,EAAoDT,CAAkB,GACvGc,IAA2BL,EAA8CR,CAAY,GACrFc,IAA2BN,EAA8CH,CAAY,GAE9EU,IAAW;AAAA,EACpB,MAAM5C;AAAA,EACN,SAASoC;AAAA,EACT,SAASE;AAAA,EACT,OAAOC;AAAA,EACP,SAASf;AAAA,EACT,YAAYgB;AAAA,EACZ,YAAYC;AAAA,EACZ,MAAMC;AAAA,EACN,MAAMC;AACV;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -482,6 +482,16 @@ declare type DropdownContentProps = {
|
|
|
482
482
|
'data-test-id'?: string;
|
|
483
483
|
onOpen?: () => void;
|
|
484
484
|
onClose?: () => void;
|
|
485
|
+
/**
|
|
486
|
+
* The vertical padding around each dropdown item.
|
|
487
|
+
* @default "comfortable"
|
|
488
|
+
*/
|
|
489
|
+
padding?: 'comfortable' | 'compact';
|
|
490
|
+
/**
|
|
491
|
+
* Defines the alignment of the dropdown.
|
|
492
|
+
* @default "start"
|
|
493
|
+
*/
|
|
494
|
+
align?: 'start' | 'center' | 'end';
|
|
485
495
|
/**
|
|
486
496
|
* Defines the preferred side of the dropdown. It will not be respected if there are collisions with the viewport.
|
|
487
497
|
* @default "bottom"
|
|
@@ -1241,6 +1251,50 @@ declare type SwitchProps = {
|
|
|
1241
1251
|
'data-test-id'?: string;
|
|
1242
1252
|
} & CommonAriaAttrs;
|
|
1243
1253
|
|
|
1254
|
+
export declare const Tabs: {
|
|
1255
|
+
Root: ForwardRefExoticComponent<TabsRootProps & RefAttributes<HTMLDivElement>>;
|
|
1256
|
+
Tab: ForwardRefExoticComponent<TabsTabProps & RefAttributes<HTMLDivElement>>;
|
|
1257
|
+
Trigger: ForwardRefExoticComponent<TabsTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
1258
|
+
Content: ForwardRefExoticComponent<TabsContentProps & RefAttributes<HTMLDivElement>>;
|
|
1259
|
+
};
|
|
1260
|
+
|
|
1261
|
+
declare type TabsContentProps = {
|
|
1262
|
+
children: ReactNode;
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
declare type TabsRootProps = {
|
|
1266
|
+
id?: string;
|
|
1267
|
+
children: ReactNode;
|
|
1268
|
+
/**
|
|
1269
|
+
* The default active tab
|
|
1270
|
+
* Used for uncontrolled components
|
|
1271
|
+
*/
|
|
1272
|
+
defaultActiveTab?: string;
|
|
1273
|
+
/**
|
|
1274
|
+
* The controlled value of the active tab
|
|
1275
|
+
*/
|
|
1276
|
+
activeTab?: string;
|
|
1277
|
+
/**
|
|
1278
|
+
* The height of the tabs
|
|
1279
|
+
* @default 'medium'
|
|
1280
|
+
*/
|
|
1281
|
+
size?: 'medium' | 'large';
|
|
1282
|
+
/**
|
|
1283
|
+
* Event handler called when the active tab changes
|
|
1284
|
+
*/
|
|
1285
|
+
onActiveTabChange?: (value: string) => void;
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
declare type TabsTabProps = {
|
|
1289
|
+
children: ReactNode;
|
|
1290
|
+
value: string;
|
|
1291
|
+
disabled?: boolean;
|
|
1292
|
+
};
|
|
1293
|
+
|
|
1294
|
+
declare type TabsTriggerProps = {
|
|
1295
|
+
children: ReactNode;
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1244
1298
|
declare const TextFieldRoot: {
|
|
1245
1299
|
({ children, className, status, "data-test-id": dataTestId, ...inputProps }: TextInputProps, ref: ForwardedRef<HTMLInputElement>): JSX_2.Element;
|
|
1246
1300
|
displayName: string;
|