@kanso-labs/kanso-ui 0.11.21 → 0.12.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 +32 -8
- package/dist/components/app-bar/index.d.ts +2 -2
- package/dist/components/app-bar/index.js +1 -1
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +4 -4
- package/dist/components/avatar/index.js +21 -15
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +1 -1
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/button/index.d.ts +32 -21
- package/dist/components/button/index.js +75 -19
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/card/index.js +1 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +5 -5
- package/dist/components/chip/index.js +5 -5
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/code/index.d.ts +2 -2
- package/dist/components/code/index.js +1 -1
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/container/index.d.ts +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/container/index.js.map +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/currency/index.d.ts +2 -2
- package/dist/components/currency/index.js +1 -1
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/feed/index.d.ts +2 -2
- package/dist/components/feed/index.js +1 -1
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +24 -18
- package/dist/components/icon-button/index.js +62 -15
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/keycap/index.d.ts +2 -2
- package/dist/components/keycap/index.js +1 -1
- package/dist/components/keycap/index.js.map +1 -1
- package/dist/components/link/index.d.ts +2 -2
- package/dist/components/link/index.js +1 -1
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list-detail/index.d.ts +2 -2
- package/dist/components/list-detail/index.js +1 -1
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +105 -0
- package/dist/components/popover/index.js +246 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/product-icon/index.d.ts +3 -3
- package/dist/components/product-icon/index.js +23 -17
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +14 -4
- package/dist/components/separator/index.js +23 -9
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +26 -28
- package/dist/components/sheet/index.js +47 -82
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/stack/index.d.ts +2 -2
- package/dist/components/stack/index.js +1 -1
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/supporting-pane/index.d.ts +2 -2
- package/dist/components/supporting-pane/index.js +1 -1
- package/dist/components/supporting-pane/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +15 -8
- package/dist/components/tabs/index.js +133 -45
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text/index.d.ts +2 -2
- package/dist/components/text/index.js +1 -1
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +12 -5
- package/dist/components/text-field/index.js +48 -33
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/hooks/useImageLoadingStatus.js +53 -0
- package/dist/hooks/useImageLoadingStatus.js.map +1 -0
- package/dist/hooks/useRipple.js +1 -1
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/render/aria.js +66 -0
- package/dist/render/aria.js.map +1 -0
- package/dist/render/useRender.d.ts +28 -0
- package/dist/render/useRender.js +132 -0
- package/dist/render/useRender.js.map +1 -0
- package/dist/styles/merge.js +14 -8
- package/dist/styles/merge.js.map +1 -1
- package/dist/styles.css +88 -36
- package/package.json +4 -4
- package/dist/render/nativeButton.js +0 -26
- package/dist/render/nativeButton.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Separator } from "@base-ui/react/separator";
|
|
2
|
+
import { useRender } from "../../render/useRender.js";
|
|
3
|
+
import { mergeStyles } from "../../styles/merge.js";
|
|
5
4
|
//#region src/components/separator/index.tsx
|
|
6
5
|
const styles = {
|
|
7
6
|
base: {
|
|
@@ -23,14 +22,29 @@ const styles = {
|
|
|
23
22
|
$$css: true
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/**
|
|
26
|
+
* A 1px rule between items. The orientation drives the accessibility tree as
|
|
27
|
+
* well as which side the rule is drawn on: `aria-orientation` is spelled out
|
|
28
|
+
* in both directions rather than leaving the horizontal case to the role's
|
|
29
|
+
* implicit value.
|
|
30
|
+
*
|
|
31
|
+
* A styled element rather than a primitive from the behaviour library: a
|
|
32
|
+
* separator has no behaviour, and the library's own would drop the
|
|
33
|
+
* `aria-orientation` written here on its way to the DOM.
|
|
34
|
+
*/
|
|
35
|
+
function Separator({ orientation = "horizontal", render, ...props$1 }) {
|
|
36
|
+
return useRender({
|
|
37
|
+
defaultTagName: "div",
|
|
38
|
+
props: {
|
|
39
|
+
"aria-orientation": orientation,
|
|
40
|
+
role: "separator",
|
|
41
|
+
...props$1,
|
|
42
|
+
...mergeStyles(props(styles.base, styles[orientation]), props$1)
|
|
43
|
+
},
|
|
44
|
+
render
|
|
31
45
|
});
|
|
32
46
|
}
|
|
33
47
|
//#endregion
|
|
34
|
-
export { Separator
|
|
48
|
+
export { Separator as default };
|
|
35
49
|
|
|
36
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors } from '../../tokens/design.tokens.stylex';\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own — the design system treats the two as one\n// decision, and a separator that drifted from the borders around it would\n// read as a mistake.\n//\n// Drawn as a background on a 1px box rather than as a border, so the rule is\n// the element itself. A border would leave the element's own box at zero\n// size, which makes it invisible to flex `gap` and to anything measuring it.\n//\n// Vertical has no length of its own. `alignSelf: stretch` takes it from the\n// flex or grid parent, since a divider between two rows should match\n// whatever they turn out to be rather than being told a height at the call\n// site. In a plain block parent there is nothing to stretch to and it will\n// have no height — that is the documented cost of the prop.\nconst styles = {\n base: {\n kWkggS: \"x1l12bh\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n },\n horizontal: {\n kZKoxP: \"xjm9jq1\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n vertical: {\n kSGwAc: \"xkh2ocl\",\n kzqmXN: \"x1i1rx1s\",\n $$css: true\n }\n};\ntype SeparatorProps = RenderComponentProps<'div'> & {\n /**\n * Which way the rule runs. A vertical separator takes its length from a\n * flex or grid parent and has none of its own.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n};\n\n/**\n * A 1px rule between items. The orientation drives the accessibility tree as\n * well as which side the rule is drawn on: `aria-orientation` is spelled out\n * in both directions rather than leaving the horizontal case to the role's\n * implicit value.\n *\n * A styled element rather than a primitive from the behaviour library: a\n * separator has no behaviour, and the library's own would drop the\n * `aria-orientation` written here on its way to the DOM.\n */\nfunction Separator({\n orientation = 'horizontal',\n render,\n ...props\n}: SeparatorProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n 'aria-orientation': orientation,\n role: 'separator',\n ...props,\n ...mergeStyles(stylex.props(styles.base, styles[orientation]), props)\n },\n render\n });\n}\nexport type { SeparatorProps };\nexport default Separator;"],"mappings":";;;;AAqBA,MAAM,SAAS;CACb,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;;;;;;;;;;;AAoBA,SAAS,UAAU,EACjB,cAAc,cACd,QACA,GAAG,WACc;CACjB,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO;GACL,oBAAoB;GACpB,MAAM;GACN,GAAG;GACH,GAAG,YAAY,MAAa,OAAO,MAAM,OAAO,YAAY,GAAG,OAAK;EACtE;EACA;CACF,CAAC;AACH"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, ModalOverlayProps, ModalRenderProps, StyleOrFunction } from "react-aria-components";
|
|
3
3
|
//#region src/components/sheet/index.d.ts
|
|
4
4
|
type SheetSize = 'md' | 'sm';
|
|
5
|
-
type SheetProps = Omit<
|
|
5
|
+
type SheetProps = Omit<DialogTriggerProps, 'children'> & {
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
/**
|
|
8
8
|
* Panel width on the side-sheet presentation: `sm` 320px, `md` 400px.
|
|
@@ -13,52 +13,47 @@ type SheetProps = Omit<DialogRootProps, 'children'> & {
|
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* A modal panel that arrives from the edge of the screen — a side sheet on a
|
|
16
|
-
* wide viewport, a bottom sheet on a narrow one. Open state is
|
|
17
|
-
* pass `
|
|
16
|
+
* wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:
|
|
17
|
+
* pass `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it
|
|
18
18
|
* keep its own.
|
|
19
19
|
*
|
|
20
20
|
* Composed rather than configured by props, because a sheet's header, body,
|
|
21
|
-
* and footer all take arbitrary content — the parts are `Sheet.
|
|
22
|
-
* `Sheet.
|
|
23
|
-
* `Sheet
|
|
21
|
+
* and footer all take arbitrary content — the parts are `Sheet.Content`,
|
|
22
|
+
* `Sheet.Header`, `Sheet.Title`, `Sheet.Body`, and `Sheet.Footer`. A
|
|
23
|
+
* `Button` or `IconButton` placed directly inside `Sheet` opens it, and one
|
|
24
|
+
* given `slot="close"` anywhere inside the content closes it; neither needs
|
|
25
|
+
* a part of its own.
|
|
24
26
|
*/
|
|
25
27
|
declare function Sheet({ children, size, ...props }: SheetProps): import("react").JSX.Element;
|
|
26
28
|
declare namespace Sheet {
|
|
27
29
|
var Body: typeof SheetBody;
|
|
28
|
-
var Close: typeof SheetClose;
|
|
29
30
|
var Content: typeof SheetContent;
|
|
30
31
|
var Footer: typeof SheetFooter;
|
|
31
32
|
var Header: typeof SheetHeader;
|
|
32
33
|
var Title: typeof SheetTitle;
|
|
33
|
-
var Trigger: typeof SheetTrigger;
|
|
34
34
|
}
|
|
35
35
|
declare function SheetBody(props: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
36
|
-
/**
|
|
37
|
-
* Closes the sheet when pressed. Carries no styling of its own, so give it
|
|
38
|
-
* the control it should be through `render` — an `IconButton` in the header,
|
|
39
|
-
* a `Button` in the footer.
|
|
40
|
-
*/
|
|
41
|
-
declare function SheetClose(props: DialogCloseProps): import("react").JSX.Element;
|
|
42
36
|
/**
|
|
43
37
|
* The panel itself, and the scrim behind it. Everything the sheet shows goes
|
|
44
|
-
* in here;
|
|
45
|
-
*
|
|
38
|
+
* in here; the trigger stays outside it, since the trigger lives in the page
|
|
39
|
+
* while this is portalled out to the end of the body.
|
|
40
|
+
*
|
|
41
|
+
* A press on the scrim closes the sheet unless `isDismissable` says
|
|
42
|
+
* otherwise — React Aria's own default is the reverse, and a sheet that
|
|
43
|
+
* ignores a tap outside it reads as stuck.
|
|
46
44
|
*/
|
|
47
|
-
declare function SheetContent({ children, container, ...props }: SheetContentProps): import("react").JSX.Element;
|
|
45
|
+
declare function SheetContent({ children, className, container, isDismissable, isKeyboardDismissDisabled, style, ...props }: SheetContentProps): import("react").JSX.Element;
|
|
48
46
|
declare function SheetFooter(props: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
49
47
|
declare function SheetHeader(props: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
50
48
|
/**
|
|
51
|
-
* Names the sheet. Rendered through
|
|
49
|
+
* Names the sheet. Rendered through React Aria's title slot, which is what
|
|
52
50
|
* points the dialog's `aria-labelledby` at it — a sheet without one announces
|
|
53
51
|
* itself as an unnamed dialog.
|
|
54
52
|
*/
|
|
55
|
-
declare function SheetTitle(props:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*/
|
|
60
|
-
declare function SheetTrigger(props: DialogTriggerProps): import("react").JSX.Element;
|
|
61
|
-
type SheetContentProps = DialogPopupProps & {
|
|
53
|
+
declare function SheetTitle(props: SheetTitleProps): import("react").JSX.Element;
|
|
54
|
+
type SheetContentProps = Omit<DialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'isDismissable' | 'isKeyboardDismissDisabled'> & {
|
|
55
|
+
/** A function may compute the class from the panel's render state. */
|
|
56
|
+
className?: ClassNameOrFunction<ModalRenderProps>;
|
|
62
57
|
/**
|
|
63
58
|
* Where to portal the panel and scrim. Defaults to the end of `<body>`,
|
|
64
59
|
* which is right for an app that sets its StyleX theme on `:root`. An app
|
|
@@ -66,8 +61,11 @@ type SheetContentProps = DialogPopupProps & {
|
|
|
66
61
|
* it, or the sheet renders outside the theme and falls back to the tokens'
|
|
67
62
|
* `prefers-color-scheme` default.
|
|
68
63
|
*/
|
|
69
|
-
container?:
|
|
64
|
+
container?: Element;
|
|
65
|
+
/** A function may compute the style from the panel's render state. */
|
|
66
|
+
style?: StyleOrFunction<ModalRenderProps>;
|
|
70
67
|
};
|
|
68
|
+
type SheetTitleProps = HeadingProps;
|
|
71
69
|
//#endregion
|
|
72
|
-
export { type SheetContentProps, type SheetProps, type SheetSize, Sheet as default };
|
|
70
|
+
export { type SheetContentProps, type SheetProps, type SheetSize, type SheetTitleProps, Sheet as default };
|
|
73
71
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { mergeStatefulStyles, mergeStyles } from "../../styles/merge.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { c } from "react/compiler-runtime";
|
|
5
3
|
import { createContext, useContext } from "react";
|
|
6
|
-
import {
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { Dialog, DialogTrigger, Heading, Modal, ModalOverlay } from "react-aria-components";
|
|
7
7
|
//#region src/components/sheet/index.tsx
|
|
8
8
|
const styles = {
|
|
9
9
|
backdrop: {
|
|
@@ -48,6 +48,14 @@ const styles = {
|
|
|
48
48
|
kVAEAm: "xixxii4",
|
|
49
49
|
$$css: true
|
|
50
50
|
},
|
|
51
|
+
dialog: {
|
|
52
|
+
kZKoxP: "x5yr21d",
|
|
53
|
+
kB7OPa: "x9f619",
|
|
54
|
+
k1xSpc: "x78zum5",
|
|
55
|
+
kXwgrk: "xdt5ytf",
|
|
56
|
+
k3XXqK: "x1t137rt",
|
|
57
|
+
$$css: true
|
|
58
|
+
},
|
|
51
59
|
footer: {
|
|
52
60
|
kLZC3w: "x12smttz",
|
|
53
61
|
kPef9Z: "x13fuv20",
|
|
@@ -98,17 +106,19 @@ const styles = {
|
|
|
98
106
|
const SheetSizeContext = createContext("md");
|
|
99
107
|
/**
|
|
100
108
|
* A modal panel that arrives from the edge of the screen — a side sheet on a
|
|
101
|
-
* wide viewport, a bottom sheet on a narrow one. Open state is
|
|
102
|
-
* pass `
|
|
109
|
+
* wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:
|
|
110
|
+
* pass `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it
|
|
103
111
|
* keep its own.
|
|
104
112
|
*
|
|
105
113
|
* Composed rather than configured by props, because a sheet's header, body,
|
|
106
|
-
* and footer all take arbitrary content — the parts are `Sheet.
|
|
107
|
-
* `Sheet.
|
|
108
|
-
* `Sheet
|
|
114
|
+
* and footer all take arbitrary content — the parts are `Sheet.Content`,
|
|
115
|
+
* `Sheet.Header`, `Sheet.Title`, `Sheet.Body`, and `Sheet.Footer`. A
|
|
116
|
+
* `Button` or `IconButton` placed directly inside `Sheet` opens it, and one
|
|
117
|
+
* given `slot="close"` anywhere inside the content closes it; neither needs
|
|
118
|
+
* a part of its own.
|
|
109
119
|
*/
|
|
110
120
|
function Sheet({ children, size = "md", ...props }) {
|
|
111
|
-
return /* @__PURE__ */ jsx(
|
|
121
|
+
return /* @__PURE__ */ jsx(DialogTrigger, {
|
|
112
122
|
...props,
|
|
113
123
|
children: /* @__PURE__ */ jsx(SheetSizeContext, {
|
|
114
124
|
value: size,
|
|
@@ -137,63 +147,33 @@ function SheetBody(props) {
|
|
|
137
147
|
return t1;
|
|
138
148
|
}
|
|
139
149
|
/**
|
|
140
|
-
* Closes the sheet when pressed. Carries no styling of its own, so give it
|
|
141
|
-
* the control it should be through `render` — an `IconButton` in the header,
|
|
142
|
-
* a `Button` in the footer.
|
|
143
|
-
*/
|
|
144
|
-
function SheetClose(props) {
|
|
145
|
-
const $ = c(2);
|
|
146
|
-
let t0;
|
|
147
|
-
if ($[0] !== props) {
|
|
148
|
-
t0 = /* @__PURE__ */ jsx(Dialog.Close, { ...props });
|
|
149
|
-
$[0] = props;
|
|
150
|
-
$[1] = t0;
|
|
151
|
-
} else t0 = $[1];
|
|
152
|
-
return t0;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
150
|
* The panel itself, and the scrim behind it. Everything the sheet shows goes
|
|
156
|
-
* in here;
|
|
157
|
-
*
|
|
151
|
+
* in here; the trigger stays outside it, since the trigger lives in the page
|
|
152
|
+
* while this is portalled out to the end of the body.
|
|
153
|
+
*
|
|
154
|
+
* A press on the scrim closes the sheet unless `isDismissable` says
|
|
155
|
+
* otherwise — React Aria's own default is the reverse, and a sheet that
|
|
156
|
+
* ignores a tap outside it reads as stuck.
|
|
158
157
|
*/
|
|
159
|
-
function SheetContent(
|
|
160
|
-
const $ = c(11);
|
|
161
|
-
const { children, container, ...props$1 } = t0;
|
|
158
|
+
function SheetContent({ children, className, container, isDismissable = true, isKeyboardDismissDisabled, style, ...props$1 }) {
|
|
162
159
|
const size = useContext(SheetSizeContext);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
$[3] = t3.Popup;
|
|
181
|
-
$[4] = t4;
|
|
182
|
-
$[5] = t5;
|
|
183
|
-
} else t5 = $[5];
|
|
184
|
-
let t6;
|
|
185
|
-
if ($[6] !== container || $[7] !== t1.Portal || $[8] !== t2 || $[9] !== t5) {
|
|
186
|
-
t6 = /* @__PURE__ */ jsxs(t1.Portal, {
|
|
187
|
-
container,
|
|
188
|
-
children: [t2, t5]
|
|
189
|
-
});
|
|
190
|
-
$[6] = container;
|
|
191
|
-
$[7] = t1.Portal;
|
|
192
|
-
$[8] = t2;
|
|
193
|
-
$[9] = t5;
|
|
194
|
-
$[10] = t6;
|
|
195
|
-
} else t6 = $[10];
|
|
196
|
-
return t6;
|
|
160
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
161
|
+
isDismissable,
|
|
162
|
+
isKeyboardDismissDisabled,
|
|
163
|
+
UNSTABLE_portalContainer: container,
|
|
164
|
+
className: "x1vhuh8u xqcmdr3 x1yujl0p x1iqbvzf x10a8y8t xixxii4",
|
|
165
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
166
|
+
...mergeStatefulStyles(props(styles.content, styles[size]), {
|
|
167
|
+
className,
|
|
168
|
+
style
|
|
169
|
+
}),
|
|
170
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
171
|
+
...props$1,
|
|
172
|
+
className: "x5yr21d x9f619 x78zum5 xdt5ytf x1t137rt",
|
|
173
|
+
children
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
});
|
|
197
177
|
}
|
|
198
178
|
function SheetFooter(props) {
|
|
199
179
|
const $ = c(5);
|
|
@@ -236,7 +216,7 @@ function SheetHeader(props) {
|
|
|
236
216
|
return t1;
|
|
237
217
|
}
|
|
238
218
|
/**
|
|
239
|
-
* Names the sheet. Rendered through
|
|
219
|
+
* Names the sheet. Rendered through React Aria's title slot, which is what
|
|
240
220
|
* points the dialog's `aria-labelledby` at it — a sheet without one announces
|
|
241
221
|
* itself as an unnamed dialog.
|
|
242
222
|
*/
|
|
@@ -244,13 +224,14 @@ function SheetTitle(props) {
|
|
|
244
224
|
const $ = c(5);
|
|
245
225
|
let t0;
|
|
246
226
|
if ($[0] !== props) {
|
|
247
|
-
t0 =
|
|
227
|
+
t0 = mergeStyles({ className: "x9f619 x139gbkf xdy5w5q xete2z3 x14ijtet xug9e1u x2divse x1ghz6dp" }, props);
|
|
248
228
|
$[0] = props;
|
|
249
229
|
$[1] = t0;
|
|
250
230
|
} else t0 = $[1];
|
|
251
231
|
let t1;
|
|
252
232
|
if ($[2] !== props || $[3] !== t0) {
|
|
253
|
-
t1 = /* @__PURE__ */ jsx(
|
|
233
|
+
t1 = /* @__PURE__ */ jsx(Heading, {
|
|
234
|
+
slot: "title",
|
|
254
235
|
...props,
|
|
255
236
|
...t0
|
|
256
237
|
});
|
|
@@ -260,27 +241,11 @@ function SheetTitle(props) {
|
|
|
260
241
|
} else t1 = $[4];
|
|
261
242
|
return t1;
|
|
262
243
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Opens the sheet when pressed. Unstyled like `Sheet.Close`, so pass the
|
|
265
|
-
* control through `render`.
|
|
266
|
-
*/
|
|
267
|
-
function SheetTrigger(props) {
|
|
268
|
-
const $ = c(2);
|
|
269
|
-
let t0;
|
|
270
|
-
if ($[0] !== props) {
|
|
271
|
-
t0 = /* @__PURE__ */ jsx(Dialog.Trigger, { ...props });
|
|
272
|
-
$[0] = props;
|
|
273
|
-
$[1] = t0;
|
|
274
|
-
} else t0 = $[1];
|
|
275
|
-
return t0;
|
|
276
|
-
}
|
|
277
244
|
Sheet.Body = SheetBody;
|
|
278
|
-
Sheet.Close = SheetClose;
|
|
279
245
|
Sheet.Content = SheetContent;
|
|
280
246
|
Sheet.Footer = SheetFooter;
|
|
281
247
|
Sheet.Header = SheetHeader;
|
|
282
248
|
Sheet.Title = SheetTitle;
|
|
283
|
-
Sheet.Trigger = SheetTrigger;
|
|
284
249
|
//#endregion
|
|
285
250
|
export { Sheet as default };
|
|
286
251
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["children","container"],"sources":["../../../src/components/sheet/index.tsx"],"sourcesContent":["import type { DialogCloseProps as BaseUIDialogCloseProps, DialogPopupProps as BaseUIDialogPopupProps, DialogPortalProps as BaseUIDialogPortalProps, DialogRootProps as BaseUIDialogRootProps, DialogTitleProps as BaseUIDialogTitleProps, DialogTriggerProps as BaseUIDialogTriggerProps } from '@base-ui/react/dialog';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { Dialog as BaseUIDialog } from '@base-ui/react/dialog';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, motion, radii, shadows, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// One component, two presentations. Above the medium breakpoint it is a side\n// sheet pinned to the inline end of the viewport; below it, the same panel\n// becomes a bottom sheet. That is M3's own pairing rather than two components,\n// and it is why nothing here takes a `side` prop — a sheet that stayed on the\n// right at 375px would be a drawer covering the whole screen.\n//\n// The two differ in three things and no more: which edges they are pinned to,\n// which two corners are rounded, and which axis they arrive along.\nconst slideInFromEnd = \"x17cjob-B\";\nconst slideInFromBottom = \"x15b941j-B\";\nconst fadeIn = \"x18re5ia-B\";\n\n// Entry only, so there is no exit animation to wait for and closing is\n// immediate. See the comment on `SheetContent` for why that is a design call\n// rather than a limit of StyleX.\nconst styles = {\n backdrop: {\n k44tkh: \"x1vhuh8u\",\n kKVMdj: \"xqcmdr3\",\n kyAemX: \"x1yujl0p\",\n kWkggS: \"x1iqbvzf\",\n kpwlN0: \"x10a8y8t\",\n kVAEAm: \"xixxii4\",\n $$css: true\n },\n body: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kOIVth: \"xxj4525\",\n kORKVm: \"x1odjw0f\",\n kmVPX3: \"xgc26li\",\n $$css: true\n },\n content: {\n k44tkh: \"x1n1nwrg\",\n kKVMdj: \"xu2fq7p x18ihq2d\",\n kyAemX: \"x16dv9tl\",\n kWkggS: \"x1vnz5z6\",\n kT0f0o: \"xkducg2\",\n kVL7Gh: \"xrzall9 xb0nsol\",\n kfmiAY: \"x1a37zkv xys6ro8\",\n krdFHd: \"x6xk272 x9t1vth\",\n kGVxlE: \"x19efjv6\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n krVfgx: \"x1ey2m1c\",\n k87sOh: \"x13vifvy xmpip4z\",\n kt4wiu: \"xtijo5x\",\n kLqNvP: \"xhi6v0a x1upgybz\",\n kskxy: \"x7ab17h x1dexy1j\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"xixxii4\",\n $$css: true\n },\n footer: {\n kLZC3w: \"x12smttz\",\n kPef9Z: \"x13fuv20\",\n kEafiO: \"x178xt8z\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kOIVth: \"x126z3so\",\n kjj79g: \"x13a6bvl\",\n k8WAf4: \"x1uvvd8r\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n header: {\n kGNEyG: \"x6s0dn4\",\n kL6WhQ: \"x1j6faob\",\n kfdmCh: \"x1q0q8m5\",\n kt9PQ7: \"xso031l\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kOIVth: \"x1gka490\",\n kjj79g: \"x1qughib\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n md: {\n kzqmXN: \"x1l2rt3b xwvxfow\",\n $$css: true\n },\n sm: {\n kzqmXN: \"x1m258z3 xwvxfow\",\n $$css: true\n },\n title: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kMv6JI: \"xdy5w5q\",\n kGuDYH: \"xete2z3\",\n k63SB2: \"x14ijtet\",\n kb6lSQ: \"xug9e1u\",\n kLWn49: \"x2divse\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n }\n};\ntype SheetSize = 'md' | 'sm';\n\n// `size` is declared on the root, where a reader expects to set the shape of\n// the whole sheet, but it is `Sheet.Content` that has to apply it. One string\n// through context rather than making the call site repeat it on both.\nconst SheetSizeContext = createContext<SheetSize>('md');\n\n// `children` is narrowed to nodes. Base UI also accepts a function there, to\n// hand the sheet a payload passed by whichever trigger opened it, and that\n// form cannot be wrapped in a context provider without calling it first —\n// which would be doing Base UI's job with none of its state. Nothing in this\n// component needs the payload, so the narrower type says so rather than\n// leaving a signature that type-checks and then fails to render.\ntype SheetProps = Omit<BaseUIDialogRootProps, 'children'> & {\n children?: ReactNode;\n /**\n * Panel width on the side-sheet presentation: `sm` 320px, `md` 400px.\n * Ignored below the medium breakpoint, where the sheet is full width.\n * @default 'md'\n */\n size?: SheetSize;\n};\n\n/**\n * A modal panel that arrives from the edge of the screen — a side sheet on a\n * wide viewport, a bottom sheet on a narrow one. Open state is Base UI's:\n * pass `open` with `onOpenChange` to control it, or `defaultOpen` to let it\n * keep its own.\n *\n * Composed rather than configured by props, because a sheet's header, body,\n * and footer all take arbitrary content — the parts are `Sheet.Trigger`,\n * `Sheet.Content`, `Sheet.Header`, `Sheet.Title`, `Sheet.Body`,\n * `Sheet.Footer`, and `Sheet.Close`.\n */\nfunction Sheet({\n children,\n size = 'md',\n ...props\n}: SheetProps) {\n return <BaseUIDialog.Root {...props}>\n <SheetSizeContext value={size}>{children}</SheetSizeContext>\n </BaseUIDialog.Root>;\n}\nfunction SheetBody(props: HTMLAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x9f619 x78zum5 xdt5ytf x1iyjqo2 xxj4525 x1odjw0f xgc26li\"\n }, props)} />;\n}\n\n/**\n * Closes the sheet when pressed. Carries no styling of its own, so give it\n * the control it should be through `render` — an `IconButton` in the header,\n * a `Button` in the footer.\n */\nfunction SheetClose(props: BaseUIDialogCloseProps) {\n return <BaseUIDialog.Close {...props} />;\n}\n\n/**\n * The panel itself, and the scrim behind it. Everything the sheet shows goes\n * in here; `Sheet.Trigger` stays outside it, since the trigger lives in the\n * page while this is portalled out to the end of the body.\n */\nfunction SheetContent({\n children,\n container,\n ...props\n}: SheetContentProps) {\n const size = useContext(SheetSizeContext);\n return <BaseUIDialog.Portal container={container}>\n <BaseUIDialog.Backdrop className=\"x1vhuh8u xqcmdr3 x1yujl0p x1iqbvzf x10a8y8t xixxii4\" />\n <BaseUIDialog.Popup {...props} {...mergeStatefulStyles(stylex.props(styles.content, styles[size]), props)}>\n {children}\n </BaseUIDialog.Popup>\n </BaseUIDialog.Portal>;\n}\nfunction SheetFooter(props: HTMLAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x12smttz x13fuv20 x178xt8z x9f619 x78zum5 x2lah0s x126z3so x13a6bvl x1uvvd8r x790zyz\"\n }, props)} />;\n}\nfunction SheetHeader(props: HTMLAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x6s0dn4 x1j6faob x1q0q8m5 xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib x1cmllll x790zyz\"\n }, props)} />;\n}\n\n/**\n * Names the sheet. Rendered through Base UI's title part, which is what\n * points the dialog's `aria-labelledby` at it — a sheet without one announces\n * itself as an unnamed dialog.\n */\nfunction SheetTitle(props: BaseUIDialogTitleProps) {\n return <BaseUIDialog.Title {...props} {...mergeStatefulStyles({\n className: \"x9f619 x139gbkf xdy5w5q xete2z3 x14ijtet xug9e1u x2divse x1ghz6dp\"\n }, props)} />;\n}\n\n/**\n * Opens the sheet when pressed. Unstyled like `Sheet.Close`, so pass the\n * control through `render`.\n */\nfunction SheetTrigger(props: BaseUIDialogTriggerProps) {\n return <BaseUIDialog.Trigger {...props} />;\n}\nSheet.Body = SheetBody;\nSheet.Close = SheetClose;\nSheet.Content = SheetContent;\nSheet.Footer = SheetFooter;\nSheet.Header = SheetHeader;\nSheet.Title = SheetTitle;\nSheet.Trigger = SheetTrigger;\ntype SheetCloseProps = BaseUIDialogCloseProps;\ntype SheetContentProps = BaseUIDialogPopupProps & {\n /**\n * Where to portal the panel and scrim. Defaults to the end of `<body>`,\n * which is right for an app that sets its StyleX theme on `:root`. An app\n * that scopes the theme to a subtree has to point this at an element inside\n * it, or the sheet renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\n */\n container?: BaseUIDialogPortalProps['container'];\n};\ntype SheetTitleProps = BaseUIDialogTitleProps;\ntype SheetTriggerProps = BaseUIDialogTriggerProps;\nexport type { SheetCloseProps, SheetContentProps, SheetProps, SheetSize, SheetTitleProps, SheetTriggerProps };\nexport default Sheet;"],"mappings":";;;;;;;AAwBA,MAAM,SAAS;C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CAAA,OAAA,KAAA,EAAA;CAAA,OAFN;AAEM;;;;;;AAQf,SAAA,WAAA,OAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA;EAC4C,KAAA,oBAAoB,EAAA,WACjD,oEACb,GAAG,KAAK;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,SAAA,EAAA,OAAA,IAAA;EAFF,KAAA,oBAAA,OAAA,OAAA;GAAA,GAAwB;GAAK,GAAM;EAEjC,CAAA;EAAI,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAFN;AAEM;;;;;AAOf,SAAA,aAAA,OAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA;EACS,KAAA,oBAAA,OAAA,SAAA,EAAA,GAA0B,MAAK,CAAA;EAAI,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAAnC;AAAmC;AAE5C,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,MAAM,UAAU;AAChB,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,UAAU"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/sheet/index.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport type { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, ModalOverlayProps, ModalRenderProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { Dialog, DialogTrigger, Heading, Modal, ModalOverlay } from 'react-aria-components';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, motion, radii, shadows, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// One component, two presentations. Above the medium breakpoint it is a side\n// sheet pinned to the inline end of the viewport; below it, the same panel\n// becomes a bottom sheet. That is M3's own pairing rather than two components,\n// and it is why nothing here takes a `side` prop — a sheet that stayed on the\n// right at 375px would be a drawer covering the whole screen.\n//\n// The two differ in three things and no more: which edges they are pinned to,\n// which two corners are rounded, and which axis they arrive along.\nconst slideInFromEnd = \"x17cjob-B\";\nconst slideInFromBottom = \"x15b941j-B\";\nconst fadeIn = \"x18re5ia-B\";\n\n// Entry only, so there is no exit animation to wait for and closing is\n// immediate: React Aria keeps a closing panel mounted only while an animation\n// is running on it, and finds none. See the comment on `SheetContent` for why\n// that is a design call rather than a limit of StyleX.\n//\n// React Aria's overlay is three nested elements — the scrim, the panel, and\n// the dialog inside it — so the styles are split the same way: `backdrop` on\n// the scrim, `content` and a size on the panel, `dialog` on the element that\n// carries the role.\nconst styles = {\n backdrop: {\n k44tkh: \"x1vhuh8u\",\n kKVMdj: \"xqcmdr3\",\n kyAemX: \"x1yujl0p\",\n kWkggS: \"x1iqbvzf\",\n kpwlN0: \"x10a8y8t\",\n kVAEAm: \"xixxii4\",\n $$css: true\n },\n body: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kOIVth: \"xxj4525\",\n kORKVm: \"x1odjw0f\",\n kmVPX3: \"xgc26li\",\n $$css: true\n },\n content: {\n k44tkh: \"x1n1nwrg\",\n kKVMdj: \"xu2fq7p x18ihq2d\",\n kyAemX: \"x16dv9tl\",\n kWkggS: \"x1vnz5z6\",\n kT0f0o: \"xkducg2\",\n kVL7Gh: \"xrzall9 xb0nsol\",\n kfmiAY: \"x1a37zkv xys6ro8\",\n krdFHd: \"x6xk272 x9t1vth\",\n kGVxlE: \"x19efjv6\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n krVfgx: \"x1ey2m1c\",\n k87sOh: \"x13vifvy xmpip4z\",\n kt4wiu: \"xtijo5x\",\n kLqNvP: \"xhi6v0a x1upgybz\",\n kskxy: \"x7ab17h x1dexy1j\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"xixxii4\",\n $$css: true\n },\n dialog: {\n kZKoxP: \"x5yr21d\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n k3XXqK: \"x1t137rt\",\n $$css: true\n },\n footer: {\n kLZC3w: \"x12smttz\",\n kPef9Z: \"x13fuv20\",\n kEafiO: \"x178xt8z\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kOIVth: \"x126z3so\",\n kjj79g: \"x13a6bvl\",\n k8WAf4: \"x1uvvd8r\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n header: {\n kGNEyG: \"x6s0dn4\",\n kL6WhQ: \"x1j6faob\",\n kfdmCh: \"x1q0q8m5\",\n kt9PQ7: \"xso031l\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kOIVth: \"x1gka490\",\n kjj79g: \"x1qughib\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n md: {\n kzqmXN: \"x1l2rt3b xwvxfow\",\n $$css: true\n },\n sm: {\n kzqmXN: \"x1m258z3 xwvxfow\",\n $$css: true\n },\n title: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kMv6JI: \"xdy5w5q\",\n kGuDYH: \"xete2z3\",\n k63SB2: \"x14ijtet\",\n kb6lSQ: \"xug9e1u\",\n kLWn49: \"x2divse\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n }\n};\ntype SheetSize = 'md' | 'sm';\n\n// `size` is declared on the root, where a reader expects to set the shape of\n// the whole sheet, but it is `Sheet.Content` that has to apply it. One string\n// through context rather than making the call site repeat it on both.\nconst SheetSizeContext = createContext<SheetSize>('md');\ntype SheetProps = Omit<DialogTriggerProps, 'children'> & {\n children?: ReactNode;\n /**\n * Panel width on the side-sheet presentation: `sm` 320px, `md` 400px.\n * Ignored below the medium breakpoint, where the sheet is full width.\n * @default 'md'\n */\n size?: SheetSize;\n};\n\n/**\n * A modal panel that arrives from the edge of the screen — a side sheet on a\n * wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:\n * pass `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it\n * keep its own.\n *\n * Composed rather than configured by props, because a sheet's header, body,\n * and footer all take arbitrary content — the parts are `Sheet.Content`,\n * `Sheet.Header`, `Sheet.Title`, `Sheet.Body`, and `Sheet.Footer`. A\n * `Button` or `IconButton` placed directly inside `Sheet` opens it, and one\n * given `slot=\"close\"` anywhere inside the content closes it; neither needs\n * a part of its own.\n */\nfunction Sheet({\n children,\n size = 'md',\n ...props\n}: SheetProps) {\n return <DialogTrigger {...props}>\n <SheetSizeContext value={size}>{children}</SheetSizeContext>\n </DialogTrigger>;\n}\nfunction SheetBody(props: HTMLAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x9f619 x78zum5 xdt5ytf x1iyjqo2 xxj4525 x1odjw0f xgc26li\"\n }, props)} />;\n}\n\n/**\n * The panel itself, and the scrim behind it. Everything the sheet shows goes\n * in here; the trigger stays outside it, since the trigger lives in the page\n * while this is portalled out to the end of the body.\n *\n * A press on the scrim closes the sheet unless `isDismissable` says\n * otherwise — React Aria's own default is the reverse, and a sheet that\n * ignores a tap outside it reads as stuck.\n */\nfunction SheetContent({\n children,\n className,\n container,\n isDismissable = true,\n isKeyboardDismissDisabled,\n style,\n ...props\n}: SheetContentProps) {\n const size = useContext(SheetSizeContext);\n return <ModalOverlay isDismissable={isDismissable} isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} className=\"x1vhuh8u xqcmdr3 x1yujl0p x1iqbvzf x10a8y8t xixxii4\">\n <Modal {...mergeStatefulStyles(stylex.props(styles.content, styles[size]), {\n className,\n style\n })}>\n <Dialog {...props} className=\"x5yr21d x9f619 x78zum5 xdt5ytf x1t137rt\">\n {children}\n </Dialog>\n </Modal>\n </ModalOverlay>;\n}\nfunction SheetFooter(props: HTMLAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x12smttz x13fuv20 x178xt8z x9f619 x78zum5 x2lah0s x126z3so x13a6bvl x1uvvd8r x790zyz\"\n }, props)} />;\n}\nfunction SheetHeader(props: HTMLAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x6s0dn4 x1j6faob x1q0q8m5 xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib x1cmllll x790zyz\"\n }, props)} />;\n}\n\n/**\n * Names the sheet. Rendered through React Aria's title slot, which is what\n * points the dialog's `aria-labelledby` at it — a sheet without one announces\n * itself as an unnamed dialog.\n */\nfunction SheetTitle(props: SheetTitleProps) {\n return <Heading slot=\"title\" {...props} {...mergeStyles({\n className: \"x9f619 x139gbkf xdy5w5q xete2z3 x14ijtet xug9e1u x2divse x1ghz6dp\"\n }, props)} />;\n}\nSheet.Body = SheetBody;\nSheet.Content = SheetContent;\nSheet.Footer = SheetFooter;\nSheet.Header = SheetHeader;\nSheet.Title = SheetTitle;\n\n// The dialog's own props, plus the scrim's dismissal settings and the panel's\n// styling. A call site has no reason to know there are three elements:\n// `className` and `style` reach the panel, which is the one worth restyling\n// and positioning, and everything else lands on the dialog.\ntype SheetContentProps = Omit<DialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'isDismissable' | 'isKeyboardDismissDisabled'> & {\n /** A function may compute the class from the panel's render state. */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Where to portal the panel and scrim. Defaults to the end of `<body>`,\n * which is right for an app that sets its StyleX theme on `:root`. An app\n * that scopes the theme to a subtree has to point this at an element inside\n * it, or the sheet renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\n */\n container?: Element;\n /** A function may compute the style from the panel's render state. */\n style?: StyleOrFunction<ModalRenderProps>;\n};\ntype SheetTitleProps = HeadingProps;\nexport type { SheetContentProps, SheetProps, SheetSize, SheetTitleProps };\nexport default Sheet;"],"mappings":";;;;;;;AA8BA,MAAM,SAAS;CACb,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,OAAO;CACT;CACA,OAA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M,UAAU;AAChB,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
2
|
//#region src/components/stack/index.d.ts
|
|
3
3
|
type StackAlign = 'baseline' | 'center' | 'end' | 'start' | 'stretch';
|
|
4
4
|
type StackGap = 'lg' | 'md' | 'none' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs' | 'xxxl';
|
|
@@ -41,7 +41,7 @@ type StackProps = {
|
|
|
41
41
|
* @default false
|
|
42
42
|
*/
|
|
43
43
|
wrap?: boolean;
|
|
44
|
-
} &
|
|
44
|
+
} & RenderComponentProps<'div'>;
|
|
45
45
|
/**
|
|
46
46
|
* A row or a column of children with one gap between them, taken from the
|
|
47
47
|
* spacing scale.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
+
import { useRender } from "../../render/useRender.js";
|
|
2
3
|
import { mergeStyles } from "../../styles/merge.js";
|
|
3
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/stack/index.tsx
|
|
5
5
|
const alignments = {
|
|
6
6
|
baseline: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/stack/index.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/stack/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { spacing } from '../../tokens/design.tokens.stylex';\n\n// Short names rather than the CSS values they map to, so a call site reads\n// `align=\"start\"` instead of `align=\"flex-start\"`. A lookup is unavoidable\n// either way — `alignItems` takes `flex-start` and `justifyContent` takes\n// `space-between`, neither of which is a word anyone wants in a prop.\nconst alignments = {\n baseline: {\n kGNEyG: \"x1pha0wt\",\n $$css: true\n },\n center: {\n kGNEyG: \"x6s0dn4\",\n $$css: true\n },\n end: {\n kGNEyG: \"xuk3077\",\n $$css: true\n },\n start: {\n kGNEyG: \"x1cy8zhl\",\n $$css: true\n },\n stretch: {\n kGNEyG: \"x1qjc9v5\",\n $$css: true\n }\n};\n\n// One key per step of the spacing scale, named exactly as the token group\n// names it, so `gaps[gap]` indexes straight off the prop with no lookup table\n// to keep in sync — the same arrangement Text's type scale uses.\n//\n// `none` is the one key with no token behind it, and deliberately so: zero is\n// the absence of a spacing decision rather than a step of the scale, so there\n// is nothing for the scale to name. It exists because a stack that only wants\n// the direction and the alignment is otherwise a plain flex container written\n// out by hand.\nconst gaps = {\n lg: {\n kOIVth: \"xxj4525\",\n $$css: true\n },\n md: {\n kOIVth: \"x1gka490\",\n $$css: true\n },\n none: {\n kOIVth: \"xxhr3t\",\n $$css: true\n },\n sm: {\n kOIVth: \"x126z3so\",\n $$css: true\n },\n xl: {\n kOIVth: \"xj2l1yv\",\n $$css: true\n },\n xs: {\n kOIVth: \"xzoy561\",\n $$css: true\n },\n xxl: {\n kOIVth: \"xghv2kt\",\n $$css: true\n },\n xxs: {\n kOIVth: \"x14qo01y\",\n $$css: true\n },\n xxxl: {\n kOIVth: \"xvm9ira\",\n $$css: true\n }\n};\nconst justifications = {\n around: {\n kjj79g: \"x1l1ennw\",\n $$css: true\n },\n between: {\n kjj79g: \"x1qughib\",\n $$css: true\n },\n center: {\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n end: {\n kjj79g: \"x13a6bvl\",\n $$css: true\n },\n start: {\n kjj79g: \"x1nhvcw1\",\n $$css: true\n }\n};\nconst styles = {\n base: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n $$css: true\n },\n column: {\n kXwgrk: \"xdt5ytf\",\n $$css: true\n },\n row: {\n kXwgrk: \"x1q0g3np\",\n $$css: true\n },\n wrap: {\n kwnvtZ: \"x1a02dak\",\n $$css: true\n }\n};\ntype StackAlign = 'baseline' | 'center' | 'end' | 'start' | 'stretch';\ntype StackGap = 'lg' | 'md' | 'none' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs' | 'xxxl';\ntype StackJustify = 'around' | 'between' | 'center' | 'end' | 'start';\ntype StackProps = {\n /**\n * How the children line up across the stack: down the inline axis of a\n * column, down the block axis of a row. Left unset, they stretch, which is\n * what makes every card in a column the same width.\n *\n * `start` is what an inline-sized child needs in a column — a Badge or a\n * Chip spans the whole width otherwise.\n */\n align?: StackAlign;\n /**\n * Which way the children run.\n * @default 'column'\n */\n direction?: 'column' | 'row';\n /**\n * The space between children, as a step of the spacing scale. `none` closes\n * it entirely.\n *\n * Worth setting. The default is a middle step, and how much air a group of\n * things wants is the one thing a stack cannot work out for itself.\n * @default 'md'\n */\n gap?: StackGap;\n /**\n * How leftover space is distributed along the stack. Left unset, the\n * children sit at the start and the space collects after them.\n *\n * `between` is the one that puts a headline at one end of a row and its\n * actions at the other.\n */\n justify?: StackJustify;\n /**\n * Lets a row wrap onto further lines rather than overflowing. Has no effect\n * on a column, which has as many lines as it has children.\n * @default false\n */\n wrap?: boolean;\n} & RenderComponentProps<'div'>;\n\n/**\n * A row or a column of children with one gap between them, taken from the\n * spacing scale.\n *\n * Layout only — it paints no surface and wraps no child, so each child is a\n * flex item exactly as it was written. It is the answer to spacing a group of\n * things, which is why no component here carries a margin of its own: the\n * space between two things belongs to whatever holds both of them.\n *\n * `render` swaps the element, for a stack that should be a `<ul>`, a `<nav>`,\n * or a `<section>` rather than a `<div>`.\n */\nfunction Stack({\n align,\n direction = 'column',\n gap = 'md',\n justify,\n render,\n wrap = false,\n ...props\n}: StackProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n ...mergeStyles(stylex.props(styles.base, styles[direction], gaps[gap], align !== undefined && alignments[align], justify !== undefined && justifications[justify], wrap && styles.wrap), props)\n },\n render\n });\n}\nexport type { StackAlign, StackGap, StackJustify, StackProps };\nexport default Stack;"],"mappings":";;;;AAWA,MAAM,aAAa;CACjB,UAAU;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,OAAO;CACT;CACA,KAAK;EACH,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,OAAO;CACT;AACF;AAWA,MAAM,OAAO;CACX,IAAI;EACF,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,OAAO;CACT;CACA,KAAK;EACH,QAAQ;EACR,OAAO;CACT;CACA,KAAK;EACH,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAM,iBAAiB;CACrB,QAAQ;EACN,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,OAAO;CACT;CACA,KAAK;EACH,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAM,SAAS;CACb,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,OAAO;CACT;CACA,KAAK;EACH,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,OAAO;CACT;AACF;;;;;;;;;;;;;AAwDA,SAAS,MAAM,EACb,OACA,YAAY,UACZ,MAAM,MACN,SACA,QACA,OAAO,OACP,GAAG,WACU;CACb,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO;GACL,GAAG;GACH,GAAG,YAAY,MAAa,OAAO,MAAM,OAAO,YAAY,KAAK,MAAM,UAAU,KAAA,KAAa,WAAW,QAAQ,YAAY,KAAA,KAAa,eAAe,UAAU,QAAQ,OAAO,IAAI,GAAG,OAAK;EAChM;EACA;CACF,CAAC;AACH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
//#region src/components/supporting-pane/index.d.ts
|
|
4
|
-
type SupportingPaneProps = Omit<
|
|
4
|
+
type SupportingPaneProps = Omit<RenderComponentProps<'div'>, 'children'> & {
|
|
5
5
|
/** The primary content. Takes two thirds of the width from expanded up. */
|
|
6
6
|
main?: ReactNode;
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { useRender } from "../../render/useRender.js";
|
|
1
2
|
import { mergeStyles } from "../../styles/merge.js";
|
|
2
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
//#region src/components/supporting-pane/index.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useRender","props","main","supporting"],"sources":["../../../src/components/supporting-pane/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":["useRender","props","main","supporting"],"sources":["../../../src/components/supporting-pane/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { media, spacing } from '../../tokens/design.tokens.stylex';\n\n// One of Material 3's canonical layouts. The supporting pane holds content\n// that only means anything next to the main pane — reviewer comments, related\n// items, a tool panel — which is what separates it from list-detail, where\n// the second pane stands on its own.\n//\n// M3 gives this layout three shapes across the breakpoints, and all three are\n// reachable in CSS because none of them depends on what the reader selected:\n// stacked at compact, an even split at medium, two thirds to one third from\n// expanded up. Stacking is M3's \"reflow\" strategy, where the supporting pane\n// moves under the main one rather than being dismissed. The spec's other\n// compact option is a bottom sheet, which is a different component's job —\n// reach for Sheet at the call site when the supporting content should be\n// summoned rather than scrolled to.\n//\n\ntype SupportingPaneProps = Omit<RenderComponentProps<'div'>, 'children'> & {\n /** The primary content. Takes two thirds of the width from expanded up. */\n main?: ReactNode;\n /**\n * Content that only means something beside `main`. Sits below it at compact,\n * and beside it from medium up.\n */\n supporting?: ReactNode;\n};\n\n/**\n * Material 3's supporting pane layout: a main pane and a companion that\n * reflows underneath it when there is no room beside it.\n *\n * Layout only — neither pane paints a surface or a border of its own, so what\n * goes in them is composed at the call site out of Cards, lists, or plain\n * content. `render` swaps the container's element, for a layout that should\n * be a `<main>` rather than a `<div>`.\n *\n * The panes are written to the DOM in the order they are shown, which is what\n * M3 asks of co-planar panes: focus order has to match the arrangement on\n * screen.\n */\nfunction SupportingPane({\n main,\n render,\n supporting,\n ...props\n}: SupportingPaneProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n children: <>\n <div className=\"x9f619 xeuugli\">{main}</div>\n <div className=\"x9f619 xeuugli\">{supporting}</div>\n </>,\n ...mergeStyles({\n className: \"x9f619 xrvj5dj xj2l1yv x1mkdm3x xj1h9sb x1bg1yrb\"\n }, props)\n },\n render\n });\n}\nexport type { SupportingPaneProps };\nexport default SupportingPane;"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA,SAAA,eAAA,IAAA;CAAA,MAAA,IAAA,EAAA,EAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAwB,MAAA,EAAA,MAAA,QAAA,IAAA,YAAA,GAAA,UAAA;EAA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,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAbMD,GAAU,EAahB;AAAC"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { TabListProps, TabPanelProps, TabProps, TabsProps } from "react-aria-components";
|
|
2
3
|
//#region src/components/tabs/index.d.ts
|
|
4
|
+
type TabsProps$1 = Omit<TabsProps, 'children'> & {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
};
|
|
3
7
|
/**
|
|
4
|
-
* A tab strip and its panels. Selection is
|
|
5
|
-
* with `
|
|
6
|
-
* own.
|
|
8
|
+
* A tab strip and its panels. Selection is React Aria's `selectedKey`: pass
|
|
9
|
+
* it with `onSelectionChange` to control it, or `defaultSelectedKey` to let
|
|
10
|
+
* it keep its own. Each `Tabs.Tab` names the `Tabs.Panel` it controls through
|
|
11
|
+
* a shared `id`, and a strip may stand alone without panels.
|
|
7
12
|
*
|
|
8
13
|
* Composed rather than configured by props, because the number of tabs and
|
|
9
14
|
* what each panel holds are the call site's to decide — the parts are
|
|
10
15
|
* `Tabs.List`, `Tabs.Tab`, and `Tabs.Panel`.
|
|
11
16
|
*/
|
|
12
|
-
declare function Tabs$1(props:
|
|
17
|
+
declare function Tabs$1({ children, ...props }: TabsProps$1): import("react").JSX.Element;
|
|
13
18
|
declare namespace Tabs$1 {
|
|
14
19
|
var List: typeof TabsList;
|
|
15
20
|
var Panel: typeof TabsPanel;
|
|
@@ -17,8 +22,10 @@ declare namespace Tabs$1 {
|
|
|
17
22
|
}
|
|
18
23
|
declare function TabsList(props: TabsListProps): import("react").JSX.Element;
|
|
19
24
|
declare function TabsPanel(props: TabsPanelProps): import("react").JSX.Element;
|
|
20
|
-
declare function TabsTab(props: TabsTabProps): import("react").JSX.Element;
|
|
21
|
-
type
|
|
25
|
+
declare function TabsTab({ render, ...props }: TabsTabProps): import("react").JSX.Element;
|
|
26
|
+
type TabsListProps = TabListProps<object>;
|
|
27
|
+
type TabsPanelProps = TabPanelProps;
|
|
28
|
+
type TabsTabProps = TabProps;
|
|
22
29
|
//#endregion
|
|
23
|
-
export { type TabsProps, Tabs$1 as default };
|
|
30
|
+
export { type TabsListProps, type TabsPanelProps, type TabsProps$1 as TabsProps, type TabsTabProps, Tabs$1 as default };
|
|
24
31
|
//# sourceMappingURL=index.d.ts.map
|