colibri-ui 0.8.80 → 0.8.82

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.
Files changed (42) hide show
  1. package/Modal/index.js +15 -13
  2. package/Sheet/Sheet.d.ts +3 -0
  3. package/Sheet/Sheet.js +276 -0
  4. package/Sheet/Sheet.module.css +153 -0
  5. package/Sheet/index.d.ts +2 -0
  6. package/Sheet/index.js +7 -0
  7. package/Sheet/index.props.d.ts +26 -0
  8. package/Sheet/package.json +9 -0
  9. package/Theme/index.d.ts +60 -0
  10. package/Theme/themes/buenos_aires.d.ts +30 -0
  11. package/Theme/themes/buenos_aires.js +30 -0
  12. package/Theme/themes/jaipur.d.ts +30 -0
  13. package/Theme/themes/jaipur.js +30 -0
  14. package/esm/Modal/index.js +4 -2
  15. package/esm/Sheet/Sheet.d.ts +3 -0
  16. package/esm/Sheet/Sheet.js +266 -0
  17. package/esm/Sheet/Sheet.module.css +153 -0
  18. package/esm/Sheet/index.d.ts +2 -0
  19. package/esm/Sheet/index.js +1 -0
  20. package/esm/Sheet/index.props.d.ts +26 -0
  21. package/esm/Theme/index.d.ts +60 -0
  22. package/esm/Theme/themes/buenos_aires.d.ts +30 -0
  23. package/esm/Theme/themes/buenos_aires.js +30 -0
  24. package/esm/Theme/themes/jaipur.d.ts +30 -0
  25. package/esm/Theme/themes/jaipur.js +30 -0
  26. package/esm/hooks/useModalStack/index.d.ts +6 -0
  27. package/esm/hooks/useModalStack/index.js +24 -0
  28. package/esm/index.d.ts +2 -0
  29. package/esm/index.js +1 -0
  30. package/esm/theme_ba_variables.css +30 -0
  31. package/esm/theme_jaipur_variables.css +30 -0
  32. package/hooks/useModalStack/index.d.ts +6 -0
  33. package/hooks/useModalStack/index.js +26 -0
  34. package/index.d.ts +2 -0
  35. package/index.js +3 -0
  36. package/package.json +1 -1
  37. package/theme_ba_variables.css +30 -0
  38. package/theme_jaipur_variables.css +30 -0
  39. package/Modal/useModalStack.d.ts +0 -2
  40. package/Modal/useModalStack.js +0 -20
  41. package/esm/Modal/useModalStack.d.ts +0 -2
  42. package/esm/Modal/useModalStack.js +0 -18
