@frontify/fondue-components 3.3.6 → 4.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-components11.js +29 -29
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components18.js +38 -36
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components22.js +12 -12
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components26.js +1 -1
- package/dist/fondue-components29.js +1 -1
- package/dist/fondue-components31.js +15 -15
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components36.js +13 -13
- package/dist/fondue-components39.js +14 -12
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components44.js +4 -4
- package/dist/fondue-components47.js +10 -10
- package/dist/fondue-components48.js +42 -40
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +7 -7
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components50.js +57 -47
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components52.js +28 -24
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components54.js +8 -8
- package/dist/fondue-components56.js +9 -9
- package/dist/fondue-components58.js +2 -11
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +11 -2
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components7.js +92 -67
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components9.js +25 -25
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +42 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const o = "_root_vlh4p_5", c = "_colorName_vlh4p_54", t = "_colorIndicator_vlh4p_58", r = "_caret_vlh4p_64", l = {
|
|
2
|
+
root: o,
|
|
3
|
+
colorName: c,
|
|
4
|
+
colorIndicator: t,
|
|
5
|
+
caret: r
|
|
6
|
+
};
|
|
2
7
|
export {
|
|
3
|
-
|
|
8
|
+
r as caret,
|
|
9
|
+
t as colorIndicator,
|
|
10
|
+
c as colorName,
|
|
11
|
+
l as default,
|
|
12
|
+
o as root
|
|
4
13
|
};
|
|
5
14
|
//# sourceMappingURL=fondue-components59.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components59.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components59.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,98 +1,123 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { IconCross as
|
|
1
|
+
import { jsx as a, jsxs as T } from "react/jsx-runtime";
|
|
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
5
|
import { addAutoFocusAttribute as B, addShowFocusRing as H } from "./fondue-components35.js";
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
6
|
+
import r from "./fondue-components36.js";
|
|
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
|
+
g.displayName = "Dialog.Root";
|
|
9
|
+
const c = ({ asChild: t = !0, children: o, "data-test-id": e = "fondue-dialog-trigger" }, d) => /* @__PURE__ */ a(
|
|
10
10
|
i.Trigger,
|
|
11
11
|
{
|
|
12
12
|
onMouseDown: B,
|
|
13
13
|
"data-auto-focus-visible": "true",
|
|
14
14
|
"data-auto-focus-trigger": !0,
|
|
15
|
-
"data-test-id":
|
|
16
|
-
asChild:
|
|
17
|
-
ref:
|
|
18
|
-
children:
|
|
15
|
+
"data-test-id": e,
|
|
16
|
+
asChild: t,
|
|
17
|
+
ref: d,
|
|
18
|
+
children: o
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
|
-
|
|
22
|
-
const j = ({ children: t, showUnderlay:
|
|
23
|
-
const { isModal: e } = S(
|
|
24
|
-
return e ? /* @__PURE__ */
|
|
25
|
-
},
|
|
21
|
+
c.displayName = "Dialog.Trigger";
|
|
22
|
+
const j = ({ children: t, showUnderlay: o }) => {
|
|
23
|
+
const { isModal: e } = S(n);
|
|
24
|
+
return e ? /* @__PURE__ */ a(i.Overlay, { "data-visible": o, className: r.underlay, children: t }) : /* @__PURE__ */ a("div", { className: r.underlay, "data-visible": o, children: t });
|
|
25
|
+
}, u = ({
|
|
26
26
|
maxWidth: t = "800px",
|
|
27
|
-
minWidth:
|
|
27
|
+
minWidth: o = "400px",
|
|
28
28
|
minHeight: e = "200px",
|
|
29
|
-
padding:
|
|
30
|
-
verticalAlign:
|
|
31
|
-
"data-test-id":
|
|
32
|
-
showUnderlay:
|
|
29
|
+
padding: d = "compact",
|
|
30
|
+
verticalAlign: s = "center",
|
|
31
|
+
"data-test-id": h = "fondue-dialog-content",
|
|
32
|
+
showUnderlay: v = !1,
|
|
33
33
|
children: x,
|
|
34
34
|
rounded: b = !0,
|
|
35
|
-
...
|
|
36
|
-
},
|
|
35
|
+
...w
|
|
36
|
+
}, R) => /* @__PURE__ */ a(i.Portal, { children: /* @__PURE__ */ a(j, { showUnderlay: v, children: /* @__PURE__ */ a(
|
|
37
37
|
i.Content,
|
|
38
38
|
{
|
|
39
39
|
style: {
|
|
40
40
|
"--dialog-max-width": t,
|
|
41
|
-
"--dialog-min-width":
|
|
41
|
+
"--dialog-min-width": o,
|
|
42
42
|
"--dialog-min-height": e
|
|
43
43
|
},
|
|
44
|
-
ref:
|
|
45
|
-
className:
|
|
44
|
+
ref: R,
|
|
45
|
+
className: r.content,
|
|
46
46
|
onFocus: H,
|
|
47
47
|
"data-dialog-rounded": b,
|
|
48
|
-
"data-dialog-spacing":
|
|
49
|
-
"data-test-id":
|
|
50
|
-
"data-dialog-vertical-align":
|
|
51
|
-
...
|
|
48
|
+
"data-dialog-spacing": d,
|
|
49
|
+
"data-test-id": h,
|
|
50
|
+
"data-dialog-vertical-align": s,
|
|
51
|
+
...w,
|
|
52
52
|
children: x
|
|
53
53
|
}
|
|
54
54
|
) }) });
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
u.displayName = "Dialog.Content";
|
|
56
|
+
const m = ({
|
|
57
|
+
children: t,
|
|
58
|
+
showBorder: o = !0,
|
|
59
|
+
showCloseButton: e = !0,
|
|
60
|
+
"data-test-id": d = "fondue-dialog-header"
|
|
61
|
+
}, s) => /* @__PURE__ */ T(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
"data-test-id": d,
|
|
65
|
+
ref: s,
|
|
66
|
+
className: r.header,
|
|
67
|
+
"data-show-border": o,
|
|
68
|
+
"data-dialog-layout-component": !0,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ a("div", { children: t }),
|
|
71
|
+
e && /* @__PURE__ */ a(i.Close, { role: "button", "data-test-id": `${d}-close`, className: "tw-cursor-pointer", children: /* @__PURE__ */ a(F, { size: 20 }) })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
m.displayName = "Dialog.Header";
|
|
76
|
+
const p = ({ showBorder: t = !0, children: o, "data-test-id": e = "fondue-dialog-footer" }, d) => /* @__PURE__ */ a(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-test-id": e,
|
|
80
|
+
ref: d,
|
|
81
|
+
className: r.footer,
|
|
82
|
+
"data-show-border": t,
|
|
83
|
+
"data-dialog-layout-component": !0,
|
|
84
|
+
children: o
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
p.displayName = "Dialog.Footer";
|
|
88
|
+
const D = ({ children: t, "data-test-id": o = "fondue-dialog-body" }, e) => /* @__PURE__ */ a("div", { "data-test-id": o, ref: e, className: r.body, "data-dialog-layout-component": !0, children: t });
|
|
89
|
+
D.displayName = "Dialog.Body";
|
|
90
|
+
const y = ({ children: t, "data-test-id": o = "fondue-dialog-side-content" }, e) => /* @__PURE__ */ a("div", { "data-test-id": o, ref: e, className: r.sideContent, "data-dialog-layout-component": !0, children: t });
|
|
91
|
+
y.displayName = "Dialog.SideContent";
|
|
92
|
+
const f = ({ children: t }) => /* @__PURE__ */ a(i.Close, { asChild: !0, children: t });
|
|
93
|
+
f.displayName = "Dialog.Close";
|
|
94
|
+
const C = ({ children: t, asChild: o }) => /* @__PURE__ */ a(i.Title, { asChild: o, children: t });
|
|
95
|
+
C.displayName = "Dialog.Title";
|
|
96
|
+
const N = ({ children: t, asChild: o }) => /* @__PURE__ */ a(i.Description, { asChild: o, children: t });
|
|
97
|
+
N.displayName = "Dialog.Description";
|
|
73
98
|
const k = {
|
|
74
|
-
Root:
|
|
75
|
-
Title:
|
|
76
|
-
Description:
|
|
77
|
-
Close:
|
|
78
|
-
Trigger: l(
|
|
79
|
-
Content: l(
|
|
80
|
-
Header: l(
|
|
81
|
-
Footer: l(
|
|
82
|
-
Body: l(
|
|
83
|
-
SideContent: l(
|
|
99
|
+
Root: g,
|
|
100
|
+
Title: C,
|
|
101
|
+
Description: N,
|
|
102
|
+
Close: f,
|
|
103
|
+
Trigger: l(c),
|
|
104
|
+
Content: l(u),
|
|
105
|
+
Header: l(m),
|
|
106
|
+
Footer: l(p),
|
|
107
|
+
Body: l(D),
|
|
108
|
+
SideContent: l(y)
|
|
84
109
|
};
|
|
85
110
|
export {
|
|
86
111
|
k as Dialog,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
112
|
+
D as DialogBody,
|
|
113
|
+
f as DialogClose,
|
|
114
|
+
u as DialogContent,
|
|
115
|
+
N as DialogDescription,
|
|
116
|
+
p as DialogFooter,
|
|
117
|
+
m as DialogHeader,
|
|
118
|
+
g as DialogRoot,
|
|
119
|
+
y as DialogSideContent,
|
|
120
|
+
C as DialogTitle,
|
|
121
|
+
c as DialogTrigger
|
|
97
122
|
};
|
|
98
123
|
//# sourceMappingURL=fondue-components7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components7.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 { createContext, forwardRef, useContext, type CSSProperties, type ForwardedRef, type ReactNode } from 'react';\n\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\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 = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogHeaderProps = {\n /**\n * Show a close button in the header\n * @default true\n */\n showCloseButton?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogBodyProps = { children?: ReactNode; 'data-test-id'?: string };\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 });\n\nexport const DialogRoot = ({ children, ...props }: DialogRootProps) => {\n return (\n <DialogContext.Provider value={{ isModal: props.modal ?? false }}>\n <RadixDialog.Root {...props}>{children}</RadixDialog.Root>\n </DialogContext.Provider>\n );\n};\nDialogRoot.displayName = 'Dialog.Root';\n\nexport const DialogTrigger = (\n { 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\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 children,\n rounded = true,\n ...props\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDialog.Portal>\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={ref}\n className={styles.content}\n onFocus={addShowFocusRing}\n data-dialog-rounded={rounded}\n data-dialog-spacing={padding}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n {...props}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n { children, showCloseButton = true, 'data-test-id': dataTestId = 'fondue-dialog-header' }: DialogHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.header} data-dialog-layout-component>\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close role=\"button\" data-test-id={`${dataTestId}-close`} className=\"tw-cursor-pointer\">\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-footer' }: DialogFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.footer} data-dialog-layout-component>\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.body} data-dialog-layout-component>\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","RadixDialog","DialogTrigger","dataTestId","ref","jsx","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","addShowFocusRing","DialogHeader","showCloseButton","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","asChild","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;AA+FA,MAAMA,IAAgBC,EAAiC,EAAE,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,gBAAAC,EAAC,OAAI,EAAA,gBAAcF,GAAY,KAAAC,GAAU,WAAWO,EAAO,aAAa,gCAA4B,IAC/F,UAAAZ,EACL,CAAA;AAGR2B,EAAkB,cAAc;AAEzB,MAAMC,IAAc,CAAC,EAAE,UAAA5B,0BAClBE,EAAY,OAAZ,EAAkB,SAAO,IAAE,UAAAF,EAAS,CAAA;AAEhD4B,EAAY,cAAc;AAEnB,MAAMC,IAAc,CAAC,EAAE,UAAA7B,GAAU,SAAA8B,QAC5B,gBAAAxB,EAAAJ,EAAY,OAAZ,EAAkB,SAAA4B,GAAmB,UAAA9B,EAAS,CAAA;AAE1D6B,EAAY,cAAc;AAEnB,MAAME,IAAoB,CAAC,EAAE,UAAA/B,GAAU,SAAA8B,QAClC,gBAAAxB,EAAAJ,EAAY,aAAZ,EAAwB,SAAA4B,GAAmB,UAAA9B,EAAS,CAAA;AAEhE+B,EAAkB,cAAc;AAEzB,MAAMC,IAAS;AAAA,EAClB,MAAMjC;AAAA,EACN,OAAO8B;AAAA,EACP,aAAaE;AAAA,EACb,OAAOH;AAAA,EACP,SAASK,EAAkD9B,CAAa;AAAA,EACxE,SAAS8B,EAA+CpB,CAAa;AAAA,EACrE,QAAQoB,EAA8CZ,CAAY;AAAA,EAClE,QAAQY,EAA8CR,CAAY;AAAA,EAClE,MAAMQ,EAA4CP,CAAU;AAAA,EAC5D,aAAaO,EAAmDN,CAAiB;AACrF;"}
|
|
1
|
+
{"version":3,"file":"fondue-components7.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 { createContext, forwardRef, useContext, type CSSProperties, type ForwardedRef, type ReactNode } from 'react';\n\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\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 * 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 children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = {\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 = { children?: ReactNode; 'data-test-id'?: string };\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 });\n\nexport const DialogRoot = ({ children, ...props }: DialogRootProps) => {\n return (\n <DialogContext.Provider value={{ isModal: props.modal ?? false }}>\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' }: 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 children,\n rounded = true,\n ...props\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <RadixDialog.Portal>\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={ref}\n className={styles.content}\n onFocus={addShowFocusRing}\n data-dialog-rounded={rounded}\n data-dialog-spacing={padding}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n {...props}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n {\n children,\n showBorder = true,\n showCloseButton = true,\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-show-border={showBorder}\n data-dialog-layout-component\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close role=\"button\" data-test-id={`${dataTestId}-close`} className=\"tw-cursor-pointer\">\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { 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-show-border={showBorder}\n data-dialog-layout-component\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.body} data-dialog-layout-component>\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","RadixDialog","DialogTrigger","asChild","dataTestId","ref","jsx","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","addShowFocusRing","DialogHeader","showBorder","showCloseButton","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;AAoHA,MAAMA,IAAgBC,EAAiC,EAAE,SAAS,GAAO,CAAA,GAE5DC,IAAa,CAAC,EAAE,UAAAC,GAAU,GAAGC,0BAEjCJ,EAAc,UAAd,EAAuB,OAAO,EAAE,SAASI,EAAM,SAAS,GAAM,GAC3D,4BAACC,EAAY,MAAZ,EAAkB,GAAGD,GAAQ,UAAAD,GAAS,EAC3C,CAAA;AAGRD,EAAW,cAAc;AAEZ,MAAAI,IAAgB,CACzB,EAAE,SAAAC,IAAU,IAAM,UAAAJ,GAAU,gBAAgBK,IAAa,wBAAwB,GACjFC,MAGI,gBAAAC;AAAA,EAACL,EAAY;AAAA,EAAZ;AAAA,IACG,aAAa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CAAC,EAAE,UAAA9B,0BAClBE,EAAY,OAAZ,EAAkB,SAAO,IAAE,UAAAF,EAAS,CAAA;AAEhD8B,EAAY,cAAc;AAEnB,MAAMC,IAAc,CAAC,EAAE,UAAA/B,GAAU,SAAAI,QAC5B,gBAAAG,EAAAL,EAAY,OAAZ,EAAkB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAE1D+B,EAAY,cAAc;AAEnB,MAAMC,IAAoB,CAAC,EAAE,UAAAhC,GAAU,SAAAI,QAClC,gBAAAG,EAAAL,EAAY,aAAZ,EAAwB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAEhEgC,EAAkB,cAAc;AAEzB,MAAMC,IAAS;AAAA,EAClB,MAAMlC;AAAA,EACN,OAAOgC;AAAA,EACP,aAAaC;AAAA,EACb,OAAOF;AAAA,EACP,SAASI,EAAkD/B,CAAa;AAAA,EACxE,SAAS+B,EAA+CpB,CAAa;AAAA,EACrE,QAAQoB,EAA8CZ,CAAY;AAAA,EAClE,QAAQY,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
@@ -3,16 +3,16 @@ import { IconCaretRight as F } from "@frontify/fondue-icons";
|
|
|
3
3
|
import * as d from "@radix-ui/react-dropdown-menu";
|
|
4
4
|
import { forwardRef as s, useRef as c } from "react";
|
|
5
5
|
import { usePreventDropdownOverflow as I } from "./fondue-components38.js";
|
|
6
|
-
import { syncRefs as
|
|
6
|
+
import { syncRefs as m } from "./fondue-components35.js";
|
|
7
7
|
import a from "./fondue-components39.js";
|
|
8
|
-
const
|
|
8
|
+
const l = ({
|
|
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 f = ({
|
|
14
|
+
l.displayName = "Dropdown.Root";
|
|
15
|
+
const f = ({ 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
16
|
f.displayName = "Dropdown.Trigger";
|
|
17
17
|
const g = ({
|
|
18
18
|
onOpen: o,
|
|
@@ -33,10 +33,10 @@ const g = ({
|
|
|
33
33
|
"data-test-id": u,
|
|
34
34
|
ref: i,
|
|
35
35
|
onCloseAutoFocus: () => {
|
|
36
|
-
|
|
36
|
+
m(i, p), t && t(), w.current = !1;
|
|
37
37
|
},
|
|
38
38
|
onFocus: () => {
|
|
39
|
-
w.current || (y(),
|
|
39
|
+
w.current || (y(), m(i, p), o && o(), w.current = !0);
|
|
40
40
|
},
|
|
41
41
|
children: n
|
|
42
42
|
}
|
|
@@ -50,14 +50,14 @@ const b = ({
|
|
|
50
50
|
"data-test-id": t = "fondue-dropdown-submenu"
|
|
51
51
|
}) => /* @__PURE__ */ e(d.Sub, { "data-test-id": t, children: o });
|
|
52
52
|
b.displayName = "Dropdown.SubMenu";
|
|
53
|
-
const
|
|
54
|
-
o,
|
|
53
|
+
const N = ({ children: o, "data-test-id": t = "fondue-dropdown-subtrigger" }, r) => /* @__PURE__ */ T(d.SubTrigger, { className: a.subTrigger, "data-test-id": t, ref: r, children: [
|
|
54
|
+
/* @__PURE__ */ e("div", { className: a.itemContent, children: o }),
|
|
55
55
|
/* @__PURE__ */ e(F, { className: a.subMenuIndicator, size: 16 })
|
|
56
56
|
] });
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const
|
|
57
|
+
N.displayName = "Dropdown.SubTrigger";
|
|
58
|
+
const S = ({ 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 }) });
|
|
59
|
+
S.displayName = "Dropdown.SubContent";
|
|
60
|
+
const R = ({
|
|
61
61
|
children: o,
|
|
62
62
|
disabled: t,
|
|
63
63
|
textValue: r,
|
|
@@ -74,33 +74,33 @@ const N = ({
|
|
|
74
74
|
ref: i,
|
|
75
75
|
disabled: t,
|
|
76
76
|
...p,
|
|
77
|
-
children: o
|
|
77
|
+
children: /* @__PURE__ */ e("div", { className: a.itemContent, children: o })
|
|
78
78
|
}
|
|
79
79
|
);
|
|
80
|
-
|
|
80
|
+
R.displayName = "Dropdown.Item";
|
|
81
81
|
const C = ({ 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 });
|
|
82
82
|
C.displayName = "Dropdown.Slot";
|
|
83
|
-
const h = s(f),
|
|
84
|
-
Root:
|
|
83
|
+
const h = s(f), v = s(g), x = s(D), G = s(N), M = s(S), P = s(R), j = s(C), B = {
|
|
84
|
+
Root: l,
|
|
85
85
|
Trigger: h,
|
|
86
|
-
Content:
|
|
87
|
-
Group:
|
|
86
|
+
Content: v,
|
|
87
|
+
Group: x,
|
|
88
88
|
SubMenu: b,
|
|
89
|
-
SubTrigger:
|
|
90
|
-
SubContent:
|
|
91
|
-
Item:
|
|
89
|
+
SubTrigger: G,
|
|
90
|
+
SubContent: M,
|
|
91
|
+
Item: P,
|
|
92
92
|
Slot: j
|
|
93
93
|
};
|
|
94
94
|
export {
|
|
95
95
|
B as Dropdown,
|
|
96
96
|
g as DropdownContent,
|
|
97
97
|
D as DropdownGroup,
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
R as DropdownItem,
|
|
99
|
+
l as DropdownRoot,
|
|
100
100
|
C as DropdownSlot,
|
|
101
|
-
|
|
101
|
+
S as DropdownSubContent,
|
|
102
102
|
b as DropdownSubMenu,
|
|
103
|
-
|
|
103
|
+
N as DropdownSubTrigger,
|
|
104
104
|
f as DropdownTrigger
|
|
105
105
|
};
|
|
106
106
|
//# 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 = { children?: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-trigger' }: DropdownTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDropdown.Trigger 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 {children}\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 {children}\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","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,MAEQ,gB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EI,MAGI,gBAAAH,EAAC,OAAI,EAAA,aAAW2B,GAAM,WAAWd,EAAO,MAAM,gBAAcd,GAAY,KAAAI,GACnE,UAAAP,EACL,CAAA;AAGR8B,EAAa,cAAc;AAE3B,MAAME,IAA8BC,EAAoD3B,CAAe,GACjG4B,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,MAAMzC;AAAA,EACN,SAASiC;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 * 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,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,EAAsB,SAAAE,GAAkB,gBAAcJ,GAAY,KAAAK,GAC9D,UAAAR,EACL,CAAA;AAGRM,EAAgB,cAAc;AAcvB,MAAMG,IAAkB,CAC3B;AAAA,EACI,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAZ;AAAA,EACA,gBAAgBG,IAAa;AACjC,GACAK,MACC;AACK,QAAAK,IAAWC,EAAO,IAAI,GACtBC,IAAiBD,EAAO,EAAK,GAE7B,EAAE,cAAAE,EAAA,IAAiBC,EAA2BJ,C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ACT,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
|
@@ -177,6 +177,7 @@ export declare const ColorPicker: {
|
|
|
177
177
|
'data-test-id'?: string;
|
|
178
178
|
} & RefAttributes<HTMLDivElement>>;
|
|
179
179
|
Input: ForwardRefExoticComponent<({
|
|
180
|
+
id?: string;
|
|
180
181
|
currentColor?: RgbaColor;
|
|
181
182
|
isOpen?: boolean;
|
|
182
183
|
onClear?: () => void;
|
|
@@ -238,6 +239,11 @@ declare type ComboboxProps = {
|
|
|
238
239
|
* Disables the combobox component.
|
|
239
240
|
*/
|
|
240
241
|
disabled?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* The alignment of the menu.
|
|
244
|
+
* @default "start"
|
|
245
|
+
*/
|
|
246
|
+
alignMenu?: 'start' | 'center' | 'end';
|
|
241
247
|
/**
|
|
242
248
|
* The aria label of the combobox component.
|
|
243
249
|
*/
|
|
@@ -361,11 +367,21 @@ declare type DialogContentProps = {
|
|
|
361
367
|
};
|
|
362
368
|
|
|
363
369
|
declare type DialogFooterProps = {
|
|
370
|
+
/**
|
|
371
|
+
* Show a border at the top of the footer
|
|
372
|
+
* @default true
|
|
373
|
+
*/
|
|
374
|
+
showBorder?: boolean;
|
|
364
375
|
children?: ReactNode;
|
|
365
376
|
'data-test-id'?: string;
|
|
366
377
|
};
|
|
367
378
|
|
|
368
379
|
declare type DialogHeaderProps = {
|
|
380
|
+
/**
|
|
381
|
+
* Show a border at the bottom of the header
|
|
382
|
+
* @default true
|
|
383
|
+
*/
|
|
384
|
+
showBorder?: boolean;
|
|
369
385
|
/**
|
|
370
386
|
* Show a close button in the header
|
|
371
387
|
* @default true
|
|
@@ -399,6 +415,11 @@ declare type DialogSideContentProps = {
|
|
|
399
415
|
};
|
|
400
416
|
|
|
401
417
|
declare type DialogTriggerProps = {
|
|
418
|
+
/**
|
|
419
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
420
|
+
* @default true
|
|
421
|
+
*/
|
|
422
|
+
asChild?: boolean;
|
|
402
423
|
children?: ReactNode;
|
|
403
424
|
'data-test-id'?: string;
|
|
404
425
|
};
|
|
@@ -525,6 +546,11 @@ declare type DropdownSubTriggerProps = {
|
|
|
525
546
|
};
|
|
526
547
|
|
|
527
548
|
declare type DropdownTriggerProps = {
|
|
549
|
+
/**
|
|
550
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
551
|
+
* @default true
|
|
552
|
+
*/
|
|
553
|
+
asChild?: boolean;
|
|
528
554
|
children?: ReactNode;
|
|
529
555
|
'data-test-id'?: string;
|
|
530
556
|
};
|
|
@@ -659,6 +685,11 @@ declare type FlyoutRootProps = {
|
|
|
659
685
|
};
|
|
660
686
|
|
|
661
687
|
declare type FlyoutTriggerProps = {
|
|
688
|
+
/**
|
|
689
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
690
|
+
* @default true
|
|
691
|
+
*/
|
|
692
|
+
asChild?: boolean;
|
|
662
693
|
children?: ReactNode;
|
|
663
694
|
'data-test-id'?: string;
|
|
664
695
|
};
|
|
@@ -1039,6 +1070,11 @@ declare type SelectComponentProps = {
|
|
|
1039
1070
|
* Disables the select component.
|
|
1040
1071
|
*/
|
|
1041
1072
|
disabled?: boolean;
|
|
1073
|
+
/**
|
|
1074
|
+
* The alignment of the menu.
|
|
1075
|
+
* @default "start"
|
|
1076
|
+
*/
|
|
1077
|
+
alignMenu?: 'start' | 'center' | 'end';
|
|
1042
1078
|
/**
|
|
1043
1079
|
* The aria label of the select component.
|
|
1044
1080
|
*/
|
|
@@ -1050,7 +1086,7 @@ declare type SelectComponentProps = {
|
|
|
1050
1086
|
};
|
|
1051
1087
|
|
|
1052
1088
|
declare const SelectInput: {
|
|
1053
|
-
({ children, onSelect, value, defaultValue, placeholder, status, disabled, "aria-label": ariaLabel, "data-test-id": dataTestId, }: SelectComponentProps, forwardedRef: ForwardedRef<HTMLDivElement>): JSX_2.Element;
|
|
1089
|
+
({ children, onSelect, value, defaultValue, placeholder, status, disabled, alignMenu, "aria-label": ariaLabel, "data-test-id": dataTestId, }: SelectComponentProps, forwardedRef: ForwardedRef<HTMLDivElement>): JSX_2.Element;
|
|
1054
1090
|
displayName: string;
|
|
1055
1091
|
};
|
|
1056
1092
|
|
|
@@ -1353,6 +1389,11 @@ declare type TooltipRootProps = {
|
|
|
1353
1389
|
};
|
|
1354
1390
|
|
|
1355
1391
|
declare type TooltipTriggerProps = {
|
|
1392
|
+
/**
|
|
1393
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
1394
|
+
* @default false
|
|
1395
|
+
*/
|
|
1396
|
+
asChild?: boolean;
|
|
1356
1397
|
children: ReactNode;
|
|
1357
1398
|
'data-test-id'?: string;
|
|
1358
1399
|
};
|