@frontify/fondue-components 20.0.0-beta.8 → 20.0.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.
- package/dist/fondue-components.js +46 -50
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +3 -3
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +66 -84
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components13.js +49 -50
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +2 -2
- package/dist/fondue-components15.js +2 -2
- package/dist/fondue-components16.js +2 -2
- package/dist/fondue-components17.js +36 -56
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +16 -34
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +71 -21
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +36 -18
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +55 -71
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +138 -36
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +50 -50
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +29 -138
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +157 -53
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +137 -29
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +127 -157
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +30 -134
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +58 -128
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +101 -31
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +12 -59
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +52 -97
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +20 -12
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +7 -55
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +6 -20
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +32 -8
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +3 -5
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +12 -32
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +155 -5
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +2 -2
- package/dist/fondue-components40.js +116 -18
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +22 -59
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +14 -111
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +30 -116
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +53 -21
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +129 -31
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +20 -52
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +53 -130
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +7 -20
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +13 -53
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +14 -7
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +5 -13
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +60 -15
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +18 -5
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +19 -59
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +5 -18
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +14 -18
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +1 -1
- package/dist/fondue-components58.js +16 -10
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +10 -4
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +4 -4
- package/dist/fondue-components60.js +35 -18
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +4 -10
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +10 -34
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +5 -35
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +24 -4
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +16 -12
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +150 -4
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +19 -25
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +77 -16
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +8 -151
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +2 -2
- package/dist/fondue-components70.js +37 -19
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +69 -76
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +11 -8
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +12 -36
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +12 -70
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +20 -10
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +34 -13
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +10 -12
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +55 -20
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +15 -34
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +24 -9
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +14 -55
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +22 -14
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +6 -24
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +5 -13
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +4 -22
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +4 -8
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +2 -7
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +39 -4
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +6 -5
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +42 -45
- package/dist/fondue-components9.js.map +1 -1
- package/dist/fondue-components90.js +10 -10
- package/dist/index.d.ts +6 -119
- package/dist/style.css +1 -1
- package/package.json +5 -6
- package/dist/fondue-components91.js +0 -5
- package/dist/fondue-components91.js.map +0 -1
- package/dist/fondue-components92.js +0 -43
- package/dist/fondue-components92.js.map +0 -1
- package/dist/fondue-components93.js +0 -9
- package/dist/fondue-components93.js.map +0 -1
|
@@ -1,8 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Children as a, isValidElement as u, cloneElement as f } from "react";
|
|
2
|
+
import { ForwardedRefSelectItem as E } from "./fondue-components67.js";
|
|
3
|
+
const g = ({
|
|
4
|
+
children: o,
|
|
5
|
+
value: r,
|
|
6
|
+
label: s
|
|
7
|
+
}) => o && typeof o == "string" ? {
|
|
8
|
+
value: r || o,
|
|
9
|
+
label: s || o
|
|
10
|
+
} : {
|
|
11
|
+
value: r || "",
|
|
12
|
+
label: s || r || "",
|
|
13
|
+
...o ? { children: o } : null
|
|
14
|
+
}, w = (o, r) => u(o) && o.type === r, y = (o, r, s, p = 0) => {
|
|
15
|
+
const n = [];
|
|
16
|
+
let t = 0;
|
|
17
|
+
return a.forEach(o, (e) => {
|
|
18
|
+
if (w(e, E) && u(e))
|
|
19
|
+
g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(r(e, p + t)), t++);
|
|
20
|
+
else if (u(e) && (e != null && e.props.children)) {
|
|
21
|
+
const { parsedChildren: m, subElementCount: C } = y(
|
|
22
|
+
e.props.children,
|
|
23
|
+
r,
|
|
24
|
+
"",
|
|
25
|
+
p + t
|
|
26
|
+
);
|
|
27
|
+
e = f(e, {
|
|
28
|
+
children: m,
|
|
29
|
+
key: `group-${p + t}`
|
|
30
|
+
}), n.push(e), t += C;
|
|
31
|
+
} else
|
|
32
|
+
n.push(e);
|
|
33
|
+
}), {
|
|
34
|
+
parsedChildren: n,
|
|
35
|
+
subElementCount: t
|
|
36
|
+
};
|
|
3
37
|
};
|
|
4
38
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
39
|
+
g as getSelectOptionValue,
|
|
40
|
+
w as isReactLeaf,
|
|
41
|
+
y as recursiveMap
|
|
7
42
|
};
|
|
8
43
|
//# sourceMappingURL=fondue-components88.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components88.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components88.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, children?: ReactNode }} 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 children?: ReactNode;\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 ...(children ? { children } : null),\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,MAKQF,KAAY,OAAOA,KAAa,WACzB;AAAA,EACH,OAAOC,KAAgBD;AAAA,EACvB,OAAOE,KAAgBF;AAAA,IAIxB;AAAA,EACH,OAAOC,KAAS;AAAA,EAChB,OAAOC,KAAgBD,KAAS;AAAA,EAChC,GAAID,IAAW,EAAE,UAAAA,MAAa;AAAA,GAmBzBG,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;AAClB,SAAAC,EAAS,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;AAChF,YAAM,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,GAC5BQ,KAAeI;AAAA,IACnB;AACI,MAAAL,EAAkB,KAAKP,CAAK;AAAA,EAEpC,CAAC,GACM;AAAA,IACH,gBAAgBO;AAAA,IAChB,iBAAiBC;AAAA,EAAA;AAEzB;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as s } from "@frontify/fondue-icons";
|
|
3
|
+
import { Button as o } from "./fondue-components6.js";
|
|
4
|
+
import t from "./fondue-components70.js";
|
|
5
|
+
const c = ({ onClear: r }) => /* @__PURE__ */ e(o, { "aria-label": "clear input", type: "button", size: "small", emphasis: "weak", aspect: "square", onPress: r, children: /* @__PURE__ */ e(s, { className: t.clearIcon, size: 16 }) });
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
+
c as SelectClear
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=fondue-components89.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components89.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components89.js","sources":["../src/components/Select/SelectClear.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\n\nimport { Button } from '../Button/Button';\n\nimport styles from './styles/select.module.scss';\n\nexport const SelectClear = ({ onClear }: { onClear?: () => void }) => {\n return (\n <Button aria-label=\"clear input\" type=\"button\" size=\"small\" emphasis=\"weak\" aspect=\"square\" onPress={onClear}>\n <IconCross className={styles.clearIcon} size={16} />\n </Button>\n );\n};\n"],"names":["SelectClear","onClear","jsx","Button","IconCross","styles"],"mappings":";;;;AAQO,MAAMA,IAAc,CAAC,EAAE,SAAAC,QAEtB,gBAAAC,EAACC,KAAO,cAAW,eAAc,MAAK,UAAS,MAAK,SAAQ,UAAS,QAAO,QAAO,UAAS,SAASF,GACjG,UAAA,gBAAAC,EAACE,GAAA,EAAU,WAAWC,EAAO,WAAW,MAAM,GAAA,CAAI,EAAA,CACtD;"}
|
|
@@ -1,58 +1,56 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { IconCross as
|
|
1
|
+
import { jsx as o, jsxs as O } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as P } from "@frontify/fondue-icons";
|
|
3
3
|
import * as d from "@radix-ui/react-dialog";
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { useSyncRefs as
|
|
6
|
-
import { addShowFocusRing as
|
|
7
|
-
import { useFondueTheme as
|
|
8
|
-
import
|
|
9
|
-
const m =
|
|
4
|
+
import { createContext as j, forwardRef as l, useRef as q, useContext as B, useMemo as z } from "react";
|
|
5
|
+
import { useSyncRefs as E } from "./fondue-components48.js";
|
|
6
|
+
import { addShowFocusRing as L, addAutoFocusAttribute as $ } from "./fondue-components49.js";
|
|
7
|
+
import { useFondueTheme as k, ThemeProvider as G } from "./fondue-components31.js";
|
|
8
|
+
import n from "./fondue-components50.js";
|
|
9
|
+
const m = j({ isModal: !1 });
|
|
10
10
|
m.displayName = "DialogContext";
|
|
11
|
-
const y = ({ children: t,
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */ o(m.Provider, { value:
|
|
11
|
+
const y = ({ children: t, modal: e, onOpenChange: a, open: i }) => {
|
|
12
|
+
const r = z(() => ({ isModal: e ?? !1 }), [e]);
|
|
13
|
+
return /* @__PURE__ */ o(m.Provider, { value: r, children: /* @__PURE__ */ o(d.Root, { open: i, onOpenChange: a, modal: e, children: t }) });
|
|
14
14
|
};
|
|
15
15
|
y.displayName = "Dialog.Root";
|
|
16
|
-
const D = ({ asChild: t = !0, children: e, "data-test-id": a = "fondue-dialog-trigger"
|
|
16
|
+
const D = ({ asChild: t = !0, children: e, "data-test-id": a = "fondue-dialog-trigger" }, i) => /* @__PURE__ */ o(
|
|
17
17
|
d.Trigger,
|
|
18
18
|
{
|
|
19
|
-
onMouseDown:
|
|
19
|
+
onMouseDown: $,
|
|
20
20
|
"data-auto-focus-visible": "true",
|
|
21
21
|
"data-auto-focus-trigger": !0,
|
|
22
22
|
"data-test-id": a,
|
|
23
23
|
asChild: t,
|
|
24
|
-
ref:
|
|
25
|
-
...i,
|
|
24
|
+
ref: i,
|
|
26
25
|
children: e
|
|
27
26
|
}
|
|
28
27
|
);
|
|
29
28
|
D.displayName = "Dialog.Trigger";
|
|
30
|
-
const
|
|
31
|
-
const { isModal: a } =
|
|
32
|
-
return a ? /* @__PURE__ */ o(d.Overlay, { "data-visible": e, className:
|
|
29
|
+
const I = ({ children: t, showUnderlay: e }) => {
|
|
30
|
+
const { isModal: a } = B(m);
|
|
31
|
+
return a ? /* @__PURE__ */ o(d.Overlay, { "data-visible": e, className: n.underlay, children: t }) : /* @__PURE__ */ o("div", { className: n.underlay, "data-visible": e, children: t });
|
|
33
32
|
}, h = ({
|
|
34
33
|
maxWidth: t = "800px",
|
|
35
34
|
minWidth: e = "400px",
|
|
36
35
|
minHeight: a = "200px",
|
|
37
36
|
padding: i = "compact",
|
|
38
|
-
verticalAlign:
|
|
37
|
+
verticalAlign: r = "center",
|
|
39
38
|
"data-test-id": s = "fondue-dialog-content",
|
|
40
39
|
showUnderlay: c = !1,
|
|
41
40
|
rounded: T = !0,
|
|
42
|
-
children: w
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const H = (O) => {
|
|
41
|
+
children: w
|
|
42
|
+
}, S) => {
|
|
43
|
+
const M = k(), u = q(null);
|
|
44
|
+
E(u, S);
|
|
45
|
+
const A = (H) => {
|
|
48
46
|
var f;
|
|
49
|
-
|
|
47
|
+
H.preventDefault();
|
|
50
48
|
const g = (f = u.current) == null ? void 0 : f.querySelector('[data-dialog-layout-component="body"]'), p = g == null ? void 0 : g.querySelector(
|
|
51
|
-
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
49
|
+
'button:not([data-tooltip-trigger="true"]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
52
50
|
);
|
|
53
51
|
p instanceof HTMLElement && p.focus();
|
|
54
52
|
};
|
|
55
|
-
return /* @__PURE__ */ o(d.Portal, { children: /* @__PURE__ */ o(
|
|
53
|
+
return /* @__PURE__ */ o(d.Portal, { children: /* @__PURE__ */ o(G, { theme: M, children: /* @__PURE__ */ o(I, { showUnderlay: c, children: /* @__PURE__ */ o(
|
|
56
54
|
d.Content,
|
|
57
55
|
{
|
|
58
56
|
style: {
|
|
@@ -61,14 +59,13 @@ const J = ({ children: t, showUnderlay: e }) => {
|
|
|
61
59
|
"--dialog-min-height": a
|
|
62
60
|
},
|
|
63
61
|
ref: u,
|
|
64
|
-
className:
|
|
65
|
-
onFocus:
|
|
66
|
-
onOpenAutoFocus:
|
|
62
|
+
className: n.content,
|
|
63
|
+
onFocus: L,
|
|
64
|
+
onOpenAutoFocus: A,
|
|
67
65
|
"data-dialog-padding": i,
|
|
68
66
|
"data-dialog-rounded": T,
|
|
69
67
|
"data-test-id": s,
|
|
70
|
-
"data-dialog-vertical-align":
|
|
71
|
-
...S,
|
|
68
|
+
"data-dialog-vertical-align": r,
|
|
72
69
|
children: w
|
|
73
70
|
}
|
|
74
71
|
) }) }) });
|
|
@@ -79,19 +76,19 @@ const C = ({
|
|
|
79
76
|
showBorder: e = !0,
|
|
80
77
|
showCloseButton: a = !0,
|
|
81
78
|
closeProps: i,
|
|
82
|
-
children:
|
|
79
|
+
children: r,
|
|
83
80
|
"data-test-id": s = "fondue-dialog-header"
|
|
84
|
-
}, c) => /* @__PURE__ */
|
|
81
|
+
}, c) => /* @__PURE__ */ O(
|
|
85
82
|
"div",
|
|
86
83
|
{
|
|
87
84
|
"data-test-id": s,
|
|
88
85
|
ref: c,
|
|
89
|
-
className:
|
|
86
|
+
className: n.header,
|
|
90
87
|
"data-dialog-header-padding": t,
|
|
91
88
|
"data-show-border": e,
|
|
92
89
|
"data-dialog-layout-component": "header",
|
|
93
90
|
children: [
|
|
94
|
-
/* @__PURE__ */ o("div", { children:
|
|
91
|
+
/* @__PURE__ */ o("div", { children: r }),
|
|
95
92
|
a && /* @__PURE__ */ o(
|
|
96
93
|
d.Close,
|
|
97
94
|
{
|
|
@@ -100,19 +97,19 @@ const C = ({
|
|
|
100
97
|
className: "tw-cursor-pointer",
|
|
101
98
|
"aria-label": "Close",
|
|
102
99
|
...i,
|
|
103
|
-
children: /* @__PURE__ */ o(
|
|
100
|
+
children: /* @__PURE__ */ o(P, { size: 20 })
|
|
104
101
|
}
|
|
105
102
|
)
|
|
106
103
|
]
|
|
107
104
|
}
|
|
108
105
|
);
|
|
109
106
|
C.displayName = "Dialog.Header";
|
|
110
|
-
const N = ({ padding: t, showBorder: e = !0, children: a, "data-test-id": i = "fondue-dialog-footer" },
|
|
107
|
+
const N = ({ padding: t, showBorder: e = !0, children: a, "data-test-id": i = "fondue-dialog-footer" }, r) => /* @__PURE__ */ o(
|
|
111
108
|
"div",
|
|
112
109
|
{
|
|
113
110
|
"data-test-id": i,
|
|
114
|
-
ref:
|
|
115
|
-
className:
|
|
111
|
+
ref: r,
|
|
112
|
+
className: n.footer,
|
|
116
113
|
"data-dialog-footer-padding": t,
|
|
117
114
|
"data-show-border": e,
|
|
118
115
|
"data-dialog-layout-component": "footer",
|
|
@@ -125,14 +122,14 @@ const b = ({ padding: t, children: e, "data-test-id": a = "fondue-dialog-body" }
|
|
|
125
122
|
{
|
|
126
123
|
"data-test-id": a,
|
|
127
124
|
ref: i,
|
|
128
|
-
className:
|
|
125
|
+
className: n.body,
|
|
129
126
|
"data-dialog-body-padding": t,
|
|
130
127
|
"data-dialog-layout-component": "body",
|
|
131
128
|
children: e
|
|
132
129
|
}
|
|
133
130
|
);
|
|
134
131
|
b.displayName = "Dialog.Body";
|
|
135
|
-
const v = ({ children: t, "data-test-id": e = "fondue-dialog-side-content" }, a) => /* @__PURE__ */ o("div", { "data-test-id": e, ref: a, className:
|
|
132
|
+
const v = ({ children: t, "data-test-id": e = "fondue-dialog-side-content" }, a) => /* @__PURE__ */ o("div", { "data-test-id": e, ref: a, className: n.sideContent, "data-dialog-layout-component": !0, children: t });
|
|
136
133
|
v.displayName = "Dialog.SideContent";
|
|
137
134
|
const x = ({ children: t }) => /* @__PURE__ */ o(d.Close, { asChild: !0, children: t });
|
|
138
135
|
x.displayName = "Dialog.Close";
|
|
@@ -140,7 +137,7 @@ const F = ({ children: t, asChild: e }) => /* @__PURE__ */ o(d.Title, { asChild:
|
|
|
140
137
|
F.displayName = "Dialog.Title";
|
|
141
138
|
const R = ({ children: t, asChild: e }) => /* @__PURE__ */ o(d.Description, { asChild: e, children: t });
|
|
142
139
|
R.displayName = "Dialog.Description";
|
|
143
|
-
const
|
|
140
|
+
const Y = {
|
|
144
141
|
Root: y,
|
|
145
142
|
Title: F,
|
|
146
143
|
Description: R,
|
|
@@ -153,7 +150,7 @@ const Z = {
|
|
|
153
150
|
SideContent: l(v)
|
|
154
151
|
};
|
|
155
152
|
export {
|
|
156
|
-
|
|
153
|
+
Y as Dialog,
|
|
157
154
|
b as DialogBody,
|
|
158
155
|
x as DialogClose,
|
|
159
156
|
h as DialogContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dialog/Dialog.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixDialog from '@radix-ui/react-dialog';\nimport {\n createContext,\n forwardRef,\n useContext,\n useMemo,\n useRef,\n type CSSProperties,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/dialog.module.scss';\n\nexport type DialogRootProps = {\n /**\n * Disable interaction with the rest of the page\n * @default false\n */\n modal?: boolean;\n /**\n * The controlled `open` state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Event handler called when the `open` state changes\n */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\nexport type DialogContentProps = {\n /**\n * Add rounded corners to the dialog\n * @default true\n */\n rounded?: boolean;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The vertical alignment of the divider\n * @default \"center\"\n */\n verticalAlign?: 'top' | 'center';\n\n /**\n * Define a maximum width for the dialog\n * @default \"800px\"\n */\n maxWidth?: string;\n /**\n * Define a minimum width for the dialog\n * @default \"400px\"\n */\n minWidth?: string;\n /**\n * Define a minimum height for the dialog\n * @default \"200px\"\n */\n minHeight?: string;\n /**\n * Show a dark underlay behind the dialog\n * @default false\n */\n showUnderlay?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogTriggerProps = {\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 type DialogHeaderProps = {\n /**\n * Define the padding for the dialog header\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the bottom of the header\n * @default true\n */\n showBorder?: boolean;\n /**\n * Show a close button in the header\n * @default true\n */\n showCloseButton?: boolean;\n closeProps?: CommonAriaProps;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = {\n /**\n * Define the padding for the dialog footer\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the top of the footer\n * @default true\n */\n showBorder?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogBodyProps = {\n /**\n * Define the padding for the dialog body\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogSideContentProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogCloseProps = { children?: ReactNode };\n\nexport type DialogAnnouncementProps = { children?: ReactNode; asChild?: boolean };\n\ntype DialogContextType = {\n isModal: boolean;\n};\n\nconst DialogContext = createContext<DialogContextType>({ isModal: false });\nDialogContext.displayName = 'DialogContext';\n\nexport const DialogRoot = ({ children, ...props }: DialogRootProps) => {\n const value = useMemo(() => ({ isModal: props.modal ?? false }), [props.modal]);\n return (\n <DialogContext.Provider value={value}>\n <RadixDialog.Root {...props}>{children}</RadixDialog.Root>\n </DialogContext.Provider>\n );\n};\nDialogRoot.displayName = 'Dialog.Root';\n\nexport const DialogTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dialog-trigger', ...props }: DialogTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDialog.Trigger\n onMouseDown={addAutoFocusAttribute}\n data-auto-focus-visible=\"true\"\n data-auto-focus-trigger\n data-test-id={dataTestId}\n asChild={asChild}\n ref={ref}\n {...props}\n >\n {children}\n </RadixDialog.Trigger>\n );\n};\nDialogTrigger.displayName = 'Dialog.Trigger';\n\nconst DialogUnderlay = ({ children, showUnderlay }: { children: ReactNode; showUnderlay: boolean }) => {\n const { isModal } = useContext(DialogContext);\n if (isModal) {\n return (\n <RadixDialog.Overlay data-visible={showUnderlay} className={styles.underlay}>\n {children}\n </RadixDialog.Overlay>\n );\n }\n return (\n <div className={styles.underlay} data-visible={showUnderlay}>\n {children}\n </div>\n );\n};\n\nexport const DialogContent = (\n {\n maxWidth = '800px',\n minWidth = '400px',\n minHeight = '200px',\n padding = 'compact',\n verticalAlign = 'center',\n 'data-test-id': dataTestId = 'fondue-dialog-content',\n showUnderlay = false,\n rounded = true,\n children,\n ...props\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const theme = useFondueTheme();\n const contentRef = useRef<HTMLDivElement>(null);\n\n useSyncRefs<HTMLDivElement>(contentRef, ref);\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const dialogBody = contentRef.current?.querySelector('[data-dialog-layout-component=\"body\"]');\n\n const firstFocusable = dialogBody?.querySelector(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (firstFocusable instanceof HTMLElement) {\n firstFocusable.focus();\n }\n };\n\n return (\n <RadixDialog.Portal>\n <ThemeProvider theme={theme}>\n <DialogUnderlay showUnderlay={showUnderlay}>\n <RadixDialog.Content\n style={\n {\n '--dialog-max-width': maxWidth,\n '--dialog-min-width': minWidth,\n '--dialog-min-height': minHeight,\n } as CSSProperties\n }\n ref={contentRef}\n className={styles.content}\n onFocus={addShowFocusRing}\n onOpenAutoFocus={handleOpenAutoFocus}\n data-dialog-padding={padding}\n data-dialog-rounded={rounded}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n {...props}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </ThemeProvider>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n {\n padding,\n showBorder = true,\n showCloseButton = true,\n closeProps,\n children,\n 'data-test-id': dataTestId = 'fondue-dialog-header',\n }: DialogHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.header}\n data-dialog-header-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"header\"\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close\n role=\"button\"\n data-test-id={`${dataTestId}-close`}\n className=\"tw-cursor-pointer\"\n aria-label=\"Close\"\n {...closeProps}\n >\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { padding, showBorder = true, children, 'data-test-id': dataTestId = 'fondue-dialog-footer' }: DialogFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.footer}\n data-dialog-footer-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"footer\"\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { padding, children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.body}\n data-dialog-body-padding={padding}\n data-dialog-layout-component=\"body\"\n >\n {children}\n </div>\n );\n};\nDialogBody.displayName = 'Dialog.Body';\n\nexport const DialogSideContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-side-content' }: DialogSideContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.sideContent} data-dialog-layout-component>\n {children}\n </div>\n );\n};\nDialogSideContent.displayName = 'Dialog.SideContent';\n\nexport const DialogClose = ({ children }: DialogCloseProps) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>;\n};\nDialogClose.displayName = 'Dialog.Close';\n\nexport const DialogTitle = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Title asChild={asChild}>{children}</RadixDialog.Title>;\n};\nDialogTitle.displayName = 'Dialog.Title';\n\nexport const DialogDescription = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Description asChild={asChild}>{children}</RadixDialog.Description>;\n};\nDialogDescription.displayName = 'Dialog.Description';\n\nexport const Dialog = {\n Root: DialogRoot,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Trigger: forwardRef<HTMLButtonElement, DialogTriggerProps>(DialogTrigger),\n Content: forwardRef<HTMLDivElement, DialogContentProps>(DialogContent),\n Header: forwardRef<HTMLDivElement, DialogHeaderProps>(DialogHeader),\n Footer: forwardRef<HTMLDivElement, DialogFooterProps>(DialogFooter),\n Body: forwardRef<HTMLDivElement, DialogBodyProps>(DialogBody),\n SideContent: forwardRef<HTMLDivElement, DialogSideContentProps>(DialogSideContent),\n};\n"],"names":["DialogContext","createContext","DialogRoot","children","props","value","useMemo","jsx","RadixDialog","DialogTrigger","asChild","dataTestId","ref","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","useFondueTheme","contentRef","useRef","useSyncRefs","handleOpenAutoFocus","event","dialogBody","_a","firstFocusable","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","closeProps","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;;AAiJA,MAAMA,IAAgBC,EAA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AAEzB,MAAMC,IAAc,CAAC,EAAE,UAAA5C,0BAClBK,EAAY,OAAZ,EAAkB,SAAO,IAAE,UAAAL,GAAS;AAEhD4C,EAAY,cAAc;AAEnB,MAAMC,IAAc,CAAC,EAAE,UAAA7C,GAAU,SAAAO,QAC7B,gBAAAH,EAACC,EAAY,OAAZ,EAAkB,SAAAE,GAAmB,UAAAP,EAAA,CAAS;AAE1D6C,EAAY,cAAc;AAEnB,MAAMC,IAAoB,CAAC,EAAE,UAAA9C,GAAU,SAAAO,QACnC,gBAAAH,EAACC,EAAY,aAAZ,EAAwB,SAAAE,GAAmB,UAAAP,EAAA,CAAS;AAEhE8C,EAAkB,cAAc;AAEzB,MAAMC,IAAS;AAAA,EAClB,MAAMhD;AAAA,EACN,OAAO8C;AAAA,EACP,aAAaC;AAAA,EACb,OAAOF;AAAA,EACP,SAASI,EAAkD1C,CAAa;AAAA,EACxE,SAAS0C,EAA+ChC,CAAa;AAAA,EACrE,QAAQgC,EAA8Cb,CAAY;AAAA,EAClE,QAAQa,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
1
|
+
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dialog/Dialog.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixDialog from '@radix-ui/react-dialog';\nimport {\n createContext,\n forwardRef,\n useContext,\n useMemo,\n useRef,\n type CSSProperties,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/dialog.module.scss';\n\nexport type DialogRootProps = {\n /**\n * Disable interaction with the rest of the page\n * @default false\n */\n modal?: boolean;\n /**\n * The controlled `open` state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Event handler called when the `open` state changes\n */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\nexport type DialogContentProps = {\n /**\n * Add rounded corners to the dialog\n * @default true\n */\n rounded?: boolean;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The vertical alignment of the divider\n * @default \"center\"\n */\n verticalAlign?: 'top' | 'center';\n\n /**\n * Define a maximum width for the dialog\n * @default \"800px\"\n */\n maxWidth?: string;\n /**\n * Define a minimum width for the dialog\n * @default \"400px\"\n */\n minWidth?: string;\n /**\n * Define a minimum height for the dialog\n * @default \"200px\"\n */\n minHeight?: string;\n /**\n * Show a dark underlay behind the dialog\n * @default false\n */\n showUnderlay?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogTriggerProps = {\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 type DialogHeaderProps = {\n /**\n * Define the padding for the dialog header\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the bottom of the header\n * @default true\n */\n showBorder?: boolean;\n /**\n * Show a close button in the header\n * @default true\n */\n showCloseButton?: boolean;\n closeProps?: CommonAriaProps;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = {\n /**\n * Define the padding for the dialog footer\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the top of the footer\n * @default true\n */\n showBorder?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogBodyProps = {\n /**\n * Define the padding for the dialog body\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogSideContentProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogCloseProps = { children?: ReactNode };\n\nexport type DialogAnnouncementProps = { children?: ReactNode; asChild?: boolean };\n\ntype DialogContextType = {\n isModal: boolean;\n};\n\nconst DialogContext = createContext<DialogContextType>({ isModal: false });\nDialogContext.displayName = 'DialogContext';\n\nexport const DialogRoot = ({ children, modal, onOpenChange, open }: DialogRootProps) => {\n const value = useMemo(() => ({ isModal: modal ?? false }), [modal]);\n\n return (\n <DialogContext.Provider value={value}>\n <RadixDialog.Root open={open} onOpenChange={onOpenChange} modal={modal}>\n {children}\n </RadixDialog.Root>\n </DialogContext.Provider>\n );\n};\nDialogRoot.displayName = 'Dialog.Root';\n\nexport const DialogTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dialog-trigger' }: DialogTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDialog.Trigger\n onMouseDown={addAutoFocusAttribute}\n data-auto-focus-visible=\"true\"\n data-auto-focus-trigger\n data-test-id={dataTestId}\n asChild={asChild}\n ref={ref}\n >\n {children}\n </RadixDialog.Trigger>\n );\n};\nDialogTrigger.displayName = 'Dialog.Trigger';\n\nconst DialogUnderlay = ({ children, showUnderlay }: { children: ReactNode; showUnderlay: boolean }) => {\n const { isModal } = useContext(DialogContext);\n if (isModal) {\n return (\n <RadixDialog.Overlay data-visible={showUnderlay} className={styles.underlay}>\n {children}\n </RadixDialog.Overlay>\n );\n }\n return (\n <div className={styles.underlay} data-visible={showUnderlay}>\n {children}\n </div>\n );\n};\n\nexport const DialogContent = (\n {\n maxWidth = '800px',\n minWidth = '400px',\n minHeight = '200px',\n padding = 'compact',\n verticalAlign = 'center',\n 'data-test-id': dataTestId = 'fondue-dialog-content',\n showUnderlay = false,\n rounded = true,\n children,\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const theme = useFondueTheme();\n const contentRef = useRef<HTMLDivElement>(null);\n\n useSyncRefs<HTMLDivElement>(contentRef, ref);\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const dialogBody = contentRef.current?.querySelector('[data-dialog-layout-component=\"body\"]');\n\n const firstFocusable = dialogBody?.querySelector(\n 'button:not([data-tooltip-trigger=\"true\"]), [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (firstFocusable instanceof HTMLElement) {\n firstFocusable.focus();\n }\n };\n\n return (\n <RadixDialog.Portal>\n <ThemeProvider theme={theme}>\n <DialogUnderlay showUnderlay={showUnderlay}>\n <RadixDialog.Content\n style={\n {\n '--dialog-max-width': maxWidth,\n '--dialog-min-width': minWidth,\n '--dialog-min-height': minHeight,\n } as CSSProperties\n }\n ref={contentRef}\n className={styles.content}\n onFocus={addShowFocusRing}\n onOpenAutoFocus={handleOpenAutoFocus}\n data-dialog-padding={padding}\n data-dialog-rounded={rounded}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </ThemeProvider>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n {\n padding,\n showBorder = true,\n showCloseButton = true,\n closeProps,\n children,\n 'data-test-id': dataTestId = 'fondue-dialog-header',\n }: DialogHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.header}\n data-dialog-header-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"header\"\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close\n role=\"button\"\n data-test-id={`${dataTestId}-close`}\n className=\"tw-cursor-pointer\"\n aria-label=\"Close\"\n {...closeProps}\n >\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { padding, showBorder = true, children, 'data-test-id': dataTestId = 'fondue-dialog-footer' }: DialogFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.footer}\n data-dialog-footer-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"footer\"\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { padding, children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.body}\n data-dialog-body-padding={padding}\n data-dialog-layout-component=\"body\"\n >\n {children}\n </div>\n );\n};\nDialogBody.displayName = 'Dialog.Body';\n\nexport const DialogSideContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-side-content' }: DialogSideContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.sideContent} data-dialog-layout-component>\n {children}\n </div>\n );\n};\nDialogSideContent.displayName = 'Dialog.SideContent';\n\nexport const DialogClose = ({ children }: DialogCloseProps) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>;\n};\nDialogClose.displayName = 'Dialog.Close';\n\nexport const DialogTitle = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Title asChild={asChild}>{children}</RadixDialog.Title>;\n};\nDialogTitle.displayName = 'Dialog.Title';\n\nexport const DialogDescription = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Description asChild={asChild}>{children}</RadixDialog.Description>;\n};\nDialogDescription.displayName = 'Dialog.Description';\n\nexport const Dialog = {\n Root: DialogRoot,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Trigger: forwardRef<HTMLButtonElement, DialogTriggerProps>(DialogTrigger),\n Content: forwardRef<HTMLDivElement, DialogContentProps>(DialogContent),\n Header: forwardRef<HTMLDivElement, DialogHeaderProps>(DialogHeader),\n Footer: forwardRef<HTMLDivElement, DialogFooterProps>(DialogFooter),\n Body: forwardRef<HTMLDivElement, DialogBodyProps>(DialogBody),\n SideContent: forwardRef<HTMLDivElement, DialogSideContentProps>(DialogSideContent),\n};\n"],"names":["DialogContext","createContext","DialogRoot","children","modal","onOpenChange","open","value","useMemo","jsx","RadixDialog","DialogTrigger","asChild","dataTestId","ref","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","useFondueTheme","contentRef","useRef","useSyncRefs","handleOpenAutoFocus","event","dialogBody","_a","firstFocusable","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","closeProps","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;;AAiJA,MAAMA,IAAgBC,EAAiC,EAAE,SAAS,IAAO;AACzED,EAAc,cAAc;AAErB,MAAME,IAAa,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,cAAAC,GAAc,MAAAC,QAA4B;AACpF,QAAMC,IAAQC,EAAQ,OAAO,EAAE,SAASJ,KAAS,GAAA,IAAU,CAACA,CAAK,CAAC;AAElE,SACI,gBAAAK,EAACT,EAAc,UAAd,EAAuB,OAAAO,GACpB,UAAA,gBAAAE,EAACC,EAAY,MAAZ,EAAiB,MAAAJ,GAAY,cAAAD,GAA4B,OAAAD,GACrD,UAAAD,GACL,GACJ;AAER;AACAD,EAAW,cAAc;AAElB,MAAMS,IAAgB,CACzB,EAAE,SAAAC,IAAU,IAAM,UAAAT,GAAU,gBAAgBU,IAAa,wBAAA,GACzDC,MAGI,gBAAAL;AAAA,EAACC,EAAY;AAAA,EAAZ;AAAA,IACG,aAAaK;AAAA,IACb,2BAAwB;AAAA,IACxB,2BAAuB;AAAA,IACvB,gBAAcF;AAAA,IACd,SAAAD;AAAA,IACA,KAAAE;AAAA,IAEC,UA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AC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const o = "
|
|
1
|
+
const o = "_root_x0mxj_5", c = "_clearIcon_x0mxj_35", t = "_caret_x0mxj_52", _ = "_colorName_x0mxj_70", n = "_button_x0mxj_91", r = "_colorIndicator_x0mxj_104", a = "_actions_x0mxj_123", x = {
|
|
2
2
|
root: o,
|
|
3
|
-
clearIcon:
|
|
4
|
-
caret:
|
|
3
|
+
clearIcon: c,
|
|
4
|
+
caret: t,
|
|
5
5
|
colorName: _,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
button: n,
|
|
7
|
+
colorIndicator: r,
|
|
8
8
|
actions: a
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
11
|
a as actions,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
n as button,
|
|
13
|
+
t as caret,
|
|
14
|
+
c as clearIcon,
|
|
15
|
+
r as colorIndicator,
|
|
16
16
|
_ as colorName,
|
|
17
|
-
|
|
17
|
+
x as default,
|
|
18
18
|
o as root
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=fondue-components90.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ChangeEventHandler } from 'react';
|
|
|
4
4
|
import { CommonAriaAttrs } from '../../utilities/types';
|
|
5
5
|
import { Context } from 'react';
|
|
6
6
|
import { CSSProperties } from 'react';
|
|
7
|
-
import { default as default_2 } from '@frontify/fondue-tokens/
|
|
7
|
+
import { default as default_2 } from '@frontify/fondue-tokens/theme-tokens';
|
|
8
8
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
9
9
|
import { FocusEventHandler } from 'react';
|
|
10
10
|
import { FormEvent } from 'react';
|
|
@@ -448,7 +448,7 @@ declare type CommonAriaProps = {
|
|
|
448
448
|
|
|
449
449
|
export declare const Dialog: {
|
|
450
450
|
Root: {
|
|
451
|
-
({ children,
|
|
451
|
+
({ children, modal, onOpenChange, open }: DialogRootProps): JSX_2.Element;
|
|
452
452
|
displayName: string;
|
|
453
453
|
};
|
|
454
454
|
Title: {
|
|
@@ -598,7 +598,7 @@ declare type DialogTriggerProps = {
|
|
|
598
598
|
|
|
599
599
|
export declare const Divider: ForwardRefExoticComponent<DividerProps & RefAttributes<HTMLDivElement>>;
|
|
600
600
|
|
|
601
|
-
declare type DividerColor = 'weak' | 'default' | 'strong';
|
|
601
|
+
declare type DividerColor = 'weak' | 'default' | 'strong' | 'x-strong';
|
|
602
602
|
|
|
603
603
|
declare type DividerDirection = 'horizontal' | 'vertical';
|
|
604
604
|
|
|
@@ -1231,105 +1231,6 @@ declare type LayoutComponentProps = {
|
|
|
1231
1231
|
left?: Responsive<SpacingValue>;
|
|
1232
1232
|
};
|
|
1233
1233
|
|
|
1234
|
-
export declare const Link: ForwardRefExoticComponent<LinkProps & RefAttributes<HTMLAnchorElement>>;
|
|
1235
|
-
|
|
1236
|
-
declare type LinkColor = 'primary' | 'secondary' | 'error' | 'success' | 'warning' | 'highlight';
|
|
1237
|
-
|
|
1238
|
-
declare type LinkOnContainerColor = 'secondary' | 'disabled' | 'error' | 'success' | 'warning' | 'highlight';
|
|
1239
|
-
|
|
1240
|
-
declare type LinkProps = {
|
|
1241
|
-
children?: ReactNode;
|
|
1242
|
-
/**
|
|
1243
|
-
* The link to navigate to when clicked
|
|
1244
|
-
*/
|
|
1245
|
-
href: string;
|
|
1246
|
-
/**
|
|
1247
|
-
* Id of the element
|
|
1248
|
-
*/
|
|
1249
|
-
id?: string;
|
|
1250
|
-
/**
|
|
1251
|
-
* Size of the text
|
|
1252
|
-
*
|
|
1253
|
-
* @default 'medium'
|
|
1254
|
-
*/
|
|
1255
|
-
size?: LinkSize;
|
|
1256
|
-
/**
|
|
1257
|
-
* Weight of the font
|
|
1258
|
-
*
|
|
1259
|
-
* @default 'regular'
|
|
1260
|
-
*/
|
|
1261
|
-
weight?: LinkWeight;
|
|
1262
|
-
/**
|
|
1263
|
-
* Color of the text
|
|
1264
|
-
*
|
|
1265
|
-
* @default 'primary'
|
|
1266
|
-
*/
|
|
1267
|
-
color?: LinkColor;
|
|
1268
|
-
/**
|
|
1269
|
-
* The texts color when used within a container
|
|
1270
|
-
*
|
|
1271
|
-
* @description optional color prop that uses the inverse container color when accessibility contrast is needed
|
|
1272
|
-
**/
|
|
1273
|
-
onContainer?: LinkOnContainerColor;
|
|
1274
|
-
/**
|
|
1275
|
-
* Truncate the text if it overflows
|
|
1276
|
-
*/
|
|
1277
|
-
truncate?: boolean;
|
|
1278
|
-
/**
|
|
1279
|
-
* Wrap the text if it overflows
|
|
1280
|
-
* @default 'nowrap'
|
|
1281
|
-
*/
|
|
1282
|
-
wrap?: LinkWrap;
|
|
1283
|
-
/**
|
|
1284
|
-
* Underline behavior of the link
|
|
1285
|
-
* @default 'auto'
|
|
1286
|
-
*/
|
|
1287
|
-
underline?: LinkUnderline;
|
|
1288
|
-
/**
|
|
1289
|
-
* The target attribute for the link
|
|
1290
|
-
* @default '_self'
|
|
1291
|
-
*/
|
|
1292
|
-
target?: string;
|
|
1293
|
-
/**
|
|
1294
|
-
* The rel attribute for the link
|
|
1295
|
-
* @default 'noopener noreferrer'
|
|
1296
|
-
*/
|
|
1297
|
-
rel?: string;
|
|
1298
|
-
className?: string;
|
|
1299
|
-
onPress?: (event: MouseEvent_2<HTMLAnchorElement>) => void;
|
|
1300
|
-
'data-test-id'?: string;
|
|
1301
|
-
/**
|
|
1302
|
-
* Aria label for the component.
|
|
1303
|
-
*/
|
|
1304
|
-
'aria-label'?: string;
|
|
1305
|
-
/**
|
|
1306
|
-
* Aria labelled by for the component.
|
|
1307
|
-
*/
|
|
1308
|
-
'aria-labelledby'?: string;
|
|
1309
|
-
/**
|
|
1310
|
-
* Aria described by for the component.
|
|
1311
|
-
*/
|
|
1312
|
-
'aria-describedby'?: string;
|
|
1313
|
-
/**
|
|
1314
|
-
* Aria details for extend description of the component.
|
|
1315
|
-
*/
|
|
1316
|
-
'aria-details'?: string;
|
|
1317
|
-
/**
|
|
1318
|
-
* Disable the link
|
|
1319
|
-
*
|
|
1320
|
-
* @default false
|
|
1321
|
-
*/
|
|
1322
|
-
disabled?: boolean;
|
|
1323
|
-
};
|
|
1324
|
-
|
|
1325
|
-
declare type LinkSize = 'xx-small' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'xx-large';
|
|
1326
|
-
|
|
1327
|
-
declare type LinkUnderline = 'auto' | 'always' | 'hover' | 'none';
|
|
1328
|
-
|
|
1329
|
-
declare type LinkWeight = 'regular' | 'medium' | 'bold';
|
|
1330
|
-
|
|
1331
|
-
declare type LinkWrap = 'wrap' | 'nowrap';
|
|
1332
|
-
|
|
1333
1234
|
export declare const LoadingBar: ForwardRefExoticComponent<LoadingBarProps & RefAttributes<HTMLDivElement>>;
|
|
1334
1235
|
|
|
1335
1236
|
declare type LoadingBarProps = {
|
|
@@ -1414,20 +1315,6 @@ declare type RgbaColor_2 = {
|
|
|
1414
1315
|
name?: string;
|
|
1415
1316
|
};
|
|
1416
1317
|
|
|
1417
|
-
export declare const RouterProvider: ({ children, navigate, useHref }: RouterProviderProps) => JSX_2.Element;
|
|
1418
|
-
|
|
1419
|
-
export declare type RouterProviderProps = {
|
|
1420
|
-
children: ReactNode;
|
|
1421
|
-
/**
|
|
1422
|
-
* Function to navigate to a specific path
|
|
1423
|
-
*/
|
|
1424
|
-
navigate: (path: string) => void;
|
|
1425
|
-
/**
|
|
1426
|
-
* Function to resolves a URL against the current location.
|
|
1427
|
-
*/
|
|
1428
|
-
useHref: (path: string) => string;
|
|
1429
|
-
};
|
|
1430
|
-
|
|
1431
1318
|
declare const screens: {
|
|
1432
1319
|
xs: string;
|
|
1433
1320
|
sm: string;
|
|
@@ -2328,7 +2215,7 @@ declare type TextSize = 'x-small' | 'small' | 'medium' | 'large';
|
|
|
2328
2215
|
|
|
2329
2216
|
declare type TextWeight = 'default' | 'strong' | 'x-strong';
|
|
2330
2217
|
|
|
2331
|
-
export declare const ThemeContext: Context<"
|
|
2218
|
+
export declare const ThemeContext: Context<"dark" | "light">;
|
|
2332
2219
|
|
|
2333
2220
|
export declare const ThemeProvider: ({ children, theme, asChild }: ThemeProviderProps) => JSX_2.Element;
|
|
2334
2221
|
|
|
@@ -2348,7 +2235,7 @@ declare type ThemeProviderProps = {
|
|
|
2348
2235
|
|
|
2349
2236
|
export declare const Tooltip: {
|
|
2350
2237
|
Root: {
|
|
2351
|
-
({ children, enterDelay, open, onOpenChange
|
|
2238
|
+
({ children, enterDelay, open, onOpenChange }: TooltipRootProps): JSX_2.Element;
|
|
2352
2239
|
displayName: string;
|
|
2353
2240
|
};
|
|
2354
2241
|
Trigger: ForwardRefExoticComponent<TooltipTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -2397,7 +2284,7 @@ declare type TooltipTriggerProps = {
|
|
|
2397
2284
|
'data-test-id'?: string;
|
|
2398
2285
|
};
|
|
2399
2286
|
|
|
2400
|
-
export declare const useFondueTheme: () => "
|
|
2287
|
+
export declare const useFondueTheme: () => "dark" | "light";
|
|
2401
2288
|
|
|
2402
2289
|
export { }
|
|
2403
2290
|
|