reshaped 4.2.0-canary.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +6 -0
- package/dist/bundle.js +2 -2
- package/dist/components/Accordion/AccordionContent.js +1 -1
- package/dist/components/Badge/Badge.js +4 -1
- package/dist/components/Badge/Badge.module.css +1 -1
- package/dist/components/Badge/tests/Badge.stories.d.ts +4 -0
- package/dist/components/Badge/tests/Badge.stories.js +48 -1
- package/dist/components/Button/Button.js +2 -0
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Button/tests/Button.stories.js +1 -0
- package/dist/components/ContentToggle/ContentToggle.d.ts +4 -0
- package/dist/components/ContentToggle/ContentToggle.js +12 -0
- package/dist/components/ContentToggle/ContentToggle.module.css +1 -0
- package/dist/components/ContentToggle/ContentToggle.types.d.ts +16 -0
- package/dist/components/ContentToggle/index.d.ts +2 -0
- package/dist/components/ContentToggle/index.js +1 -0
- package/dist/components/ContentToggle/tests/ContentToggle.stories.d.ts +10 -0
- package/dist/components/ContentToggle/tests/ContentToggle.stories.js +75 -0
- package/dist/components/ContextMenu/ContextMenu.js +5 -4
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +5 -1
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +11 -7
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +18 -1
- package/dist/components/DropdownMenu/DropdownMenu.context.d.ts +11 -0
- package/dist/components/DropdownMenu/DropdownMenu.context.js +19 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +6 -4
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +9 -0
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +1 -0
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +22 -1
- package/dist/components/Expandable/Expandable.d.ts +4 -0
- package/dist/components/Expandable/Expandable.js +85 -0
- package/dist/components/Expandable/Expandable.module.css +1 -0
- package/dist/components/Expandable/Expandable.types.d.ts +18 -0
- package/dist/components/Expandable/Expandable.types.js +1 -0
- package/dist/components/Expandable/index.d.ts +2 -0
- package/dist/components/Expandable/tests/Expandable.stories.d.ts +12 -0
- package/dist/components/Expandable/tests/Expandable.stories.js +82 -0
- package/dist/components/IconToggle/IconToggle.d.ts +4 -0
- package/dist/components/IconToggle/IconToggle.js +13 -0
- package/dist/components/IconToggle/IconToggle.module.css +1 -0
- package/dist/components/IconToggle/IconToggle.types.d.ts +5 -0
- package/dist/components/IconToggle/IconToggle.types.js +1 -0
- package/dist/components/IconToggle/index.d.ts +2 -0
- package/dist/components/IconToggle/index.js +1 -0
- package/dist/components/IconToggle/tests/IconToggle.stories.d.ts +10 -0
- package/dist/components/IconToggle/tests/IconToggle.stories.js +24 -0
- package/dist/components/Image/Image.js +14 -0
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.js +2 -2
- package/dist/components/Link/Link.types.d.ts +1 -1
- package/dist/components/Link/tests/Link.stories.d.ts +2 -1
- package/dist/components/Link/tests/Link.stories.js +7 -1
- package/dist/components/MenuItem/MenuItem.js +14 -2
- package/dist/components/MenuItem/MenuItem.module.css +1 -1
- package/dist/components/Select/Select.module.css +1 -1
- package/dist/components/Select/SelectStartContent.js +2 -0
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/TabsItem.js +6 -1
- package/dist/components/TextField/TextField.js +2 -0
- package/dist/components/TextField/TextField.module.css +1 -1
- package/dist/components/_private/Presence/Presence.d.ts +7 -0
- package/dist/components/_private/Presence/Presence.js +71 -0
- package/dist/components/_private/Presence/Presence.module.css +1 -0
- package/dist/components/_private/Presence/Presence.types.d.ts +45 -0
- package/dist/components/_private/Presence/Presence.types.js +1 -0
- package/dist/components/_private/Presence/index.d.ts +1 -0
- package/dist/components/_private/Presence/index.js +1 -0
- package/dist/hooks/_internal/useSingletonKeyboardMode.js +12 -0
- package/dist/hooks/useOnClickOutside.js +19 -11
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/package.json +3 -3
- package/dist/components/_private/Expandable/Expandable.d.ts +0 -4
- package/dist/components/_private/Expandable/Expandable.js +0 -58
- package/dist/components/_private/Expandable/Expandable.module.css +0 -1
- package/dist/components/_private/Expandable/Expandable.types.d.ts +0 -7
- package/dist/components/_private/Expandable/index.d.ts +0 -1
- /package/dist/components/{_private/Expandable/Expandable.types.js → ContentToggle/ContentToggle.types.js} +0 -0
- /package/dist/components/{_private/Expandable → Expandable}/index.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import Expandable from "../../components/
|
|
4
|
+
import Expandable from "../../components/Expandable";
|
|
5
5
|
import View from "../../components/View";
|
|
6
6
|
import AccordionContext from "./Accordion.context";
|
|
7
7
|
const AccordionContent = (props) => {
|
|
@@ -18,10 +18,13 @@ const Badge = forwardRef((props, ref) => {
|
|
|
18
18
|
const empty = !hasText && !icon && !endIcon;
|
|
19
19
|
const rootClassName = classNames(s.root, className, rounded && s["--rounded"], hidden && s["--hidden"], size && s[`--size-${size}`], color && s[`--color-${color}`], variant && s[`--variant-${variant}`], isActionable && s["--actionable"], highlighted && s["--highlighted"], empty && s["--empty"]);
|
|
20
20
|
const handleDismiss = (e) => {
|
|
21
|
+
// Prevent the parent Actionable from handling the click,
|
|
22
|
+
// including following the link when the badge is rendered as one
|
|
23
|
+
e.preventDefault();
|
|
21
24
|
e.stopPropagation();
|
|
22
25
|
onDismiss?.();
|
|
23
26
|
};
|
|
24
|
-
return (_jsx(Actionable, { onClick: onClick, href: href, className: rootClassName, attributes: attributes, ref: ref, as: as, touchHitbox: isActionable, children: _jsxs("span", { className: s.content, children: [icon && _jsx(Icon, { svg: icon, autoWidth: true, size: iconSize, className: s.icon }), hasText && (_jsx(Text, { variant: size === "large" ? "body-2" : "caption-1", weight: "medium", attributes: {
|
|
27
|
+
return (_jsx(Actionable, { onClick: onClick, href: href, className: rootClassName, attributes: attributes, ref: ref, as: as, touchHitbox: isActionable, children: _jsxs("span", { className: s.content, children: [icon && _jsx(Icon, { svg: icon, autoWidth: true, size: iconSize, className: s.icon }), hasText && (_jsx(Text, { variant: size === "large" ? "body-2" : "caption-1", weight: "medium", className: s.text, attributes: {
|
|
25
28
|
"aria-hidden": hidden ? "true" : undefined,
|
|
26
29
|
}, children: children })), endIcon && _jsx(Icon, { svg: endIcon, autoWidth: true, size: iconSize, className: s.icon }), onDismiss && (_jsx(Actionable, { onClick: handleDismiss, className: s.dismiss, as: "span", attributes: { "aria-label": dismissAriaLabel }, touchHitbox: true, children: _jsx(Icon, { svg: IconClose, size: iconSize }) }))] }) }));
|
|
27
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.root{--rs-badge-border-color:transparent;padding:var(--rs-badge-p-v) var(--rs-badge-p-h);min-width:calc(var(--rs-badge-line-height) + (var(--rs-badge-p-v) * 2));min-height:calc(var(--rs-badge-line-height) + (var(--rs-badge-p-v) * 2));display:inline-flex;align-items:center;justify-content:center;vertical-align:top;border-radius:var(--rs-radius-small);background:var(--rs-color-background-neutral);color:var(--rs-color-on-background-neutral);box-sizing:border-box;box-shadow:0 0 0 1px var(--rs-badge-border-color) inset;backface-visibility:hidden;transition:var(--rs-duration-medium) var(--rs-easing-standard);transition-property:transform,opacity,box-shadow,background-color}.root.--empty{width:var(--rs-badge-empty-size);height:var(--rs-badge-empty-size);min-width:auto;min-height:auto;padding:0}.content{display:inline-flex;align-items:center;gap:var(--rs-badge-gap)}.icon:first-child{margin-inline-start:calc(var(--rs-unit-x0-5) * -1)}.icon:last-child{margin-inline-end:calc(var(--rs-unit-x0-5) * -1)}.icon:only-child{margin-inline:calc(var(--rs-unit-x1) * -1)}.dismiss{border-radius:var(--rs-radius-small);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity}.dismiss:last-child{margin-inline-end:calc(var(--rs-unit-x0-5) * -1)}.root.--highlighted{opacity:.8}@media (hover:hover) and (pointer:fine){.root .dismiss:hover,.root.--actionable:hover:not(:has(.dismiss:hover)){opacity:.8}}.root.--variant-faded{--rs-badge-border-color:var(--rs-color-border-neutral-faded);background:var(--rs-color-background-neutral-faded);color:var(--rs-color-foreground-neutral-faded)}.root.--color-positive{background:var(--rs-color-background-positive);color:var(--rs-color-on-background-positive)}.root.--color-positive.--variant-faded{--rs-badge-border-color:var(--rs-color-border-positive-faded);background:var(--rs-color-background-positive-faded);color:var(--rs-color-foreground-positive)}.root.--color-critical{background:var(--rs-color-background-critical);color:var(--rs-color-on-background-critical)}.root.--color-critical.--variant-faded{--rs-badge-border-color:var(--rs-color-border-critical-faded);background:var(--rs-color-background-critical-faded);color:var(--rs-color-foreground-critical)}.root.--color-warning{background:var(--rs-color-background-warning);color:var(--rs-color-on-background-warning)}.root.--color-warning.--variant-faded{--rs-badge-border-color:var(--rs-color-border-warning-faded);background:var(--rs-color-background-warning-faded);color:var(--rs-color-foreground-warning)}.root.--color-primary{background:var(--rs-color-background-primary);color:var(--rs-color-on-background-primary)}.root.--color-primary.--variant-faded{--rs-badge-border-color:var(--rs-color-border-primary-faded);background:var(--rs-color-background-primary-faded);color:var(--rs-color-foreground-primary)}.root.--size-small{--rs-badge-p-v:calc(var(--rs-unit-x1) / 2);--rs-badge-p-h:var(--rs-unit-x1-5);--rs-badge-line-height:var(--rs-line-height-caption-1);--rs-badge-empty-size:var(--rs-unit-x2);--rs-badge-gap:var(--rs-unit-x1)}.root.--size-medium{--rs-badge-p-v:var(--rs-unit-x1);--rs-badge-p-h:var(--rs-unit-x2);--rs-badge-line-height:var(--rs-line-height-caption-1);--rs-badge-empty-size:var(--rs-unit-x3);--rs-badge-gap:var(--rs-unit-x1)}.root.--size-large{--rs-badge-p-v:var(--rs-unit-x1);--rs-badge-p-h:calc(var(--rs-unit-x0-5) * 5);--rs-badge-line-height:var(--rs-line-height-body-2);--rs-badge-empty-size:var(--rs-unit-x4);--rs-badge-gap:var(--rs-unit-x1-5)}.root.--rounded{border-radius:var(--rs-radius-circular)}.root.--hidden{transform:scale(.2);opacity:0}.container{position:relative;display:inline-block;vertical-align:top}.container .root{position:absolute;z-index:10;inset-inline-end:0;transform:translate(50%,var(--rs-badge-translate-y)) scale(1);user-select:none}.container .root.--hidden{transform:translate(50%,var(--rs-badge-translate-y)) scale(.2)}[dir=rtl] .container .root{transform:translate(-50%,var(--rs-badge-translate-y)) scale(1)}[dir=rtl] .container .root.--hidden{transform:translate(-50%,var(--rs-badge-translate-y)) scale(.2)}.--container-overlap .root{inset-inline-end:14%}.--container-position-top-end .root{--rs-badge-translate-y:-50%;top:0}.--container-position-top-end.--container-overlap .root{top:14%}.--container-position-bottom-end .root{--rs-badge-translate-y:50%;bottom:0}.--container-position-bottom-end.--container-overlap .root{bottom:14%}
|
|
1
|
+
.root{--rs-badge-border-color:transparent;padding:var(--rs-badge-p-v) var(--rs-badge-p-h);min-width:calc(var(--rs-badge-line-height) + (var(--rs-badge-p-v) * 2));min-height:calc(var(--rs-badge-line-height) + (var(--rs-badge-p-v) * 2));display:inline-flex;align-items:center;justify-content:center;vertical-align:top;border-radius:var(--rs-radius-small);background:var(--rs-color-background-neutral);color:var(--rs-color-on-background-neutral);box-sizing:border-box;box-shadow:0 0 0 1px var(--rs-badge-border-color) inset;max-width:100%;backface-visibility:hidden;transition:var(--rs-duration-medium) var(--rs-easing-standard);transition-property:transform,opacity,box-shadow,background-color}.root.--empty{width:var(--rs-badge-empty-size);height:var(--rs-badge-empty-size);min-width:auto;min-height:auto;padding:0}.content{display:inline-flex;align-items:center;gap:var(--rs-badge-gap);max-width:100%;min-width:0}.text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.icon{flex-shrink:0}.icon:first-child{margin-inline-start:calc(var(--rs-unit-x0-5) * -1)}.icon:last-child{margin-inline-end:calc(var(--rs-unit-x0-5) * -1)}.icon:only-child{margin-inline:calc(var(--rs-unit-x1) * -1)}.dismiss{flex-shrink:0;border-radius:var(--rs-radius-small);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity}.dismiss:last-child{margin-inline-end:calc(var(--rs-unit-x0-5) * -1)}.root.--highlighted{opacity:.8}@media (hover:hover) and (pointer:fine){.root .dismiss:hover,.root.--actionable:hover:not(:has(.dismiss:hover)){opacity:.8}}.root.--variant-faded{--rs-badge-border-color:var(--rs-color-border-neutral-faded);background:var(--rs-color-background-neutral-faded);color:var(--rs-color-foreground-neutral-faded)}.root.--color-positive{background:var(--rs-color-background-positive);color:var(--rs-color-on-background-positive)}.root.--color-positive.--variant-faded{--rs-badge-border-color:var(--rs-color-border-positive-faded);background:var(--rs-color-background-positive-faded);color:var(--rs-color-foreground-positive)}.root.--color-critical{background:var(--rs-color-background-critical);color:var(--rs-color-on-background-critical)}.root.--color-critical.--variant-faded{--rs-badge-border-color:var(--rs-color-border-critical-faded);background:var(--rs-color-background-critical-faded);color:var(--rs-color-foreground-critical)}.root.--color-warning{background:var(--rs-color-background-warning);color:var(--rs-color-on-background-warning)}.root.--color-warning.--variant-faded{--rs-badge-border-color:var(--rs-color-border-warning-faded);background:var(--rs-color-background-warning-faded);color:var(--rs-color-foreground-warning)}.root.--color-primary{background:var(--rs-color-background-primary);color:var(--rs-color-on-background-primary)}.root.--color-primary.--variant-faded{--rs-badge-border-color:var(--rs-color-border-primary-faded);background:var(--rs-color-background-primary-faded);color:var(--rs-color-foreground-primary)}.root.--size-small{--rs-badge-p-v:calc(var(--rs-unit-x1) / 2);--rs-badge-p-h:var(--rs-unit-x1-5);--rs-badge-line-height:var(--rs-line-height-caption-1);--rs-badge-empty-size:var(--rs-unit-x2);--rs-badge-gap:var(--rs-unit-x1)}.root.--size-medium{--rs-badge-p-v:var(--rs-unit-x1);--rs-badge-p-h:var(--rs-unit-x2);--rs-badge-line-height:var(--rs-line-height-caption-1);--rs-badge-empty-size:var(--rs-unit-x3);--rs-badge-gap:var(--rs-unit-x1)}.root.--size-large{--rs-badge-p-v:var(--rs-unit-x1);--rs-badge-p-h:calc(var(--rs-unit-x0-5) * 5);--rs-badge-line-height:var(--rs-line-height-body-2);--rs-badge-empty-size:var(--rs-unit-x4);--rs-badge-gap:var(--rs-unit-x1-5)}.root.--rounded{border-radius:var(--rs-radius-circular)}.root.--hidden{transform:scale(.2);opacity:0}.container{position:relative;display:inline-block;vertical-align:top}.container .root{position:absolute;z-index:10;max-width:none;inset-inline-end:0;transform:translate(50%,var(--rs-badge-translate-y)) scale(1);user-select:none}.container .root.--hidden{transform:translate(50%,var(--rs-badge-translate-y)) scale(.2)}[dir=rtl] .container .root{transform:translate(-50%,var(--rs-badge-translate-y)) scale(1)}[dir=rtl] .container .root.--hidden{transform:translate(-50%,var(--rs-badge-translate-y)) scale(.2)}.--container-overlap .root{inset-inline-end:14%}.--container-position-top-end .root{--rs-badge-translate-y:-50%;top:0}.--container-position-top-end.--container-overlap .root{top:14%}.--container-position-bottom-end .root{--rs-badge-translate-y:50%;bottom:0}.--container-position-bottom-end.--container-overlap .root{bottom:14%}
|
|
@@ -45,6 +45,10 @@ export declare const container: {
|
|
|
45
45
|
render: () => React.JSX.Element;
|
|
46
46
|
};
|
|
47
47
|
export declare const href: StoryObj;
|
|
48
|
+
export declare const hrefDismissible: StoryObj<{
|
|
49
|
+
handleDismiss: ReturnType<typeof fn>;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const truncation: StoryObj;
|
|
48
52
|
export declare const onClick: StoryObj<{
|
|
49
53
|
handleClick: ReturnType<typeof fn>;
|
|
50
54
|
}>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.animated = exports.className = exports.onClick = exports.href = exports.container = exports.highlighted = exports.empty = exports.rounded = exports.onDismiss = exports.icon = exports.size = exports.color = void 0;
|
|
6
|
+
exports.animated = exports.className = exports.onClick = exports.truncation = exports.hrefDismissible = exports.href = exports.container = exports.highlighted = exports.empty = exports.rounded = exports.onDismiss = exports.icon = exports.size = exports.color = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const test_1 = require("storybook/test");
|
|
9
9
|
const Avatar_1 = __importDefault(require("../../../components/Avatar"));
|
|
@@ -306,6 +306,53 @@ exports.href = {
|
|
|
306
306
|
(0, test_1.expect)(link).toHaveAttribute("href", "https://reshaped.so");
|
|
307
307
|
},
|
|
308
308
|
};
|
|
309
|
+
exports.hrefDismissible = {
|
|
310
|
+
name: "test: href, onDismiss",
|
|
311
|
+
args: {
|
|
312
|
+
handleDismiss: (0, test_1.fn)(),
|
|
313
|
+
},
|
|
314
|
+
render: (args) => (<Badge_1.default href="#badge-dismiss" onDismiss={args.handleDismiss} dismissAriaLabel="Dismiss">
|
|
315
|
+
Badge
|
|
316
|
+
</Badge_1.default>),
|
|
317
|
+
play: async ({ canvas, args }) => {
|
|
318
|
+
const initialHash = window.location.hash;
|
|
319
|
+
const dismissTrigger = canvas.getByRole("button", { name: "Dismiss" });
|
|
320
|
+
(0, test_1.expect)(canvas.getByRole("link")).toHaveAttribute("href", "#badge-dismiss");
|
|
321
|
+
await test_1.userEvent.click(dismissTrigger);
|
|
322
|
+
(0, test_1.expect)(args.handleDismiss).toHaveBeenCalledTimes(1);
|
|
323
|
+
// Dismissing the badge shouldn't follow the link
|
|
324
|
+
(0, test_1.expect)(window.location.hash).toBe(initialHash);
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
exports.truncation = {
|
|
328
|
+
name: "test: truncation",
|
|
329
|
+
render: () => (<storybook_1.Example>
|
|
330
|
+
<storybook_1.Example.Item title={["truncation", "text is truncated, badge is not wider than 200px"]}>
|
|
331
|
+
<View_1.default width="200px" align="start" gap={3} attributes={{ "data-testid": "root" }}>
|
|
332
|
+
<Badge_1.default attributes={{ "data-testid": "badge" }}>
|
|
333
|
+
Badge with a very long text that should get truncated
|
|
334
|
+
</Badge_1.default>
|
|
335
|
+
<Badge_1.default icon={Plus_1.default} endIcon={Plus_1.default} attributes={{ "data-testid": "badge" }}>
|
|
336
|
+
Badge with a very long text that should get truncated
|
|
337
|
+
</Badge_1.default>
|
|
338
|
+
<Badge_1.default onDismiss={() => { }} dismissAriaLabel="Dismiss" attributes={{ "data-testid": "badge" }}>
|
|
339
|
+
Badge with a very long text that should get truncated
|
|
340
|
+
</Badge_1.default>
|
|
341
|
+
</View_1.default>
|
|
342
|
+
</storybook_1.Example.Item>
|
|
343
|
+
</storybook_1.Example>),
|
|
344
|
+
play: async ({ canvas }) => {
|
|
345
|
+
const badges = canvas.getAllByTestId("badge");
|
|
346
|
+
badges.forEach((badge) => {
|
|
347
|
+
// Badge is not growing wider than its parent
|
|
348
|
+
(0, test_1.expect)(badge.getBoundingClientRect().width).toBeLessThanOrEqual(200);
|
|
349
|
+
// Badge text is rendered on a single line and gets clipped
|
|
350
|
+
const text = badge.querySelector("div");
|
|
351
|
+
(0, test_1.expect)(text.scrollWidth).toBeGreaterThan(text.clientWidth);
|
|
352
|
+
(0, test_1.expect)(getComputedStyle(text).textOverflow).toBe("ellipsis");
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
};
|
|
309
356
|
exports.onClick = {
|
|
310
357
|
name: "onClick",
|
|
311
358
|
args: {
|
|
@@ -23,6 +23,8 @@ const Button = forwardRef((props, ref) => {
|
|
|
23
23
|
return 5;
|
|
24
24
|
if (size === "xlarge")
|
|
25
25
|
return 6;
|
|
26
|
+
if (size === "small")
|
|
27
|
+
return 3.5;
|
|
26
28
|
return 4;
|
|
27
29
|
});
|
|
28
30
|
return (_jsx(Icon, { className: iconClassName, svg: (position === "start" ? icon : endIcon), size: iconSize, autoWidth: true }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.root{--rs-p-v:var(--rs-button-p-v);--rs-p-h:var(--rs-button-p-h);--rs-button-min-size:calc(var(--rs-button-line-height) + var(--rs-button-p-v) * 2);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:background-color,box-shadow,border-color,color,transform,opacity;padding:var(--rs-unit-x1) var(--rs-p-h);border-radius:var(--rs-button-radius);cursor:pointer;position:relative;z-index:0;text-align:initial;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;user-select:none;-webkit-tap-highlight-color:transparent;font-family:var(--rs-font-family-body);font-weight:var(--rs-font-weight-medium);font-size:var(--rs-button-font-size);line-height:var(--rs-button-line-height);letter-spacing:var(--rs-button-letter-spacing);box-sizing:border-box;min-height:var(--rs-button-min-size);min-width:var(--rs-button-min-size);background-color:var(--rs-button-background-color);color:var(--rs-button-color);isolation:isolate}.root:active{transform:scale(.985) translateZ(0)}.root.--highlighted{z-index:var(--rs-z-index-relative)}.root.--highlighted .highlight,.root.--highlighted:not(:has(.highlight)){background-color:var(--rs-button-highlight-color)}@media (hover:hover) and (pointer:fine){.root:hover:not(.--loading) .highlight,.root:hover:not(:has(.highlight),.--loading){background-color:var(--rs-button-highlight-color)}}.text{display:flex;align-items:center;gap:var(--rs-button-gap)}.text>:is(:first-child):not(.label,:only-child){margin-inline-start:calc(var(--rs-button-icon-align) * -1)}.text:not(:only-child)>:is(:last-child):not(.label,:only-child){margin-inline-end:calc(var(--rs-button-icon-align) * -1)}.icon{margin-inline-end:var(--rs-button-gap);margin-inline-start:calc(var(--rs-button-icon-align) * -1)}.icon.--icon-position-end{margin-inline-end:calc(var(--rs-button-icon-align) * -1);margin-inline-start:var(--rs-button-gap)}.--icon-only .icon{margin:0}.icon,.text{position:relative;z-index:var(--rs-z-index-relative)}.loader{display:none;align-items:center;justify-content:center;z-index:var(--rs-z-index-relative)}.highlight,.loader{position:absolute;inset:0}.highlight{pointer-events:none;border-radius:inherit;background-color:transparent;transition:var(--rs-duration-fast) var(--rs-easing-standard);transform:translateZ(0)}.root.--icon-only{--rs-p-h:calc(var(--rs-button-p-h) - var(--rs-unit-x1) / 2)}.root.--loading{cursor:default}.root.--loading .icon,.root.--loading .text{visibility:hidden}.root.--loading .loader{display:flex}.root.--rounded,.root.--rounded:before{border-radius:var(--rs-radius-circular)}.--size-small{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1-5);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width{width:100%;text-align:center}.root.--variant-solid{--rs-button-border-width:0px}.root.--variant-solid.--color-neutral{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-background-color:var(--rs-color-background-neutral);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted);--rs-button-color:var(--rs-color-on-background-neutral)}.root.--variant-solid.--color-primary{--rs-button-group-separator-color:var(--rs-color-border-primary);--rs-button-background-color:var(--rs-color-background-primary);--rs-button-highlight-color:var(--rs-color-background-primary-highlighted);--rs-button-color:var(--rs-color-on-background-primary)}.root.--variant-solid.--color-critical{--rs-button-group-separator-color:var(--rs-color-border-critical);--rs-button-background-color:var(--rs-color-background-critical);--rs-button-highlight-color:var(--rs-color-background-critical-highlighted);--rs-button-color:var(--rs-color-on-background-critical)}.root.--variant-solid.--color-positive{--rs-button-group-separator-color:var(--rs-color-border-positive);--rs-button-background-color:var(--rs-color-background-positive);--rs-button-highlight-color:var(--rs-color-background-positive-highlighted);--rs-button-color:var(--rs-color-on-background-positive)}.root.--variant-solid.--color-media{--rs-button-group-separator-color:rgb(from var(--rs-color-black) r g b/12%);--rs-button-color:var(--rs-color-black);--rs-button-background-color:var(--rs-color-white);--rs-button-highlight-color:rgb(from var(--rs-color-white) r g b/88%)}.root.--variant-outline{--rs-button-border-width:1px}.root.--variant-outline:before{content:"";position:absolute;pointer-events:none;border-radius:inherit;z-index:calc(var(--rs-z-index-relative) - 1);inset:0;border:var(--rs-button-border-width) solid var(--rs-color-border-neutral)}.root.--variant-outline:after{box-shadow:var(--rs-shadow-outline)}.root.--variant-outline.--color-neutral{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-neutral);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-primary{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-primary);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-critical{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-critical);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-positive{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-positive);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-inherit{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:currentcolor;--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-ghost{--rs-button-border-width:0px}.root.--variant-ghost.--color-neutral{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-neutral);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-ghost.--color-primary{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-primary);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-primary-highlighted-faded)}.root.--variant-ghost.--color-critical{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-critical);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-critical-highlighted-faded)}.root.--variant-ghost.--color-positive{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-positive);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-positive-highlighted-faded)}.root.--variant-ghost.--color-inherit{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:inherit;--rs-button-highlight-color:currentcolor}.root.--variant-ghost.--color-inherit .highlight{opacity:.08}.root.--variant-ghost.--color-media{--rs-button-group-separator-color:rgb(from var(--rs-color-white) r g b/12%);--rs-button-color:var(--rs-color-white);--rs-button-background-color:rgb(from var(--rs-color-black) r g b/28%);--rs-button-highlight-color:rgb(from var(--rs-color-black) r g b/12%)}.root.--raised:after,.root.--variant-outline:after{content:"";position:absolute;inset:var(--rs-button-border-width);pointer-events:none;border-radius:inherit;z-index:var(--rs-z-index-relative)}.root.--raised:after{box-shadow:var(--rs-shadow-raised-intense)}.root.--raised.--variant-outline:after,.root.--raised.--variant-solid.--color-neutral:after{box-shadow:var(--rs-shadow-raised)}.root.--raised.--variant-outline{background-color:var(--rs-color-background-elevation-raised)}.root.--disabled:not(.--color-media),.root.--disabled:not(.--color-media).--highlighted,.root.--disabled:not(.--color-media):active:not(.--loading),.root.--disabled:not(.--color-media):hover:not(.--loading){color:var(--rs-color-foreground-disabled)!important;background-color:var(--rs-color-background-disabled)!important}.root.--disabled:not(.--color-media) .highlight,.root.--disabled:not(.--color-media).--highlighted .highlight,.root.--disabled:not(.--color-media):active:not(.--loading) .highlight,.root.--disabled:not(.--color-media):hover:not(.--loading) .highlight{opacity:0!important}.root.--disabled:not(.--color-media).--highlighted.--variant-outline,.root.--disabled:not(.--color-media).--variant-outline,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-outline,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-outline{background-color:transparent!important}.root.--disabled:not(.--color-media).--highlighted.--variant-outline:before,.root.--disabled:not(.--color-media).--variant-outline:before,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-outline:before,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-outline:before{border-color:var(--rs-color-border-disabled)!important}.root.--disabled:not(.--color-media).--highlighted.--variant-outline:after,.root.--disabled:not(.--color-media).--variant-outline:after,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-outline:after,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-outline:after{content:none!important}.root.--disabled:not(.--color-media).--highlighted.--variant-ghost,.root.--disabled:not(.--color-media).--variant-ghost,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-ghost,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-ghost{background-color:transparent!important}.root.--color-media.--disabled,.root.--color-media.--disabled.--highlighted,.root.--color-media.--disabled:active,.root.--color-media.--disabled:hover{opacity:.6!important;background-color:var(--rs-button-background-color)!important}.group{display:inline-flex;position:relative}.group:has(.--full-width){display:flex}.group:has(.--variant-outline):after,.group:has(.--variant-outline):before{border-radius:var(--rs-radius-medium)}.group:has(.--variant-outline):has(.--size-small){border-radius:var(--rs-radius-small)}.group:has(.--variant-outline):before{content:"";position:absolute;pointer-events:none;z-index:calc(var(--rs-z-index-relative) + 1);inset:0;border:1px solid var(--rs-color-border-neutral);border-radius:6px}.group:has(.--variant-outline):after{content:"";position:absolute;inset:1px;pointer-events:none;border-radius:inherit;z-index:calc(var(--rs-z-index-relative) + 1)}.group .root{flex-shrink:0;width:auto}.group .root:active{transform:scale(1) translateZ(0)}.group .root,.group .root .highlight{border-radius:0}.group .root:first-child,.group .root:first-child .highlight{border-start-start-radius:var(--rs-button-radius);border-end-start-radius:var(--rs-button-radius)}.group .root:last-child,.group .root:last-child .highlight{border-start-end-radius:var(--rs-button-radius);border-end-end-radius:var(--rs-button-radius)}.group .root:before{border:none;inset-inline-end:auto;border-radius:0;transition:background-color var(--rs-duration-fast) var(--rs-easing-standard)}.group .root:after{content:none}.group .root:not(:first-child):before{content:"";position:absolute;width:1px;inset-block:var(--rs-unit-x1);inset-inline-start:-.5px;border-radius:var(--rs-radius-circular);background-color:var(--rs-button-group-separator-color)}.group .root.--variant-outline{background:transparent}.group .root.--full-width{flex-grow:1}.aligner{line-height:0}@media (--rs-viewport-m ){.--size-small--m{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1-5);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium--m{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large--m{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge--m{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width-true--m{width:100%;text-align:center}.--full-width-false--m{width:auto;text-align:initial}}@media (--rs-viewport-l ){.--size-small--l{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1-5);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium--l{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large--l{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge--l{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width-true--l{width:100%;text-align:center}.--full-width-false--l{width:auto;text-align:initial}}@media (--rs-viewport-xl ){.--size-small--xl{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1-5);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium--xl{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large--xl{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge--xl{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width-true--xl{width:100%;text-align:center}.--full-width-false--xl{width:auto;text-align:initial}}
|
|
1
|
+
.root{--rs-p-v:var(--rs-button-p-v);--rs-p-h:var(--rs-button-p-h);--rs-button-min-size:calc(var(--rs-button-line-height) + var(--rs-button-p-v) * 2);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:background-color,box-shadow,border-color,color,transform,opacity;padding:var(--rs-unit-x1) var(--rs-p-h);border-radius:var(--rs-button-radius);cursor:pointer;position:relative;z-index:0;text-align:initial;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;user-select:none;-webkit-tap-highlight-color:transparent;font-family:var(--rs-font-family-body);font-weight:var(--rs-font-weight-medium);font-size:var(--rs-button-font-size);line-height:var(--rs-button-line-height);letter-spacing:var(--rs-button-letter-spacing);box-sizing:border-box;min-height:var(--rs-button-min-size);min-width:var(--rs-button-min-size);background-color:var(--rs-button-background-color);color:var(--rs-button-color);isolation:isolate}.root:active{transform:scale(.985) translateZ(0)}.root.--highlighted{z-index:var(--rs-z-index-relative)}.root.--highlighted .highlight,.root.--highlighted:not(:has(.highlight)){background-color:var(--rs-button-highlight-color)}@media (hover:hover) and (pointer:fine){.root:hover:not(.--loading) .highlight,.root:hover:not(:has(.highlight),.--loading){background-color:var(--rs-button-highlight-color)}}.text{display:flex;align-items:center;gap:var(--rs-button-gap)}.text>:is(:first-child):not(.label,:only-child){margin-inline-start:calc(var(--rs-button-icon-align) * -1)}.text:not(:only-child)>:is(:last-child):not(.label,:only-child){margin-inline-end:calc(var(--rs-button-icon-align) * -1)}.icon{margin-inline-end:var(--rs-button-gap);margin-inline-start:calc(var(--rs-button-icon-align) * -1)}.icon.--icon-position-end{margin-inline-end:calc(var(--rs-button-icon-align) * -1);margin-inline-start:var(--rs-button-gap)}.--icon-only .icon{margin:0}.icon,.text{position:relative;z-index:var(--rs-z-index-relative)}.loader{display:none;align-items:center;justify-content:center;z-index:var(--rs-z-index-relative)}.highlight,.loader{position:absolute;inset:0}.highlight{pointer-events:none;border-radius:inherit;background-color:transparent;transition:var(--rs-duration-fast) var(--rs-easing-standard);transform:translateZ(0)}.root.--icon-only{--rs-p-h:calc(var(--rs-button-p-h) - var(--rs-unit-x1) / 2)}.root.--loading{cursor:default}.root.--loading .icon,.root.--loading .text{visibility:hidden}.root.--loading .loader{display:flex}.root.--rounded,.root.--rounded:before{border-radius:var(--rs-radius-circular)}.--size-small{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width{width:100%;text-align:center}.root.--variant-solid{--rs-button-border-width:0px}.root.--variant-solid.--color-neutral{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-background-color:var(--rs-color-background-neutral);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted);--rs-button-color:var(--rs-color-on-background-neutral)}.root.--variant-solid.--color-primary{--rs-button-group-separator-color:var(--rs-color-border-primary);--rs-button-background-color:var(--rs-color-background-primary);--rs-button-highlight-color:var(--rs-color-background-primary-highlighted);--rs-button-color:var(--rs-color-on-background-primary)}.root.--variant-solid.--color-critical{--rs-button-group-separator-color:var(--rs-color-border-critical);--rs-button-background-color:var(--rs-color-background-critical);--rs-button-highlight-color:var(--rs-color-background-critical-highlighted);--rs-button-color:var(--rs-color-on-background-critical)}.root.--variant-solid.--color-positive{--rs-button-group-separator-color:var(--rs-color-border-positive);--rs-button-background-color:var(--rs-color-background-positive);--rs-button-highlight-color:var(--rs-color-background-positive-highlighted);--rs-button-color:var(--rs-color-on-background-positive)}.root.--variant-solid.--color-media{--rs-button-group-separator-color:rgb(from var(--rs-color-black) r g b/12%);--rs-button-color:var(--rs-color-black);--rs-button-background-color:var(--rs-color-white);--rs-button-highlight-color:rgb(from var(--rs-color-white) r g b/88%)}.root.--variant-outline{--rs-button-border-width:1px}.root.--variant-outline:before{content:"";position:absolute;pointer-events:none;border-radius:inherit;z-index:calc(var(--rs-z-index-relative) - 1);inset:0;border:var(--rs-button-border-width) solid var(--rs-color-border-neutral)}.root.--variant-outline:after{box-shadow:var(--rs-shadow-outline)}.root.--variant-outline.--color-neutral{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-neutral);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-primary{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-primary);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-critical{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-critical);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-positive{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:var(--rs-color-foreground-positive);--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-outline.--color-inherit{--rs-button-group-separator-color:var(--rs-color-border-neutral);--rs-button-color:currentcolor;--rs-button-background-color:var(--rs-color-background-elevation-base);--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-ghost{--rs-button-border-width:0px}.root.--variant-ghost.--color-neutral{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-neutral);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-neutral-highlighted-faded)}.root.--variant-ghost.--color-primary{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-primary);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-primary-highlighted-faded)}.root.--variant-ghost.--color-critical{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-critical);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-critical-highlighted-faded)}.root.--variant-ghost.--color-positive{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:var(--rs-color-foreground-positive);--rs-button-background-color:transparent;--rs-button-highlight-color:var(--rs-color-background-positive-highlighted-faded)}.root.--variant-ghost.--color-inherit{--rs-button-group-separator-color:var(--rs-color-border-neutral-faded);--rs-button-color:inherit;--rs-button-highlight-color:currentcolor}.root.--variant-ghost.--color-inherit .highlight{opacity:.08}.root.--variant-ghost.--color-media{--rs-button-group-separator-color:rgb(from var(--rs-color-white) r g b/12%);--rs-button-color:var(--rs-color-white);--rs-button-background-color:rgb(from var(--rs-color-black) r g b/28%);--rs-button-highlight-color:rgb(from var(--rs-color-black) r g b/12%)}.root.--raised:after,.root.--variant-outline:after{content:"";position:absolute;inset:var(--rs-button-border-width);pointer-events:none;border-radius:inherit;z-index:var(--rs-z-index-relative)}.root.--raised:after{box-shadow:var(--rs-shadow-raised-intense)}.root.--raised.--variant-outline:after,.root.--raised.--variant-solid.--color-neutral:after{box-shadow:var(--rs-shadow-raised)}.root.--raised.--variant-outline{background-color:var(--rs-color-background-elevation-raised)}.root.--disabled:not(.--color-media),.root.--disabled:not(.--color-media).--highlighted,.root.--disabled:not(.--color-media):active:not(.--loading),.root.--disabled:not(.--color-media):hover:not(.--loading){color:var(--rs-color-foreground-disabled)!important;background-color:var(--rs-color-background-disabled)!important}.root.--disabled:not(.--color-media) .highlight,.root.--disabled:not(.--color-media).--highlighted .highlight,.root.--disabled:not(.--color-media):active:not(.--loading) .highlight,.root.--disabled:not(.--color-media):hover:not(.--loading) .highlight{opacity:0!important}.root.--disabled:not(.--color-media).--highlighted.--variant-outline,.root.--disabled:not(.--color-media).--variant-outline,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-outline,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-outline{background-color:transparent!important}.root.--disabled:not(.--color-media).--highlighted.--variant-outline:before,.root.--disabled:not(.--color-media).--variant-outline:before,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-outline:before,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-outline:before{border-color:var(--rs-color-border-disabled)!important}.root.--disabled:not(.--color-media).--highlighted.--variant-outline:after,.root.--disabled:not(.--color-media).--variant-outline:after,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-outline:after,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-outline:after{content:none!important}.root.--disabled:not(.--color-media).--highlighted.--variant-ghost,.root.--disabled:not(.--color-media).--variant-ghost,.root.--disabled:not(.--color-media):active:not(.--loading).--variant-ghost,.root.--disabled:not(.--color-media):hover:not(.--loading).--variant-ghost{background-color:transparent!important}.root.--color-media.--disabled,.root.--color-media.--disabled.--highlighted,.root.--color-media.--disabled:active,.root.--color-media.--disabled:hover{opacity:.6!important;background-color:var(--rs-button-background-color)!important}.group{display:inline-flex;position:relative}.group:has(.--full-width){display:flex}.group:has(.--variant-outline):after,.group:has(.--variant-outline):before{border-radius:var(--rs-radius-medium)}.group:has(.--variant-outline):has(.--size-small){border-radius:var(--rs-radius-small)}.group:has(.--variant-outline):before{content:"";position:absolute;pointer-events:none;z-index:calc(var(--rs-z-index-relative) + 1);inset:0;border:1px solid var(--rs-color-border-neutral);border-radius:6px}.group:has(.--variant-outline):after{content:"";position:absolute;inset:1px;pointer-events:none;border-radius:inherit;z-index:calc(var(--rs-z-index-relative) + 1)}.group .root{flex-shrink:0;width:auto}.group .root:active{transform:scale(1) translateZ(0)}.group .root,.group .root .highlight{border-radius:0}.group .root:first-child,.group .root:first-child .highlight{border-start-start-radius:var(--rs-button-radius);border-end-start-radius:var(--rs-button-radius)}.group .root:last-child,.group .root:last-child .highlight{border-start-end-radius:var(--rs-button-radius);border-end-end-radius:var(--rs-button-radius)}.group .root:before{border:none;inset-inline-end:auto;border-radius:0;transition:background-color var(--rs-duration-fast) var(--rs-easing-standard)}.group .root:after{content:none}.group .root:not(:first-child):before{content:"";position:absolute;width:1px;inset-block:var(--rs-unit-x1);inset-inline-start:-.5px;border-radius:var(--rs-radius-circular);background-color:var(--rs-button-group-separator-color)}.group .root.--variant-outline{background:transparent}.group .root.--full-width{flex-grow:1}.aligner{line-height:0}@media (--rs-viewport-m ){.--size-small--m{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium--m{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large--m{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge--m{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width-true--m{width:100%;text-align:center}.--full-width-false--m{width:auto;text-align:initial}}@media (--rs-viewport-l ){.--size-small--l{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium--l{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large--l{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge--l{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width-true--l{width:100%;text-align:center}.--full-width-false--l{width:auto;text-align:initial}}@media (--rs-viewport-xl ){.--size-small--xl{--rs-button-p-v:calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2);--rs-button-p-h:var(--rs-unit-x2);--rs-button-gap:var(--rs-unit-x1);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-caption-1);--rs-button-font-size:var(--rs-font-size-caption-1);--rs-button-letter-spacing:var(--rs-letter-spacing-caption-1);--rs-button-radius:var(--rs-radius-small)}.--size-medium--xl{--rs-button-p-v:var(--rs-unit-x2);--rs-button-p-h:var(--rs-unit-x3);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x0-5);--rs-button-line-height:var(--rs-line-height-body-2);--rs-button-font-size:var(--rs-font-size-body-2);--rs-button-letter-spacing:var(--rs-letter-spacing-body-2);--rs-button-radius:var(--rs-radius-medium)}.--size-large--xl{--rs-button-p-v:var(--rs-unit-x3);--rs-button-p-h:var(--rs-unit-x4);--rs-button-gap:var(--rs-unit-x2);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-body-1);--rs-button-font-size:var(--rs-font-size-body-1);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--size-xlarge--xl{--rs-button-p-v:var(--rs-unit-x4);--rs-button-p-h:var(--rs-unit-x5);--rs-button-gap:var(--rs-unit-x3);--rs-button-icon-align:var(--rs-unit-x1);--rs-button-line-height:var(--rs-line-height-featured-6);--rs-button-font-size:var(--rs-font-size-featured-6);--rs-button-letter-spacing:var(--rs-letter-spacing-body-1);--rs-button-radius:var(--rs-radius-medium)}.--full-width-true--xl{width:100%;text-align:center}.--full-width-false--xl{width:auto;text-align:initial}}
|
|
@@ -151,6 +151,7 @@ exports.size = {
|
|
|
151
151
|
<Button_1.default size="small" variant="ghost" icon={Zap_1.default}>
|
|
152
152
|
Button
|
|
153
153
|
</Button_1.default>
|
|
154
|
+
<Button_1.default size="small" variant="outline" icon={Zap_1.default}/>
|
|
154
155
|
</View_1.default>
|
|
155
156
|
</storybook_1.Example.Item>
|
|
156
157
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
4
|
+
import Presence from "../../components/_private/Presence";
|
|
5
|
+
import s from "./ContentToggle.module.css";
|
|
6
|
+
const ContentToggle = (props) => {
|
|
7
|
+
const { children, id, direction = "end", className, attributes } = props;
|
|
8
|
+
const rootClassName = classNames(s.root, s[`--direction-${direction}`], className);
|
|
9
|
+
return (_jsx(Presence, { as: "div", itemKey: id, className: rootClassName, attributes: attributes, enterClassName: s["--enter"], exitClassName: s["--exit"], children: children }));
|
|
10
|
+
};
|
|
11
|
+
ContentToggle.displayName = "ContentToggle";
|
|
12
|
+
export default ContentToggle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.root{--rs-content-toggle-offset:var(--rs-unit-x2);align-items:start}.--direction-start{--rs-content-toggle-direction:-1}.--direction-end,[dir=rtl] .--direction-start{--rs-content-toggle-direction:1}[dir=rtl] .--direction-end{--rs-content-toggle-direction:-1}.--enter{animation:rs-content-toggle-enter var(--rs-duration-slow) var(--rs-easing-standard)}.--exit{animation:rs-content-toggle-exit var(--rs-duration-slow) var(--rs-easing-standard) forwards}@keyframes rs-content-toggle-enter{0%{opacity:0;transform:translateX(calc(var(--rs-content-toggle-offset) * var(--rs-content-toggle-direction) * -1))}}@keyframes rs-content-toggle-exit{to{opacity:0;transform:translateX(calc(var(--rs-content-toggle-offset) * var(--rs-content-toggle-direction)))}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ClassName } from "@reshaped/utilities";
|
|
3
|
+
import type { Attributes } from "../../types/global";
|
|
4
|
+
export type Direction = "start" | "end";
|
|
5
|
+
export type Props = {
|
|
6
|
+
/** Node for inserting the content */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/** Identity of the currently rendered content, animating the change whenever it changes */
|
|
9
|
+
id?: string | number | boolean;
|
|
10
|
+
/** Side the current content slides out to, while the next one slides in from the opposite one */
|
|
11
|
+
direction?: Direction;
|
|
12
|
+
/** Additional classname for the root element */
|
|
13
|
+
className?: ClassName;
|
|
14
|
+
/** Additional attributes for the root element */
|
|
15
|
+
attributes?: Attributes<"div">;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ContentToggle";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.FC<import("../../../components/ContentToggle").ContentToggleProps>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const example: {
|
|
8
|
+
name: string;
|
|
9
|
+
render: () => React.JSX.Element;
|
|
10
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.example = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Button_1 = __importDefault(require("../../../components/Button"));
|
|
9
|
+
const ContentToggle_1 = __importDefault(require("../../../components/ContentToggle"));
|
|
10
|
+
const Text_1 = __importDefault(require("../../../components/Text"));
|
|
11
|
+
const View_1 = __importDefault(require("../../../components/View"));
|
|
12
|
+
const ChevronLeft_1 = __importDefault(require("../../../icons/ChevronLeft"));
|
|
13
|
+
const ChevronRight_1 = __importDefault(require("../../../icons/ChevronRight"));
|
|
14
|
+
exports.default = {
|
|
15
|
+
title: "Utility components/ContentToggle",
|
|
16
|
+
component: ContentToggle_1.default,
|
|
17
|
+
};
|
|
18
|
+
const chapters = [
|
|
19
|
+
{
|
|
20
|
+
paragraphs: [
|
|
21
|
+
"The troposphere holds almost all of the water vapour on the planet, which makes it the only layer where weather happens. It gets colder the higher you go, right up to the point where the temperature stops falling.",
|
|
22
|
+
"That point is the tropopause, and it works as a lid. Storm clouds flatten out against it instead of growing taller, which is why the tallest ones spread sideways into an anvil.",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
paragraphs: [
|
|
27
|
+
"The stratosphere reverses the pattern and gets warmer with altitude, because the ozone in it absorbs ultraviolet light. That inversion makes the air very stable, so almost nothing mixes vertically.",
|
|
28
|
+
"Long-haul aircraft cruise in the lower part of it for exactly that reason: no convection, no turbulence from rising air, and far less drag than the denser layer below.",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
paragraphs: [
|
|
33
|
+
"In the mesosphere the temperature falls again, down to the coldest point anywhere in the atmosphere. Meteors burn up here, far below the altitude most people imagine.",
|
|
34
|
+
"Higher still, the thermosphere is hot but almost empty, and the aurora forms in it. Somewhere along the way the air simply thins out into space rather than ending at a line.",
|
|
35
|
+
"That point is the tropopause, and it works as a lid. Storm clouds flatten out against it instead of growing taller, which is why the tallest ones spread sideways into an anvil.",
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
exports.example = {
|
|
40
|
+
name: "example",
|
|
41
|
+
render: () => {
|
|
42
|
+
const [index, setIndex] = react_1.default.useState(0);
|
|
43
|
+
// The content follows the direction it moves in: going forward slides it to the start
|
|
44
|
+
const [direction, setDirection] = react_1.default.useState("start");
|
|
45
|
+
const chapter = chapters[index];
|
|
46
|
+
const handleChange = (nextIndex) => {
|
|
47
|
+
setDirection(nextIndex > index ? "start" : "end");
|
|
48
|
+
setIndex(nextIndex);
|
|
49
|
+
};
|
|
50
|
+
return (<View_1.default width="480px">
|
|
51
|
+
<View_1.default gap={3}>
|
|
52
|
+
<View_1.default direction="row" align="center" gap={2}>
|
|
53
|
+
<View_1.default.Item grow>
|
|
54
|
+
<Text_1.default variant="body-2" weight="medium">
|
|
55
|
+
Layers of the atmosphere
|
|
56
|
+
</Text_1.default>
|
|
57
|
+
</View_1.default.Item>
|
|
58
|
+
|
|
59
|
+
<View_1.default direction="row" gap={1}>
|
|
60
|
+
<Button_1.default variant="ghost" size="small" icon={ChevronLeft_1.default} disabled={index === 0} onClick={() => handleChange(index - 1)} attributes={{ "aria-label": "Previous chapter" }}/>
|
|
61
|
+
<Button_1.default size="small" variant="ghost" icon={ChevronRight_1.default} disabled={index === chapters.length - 1} onClick={() => handleChange(index + 1)} attributes={{ "aria-label": "Next chapter" }}/>
|
|
62
|
+
</View_1.default>
|
|
63
|
+
</View_1.default>
|
|
64
|
+
|
|
65
|
+
<ContentToggle_1.default id={index} direction={direction}>
|
|
66
|
+
<View_1.default gap={3}>
|
|
67
|
+
{chapter.paragraphs.map((paragraph) => (<Text_1.default key={paragraph} variant="body-3" color="neutral-faded">
|
|
68
|
+
{paragraph}
|
|
69
|
+
</Text_1.default>))}
|
|
70
|
+
</View_1.default>
|
|
71
|
+
</ContentToggle_1.default>
|
|
72
|
+
</View_1.default>
|
|
73
|
+
</View_1.default>);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -6,9 +6,10 @@ import useHandlerRef from "../../hooks/useHandlerRef";
|
|
|
6
6
|
import useScrollLock from "../../hooks/useScrollLock";
|
|
7
7
|
import s from "./ContextMenu.module.css";
|
|
8
8
|
const ContextMenu = (props) => {
|
|
9
|
-
const { position = "end-top", onOpen, onClose, ...dropdownMenuProps } = props;
|
|
9
|
+
const { position = "end-top", onOpen, onClose, triggerRef, ...dropdownMenuProps } = props;
|
|
10
10
|
const [coordinates, setCoordinates] = React.useState();
|
|
11
|
-
const
|
|
11
|
+
const internalOriginRef = React.useRef(null);
|
|
12
|
+
const originRef = triggerRef || internalOriginRef;
|
|
12
13
|
const { lockScroll, unlockScroll } = useScrollLock({ originRef });
|
|
13
14
|
const onOpenRef = useHandlerRef(onOpen);
|
|
14
15
|
React.useEffect(() => {
|
|
@@ -23,11 +24,11 @@ const ContextMenu = (props) => {
|
|
|
23
24
|
};
|
|
24
25
|
originEl.addEventListener("contextmenu", handleContextMenu);
|
|
25
26
|
return () => originEl.removeEventListener("contextmenu", handleContextMenu);
|
|
26
|
-
}, [lockScroll, onOpenRef]);
|
|
27
|
+
}, [lockScroll, onOpenRef, originRef]);
|
|
27
28
|
React.useEffect(() => {
|
|
28
29
|
return () => unlockScroll();
|
|
29
30
|
}, [unlockScroll]);
|
|
30
|
-
return (_jsx("div", { className: s.root, ref:
|
|
31
|
+
return (_jsx("div", { className: s.root, ref: internalOriginRef, children: _jsx(DropdownMenu, { ...dropdownMenuProps, position: position, originCoordinates: coordinates, active: !!coordinates, onClose: (args) => {
|
|
31
32
|
setCoordinates(undefined);
|
|
32
33
|
unlockScroll();
|
|
33
34
|
onClose?.(args);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type React from "react";
|
|
1
2
|
import type { DropdownMenuInstance, DropdownMenuProps } from "../../components/DropdownMenu";
|
|
2
3
|
export type Instance = DropdownMenuInstance;
|
|
3
|
-
export type Props = Omit<DropdownMenuProps, "active" | "defaultActive"
|
|
4
|
+
export type Props = Omit<DropdownMenuProps, "active" | "defaultActive"> & {
|
|
5
|
+
/** Element that opens the menu on right click, used when it's rendered outside of the ContextMenu */
|
|
6
|
+
triggerRef?: React.RefObject<HTMLElement | null>;
|
|
7
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import { fn } from "storybook/test";
|
|
3
4
|
declare const _default: {
|
|
4
5
|
title: string;
|
|
5
|
-
component:
|
|
6
|
-
Content:
|
|
7
|
-
Item:
|
|
8
|
-
Section:
|
|
9
|
-
SubMenu:
|
|
10
|
-
SubTrigger:
|
|
6
|
+
component: React.FC<import("../../../components/ContextMenu").ContextMenuProps> & {
|
|
7
|
+
Content: React.FC<import("../../DropdownMenu/DropdownMenu.types").ContentProps>;
|
|
8
|
+
Item: React.FC<import("../../DropdownMenu/DropdownMenu.types").ItemProps>;
|
|
9
|
+
Section: React.FC<import("../../DropdownMenu/DropdownMenu.types").SectionProps>;
|
|
10
|
+
SubMenu: React.FC<import("../../DropdownMenu/DropdownMenu.types").SubMenuProps>;
|
|
11
|
+
SubTrigger: React.FC<import("../../DropdownMenu/DropdownMenu.types").SubTriggerProps>;
|
|
11
12
|
};
|
|
12
13
|
parameters: {
|
|
13
14
|
iframe: {
|
|
@@ -18,10 +19,13 @@ declare const _default: {
|
|
|
18
19
|
export default _default;
|
|
19
20
|
export declare const base: {
|
|
20
21
|
name: string;
|
|
21
|
-
render: () =>
|
|
22
|
+
render: () => React.JSX.Element;
|
|
22
23
|
};
|
|
23
24
|
export declare const handlers: StoryObj<{
|
|
24
25
|
handleOpen: ReturnType<typeof fn>;
|
|
25
26
|
handleClose: ReturnType<typeof fn>;
|
|
26
27
|
}>;
|
|
28
|
+
export declare const triggerRef: StoryObj<{
|
|
29
|
+
handleOpen: ReturnType<typeof fn>;
|
|
30
|
+
}>;
|
|
27
31
|
export declare const menu: StoryObj;
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.menu = exports.handlers = exports.base = void 0;
|
|
6
|
+
exports.menu = exports.triggerRef = exports.handlers = exports.base = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
7
8
|
const test_1 = require("storybook/test");
|
|
8
9
|
const ContextMenu_1 = __importDefault(require("../../../components/ContextMenu"));
|
|
9
10
|
const View_1 = __importDefault(require("../../../components/View"));
|
|
@@ -74,6 +75,22 @@ exports.handlers = {
|
|
|
74
75
|
});
|
|
75
76
|
},
|
|
76
77
|
};
|
|
78
|
+
exports.triggerRef = {
|
|
79
|
+
name: "triggerRef",
|
|
80
|
+
render: () => {
|
|
81
|
+
const triggerRef = react_1.default.useRef(null);
|
|
82
|
+
return (<>
|
|
83
|
+
<View_1.default height="200px" backgroundColor="neutral-faded" borderRadius="medium" attributes={{ ref: triggerRef }}/>
|
|
84
|
+
|
|
85
|
+
<ContextMenu_1.default triggerRef={triggerRef}>
|
|
86
|
+
<ContextMenu_1.default.Content>
|
|
87
|
+
<ContextMenu_1.default.Item onClick={() => { }}>Item</ContextMenu_1.default.Item>
|
|
88
|
+
<ContextMenu_1.default.Item onClick={() => { }}>Item</ContextMenu_1.default.Item>
|
|
89
|
+
</ContextMenu_1.default.Content>
|
|
90
|
+
</ContextMenu_1.default>
|
|
91
|
+
</>);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
77
94
|
const menuData = [
|
|
78
95
|
{ label: "Action 1" },
|
|
79
96
|
{ label: "Action 2" },
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type * as T from "./DropdownMenu.types";
|
|
3
|
+
declare const DropdownMenuContext: React.Context<T.Context>;
|
|
4
|
+
export declare const useDropdownMenu: () => T.Context;
|
|
5
|
+
/**
|
|
6
|
+
* Shares the root menu configuration with its items and submenus.
|
|
7
|
+
* Submenus render their own DropdownMenu, so the values they don't
|
|
8
|
+
* define themselves are inherited from the menu they're nested in.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DropdownMenuProvider: React.FC<T.ProviderProps>;
|
|
11
|
+
export default DropdownMenuContext;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
const DropdownMenuContext = React.createContext({});
|
|
5
|
+
export const useDropdownMenu = () => React.useContext(DropdownMenuContext);
|
|
6
|
+
/**
|
|
7
|
+
* Shares the root menu configuration with its items and submenus.
|
|
8
|
+
* Submenus render their own DropdownMenu, so the values they don't
|
|
9
|
+
* define themselves are inherited from the menu they're nested in.
|
|
10
|
+
*/
|
|
11
|
+
export const DropdownMenuProvider = (props) => {
|
|
12
|
+
const { size, children } = props;
|
|
13
|
+
const parentContext = useDropdownMenu();
|
|
14
|
+
const resolvedSize = size ?? parentContext.size;
|
|
15
|
+
const value = React.useMemo(() => ({ size: resolvedSize }), [resolvedSize]);
|
|
16
|
+
return _jsx(DropdownMenuContext.Provider, { value: value, children: children });
|
|
17
|
+
};
|
|
18
|
+
DropdownMenuProvider.displayName = "DropdownMenu.Provider";
|
|
19
|
+
export default DropdownMenuContext;
|
|
@@ -9,12 +9,13 @@ import useHotkeys from "../../hooks/useHotkeys";
|
|
|
9
9
|
import useRTL from "../../hooks/useRTL";
|
|
10
10
|
import * as keys from "../../constants/keys";
|
|
11
11
|
import IconChevronRight from "../../icons/ChevronRight";
|
|
12
|
+
import { DropdownMenuProvider, useDropdownMenu } from "./DropdownMenu.context";
|
|
12
13
|
import s from "./DropdownMenu.module.css";
|
|
13
14
|
const DropdownMenuSubContext = React.createContext(null);
|
|
14
15
|
const DropdownMenuSubTriggerContext = React.createContext(false);
|
|
15
16
|
const DropdownMenu = (props) => {
|
|
16
|
-
const { children, position = "bottom-start", triggerType = "click", trapFocusMode = "action-menu", ...popoverProps } = props;
|
|
17
|
-
return (_jsx(Popover, { ...popoverProps, position: position, padding: 1, trapFocusMode: trapFocusMode, triggerType: triggerType, disableHideAnimation: triggerType !== "hover", children: children }));
|
|
17
|
+
const { children, position = "bottom-start", triggerType = "click", trapFocusMode = "action-menu", size, ...popoverProps } = props;
|
|
18
|
+
return (_jsx(DropdownMenuProvider, { size: size, children: _jsx(Popover, { ...popoverProps, position: position, padding: 1, trapFocusMode: trapFocusMode, triggerType: triggerType, disableHideAnimation: triggerType !== "hover", children: children }) }));
|
|
18
19
|
};
|
|
19
20
|
export const DropdownMenuContent = (props) => {
|
|
20
21
|
const { children, attributes, className } = props;
|
|
@@ -44,8 +45,9 @@ export const DropdownMenuSection = (props) => {
|
|
|
44
45
|
return (_jsx("div", { className: s.section, role: "group", children: children }));
|
|
45
46
|
};
|
|
46
47
|
export const DropdownMenuItem = (props) => {
|
|
47
|
-
const { onClick } = props;
|
|
48
|
+
const { onClick, size } = props;
|
|
48
49
|
const { handleClose } = useFlyoutContext();
|
|
50
|
+
const { size: menuSize } = useDropdownMenu();
|
|
49
51
|
const subTriggerContext = React.useContext(DropdownMenuSubTriggerContext);
|
|
50
52
|
const handleClick = (e) => {
|
|
51
53
|
/**
|
|
@@ -57,7 +59,7 @@ export const DropdownMenuItem = (props) => {
|
|
|
57
59
|
if (onClick)
|
|
58
60
|
onClick(e);
|
|
59
61
|
};
|
|
60
|
-
return (_jsx(MenuItem, { ...props, roundedCorners: true, className: [s.item, props.className], attributes: { role: "menuitem", ...props.attributes }, onClick: handleClick }));
|
|
62
|
+
return (_jsx(MenuItem, { ...props, size: size ?? menuSize, roundedCorners: true, className: [s.item, props.className], attributes: { role: "menuitem", ...props.attributes }, onClick: handleClick }));
|
|
61
63
|
};
|
|
62
64
|
export const DropdownMenuSubMenu = (props) => {
|
|
63
65
|
const { children, position = "end-top", contentGap = 0.5, ...dropdownMenuProps } = props;
|
|
@@ -3,9 +3,18 @@ import type { FlyoutContentProps } from "../../components/Flyout";
|
|
|
3
3
|
import type { MenuItemProps } from "../../components/MenuItem";
|
|
4
4
|
import type { PopoverInstance, PopoverProps } from "../../components/Popover";
|
|
5
5
|
export type Instance = PopoverInstance;
|
|
6
|
+
export type Context = {
|
|
7
|
+
size?: MenuItemProps["size"];
|
|
8
|
+
};
|
|
9
|
+
export type ProviderProps = {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
size?: MenuItemProps["size"];
|
|
12
|
+
};
|
|
6
13
|
export type Props = Pick<PopoverProps, "children" | "position" | "fallbackPositions" | "fallbackAdjustLayout" | "fallbackMinHeight" | "triggerType" | "contentGap" | "contentShift" | "contentMaxHeight" | "contentZIndex" | "onOpen" | "onClose" | "onAfterOpen" | "onAfterClose" | "active" | "defaultActive" | "width" | "disableHideAnimation" | "disableCloseOnOutsideClick" | "instanceRef" | "containerRef" | "positionRef" | "originCoordinates" | "elevation" | "initialFocusRef"> & {
|
|
7
14
|
/** Change component trap focus keyboard behavior and shortcuts */
|
|
8
15
|
trapFocusMode?: Extract<PopoverProps["trapFocusMode"], "action-menu" | "selection-menu"> | false;
|
|
16
|
+
/** Size used by the menu items */
|
|
17
|
+
size?: MenuItemProps["size"];
|
|
9
18
|
};
|
|
10
19
|
export type ContentProps = Pick<FlyoutContentProps, "attributes" | "children" | "className">;
|
|
11
20
|
export type ItemProps = Omit<MenuItemProps, "roundedCorners">;
|
|
@@ -26,6 +26,7 @@ export declare const sections: {
|
|
|
26
26
|
name: string;
|
|
27
27
|
render: () => import("react").JSX.Element;
|
|
28
28
|
};
|
|
29
|
+
export declare const size: StoryObj;
|
|
29
30
|
export declare const submenu: StoryObj;
|
|
30
31
|
export declare const defaultActive: StoryObj<{
|
|
31
32
|
handleOpen: ReturnType<typeof fn>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.testTheme = exports.testScroll = exports.className = exports.activeFalse = exports.active = exports.defaultActive = exports.submenu = exports.sections = exports.position = void 0;
|
|
6
|
+
exports.testTheme = exports.testScroll = exports.className = exports.activeFalse = exports.active = exports.defaultActive = exports.submenu = exports.size = exports.sections = exports.position = void 0;
|
|
7
7
|
const test_1 = require("storybook/test");
|
|
8
8
|
const Button_1 = __importDefault(require("../../../components/Button"));
|
|
9
9
|
const DropdownMenu_1 = __importDefault(require("../../../components/DropdownMenu"));
|
|
@@ -86,6 +86,27 @@ exports.sections = {
|
|
|
86
86
|
</storybook_1.Example.Item>
|
|
87
87
|
</storybook_1.Example>),
|
|
88
88
|
};
|
|
89
|
+
exports.size = {
|
|
90
|
+
name: "size",
|
|
91
|
+
render: () => (<storybook_1.Example>
|
|
92
|
+
<storybook_1.Example.Item title="size: small, inherited by the items and the submenu">
|
|
93
|
+
<DropdownMenu_1.default size="small">
|
|
94
|
+
<DropdownMenu_1.default.Trigger>
|
|
95
|
+
{(attributes) => <Button_1.default attributes={attributes}>Open small</Button_1.default>}
|
|
96
|
+
</DropdownMenu_1.default.Trigger>
|
|
97
|
+
<DropdownMenu_1.default.Content>
|
|
98
|
+
<DropdownMenu_1.default.Item icon={Checkmark_1.default}>Small item</DropdownMenu_1.default.Item>
|
|
99
|
+
<DropdownMenu_1.default.SubMenu>
|
|
100
|
+
<DropdownMenu_1.default.SubTrigger>Small submenu</DropdownMenu_1.default.SubTrigger>
|
|
101
|
+
<DropdownMenu_1.default.Content>
|
|
102
|
+
<DropdownMenu_1.default.Item>Small subitem</DropdownMenu_1.default.Item>
|
|
103
|
+
</DropdownMenu_1.default.Content>
|
|
104
|
+
</DropdownMenu_1.default.SubMenu>
|
|
105
|
+
</DropdownMenu_1.default.Content>
|
|
106
|
+
</DropdownMenu_1.default>
|
|
107
|
+
</storybook_1.Example.Item>
|
|
108
|
+
</storybook_1.Example>),
|
|
109
|
+
};
|
|
89
110
|
exports.submenu = {
|
|
90
111
|
name: "submenu",
|
|
91
112
|
render: () => (<storybook_1.Example>
|