@@ -524,6 +524,36 @@ var THEME_BA = {
524
524
  "component-avatar-font-size-xxxl": "9rem",
525
525
  "component-accordion-text": theme_buenos_aires.default.BRAND_BA_FOREST,
526
526
  "component-accordion-line": theme_buenos_aires.default.NEUTRAL_BA_300,
527
+ "component-sheet-bg": "var(--color-bg-surface)",
528
+ "component-sheet-text": "var(--color-text-primary)",
529
+ "component-sheet-secondary": "var(--color-text-secondary)",
530
+ "component-sheet-overlay": "var(--component-modal-overlay)",
531
+ "component-sheet-radius": "var(--radius-xl)",
532
+ "component-sheet-shadow": "var(--shadow-raised)",
533
+ "component-sheet-z-index": "1000",
534
+ "component-sheet-max-height": "96dvh",
535
+ "component-sheet-overlay-blur": "var(--space-3)",
536
+ "component-sheet-motion-duration": "220ms",
537
+ "component-sheet-resize-duration": "200ms",
538
+ "component-sheet-motion-easing": "cubic-bezier(0.2, 0.8, 0.2, 1)",
539
+ "component-sheet-reduced-motion-duration": "0.001ms",
540
+ "component-sheet-drag-area-height": "var(--space-6)",
541
+ "component-sheet-handle-width": "calc(var(--space-10) + var(--space-1))",
542
+ "component-sheet-handle-height": "var(--space-1)",
543
+ "component-sheet-handle-radius": "var(--radius-full)",
544
+ "component-sheet-handle-opacity": "0.45",
545
+ "component-sheet-header-gap": "var(--space-4)",
546
+ "component-sheet-header-padding": "var(--space-3) var(--space-5) var(--space-4)",
547
+ "component-sheet-border-width": "var(--border-width-hairline)",
548
+ "component-sheet-border-color": "var(--color-border-subtle)",
549
+ "component-sheet-title-font-size": "var(--font-size-heading-sm)",
550
+ "component-sheet-title-line-height": "var(--line-height-heading-sm)",
551
+ "component-sheet-title-font-weight": "var(--font-weight-semibold)",
552
+ "component-sheet-description-offset": "var(--space-1)",
553
+ "component-sheet-description-font-size": "var(--font-size-text-sm)",
554
+ "component-sheet-body-padding": "var(--space-5)",
555
+ "component-sheet-footer-padding-block": "var(--space-4)",
556
+ "component-sheet-footer-padding-inline": "var(--space-5)",
527
557
  "component-modal-bg": theme_buenos_aires.default.NEUTRAL_BA_0,
528
558
  "component-modal-border": theme_buenos_aires.default.NEUTRAL_BA_200,
529
559
  "component-modal-overlay": "rgb(22 51 0 / 28%)",
@@ -518,6 +518,36 @@ declare const _default: {
518
518
  "component-avatar-font-size-xxxl": string;
519
519
  "component-accordion-text": string;
520
520
  "component-accordion-line": string;
521
+ "component-sheet-bg": string;
522
+ "component-sheet-text": string;
523
+ "component-sheet-secondary": string;
524
+ "component-sheet-overlay": string;
525
+ "component-sheet-radius": string;
526
+ "component-sheet-shadow": string;
527
+ "component-sheet-z-index": string;
528
+ "component-sheet-max-height": string;
529
+ "component-sheet-overlay-blur": string;
530
+ "component-sheet-motion-duration": string;
531
+ "component-sheet-resize-duration": string;
532
+ "component-sheet-motion-easing": string;
533
+ "component-sheet-reduced-motion-duration": string;
534
+ "component-sheet-drag-area-height": string;
535
+ "component-sheet-handle-width": string;
536
+ "component-sheet-handle-height": string;
537
+ "component-sheet-handle-radius": string;
538
+ "component-sheet-handle-opacity": string;
539
+ "component-sheet-header-gap": string;
540
+ "component-sheet-header-padding": string;
541
+ "component-sheet-border-width": string;
542
+ "component-sheet-border-color": string;
543
+ "component-sheet-title-font-size": string;
544
+ "component-sheet-title-line-height": string;
545
+ "component-sheet-title-font-weight": string;
546
+ "component-sheet-description-offset": string;
547
+ "component-sheet-description-font-size": string;
548
+ "component-sheet-body-padding": string;
549
+ "component-sheet-footer-padding-block": string;
550
+ "component-sheet-footer-padding-inline": string;
521
551
  "component-modal-bg": string;
522
552
  "component-modal-border": string;
523
553
  "component-modal-overlay": string;
@@ -524,6 +524,36 @@ var theme_jaipur = {
524
524
  "component-avatar-font-size-xxxl": "9rem",
525
525
  "component-accordion-text": theme_jaipur$1.default.BRAND_JP_EGGPLANT,
526
526
  "component-accordion-line": theme_jaipur$1.default.NEUTRAL_JP_300,
527
+ "component-sheet-bg": "var(--color-bg-surface)",
528
+ "component-sheet-text": "var(--color-text-primary)",
529
+ "component-sheet-secondary": "var(--color-text-secondary)",
530
+ "component-sheet-overlay": "var(--component-modal-overlay)",
531
+ "component-sheet-radius": "var(--radius-xl)",
532
+ "component-sheet-shadow": "var(--shadow-raised)",
533
+ "component-sheet-z-index": "1000",
534
+ "component-sheet-max-height": "96dvh",
535
+ "component-sheet-overlay-blur": "var(--space-3)",
536
+ "component-sheet-motion-duration": "220ms",
537
+ "component-sheet-resize-duration": "200ms",
538
+ "component-sheet-motion-easing": "cubic-bezier(0.2, 0.8, 0.2, 1)",
539
+ "component-sheet-reduced-motion-duration": "0.001ms",
540
+ "component-sheet-drag-area-height": "var(--space-6)",
541
+ "component-sheet-handle-width": "calc(var(--space-10) + var(--space-1))",
542
+ "component-sheet-handle-height": "var(--space-1)",
543
+ "component-sheet-handle-radius": "var(--radius-full)",
544
+ "component-sheet-handle-opacity": "0.45",
545
+ "component-sheet-header-gap": "var(--space-4)",
546
+ "component-sheet-header-padding": "var(--space-3) var(--space-5) var(--space-4)",
547
+ "component-sheet-border-width": "var(--border-width-hairline)",
548
+ "component-sheet-border-color": "var(--color-border-subtle)",
549
+ "component-sheet-title-font-size": "var(--font-size-heading-sm)",
550
+ "component-sheet-title-line-height": "var(--line-height-heading-sm)",
551
+ "component-sheet-title-font-weight": "var(--font-weight-semibold)",
552
+ "component-sheet-description-offset": "var(--space-1)",
553
+ "component-sheet-description-font-size": "var(--font-size-text-sm)",
554
+ "component-sheet-body-padding": "var(--space-5)",
555
+ "component-sheet-footer-padding-block": "var(--space-4)",
556
+ "component-sheet-footer-padding-inline": "var(--space-5)",
527
557
  "component-modal-bg": theme_jaipur$1.default.NEUTRAL_JP_0,
528
558
  "component-modal-border": theme_jaipur$1.default.NEUTRAL_JP_200,
529
559
  "component-modal-overlay": "color-mix(in srgb, var(--palette-black) 25%, transparent)",
@@ -4,6 +4,7 @@ import React, { useRef, useState, useContext, useId, useCallback, useMemo, useEf
4
4
  import clsx from 'clsx';
5
5
  import { useScrollLock } from '../hooks/useScrollLock/index.js';
6
6
  import { useTrapFocus } from '../hooks/useTrapFocus/index.js';
7
+ import { useModalStack } from '../hooks/useModalStack/index.js';
7
8
  import { Portal } from '../Portal/index.js';
8
9
  import { useMediaSizes } from '../hooks/useMediaSizes/index.js';
9
10
  import { Body } from './components/Body/index.js';
@@ -13,7 +14,6 @@ import { Footer } from './components/Footer/index.js';
13
14
  import { Header } from './components/Header/index.js';
14
15
  import { Title } from './components/Title/index.js';
15
16
  import { ModalContext } from './context.js';
16
- import { useModalStack } from './useModalStack.js';
17
17
  import styles from './Modal.module.css';
18
18
 
19
19
  var compoundParts = [Header, Body, Footer];
@@ -83,7 +83,9 @@ var ModalRoot = function ModalRoot(_ref) {
83
83
  }, [handleClose]);
84
84
  useEffect(function () {
85
85
  var handleEscape = function handleEscape(event) {
86
- if (event.key === "Escape" && isTopmost()) {
86
+ // A layer that closed on this Escape already called preventDefault.
87
+ if (event.key === "Escape" && !event.defaultPrevented && isTopmost()) {
88
+ event.preventDefault();
87
89
  handleClose();
88
90
  }
89
91
  };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import type { SheetProps } from "./index.props";
3
+ export declare const Sheet: React.ForwardRefExoticComponent<SheetProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,266 @@
1
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
+ import { __rest } from 'tslib';
4
+ import React, { forwardRef, useState, useRef, useId, useMemo, useEffect } from 'react';
5
+ import { createPortal } from 'react-dom';
6
+ import clsx from 'clsx';
7
+ import { useModalStack } from '../hooks/useModalStack/index.js';
8
+ import styles from './Sheet.module.css';
9
+
10
+ var defaultSnapPoints = ["60dvh"];
11
+ var focusableSelector = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
12
+ var toCssSize = function toCssSize(point) {
13
+ return typeof point === "number" ? "".concat(point, "px") : point;
14
+ };
15
+ var toPixels = function toPixels(point, viewportHeight) {
16
+ if (typeof point === "number") return point;
17
+ var value = Number.parseFloat(point);
18
+ if (!Number.isFinite(value)) return 0;
19
+ if (point.endsWith("%") || point.endsWith("vh") || point.endsWith("dvh")) return viewportHeight * value / 100;
20
+ return value;
21
+ };
22
+ var findPoint = function findPoint(points, preferred) {
23
+ var _a;
24
+ if (preferred !== undefined && points.includes(preferred)) return preferred;
25
+ return (_a = points[0]) !== null && _a !== void 0 ? _a : "60dvh";
26
+ };
27
+ var Sheet = /*#__PURE__*/forwardRef(function SheetComponent(_a, forwardedRef) {
28
+ var open = _a.open,
29
+ onOpenChange = _a.onOpenChange,
30
+ title = _a.title,
31
+ description = _a.description,
32
+ header = _a.header,
33
+ footer = _a.footer,
34
+ _a$snapPoints = _a.snapPoints,
35
+ snapPoints = _a$snapPoints === void 0 ? defaultSnapPoints : _a$snapPoints,
36
+ snapPoint = _a.snapPoint,
37
+ defaultSnapPoint = _a.defaultSnapPoint,
38
+ onSnapPointChange = _a.onSnapPointChange,
39
+ _a$modal = _a.modal,
40
+ modal = _a$modal === void 0 ? true : _a$modal,
41
+ _a$blurOverlay = _a.blurOverlay,
42
+ blurOverlay = _a$blurOverlay === void 0 ? false : _a$blurOverlay,
43
+ _a$closeOnOverlayClic = _a.closeOnOverlayClick,
44
+ closeOnOverlayClick = _a$closeOnOverlayClic === void 0 ? true : _a$closeOnOverlayClic,
45
+ _a$closeOnEscape = _a.closeOnEscape,
46
+ closeOnEscape = _a$closeOnEscape === void 0 ? true : _a$closeOnEscape,
47
+ _a$draggable = _a.draggable,
48
+ draggable = _a$draggable === void 0 ? true : _a$draggable,
49
+ _a$showHandle = _a.showHandle,
50
+ showHandle = _a$showHandle === void 0 ? true : _a$showHandle,
51
+ _a$lockBodyScroll = _a.lockBodyScroll,
52
+ lockBodyScroll = _a$lockBodyScroll === void 0 ? true : _a$lockBodyScroll,
53
+ portalContainer = _a.portalContainer,
54
+ initialFocusRef = _a.initialFocusRef,
55
+ returnFocusRef = _a.returnFocusRef,
56
+ zIndex = _a.zIndex,
57
+ className = _a.className,
58
+ style = _a.style,
59
+ children = _a.children,
60
+ ariaLabel = _a["aria-label"],
61
+ ariaLabelledBy = _a["aria-labelledby"],
62
+ ariaDescribedBy = _a["aria-describedby"],
63
+ rest = __rest(_a, ["open", "onOpenChange", "title", "description", "header", "footer", "snapPoints", "snapPoint", "defaultSnapPoint", "onSnapPointChange", "modal", "blurOverlay", "closeOnOverlayClick", "closeOnEscape", "draggable", "showHandle", "lockBodyScroll", "portalContainer", "initialFocusRef", "returnFocusRef", "zIndex", "className", "style", "children", "aria-label", "aria-labelledby", "aria-describedby"]);
64
+ var normalizedPoints = snapPoints.length ? snapPoints : defaultSnapPoints;
65
+ var controlledSnap = snapPoint !== undefined;
66
+ var _useState = useState(function () {
67
+ return findPoint(normalizedPoints, defaultSnapPoint);
68
+ }),
69
+ _useState2 = _slicedToArray(_useState, 2),
70
+ internalSnap = _useState2[0],
71
+ setInternalSnap = _useState2[1];
72
+ var activeSnap = findPoint(normalizedPoints, controlledSnap ? snapPoint : internalSnap);
73
+ var _useState3 = useState(open),
74
+ _useState4 = _slicedToArray(_useState3, 2),
75
+ rendered = _useState4[0],
76
+ setRendered = _useState4[1];
77
+ var _useState5 = useState(false),
78
+ _useState6 = _slicedToArray(_useState5, 2),
79
+ closing = _useState6[0],
80
+ setClosing = _useState6[1];
81
+ var panelRef = useRef(null);
82
+ var previousFocusRef = useRef(null);
83
+ var dragRef = useRef({
84
+ pointerId: -1,
85
+ startY: 0,
86
+ startHeight: 0,
87
+ currentHeight: 0
88
+ });
89
+ var titleId = useId();
90
+ var descriptionId = useId();
91
+ var isTopmost = useModalStack(titleId, open && modal);
92
+ var setPanelRef = function setPanelRef(node) {
93
+ panelRef.current = node;
94
+ if (typeof forwardedRef === "function") forwardedRef(node);else if (forwardedRef) forwardedRef.current = node;
95
+ };
96
+ var sortedPoints = useMemo(function () {
97
+ return _toConsumableArray(normalizedPoints).sort(function (left, right) {
98
+ var height = typeof window === "undefined" ? 1000 : window.innerHeight;
99
+ return toPixels(left, height) - toPixels(right, height);
100
+ });
101
+ }, [normalizedPoints]);
102
+ var changeSnap = function changeSnap(next) {
103
+ if (!controlledSnap) setInternalSnap(next);
104
+ onSnapPointChange === null || onSnapPointChange === void 0 ? void 0 : onSnapPointChange(next);
105
+ };
106
+ useEffect(function () {
107
+ if (open) {
108
+ setRendered(true);
109
+ setClosing(false);
110
+ return;
111
+ }
112
+ if (!rendered) return;
113
+ setClosing(true);
114
+ var duration = panelRef.current ? Number.parseFloat(getComputedStyle(panelRef.current).animationDuration) * 1000 : 220;
115
+ var timer = window.setTimeout(function () {
116
+ setRendered(false);
117
+ setClosing(false);
118
+ }, Number.isFinite(duration) ? duration : 220);
119
+ return function () {
120
+ return window.clearTimeout(timer);
121
+ };
122
+ }, [open, rendered]);
123
+ useEffect(function () {
124
+ var _a;
125
+ if (!open || typeof document === "undefined") return;
126
+ previousFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
127
+ var returnFocusElement = (_a = returnFocusRef === null || returnFocusRef === void 0 ? void 0 : returnFocusRef.current) !== null && _a !== void 0 ? _a : previousFocusRef.current;
128
+ var previousOverflow = document.body.style.overflow;
129
+ if (modal && lockBodyScroll) document.body.style.overflow = "hidden";
130
+ var frame = window.requestAnimationFrame(function () {
131
+ var _a, _b, _c, _d;
132
+ var first = (_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(focusableSelector);
133
+ (_d = (_c = (_b = initialFocusRef === null || initialFocusRef === void 0 ? void 0 : initialFocusRef.current) !== null && _b !== void 0 ? _b : first) !== null && _c !== void 0 ? _c : panelRef.current) === null || _d === void 0 ? void 0 : _d.focus();
134
+ });
135
+ var onKeyDown = function onKeyDown(event) {
136
+ if (event.defaultPrevented || !isTopmost()) return;
137
+ if (event.key === "Escape" && closeOnEscape) {
138
+ event.preventDefault();
139
+ onOpenChange(false, "escape");
140
+ return;
141
+ }
142
+ if (!modal || event.key !== "Tab" || !panelRef.current) return;
143
+ var focusable = Array.from(panelRef.current.querySelectorAll(focusableSelector));
144
+ if (!focusable.length) {
145
+ event.preventDefault();
146
+ panelRef.current.focus();
147
+ return;
148
+ }
149
+ var first = focusable[0];
150
+ var last = focusable[focusable.length - 1];
151
+ if (event.shiftKey && document.activeElement === first) {
152
+ event.preventDefault();
153
+ last.focus();
154
+ } else if (!event.shiftKey && document.activeElement === last) {
155
+ event.preventDefault();
156
+ first.focus();
157
+ }
158
+ };
159
+ document.addEventListener("keydown", onKeyDown);
160
+ return function () {
161
+ window.cancelAnimationFrame(frame);
162
+ document.removeEventListener("keydown", onKeyDown);
163
+ if (modal && lockBodyScroll) document.body.style.overflow = previousOverflow;
164
+ returnFocusElement === null || returnFocusElement === void 0 ? void 0 : returnFocusElement.focus();
165
+ };
166
+ }, [open, modal, lockBodyScroll, closeOnEscape, onOpenChange, initialFocusRef, returnFocusRef, isTopmost]);
167
+ var startDrag = function startDrag(event) {
168
+ if (!draggable || !panelRef.current) return;
169
+ event.currentTarget.setPointerCapture(event.pointerId);
170
+ var height = panelRef.current.getBoundingClientRect().height;
171
+ dragRef.current = {
172
+ pointerId: event.pointerId,
173
+ startY: event.clientY,
174
+ startHeight: height,
175
+ currentHeight: height
176
+ };
177
+ panelRef.current.classList.add(styles.dragging);
178
+ };
179
+ var moveDrag = function moveDrag(event) {
180
+ if (dragRef.current.pointerId !== event.pointerId || !panelRef.current) return;
181
+ var viewportHeight = window.innerHeight;
182
+ var maximum = Math.max.apply(Math, _toConsumableArray(sortedPoints.map(function (point) {
183
+ return toPixels(point, viewportHeight);
184
+ })));
185
+ var nextHeight = Math.max(0, Math.min(maximum, dragRef.current.startHeight - (event.clientY - dragRef.current.startY)));
186
+ dragRef.current.currentHeight = nextHeight;
187
+ panelRef.current.style.height = "".concat(nextHeight, "px");
188
+ };
189
+ var endDrag = function endDrag(event) {
190
+ if (dragRef.current.pointerId !== event.pointerId || !panelRef.current) return;
191
+ event.currentTarget.releasePointerCapture(event.pointerId);
192
+ panelRef.current.classList.remove(styles.dragging);
193
+ var _dragRef$current = dragRef.current,
194
+ currentHeight = _dragRef$current.currentHeight,
195
+ startHeight = _dragRef$current.startHeight;
196
+ dragRef.current.pointerId = -1;
197
+ var pointHeights = sortedPoints.map(function (point) {
198
+ return toPixels(point, window.innerHeight);
199
+ });
200
+ var minimum = pointHeights[0];
201
+ if (currentHeight < Math.min(minimum * 0.65, startHeight * 0.65)) {
202
+ panelRef.current.style.height = toCssSize(activeSnap);
203
+ onOpenChange(false, "drag");
204
+ return;
205
+ }
206
+ var nearest = 0;
207
+ pointHeights.forEach(function (height, index) {
208
+ if (Math.abs(height - currentHeight) < Math.abs(pointHeights[nearest] - currentHeight)) nearest = index;
209
+ });
210
+ var next = sortedPoints[nearest];
211
+ panelRef.current.style.height = toCssSize(next);
212
+ changeSnap(next);
213
+ };
214
+ if (!rendered || typeof document === "undefined") return null;
215
+ var panelStyle = Object.assign(Object.assign({}, style), {
216
+ height: toCssSize(activeSnap)
217
+ });
218
+ var node = /*#__PURE__*/React.createElement("div", {
219
+ className: clsx(styles.root, !modal && styles["non-modal"], closing && styles.closing),
220
+ style: {
221
+ zIndex: zIndex
222
+ }
223
+ }, modal && (/*#__PURE__*/React.createElement("div", {
224
+ className: clsx(styles.overlay, blurOverlay && styles.blur),
225
+ "aria-hidden": "true",
226
+ onClick: function onClick() {
227
+ return closeOnOverlayClick && onOpenChange(false, "overlay");
228
+ }
229
+ })), /*#__PURE__*/React.createElement("div", Object.assign({}, rest, {
230
+ ref: setPanelRef,
231
+ role: "dialog",
232
+ "aria-modal": modal || undefined,
233
+ "aria-label": ariaLabel,
234
+ "aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : title ? titleId : undefined,
235
+ "aria-describedby": ariaDescribedBy !== null && ariaDescribedBy !== void 0 ? ariaDescribedBy : description ? descriptionId : undefined,
236
+ tabIndex: -1,
237
+ className: clsx(styles.sheet, className),
238
+ style: panelStyle
239
+ }), (showHandle || draggable) && (/*#__PURE__*/React.createElement("div", {
240
+ className: styles["drag-area"],
241
+ onPointerDown: startDrag,
242
+ onPointerMove: moveDrag,
243
+ onPointerUp: endDrag,
244
+ onPointerCancel: endDrag
245
+ }, showHandle && (/*#__PURE__*/React.createElement("span", {
246
+ className: styles.handle,
247
+ "aria-hidden": "true"
248
+ })))), (title || description || header) && (/*#__PURE__*/React.createElement("header", {
249
+ className: styles.header
250
+ }, /*#__PURE__*/React.createElement("div", {
251
+ className: styles.heading
252
+ }, title && /*#__PURE__*/React.createElement("h2", {
253
+ id: titleId
254
+ }, title), description && /*#__PURE__*/React.createElement("p", {
255
+ id: descriptionId
256
+ }, description)), header && (/*#__PURE__*/React.createElement("div", {
257
+ className: styles["header-actions"]
258
+ }, header)))), /*#__PURE__*/React.createElement("div", {
259
+ className: styles.body
260
+ }, children), footer && /*#__PURE__*/React.createElement("footer", {
261
+ className: styles.footer
262
+ }, footer)));
263
+ return /*#__PURE__*/createPortal(node, portalContainer !== null && portalContainer !== void 0 ? portalContainer : document.body);
264
+ });
265
+
266
+ export { Sheet };
@@ -0,0 +1,153 @@
1
+ .root {
2
+ font-family: var(--font-family-ui);
3
+ inset: 0;
4
+ pointer-events: none;
5
+ position: fixed;
6
+ z-index: var(--component-sheet-z-index);
7
+ }
8
+
9
+ .overlay {
10
+ animation: fade-in var(--component-sheet-motion-duration) ease-out both;
11
+ background: var(--component-sheet-overlay);
12
+ inset: 0;
13
+ pointer-events: auto;
14
+ position: absolute;
15
+ }
16
+
17
+ .blur {
18
+ backdrop-filter: blur(var(--component-sheet-overlay-blur));
19
+ }
20
+
21
+ .sheet {
22
+ animation: sheet-in var(--component-sheet-motion-duration) var(--component-sheet-motion-easing) both;
23
+ background: var(--component-sheet-bg);
24
+ border-radius: var(--component-sheet-radius) var(--component-sheet-radius) 0 0;
25
+ bottom: 0;
26
+ box-shadow: var(--component-sheet-shadow);
27
+ box-sizing: border-box;
28
+ color: var(--component-sheet-text);
29
+ display: flex;
30
+ flex-direction: column;
31
+ left: 0;
32
+ max-height: min(var(--component-sheet-max-height), 100%);
33
+ outline: none;
34
+ overflow: hidden;
35
+ pointer-events: auto;
36
+ position: absolute;
37
+ right: 0;
38
+ transition: height var(--component-sheet-resize-duration) ease, transform var(--component-sheet-motion-duration) ease;
39
+ }
40
+
41
+ .dragging {
42
+ transition: none;
43
+ user-select: none;
44
+ }
45
+
46
+ .drag-area {
47
+ align-items: center;
48
+ cursor: ns-resize;
49
+ display: flex;
50
+ flex: none;
51
+ justify-content: center;
52
+ min-height: var(--component-sheet-drag-area-height);
53
+ touch-action: none;
54
+ }
55
+
56
+ .handle {
57
+ background: var(--component-sheet-secondary);
58
+ border-radius: var(--component-sheet-handle-radius);
59
+ height: var(--component-sheet-handle-height);
60
+ opacity: var(--component-sheet-handle-opacity);
61
+ width: var(--component-sheet-handle-width);
62
+ }
63
+
64
+ .header {
65
+ align-items: flex-start;
66
+ border-bottom: var(--component-sheet-border-width) solid var(--component-sheet-border-color);
67
+ display: flex;
68
+ flex: none;
69
+ gap: var(--component-sheet-header-gap);
70
+ padding: var(--component-sheet-header-padding);
71
+ }
72
+
73
+ .heading {
74
+ flex: 1;
75
+ min-width: 0;
76
+ }
77
+
78
+ .heading h2 {
79
+ font-size: var(--component-sheet-title-font-size);
80
+ font-weight: var(--component-sheet-title-font-weight);
81
+ line-height: var(--component-sheet-title-line-height);
82
+ margin: 0;
83
+ }
84
+
85
+ .heading p {
86
+ color: var(--component-sheet-secondary);
87
+ font-size: var(--component-sheet-description-font-size);
88
+ margin: var(--component-sheet-description-offset) 0 0;
89
+ }
90
+
91
+ .header-actions {
92
+ align-items: center;
93
+ display: flex;
94
+ flex: none;
95
+ }
96
+
97
+ .body {
98
+ flex: 1;
99
+ min-height: 0;
100
+ overflow: auto;
101
+ overscroll-behavior: contain;
102
+ padding: var(--component-sheet-body-padding);
103
+ }
104
+
105
+ .footer {
106
+ background: var(--component-sheet-bg);
107
+ border-top: var(--component-sheet-border-width) solid var(--component-sheet-border-color);
108
+ flex: none;
109
+ padding: var(--component-sheet-footer-padding-block) var(--component-sheet-footer-padding-inline) max(var(--component-sheet-footer-padding-block), env(safe-area-inset-bottom));
110
+ }
111
+
112
+ .closing .overlay {
113
+ animation: fade-out var(--component-sheet-motion-duration) ease-in both;
114
+ }
115
+
116
+ .closing .sheet {
117
+ animation: sheet-out var(--component-sheet-motion-duration) ease-in both;
118
+ }
119
+
120
+ .non-modal {
121
+ height: 100%;
122
+ inset: auto 0 0;
123
+ }
124
+
125
+ @keyframes fade-in {
126
+ from {
127
+ opacity: 0;
128
+ }
129
+ }
130
+ @keyframes fade-out {
131
+ to {
132
+ opacity: 0;
133
+ }
134
+ }
135
+ @keyframes sheet-in {
136
+ from {
137
+ transform: translateY(100%);
138
+ }
139
+ }
140
+ @keyframes sheet-out {
141
+ to {
142
+ transform: translateY(100%);
143
+ }
144
+ }
145
+ @media (prefers-reduced-motion: reduce) {
146
+ .overlay,
147
+ .sheet,
148
+ .closing .overlay,
149
+ .closing .sheet {
150
+ animation-duration: var(--component-sheet-reduced-motion-duration);
151
+ transition-duration: var(--component-sheet-reduced-motion-duration);
152
+ }
153
+ }
@@ -0,0 +1,2 @@
1
+ export { Sheet } from "./Sheet";
2
+ export type { SheetProps, SheetSnapPoint, SheetCloseReason, } from "./index.props";
@@ -0,0 +1 @@
1
+ export { Sheet } from './Sheet.js';
@@ -0,0 +1,26 @@
1
+ import type { HTMLAttributes, ReactNode, RefObject } from "react";
2
+ export type SheetSnapPoint = number | `${number}px` | `${number}%` | `${number}vh` | `${number}dvh`;
3
+ export type SheetCloseReason = "overlay" | "escape" | "drag";
4
+ export interface SheetProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "onChange"> {
5
+ open: boolean;
6
+ onOpenChange: (open: boolean, reason?: SheetCloseReason) => void;
7
+ title?: ReactNode;
8
+ description?: ReactNode;
9
+ header?: ReactNode;
10
+ footer?: ReactNode;
11
+ snapPoints?: readonly SheetSnapPoint[];
12
+ snapPoint?: SheetSnapPoint;
13
+ defaultSnapPoint?: SheetSnapPoint;
14
+ onSnapPointChange?: (snapPoint: SheetSnapPoint) => void;
15
+ modal?: boolean;
16
+ blurOverlay?: boolean;
17
+ closeOnOverlayClick?: boolean;
18
+ closeOnEscape?: boolean;
19
+ draggable?: boolean;
20
+ showHandle?: boolean;
21
+ lockBodyScroll?: boolean;
22
+ portalContainer?: HTMLElement | null;
23
+ initialFocusRef?: RefObject<HTMLElement | null>;
24
+ returnFocusRef?: RefObject<HTMLElement | null>;
25
+ zIndex?: number;
26
+ }
@@ -597,6 +597,36 @@ export declare const THEMES: {
597
597
  "component-avatar-font-size-xxxl": string;
598
598
  "component-accordion-text": string;
599
599
  "component-accordion-line": string;
600
+ "component-sheet-bg": string;
601
+ "component-sheet-text": string;
602
+ "component-sheet-secondary": string;
603
+ "component-sheet-overlay": string;
604
+ "component-sheet-radius": string;
605
+ "component-sheet-shadow": string;
606
+ "component-sheet-z-index": string;
607
+ "component-sheet-max-height": string;
608
+ "component-sheet-overlay-blur": string;
609
+ "component-sheet-motion-duration": string;
610
+ "component-sheet-resize-duration": string;
611
+ "component-sheet-motion-easing": string;
612
+ "component-sheet-reduced-motion-duration": string;
613
+ "component-sheet-drag-area-height": string;
614
+ "component-sheet-handle-width": string;
615
+ "component-sheet-handle-height": string;
616
+ "component-sheet-handle-radius": string;
617
+ "component-sheet-handle-opacity": string;
618
+ "component-sheet-header-gap": string;
619
+ "component-sheet-header-padding": string;
620
+ "component-sheet-border-width": string;
621
+ "component-sheet-border-color": string;
622
+ "component-sheet-title-font-size": string;
623
+ "component-sheet-title-line-height": string;
624
+ "component-sheet-title-font-weight": string;
625
+ "component-sheet-description-offset": string;
626
+ "component-sheet-description-font-size": string;
627
+ "component-sheet-body-padding": string;
628
+ "component-sheet-footer-padding-block": string;
629
+ "component-sheet-footer-padding-inline": string;
600
630
  "component-modal-bg": string;
601
631
  "component-modal-border": string;
602
632
  "component-modal-overlay": string;
@@ -1384,6 +1414,36 @@ export declare const THEMES: {
1384
1414
  "component-avatar-font-size-xxxl": string;
1385
1415
  "component-accordion-text": string;
1386
1416
  "component-accordion-line": string;
1417
+ "component-sheet-bg": string;
1418
+ "component-sheet-text": string;
1419
+ "component-sheet-secondary": string;
1420
+ "component-sheet-overlay": string;
1421
+ "component-sheet-radius": string;
1422
+ "component-sheet-shadow": string;
1423
+ "component-sheet-z-index": string;
1424
+ "component-sheet-max-height": string;
1425
+ "component-sheet-overlay-blur": string;
1426
+ "component-sheet-motion-duration": string;
1427
+ "component-sheet-resize-duration": string;
1428
+ "component-sheet-motion-easing": string;
1429
+ "component-sheet-reduced-motion-duration": string;
1430
+ "component-sheet-drag-area-height": string;
1431
+ "component-sheet-handle-width": string;
1432
+ "component-sheet-handle-height": string;
1433
+ "component-sheet-handle-radius": string;
1434
+ "component-sheet-handle-opacity": string;
1435
+ "component-sheet-header-gap": string;
1436
+ "component-sheet-header-padding": string;
1437
+ "component-sheet-border-width": string;
1438
+ "component-sheet-border-color": string;
1439
+ "component-sheet-title-font-size": string;
1440
+ "component-sheet-title-line-height": string;
1441
+ "component-sheet-title-font-weight": string;
1442
+ "component-sheet-description-offset": string;
1443
+ "component-sheet-description-font-size": string;
1444
+ "component-sheet-body-padding": string;
1445
+ "component-sheet-footer-padding-block": string;
1446
+ "component-sheet-footer-padding-inline": string;
1387
1447
  "component-modal-bg": string;
1388
1448
  "component-modal-border": string;
1389
1449
  "component-modal-overlay": string;