bonprix-design-system 0.70.0 → 0.71.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/components/BottomSheet/BottomSheet.js +6 -167
- package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetRoot.js +171 -0
- package/dist/components/BottomSheet/BottomSheetRoot.js.map +1 -0
- package/dist/components/Carousel/Carousel.js +6 -95
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Carousel/CarouselArrow.js.map +1 -1
- package/dist/components/Carousel/CarouselRoot.js +100 -0
- package/dist/components/Carousel/CarouselRoot.js.map +1 -0
- package/dist/components/Carousel/CarouselSlide.js +14 -0
- package/dist/components/Carousel/CarouselSlide.js.map +1 -0
- package/dist/components/CarouselV2/CarouselArrow.js.map +1 -1
- package/dist/components/CarouselV2/CarouselV2.js +9 -117
- package/dist/components/CarouselV2/CarouselV2.js.map +1 -1
- package/dist/components/CarouselV2/CarouselV2Root.js +118 -0
- package/dist/components/CarouselV2/CarouselV2Root.js.map +1 -0
- package/dist/components/CarouselV2/PositionIndicator/PositionIndicator.js +1 -0
- package/dist/components/CarouselV2/PositionIndicator/PositionIndicator.js.map +1 -1
- package/dist/components/CarouselV2/Slide/Slide.js +1 -0
- package/dist/components/CarouselV2/Slide/Slide.js.map +1 -1
- package/dist/components/CarouselV2/Slides/Slides.js +1 -0
- package/dist/components/CarouselV2/Slides/Slides.js.map +1 -1
- package/dist/components/Dialog/Dialog.js +4 -62
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/DialogRoot.js +68 -0
- package/dist/components/Dialog/DialogRoot.js.map +1 -0
- package/dist/components/FeatureHint/FeatureHint.js +4 -4
- package/dist/components/FeatureHint/FeatureHint.js.map +1 -1
- package/dist/components/Image/Image.js.map +1 -1
- package/dist/components/InputFields/BaseInputField/BaseInputField.js.map +1 -1
- package/dist/components/InputFields/EmailField/EmailField.js.map +1 -1
- package/dist/components/InputFields/PasswordField/PasswordField.js.map +1 -1
- package/dist/components/InputFields/SearchField/SearchField.js.map +1 -1
- package/dist/components/InputFields/TextField/TextField.js.map +1 -1
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Notification/Notification.js.map +1 -1
- package/dist/components/Overlay/Overlay.js.map +1 -1
- package/dist/components/RemovedItemPlaceholder/RemovedItemPlaceholder.js.map +1 -1
- package/dist/components/ShowMoreList/ShowMoreList.js +7 -105
- package/dist/components/ShowMoreList/ShowMoreList.js.map +1 -1
- package/dist/components/ShowMoreList/ShowMoreListItem/ShowMoreListItem.js +1 -0
- package/dist/components/ShowMoreList/ShowMoreListItem/ShowMoreListItem.js.map +1 -1
- package/dist/components/ShowMoreList/ShowMoreListRoot.js +108 -0
- package/dist/components/ShowMoreList/ShowMoreListRoot.js.map +1 -0
- package/dist/components/SideNavigation/SideNavigation.js +9 -22
- package/dist/components/SideNavigation/SideNavigation.js.map +1 -1
- package/dist/components/SideNavigation/SideNavigationRoot.js +28 -0
- package/dist/components/SideNavigation/SideNavigationRoot.js.map +1 -0
- package/dist/components/SideSheet/SideSheet.js +5 -165
- package/dist/components/SideSheet/SideSheet.js.map +1 -1
- package/dist/components/SideSheet/SideSheetRoot.js +170 -0
- package/dist/components/SideSheet/SideSheetRoot.js.map +1 -0
- package/dist/components/TabGroup/TabGroup.js +6 -23
- package/dist/components/TabGroup/TabGroup.js.map +1 -1
- package/dist/components/TabGroup/TabGroupContent/TabGroupContent.js +1 -0
- package/dist/components/TabGroup/TabGroupContent/TabGroupContent.js.map +1 -1
- package/dist/components/TabGroup/TabGroupItem/TabGroupItem.js +1 -0
- package/dist/components/TabGroup/TabGroupItem/TabGroupItem.js.map +1 -1
- package/dist/components/TabGroup/TabGroupList/TabGroupList.js +1 -0
- package/dist/components/TabGroup/TabGroupList/TabGroupList.js.map +1 -1
- package/dist/components/TabGroup/TabGroupRoot.js +27 -0
- package/dist/components/TabGroup/TabGroupRoot.js.map +1 -0
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/ThemeForcer/ThemeForcer.js.map +1 -1
- package/dist/index.d.ts +180 -152
- package/dist/styles/legacy-component-variables.css +2 -2
- package/dist/styles/primitive-tokens.css +129 -0
- package/dist/styles/{default-variables.css → semantic-tokens.css} +0 -127
- package/dist/styles/variables.css +4 -3
- package/dist/styles/web-components/collapsible.css +4 -2
- package/dist/styles/web-components/feature-hint.css +4 -2
- package/dist/web-components/collapsible/collapsible.css +1 -1
- package/dist/web-components/feature-hint/feature-hint.css +1 -1
- package/package.json +45 -44
- /package/dist/styles/{component-variables.css → component-tokens.css} +0 -0
- /package/dist/styles/{dark-theme-variables.css → semantic-colors-dark.css} +0 -0
- /package/dist/styles/{light-theme-variables.css → semantic-colors-light.css} +0 -0
|
@@ -1,171 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { backdrop as n } from "../../utils/tailwindVariants.js";
|
|
5
|
-
import r from "./BottomSheetContext.js";
|
|
6
|
-
import i from "./useConsumeBottomSheet.js";
|
|
7
|
-
import a from "./useCreateBottomSheet.js";
|
|
8
|
-
import o from "@bonprix-ds/react-icon-button";
|
|
9
|
-
import { useId as s } from "react";
|
|
10
|
-
import { tv as c } from "tailwind-variants";
|
|
11
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
12
|
-
import d from "@bonprix-ds/react-typography";
|
|
13
|
-
import { ZIndexContext as f, usePrefersReducedMotion as p } from "@bonprix-ds/utils";
|
|
14
|
-
import { Sheet as m } from "react-modal-sheet";
|
|
1
|
+
import e, { ButtonSection as t, Content as n, PrimaryButton as r, SecondaryButton as i, Title as a } from "./BottomSheetRoot.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
15
4
|
//#region src/components/BottomSheet/BottomSheet.tsx
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
root: "preflight block",
|
|
19
|
-
container: "shadow-none rounded-none bg-clr-bg-modal max-h-[calc(100%-4rem)]",
|
|
20
|
-
header: "px-4 py-3",
|
|
21
|
-
titleAndIcons: "flex gap-2 items-center touch-pan-down",
|
|
22
|
-
contentWrapper: "flex flex-col w-full",
|
|
23
|
-
content: [
|
|
24
|
-
"typography-body1 text-clr-primary",
|
|
25
|
-
"*:flex *:-mx-0.5 *:px-0.5",
|
|
26
|
-
"*:min-h-0"
|
|
27
|
-
],
|
|
28
|
-
dragHandleContainer: "h-6 flex justify-center items-center shrink-0",
|
|
29
|
-
dragHandle: "h-1 w-8 rounded-full bg-clr-on-bg-low",
|
|
30
|
-
backdrop: n(),
|
|
31
|
-
scrollArea: "scroll-area relative"
|
|
32
|
-
},
|
|
33
|
-
variants: { disableHorizontalPadding: {
|
|
34
|
-
false: { scrollArea: "px-4" },
|
|
35
|
-
true: ""
|
|
36
|
-
} }
|
|
37
|
-
}), g = ({ children: e, isOpen: n, onClose: i, onBack: o, zIndex: c = 9999, ref: d }) => {
|
|
38
|
-
let g = p(), { root: _, container: v, dragHandleContainer: y, dragHandle: b, content: x, contentWrapper: S, backdrop: C } = h(), { isShown: w, scrollRef: T, scrollPosition: E } = a({ isOpen: n }), D = E === "middle" || E === "bottom", { innerOpen: O } = t(w), k = s();
|
|
39
|
-
return /* @__PURE__ */ u(m, {
|
|
40
|
-
isOpen: O,
|
|
41
|
-
onClose: i,
|
|
42
|
-
className: _(),
|
|
43
|
-
detent: "content",
|
|
44
|
-
"data-bpds": "bottom-sheet",
|
|
45
|
-
prefersReducedMotion: g,
|
|
46
|
-
style: {
|
|
47
|
-
"--touch-action": D ? "initial" : "pan-down",
|
|
48
|
-
pointerEvents: void 0,
|
|
49
|
-
visibility: O ? "visible" : "hidden",
|
|
50
|
-
zIndex: c
|
|
51
|
-
},
|
|
52
|
-
role: "dialog",
|
|
53
|
-
avoidKeyboard: !1,
|
|
54
|
-
"aria-labelledby": k,
|
|
55
|
-
children: [/* @__PURE__ */ u(m.Container, {
|
|
56
|
-
className: v(),
|
|
57
|
-
ref: d,
|
|
58
|
-
style: { pointerEvents: void 0 },
|
|
59
|
-
children: [/* @__PURE__ */ l(m.Header, {
|
|
60
|
-
unstyled: !0,
|
|
61
|
-
className: y(),
|
|
62
|
-
children: /* @__PURE__ */ l(m.DragIndicator, {
|
|
63
|
-
unstyled: !0,
|
|
64
|
-
className: b()
|
|
65
|
-
})
|
|
66
|
-
}), /* @__PURE__ */ l(f.Provider, {
|
|
67
|
-
value: c,
|
|
68
|
-
children: /* @__PURE__ */ l(r.Provider, {
|
|
69
|
-
value: {
|
|
70
|
-
scrollRef: T,
|
|
71
|
-
scrollPosition: E,
|
|
72
|
-
onClose: i,
|
|
73
|
-
onBack: o,
|
|
74
|
-
titleId: k
|
|
75
|
-
},
|
|
76
|
-
children: /* @__PURE__ */ l(m.Content, {
|
|
77
|
-
className: x(),
|
|
78
|
-
disableScroll: !0,
|
|
79
|
-
disableDrag: D,
|
|
80
|
-
style: { paddingBottom: "max(var(--keyboard-inset-height, 0rem), var(--app-safe-area-inset-bottom, 1rem))" },
|
|
81
|
-
children: /* @__PURE__ */ l("div", {
|
|
82
|
-
className: S(),
|
|
83
|
-
children: e
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
})
|
|
87
|
-
})]
|
|
88
|
-
}), /* @__PURE__ */ l(m.Backdrop, {
|
|
89
|
-
"aria-label": "Bottom Sheet schließen",
|
|
90
|
-
onTap: i,
|
|
91
|
-
className: C()
|
|
92
|
-
})]
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
g.displayName = "BottomSheet", g.Title = ({ children: e, subline: t, level: n = "h3" }) => {
|
|
96
|
-
let { onBack: r, onClose: a, titleId: s } = i(), { header: c, titleAndIcons: f } = h();
|
|
97
|
-
return /* @__PURE__ */ u("div", {
|
|
98
|
-
className: c(),
|
|
99
|
-
children: [/* @__PURE__ */ u("div", {
|
|
100
|
-
className: f(),
|
|
101
|
-
children: [
|
|
102
|
-
r && /* @__PURE__ */ l(o, {
|
|
103
|
-
onClick: r,
|
|
104
|
-
icon: "arrow-left",
|
|
105
|
-
label: "Zurück",
|
|
106
|
-
variant: "tertiary",
|
|
107
|
-
size: "small"
|
|
108
|
-
}),
|
|
109
|
-
/* @__PURE__ */ l(d, {
|
|
110
|
-
variant: "bonprix-h6",
|
|
111
|
-
component: n,
|
|
112
|
-
className: "grow line-clamp-2",
|
|
113
|
-
id: s,
|
|
114
|
-
children: e
|
|
115
|
-
}),
|
|
116
|
-
/* @__PURE__ */ l(o, {
|
|
117
|
-
onClick: a,
|
|
118
|
-
icon: "closer",
|
|
119
|
-
label: "Schließen",
|
|
120
|
-
variant: "tertiary",
|
|
121
|
-
size: "small"
|
|
122
|
-
})
|
|
123
|
-
]
|
|
124
|
-
}), t && /* @__PURE__ */ l(d, { children: t })]
|
|
125
|
-
});
|
|
126
|
-
}, g.Content = ({ children: e, disableHorizontalPadding: t = !1 }) => {
|
|
127
|
-
let { scrollRef: n } = i(), { scrollArea: r } = h({ disableHorizontalPadding: t });
|
|
128
|
-
return /* @__PURE__ */ l("div", {
|
|
129
|
-
ref: n,
|
|
130
|
-
className: r(),
|
|
131
|
-
"data-bpds-disable-horizontal-padding": t,
|
|
132
|
-
tabIndex: 0,
|
|
133
|
-
children: e
|
|
134
|
-
});
|
|
135
|
-
}, g.ButtonSection = ({ children: e }) => /* @__PURE__ */ l("div", {
|
|
136
|
-
className: "button-section w-full flex flex-col gap-3 px-4 pt-4 shrink-0 touch-pan-down",
|
|
137
|
-
children: e
|
|
138
|
-
}), g.PrimaryButton = ({ children: t, icon: n, iconPosition: r, loading: a, component: o = "button", ...s }) => {
|
|
139
|
-
let c = o, { onClick: u, type: d = "button", ...f } = s, { onClose: p } = i(), m = (e) => {
|
|
140
|
-
u?.(e), p();
|
|
141
|
-
};
|
|
142
|
-
return /* @__PURE__ */ l(e, {
|
|
143
|
-
component: c,
|
|
144
|
-
...f,
|
|
145
|
-
variant: "primary",
|
|
146
|
-
onClick: m,
|
|
147
|
-
type: d,
|
|
148
|
-
icon: n,
|
|
149
|
-
iconPosition: r,
|
|
150
|
-
size: "large",
|
|
151
|
-
loading: a,
|
|
152
|
-
children: t
|
|
153
|
-
});
|
|
154
|
-
}, g.SecondaryButton = ({ children: t, icon: n, iconPosition: r, component: a = "button", ...o }) => {
|
|
155
|
-
let s = a, { onClose: c } = i();
|
|
156
|
-
return /* @__PURE__ */ l(e, {
|
|
157
|
-
component: s,
|
|
158
|
-
...o,
|
|
159
|
-
variant: "secondary",
|
|
160
|
-
type: "button",
|
|
161
|
-
onClick: c,
|
|
162
|
-
icon: n,
|
|
163
|
-
iconPosition: r,
|
|
164
|
-
size: "large",
|
|
165
|
-
children: t
|
|
166
|
-
});
|
|
167
|
-
};
|
|
5
|
+
var s = (t) => /* @__PURE__ */ o(e, { ...t });
|
|
6
|
+
s.displayName = "BottomSheet", s.Title = a, s.Content = n, s.ButtonSection = t, s.PrimaryButton = r, s.SecondaryButton = i;
|
|
168
7
|
//#endregion
|
|
169
|
-
export {
|
|
8
|
+
export { s as default };
|
|
170
9
|
|
|
171
10
|
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.js","names":[],"sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"sourcesContent":["\"use client\";\n\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, usePrefersReducedMotion, ZIndexContext } from \"@bonprix-ds/utils\";\nimport React, { ComponentProps, ElementType, FC, ReactNode, RefObject, useId } from \"react\";\nimport { Sheet } from \"react-modal-sheet\";\nimport { tv } from \"tailwind-variants\";\n\nimport { Button } from \"@components/Buttons\";\nimport { useInnerOpen } from \"@hooks\";\nimport { backdrop } from \"@utils/tailwindVariants\";\n\nimport BottomSheetContext from \"./BottomSheetContext\";\nimport useConsumeBottomSheet from \"./useConsumeBottomSheet\";\nimport useCreateBottomSheet from \"./useCreateBottomSheet\";\n\nconst generateClasses = tv({\n slots: {\n root: \"preflight block\",\n container: \"shadow-none rounded-none bg-clr-bg-modal max-h-[calc(100%-4rem)]\",\n header: \"px-4 py-3\",\n titleAndIcons: \"flex gap-2 items-center touch-pan-down\",\n contentWrapper: \"flex flex-col w-full\",\n content: [\n \"typography-body1 text-clr-primary\",\n // scroller must be a flexbox to fix scrollbar\n // scroller needs some padding to not cut off the focus-ring\n \"*:flex *:-mx-0.5 *:px-0.5\",\n // scroller must set min-h-0 in order to make scrolling work inside our flex context\n \"*:min-h-0\",\n ],\n dragHandleContainer: \"h-6 flex justify-center items-center shrink-0\",\n dragHandle: \"h-1 w-8 rounded-full bg-clr-on-bg-low\",\n backdrop: backdrop(),\n scrollArea: \"scroll-area relative\",\n },\n variants: {\n disableHorizontalPadding: {\n false: { scrollArea: \"px-4\" },\n true: \"\",\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\ninterface 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\ninterface SheetButtonSectionProps {\n /** Primary and secondary buttons should be placed inside this section. */\n children: ReactNode;\n}\n\ninterface 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\ninterface 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\"`. Defaults to `\"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\ninterface SheetSubcomponents {\n Title: typeof Title;\n Content: typeof Content;\n ButtonSection: typeof ButtonSection;\n PrimaryButton: typeof PrimaryButton;\n SecondaryButton: typeof SecondaryButton;\n}\n\nexport interface Props extends SheetProps {\n /** A reference to the root element of the sheet. */\n ref?: RefObject<HTMLDivElement>;\n}\n\nconst BottomSheet: FC<Props> & SheetSubcomponents = ({ children, isOpen, onClose, onBack, zIndex = 9999, ref }) => {\n // TODO: add aria-modal = true once we implemented the dialog pattern fully and i.e. manage the focus\n const prefersReducedMotion = usePrefersReducedMotion();\n const { root, container, dragHandleContainer, dragHandle, content, contentWrapper, backdrop } = generateClasses();\n const { isShown, scrollRef, scrollPosition } = useCreateBottomSheet({ isOpen });\n\n // When \"middle\" or \"bottom\", dragging is disabled to allow for regular scrolling.\n // When at \"top\", we need to enable drag to close. When `undefined`, the element is not scrollable and can be dragged, too.\n const disableDrag = scrollPosition === \"middle\" || scrollPosition === \"bottom\";\n\n const { innerOpen } = useInnerOpen(isShown);\n\n const titleId = useId();\n\n return (\n <Sheet\n isOpen={innerOpen}\n onClose={onClose}\n className={root()}\n detent=\"content\"\n data-bpds=\"bottom-sheet\"\n prefersReducedMotion={prefersReducedMotion}\n style={{\n // @ts-expect-error setting custom properties is not recognized by React.CSSProperties\n // This is consumed by the inner ScrollArea to fix drag to close.\n \"--touch-action\": disableDrag ? \"initial\" : \"pan-down\",\n // We remove `pointer-events` handling from the library because it interfers with a lot of things like opened Selects that wouldn't close etc.\n pointerEvents: undefined,\n // When removing react-modal-sheet's pointerEvents handling, we need to adjust visibility because we can no longer rely on `pointer-events: none` being set on the wrapper that spans the whole page even when closed.\n visibility: innerOpen ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n }}\n role=\"dialog\"\n avoidKeyboard={false}\n aria-labelledby={titleId}\n >\n {/* We remove `pointer-events` handling from the library because it interfers with a lot of things like opened Selects that wouldn't close etc. */}\n <Sheet.Container className={container()} ref={ref} style={{ pointerEvents: undefined }}>\n <Sheet.Header unstyled className={dragHandleContainer()}>\n <Sheet.DragIndicator unstyled className={dragHandle()} />\n </Sheet.Header>\n <ZIndexContext.Provider value={zIndex}>\n <BottomSheetContext.Provider value={{ scrollRef, scrollPosition, onClose, onBack, titleId }}>\n <Sheet.Content\n className={content()}\n // disable default scrolling\n disableScroll\n // Dragging is still managed by `Sheet.Content` so we control it here\n disableDrag={disableDrag}\n // Apply keyboard height as padding bottom to keep content above the keyboard\n style={{ paddingBottom: \"max(var(--keyboard-inset-height, 0rem), var(--app-safe-area-inset-bottom, 1rem))\" }}\n >\n <div className={contentWrapper()}>{children}</div>\n </Sheet.Content>\n </BottomSheetContext.Provider>\n </ZIndexContext.Provider>\n </Sheet.Container>\n {/* TODO: Deactivate the animation, when the user prefers reduced motion: https://github.com/Temzasse/react-modal-sheet/issues/227 */}\n <Sheet.Backdrop aria-label=\"Bottom Sheet schließen\" onTap={onClose} className={backdrop()} />\n </Sheet>\n );\n};\n\nexport default BottomSheet;\n\nconst Title = ({ children, subline, level = \"h3\" }: SheetTitleProps) => {\n const { onBack, onClose, titleId } = useConsumeBottomSheet();\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 <Typography variant=\"bonprix-h6\" component={level} className=\"grow line-clamp-2\" id={titleId}>\n {children}\n </Typography>\n <IconButton onClick={onClose} icon=\"closer\" label=\"Schließen\" variant=\"tertiary\" size=\"small\" />\n </div>\n {subline && <Typography>{subline}</Typography>}\n </div>\n );\n};\n\nconst Content = ({ children, disableHorizontalPadding = false }: SheetContentProps) => {\n const { scrollRef: setScrollRef } = useConsumeBottomSheet();\n const { scrollArea } = generateClasses({ disableHorizontalPadding });\n return (\n <div ref={setScrollRef} className={scrollArea()} data-bpds-disable-horizontal-padding={disableHorizontalPadding} tabIndex={0}>\n {children}\n </div>\n );\n};\n\nconst ButtonSection = ({ children }: SheetButtonSectionProps) => {\n return <div className=\"button-section w-full flex flex-col gap-3 px-4 pt-4 shrink-0 touch-pan-down\">{children}</div>;\n};\n\nconst PrimaryButton = <C extends ElementType>({\n children,\n icon,\n iconPosition,\n loading,\n component = \"button\" as C,\n ...props\n}: SheetPrimaryButtonProps<C>) => {\n const Component: ElementType = component;\n const { onClick, type = \"button\", ...otherProps } = props;\n const { onClose } = useConsumeBottomSheet();\n const handleClick = (event: React.MouseEvent) => {\n // eslint-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 type={type}\n icon={icon}\n iconPosition={iconPosition}\n size=\"large\"\n loading={loading}\n >\n {children}\n </Button>\n );\n};\n\nconst 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 } = useConsumeBottomSheet();\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\nBottomSheet.displayName = \"BottomSheet\";\n\nBottomSheet.Title = Title;\nBottomSheet.Content = Content;\nBottomSheet.ButtonSection = ButtonSection;\nBottomSheet.PrimaryButton = PrimaryButton;\nBottomSheet.SecondaryButton = SecondaryButton;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"BottomSheet.js","names":[],"sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"sourcesContent":["import React from \"react\";\n\nimport BottomSheetRoot, { ButtonSection, Content, PrimaryButton, SecondaryButton, Title, type Props } from \"./BottomSheetRoot\";\n\nexport type { Props, SheetButtonProps } from \"./BottomSheetRoot\";\n\nconst BottomSheet = (props: Props) => <BottomSheetRoot {...props} />;\n\nBottomSheet.displayName = \"BottomSheet\";\n\nBottomSheet.Title = Title;\nBottomSheet.Content = Content;\nBottomSheet.ButtonSection = ButtonSection;\nBottomSheet.PrimaryButton = PrimaryButton;\nBottomSheet.SecondaryButton = SecondaryButton;\n\nexport default BottomSheet;\n"],"mappings":";;;;AAMA,IAAM,KAAe,MAAiB,kBAAC,GAAD,EAAiB,GAAI,EAAQ,CAAA;AAEnE,EAAY,cAAc,eAE1B,EAAY,QAAQ,GACpB,EAAY,UAAU,GACtB,EAAY,gBAAgB,GAC5B,EAAY,gBAAgB,GAC5B,EAAY,kBAAkB"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../Buttons/Button/index.js";
|
|
3
|
+
import t from "../../hooks/useInnerOpen.js";
|
|
4
|
+
import { backdrop as n } from "../../utils/tailwindVariants.js";
|
|
5
|
+
import r from "./BottomSheetContext.js";
|
|
6
|
+
import i from "./useConsumeBottomSheet.js";
|
|
7
|
+
import a from "./useCreateBottomSheet.js";
|
|
8
|
+
import o from "@bonprix-ds/react-icon-button";
|
|
9
|
+
import { useId as s } from "react";
|
|
10
|
+
import { tv as c } from "tailwind-variants";
|
|
11
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
12
|
+
import d from "@bonprix-ds/react-typography";
|
|
13
|
+
import { ZIndexContext as f, usePrefersReducedMotion as p } from "@bonprix-ds/utils";
|
|
14
|
+
import { Sheet as m } from "react-modal-sheet";
|
|
15
|
+
//#region src/components/BottomSheet/BottomSheetRoot.tsx
|
|
16
|
+
var h = c({
|
|
17
|
+
slots: {
|
|
18
|
+
root: "preflight block",
|
|
19
|
+
container: "shadow-none rounded-none bg-clr-bg-modal max-h-[calc(100%-4rem)]",
|
|
20
|
+
header: "px-4 py-3",
|
|
21
|
+
titleAndIcons: "flex gap-2 items-center touch-pan-down",
|
|
22
|
+
contentWrapper: "flex flex-col w-full",
|
|
23
|
+
content: [
|
|
24
|
+
"typography-body1 text-clr-primary",
|
|
25
|
+
"*:flex *:-mx-0.5 *:px-0.5",
|
|
26
|
+
"*:min-h-0"
|
|
27
|
+
],
|
|
28
|
+
dragHandleContainer: "h-6 flex justify-center items-center shrink-0",
|
|
29
|
+
dragHandle: "h-1 w-8 rounded-full bg-clr-on-bg-low",
|
|
30
|
+
backdrop: n(),
|
|
31
|
+
scrollArea: "scroll-area relative"
|
|
32
|
+
},
|
|
33
|
+
variants: { disableHorizontalPadding: {
|
|
34
|
+
false: { scrollArea: "px-4" },
|
|
35
|
+
true: ""
|
|
36
|
+
} }
|
|
37
|
+
}), g = ({ children: e, isOpen: n, onClose: i, onBack: o, zIndex: c = 9999, ref: d }) => {
|
|
38
|
+
let g = p(), { root: _, container: v, dragHandleContainer: y, dragHandle: b, content: x, contentWrapper: S, backdrop: C } = h(), { isShown: w, scrollRef: T, scrollPosition: E } = a({ isOpen: n }), D = E === "middle" || E === "bottom", { innerOpen: O } = t(w), k = s();
|
|
39
|
+
return /* @__PURE__ */ u(m, {
|
|
40
|
+
isOpen: O,
|
|
41
|
+
onClose: i,
|
|
42
|
+
className: _(),
|
|
43
|
+
detent: "content",
|
|
44
|
+
"data-bpds": "bottom-sheet",
|
|
45
|
+
prefersReducedMotion: g,
|
|
46
|
+
style: {
|
|
47
|
+
"--touch-action": D ? "initial" : "pan-down",
|
|
48
|
+
pointerEvents: void 0,
|
|
49
|
+
visibility: O ? "visible" : "hidden",
|
|
50
|
+
zIndex: c
|
|
51
|
+
},
|
|
52
|
+
role: "dialog",
|
|
53
|
+
avoidKeyboard: !1,
|
|
54
|
+
"aria-labelledby": k,
|
|
55
|
+
children: [/* @__PURE__ */ u(m.Container, {
|
|
56
|
+
className: v(),
|
|
57
|
+
ref: d,
|
|
58
|
+
style: { pointerEvents: void 0 },
|
|
59
|
+
children: [/* @__PURE__ */ l(m.Header, {
|
|
60
|
+
unstyled: !0,
|
|
61
|
+
className: y(),
|
|
62
|
+
children: /* @__PURE__ */ l(m.DragIndicator, {
|
|
63
|
+
unstyled: !0,
|
|
64
|
+
className: b()
|
|
65
|
+
})
|
|
66
|
+
}), /* @__PURE__ */ l(f.Provider, {
|
|
67
|
+
value: c,
|
|
68
|
+
children: /* @__PURE__ */ l(r.Provider, {
|
|
69
|
+
value: {
|
|
70
|
+
scrollRef: T,
|
|
71
|
+
scrollPosition: E,
|
|
72
|
+
onClose: i,
|
|
73
|
+
onBack: o,
|
|
74
|
+
titleId: k
|
|
75
|
+
},
|
|
76
|
+
children: /* @__PURE__ */ l(m.Content, {
|
|
77
|
+
className: x(),
|
|
78
|
+
disableScroll: !0,
|
|
79
|
+
disableDrag: D,
|
|
80
|
+
style: { paddingBottom: "max(var(--keyboard-inset-height, 0rem), var(--app-safe-area-inset-bottom, 1rem))" },
|
|
81
|
+
children: /* @__PURE__ */ l("div", {
|
|
82
|
+
className: S(),
|
|
83
|
+
children: e
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
})]
|
|
88
|
+
}), /* @__PURE__ */ l(m.Backdrop, {
|
|
89
|
+
"aria-label": "Bottom Sheet schließen",
|
|
90
|
+
onTap: i,
|
|
91
|
+
className: C()
|
|
92
|
+
})]
|
|
93
|
+
});
|
|
94
|
+
}, _ = ({ children: e, subline: t, level: n = "h3" }) => {
|
|
95
|
+
let { onBack: r, onClose: a, titleId: s } = i(), { header: c, titleAndIcons: f } = h();
|
|
96
|
+
return /* @__PURE__ */ u("div", {
|
|
97
|
+
className: c(),
|
|
98
|
+
children: [/* @__PURE__ */ u("div", {
|
|
99
|
+
className: f(),
|
|
100
|
+
children: [
|
|
101
|
+
r && /* @__PURE__ */ l(o, {
|
|
102
|
+
onClick: r,
|
|
103
|
+
icon: "arrow-left",
|
|
104
|
+
label: "Zurück",
|
|
105
|
+
variant: "tertiary",
|
|
106
|
+
size: "small"
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ l(d, {
|
|
109
|
+
variant: "bonprix-h6",
|
|
110
|
+
component: n,
|
|
111
|
+
className: "grow line-clamp-2",
|
|
112
|
+
id: s,
|
|
113
|
+
children: e
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ l(o, {
|
|
116
|
+
onClick: a,
|
|
117
|
+
icon: "closer",
|
|
118
|
+
label: "Schließen",
|
|
119
|
+
variant: "tertiary",
|
|
120
|
+
size: "small"
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
}), t && /* @__PURE__ */ l(d, { children: t })]
|
|
124
|
+
});
|
|
125
|
+
}, v = ({ children: e, disableHorizontalPadding: t = !1 }) => {
|
|
126
|
+
let { scrollRef: n } = i(), { scrollArea: r } = h({ disableHorizontalPadding: t });
|
|
127
|
+
return /* @__PURE__ */ l("div", {
|
|
128
|
+
ref: n,
|
|
129
|
+
className: r(),
|
|
130
|
+
"data-bpds-disable-horizontal-padding": t,
|
|
131
|
+
tabIndex: 0,
|
|
132
|
+
children: e
|
|
133
|
+
});
|
|
134
|
+
}, y = ({ children: e }) => /* @__PURE__ */ l("div", {
|
|
135
|
+
className: "button-section w-full flex flex-col gap-3 px-4 pt-4 shrink-0 touch-pan-down",
|
|
136
|
+
children: e
|
|
137
|
+
}), b = ({ children: t, icon: n, iconPosition: r, loading: a, component: o = "button", ...s }) => {
|
|
138
|
+
let c = o, { onClick: u, type: d = "button", ...f } = s, { onClose: p } = i(), m = (e) => {
|
|
139
|
+
u?.(e), p();
|
|
140
|
+
};
|
|
141
|
+
return /* @__PURE__ */ l(e, {
|
|
142
|
+
component: c,
|
|
143
|
+
...f,
|
|
144
|
+
variant: "primary",
|
|
145
|
+
onClick: m,
|
|
146
|
+
type: d,
|
|
147
|
+
icon: n,
|
|
148
|
+
iconPosition: r,
|
|
149
|
+
size: "large",
|
|
150
|
+
loading: a,
|
|
151
|
+
children: t
|
|
152
|
+
});
|
|
153
|
+
}, x = ({ children: t, icon: n, iconPosition: r, component: a = "button", ...o }) => {
|
|
154
|
+
let s = a, { onClose: c } = i();
|
|
155
|
+
return /* @__PURE__ */ l(e, {
|
|
156
|
+
component: s,
|
|
157
|
+
...o,
|
|
158
|
+
variant: "secondary",
|
|
159
|
+
type: "button",
|
|
160
|
+
onClick: c,
|
|
161
|
+
icon: n,
|
|
162
|
+
iconPosition: r,
|
|
163
|
+
size: "large",
|
|
164
|
+
children: t
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
g.displayName = "BottomSheet";
|
|
168
|
+
//#endregion
|
|
169
|
+
export { y as ButtonSection, v as Content, b as PrimaryButton, x as SecondaryButton, _ as Title, g as default };
|
|
170
|
+
|
|
171
|
+
//# sourceMappingURL=BottomSheetRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheetRoot.js","names":[],"sources":["../../../src/components/BottomSheet/BottomSheetRoot.tsx"],"sourcesContent":["\"use client\";\n\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, usePrefersReducedMotion, ZIndexContext } from \"@bonprix-ds/utils\";\nimport React, { ComponentProps, ElementType, ReactNode, RefObject, useId } from \"react\";\nimport { Sheet } from \"react-modal-sheet\";\nimport { tv } from \"tailwind-variants\";\n\nimport { Button } from \"@components/Buttons\";\nimport { useInnerOpen } from \"@hooks\";\nimport { backdrop } from \"@utils/tailwindVariants\";\n\nimport BottomSheetContext from \"./BottomSheetContext\";\nimport useConsumeBottomSheet from \"./useConsumeBottomSheet\";\nimport useCreateBottomSheet from \"./useCreateBottomSheet\";\n\nconst generateClasses = tv({\n slots: {\n root: \"preflight block\",\n container: \"shadow-none rounded-none bg-clr-bg-modal max-h-[calc(100%-4rem)]\",\n header: \"px-4 py-3\",\n titleAndIcons: \"flex gap-2 items-center touch-pan-down\",\n contentWrapper: \"flex flex-col w-full\",\n content: [\n \"typography-body1 text-clr-primary\",\n // scroller must be a flexbox to fix scrollbar\n // scroller needs some padding to not cut off the focus-ring\n \"*:flex *:-mx-0.5 *:px-0.5\",\n // scroller must set min-h-0 in order to make scrolling work inside our flex context\n \"*:min-h-0\",\n ],\n dragHandleContainer: \"h-6 flex justify-center items-center shrink-0\",\n dragHandle: \"h-1 w-8 rounded-full bg-clr-on-bg-low\",\n backdrop: backdrop(),\n scrollArea: \"scroll-area relative\",\n },\n variants: {\n disableHorizontalPadding: {\n false: { scrollArea: \"px-4\" },\n true: \"\",\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\"`. Defaults to `\"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 /** A reference to the root element of the sheet. */\n ref?: RefObject<HTMLDivElement>;\n}\n\nconst BottomSheetRoot = ({ children, isOpen, onClose, onBack, zIndex = 9999, ref }: Props) => {\n // TODO: add aria-modal = true once we implemented the dialog pattern fully and i.e. manage the focus\n const prefersReducedMotion = usePrefersReducedMotion();\n const { root, container, dragHandleContainer, dragHandle, content, contentWrapper, backdrop } = generateClasses();\n const { isShown, scrollRef, scrollPosition } = useCreateBottomSheet({ isOpen });\n\n // When \"middle\" or \"bottom\", dragging is disabled to allow for regular scrolling.\n // When at \"top\", we need to enable drag to close. When `undefined`, the element is not scrollable and can be dragged, too.\n const disableDrag = scrollPosition === \"middle\" || scrollPosition === \"bottom\";\n\n const { innerOpen } = useInnerOpen(isShown);\n\n const titleId = useId();\n\n return (\n <Sheet\n isOpen={innerOpen}\n onClose={onClose}\n className={root()}\n detent=\"content\"\n data-bpds=\"bottom-sheet\"\n prefersReducedMotion={prefersReducedMotion}\n style={{\n // @ts-expect-error setting custom properties is not recognized by React.CSSProperties\n // This is consumed by the inner ScrollArea to fix drag to close.\n \"--touch-action\": disableDrag ? \"initial\" : \"pan-down\",\n // We remove `pointer-events` handling from the library because it interfers with a lot of things like opened Selects that wouldn't close etc.\n pointerEvents: undefined,\n // When removing react-modal-sheet's pointerEvents handling, we need to adjust visibility because we can no longer rely on `pointer-events: none` being set on the wrapper that spans the whole page even when closed.\n visibility: innerOpen ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n }}\n role=\"dialog\"\n avoidKeyboard={false}\n aria-labelledby={titleId}\n >\n {/* We remove `pointer-events` handling from the library because it interfers with a lot of things like opened Selects that wouldn't close etc. */}\n <Sheet.Container className={container()} ref={ref} style={{ pointerEvents: undefined }}>\n <Sheet.Header unstyled className={dragHandleContainer()}>\n <Sheet.DragIndicator unstyled className={dragHandle()} />\n </Sheet.Header>\n <ZIndexContext.Provider value={zIndex}>\n <BottomSheetContext.Provider value={{ scrollRef, scrollPosition, onClose, onBack, titleId }}>\n <Sheet.Content\n className={content()}\n // disable default scrolling\n disableScroll\n // Dragging is still managed by `Sheet.Content` so we control it here\n disableDrag={disableDrag}\n // Apply keyboard height as padding bottom to keep content above the keyboard\n style={{ paddingBottom: \"max(var(--keyboard-inset-height, 0rem), var(--app-safe-area-inset-bottom, 1rem))\" }}\n >\n <div className={contentWrapper()}>{children}</div>\n </Sheet.Content>\n </BottomSheetContext.Provider>\n </ZIndexContext.Provider>\n </Sheet.Container>\n {/* TODO: Deactivate the animation, when the user prefers reduced motion: https://github.com/Temzasse/react-modal-sheet/issues/227 */}\n <Sheet.Backdrop aria-label=\"Bottom Sheet schließen\" onTap={onClose} className={backdrop()} />\n </Sheet>\n );\n};\n\nexport default BottomSheetRoot;\n\nexport const Title = ({ children, subline, level = \"h3\" }: SheetTitleProps) => {\n const { onBack, onClose, titleId } = useConsumeBottomSheet();\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 <Typography variant=\"bonprix-h6\" component={level} className=\"grow line-clamp-2\" id={titleId}>\n {children}\n </Typography>\n <IconButton onClick={onClose} icon=\"closer\" label=\"Schließen\" variant=\"tertiary\" size=\"small\" />\n </div>\n {subline && <Typography>{subline}</Typography>}\n </div>\n );\n};\n\nexport const Content = ({ children, disableHorizontalPadding = false }: SheetContentProps) => {\n const { scrollRef: setScrollRef } = useConsumeBottomSheet();\n const { scrollArea } = generateClasses({ disableHorizontalPadding });\n return (\n <div ref={setScrollRef} className={scrollArea()} data-bpds-disable-horizontal-padding={disableHorizontalPadding} tabIndex={0}>\n {children}\n </div>\n );\n};\n\nexport const ButtonSection = ({ children }: SheetButtonSectionProps) => {\n return <div className=\"button-section w-full flex flex-col gap-3 px-4 pt-4 shrink-0 touch-pan-down\">{children}</div>;\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 Component: ElementType = component;\n const { onClick, type = \"button\", ...otherProps } = props;\n const { onClose } = useConsumeBottomSheet();\n const handleClick = (event: React.MouseEvent) => {\n // eslint-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 type={type}\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 } = useConsumeBottomSheet();\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\nBottomSheetRoot.displayName = \"BottomSheet\";\n"],"mappings":"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"}
|
|
@@ -1,100 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import e from "./CarouselRoot.js";
|
|
2
|
+
import t from "./CarouselSlide.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import {
|
|
5
|
-
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
-
import { Splide as i, SplideSlide as a, SplideTrack as o } from "@splidejs/react-splide";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
7
5
|
//#region src/components/Carousel/Carousel.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
root: "",
|
|
11
|
-
buttons: "",
|
|
12
|
-
paginationClass: "splide__pagination flex gap-1 absolute start-0 end-0 bottom-2 px-4 py-0 z-1",
|
|
13
|
-
page: [
|
|
14
|
-
"splide__pagination__page block p-0 relative bg-clr-on-bg-low w-3 h-0.25 m-0 opacity-100 border-none rounded-none transform-none transition-all",
|
|
15
|
-
"[&.is-active]:bg-clr-black [&.is-active]:h-1",
|
|
16
|
-
"after:content-[''] after:absolute after:start-0 after:-mt-1 after:h-2 after:w-3 after:cursor-pointer [&.is-active]:after:content-[]"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
variants: { showArrows: {
|
|
20
|
-
always: "",
|
|
21
|
-
hover: {
|
|
22
|
-
root: "group/crsl",
|
|
23
|
-
buttons: "hidden group-hover/crsl:flex"
|
|
24
|
-
},
|
|
25
|
-
never: ""
|
|
26
|
-
} }
|
|
27
|
-
}), c = ({ children: t, label: a, perPage: c = 1, perMove: l = 1, rewind: u = !1, buttonsContrast: d = !1, invertButtons: f = !1, focus: p, gap: m = 20, showArrows: h = "always", pagination: g = !0, onMove: _, padding: v, disableHorizontalPadding: y = !1, start: b = 0, disableDrag: x = !1, paginationRef: S }) => {
|
|
28
|
-
let { root: C, buttons: w, paginationClass: T, page: E } = s({ showArrows: h }), D = {
|
|
29
|
-
perPage: c,
|
|
30
|
-
perMove: l,
|
|
31
|
-
type: u ? "loop" : "slide",
|
|
32
|
-
focus: p,
|
|
33
|
-
gap: m,
|
|
34
|
-
arrows: h !== "never",
|
|
35
|
-
pagination: g,
|
|
36
|
-
padding: v,
|
|
37
|
-
start: b,
|
|
38
|
-
lazyLoad: "nearby",
|
|
39
|
-
classes: { page: E() },
|
|
40
|
-
i18n: {
|
|
41
|
-
prev: "vorherige Ansicht",
|
|
42
|
-
next: "nächste Ansicht",
|
|
43
|
-
first: "erste Ansicht",
|
|
44
|
-
last: "letzte Ansicht",
|
|
45
|
-
slideX: "gehe zu Ansicht %s",
|
|
46
|
-
pageX: "gehe zu Seite %s",
|
|
47
|
-
play: "starte Wiedergabe",
|
|
48
|
-
pause: "pausiere Wiedergabe",
|
|
49
|
-
carousel: "carousel",
|
|
50
|
-
select: "wähle eine Ansicht aus",
|
|
51
|
-
slide: "slide",
|
|
52
|
-
slideLabel: "%s von %s"
|
|
53
|
-
},
|
|
54
|
-
drag: !x
|
|
55
|
-
};
|
|
56
|
-
return /* @__PURE__ */ r(i, {
|
|
57
|
-
"aria-label": a,
|
|
58
|
-
options: D,
|
|
59
|
-
hasTrack: !1,
|
|
60
|
-
onMove: (e, t, n) => _?.(t, n),
|
|
61
|
-
"data-bpds": "carousel",
|
|
62
|
-
"data-bpds-per-page": c,
|
|
63
|
-
"data-bpds-per-move": l,
|
|
64
|
-
"data-bpds-rewind": u,
|
|
65
|
-
"data-bpds-buttons-contrast": d,
|
|
66
|
-
"data-bpds-invert-buttons": f,
|
|
67
|
-
"data-bpds-disable-horizontal-padding": y,
|
|
68
|
-
"data-bpds-gap": m,
|
|
69
|
-
"data-bpds-padding": v,
|
|
70
|
-
"data-bpds-pagination": g,
|
|
71
|
-
"data-bpds-show-arrows": h,
|
|
72
|
-
className: C(),
|
|
73
|
-
children: [
|
|
74
|
-
/* @__PURE__ */ r("div", {
|
|
75
|
-
className: `splide__arrows ${w()}`,
|
|
76
|
-
children: [/* @__PURE__ */ n(e, {
|
|
77
|
-
invertButtons: f,
|
|
78
|
-
position: "left",
|
|
79
|
-
buttonsContrast: d,
|
|
80
|
-
disableHorizontalPadding: y
|
|
81
|
-
}), /* @__PURE__ */ n(e, {
|
|
82
|
-
invertButtons: f,
|
|
83
|
-
position: "right",
|
|
84
|
-
buttonsContrast: d,
|
|
85
|
-
disableHorizontalPadding: y
|
|
86
|
-
})]
|
|
87
|
-
}),
|
|
88
|
-
/* @__PURE__ */ n(o, { children: t }),
|
|
89
|
-
/* @__PURE__ */ n("ul", {
|
|
90
|
-
className: T(),
|
|
91
|
-
ref: S
|
|
92
|
-
})
|
|
93
|
-
]
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
c.displayName = "Carousel", c.Slide = a, a.displayName = "Carousel.Slide";
|
|
6
|
+
var r = (t) => /* @__PURE__ */ n(e, { ...t });
|
|
7
|
+
r.displayName = "Carousel", r.Slide = t;
|
|
97
8
|
//#endregion
|
|
98
|
-
export {
|
|
9
|
+
export { r as default };
|
|
99
10
|
|
|
100
11
|
//# sourceMappingURL=Carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.js","names":[],"sources":["../../../src/components/Carousel/Carousel.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Carousel.js","names":[],"sources":["../../../src/components/Carousel/Carousel.tsx"],"sourcesContent":["import React from \"react\";\n\nimport CarouselRoot, { type Props } from \"./CarouselRoot\";\nimport CarouselSlide from \"./CarouselSlide\";\n\nexport type { Props } from \"./CarouselRoot\";\n\nconst Carousel = (props: Props) => <CarouselRoot {...props} />;\n\nCarousel.displayName = \"Carousel\";\n\nCarousel.Slide = CarouselSlide;\n\nexport default Carousel;\n"],"mappings":";;;;;AAOA,IAAM,KAAY,MAAiB,kBAAC,GAAD,EAAc,GAAI,EAAQ,CAAA;AAE7D,EAAS,cAAc,YAEvB,EAAS,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselArrow.js","names":[],"sources":["../../../src/components/Carousel/CarouselArrow.tsx"],"sourcesContent":["import { BaseButton } from \"@bonprix-ds/internal-components\";\nimport React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nconst generateClasses = tv({\n slots: {\n wrapper: \"z-[1] absolute top-1/2 transform -translate-y-1/2\",\n button: \"disabled:hidden\",\n },\n variants: {\n position: {\n left: {\n wrapper: \"start-3\",\n button: \"splide__arrow--prev\",\n },\n right: {\n wrapper: \"end-3\",\n button: \"splide__arrow--next\",\n },\n },\n disableHorizontalPadding: {\n true: \"\",\n false: \"\",\n },\n },\n compoundVariants: [\n {\n disableHorizontalPadding: true,\n position: \"left\",\n class: {\n wrapper: \"start-0\",\n },\n },\n {\n disableHorizontalPadding: true,\n position: \"right\",\n class: {\n wrapper: \"end-0\",\n },\n },\n ],\n});\n\ninterface Props {\n position: \"left\" | \"right\";\n buttonsContrast: boolean;\n invertButtons: boolean;\n disableHorizontalPadding: boolean;\n}\n\nconst CarouselArrow
|
|
1
|
+
{"version":3,"file":"CarouselArrow.js","names":[],"sources":["../../../src/components/Carousel/CarouselArrow.tsx"],"sourcesContent":["import { BaseButton } from \"@bonprix-ds/internal-components\";\nimport React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nconst generateClasses = tv({\n slots: {\n wrapper: \"z-[1] absolute top-1/2 transform -translate-y-1/2\",\n button: \"disabled:hidden\",\n },\n variants: {\n position: {\n left: {\n wrapper: \"start-3\",\n button: \"splide__arrow--prev\",\n },\n right: {\n wrapper: \"end-3\",\n button: \"splide__arrow--next\",\n },\n },\n disableHorizontalPadding: {\n true: \"\",\n false: \"\",\n },\n },\n compoundVariants: [\n {\n disableHorizontalPadding: true,\n position: \"left\",\n class: {\n wrapper: \"start-0\",\n },\n },\n {\n disableHorizontalPadding: true,\n position: \"right\",\n class: {\n wrapper: \"end-0\",\n },\n },\n ],\n});\n\ninterface Props {\n position: \"left\" | \"right\";\n buttonsContrast: boolean;\n invertButtons: boolean;\n disableHorizontalPadding: boolean;\n}\n\nconst CarouselArrow = ({ position, buttonsContrast, invertButtons, disableHorizontalPadding }: Props) => {\n const isLeftArrow = position === \"left\" ? true : false;\n const icon = isLeftArrow ? \"arrow-left\" : \"arrow-right\";\n const label = isLeftArrow ? \"Previous Page\" : \"Next Page\";\n const variant = buttonsContrast ? \"primary\" : \"tertiary\";\n const { wrapper, button } = generateClasses({ position, disableHorizontalPadding });\n\n return (\n <span className={wrapper()}>\n <BaseButton type=\"button\" className={button()} variant={variant} icon={icon} componentName=\"icon-button\" inverted={invertButtons}>\n {label}\n </BaseButton>\n </span>\n );\n};\n\nexport default CarouselArrow;\n"],"mappings":";;;;;AAIA,IAAM,IAAkB,EAAG;CACzB,OAAO;EACL,SAAS;EACT,QAAQ;CACV;CACA,UAAU;EACR,UAAU;GACR,MAAM;IACJ,SAAS;IACT,QAAQ;GACV;GACA,OAAO;IACL,SAAS;IACT,QAAQ;GACV;EACF;EACA,0BAA0B;GACxB,MAAM;GACN,OAAO;EACT;CACF;CACA,kBAAkB,CAChB;EACE,0BAA0B;EAC1B,UAAU;EACV,OAAO,EACL,SAAS,UACX;CACF,GACA;EACE,0BAA0B;EAC1B,UAAU;EACV,OAAO,EACL,SAAS,QACX;CACF,CACF;AACF,CAAC,GASK,KAAiB,EAAE,aAAU,oBAAiB,kBAAe,kCAAsC;CACvG,IAAM,IAAc,MAAa,QAC3B,IAAO,IAAc,eAAe,eACpC,IAAQ,IAAc,kBAAkB,aACxC,IAAU,IAAkB,YAAY,YACxC,EAAE,YAAS,cAAW,EAAgB;EAAE;EAAU;CAAyB,CAAC;CAElF,OACE,kBAAC,QAAD;EAAM,WAAW,EAAQ;EACvB,UAAA,kBAAC,GAAD;GAAY,MAAK;GAAS,WAAW,EAAO;GAAY;GAAe;GAAM,eAAc;GAAc,UAAU;GAChH,UAAA;EACS,CAAA;CACR,CAAA;AAEV"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "./CarouselArrow.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { tv as t } from "tailwind-variants";
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { Splide as i, SplideTrack as a } from "@splidejs/react-splide";
|
|
7
|
+
//#region src/components/Carousel/CarouselRoot.tsx
|
|
8
|
+
var o = t({
|
|
9
|
+
slots: {
|
|
10
|
+
root: "",
|
|
11
|
+
buttons: "",
|
|
12
|
+
paginationClass: "splide__pagination flex gap-1 absolute start-0 end-0 bottom-2 px-4 py-0 z-1",
|
|
13
|
+
page: [
|
|
14
|
+
"splide__pagination__page block p-0 relative bg-clr-on-bg-low w-3 h-0.25 m-0 opacity-100 border-none rounded-none transform-none transition-all",
|
|
15
|
+
"[&.is-active]:bg-clr-black [&.is-active]:h-1",
|
|
16
|
+
"after:content-[''] after:absolute after:start-0 after:-mt-1 after:h-2 after:w-3 after:cursor-pointer [&.is-active]:after:content-[]"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
variants: { showArrows: {
|
|
20
|
+
always: "",
|
|
21
|
+
hover: {
|
|
22
|
+
root: "group/crsl",
|
|
23
|
+
buttons: "hidden group-hover/crsl:flex"
|
|
24
|
+
},
|
|
25
|
+
never: ""
|
|
26
|
+
} }
|
|
27
|
+
}), s = ({ children: t, label: s, perPage: c = 1, perMove: l = 1, rewind: u = !1, buttonsContrast: d = !1, invertButtons: f = !1, focus: p, gap: m = 20, showArrows: h = "always", pagination: g = !0, onMove: _, padding: v, disableHorizontalPadding: y = !1, start: b = 0, disableDrag: x = !1, paginationRef: S }) => {
|
|
28
|
+
let { root: C, buttons: w, paginationClass: T, page: E } = o({ showArrows: h }), D = {
|
|
29
|
+
perPage: c,
|
|
30
|
+
perMove: l,
|
|
31
|
+
type: u ? "loop" : "slide",
|
|
32
|
+
focus: p,
|
|
33
|
+
gap: m,
|
|
34
|
+
arrows: h !== "never",
|
|
35
|
+
pagination: g,
|
|
36
|
+
padding: v,
|
|
37
|
+
start: b,
|
|
38
|
+
lazyLoad: "nearby",
|
|
39
|
+
classes: { page: E() },
|
|
40
|
+
i18n: {
|
|
41
|
+
prev: "vorherige Ansicht",
|
|
42
|
+
next: "nächste Ansicht",
|
|
43
|
+
first: "erste Ansicht",
|
|
44
|
+
last: "letzte Ansicht",
|
|
45
|
+
slideX: "gehe zu Ansicht %s",
|
|
46
|
+
pageX: "gehe zu Seite %s",
|
|
47
|
+
play: "starte Wiedergabe",
|
|
48
|
+
pause: "pausiere Wiedergabe",
|
|
49
|
+
carousel: "carousel",
|
|
50
|
+
select: "wähle eine Ansicht aus",
|
|
51
|
+
slide: "slide",
|
|
52
|
+
slideLabel: "%s von %s"
|
|
53
|
+
},
|
|
54
|
+
drag: !x
|
|
55
|
+
};
|
|
56
|
+
return /* @__PURE__ */ r(i, {
|
|
57
|
+
"aria-label": s,
|
|
58
|
+
options: D,
|
|
59
|
+
hasTrack: !1,
|
|
60
|
+
onMove: (e, t, n) => _?.(t, n),
|
|
61
|
+
"data-bpds": "carousel",
|
|
62
|
+
"data-bpds-per-page": c,
|
|
63
|
+
"data-bpds-per-move": l,
|
|
64
|
+
"data-bpds-rewind": u,
|
|
65
|
+
"data-bpds-buttons-contrast": d,
|
|
66
|
+
"data-bpds-invert-buttons": f,
|
|
67
|
+
"data-bpds-disable-horizontal-padding": y,
|
|
68
|
+
"data-bpds-gap": m,
|
|
69
|
+
"data-bpds-padding": v,
|
|
70
|
+
"data-bpds-pagination": g,
|
|
71
|
+
"data-bpds-show-arrows": h,
|
|
72
|
+
className: C(),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ r("div", {
|
|
75
|
+
className: `splide__arrows ${w()}`,
|
|
76
|
+
children: [/* @__PURE__ */ n(e, {
|
|
77
|
+
invertButtons: f,
|
|
78
|
+
position: "left",
|
|
79
|
+
buttonsContrast: d,
|
|
80
|
+
disableHorizontalPadding: y
|
|
81
|
+
}), /* @__PURE__ */ n(e, {
|
|
82
|
+
invertButtons: f,
|
|
83
|
+
position: "right",
|
|
84
|
+
buttonsContrast: d,
|
|
85
|
+
disableHorizontalPadding: y
|
|
86
|
+
})]
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ n(a, { children: t }),
|
|
89
|
+
/* @__PURE__ */ n("ul", {
|
|
90
|
+
className: T(),
|
|
91
|
+
ref: S
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
s.displayName = "Carousel";
|
|
97
|
+
//#endregion
|
|
98
|
+
export { s as default };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=CarouselRoot.js.map
|