@bonprix-ds/react-dialog 1.1.1 → 1.1.3

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.
@@ -6,12 +6,13 @@ import { tv as n } from "tailwind-variants";
6
6
  import { backdrop as r, fadeAnimation as i } from "@bonprix-ds/internal-components";
7
7
  import a from "@bonprix-ds/react-button";
8
8
  import o from "@bonprix-ds/react-icon-button";
9
- import { ZIndexContext as s, useInnerOpen as c, usePrefersReducedMotion as l } from "@bonprix-ds/utils";
10
- import { warnDeprecated as u } from "@bonprix-ds/utils/deprecation";
9
+ import { CloserIcon as s } from "@bonprix-ds/react-icon/icons";
10
+ import { ZIndexContext as c, useInnerOpen as l, usePrefersReducedMotion as u } from "@bonprix-ds/utils";
11
+ import { warnDeprecated as d } from "@bonprix-ds/utils/deprecation";
11
12
  import "#styles";
12
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
13
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
13
14
  //#region src/DialogRoot.tsx
14
- var p = n({
15
+ var m = n({
15
16
  slots: {
16
17
  modal: [
17
18
  "preflight fixed start-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
@@ -33,92 +34,92 @@ var p = n({
33
34
  image: { true: { modal: "grid-cols-1 grid-rows-2 l:grid-cols-2 l:grid-rows-1" } },
34
35
  prefersReducedMotion: { false: { modal: [i()] } }
35
36
  }
36
- }), m = ({ open: n, isOpen: i, onClose: a, zIndex: m = 2, children: h, image: g, imageWrapperClassName: _ = "" }) => {
37
- i !== void 0 && u("is-open-prop");
38
- let { wrapper: v } = p(), { innerOpen: y } = c(n ?? i ?? !1), { modal: b, imageBox: x, contentBox: S, closeButtonWrapper: C } = p({
39
- prefersReducedMotion: l(),
40
- image: !!g
37
+ }), h = ({ open: n, isOpen: i, onClose: a, zIndex: h = 2, children: g, image: _, imageWrapperClassName: v = "" }) => {
38
+ i !== void 0 && d("is-open-prop");
39
+ let { wrapper: y } = m(), { innerOpen: b } = l(n ?? i ?? !1), { modal: x, imageBox: S, contentBox: C, closeButtonWrapper: w } = m({
40
+ prefersReducedMotion: u(),
41
+ image: !!_
41
42
  });
42
- return /* @__PURE__ */ d(e.Root, {
43
- open: y,
44
- children: /* @__PURE__ */ f(e.Portal, { children: [/* @__PURE__ */ d(e.Overlay, {
43
+ return /* @__PURE__ */ f(e.Root, {
44
+ open: b,
45
+ children: /* @__PURE__ */ p(e.Portal, { children: [/* @__PURE__ */ f(e.Overlay, {
45
46
  className: r(),
46
47
  onClick: a,
47
- style: { zIndex: m - 1 }
48
- }), /* @__PURE__ */ d(e.Content, {
49
- className: b(),
50
- style: { zIndex: m },
48
+ style: { zIndex: h - 1 }
49
+ }), /* @__PURE__ */ f(e.Content, {
50
+ className: x(),
51
+ style: { zIndex: h },
51
52
  "data-bpds": "dialog",
52
53
  "aria-modal": "true",
53
54
  onEscapeKeyDown: a,
54
- children: /* @__PURE__ */ f(s.Provider, {
55
- value: m,
56
- children: [g && /* @__PURE__ */ d("div", {
57
- className: t(x(), _),
58
- style: { zIndex: m },
59
- children: g
60
- }), /* @__PURE__ */ f("div", {
61
- className: S(),
62
- style: { zIndex: m },
55
+ children: /* @__PURE__ */ p(c.Provider, {
56
+ value: h,
57
+ children: [_ && /* @__PURE__ */ f("div", {
58
+ className: t(S(), v),
59
+ style: { zIndex: h },
60
+ children: _
61
+ }), /* @__PURE__ */ p("div", {
62
+ className: C(),
63
+ style: { zIndex: h },
63
64
  children: [
64
- /* @__PURE__ */ d(e.Close, {
65
+ /* @__PURE__ */ f(e.Close, {
65
66
  asChild: !0,
66
- children: /* @__PURE__ */ d("div", {
67
- className: C(),
68
- children: /* @__PURE__ */ d(o, {
67
+ children: /* @__PURE__ */ f("div", {
68
+ className: w(),
69
+ children: /* @__PURE__ */ f(o, {
69
70
  variant: "tertiary",
70
- icon: "closer",
71
+ icon: /* @__PURE__ */ f(s, {}),
71
72
  size: "small",
72
73
  label: "Schließen",
73
74
  onClick: a
74
75
  })
75
76
  })
76
77
  }),
77
- /* @__PURE__ */ d(e.Description, { className: "sr-only" }),
78
- /* @__PURE__ */ d("div", {
79
- className: v(),
80
- children: h
78
+ /* @__PURE__ */ f(e.Description, { className: "sr-only" }),
79
+ /* @__PURE__ */ f("div", {
80
+ className: y(),
81
+ children: g
81
82
  })
82
83
  ]
83
84
  })]
84
85
  })
85
86
  })] })
86
87
  });
87
- }, h = ({ children: t }) => {
88
- let { title: n } = p();
89
- return /* @__PURE__ */ d(e.Title, {
88
+ }, g = ({ children: t }) => {
89
+ let { title: n } = m();
90
+ return /* @__PURE__ */ f(e.Title, {
90
91
  className: n(),
91
92
  children: t
92
93
  });
93
- }, g = ({ children: e }) => {
94
- let { scrollArea: t, contentWrapper: n } = p();
95
- return /* @__PURE__ */ d("div", {
94
+ }, _ = ({ children: e }) => {
95
+ let { scrollArea: t, contentWrapper: n } = m();
96
+ return /* @__PURE__ */ f("div", {
96
97
  className: t(),
97
- children: /* @__PURE__ */ d("div", {
98
+ children: /* @__PURE__ */ f("div", {
98
99
  className: n(),
99
100
  children: e
100
101
  })
101
102
  });
102
- }, _ = ({ children: e }) => {
103
- let { buttonSection: t } = p();
104
- return /* @__PURE__ */ d("div", {
103
+ }, v = ({ children: e }) => {
104
+ let { buttonSection: t } = m();
105
+ return /* @__PURE__ */ f("div", {
105
106
  className: t(),
106
107
  children: e
107
108
  });
108
- }, v = ({ children: e, component: t = "button", ...n }) => /* @__PURE__ */ d(a, {
109
+ }, y = ({ children: e, component: t = "button", ...n }) => /* @__PURE__ */ f(a, {
109
110
  component: t,
110
111
  ...n,
111
112
  size: "large",
112
113
  children: e
113
- }), y = ({ children: e, component: t = "button", ...n }) => /* @__PURE__ */ d(a, {
114
+ }), b = ({ children: e, component: t = "button", ...n }) => /* @__PURE__ */ f(a, {
114
115
  component: t,
115
116
  ...n,
116
117
  variant: "secondary",
117
118
  size: "large",
118
119
  children: e
119
120
  });
120
- m.displayName = "Dialog", h.displayName = "Dialog.Title", g.displayName = "Dialog.Content", _.displayName = "Dialog.ButtonSection", v.displayName = "Dialog.PrimaryButton", y.displayName = "Dialog.SecondaryButton";
121
+ h.displayName = "Dialog", g.displayName = "Dialog.Title", _.displayName = "Dialog.Content", v.displayName = "Dialog.ButtonSection", y.displayName = "Dialog.PrimaryButton", b.displayName = "Dialog.SecondaryButton";
121
122
  //#endregion
122
- export { _ as ButtonSection, g as Content, v as PrimaryButton, y as SecondaryButton, h as Title, m as default };
123
+ export { v as ButtonSection, _ as Content, y as PrimaryButton, b as SecondaryButton, g as Title, h as default };
123
124
 
124
125
  //# sourceMappingURL=DialogRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogRoot.js","names":["Component","DialogPrimitive","Button","IconButton","generateClasses","tv","fadeAnimation","DialogRoot","isOpen","warnDeprecated","useInnerOpen","open","usePrefersReducedMotion","image","innerOpen","backdrop","onClose","zIndex","modal","ZIndexContext","twMerge","imageBox","imageWrapperClassName","contentBox","closeButtonWrapper","wrapper","Title","title","Content","scrollArea","contentWrapper","ButtonSection","buttonSection","PrimaryButton","props","SecondaryButton"],"sources":["../../src/DialogRoot.tsx"],"sourcesContent":["\"use client\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport React, { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { tv } from \"tailwind-variants\";\n\nimport { backdrop, fadeAnimation } from \"@bonprix-ds/internal-components\";\nimport Button from \"@bonprix-ds/react-button\";\nimport IconButton from \"@bonprix-ds/react-icon-button\";\nimport { usePrefersReducedMotion, ZIndexContext } from \"@bonprix-ds/utils\";\nimport { useInnerOpen } from \"@bonprix-ds/utils\";\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\n\nimport \"./Dialog.css\";\n\nconst generateClasses = tv({\n slots: {\n modal: [\n \"preflight fixed start-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\", // Fixed position and centering\n \"h-fit min-h-[12.375rem] w-[37.5rem] max-w-[calc(100vw-2.5rem)] l:w-[67.5rem]\", // Size considering spacing to screen edges\n \"max-h-[calc(100dvh-var(--app-safe-area-inset-bottom,2.5rem)*2)]\",\n \"box-border grid grid-rows-1 justify-items-center\",\n \"outline-none\", // A click inside focuses the dialog, and a key press after it would draw the browser's focus ring around it\n ],\n imageBox: \"flex h-full w-full\",\n contentBox: \"relative box-border flex w-full max-w-[37.5rem] flex-col bg-clr-bg-modal py-7\",\n title: \"typography-bonprix-h4 px-7 text-clr-primary\",\n closeButtonWrapper: \"absolute end-1 top-1\",\n wrapper: \"flex h-full flex-col gap-5\",\n scrollArea: \"scroll-area relative h-full px-7\",\n contentWrapper: \"flex flex-col overflow-hidden\",\n buttonSection: \"flex flex-col gap-3 px-7\",\n },\n variants: {\n image: {\n true: {\n modal: \"grid-cols-1 grid-rows-2 l:grid-cols-2 l:grid-rows-1\",\n },\n },\n prefersReducedMotion: {\n false: {\n modal: [fadeAnimation()],\n },\n },\n },\n});\n\ninterface BaseProps {\n /** Here, all of the subcomponents should be placed. */\n children: ReactNode;\n /** Callback function that is called when the dialog is supposed to be closed. Should be used in conjunction with `open` property. */\n onClose: () => void;\n /** The z-index of the dialog. */\n zIndex?: number;\n /** Optional image slot that gets rendered left to (desktop) or above (mobile) the `children`. */\n image?: ReactNode;\n /** Additional CSS classes for the wrapper element around `image`, not the image itself. Useful to specify height and tweak layout. */\n imageWrapperClassName?: string;\n}\n\ntype OpenProps = BaseProps & {\n /** Controls the visibility of the dialog. Should be used in conjunction with `onClose`. */\n open: boolean;\n /** @deprecated [is-open-prop] Use `open` instead. */\n isOpen?: never;\n};\n\ntype DeprecatedOpenProps = BaseProps & {\n open?: never;\n /**\n * Controls the visibility of the dialog. Should be used in conjunction with `onClose`.\n * @deprecated [is-open-prop] Use `open` instead.\n */\n isOpen: boolean;\n};\n\nexport type Props = DeprecatedOpenProps | OpenProps;\n\nexport interface DialogTitleProps {\n /** The title to display in the dialog. */\n children: string;\n}\n\nexport interface DialogContentProps {\n /** The content to display in the dialog. */\n children: ReactNode;\n}\n\nexport interface DialogButtonSectionProps {\n /** Primary and secondary buttons should be placed inside this section. */\n children: ReactNode;\n}\n\ntype DialogButtonProps<C extends ElementType> = {\n /** The button text to render. */\n children: string;\n /** The semantic component to render the Button. Preferrably `\"button\"`. Native props will be passed to this component. */\n component?: C;\n} & Omit<ComponentProps<C>, \"component\">;\n\nconst DialogRoot = ({ open, isOpen, onClose, zIndex = 2, children, image, imageWrapperClassName = \"\" }: Props) => {\n if (isOpen !== undefined) warnDeprecated(\"is-open-prop\");\n const { wrapper } = generateClasses();\n const { innerOpen } = useInnerOpen(open ?? isOpen ?? false);\n\n const prefersReducedMotion = usePrefersReducedMotion();\n\n const { modal, imageBox, contentBox, closeButtonWrapper } = generateClasses({ prefersReducedMotion, image: !!image });\n const closeLabel = \"Schließen\";\n\n return (\n <DialogPrimitive.Root open={innerOpen}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay className={backdrop()} onClick={onClose} style={{ zIndex: zIndex - 1 }} />\n <DialogPrimitive.Content className={modal()} style={{ zIndex }} data-bpds=\"dialog\" aria-modal=\"true\" onEscapeKeyDown={onClose}>\n <ZIndexContext.Provider value={zIndex}>\n {image && (\n <div className={twMerge(imageBox(), imageWrapperClassName)} style={{ zIndex }}>\n {image}\n </div>\n )}\n <div className={contentBox()} style={{ zIndex }}>\n <DialogPrimitive.Close asChild>\n <div className={closeButtonWrapper()}>\n <IconButton variant=\"tertiary\" icon=\"closer\" size=\"small\" label={closeLabel} onClick={onClose} />\n </div>\n </DialogPrimitive.Close>\n <DialogPrimitive.Description className=\"sr-only\"></DialogPrimitive.Description>\n <div className={wrapper()}>{children}</div>\n </div>\n </ZIndexContext.Provider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n\nexport const Title = ({ children }: DialogTitleProps) => {\n const { title } = generateClasses();\n\n return <DialogPrimitive.Title className={title()}>{children}</DialogPrimitive.Title>;\n};\n\nexport const Content = ({ children }: DialogContentProps) => {\n const { scrollArea, contentWrapper } = generateClasses();\n\n return (\n <div className={scrollArea()}>\n <div className={contentWrapper()}>{children}</div>\n </div>\n );\n};\n\nexport const ButtonSection = ({ children }: DialogButtonSectionProps) => {\n const { buttonSection } = generateClasses();\n\n return <div className={buttonSection()}>{children}</div>;\n};\n\nexport const PrimaryButton = <C extends ElementType>({ children, component = \"button\" as C, ...props }: DialogButtonProps<C>) => {\n const Component: ElementType = component;\n return (\n <Button component={Component} {...props} size=\"large\">\n {children}\n </Button>\n );\n};\n\nexport const SecondaryButton = <C extends ElementType>({ children, component = \"button\" as C, ...props }: DialogButtonProps<C>) => {\n const Component: ElementType = component;\n return (\n <Button component={Component} {...props} variant=\"secondary\" size=\"large\">\n {children}\n </Button>\n );\n};\n\nDialogRoot.displayName = \"Dialog\";\nTitle.displayName = \"Dialog.Title\";\nContent.displayName = \"Dialog.Content\";\nButtonSection.displayName = \"Dialog.ButtonSection\";\nPrimaryButton.displayName = \"Dialog.PrimaryButton\";\nSecondaryButton.displayName = \"Dialog.SecondaryButton\";\n\nexport default DialogRoot;\n"],"mappings":";;;;;;;;;;;;;AAeA,IAAMI,IAAkBC,EAAG;CACzB,OAAO;EACL,OAAO;GACL;GACA;GACA;GACA;GACA;EACF;EACA,UAAU;EACV,YAAY;EACZ,OAAO;EACP,oBAAoB;EACpB,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,eAAe;CACjB;CACA,UAAU;EACR,OAAO,EACL,MAAM,EACJ,OAAO,sDACT,EACF;EACA,sBAAsB,EACpB,OAAO,EACL,OAAO,CAACC,EAAc,CAAC,EACzB,EACF;CACF;AACF,CAAC,GAuDKC,KAAc,EAAE,SAAM,WAAQ,YAAS,YAAS,GAAG,aAAU,UAAO,2BAAwB,SAAgB;CAChH,AAAIC,MAAW,KAAA,KAAWC,EAAe,cAAc;CACvD,IAAM,EAAE,eAAYL,EAAgB,GAC9B,EAAE,iBAAcM,EAAaC,KAA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ACrF,GAEaC,KAAW,EAAE,kBAAmC;CAC3D,IAAM,EAAE,eAAY,sBAAmBxB,EAAgB;CAEvD,OACE,kBAAC,OAAD;EAAK,WAAWyB,EAAW;EACzB,UAAA,kBAAC,OAAD;GAAK,WAAWC,EAAe;GAAI;EAAc,CAAA;CAC9C,CAAA;AAET,GAEaC,KAAiB,EAAE,kBAAyC;CACvE,IAAM,EAAE,qBAAkB3B,EAAgB;CAE1C,OAAO,kBAAC,OAAD;EAAK,WAAW4B,EAAc;EAAI;CAAc,CAAA;AACzD,GAEaC,KAAwC,EAAE,aAAU,eAAY,UAAe,GAAGC,QAG3F,kBAAChC,GAAD;CAAmBF;CAAW,GAAIkC;CAAO,MAAK;CAC3C;AACK,CAAA,GAICC,KAA0C,EAAE,aAAU,eAAY,UAAe,GAAGD,QAG7F,kBAAChC,GAAD;CAAmBF;CAAW,GAAIkC;CAAO,SAAQ;CAAY,MAAK;CAC/D;AACK,CAAA;AAIZ,EAAW,cAAc,UACzB,EAAM,cAAc,gBACpB,EAAQ,cAAc,kBACtB,EAAc,cAAc,wBAC5B,EAAc,cAAc,wBAC5B,EAAgB,cAAc"}
1
+ {"version":3,"file":"DialogRoot.js","names":["Component","DialogPrimitive","Button","IconButton","generateClasses","tv","fadeAnimation","DialogRoot","isOpen","warnDeprecated","useInnerOpen","open","usePrefersReducedMotion","image","innerOpen","backdrop","onClose","zIndex","modal","ZIndexContext","twMerge","imageBox","imageWrapperClassName","contentBox","closeButtonWrapper","CloserIcon","wrapper","Title","title","Content","scrollArea","contentWrapper","ButtonSection","buttonSection","PrimaryButton","props","SecondaryButton"],"sources":["../../src/DialogRoot.tsx"],"sourcesContent":["\"use client\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport React, { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { tv } from \"tailwind-variants\";\n\nimport { backdrop, fadeAnimation } from \"@bonprix-ds/internal-components\";\nimport Button from \"@bonprix-ds/react-button\";\nimport IconButton from \"@bonprix-ds/react-icon-button\";\nimport { CloserIcon } from \"@bonprix-ds/react-icon/icons\";\nimport { usePrefersReducedMotion, ZIndexContext } from \"@bonprix-ds/utils\";\nimport { useInnerOpen } from \"@bonprix-ds/utils\";\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\n\nimport \"./Dialog.css\";\n\nconst generateClasses = tv({\n slots: {\n modal: [\n \"preflight fixed start-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\", // Fixed position and centering\n \"h-fit min-h-[12.375rem] w-[37.5rem] max-w-[calc(100vw-2.5rem)] l:w-[67.5rem]\", // Size considering spacing to screen edges\n \"max-h-[calc(100dvh-var(--app-safe-area-inset-bottom,2.5rem)*2)]\",\n \"box-border grid grid-rows-1 justify-items-center\",\n \"outline-none\", // A click inside focuses the dialog, and a key press after it would draw the browser's focus ring around it\n ],\n imageBox: \"flex h-full w-full\",\n contentBox: \"relative box-border flex w-full max-w-[37.5rem] flex-col bg-clr-bg-modal py-7\",\n title: \"typography-bonprix-h4 px-7 text-clr-primary\",\n closeButtonWrapper: \"absolute end-1 top-1\",\n wrapper: \"flex h-full flex-col gap-5\",\n scrollArea: \"scroll-area relative h-full px-7\",\n contentWrapper: \"flex flex-col overflow-hidden\",\n buttonSection: \"flex flex-col gap-3 px-7\",\n },\n variants: {\n image: {\n true: {\n modal: \"grid-cols-1 grid-rows-2 l:grid-cols-2 l:grid-rows-1\",\n },\n },\n prefersReducedMotion: {\n false: {\n modal: [fadeAnimation()],\n },\n },\n },\n});\n\ninterface BaseProps {\n /** Here, all of the subcomponents should be placed. */\n children: ReactNode;\n /** Callback function that is called when the dialog is supposed to be closed. Should be used in conjunction with `open` property. */\n onClose: () => void;\n /** The z-index of the dialog. */\n zIndex?: number;\n /** Optional image slot that gets rendered left to (desktop) or above (mobile) the `children`. */\n image?: ReactNode;\n /** Additional CSS classes for the wrapper element around `image`, not the image itself. Useful to specify height and tweak layout. */\n imageWrapperClassName?: string;\n}\n\ntype OpenProps = BaseProps & {\n /** Controls the visibility of the dialog. Should be used in conjunction with `onClose`. */\n open: boolean;\n /** @deprecated [is-open-prop] Use `open` instead. */\n isOpen?: never;\n};\n\ntype DeprecatedOpenProps = BaseProps & {\n open?: never;\n /**\n * Controls the visibility of the dialog. Should be used in conjunction with `onClose`.\n * @deprecated [is-open-prop] Use `open` instead.\n */\n isOpen: boolean;\n};\n\nexport type Props = DeprecatedOpenProps | OpenProps;\n\nexport interface DialogTitleProps {\n /** The title to display in the dialog. */\n children: string;\n}\n\nexport interface DialogContentProps {\n /** The content to display in the dialog. */\n children: ReactNode;\n}\n\nexport interface DialogButtonSectionProps {\n /** Primary and secondary buttons should be placed inside this section. */\n children: ReactNode;\n}\n\ntype DialogButtonProps<C extends ElementType> = {\n /** The button text to render. */\n children: string;\n /** The semantic component to render the Button. Preferrably `\"button\"`. Native props will be passed to this component. */\n component?: C;\n} & Omit<ComponentProps<C>, \"component\">;\n\nconst DialogRoot = ({ open, isOpen, onClose, zIndex = 2, children, image, imageWrapperClassName = \"\" }: Props) => {\n if (isOpen !== undefined) warnDeprecated(\"is-open-prop\");\n const { wrapper } = generateClasses();\n const { innerOpen } = useInnerOpen(open ?? isOpen ?? false);\n\n const prefersReducedMotion = usePrefersReducedMotion();\n\n const { modal, imageBox, contentBox, closeButtonWrapper } = generateClasses({ prefersReducedMotion, image: !!image });\n const closeLabel = \"Schließen\";\n\n return (\n <DialogPrimitive.Root open={innerOpen}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay className={backdrop()} onClick={onClose} style={{ zIndex: zIndex - 1 }} />\n <DialogPrimitive.Content className={modal()} style={{ zIndex }} data-bpds=\"dialog\" aria-modal=\"true\" onEscapeKeyDown={onClose}>\n <ZIndexContext.Provider value={zIndex}>\n {image && (\n <div className={twMerge(imageBox(), imageWrapperClassName)} style={{ zIndex }}>\n {image}\n </div>\n )}\n <div className={contentBox()} style={{ zIndex }}>\n <DialogPrimitive.Close asChild>\n <div className={closeButtonWrapper()}>\n <IconButton variant=\"tertiary\" icon={<CloserIcon />} size=\"small\" label={closeLabel} onClick={onClose} />\n </div>\n </DialogPrimitive.Close>\n <DialogPrimitive.Description className=\"sr-only\"></DialogPrimitive.Description>\n <div className={wrapper()}>{children}</div>\n </div>\n </ZIndexContext.Provider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n\nexport const Title = ({ children }: DialogTitleProps) => {\n const { title } = generateClasses();\n\n return <DialogPrimitive.Title className={title()}>{children}</DialogPrimitive.Title>;\n};\n\nexport const Content = ({ children }: DialogContentProps) => {\n const { scrollArea, contentWrapper } = generateClasses();\n\n return (\n <div className={scrollArea()}>\n <div className={contentWrapper()}>{children}</div>\n </div>\n );\n};\n\nexport const ButtonSection = ({ children }: DialogButtonSectionProps) => {\n const { buttonSection } = generateClasses();\n\n return <div className={buttonSection()}>{children}</div>;\n};\n\nexport const PrimaryButton = <C extends ElementType>({ children, component = \"button\" as C, ...props }: DialogButtonProps<C>) => {\n const Component: ElementType = component;\n return (\n <Button component={Component} {...props} size=\"large\">\n {children}\n </Button>\n );\n};\n\nexport const SecondaryButton = <C extends ElementType>({ children, component = \"button\" as C, ...props }: DialogButtonProps<C>) => {\n const Component: ElementType = component;\n return (\n <Button component={Component} {...props} variant=\"secondary\" size=\"large\">\n {children}\n </Button>\n );\n};\n\nDialogRoot.displayName = \"Dialog\";\nTitle.displayName = \"Dialog.Title\";\nContent.displayName = \"Dialog.Content\";\nButtonSection.displayName = \"Dialog.ButtonSection\";\nPrimaryButton.displayName = \"Dialog.PrimaryButton\";\nSecondaryButton.displayName = \"Dialog.SecondaryButton\";\n\nexport default DialogRoot;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,IAAMI,IAAkBC,EAAG;CACzB,OAAO;EACL,OAAO;GACL;GACA;GACA;GACA;GACA;EACF;EACA,UAAU;EACV,YAAY;EACZ,OAAO;EACP,oBAAoB;EACpB,SAAS;EACT,Y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K;SAAQ,OAAO;SAAY,SAAST;QAAU,CAAA;OACrG,CAAA;MACgB,CAAA;MACvB,kBAACf,EAAgB,aAAjB,EAA6B,WAAU,UAAuC,CAAA;MAC9E,kBAAC,OAAD;OAAK,WAAWyB,EAAQ;OAAI;MAAc,CAAA;KACvC;IACiB,CAAA,CAAA;;EACD,CAAA,CACH,EAAA,CAAA;CACJ,CAAA;AAE1B,GAEaC,KAAS,EAAE,kBAAiC;CACvD,IAAM,EAAE,aAAUvB,EAAgB;CAElC,OAAO,kBAACH,EAAgB,OAAjB;EAAuB,WAAW2B,EAAM;EAAI;CAAgC,CAAA;AACrF,GAEaC,KAAW,EAAE,kBAAmC;CAC3D,IAAM,EAAE,eAAY,sBAAmBzB,EAAgB;CAEvD,OACE,kBAAC,OAAD;EAAK,WAAW0B,EAAW;EACzB,UAAA,kBAAC,OAAD;GAAK,WAAWC,EAAe;GAAI;EAAc,CAAA;CAC9C,CAAA;AAET,GAEaC,KAAiB,EAAE,kBAAyC;CACvE,IAAM,EAAE,qBAAkB5B,EAAgB;CAE1C,OAAO,kBAAC,OAAD;EAAK,WAAW6B,EAAc;EAAI;CAAc,CAAA;AACzD,GAEaC,KAAwC,EAAE,aAAU,eAAY,UAAe,GAAGC,QAG3F,kBAACjC,GAAD;CAAmBF;CAAW,GAAImC;CAAO,MAAK;CAC3C;AACK,CAAA,GAICC,KAA0C,EAAE,aAAU,eAAY,UAAe,GAAGD,QAG7F,kBAACjC,GAAD;CAAmBF;CAAW,GAAImC;CAAO,SAAQ;CAAY,MAAK;CAC/D;AACK,CAAA;AAIZ,EAAW,cAAc,UACzB,EAAM,cAAc,gBACpB,EAAQ,cAAc,kBACtB,EAAc,cAAc,wBAC5B,EAAc,cAAc,wBAC5B,EAAgB,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonprix-ds/react-dialog",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Dialog component, implemented in React, for the Bonprix Design System.",
5
5
  "keywords": [],
6
6
  "license": "UNLICENSED",
@@ -42,18 +42,19 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@radix-ui/react-dialog": "1.1.23",
45
- "tailwind-merge": "2.6.1",
46
- "@bonprix-ds/internal-components": "0.2.2",
47
- "@bonprix-ds/react-button": "1.1.2",
48
- "@bonprix-ds/react-icon-button": "1.2.2",
49
- "@bonprix-ds/utils": "0.3.0"
45
+ "tailwind-merge": "2.5.4",
46
+ "@bonprix-ds/internal-components": "0.2.4",
47
+ "@bonprix-ds/react-button": "1.1.4",
48
+ "@bonprix-ds/react-icon": "1.3.1",
49
+ "@bonprix-ds/react-icon-button": "1.2.4",
50
+ "@bonprix-ds/utils": "0.5.0"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@testing-library/dom": "10.4.2",
53
54
  "@testing-library/react": "16.3.3",
54
55
  "@types/react": "19.3.0",
55
56
  "vite": "8.3.2",
56
- "vitest": "4.1.11",
57
+ "vitest": "5.0.5",
57
58
  "@bonprix-ds/vite-config": "0.0.0"
58
59
  },
59
60
  "peerDependencies": {