@react-cupertino-ui/bottom-sheet 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/dist/index.css +105 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +122 -0
- package/dist/index.scss +99 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Anderson Lima
|
|
4
|
+
|
|
5
|
+
This project is inspired by Apple's design principles but is not affiliated with, endorsed, or sponsored by Apple Inc.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.react-cupertino-ui-bottom-sheet__overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
background: color-mix(in srgb, rgba(6, 8, 12, 0.65), transparent 20%);
|
|
5
|
+
backdrop-filter: blur(24px) saturate(140%);
|
|
6
|
+
-webkit-backdrop-filter: blur(24px) saturate(140%);
|
|
7
|
+
animation: bottom-sheet-overlay-fade 200ms ease forwards;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.react-cupertino-ui-bottom-sheet__content {
|
|
11
|
+
position: fixed;
|
|
12
|
+
left: 0;
|
|
13
|
+
right: 0;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
margin: 0 auto;
|
|
16
|
+
width: min(640px, 100%);
|
|
17
|
+
border-radius: 32px 32px 0 0;
|
|
18
|
+
padding: 1.5rem clamp(1.25rem, 4vw, 2rem) 2rem;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 1rem;
|
|
22
|
+
color: inherit;
|
|
23
|
+
background: rgba(255, 255, 255, 0.92);
|
|
24
|
+
box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12), 0 -24px 60px rgba(0, 0, 0, 0.18);
|
|
25
|
+
height: calc(var(--bottom-sheet-height, 0.6) * 100vh);
|
|
26
|
+
max-height: calc(100vh - 1rem);
|
|
27
|
+
transform: translate3d(0, calc(var(--bottom-sheet-offset, 0) * 100vh), 0);
|
|
28
|
+
transition: height 380ms cubic-bezier(0.2, 0.8, 0.4, 1), transform 260ms cubic-bezier(0.2, 0.8, 0.4, 1), box-shadow 260ms ease, background 260ms ease;
|
|
29
|
+
outline: none;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
.react-cupertino-ui-bottom-sheet__content.glass {
|
|
33
|
+
background: rgba(255, 255, 255, var(--glass-opacity, 0.7));
|
|
34
|
+
backdrop-filter: blur(var(--glass-blur, 46px)) saturate(var(--glass-saturation, 180%));
|
|
35
|
+
-webkit-backdrop-filter: blur(var(--glass-blur, 46px)) saturate(var(--glass-saturation, 180%));
|
|
36
|
+
border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.18));
|
|
37
|
+
box-shadow: var(--glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.12));
|
|
38
|
+
position: relative;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
}
|
|
41
|
+
.react-cupertino-ui-bottom-sheet__content.glass::before {
|
|
42
|
+
content: "";
|
|
43
|
+
position: absolute;
|
|
44
|
+
inset: 0;
|
|
45
|
+
background: var(--glass-highlight, linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, transparent 55%));
|
|
46
|
+
border-radius: inherit;
|
|
47
|
+
opacity: var(--glass-highlight-opacity, 0.95);
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
mix-blend-mode: screen;
|
|
50
|
+
}
|
|
51
|
+
.react-cupertino-ui-bottom-sheet__content.is-dragging {
|
|
52
|
+
transition: none;
|
|
53
|
+
cursor: grabbing;
|
|
54
|
+
}
|
|
55
|
+
@media (prefers-reduced-motion: reduce) {
|
|
56
|
+
.react-cupertino-ui-bottom-sheet__content {
|
|
57
|
+
transition: none;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.react-cupertino-ui-bottom-sheet__handle {
|
|
62
|
+
width: 72px;
|
|
63
|
+
height: 6px;
|
|
64
|
+
border-radius: 999px;
|
|
65
|
+
border: none;
|
|
66
|
+
background: color-mix(in srgb, rgba(15, 15, 15, 0.35), rgba(255, 255, 255, 0.6));
|
|
67
|
+
margin: 0 auto 0.5rem;
|
|
68
|
+
cursor: grab;
|
|
69
|
+
position: relative;
|
|
70
|
+
isolation: isolate;
|
|
71
|
+
}
|
|
72
|
+
.react-cupertino-ui-bottom-sheet__handle:focus-visible {
|
|
73
|
+
outline: none;
|
|
74
|
+
box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.35);
|
|
75
|
+
}
|
|
76
|
+
.react-cupertino-ui-bottom-sheet__handle:active {
|
|
77
|
+
cursor: grabbing;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.react-cupertino-ui-bottom-sheet__body {
|
|
81
|
+
flex: 1;
|
|
82
|
+
overflow-y: auto;
|
|
83
|
+
padding-bottom: 1rem;
|
|
84
|
+
mask-image: linear-gradient(180deg, transparent, #000 10%);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.react-cupertino-ui-bottom-sheet__title {
|
|
88
|
+
font-size: 1.1rem;
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
margin-bottom: 0.35rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.react-cupertino-ui-bottom-sheet__description {
|
|
94
|
+
font-size: 0.95rem;
|
|
95
|
+
color: color-mix(in srgb, currentColor, transparent 30%);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes bottom-sheet-overlay-fade {
|
|
99
|
+
from {
|
|
100
|
+
opacity: 0;
|
|
101
|
+
}
|
|
102
|
+
to {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
export declare const BottomSheetTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare const BottomSheetClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export declare const BottomSheetPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
7
|
+
export declare const BottomSheet: ({ children, open, defaultOpen, onOpenChange, ...props }: DialogPrimitive.DialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const BottomSheetOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
interface BottomSheetContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
|
|
10
|
+
snapPoints?: number[];
|
|
11
|
+
initialSnap?: number;
|
|
12
|
+
handle?: boolean;
|
|
13
|
+
glass?: boolean;
|
|
14
|
+
onSnapChange?: (value: number, index: number) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const BottomSheetContent: React.ForwardRefExoticComponent<BottomSheetContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const BottomSheetTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
18
|
+
declare const BottomSheetDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
19
|
+
export { BottomSheetOverlay, BottomSheetContent, BottomSheetTitle, BottomSheetDescription, };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { cn } from "@react-cupertino-ui/shared/lib/utils";
|
|
5
|
+
import "./index.scss";
|
|
6
|
+
const DEFAULT_SNAP_POINTS = [0.25, 0.5, 0.9];
|
|
7
|
+
const BottomSheetContext = React.createContext(null);
|
|
8
|
+
export const BottomSheetTrigger = DialogPrimitive.Trigger;
|
|
9
|
+
export const BottomSheetClose = DialogPrimitive.Close;
|
|
10
|
+
export const BottomSheetPortal = DialogPrimitive.Portal;
|
|
11
|
+
export const BottomSheet = ({ children, open, defaultOpen, onOpenChange, ...props }) => {
|
|
12
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false);
|
|
13
|
+
const isControlled = open !== undefined;
|
|
14
|
+
const currentOpen = isControlled ? open : internalOpen;
|
|
15
|
+
const handleOpenChange = React.useCallback((next) => {
|
|
16
|
+
if (!isControlled) {
|
|
17
|
+
setInternalOpen(next);
|
|
18
|
+
}
|
|
19
|
+
onOpenChange?.(next);
|
|
20
|
+
}, [isControlled, onOpenChange]);
|
|
21
|
+
const requestClose = React.useCallback(() => handleOpenChange(false), [handleOpenChange]);
|
|
22
|
+
const contextValue = React.useMemo(() => ({ requestClose }), [requestClose]);
|
|
23
|
+
return (_jsx(DialogPrimitive.Root, { open: currentOpen, onOpenChange: handleOpenChange, ...props, children: _jsx(BottomSheetContext.Provider, { value: contextValue, children: children }) }));
|
|
24
|
+
};
|
|
25
|
+
const BottomSheetOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn("react-cupertino-ui-bottom-sheet__overlay", className), ...props })));
|
|
26
|
+
BottomSheetOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
27
|
+
const clampRatio = (value) => Math.min(1, Math.max(0, value));
|
|
28
|
+
const useBottomSheetContext = () => React.useContext(BottomSheetContext);
|
|
29
|
+
const BottomSheetContent = React.forwardRef(({ className, children, snapPoints, initialSnap, handle = true, glass = true, onSnapChange, ...props }, ref) => {
|
|
30
|
+
const context = useBottomSheetContext();
|
|
31
|
+
const sanitizedSnapPoints = React.useMemo(() => {
|
|
32
|
+
const points = (snapPoints && snapPoints.length ? snapPoints : DEFAULT_SNAP_POINTS)
|
|
33
|
+
.map((point) => clampRatio(point))
|
|
34
|
+
.filter((point) => point > 0)
|
|
35
|
+
.sort((a, b) => a - b);
|
|
36
|
+
return points.length ? points : DEFAULT_SNAP_POINTS;
|
|
37
|
+
}, [snapPoints]);
|
|
38
|
+
const getNearestSnapIndex = React.useCallback((value) => {
|
|
39
|
+
let nearestIndex = 0;
|
|
40
|
+
sanitizedSnapPoints.forEach((point, index) => {
|
|
41
|
+
const currentDiff = Math.abs(point - value);
|
|
42
|
+
const bestDiff = Math.abs(sanitizedSnapPoints[nearestIndex] - value);
|
|
43
|
+
if (currentDiff < bestDiff) {
|
|
44
|
+
nearestIndex = index;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return nearestIndex;
|
|
48
|
+
}, [sanitizedSnapPoints]);
|
|
49
|
+
const initialIndex = React.useMemo(() => {
|
|
50
|
+
if (typeof initialSnap === "number") {
|
|
51
|
+
return getNearestSnapIndex(clampRatio(initialSnap));
|
|
52
|
+
}
|
|
53
|
+
return sanitizedSnapPoints.length - 1;
|
|
54
|
+
}, [getNearestSnapIndex, initialSnap, sanitizedSnapPoints.length]);
|
|
55
|
+
const [currentSnapIndex, setCurrentSnapIndex] = React.useState(initialIndex);
|
|
56
|
+
const [dragOffset, setDragOffset] = React.useState(0);
|
|
57
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
setCurrentSnapIndex(initialIndex);
|
|
60
|
+
}, [initialIndex]);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const value = sanitizedSnapPoints[currentSnapIndex];
|
|
63
|
+
if (typeof value === "number") {
|
|
64
|
+
onSnapChange?.(value, currentSnapIndex);
|
|
65
|
+
}
|
|
66
|
+
}, [currentSnapIndex, onSnapChange, sanitizedSnapPoints]);
|
|
67
|
+
const handlePointerDown = React.useCallback((event) => {
|
|
68
|
+
if (event.button && event.button !== 0) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
const startY = event.clientY;
|
|
73
|
+
const baseSnap = sanitizedSnapPoints[currentSnapIndex] ?? sanitizedSnapPoints[0];
|
|
74
|
+
setIsDragging(true);
|
|
75
|
+
const handleMove = (moveEvent) => {
|
|
76
|
+
const delta = moveEvent.clientY - startY;
|
|
77
|
+
const viewportHeight = window.innerHeight || document.documentElement.clientHeight || 1;
|
|
78
|
+
setDragOffset(delta / viewportHeight);
|
|
79
|
+
};
|
|
80
|
+
const cleanup = () => {
|
|
81
|
+
setIsDragging(false);
|
|
82
|
+
setDragOffset(0);
|
|
83
|
+
window.removeEventListener("pointermove", handleMove);
|
|
84
|
+
window.removeEventListener("pointerup", handleUp);
|
|
85
|
+
window.removeEventListener("pointercancel", handleUp);
|
|
86
|
+
};
|
|
87
|
+
const handleUp = (upEvent) => {
|
|
88
|
+
const delta = upEvent.clientY - startY;
|
|
89
|
+
const viewportHeight = window.innerHeight || document.documentElement.clientHeight || 1;
|
|
90
|
+
const offset = delta / viewportHeight;
|
|
91
|
+
finishDrag(baseSnap, offset);
|
|
92
|
+
cleanup();
|
|
93
|
+
};
|
|
94
|
+
const finishDrag = (startSnap, offsetRatio) => {
|
|
95
|
+
const smallestSnap = sanitizedSnapPoints[0] ?? 0.25;
|
|
96
|
+
const nextRatio = clampRatio(startSnap - offsetRatio);
|
|
97
|
+
if (nextRatio <= smallestSnap * 0.5) {
|
|
98
|
+
context?.requestClose?.();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const targetIndex = getNearestSnapIndex(nextRatio);
|
|
102
|
+
setCurrentSnapIndex(targetIndex);
|
|
103
|
+
};
|
|
104
|
+
window.addEventListener("pointermove", handleMove);
|
|
105
|
+
window.addEventListener("pointerup", handleUp);
|
|
106
|
+
window.addEventListener("pointercancel", handleUp);
|
|
107
|
+
}, [context, currentSnapIndex, getNearestSnapIndex, sanitizedSnapPoints]);
|
|
108
|
+
const resolvedSnap = sanitizedSnapPoints[currentSnapIndex] ?? sanitizedSnapPoints[0];
|
|
109
|
+
const heightRatio = clampRatio(resolvedSnap - dragOffset);
|
|
110
|
+
const downwardDrag = dragOffset > 0 ? Math.min(dragOffset, 1) : 0;
|
|
111
|
+
const style = {
|
|
112
|
+
"--bottom-sheet-height": heightRatio.toString(),
|
|
113
|
+
"--bottom-sheet-offset": downwardDrag.toString(),
|
|
114
|
+
};
|
|
115
|
+
return (_jsxs(BottomSheetPortal, { forceMount: true, children: [_jsx(BottomSheetOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn("react-cupertino-ui-bottom-sheet__content", glass && "glass", isDragging && "is-dragging", className), "data-dragging": isDragging ? "true" : undefined, "data-snap-index": currentSnapIndex, style: style, ...props, children: [handle && (_jsx("button", { type: "button", className: "react-cupertino-ui-bottom-sheet__handle", "aria-label": "Ajustar painel", onPointerDown: handlePointerDown })), _jsx("div", { className: "react-cupertino-ui-bottom-sheet__body", onPointerDown: handle ? undefined : handlePointerDown, children: children })] })] }));
|
|
116
|
+
});
|
|
117
|
+
BottomSheetContent.displayName = DialogPrimitive.Content.displayName;
|
|
118
|
+
const BottomSheetTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn("react-cupertino-ui-bottom-sheet__title", className), ...props })));
|
|
119
|
+
BottomSheetTitle.displayName = DialogPrimitive.Title.displayName;
|
|
120
|
+
const BottomSheetDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn("react-cupertino-ui-bottom-sheet__description", className), ...props })));
|
|
121
|
+
BottomSheetDescription.displayName = DialogPrimitive.Description.displayName;
|
|
122
|
+
export { BottomSheetOverlay, BottomSheetContent, BottomSheetTitle, BottomSheetDescription, };
|
package/dist/index.scss
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
@use "@/styles/mixins/glass" as glass;
|
|
2
|
+
@use "@/styles/mixins/animations" as motion;
|
|
3
|
+
|
|
4
|
+
.react-cupertino-ui-bottom-sheet__overlay {
|
|
5
|
+
position: fixed;
|
|
6
|
+
inset: 0;
|
|
7
|
+
background: color-mix(in srgb, rgba(6, 8, 12, 0.65), transparent 20%);
|
|
8
|
+
backdrop-filter: blur(24px) saturate(140%);
|
|
9
|
+
-webkit-backdrop-filter: blur(24px) saturate(140%);
|
|
10
|
+
animation: bottom-sheet-overlay-fade 200ms ease forwards;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.react-cupertino-ui-bottom-sheet__content {
|
|
14
|
+
position: fixed;
|
|
15
|
+
left: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
margin: 0 auto;
|
|
19
|
+
width: min(640px, 100%);
|
|
20
|
+
border-radius: 32px 32px 0 0;
|
|
21
|
+
padding: 1.5rem clamp(1.25rem, 4vw, 2rem) 2rem;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: 1rem;
|
|
25
|
+
color: inherit;
|
|
26
|
+
background: rgba(255, 255, 255, 0.92);
|
|
27
|
+
box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12), 0 -24px 60px rgba(0, 0, 0, 0.18);
|
|
28
|
+
height: calc(var(--bottom-sheet-height, 0.6) * 100vh);
|
|
29
|
+
max-height: calc(100vh - 1rem);
|
|
30
|
+
transform: translate3d(0, calc(var(--bottom-sheet-offset, 0) * 100vh), 0);
|
|
31
|
+
transition:
|
|
32
|
+
height 380ms cubic-bezier(0.2, 0.8, 0.4, 1),
|
|
33
|
+
transform 260ms cubic-bezier(0.2, 0.8, 0.4, 1),
|
|
34
|
+
box-shadow 260ms ease,
|
|
35
|
+
background 260ms ease;
|
|
36
|
+
outline: none;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
|
|
39
|
+
&.glass {
|
|
40
|
+
@include glass.glass-panel(light, var(--glass-blur, 46px));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.is-dragging {
|
|
44
|
+
transition: none;
|
|
45
|
+
cursor: grabbing;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@media (prefers-reduced-motion: reduce) {
|
|
49
|
+
transition: none;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.react-cupertino-ui-bottom-sheet__handle {
|
|
54
|
+
width: 72px;
|
|
55
|
+
height: 6px;
|
|
56
|
+
border-radius: 999px;
|
|
57
|
+
border: none;
|
|
58
|
+
background: color-mix(in srgb, rgba(15, 15, 15, 0.35), rgba(255, 255, 255, 0.6));
|
|
59
|
+
margin: 0 auto 0.5rem;
|
|
60
|
+
cursor: grab;
|
|
61
|
+
position: relative;
|
|
62
|
+
isolation: isolate;
|
|
63
|
+
|
|
64
|
+
&:focus-visible {
|
|
65
|
+
outline: none;
|
|
66
|
+
box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.35);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:active {
|
|
70
|
+
cursor: grabbing;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.react-cupertino-ui-bottom-sheet__body {
|
|
75
|
+
flex: 1;
|
|
76
|
+
overflow-y: auto;
|
|
77
|
+
padding-bottom: 1rem;
|
|
78
|
+
mask-image: linear-gradient(180deg, transparent, #000 10%);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.react-cupertino-ui-bottom-sheet__title {
|
|
82
|
+
font-size: 1.1rem;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
margin-bottom: 0.35rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.react-cupertino-ui-bottom-sheet__description {
|
|
88
|
+
font-size: 0.95rem;
|
|
89
|
+
color: color-mix(in srgb, currentColor, transparent 30%);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@keyframes bottom-sheet-overlay-fade {
|
|
93
|
+
from {
|
|
94
|
+
opacity: 0;
|
|
95
|
+
}
|
|
96
|
+
to {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-cupertino-ui/bottom-sheet",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "BottomSheet component from React Cupertino UI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"./dist/**/*.css",
|
|
14
|
+
"./dist/**/*.scss"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.build.json && npm run build:styles",
|
|
18
|
+
"build:styles": "node ../../../scripts/build-styles.mjs"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react": "^18.3.1",
|
|
22
|
+
"react-dom": "^18.3.1"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@radix-ui/react-dialog": "^1.1.1",
|
|
26
|
+
"@react-cupertino-ui/shared": "workspace:*"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.2.2"
|
|
30
|
+
},
|
|
31
|
+
"gitHead": "3f53987bdb936a331665691b517c2ba9984777f8",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|