@kanso-labs/kanso-ui 0.44.1 → 0.45.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/README.md +59 -7
- package/dist/chip/index.js +24 -4
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/styles.js +13 -5
- package/dist/chip/styles.js.map +1 -1
- package/dist/components/app-bar/index.d.ts +14 -2
- package/dist/components/app-bar/index.js +36 -7
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +44 -0
- package/dist/components/autocomplete/index.js +44 -0
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/button/index.d.ts +3 -2
- package/dist/components/button/index.js +53 -59
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.d.ts +11 -3
- package/dist/components/card/index.js +23 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.js +65 -58
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +46 -30
- package/dist/components/chip/index.js +38 -17
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +5 -2
- package/dist/components/chip-group/index.js +8 -2
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +27 -0
- package/dist/components/dialog/index.js +81 -37
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +1 -1
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/form/index.d.ts +14 -4
- package/dist/components/form/index.js +6 -3
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +15 -1
- package/dist/components/icon-button/index.js +15 -1
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/link/index.d.ts +4 -0
- package/dist/components/link/index.js +4 -0
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list/index.d.ts +34 -0
- package/dist/components/list/index.js +47 -13
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-detail/index.d.ts +34 -1
- package/dist/components/list-detail/index.js +34 -1
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/list-item/index.d.ts +21 -2
- package/dist/components/list-item/index.js +6 -0
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +6 -3
- package/dist/components/menu/index.js +3 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +4 -0
- package/dist/components/meter/index.js +4 -0
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-bar/index.d.ts +14 -2
- package/dist/components/navigation-bar/index.js +14 -2
- package/dist/components/navigation-bar/index.js.map +1 -1
- package/dist/components/navigation-tree/index.js +2 -9
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +7 -1
- package/dist/components/number-field/index.js +7 -1
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +15 -1
- package/dist/components/popover/index.js +15 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +8 -1
- package/dist/components/product-icon/index.js +8 -1
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +12 -6
- package/dist/components/progress-indicator/index.js +57 -46
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +7 -0
- package/dist/components/radio-group/index.js +23 -14
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +13 -4
- package/dist/components/search-field/index.js +10 -4
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-view/index.d.ts +2 -0
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +1 -1
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +31 -6
- package/dist/components/separator/index.js +30 -6
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +96 -37
- package/dist/components/sheet/index.js +420 -136
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +8 -1
- package/dist/components/snackbar/index.js +7 -0
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/stack/index.d.ts +21 -5
- package/dist/components/stack/index.js +10 -0
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +12 -0
- package/dist/components/switch/index.js +12 -0
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +39 -9
- package/dist/components/text-field/index.js +29 -7
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/tree/index.js +11 -15
- package/dist/components/tree/index.js.map +1 -1
- package/dist/hooks/useBottomEdge.js +6 -3
- package/dist/hooks/useBottomEdge.js.map +1 -1
- package/dist/hooks/useRipple.js +216 -192
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +34 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/indicator/styles.js +7 -4
- package/dist/indicator/styles.js.map +1 -1
- package/dist/mark/styles.js +11 -5
- package/dist/mark/styles.js.map +1 -1
- package/dist/react-aria.d.ts +2 -2
- package/dist/row/index.js +90 -62
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +6 -1
- package/dist/row/styles.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles/overlay.js +8 -0
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles.css +135 -114
- package/dist/theme-scope.d.ts +14 -2
- package/dist/theme-scope.js +12 -0
- package/dist/theme-scope.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,27 +2,125 @@
|
|
|
2
2
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
3
3
|
import { mergeRefs } from "../../render/ref.js";
|
|
4
4
|
import { mergeStatefulStyles, mergeStyles } from "../../styles/merge.js";
|
|
5
|
+
import { useMessages } from "../../i18n/index.js";
|
|
5
6
|
import { overlay } from "../../styles/overlay.js";
|
|
6
7
|
import { useHoldBottomEdge } from "../../hooks/useBottomEdge.js";
|
|
7
8
|
import { useScrollStop } from "../../hooks/useScrollStop.js";
|
|
8
9
|
import { OverlayScope } from "../../overlay/index.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
10
|
-
import { useRef } from "react";
|
|
11
|
-
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
import {
|
|
11
|
+
import { createContext, useContext, useLayoutEffect, useRef, useSyncExternalStore } from "react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Button, Heading, HeadingContext, OverlayTriggerStateContext, Sheet, SheetBackdrop, SheetContent, SheetOverlay, SheetTrigger, useSlottedContext } from "react-aria-components";
|
|
13
14
|
//#region src/components/sheet/index.tsx
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const scrimIn = "x18re5ia-B";
|
|
16
|
+
const BOTTOM_SHEET = "(width < 600px)";
|
|
17
|
+
const REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
|
|
18
|
+
const TO_THE_FIRST_SNAP_POINT = { end: 0 };
|
|
19
|
+
const styles = {
|
|
20
|
+
body: {
|
|
21
|
+
kB7OPa: "x9f619",
|
|
22
|
+
k1xSpc: "x78zum5",
|
|
23
|
+
kXwgrk: "xdt5ytf",
|
|
24
|
+
kzQI83: "x1iyjqo2",
|
|
25
|
+
kOIVth: "xxj4525",
|
|
26
|
+
kAzted: "x2lwn1j",
|
|
27
|
+
kHjlTd: "xj0a0fe",
|
|
28
|
+
kORKVm: "x1odjw0f",
|
|
29
|
+
k8WAf4: "xp6hjv6",
|
|
30
|
+
kg3NbH: "xg0ps1x",
|
|
31
|
+
$$css: true
|
|
32
|
+
},
|
|
33
|
+
bodyHeld: {
|
|
34
|
+
kORKVm: "x1s73dr8",
|
|
35
|
+
$$css: true
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function isBottomSheet() {
|
|
39
|
+
return window.matchMedia(BOTTOM_SHEET).matches;
|
|
40
|
+
}
|
|
41
|
+
function isReducedMotion() {
|
|
42
|
+
return window.matchMedia(REDUCED_MOTION).matches;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Moves the sheet whose handle was pressed to its next snap point, or from
|
|
46
|
+
* the last back to the first. React Aria offers no call that moves a sheet,
|
|
47
|
+
* so this scrolls its scroller as React Aria does to open the sheet at the
|
|
48
|
+
* first: React Aria places a marker in the panel for each snap point, and a
|
|
49
|
+
* scroll that rests a marker one viewport below the scroller's top leaves
|
|
50
|
+
* that snap point showing. The markers are `[data-sheet-detent]`, in the
|
|
51
|
+
* order the snap points were given, and they are React Aria's markup rather
|
|
52
|
+
* than its API — a release that renames them leaves the handle pressing
|
|
53
|
+
* nothing, which the handle's tests are there to say.
|
|
54
|
+
*
|
|
55
|
+
* Which snap point the sheet is at is the marker whose resting scroll lies
|
|
56
|
+
* nearest the scroller's own, so a press after a swipe moves on from where
|
|
57
|
+
* the swipe left the sheet.
|
|
58
|
+
*/
|
|
59
|
+
function moveToNextSnapPoint({ target }) {
|
|
60
|
+
const scroller = target.closest("[data-sheet-scroll]");
|
|
61
|
+
if (!(scroller instanceof HTMLElement)) return;
|
|
62
|
+
const origin = scroller.getBoundingClientRect().top - scroller.scrollTop;
|
|
63
|
+
const stops = [...scroller.querySelectorAll("[data-sheet-detent]")].map((marker) => marker.getBoundingClientRect().top - origin - Number.parseFloat(getComputedStyle(marker).scrollMarginTop));
|
|
64
|
+
if (stops.length === 0) return;
|
|
65
|
+
const distances = stops.map((stop) => Math.abs(stop - scroller.scrollTop));
|
|
66
|
+
const at = distances.indexOf(Math.min(...distances));
|
|
67
|
+
scroller.scrollTo({
|
|
68
|
+
behavior: isReducedMotion() ? "auto" : "smooth",
|
|
69
|
+
top: stops[(at + 1) % stops.length]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function onServer() {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
function panelStyles({ position }) {
|
|
76
|
+
return {
|
|
77
|
+
0: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x5yr21d xrzall9 xjslfuv x1gbqego xjg5lhu x6xk272 x1l2rt3b x1a148e8 x1mrd0q" },
|
|
78
|
+
4: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x19dwuzr x4z998w x1lym3mf x1u81hx7 x1uop38w xh8yej3 xv4ka1z x1a148e8 x196z7tn xg4jtgg" },
|
|
79
|
+
2: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x5yr21d xrzall9 xjslfuv x1gbqego xjg5lhu x6xk272 x1l2rt3b x1a148e8 x1mrd0q x196z7tn" },
|
|
80
|
+
6: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x19dwuzr x4z998w x1lym3mf x1u81hx7 x1uop38w xh8yej3 xv4ka1z x1a148e8 xg4jtgg x196z7tn" },
|
|
81
|
+
1: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x5yr21d xrzall9 xjslfuv x1gbqego xjg5lhu x6xk272 x1l2rt3b x1a148e8 x1mrd0q xg4jtgg" },
|
|
82
|
+
5: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x19dwuzr x4z998w x1lym3mf x1u81hx7 x1uop38w xh8yej3 xv4ka1z x1a148e8 x196z7tn xg4jtgg" },
|
|
83
|
+
3: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x5yr21d xrzall9 xjslfuv x1gbqego xjg5lhu x6xk272 x1l2rt3b x1a148e8 x1mrd0q x196z7tn xg4jtgg" },
|
|
84
|
+
7: { className: "x1vnz5z6 x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x7giv3 x19dwuzr x4z998w x1lym3mf x1u81hx7 x1uop38w xh8yej3 xv4ka1z x1a148e8 x196z7tn xg4jtgg" }
|
|
85
|
+
}[!!(position === "bottom") << 2 | !!(position === "left") << 1 | !!(position === "right") << 0];
|
|
86
|
+
}
|
|
87
|
+
function subscribeTo(query) {
|
|
88
|
+
return (listener) => {
|
|
89
|
+
const list = window.matchMedia(query);
|
|
90
|
+
list.addEventListener("change", listener);
|
|
91
|
+
return () => {
|
|
92
|
+
list.removeEventListener("change", listener);
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const subscribeToBottomSheet = subscribeTo(BOTTOM_SHEET);
|
|
97
|
+
const subscribeToReducedMotion = subscribeTo(REDUCED_MOTION);
|
|
98
|
+
const SnapContext = createContext(null);
|
|
99
|
+
/**
|
|
100
|
+
* The dialog's element, given a key handler for Escape. React Aria's sheet
|
|
101
|
+
* has one switch for every way out, so where this sheet's two settings
|
|
102
|
+
* disagree about Escape the handler answers for it: `close` closes the sheet
|
|
103
|
+
* React Aria is holding open, and `hold` keeps Escape from the overlay that
|
|
104
|
+
* would close it. Either way the key goes no further, as it would not have
|
|
105
|
+
* from React Aria's own handler.
|
|
106
|
+
*/
|
|
107
|
+
function escapeKeyOn(escape, state, render) {
|
|
108
|
+
return (props, renderProps) => {
|
|
109
|
+
const next = {
|
|
110
|
+
...props,
|
|
111
|
+
onKeyDown: (event) => {
|
|
112
|
+
props.onKeyDown?.(event);
|
|
113
|
+
if (event.key !== "Escape" || event.nativeEvent.isComposing || !(event.target instanceof Node && event.currentTarget.contains(event.target))) return;
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
if (escape === "close") {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
state?.close();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return render === void 0 ? /* @__PURE__ */ jsx("section", { ...next }) : render(next, renderProps);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
26
124
|
/**
|
|
27
125
|
* A modal panel that arrives from the edge of the screen — a side sheet on a
|
|
28
126
|
* wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:
|
|
@@ -36,13 +134,39 @@ const styles = { body: {
|
|
|
36
134
|
* given `slot="close"` anywhere inside the content closes it; neither needs
|
|
37
135
|
* a part of its own.
|
|
38
136
|
*
|
|
137
|
+
* ```tsx
|
|
138
|
+
* <Sheet>
|
|
139
|
+
* <Button>Open</Button>
|
|
140
|
+
* <Sheet.Content>
|
|
141
|
+
* <Sheet.Handle />
|
|
142
|
+
* <Sheet.Header>
|
|
143
|
+
* <Sheet.Title>Headline</Sheet.Title>
|
|
144
|
+
* </Sheet.Header>
|
|
145
|
+
* <Sheet.Body>Supporting line</Sheet.Body>
|
|
146
|
+
* <Sheet.Footer>
|
|
147
|
+
* <Button slot="close">Close</Button>
|
|
148
|
+
* </Sheet.Footer>
|
|
149
|
+
* </Sheet.Content>
|
|
150
|
+
* </Sheet>
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
39
153
|
* `Sheet` is the trigger's half, so a sheet nothing on the page opens — one
|
|
40
154
|
* a route shows, or a menu item raises — leaves it out and passes `isOpen`
|
|
41
155
|
* and `onOpenChange` to `Sheet.Content` instead. Wrapped in `Sheet` with no
|
|
42
156
|
* button inside it, React Aria warns that its press responder found nothing
|
|
43
157
|
* to press.
|
|
158
|
+
*
|
|
159
|
+
* ```tsx
|
|
160
|
+
* <Sheet.Content isOpen={isOpen} onOpenChange={setOpen}>
|
|
161
|
+
* …
|
|
162
|
+
* </Sheet.Content>
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* Tab stays inside an open sheet, so a `Snackbar` shown meanwhile is reached
|
|
166
|
+
* with F6, which React Aria uses to move between landmarks. Tabbing on past
|
|
167
|
+
* the snackbar's last control leads back into the sheet.
|
|
44
168
|
*/
|
|
45
|
-
function Sheet(t0) {
|
|
169
|
+
function Sheet$1(t0) {
|
|
46
170
|
const $ = c(6);
|
|
47
171
|
let children;
|
|
48
172
|
let props;
|
|
@@ -57,7 +181,7 @@ function Sheet(t0) {
|
|
|
57
181
|
}
|
|
58
182
|
let t1;
|
|
59
183
|
if ($[3] !== children || $[4] !== props) {
|
|
60
|
-
t1 = /* @__PURE__ */ jsx(
|
|
184
|
+
t1 = /* @__PURE__ */ jsx(SheetTrigger, {
|
|
61
185
|
...props,
|
|
62
186
|
children
|
|
63
187
|
});
|
|
@@ -71,6 +195,7 @@ function SheetBody(t0) {
|
|
|
71
195
|
const $ = c(7);
|
|
72
196
|
const { ref: callerRef, ...props$2 } = t0;
|
|
73
197
|
const ref = useRef(null);
|
|
198
|
+
const snap = useContext(SnapContext);
|
|
74
199
|
const title = useSlottedContext(HeadingContext, "title");
|
|
75
200
|
const scrollStop = useScrollStop(ref, {
|
|
76
201
|
label: props$2["aria-label"],
|
|
@@ -84,7 +209,7 @@ function SheetBody(t0) {
|
|
|
84
209
|
$[1] = t2;
|
|
85
210
|
} else t2 = $[1];
|
|
86
211
|
const merged = t2;
|
|
87
|
-
const t3 = mergeStyles(props(styles.body, overlay.modalBodyRing), props$2);
|
|
212
|
+
const t3 = mergeStyles(props(styles.body, snap === "collapsed" && styles.bodyHeld, overlay.modalBodyRing), props$2);
|
|
88
213
|
let t4;
|
|
89
214
|
if ($[2] !== merged || $[3] !== props$2 || $[4] !== scrollStop || $[5] !== t3) {
|
|
90
215
|
t4 = /* @__PURE__ */ jsx("div", {
|
|
@@ -106,133 +231,223 @@ function SheetBody(t0) {
|
|
|
106
231
|
* in here; the trigger stays outside it, since the trigger lives in the page
|
|
107
232
|
* while this is portalled out to the end of the body.
|
|
108
233
|
*
|
|
109
|
-
* A
|
|
110
|
-
*
|
|
111
|
-
*
|
|
234
|
+
* A swipe toward the edge the panel rests on closes it — down on a bottom
|
|
235
|
+
* sheet, toward the screen's edge on a side sheet — as do a press on the
|
|
236
|
+
* scrim, Escape and a `slot="close"` button. `isDismissable` holds the first
|
|
237
|
+
* two, and `isKeyboardDismissDisabled` holds Escape. React Aria's default for
|
|
238
|
+
* the scrim is the reverse of this one: a sheet that ignores a tap outside it
|
|
239
|
+
* reads as stuck.
|
|
112
240
|
*
|
|
113
241
|
* Inside `Sheet`, the open state is the trigger's. On its own, with no
|
|
114
242
|
* trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and
|
|
115
|
-
* a `slot="close"` button, Escape and the scrim all report through
|
|
243
|
+
* a swipe, a `slot="close"` button, Escape and the scrim all report through
|
|
116
244
|
* `onOpenChange`, as they would to `Sheet`.
|
|
117
245
|
*
|
|
118
|
-
* The
|
|
119
|
-
* that, such as a sticky header
|
|
246
|
+
* The sheet draws at `z-index: 900`, the scrim and the panel over it, over
|
|
247
|
+
* any page content layered below that, such as a sticky header. A
|
|
120
248
|
* `Snackbar` draws at 1000, so a toast raised from inside the sheet is read
|
|
121
249
|
* over it, and React Aria's popovers and menus draw above both.
|
|
250
|
+
*
|
|
251
|
+
* React Aria lays the sheet over the page from the page's own top-left
|
|
252
|
+
* corner rather than fixing it to the window, so a `container` inside a
|
|
253
|
+
* positioned element holds the sheet to that element instead.
|
|
122
254
|
*/
|
|
123
|
-
function SheetContent(t0) {
|
|
124
|
-
const $ = c(
|
|
255
|
+
function SheetContent$1(t0) {
|
|
256
|
+
const $ = c(42);
|
|
125
257
|
let children;
|
|
126
258
|
let className;
|
|
127
259
|
let container;
|
|
128
260
|
let defaultOpen;
|
|
129
|
-
let isKeyboardDismissDisabled;
|
|
130
261
|
let isOpen;
|
|
131
262
|
let onOpenChange;
|
|
132
263
|
let props$1;
|
|
133
264
|
let ref;
|
|
265
|
+
let snapPoints;
|
|
134
266
|
let style;
|
|
135
267
|
let t1;
|
|
268
|
+
let t2;
|
|
136
269
|
if ($[0] !== t0) {
|
|
137
|
-
({children, className, container, defaultOpen, isDismissable: t1, isKeyboardDismissDisabled, isOpen, onOpenChange, ref, style, ...props$1} = t0);
|
|
270
|
+
({children, className, container, defaultOpen, isDismissable: t1, isKeyboardDismissDisabled: t2, isOpen, onOpenChange, ref, snapPoints, style, ...props$1} = t0);
|
|
138
271
|
$[0] = t0;
|
|
139
272
|
$[1] = children;
|
|
140
273
|
$[2] = className;
|
|
141
274
|
$[3] = container;
|
|
142
275
|
$[4] = defaultOpen;
|
|
143
|
-
$[5] =
|
|
144
|
-
$[6] =
|
|
145
|
-
$[7] =
|
|
146
|
-
$[8] =
|
|
147
|
-
$[9] =
|
|
276
|
+
$[5] = isOpen;
|
|
277
|
+
$[6] = onOpenChange;
|
|
278
|
+
$[7] = props$1;
|
|
279
|
+
$[8] = ref;
|
|
280
|
+
$[9] = snapPoints;
|
|
148
281
|
$[10] = style;
|
|
149
282
|
$[11] = t1;
|
|
283
|
+
$[12] = t2;
|
|
150
284
|
} else {
|
|
151
285
|
children = $[1];
|
|
152
286
|
className = $[2];
|
|
153
287
|
container = $[3];
|
|
154
288
|
defaultOpen = $[4];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
289
|
+
isOpen = $[5];
|
|
290
|
+
onOpenChange = $[6];
|
|
291
|
+
props$1 = $[7];
|
|
292
|
+
ref = $[8];
|
|
293
|
+
snapPoints = $[9];
|
|
160
294
|
style = $[10];
|
|
161
295
|
t1 = $[11];
|
|
296
|
+
t2 = $[12];
|
|
162
297
|
}
|
|
163
298
|
const isDismissable = t1 === void 0 ? true : t1;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
299
|
+
const isKeyboardDismissDisabled = t2 === void 0 ? false : t2;
|
|
300
|
+
const isBottom = useSyncExternalStore(subscribeToBottomSheet, isBottomSheet, onServer);
|
|
301
|
+
const isReduced = useSyncExternalStore(subscribeToReducedMotion, isReducedMotion, onServer);
|
|
302
|
+
const position = isBottom ? "bottom" : "end";
|
|
303
|
+
const heights = isBottom && snapPoints !== void 0 && snapPoints.length > 0 ? snapPoints : void 0;
|
|
304
|
+
const overlayRef = useRef(null);
|
|
305
|
+
useRestOnTurn(overlayRef, position);
|
|
306
|
+
let escape;
|
|
307
|
+
if ($[13] !== isDismissable || $[14] !== isKeyboardDismissDisabled) {
|
|
308
|
+
if (isDismissable === isKeyboardDismissDisabled) escape = isKeyboardDismissDisabled ? "hold" : "close";
|
|
309
|
+
$[13] = isDismissable;
|
|
310
|
+
$[14] = isKeyboardDismissDisabled;
|
|
311
|
+
$[15] = escape;
|
|
312
|
+
} else escape = $[15];
|
|
313
|
+
const t3 = !isDismissable;
|
|
314
|
+
const t4 = isReduced ? void 0 : scrimIn;
|
|
315
|
+
const t5 = heights === void 0 ? void 0 : TO_THE_FIRST_SNAP_POINT;
|
|
316
|
+
let t6;
|
|
317
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
318
|
+
t6 = props(overlay.backdrop);
|
|
319
|
+
$[16] = t6;
|
|
320
|
+
} else t6 = $[16];
|
|
321
|
+
let t7;
|
|
322
|
+
if ($[17] !== t4 || $[18] !== t5) {
|
|
323
|
+
t7 = /* @__PURE__ */ jsx(SheetBackdrop, {
|
|
324
|
+
swipeAnimation: t4,
|
|
325
|
+
swipeAnimationRange: t5,
|
|
326
|
+
...t6
|
|
327
|
+
});
|
|
328
|
+
$[17] = t4;
|
|
329
|
+
$[18] = t5;
|
|
330
|
+
$[19] = t7;
|
|
331
|
+
} else t7 = $[19];
|
|
332
|
+
let t8;
|
|
333
|
+
if ($[20] !== className || $[21] !== style) {
|
|
334
|
+
t8 = mergeStatefulStyles(panelStyles, {
|
|
172
335
|
className,
|
|
173
336
|
style
|
|
174
337
|
});
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
} else
|
|
179
|
-
let
|
|
180
|
-
if ($[
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
338
|
+
$[20] = className;
|
|
339
|
+
$[21] = style;
|
|
340
|
+
$[22] = t8;
|
|
341
|
+
} else t8 = $[22];
|
|
342
|
+
let t9;
|
|
343
|
+
if ($[23] !== children || $[24] !== escape || $[25] !== heights || $[26] !== props$1) {
|
|
344
|
+
t9 = (t10) => {
|
|
345
|
+
const { isExpanded } = t10;
|
|
346
|
+
let snap = null;
|
|
347
|
+
if (heights !== void 0) snap = isExpanded ? "expanded" : "collapsed";
|
|
348
|
+
return /* @__PURE__ */ jsx(SnapContext, {
|
|
349
|
+
value: snap,
|
|
350
|
+
children: /* @__PURE__ */ jsx(SheetDialog, {
|
|
351
|
+
escape,
|
|
352
|
+
...props$1,
|
|
353
|
+
children
|
|
354
|
+
})
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
$[23] = children;
|
|
358
|
+
$[24] = escape;
|
|
359
|
+
$[25] = heights;
|
|
360
|
+
$[26] = props$1;
|
|
361
|
+
$[27] = t9;
|
|
362
|
+
} else t9 = $[27];
|
|
363
|
+
let t10;
|
|
364
|
+
if ($[28] !== ref || $[29] !== t8 || $[30] !== t9) {
|
|
365
|
+
t10 = /* @__PURE__ */ jsx(Sheet, {
|
|
198
366
|
ref,
|
|
199
|
-
...
|
|
200
|
-
children:
|
|
367
|
+
...t8,
|
|
368
|
+
children: t9
|
|
201
369
|
});
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
} else
|
|
207
|
-
let
|
|
208
|
-
if ($[
|
|
209
|
-
|
|
370
|
+
$[28] = ref;
|
|
371
|
+
$[29] = t8;
|
|
372
|
+
$[30] = t9;
|
|
373
|
+
$[31] = t10;
|
|
374
|
+
} else t10 = $[31];
|
|
375
|
+
let t11;
|
|
376
|
+
if ($[32] !== container || $[33] !== defaultOpen || $[34] !== heights || $[35] !== isOpen || $[36] !== onOpenChange || $[37] !== position || $[38] !== t10 || $[39] !== t3 || $[40] !== t7) {
|
|
377
|
+
t11 = /* @__PURE__ */ jsx(OverlayScope, { children: /* @__PURE__ */ jsxs(SheetOverlay, {
|
|
210
378
|
defaultOpen,
|
|
211
|
-
isDismissable,
|
|
212
|
-
isKeyboardDismissDisabled,
|
|
213
379
|
isOpen,
|
|
214
380
|
onOpenChange,
|
|
381
|
+
position,
|
|
382
|
+
preventDismissal: t3,
|
|
383
|
+
ref: overlayRef,
|
|
384
|
+
snapPoints: heights,
|
|
215
385
|
UNSTABLE_portalContainer: container,
|
|
216
|
-
|
|
217
|
-
children:
|
|
386
|
+
className: "x9f619 x125h2g0",
|
|
387
|
+
children: [t7, t10]
|
|
218
388
|
}) });
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
|
|
228
|
-
|
|
389
|
+
$[32] = container;
|
|
390
|
+
$[33] = defaultOpen;
|
|
391
|
+
$[34] = heights;
|
|
392
|
+
$[35] = isOpen;
|
|
393
|
+
$[36] = onOpenChange;
|
|
394
|
+
$[37] = position;
|
|
395
|
+
$[38] = t10;
|
|
396
|
+
$[39] = t3;
|
|
397
|
+
$[40] = t7;
|
|
398
|
+
$[41] = t11;
|
|
399
|
+
} else t11 = $[41];
|
|
400
|
+
return t11;
|
|
401
|
+
}
|
|
402
|
+
function SheetDialog(t0) {
|
|
403
|
+
const $ = c(12);
|
|
404
|
+
let escape;
|
|
405
|
+
let props$3;
|
|
406
|
+
let render;
|
|
407
|
+
if ($[0] !== t0) {
|
|
408
|
+
({escape, render, ...props$3} = t0);
|
|
409
|
+
$[0] = t0;
|
|
410
|
+
$[1] = escape;
|
|
411
|
+
$[2] = props$3;
|
|
412
|
+
$[3] = render;
|
|
413
|
+
} else {
|
|
414
|
+
escape = $[1];
|
|
415
|
+
props$3 = $[2];
|
|
416
|
+
render = $[3];
|
|
417
|
+
}
|
|
418
|
+
const state = useContext(OverlayTriggerStateContext);
|
|
419
|
+
let t1;
|
|
420
|
+
if ($[4] !== escape || $[5] !== render || $[6] !== state) {
|
|
421
|
+
t1 = escape === void 0 ? render : escapeKeyOn(escape, state, render);
|
|
422
|
+
$[4] = escape;
|
|
423
|
+
$[5] = render;
|
|
424
|
+
$[6] = state;
|
|
425
|
+
$[7] = t1;
|
|
426
|
+
} else t1 = $[7];
|
|
427
|
+
let t2;
|
|
428
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
429
|
+
t2 = props(overlay.modalDialog);
|
|
430
|
+
$[8] = t2;
|
|
431
|
+
} else t2 = $[8];
|
|
432
|
+
let t3;
|
|
433
|
+
if ($[9] !== props$3 || $[10] !== t1) {
|
|
434
|
+
t3 = /* @__PURE__ */ jsx(SheetContent, {
|
|
435
|
+
...props$3,
|
|
436
|
+
render: t1,
|
|
437
|
+
...t2
|
|
438
|
+
});
|
|
439
|
+
$[9] = props$3;
|
|
440
|
+
$[10] = t1;
|
|
441
|
+
$[11] = t3;
|
|
442
|
+
} else t3 = $[11];
|
|
443
|
+
return t3;
|
|
229
444
|
}
|
|
230
445
|
/**
|
|
231
|
-
* The sheet's actions. The panel
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
446
|
+
* The sheet's actions. The panel rests on the window's bottom edge in both
|
|
447
|
+
* presentations, so they sit on that edge, and a toast rises clear of them
|
|
448
|
+
* while the sheet is open rather than lying over its buttons. A side sheet's
|
|
449
|
+
* are included: the toast is centred in the window, and on any window
|
|
450
|
+
* narrower than about 1376px its 576 reach into the sheet's 400.
|
|
236
451
|
*/
|
|
237
452
|
function SheetFooter(t0) {
|
|
238
453
|
const $ = c(6);
|
|
@@ -264,43 +479,71 @@ function SheetFooter(t0) {
|
|
|
264
479
|
}
|
|
265
480
|
/**
|
|
266
481
|
* The bottom sheets page's drag handle: a short bar above the sheet's
|
|
267
|
-
* content, saying the panel is a bottom sheet. Place it
|
|
268
|
-
* `Sheet.Content`; above the medium breakpoint the panel is a
|
|
269
|
-
* this draws nothing.
|
|
482
|
+
* content, saying the panel is a bottom sheet that a swipe moves. Place it
|
|
483
|
+
* first inside `Sheet.Content`; above the medium breakpoint the panel is a
|
|
484
|
+
* side sheet and this draws nothing.
|
|
485
|
+
*
|
|
486
|
+
* On a sheet given `snapPoints` it is a button, as the bottom sheets page
|
|
487
|
+
* asks of a handle that moves the sheet between heights: a press, from a
|
|
488
|
+
* pointer, a keyboard or assistive technology, moves the sheet to its next
|
|
489
|
+
* snap point, from the last back to the first, and `aria-expanded` says
|
|
490
|
+
* whether it rests at the last. It is called "Drag handle" in the locale's
|
|
491
|
+
* own words, and a call site's `aria-label` names it instead. Its 48 square
|
|
492
|
+
* is the page's target, centred over the bar.
|
|
270
493
|
*
|
|
271
|
-
*
|
|
272
|
-
* technology
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* would promise what it cannot do. Closing is already the scrim, Escape, and
|
|
276
|
-
* any button given `slot="close"`.
|
|
494
|
+
* On a sheet without them it is decoration, hidden from assistive
|
|
495
|
+
* technology: the panel has one height, and the swipe the bar points at
|
|
496
|
+
* takes it from anywhere on the panel, so a control here would offer
|
|
497
|
+
* nothing a swipe, the scrim, Escape or a `slot="close"` button does not.
|
|
277
498
|
*/
|
|
278
|
-
function SheetHandle(
|
|
279
|
-
const $ = c(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
$[0] = props;
|
|
284
|
-
$[1] = t0;
|
|
285
|
-
} else t0 = $[1];
|
|
499
|
+
function SheetHandle(t0) {
|
|
500
|
+
const $ = c(9);
|
|
501
|
+
const { "aria-label": label, ...props } = t0;
|
|
502
|
+
const snap = useContext(SnapContext);
|
|
503
|
+
const messages = useMessages();
|
|
286
504
|
let t1;
|
|
287
|
-
if ($[
|
|
505
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
288
506
|
t1 = /* @__PURE__ */ jsx("span", { className: "x1ccu2yh xwvh9j7 xqu0tyb x1dkaolv x9f619 x1g12otp x1td3qas" });
|
|
289
|
-
$[
|
|
290
|
-
} else t1 = $[
|
|
291
|
-
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
|
|
507
|
+
$[0] = t1;
|
|
508
|
+
} else t1 = $[0];
|
|
509
|
+
const bar = t1;
|
|
510
|
+
if (snap === null) return /* @__PURE__ */ jsx("div", {
|
|
511
|
+
"aria-hidden": "true",
|
|
512
|
+
"aria-label": label,
|
|
513
|
+
...props,
|
|
514
|
+
...mergeStyles({ className: "x6s0dn4 x9f619 x1s85apg x37i4ze x2lah0s xl56j7k x1xg6qyv" }, props),
|
|
515
|
+
children: bar
|
|
516
|
+
});
|
|
517
|
+
const t2 = mergeStyles({ className: "x6s0dn4 x9f619 x1s85apg x37i4ze x2lah0s xl56j7k xt970qd" }, props);
|
|
518
|
+
const t3 = snap === "expanded";
|
|
519
|
+
const t4 = label ?? messages.dragHandle;
|
|
520
|
+
let t5;
|
|
521
|
+
if ($[1] !== bar || $[2] !== t3 || $[3] !== t4) {
|
|
522
|
+
t5 = /* @__PURE__ */ jsx(Button, {
|
|
523
|
+
"aria-expanded": t3,
|
|
524
|
+
"aria-label": t4,
|
|
525
|
+
onPress: moveToNextSnapPoint,
|
|
526
|
+
className: "x6s0dn4 xjbqb8w xsdox4t x1dkaolv xng3xce x9f619 x1ypdohk x78zum5 x1useyqa xl56j7k x1ghz6dp xrgy624 x2ssjo2 x9v5kkp x1t137rt x1de99jn x1717udv",
|
|
527
|
+
children: bar
|
|
528
|
+
});
|
|
529
|
+
$[1] = bar;
|
|
530
|
+
$[2] = t3;
|
|
531
|
+
$[3] = t4;
|
|
532
|
+
$[4] = t5;
|
|
533
|
+
} else t5 = $[4];
|
|
534
|
+
let t6;
|
|
535
|
+
if ($[5] !== props || $[6] !== t2 || $[7] !== t5) {
|
|
536
|
+
t6 = /* @__PURE__ */ jsx("div", {
|
|
295
537
|
...props,
|
|
296
|
-
...
|
|
297
|
-
children:
|
|
538
|
+
...t2,
|
|
539
|
+
children: t5
|
|
298
540
|
});
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
|
|
303
|
-
|
|
541
|
+
$[5] = props;
|
|
542
|
+
$[6] = t2;
|
|
543
|
+
$[7] = t5;
|
|
544
|
+
$[8] = t6;
|
|
545
|
+
} else t6 = $[8];
|
|
546
|
+
return t6;
|
|
304
547
|
}
|
|
305
548
|
function SheetHeader(props) {
|
|
306
549
|
const $ = c(5);
|
|
@@ -348,13 +591,54 @@ function SheetTitle(props) {
|
|
|
348
591
|
} else t1 = $[4];
|
|
349
592
|
return t1;
|
|
350
593
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
594
|
+
/**
|
|
595
|
+
* Puts an open panel back where it rests when the window crosses the
|
|
596
|
+
* breakpoint. Its scroller runs along the axis the panel arrives on, so a
|
|
597
|
+
* side sheet turned into a bottom sheet kept the side sheet's scroll, which on
|
|
598
|
+
* the new axis is the closed position: the panel stayed open below the
|
|
599
|
+
* window, and its scrim went on holding the page. A panel resting against the
|
|
600
|
+
* end of its scroller — a bottom sheet, a sheet on the right — goes to the
|
|
601
|
+
* end, and a sheet on the left to the start, without the smooth scroll its
|
|
602
|
+
* arrival takes, since it is not arriving.
|
|
603
|
+
*
|
|
604
|
+
* A layout effect, so the panel is back before the frame is drawn and before
|
|
605
|
+
* React Aria's observer can see it gone; the parent's, so it runs after
|
|
606
|
+
* React Aria has set the scroller up for the new edge.
|
|
607
|
+
*/
|
|
608
|
+
function useRestOnTurn(overlayRef, position) {
|
|
609
|
+
const $ = c(4);
|
|
610
|
+
const previous = useRef(position);
|
|
611
|
+
let t0;
|
|
612
|
+
let t1;
|
|
613
|
+
if ($[0] !== overlayRef || $[1] !== position) {
|
|
614
|
+
t0 = () => {
|
|
615
|
+
if (previous.current === position) return;
|
|
616
|
+
previous.current = position;
|
|
617
|
+
const layer = overlayRef.current;
|
|
618
|
+
const scroller = layer?.querySelector("[data-sheet-scroll]");
|
|
619
|
+
if (!(layer instanceof HTMLElement && scroller instanceof HTMLElement)) return;
|
|
620
|
+
const edge = layer.dataset.position;
|
|
621
|
+
if (edge === "bottom") scroller.scrollTo({ top: scroller.scrollHeight });
|
|
622
|
+
else scroller.scrollTo({ left: edge === "left" ? 0 : scroller.scrollWidth });
|
|
623
|
+
};
|
|
624
|
+
t1 = [overlayRef, position];
|
|
625
|
+
$[0] = overlayRef;
|
|
626
|
+
$[1] = position;
|
|
627
|
+
$[2] = t0;
|
|
628
|
+
$[3] = t1;
|
|
629
|
+
} else {
|
|
630
|
+
t0 = $[2];
|
|
631
|
+
t1 = $[3];
|
|
632
|
+
}
|
|
633
|
+
useLayoutEffect(t0, t1);
|
|
634
|
+
}
|
|
635
|
+
Sheet$1.Body = SheetBody;
|
|
636
|
+
Sheet$1.Content = SheetContent$1;
|
|
637
|
+
Sheet$1.Footer = SheetFooter;
|
|
638
|
+
Sheet$1.Handle = SheetHandle;
|
|
639
|
+
Sheet$1.Header = SheetHeader;
|
|
640
|
+
Sheet$1.Title = SheetTitle;
|
|
357
641
|
//#endregion
|
|
358
|
-
export { SheetBody, SheetContent, SheetFooter, SheetHandle, SheetHeader, SheetTitle, Sheet as default };
|
|
642
|
+
export { SheetBody, SheetContent$1 as SheetContent, SheetFooter, SheetHandle, SheetHeader, SheetTitle, Sheet$1 as default };
|
|
359
643
|
|
|
360
644
|
//# sourceMappingURL=index.js.map
|