@bonprix-ds/react-side-sheet 1.0.2 → 1.1.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/no-styles.js +1 -0
- package/dist/src/SideSheet.css +8 -0
- package/dist/src/SideSheet.d.ts +1 -1
- package/dist/src/SideSheet.js.map +1 -1
- package/dist/src/SideSheetContext.js.map +1 -1
- package/dist/src/SideSheetRoot.d.ts +19 -7
- package/dist/src/SideSheetRoot.js +37 -35
- package/dist/src/SideSheetRoot.js.map +1 -1
- package/dist/src/useConsumeSideSheet.js.map +1 -1
- package/dist/styles.js +1 -0
- package/package.json +20 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/SideSheet.css
CHANGED
|
@@ -8,3 +8,11 @@
|
|
|
8
8
|
flex-direction: row !important;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
/* Radix prepends focus guards to `body` while a dialog is open. Chromium saves the scroll anchor of a page that is
|
|
13
|
+
left as an `nth-child` path, which the guards shift, so going back would restore the scroll position of another
|
|
14
|
+
element. Without an anchor, Chromium restores the plain scroll offset. Keyed to the guards rather than to the
|
|
15
|
+
open state, so it holds through the closing animation and across every copy of the package on the page. */
|
|
16
|
+
:root:has(> body > [data-radix-focus-guard]) {
|
|
17
|
+
overflow-anchor: none;
|
|
18
|
+
}
|
package/dist/src/SideSheet.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { Props, SheetButtonBaseProps, SheetButtonProps, SheetButtonSectionP
|
|
|
4
4
|
declare const SideSheet: {
|
|
5
5
|
(props: Props): React.JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
|
-
Title: ({ children, subline, level }: import("./SideSheetRoot").SheetTitleProps) => React.JSX.Element;
|
|
7
|
+
Title: ({ children, subline, level: Level }: import("./SideSheetRoot").SheetTitleProps) => React.JSX.Element;
|
|
8
8
|
Content: ({ children, disableHorizontalPadding }: import("./SideSheetRoot").SheetContentProps) => React.JSX.Element;
|
|
9
9
|
ButtonSection: ({ children }: import("./SideSheetRoot").SheetButtonSectionProps) => React.JSX.Element;
|
|
10
10
|
PrimaryButton: <C extends React.ElementType>({ children, icon, iconPosition, loading, component, ...props }: import("./SideSheetRoot").SheetButtonBaseProps & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideSheet.js","names":[],"sources":["../../src/SideSheet.tsx"],"sourcesContent":["import React from \"react\";\n\nimport SideSheetRoot, { ButtonSection, Content, PrimaryButton, SecondaryButton, Title, type Props } from \"./SideSheetRoot\";\n\nexport type {\n Props,\n SheetButtonBaseProps,\n SheetButtonProps,\n SheetButtonSectionProps,\n SheetContentProps,\n SheetTitleProps,\n} from \"./SideSheetRoot\";\n\nconst SideSheet = (props: Props) => <SideSheetRoot {...props} />;\n\nSideSheet.displayName = \"SideSheet\";\n\nSideSheet.Title = Title;\nSideSheet.Content = Content;\nSideSheet.ButtonSection = ButtonSection;\nSideSheet.PrimaryButton = PrimaryButton;\nSideSheet.SecondaryButton = SecondaryButton;\n\nexport default SideSheet;\n"],"mappings":";;;;AAaA,
|
|
1
|
+
{"version":3,"file":"SideSheet.js","names":["SideSheetRoot","SideSheet","props","Title","Content","ButtonSection","PrimaryButton","SecondaryButton"],"sources":["../../src/SideSheet.tsx"],"sourcesContent":["import React from \"react\";\n\nimport SideSheetRoot, { ButtonSection, Content, PrimaryButton, SecondaryButton, Title, type Props } from \"./SideSheetRoot\";\n\nexport type {\n Props,\n SheetButtonBaseProps,\n SheetButtonProps,\n SheetButtonSectionProps,\n SheetContentProps,\n SheetTitleProps,\n} from \"./SideSheetRoot\";\n\nconst SideSheet = (props: Props) => <SideSheetRoot {...props} />;\n\nSideSheet.displayName = \"SideSheet\";\n\nSideSheet.Title = Title;\nSideSheet.Content = Content;\nSideSheet.ButtonSection = ButtonSection;\nSideSheet.PrimaryButton = PrimaryButton;\nSideSheet.SecondaryButton = SecondaryButton;\n\nexport default SideSheet;\n"],"mappings":";;;;AAaA,IAAMC,KAAa,MAAiB,kBAACD,GAAD,EAAe,GAAIE,EAAQ,CAAA;AAE/D,EAAU,cAAc,aAExB,EAAU,QAAQC,GAClB,EAAU,UAAUC,GACpB,EAAU,gBAAgBC,GAC1B,EAAU,gBAAgBC,GAC1B,EAAU,kBAAkBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideSheetContext.js","names":[],"sources":["../../src/SideSheetContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\n\nexport interface SideSheetContextProps {\n onClose: () => void;\n onBack?: () => void;\n}\n\nconst SideSheetContext = createContext<SideSheetContextProps>({\n onClose: () => null,\n onBack: () => null,\n});\n\nexport default SideSheetContext;\n"],"mappings":";;;AASA,
|
|
1
|
+
{"version":3,"file":"SideSheetContext.js","names":["SideSheetContext","createContext"],"sources":["../../src/SideSheetContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\n\nexport interface SideSheetContextProps {\n onClose: () => void;\n onBack?: () => void;\n}\n\nconst SideSheetContext = createContext<SideSheetContextProps>({\n onClose: () => null,\n onBack: () => null,\n});\n\nexport default SideSheetContext;\n"],"mappings":";;;AASA,IAAMA,IAAmBC,EAAqC;CAC5D,eAAe;CACf,cAAc;AAChB,CAAC"}
|
|
@@ -5,8 +5,6 @@ import "./SideSheet.css";
|
|
|
5
5
|
interface SheetProps {
|
|
6
6
|
/** All of the subcomponents should be placed inside this property. */
|
|
7
7
|
children: ReactNode;
|
|
8
|
-
/** Toggles the visibility of the sheet. Should be used in conjunction with the `onClose` property. */
|
|
9
|
-
isOpen: boolean;
|
|
10
8
|
/** Callback function, that is triggered when the sheet is attempted to be closed.
|
|
11
9
|
*
|
|
12
10
|
* It will be called in following cases:
|
|
@@ -15,13 +13,27 @@ interface SheetProps {
|
|
|
15
13
|
* - Click on "close" icon button in the upper-right corner
|
|
16
14
|
* - Click on any button (PrimaryButton or SecondaryButton)
|
|
17
15
|
*
|
|
18
|
-
* Should be used in conjunction with `
|
|
16
|
+
* Should be used in conjunction with `open`. */
|
|
19
17
|
onClose: () => void;
|
|
20
18
|
/** Callback to execute when clicking back icon. */
|
|
21
19
|
onBack?: () => void;
|
|
22
20
|
/** The z-index of the sheet.. */
|
|
23
21
|
zIndex?: number;
|
|
24
22
|
}
|
|
23
|
+
type OpenProps = SheetProps & {
|
|
24
|
+
/** Toggles the visibility of the sheet. Should be used in conjunction with the `onClose` property. */
|
|
25
|
+
open: boolean;
|
|
26
|
+
/** @deprecated [is-open-prop] Use `open` instead. */
|
|
27
|
+
isOpen?: never;
|
|
28
|
+
};
|
|
29
|
+
type DeprecatedOpenProps = SheetProps & {
|
|
30
|
+
open?: never;
|
|
31
|
+
/**
|
|
32
|
+
* Toggles the visibility of the sheet. Should be used in conjunction with the `onClose` property.
|
|
33
|
+
* @deprecated [is-open-prop] Use `open` instead.
|
|
34
|
+
*/
|
|
35
|
+
isOpen: boolean;
|
|
36
|
+
};
|
|
25
37
|
export interface SheetTitleProps {
|
|
26
38
|
/** The text content. */
|
|
27
39
|
children: string;
|
|
@@ -56,17 +68,17 @@ type SheetPrimaryButtonProps<C extends ElementType> = SheetButtonProps<C> & {
|
|
|
56
68
|
/** If `true`, a loading spinner will be shown instead of the content. */
|
|
57
69
|
loading?: boolean;
|
|
58
70
|
};
|
|
59
|
-
export
|
|
71
|
+
export type Props = (DeprecatedOpenProps | OpenProps) & {
|
|
60
72
|
/** When set to false, interaction with outside elements will be disabled and only dialog content will be visible to screen readers. */
|
|
61
73
|
modeless?: boolean;
|
|
62
74
|
/** Makes the Sheet of 400px fixed or able to expand up to 600px depending on the content */
|
|
63
75
|
hasDynamicWidth?: boolean;
|
|
64
|
-
}
|
|
76
|
+
};
|
|
65
77
|
declare const SideSheetRoot: {
|
|
66
|
-
({ children, isOpen, modeless, onClose, onBack, zIndex, hasDynamicWidth }: Props): React.JSX.Element | undefined;
|
|
78
|
+
({ children, open, isOpen, modeless, onClose, onBack, zIndex, hasDynamicWidth }: Props): React.JSX.Element | undefined;
|
|
67
79
|
displayName: string;
|
|
68
80
|
};
|
|
69
|
-
export declare const Title: ({ children, subline, level }: SheetTitleProps) => React.JSX.Element;
|
|
81
|
+
export declare const Title: ({ children, subline, level: Level }: SheetTitleProps) => React.JSX.Element;
|
|
70
82
|
export declare const Content: ({ children, disableHorizontalPadding }: SheetContentProps) => React.JSX.Element;
|
|
71
83
|
export declare const ButtonSection: ({ children }: SheetButtonSectionProps) => React.JSX.Element;
|
|
72
84
|
export declare const PrimaryButton: <C extends ElementType>({ children, icon, iconPosition, loading, component, ...props }: SheetPrimaryButtonProps<C>) => React.JSX.Element;
|
|
@@ -8,20 +8,20 @@ import { tv as i } from "tailwind-variants";
|
|
|
8
8
|
import { backdrop as a, fadeAnimation as o, slideAnimation as s } from "@bonprix-ds/internal-components";
|
|
9
9
|
import c from "@bonprix-ds/react-button";
|
|
10
10
|
import l from "@bonprix-ds/react-icon-button";
|
|
11
|
-
import u from "@bonprix-ds/
|
|
12
|
-
import {
|
|
13
|
-
import "
|
|
11
|
+
import { ZIndexContext as u, useBreakpointDown as d, useInnerOpen as f, usePrefersReducedMotion as p } from "@bonprix-ds/utils";
|
|
12
|
+
import { warnDeprecated as m } from "@bonprix-ds/utils/deprecation";
|
|
13
|
+
import "#styles";
|
|
14
14
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
15
15
|
//#region src/SideSheetRoot.tsx
|
|
16
16
|
var _ = i({
|
|
17
17
|
slots: {
|
|
18
|
-
modal: "preflight fixed h-dvh flex
|
|
18
|
+
modal: "preflight fixed -end-100 top-0 flex h-dvh flex-col bg-clr-bg-modal outline-none",
|
|
19
19
|
header: "px-4 py-6",
|
|
20
|
-
titleAndIcons: "flex gap-2
|
|
21
|
-
scrollArea: "
|
|
22
|
-
buttonSection: "w-full
|
|
20
|
+
titleAndIcons: "flex items-center gap-2",
|
|
21
|
+
scrollArea: "scroll-area relative h-full",
|
|
22
|
+
buttonSection: "flex w-full shrink-0 flex-col gap-3 px-4 pt-6",
|
|
23
23
|
backdrop: a(),
|
|
24
|
-
contentWrapper: "
|
|
24
|
+
contentWrapper: "typography-body1 flex w-full grow flex-col overflow-hidden pb-6 text-clr-primary"
|
|
25
25
|
},
|
|
26
26
|
variants: {
|
|
27
27
|
disableHorizontalPadding: { false: { scrollArea: "px-4" } },
|
|
@@ -34,42 +34,43 @@ var _ = i({
|
|
|
34
34
|
},
|
|
35
35
|
hasDynamicWidth: {
|
|
36
36
|
false: { modal: "w-100" },
|
|
37
|
-
true: { modal: "min-w-100
|
|
37
|
+
true: { modal: "w-fit min-w-100 max-w-150" }
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
}), v = ({ children: t,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
}), v = ({ children: t, open: r, isOpen: i, modeless: a = !1, onClose: o, onBack: s, zIndex: c = 9999, hasDynamicWidth: l = !1 }) => {
|
|
41
|
+
i !== void 0 && m("is-open-prop");
|
|
42
|
+
let v = p(), y = d("m"), { modal: b, backdrop: x, contentWrapper: S } = _({
|
|
43
|
+
hasDynamicWidth: l,
|
|
44
|
+
prefersReducedMotion: v
|
|
45
|
+
}), { innerOpen: C } = f(r ?? i ?? !1);
|
|
46
|
+
return y ? void 0 : /* @__PURE__ */ h(n.Root, {
|
|
47
|
+
open: C,
|
|
48
|
+
modal: !a,
|
|
48
49
|
children: /* @__PURE__ */ g(n.Portal, { children: [/* @__PURE__ */ h(n.Overlay, {
|
|
49
|
-
className:
|
|
50
|
-
onClick:
|
|
51
|
-
style: { zIndex:
|
|
50
|
+
className: x(),
|
|
51
|
+
onClick: o,
|
|
52
|
+
style: { zIndex: c }
|
|
52
53
|
}), /* @__PURE__ */ h(n.Content, {
|
|
53
|
-
className:
|
|
54
|
-
style: { zIndex:
|
|
54
|
+
className: b(),
|
|
55
|
+
style: { zIndex: c },
|
|
55
56
|
"aria-describedby": void 0,
|
|
56
57
|
onOpenAutoFocus: (e) => {
|
|
57
58
|
e.preventDefault(), e.target.focus();
|
|
58
59
|
},
|
|
59
60
|
tabIndex: -1,
|
|
60
61
|
"data-bpds": "side-sheet",
|
|
61
|
-
"data-bpds-modeless":
|
|
62
|
-
"data-bpds-has-dynamic-width":
|
|
63
|
-
"aria-modal": !
|
|
64
|
-
children: /* @__PURE__ */ h(
|
|
65
|
-
value:
|
|
62
|
+
"data-bpds-modeless": a,
|
|
63
|
+
"data-bpds-has-dynamic-width": l,
|
|
64
|
+
"aria-modal": !a,
|
|
65
|
+
children: /* @__PURE__ */ h(u.Provider, {
|
|
66
|
+
value: c,
|
|
66
67
|
children: /* @__PURE__ */ h(e.Provider, {
|
|
67
68
|
value: {
|
|
68
|
-
onClose:
|
|
69
|
-
onBack:
|
|
69
|
+
onClose: o,
|
|
70
|
+
onBack: s
|
|
70
71
|
},
|
|
71
72
|
children: /* @__PURE__ */ h("div", {
|
|
72
|
-
className:
|
|
73
|
+
className: S(),
|
|
73
74
|
children: t
|
|
74
75
|
})
|
|
75
76
|
})
|
|
@@ -94,10 +95,8 @@ var _ = i({
|
|
|
94
95
|
asChild: !0,
|
|
95
96
|
children: /* @__PURE__ */ h("div", {
|
|
96
97
|
className: "grow",
|
|
97
|
-
children: /* @__PURE__ */ h(
|
|
98
|
-
|
|
99
|
-
component: i,
|
|
100
|
-
className: "line-clamp-2",
|
|
98
|
+
children: /* @__PURE__ */ h(i, {
|
|
99
|
+
className: "typography-bonprix-h6 my-0 line-clamp-2 text-start text-clr-on-bg-high",
|
|
101
100
|
children: e
|
|
102
101
|
})
|
|
103
102
|
})
|
|
@@ -113,7 +112,10 @@ var _ = i({
|
|
|
113
112
|
})
|
|
114
113
|
})
|
|
115
114
|
]
|
|
116
|
-
}), r && /* @__PURE__ */ h(
|
|
115
|
+
}), r && /* @__PURE__ */ h("p", {
|
|
116
|
+
className: "typography-body1 my-0 text-start text-clr-on-bg-high",
|
|
117
|
+
children: r
|
|
118
|
+
})]
|
|
117
119
|
});
|
|
118
120
|
}, b = ({ children: e, disableHorizontalPadding: t = !1 }) => {
|
|
119
121
|
let { scrollArea: n } = _({ disableHorizontalPadding: t });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideSheetRoot.js","names":[],"sources":["../../src/SideSheetRoot.tsx"],"sourcesContent":["\"use client\";\n\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, slideAnimation } from \"@bonprix-ds/internal-components\";\nimport Button from \"@bonprix-ds/react-button\";\nimport type { IconType } from \"@bonprix-ds/react-icon\";\nimport IconButton from \"@bonprix-ds/react-icon-button\";\nimport Typography from \"@bonprix-ds/react-typography\";\nimport { TitleLevel, useBreakpointDown, useInnerOpen, usePrefersReducedMotion, ZIndexContext } from \"@bonprix-ds/utils\";\n\nimport SideSheetContext from \"./SideSheetContext\";\nimport useConsumeSideSheet from \"./useConsumeSideSheet\";\n\nimport \"./SideSheet.css\";\n\nconst generateClasses = tv({\n slots: {\n modal: \"preflight fixed h-dvh flex flex-col bg-clr-bg-modal -end-100 top-0 outline-none\",\n header: \"px-4 py-6\",\n titleAndIcons: \"flex gap-2 items-center\",\n scrollArea: \"h-full scroll-area relative\",\n buttonSection: \"w-full flex flex-col gap-3 px-4 pt-6 shrink-0\",\n backdrop: backdrop(),\n contentWrapper: \"flex flex-col w-full grow typography-body1 text-clr-primary pb-6 overflow-hidden\",\n },\n variants: {\n disableHorizontalPadding: {\n false: { scrollArea: \"px-4\" },\n },\n prefersReducedMotion: {\n false: {\n modal: slideAnimation(),\n backdrop: fadeAnimation(),\n },\n true: {\n modal: \"end-0\",\n },\n },\n hasDynamicWidth: {\n false: {\n modal: \"w-100\",\n },\n true: {\n modal: \"min-w-100 w-fit max-w-150\",\n },\n },\n },\n});\n\ninterface SheetProps {\n /** All of the subcomponents should be placed inside this property. */\n children: ReactNode;\n /** Toggles the visibility of the sheet. Should be used in conjunction with the `onClose` property. */\n isOpen: boolean;\n /** Callback function, that is triggered when the sheet is attempted to be closed.\n *\n * It will be called in following cases:\n * - Click on backdrop\n * - Swipe down to close\n * - Click on \"close\" icon button in the upper-right corner\n * - Click on any button (PrimaryButton or SecondaryButton)\n *\n * Should be used in conjunction with `isOpen`. */\n onClose: () => void;\n /** Callback to execute when clicking back icon. */\n onBack?: () => void;\n /** The z-index of the sheet.. */\n zIndex?: number;\n}\n\nexport interface SheetTitleProps {\n /** The text content. */\n children: string;\n /** An optional subline that is displayed right below the title. */\n subline?: string;\n /** The heading level for the title. */\n level?: TitleLevel;\n}\n\nexport interface SheetButtonSectionProps {\n /** Primary and secondary buttons should be placed inside this section. */\n children: ReactNode;\n}\n\nexport interface SheetContentProps {\n /** The content of the content section. */\n children: ReactNode;\n /** If `true`, the horizontal padding around the content will be removed. */\n disableHorizontalPadding?: boolean;\n}\n\nexport interface SheetButtonBaseProps {\n /** The label of the button. */\n children: string;\n /** If used, an icon will be additionally shown. The value is a name of one icon from our icon set. */\n icon?: IconType;\n /** The position of the icon relative to the content. */\n iconPosition?: \"start\" | \"end\";\n}\n\nexport type SheetButtonProps<C extends ElementType> = SheetButtonBaseProps & {\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>, keyof SheetButtonBaseProps | \"component\">;\n\ntype SheetPrimaryButtonProps<C extends ElementType> = SheetButtonProps<C> & {\n /** If `true`, a loading spinner will be shown instead of the content. */\n loading?: boolean;\n};\n\nexport interface Props extends SheetProps {\n /** When set to false, interaction with outside elements will be disabled and only dialog content will be visible to screen readers. */\n modeless?: boolean;\n /** Makes the Sheet of 400px fixed or able to expand up to 600px depending on the content */\n hasDynamicWidth?: boolean;\n}\n\nconst SideSheetRoot = ({ children, isOpen, modeless = false, onClose, onBack, zIndex = 9999, hasDynamicWidth = false }: Props) => {\n const prefersReducedMotion = usePrefersReducedMotion();\n const isMobile = useBreakpointDown(\"m\");\n const { modal: modalClass, backdrop, contentWrapper } = generateClasses({ hasDynamicWidth, prefersReducedMotion });\n\n const { innerOpen } = useInnerOpen(isOpen);\n\n if (isMobile) return;\n\n const shiftFocusProgrammatically = (event: Event) => {\n event.preventDefault();\n const target = event.target as HTMLElement;\n target.focus();\n };\n\n return (\n <DialogPrimitive.Root open={innerOpen} modal={!modeless}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay className={backdrop()} onClick={onClose} style={{ zIndex }} />\n <DialogPrimitive.Content\n className={modalClass()}\n style={{ zIndex }}\n aria-describedby={undefined}\n onOpenAutoFocus={shiftFocusProgrammatically}\n tabIndex={-1}\n data-bpds=\"side-sheet\"\n data-bpds-modeless={modeless}\n data-bpds-has-dynamic-width={hasDynamicWidth}\n aria-modal={!modeless}\n >\n <ZIndexContext.Provider value={zIndex}>\n <SideSheetContext.Provider value={{ onClose, onBack }}>\n <div className={contentWrapper()}>{children}</div>\n </SideSheetContext.Provider>\n </ZIndexContext.Provider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n\nexport const Title = ({ children, subline, level = \"h3\" }: SheetTitleProps) => {\n const { onBack, onClose } = useConsumeSideSheet();\n const { header, titleAndIcons } = generateClasses();\n return (\n <div className={header()}>\n <div className={titleAndIcons()}>\n {onBack && <IconButton onClick={onBack} icon=\"arrow-left\" label=\"Zurück\" variant=\"tertiary\" size=\"small\" />}\n <DialogPrimitive.Title asChild>\n <div className=\"grow\">\n <Typography variant=\"bonprix-h6\" component={level} className=\"line-clamp-2\">\n {children}\n </Typography>\n </div>\n </DialogPrimitive.Title>\n <DialogPrimitive.Close asChild>\n <IconButton onClick={onClose} icon=\"closer\" label=\"Schließen\" variant=\"tertiary\" size=\"small\" />\n </DialogPrimitive.Close>\n </div>\n {subline && <Typography>{subline}</Typography>}\n </div>\n );\n};\n\nexport const Content = ({ children, disableHorizontalPadding = false }: SheetContentProps) => {\n const { scrollArea } = generateClasses({ disableHorizontalPadding });\n return (\n <div className={scrollArea()} data-bpds-disable-horizontal-padding={disableHorizontalPadding}>\n {children}\n </div>\n );\n};\n\nexport const ButtonSection = ({ children }: SheetButtonSectionProps) => {\n const { buttonSection } = generateClasses();\n return (\n <div className=\"button-section-container\">\n <div className={twMerge(buttonSection(), \"button-section\")}>{children}</div>\n </div>\n );\n};\n\nexport const PrimaryButton = <C extends ElementType>({\n children,\n icon,\n iconPosition,\n loading,\n component = \"button\" as C,\n ...props\n}: SheetPrimaryButtonProps<C>) => {\n const { onClick, ...otherProps } = props;\n const Component: ElementType = component;\n const { onClose } = useConsumeSideSheet();\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // oxlint-disable-next-line @typescript-eslint/no-unsafe-call\n onClick?.(event);\n onClose();\n };\n return (\n <Button\n component={Component}\n {...otherProps}\n variant=\"primary\"\n onClick={handleClick}\n icon={icon}\n iconPosition={iconPosition}\n size=\"large\"\n loading={loading}\n >\n {children}\n </Button>\n );\n};\n\nexport const SecondaryButton = <C extends ElementType>({\n children,\n icon,\n iconPosition,\n component = \"button\" as C,\n ...props\n}: SheetButtonProps<C>) => {\n const Component: ElementType = component;\n const { onClose } = useConsumeSideSheet();\n return (\n <Button\n component={Component}\n {...props}\n variant=\"secondary\"\n type=\"button\"\n onClick={onClose}\n icon={icon}\n iconPosition={iconPosition}\n size=\"large\"\n >\n {children}\n </Button>\n );\n};\n\nSideSheetRoot.displayName = \"SideSheet\";\n\nexport default SideSheetRoot;\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,IAAM,IAAkB,EAAG;CACzB,OAAO;EACL,OAAO;EACP,QAAQ;EACR,eAAe;EACf,YAAY;EACZ,eAAe;EACf,UAAU,EAAS;EACnB,gBAAgB;CAClB;CACA,UAAU;EACR,0BAA0B,EACxB,OAAO,EAAE,YAAY,OAAO,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AD;EACE,WAAW;EACX,GAAI;EACJ,SAAQ;EACR,SAAS;EACH;EACQ;EACd,MAAK;EACI;EAER;CACK,CAAA;AAEZ,GAEa,KAA0C,EACrD,aACA,SACA,iBACA,eAAY,UACZ,GAAG,QACsB;CACzB,IAAM,IAAyB,GACzB,EAAE,eAAY,EAAoB;CACxC,OACE,kBAAC,GAAD;EACE,WAAW;EACX,GAAI;EACJ,SAAQ;EACR,MAAK;EACL,SAAS;EACH;EACQ;EACd,MAAK;EAEJ;CACK,CAAA;AAEZ;AAEA,EAAc,cAAc"}
|
|
1
|
+
{"version":3,"file":"SideSheetRoot.js","names":["SideSheetContext","useConsumeSideSheet","DialogPrimitive","Button","IconButton","generateClasses","tv","backdrop","slideAnimation","fadeAnimation","SideSheetRoot","isOpen","warnDeprecated","prefersReducedMotion","usePrefersReducedMotion","isMobile","useBreakpointDown","modalClass","useInnerOpen","open","innerOpen","modeless","onClose","event","hasDynamicWidth","ZIndexContext","zIndex","contentWrapper","Title","Level","header","titleAndIcons","onBack","subline","Content","scrollArea","disableHorizontalPadding","ButtonSection","twMerge","buttonSection","PrimaryButton","props","otherProps","Component","component","handleClick","onClick","SecondaryButton"],"sources":["../../src/SideSheetRoot.tsx"],"sourcesContent":["\"use client\";\n\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, slideAnimation } from \"@bonprix-ds/internal-components\";\nimport Button from \"@bonprix-ds/react-button\";\nimport type { IconType } from \"@bonprix-ds/react-icon\";\nimport IconButton from \"@bonprix-ds/react-icon-button\";\nimport { TitleLevel, useBreakpointDown, useInnerOpen, usePrefersReducedMotion, ZIndexContext } from \"@bonprix-ds/utils\";\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\n\nimport SideSheetContext from \"./SideSheetContext\";\nimport useConsumeSideSheet from \"./useConsumeSideSheet\";\n\nimport \"./SideSheet.css\";\n\nconst generateClasses = tv({\n slots: {\n modal: \"preflight fixed -end-100 top-0 flex h-dvh flex-col bg-clr-bg-modal outline-none\",\n header: \"px-4 py-6\",\n titleAndIcons: \"flex items-center gap-2\",\n scrollArea: \"scroll-area relative h-full\",\n buttonSection: \"flex w-full shrink-0 flex-col gap-3 px-4 pt-6\",\n backdrop: backdrop(),\n contentWrapper: \"typography-body1 flex w-full grow flex-col overflow-hidden pb-6 text-clr-primary\",\n },\n variants: {\n disableHorizontalPadding: {\n false: { scrollArea: \"px-4\" },\n },\n prefersReducedMotion: {\n false: {\n modal: slideAnimation(),\n backdrop: fadeAnimation(),\n },\n true: {\n modal: \"end-0\",\n },\n },\n hasDynamicWidth: {\n false: {\n modal: \"w-100\",\n },\n true: {\n modal: \"w-fit min-w-100 max-w-150\",\n },\n },\n },\n});\n\ninterface SheetProps {\n /** All of the subcomponents should be placed inside this property. */\n children: ReactNode;\n /** Callback function, that is triggered when the sheet is attempted to be closed.\n *\n * It will be called in following cases:\n * - Click on backdrop\n * - Swipe down to close\n * - Click on \"close\" icon button in the upper-right corner\n * - Click on any button (PrimaryButton or SecondaryButton)\n *\n * Should be used in conjunction with `open`. */\n onClose: () => void;\n /** Callback to execute when clicking back icon. */\n onBack?: () => void;\n /** The z-index of the sheet.. */\n zIndex?: number;\n}\n\ntype OpenProps = SheetProps & {\n /** Toggles the visibility of the sheet. Should be used in conjunction with the `onClose` property. */\n open: boolean;\n /** @deprecated [is-open-prop] Use `open` instead. */\n isOpen?: never;\n};\n\ntype DeprecatedOpenProps = SheetProps & {\n open?: never;\n /**\n * Toggles the visibility of the sheet. Should be used in conjunction with the `onClose` property.\n * @deprecated [is-open-prop] Use `open` instead.\n */\n isOpen: boolean;\n};\n\nexport interface SheetTitleProps {\n /** The text content. */\n children: string;\n /** An optional subline that is displayed right below the title. */\n subline?: string;\n /** The heading level for the title. */\n level?: TitleLevel;\n}\n\nexport interface SheetButtonSectionProps {\n /** Primary and secondary buttons should be placed inside this section. */\n children: ReactNode;\n}\n\nexport interface SheetContentProps {\n /** The content of the content section. */\n children: ReactNode;\n /** If `true`, the horizontal padding around the content will be removed. */\n disableHorizontalPadding?: boolean;\n}\n\nexport interface SheetButtonBaseProps {\n /** The label of the button. */\n children: string;\n /** If used, an icon will be additionally shown. The value is a name of one icon from our icon set. */\n icon?: IconType;\n /** The position of the icon relative to the content. */\n iconPosition?: \"start\" | \"end\";\n}\n\nexport type SheetButtonProps<C extends ElementType> = SheetButtonBaseProps & {\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>, keyof SheetButtonBaseProps | \"component\">;\n\ntype SheetPrimaryButtonProps<C extends ElementType> = SheetButtonProps<C> & {\n /** If `true`, a loading spinner will be shown instead of the content. */\n loading?: boolean;\n};\n\nexport type Props = (DeprecatedOpenProps | OpenProps) & {\n /** When set to false, interaction with outside elements will be disabled and only dialog content will be visible to screen readers. */\n modeless?: boolean;\n /** Makes the Sheet of 400px fixed or able to expand up to 600px depending on the content */\n hasDynamicWidth?: boolean;\n};\n\nconst SideSheetRoot = ({ children, open, isOpen, modeless = false, onClose, onBack, zIndex = 9999, hasDynamicWidth = false }: Props) => {\n if (isOpen !== undefined) warnDeprecated(\"is-open-prop\");\n const prefersReducedMotion = usePrefersReducedMotion();\n const isMobile = useBreakpointDown(\"m\");\n const { modal: modalClass, backdrop, contentWrapper } = generateClasses({ hasDynamicWidth, prefersReducedMotion });\n\n const { innerOpen } = useInnerOpen(open ?? isOpen ?? false);\n\n if (isMobile) return;\n\n const shiftFocusProgrammatically = (event: Event) => {\n event.preventDefault();\n const target = event.target as HTMLElement;\n target.focus();\n };\n\n return (\n <DialogPrimitive.Root open={innerOpen} modal={!modeless}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay className={backdrop()} onClick={onClose} style={{ zIndex }} />\n <DialogPrimitive.Content\n className={modalClass()}\n style={{ zIndex }}\n aria-describedby={undefined}\n onOpenAutoFocus={shiftFocusProgrammatically}\n tabIndex={-1}\n data-bpds=\"side-sheet\"\n data-bpds-modeless={modeless}\n data-bpds-has-dynamic-width={hasDynamicWidth}\n aria-modal={!modeless}\n >\n <ZIndexContext.Provider value={zIndex}>\n <SideSheetContext.Provider value={{ onClose, onBack }}>\n <div className={contentWrapper()}>{children}</div>\n </SideSheetContext.Provider>\n </ZIndexContext.Provider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n\nexport const Title = ({ children, subline, level: Level = \"h3\" }: SheetTitleProps) => {\n const { onBack, onClose } = useConsumeSideSheet();\n const { header, titleAndIcons } = generateClasses();\n return (\n <div className={header()}>\n <div className={titleAndIcons()}>\n {onBack && <IconButton onClick={onBack} icon=\"arrow-left\" label=\"Zurück\" variant=\"tertiary\" size=\"small\" />}\n <DialogPrimitive.Title asChild>\n <div className=\"grow\">\n <Level className=\"typography-bonprix-h6 my-0 line-clamp-2 text-start text-clr-on-bg-high\">{children}</Level>\n </div>\n </DialogPrimitive.Title>\n <DialogPrimitive.Close asChild>\n <IconButton onClick={onClose} icon=\"closer\" label=\"Schließen\" variant=\"tertiary\" size=\"small\" />\n </DialogPrimitive.Close>\n </div>\n {subline && <p className=\"typography-body1 my-0 text-start text-clr-on-bg-high\">{subline}</p>}\n </div>\n );\n};\n\nexport const Content = ({ children, disableHorizontalPadding = false }: SheetContentProps) => {\n const { scrollArea } = generateClasses({ disableHorizontalPadding });\n return (\n <div className={scrollArea()} data-bpds-disable-horizontal-padding={disableHorizontalPadding}>\n {children}\n </div>\n );\n};\n\nexport const ButtonSection = ({ children }: SheetButtonSectionProps) => {\n const { buttonSection } = generateClasses();\n return (\n <div className=\"button-section-container\">\n <div className={twMerge(buttonSection(), \"button-section\")}>{children}</div>\n </div>\n );\n};\n\nexport const PrimaryButton = <C extends ElementType>({\n children,\n icon,\n iconPosition,\n loading,\n component = \"button\" as C,\n ...props\n}: SheetPrimaryButtonProps<C>) => {\n const { onClick, ...otherProps } = props;\n const Component: ElementType = component;\n const { onClose } = useConsumeSideSheet();\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // oxlint-disable-next-line @typescript-eslint/no-unsafe-call\n onClick?.(event);\n onClose();\n };\n return (\n <Button\n component={Component}\n {...otherProps}\n variant=\"primary\"\n onClick={handleClick}\n icon={icon}\n iconPosition={iconPosition}\n size=\"large\"\n loading={loading}\n >\n {children}\n </Button>\n );\n};\n\nexport const SecondaryButton = <C extends ElementType>({\n children,\n icon,\n iconPosition,\n component = \"button\" as C,\n ...props\n}: SheetButtonProps<C>) => {\n const Component: ElementType = component;\n const { onClose } = useConsumeSideSheet();\n return (\n <Button\n component={Component}\n {...props}\n variant=\"secondary\"\n type=\"button\"\n onClick={onClose}\n icon={icon}\n iconPosition={iconPosition}\n size=\"large\"\n >\n {children}\n </Button>\n );\n};\n\nSideSheetRoot.displayName = \"SideSheet\";\n\nexport default SideSheetRoot;\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,IAAMK,IAAkBC,EAAG;CACzB,OAAO;EACL,OAAO;EACP,QAAQ;EACR,eAAe;EACf,YAAY;EACZ,eAAe;EACf,UAAUC,EAAS;EACnB,gBAAgB;CAClB;CACA,UAAU;EACR,0BAA0B,EACxB,OAAO,EAAE,YAAY,OAAO,EAC9B;EACA,sBAAsB;GACpB,OAAO;IACL,OAAOC,EAAe;IACtB,UAAUC,EAAc;GAC1B;GACA,MAAM,EACJ,OAAO,QACT;EACF;EACA,iBAAiB;GACf,OAAO,EACL,OAAO,QACT;GACA,MAAM,EACJ,OAAO,4BACT;EACF;CACF;AACF,CAAC,GAoFKC,KAAiB,EAAE,aAAU,SAAM,WAAQ,cAAW,IAAO,YAAS,WAAQ,YAAS,MAAM,qBAAkB,SAAmB;CACtI,AAAIC,MAAW,KAAA,KAAWC,EAAe,cAAc;CACvD,IAAMC,IAAuBC,EAAwB,GAC/CC,IAAWC,EAAkB,GAAG,GACh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,GAAIF;EACJ,SAAQ;EACR,MAAK;EACL,SAASnB;EACH;EACQ;EACd,MAAK;EAEJ;CACK,CAAA;AAEZ;AAEA,EAAc,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConsumeSideSheet.js","names":[],"sources":["../../src/useConsumeSideSheet.ts"],"sourcesContent":["import { useContext } from \"react\";\n\nimport SideSheetContext from \"./SideSheetContext\";\n\nconst useConsumeSideSheet = () => {\n return useContext(SideSheetContext);\n};\n\nexport default useConsumeSideSheet;\n"],"mappings":";;;AAIA,
|
|
1
|
+
{"version":3,"file":"useConsumeSideSheet.js","names":["SideSheetContext","useConsumeSideSheet","useContext"],"sources":["../../src/useConsumeSideSheet.ts"],"sourcesContent":["import { useContext } from \"react\";\n\nimport SideSheetContext from \"./SideSheetContext\";\n\nconst useConsumeSideSheet = () => {\n return useContext(SideSheetContext);\n};\n\nexport default useConsumeSideSheet;\n"],"mappings":";;;AAIA,IAAMC,UACGC,EAAWF,CAAgB"}
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./src/SideSheet.css";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonprix-ds/react-side-sheet",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "SideSheet component, implemented in React, for the Bonprix Design System.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -18,10 +18,17 @@
|
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
20
|
"sideEffects": [
|
|
21
|
-
"**/*.css"
|
|
21
|
+
"**/*.css",
|
|
22
|
+
"./dist/styles.js"
|
|
22
23
|
],
|
|
23
24
|
"module": "./dist/index.js",
|
|
24
25
|
"types": "./dist/index.d.ts",
|
|
26
|
+
"imports": {
|
|
27
|
+
"#styles": {
|
|
28
|
+
"browser": "./dist/styles.js",
|
|
29
|
+
"default": "./dist/no-styles.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
25
32
|
"exports": {
|
|
26
33
|
".": {
|
|
27
34
|
"import": "./dist/index.js",
|
|
@@ -36,23 +43,23 @@
|
|
|
36
43
|
"dependencies": {
|
|
37
44
|
"@radix-ui/react-dialog": "1.1.23",
|
|
38
45
|
"tailwind-merge": "2.6.1",
|
|
39
|
-
"@bonprix-ds/
|
|
40
|
-
"@bonprix-ds/
|
|
41
|
-
"@bonprix-ds/react-
|
|
42
|
-
"@bonprix-ds/react-icon-button": "1.2.
|
|
43
|
-
"@bonprix-ds/
|
|
44
|
-
"@bonprix-ds/utils": "0.2.2"
|
|
46
|
+
"@bonprix-ds/internal-components": "0.2.2",
|
|
47
|
+
"@bonprix-ds/react-icon": "1.2.2",
|
|
48
|
+
"@bonprix-ds/react-button": "1.1.2",
|
|
49
|
+
"@bonprix-ds/react-icon-button": "1.2.2",
|
|
50
|
+
"@bonprix-ds/utils": "0.3.0"
|
|
45
51
|
},
|
|
46
52
|
"devDependencies": {
|
|
53
|
+
"@testing-library/dom": "10.4.2",
|
|
54
|
+
"@testing-library/react": "16.3.3",
|
|
47
55
|
"@types/react": "19.3.0",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"vite": "8.3.0",
|
|
56
|
+
"vite": "8.3.2",
|
|
57
|
+
"vitest": "4.1.11",
|
|
51
58
|
"@bonprix-ds/vite-config": "0.0.0"
|
|
52
59
|
},
|
|
53
60
|
"peerDependencies": {
|
|
54
|
-
"react": "^19
|
|
55
|
-
"react-dom": "^19
|
|
61
|
+
"react": "^19",
|
|
62
|
+
"react-dom": "^19",
|
|
56
63
|
"tailwind-variants": "0.3.1"
|
|
57
64
|
},
|
|
58
65
|
"scripts": {
|