oneslash-design-system 2.24.0 → 2.26.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 +1 -1
- package/dist/DESIGN.md +8 -4
- package/dist/cases/ask-page/answered.jsx +10 -2
- package/dist/cases/ask-page.md +12 -3
- package/dist/cases/billing-page/self-serve.jsx +4 -4
- package/dist/cases/billing-page/trial.d.ts +1 -0
- package/dist/cases/billing-page/trial.jsx +115 -0
- package/dist/cases/billing-page.md +166 -5
- package/dist/cases/collapsible-search/popover.jsx +1 -1
- package/dist/cases/collapsible-search.md +2 -2
- package/dist/cases/cookie-choice/banner.d.ts +1 -0
- package/dist/cases/cookie-choice/banner.jsx +82 -0
- package/dist/cases/cookie-choice/settings.d.ts +1 -0
- package/dist/cases/cookie-choice/settings.jsx +75 -0
- package/dist/cases/cookie-choice.md +234 -0
- package/dist/cases/dashboard/numbers-first.jsx +1 -1
- package/dist/cases/dashboard/work-first.jsx +1 -1
- package/dist/cases/dashboard.md +2 -2
- package/dist/cases/data-table-page/all-rows.jsx +1 -1
- package/dist/cases/data-table-page/paged.jsx +1 -1
- package/dist/cases/data-table-page.md +2 -2
- package/dist/cases/invoice-list/table.jsx +21 -9
- package/dist/cases/invoice-list.md +27 -12
- package/dist/cases/message-reactions/picker.jsx +1 -1
- package/dist/cases/message-reactions.md +2 -2
- package/dist/cases/message-row.md +2 -1
- package/dist/cases/newsletter-signup/inline.d.ts +1 -0
- package/dist/cases/newsletter-signup/inline.jsx +72 -0
- package/dist/cases/newsletter-signup/section.d.ts +1 -0
- package/dist/cases/newsletter-signup/section.jsx +72 -0
- package/dist/cases/newsletter-signup.md +234 -0
- package/dist/cases/number-format.md +6 -2
- package/dist/cases/on-this-page.md +2 -0
- package/dist/cases/people-row/stack.jsx +1 -1
- package/dist/cases/people-row.md +2 -2
- package/dist/cases/plan-comparison/table.d.ts +1 -0
- package/dist/cases/plan-comparison/table.jsx +47 -0
- package/dist/cases/plan-comparison.md +94 -0
- package/dist/cases/plan-picker.md +1 -0
- package/dist/cases/pricing-section.md +1 -1
- package/dist/cases/site-footer/columns.jsx +2 -1
- package/dist/cases/site-footer.md +3 -1
- package/dist/cases/stat-row/tiles.jsx +2 -1
- package/dist/cases/stat-row.md +4 -1
- package/dist/cases/task-header/agent-sets-status.jsx +1 -1
- package/dist/cases/task-header/people-change-status.jsx +1 -1
- package/dist/cases/task-header.md +2 -2
- package/dist/cases.json +245 -28
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +5 -5
- package/dist/components/barChart.jsx +4 -2
- package/dist/components/dateField.jsx +1 -1
- package/dist/components/formatNumber.d.ts +10 -2
- package/dist/components/formatNumber.js +44 -9
- package/dist/components/layout.d.ts +4 -2
- package/dist/components/layout.jsx +13 -2
- package/dist/components/markdown.d.ts +24 -0
- package/dist/components/markdown.jsx +81 -0
- package/dist/components/onThisPage.d.ts +14 -3
- package/dist/components/onThisPage.jsx +72 -8
- package/dist/components/pageShell.d.ts +3 -3
- package/dist/components/pageShell.jsx +6 -5
- package/dist/components/popover.d.ts +5 -1
- package/dist/components/popover.jsx +3 -2
- package/dist/components/progress.jsx +1 -1
- package/dist/components/select.jsx +5 -2
- package/dist/components/statTile.d.ts +1 -1
- package/dist/components/statTile.jsx +7 -2
- package/dist/components/tableCell.d.ts +4 -3
- package/dist/components/tableCell.jsx +2 -2
- package/dist/components/toaster.jsx +81 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/markdown.d.ts +40 -0
- package/dist/internal/markdown.js +577 -0
- package/dist/internal/toaster.d.ts +2 -0
- package/dist/internal/toaster.js +8 -0
- package/dist/native-mapping.json +9 -3
- package/dist/stories/Cases.generated.stories.d.ts +6 -0
- package/dist/stories/Cases.generated.stories.jsx +12 -0
- package/dist/stories/Markdown.stories.d.ts +9 -0
- package/dist/stories/Markdown.stories.jsx +66 -0
- package/dist/stories/OnThisPage.stories.d.ts +1 -0
- package/dist/stories/OnThisPage.stories.jsx +11 -0
- package/dist/stories/Popover.stories.d.ts +2 -0
- package/dist/stories/Popover.stories.jsx +33 -0
- package/dist/stories/StatTile.stories.d.ts +4 -0
- package/dist/stories/StatTile.stories.jsx +47 -2
- package/dist/stories/Toaster.stories.d.ts +4 -0
- package/dist/stories/Toaster.stories.jsx +30 -0
- package/package.json +1 -1
|
@@ -26,6 +26,7 @@ import AuthGateLoading_SpinnerExample from "../cases/auth-gate-loading/spinner";
|
|
|
26
26
|
import AuthGateLoading_SpinnerWithLineExample from "../cases/auth-gate-loading/spinner-with-line";
|
|
27
27
|
import BillingPage_SelfServeExample from "../cases/billing-page/self-serve";
|
|
28
28
|
import BillingPage_BilledElsewhereExample from "../cases/billing-page/billed-elsewhere";
|
|
29
|
+
import BillingPage_TrialExample from "../cases/billing-page/trial";
|
|
29
30
|
import BlogIndex_ListExample from "../cases/blog-index/list";
|
|
30
31
|
import BlogIndex_CardsExample from "../cases/blog-index/cards";
|
|
31
32
|
import Breadcrumb_TrailExample from "../cases/breadcrumb/trail";
|
|
@@ -51,6 +52,8 @@ import ContactPage_FormExample from "../cases/contact-page/form";
|
|
|
51
52
|
import ContactPage_LinksExample from "../cases/contact-page/links";
|
|
52
53
|
import ConversationStarters_ChipsExample from "../cases/conversation-starters/chips";
|
|
53
54
|
import ConversationStarters_NoneExample from "../cases/conversation-starters/none";
|
|
55
|
+
import CookieChoice_BannerExample from "../cases/cookie-choice/banner";
|
|
56
|
+
import CookieChoice_SettingsExample from "../cases/cookie-choice/settings";
|
|
54
57
|
import CreateModal_QuickExample from "../cases/create-modal/quick";
|
|
55
58
|
import CreateModal_WithSettingsExample from "../cases/create-modal/with-settings";
|
|
56
59
|
import DangerZone_CollapsedExample from "../cases/danger-zone/collapsed";
|
|
@@ -130,6 +133,8 @@ import MessageRow_PersonAndAgentExample from "../cases/message-row/person-and-ag
|
|
|
130
133
|
import MessageRow_GroupedExample from "../cases/message-row/grouped";
|
|
131
134
|
import MobileMenu_LinksExample from "../cases/mobile-menu/links";
|
|
132
135
|
import MobileMenu_SectionsExample from "../cases/mobile-menu/sections";
|
|
136
|
+
import NewsletterSignup_InlineExample from "../cases/newsletter-signup/inline";
|
|
137
|
+
import NewsletterSignup_SectionExample from "../cases/newsletter-signup/section";
|
|
133
138
|
import NotFoundPage_FullPageExample from "../cases/not-found-page/full-page";
|
|
134
139
|
import NotFoundPage_InShellExample from "../cases/not-found-page/in-shell";
|
|
135
140
|
import NotificationMenu_MenuExample from "../cases/notification-menu/menu";
|
|
@@ -157,6 +162,7 @@ import PeopleRow_NamesExample from "../cases/people-row/names";
|
|
|
157
162
|
import PlanChangeConfirm_UpgradeExample from "../cases/plan-change-confirm/upgrade";
|
|
158
163
|
import PlanChangeConfirm_DowngradeExample from "../cases/plan-change-confirm/downgrade";
|
|
159
164
|
import PlanChangeConfirm_BlockedExample from "../cases/plan-change-confirm/blocked";
|
|
165
|
+
import PlanComparison_TableExample from "../cases/plan-comparison/table";
|
|
160
166
|
import PlanPicker_CardsExample from "../cases/plan-picker/cards";
|
|
161
167
|
import PlanPicker_ListExample from "../cases/plan-picker/list";
|
|
162
168
|
import PlanSignOff_OneApproverExample from "../cases/plan-sign-off/one-approver";
|
|
@@ -242,6 +248,7 @@ export var AuthGateLoading_Spinner = { render: function () { return <AuthGateLoa
|
|
|
242
248
|
export var AuthGateLoading_SpinnerWithLine = { render: function () { return <AuthGateLoading_SpinnerWithLineExample />; } };
|
|
243
249
|
export var BillingPage_SelfServe = { tags: ["shell"], render: function () { return <BillingPage_SelfServeExample />; } };
|
|
244
250
|
export var BillingPage_BilledElsewhere = { tags: ["shell"], render: function () { return <BillingPage_BilledElsewhereExample />; } };
|
|
251
|
+
export var BillingPage_Trial = { tags: ["shell"], render: function () { return <BillingPage_TrialExample />; } };
|
|
245
252
|
export var BlogIndex_List = { tags: ["shell"], render: function () { return <BlogIndex_ListExample />; } };
|
|
246
253
|
export var BlogIndex_Cards = { tags: ["shell"], render: function () { return <BlogIndex_CardsExample />; } };
|
|
247
254
|
export var Breadcrumb_Trail = { tags: ["shell"], render: function () { return <Breadcrumb_TrailExample />; } };
|
|
@@ -267,6 +274,8 @@ export var ContactPage_Form = { tags: ["shell"], render: function () { return <C
|
|
|
267
274
|
export var ContactPage_Links = { tags: ["shell"], render: function () { return <ContactPage_LinksExample />; } };
|
|
268
275
|
export var ConversationStarters_Chips = { render: function () { return <ConversationStarters_ChipsExample />; } };
|
|
269
276
|
export var ConversationStarters_None = { render: function () { return <ConversationStarters_NoneExample />; } };
|
|
277
|
+
export var CookieChoice_Banner = { tags: ["shell"], render: function () { return <CookieChoice_BannerExample />; } };
|
|
278
|
+
export var CookieChoice_Settings = { tags: ["shell"], render: function () { return <CookieChoice_SettingsExample />; } };
|
|
270
279
|
export var CreateModal_Quick = { render: function () { return <CreateModal_QuickExample />; } };
|
|
271
280
|
export var CreateModal_WithSettings = { render: function () { return <CreateModal_WithSettingsExample />; } };
|
|
272
281
|
export var DangerZone_Collapsed = { render: function () { return <DangerZone_CollapsedExample />; } };
|
|
@@ -346,6 +355,8 @@ export var MessageRow_PersonAndAgent = { render: function () { return <MessageRo
|
|
|
346
355
|
export var MessageRow_Grouped = { render: function () { return <MessageRow_GroupedExample />; } };
|
|
347
356
|
export var MobileMenu_Links = { tags: ["shell"], render: function () { return <MobileMenu_LinksExample />; } };
|
|
348
357
|
export var MobileMenu_Sections = { tags: ["shell"], render: function () { return <MobileMenu_SectionsExample />; } };
|
|
358
|
+
export var NewsletterSignup_Inline = { tags: ["shell"], render: function () { return <NewsletterSignup_InlineExample />; } };
|
|
359
|
+
export var NewsletterSignup_Section = { tags: ["shell"], render: function () { return <NewsletterSignup_SectionExample />; } };
|
|
349
360
|
export var NotFoundPage_FullPage = { render: function () { return <NotFoundPage_FullPageExample />; } };
|
|
350
361
|
export var NotFoundPage_InShell = { render: function () { return <NotFoundPage_InShellExample />; } };
|
|
351
362
|
export var NotificationMenu_Menu = { render: function () { return <NotificationMenu_MenuExample />; } };
|
|
@@ -373,6 +384,7 @@ export var PeopleRow_Names = { render: function () { return <PeopleRow_NamesExam
|
|
|
373
384
|
export var PlanChangeConfirm_Upgrade = { tags: ["shell"], render: function () { return <PlanChangeConfirm_UpgradeExample />; } };
|
|
374
385
|
export var PlanChangeConfirm_Downgrade = { tags: ["shell"], render: function () { return <PlanChangeConfirm_DowngradeExample />; } };
|
|
375
386
|
export var PlanChangeConfirm_Blocked = { tags: ["shell"], render: function () { return <PlanChangeConfirm_BlockedExample />; } };
|
|
387
|
+
export var PlanComparison_Table = { tags: ["shell"], render: function () { return <PlanComparison_TableExample />; } };
|
|
376
388
|
export var PlanPicker_Cards = { tags: ["shell"], render: function () { return <PlanPicker_CardsExample />; } };
|
|
377
389
|
export var PlanPicker_List = { tags: ["shell"], render: function () { return <PlanPicker_ListExample />; } };
|
|
378
390
|
export var PlanSignOff_OneApprover = { render: function () { return <PlanSignOff_OneApproverExample />; } };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Markdown from "../components/markdown";
|
|
3
|
+
declare const meta: Meta<typeof Markdown>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Markdown>;
|
|
6
|
+
export declare const AgentReply: Story;
|
|
7
|
+
export declare const Fallbacks: Story;
|
|
8
|
+
export declare const Streaming: Story;
|
|
9
|
+
export declare const HydrateProbe: Story;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { renderToString } from "react-dom/server";
|
|
3
|
+
import { hydrateRoot } from "react-dom/client";
|
|
4
|
+
import Markdown from "../components/markdown";
|
|
5
|
+
var meta = {
|
|
6
|
+
title: "Components/Markdown",
|
|
7
|
+
component: Markdown,
|
|
8
|
+
argTypes: {
|
|
9
|
+
text: { control: "text" },
|
|
10
|
+
headingLevel: { control: "inline-radio", options: [2, 3] },
|
|
11
|
+
size: { control: "inline-radio", options: ["body1", "body2"] },
|
|
12
|
+
},
|
|
13
|
+
decorators: [function (Story) { return <div style={{ width: 560, maxWidth: "100%" }}><Story /></div>; }],
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
var agentReply = "# Export your projects\n\nYou can export **every project** as a CSV file. The [export guide](https://acme.example/docs/exports) lists each column.\n\n1. Open **Settings** and pick *Exports*.\n2. Choose what goes in the file:\n - Members and their roles\n - Invoices from the last year\n3. Select `Export`. The file arrives by email within a few minutes.\n\n```ts\nconst res = await fetch('https://api.acme.example/v1/exports?format=csv&include=members,invoices,comments,attachments');\n```\n\n---\n\nQuestions? Write to [help@acme.example](mailto:help@acme.example).";
|
|
17
|
+
// Shot at 1024 and 375 (the "shell" tag): the long line scrolls inside the code block, never the page
|
|
18
|
+
export var AgentReply = {
|
|
19
|
+
tags: ["shell"],
|
|
20
|
+
args: { id: "markdown-reply", text: agentReply },
|
|
21
|
+
};
|
|
22
|
+
var fallbacks = "## What did not render\n\n| Plan | Price |\n| --- | ---: |\n| Free | $0 |\n| Pro | $12 |\n\n\n\n<script>alert('hi')</script> <b>raw HTML shows as text</b>\n\n[A link that runs a script](javascript:alert(1)) prints its words with no link.\n\n> A quote reads as its text.";
|
|
23
|
+
// A table is a code block named Table, an image its alt text, and HTML and an unsafe link are text
|
|
24
|
+
export var Fallbacks = {
|
|
25
|
+
tags: ["shell"],
|
|
26
|
+
args: { id: "markdown-fallbacks", text: fallbacks },
|
|
27
|
+
};
|
|
28
|
+
// A reply still streaming: the fence is not closed yet, so the code runs to the end
|
|
29
|
+
export var Streaming = {
|
|
30
|
+
tags: ["shell"],
|
|
31
|
+
args: {
|
|
32
|
+
id: "markdown-streaming",
|
|
33
|
+
text: "Add the client, then call it:\n\n```ts\nimport { Acme } from 'acme';\n\nconst acme = new Acme({ key: process.env.ACME_KEY });\nawait acme.exports.cre",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// Test-only: the server markup is put on the page, then React hydrates it. `data-hydrated` says it is done.
|
|
37
|
+
function HydrateBox() {
|
|
38
|
+
var ref = useRef(null);
|
|
39
|
+
var _a = useState(false), done = _a[0], setDone = _a[1];
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var el = ref.current;
|
|
42
|
+
if (!el)
|
|
43
|
+
return;
|
|
44
|
+
var reply = <Markdown id="markdown-hydrate" text={"".concat(agentReply, "\n\n").concat(fallbacks)}/>;
|
|
45
|
+
el.innerHTML = renderToString(reply);
|
|
46
|
+
var before = el.innerHTML;
|
|
47
|
+
var root = hydrateRoot(el, reply);
|
|
48
|
+
// Hydration finishes within a frame or two; the markup must not have changed
|
|
49
|
+
requestAnimationFrame(function () {
|
|
50
|
+
return requestAnimationFrame(function () {
|
|
51
|
+
el.dataset.same = String(el.innerHTML === before);
|
|
52
|
+
setDone(true);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
return function () {
|
|
56
|
+
setTimeout(function () { return root.unmount(); });
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
59
|
+
return (<div data-hydrated={done ? "true" : "false"}>
|
|
60
|
+
<div ref={ref}/>
|
|
61
|
+
</div>);
|
|
62
|
+
}
|
|
63
|
+
export var HydrateProbe = {
|
|
64
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
65
|
+
render: function () { return <HydrateBox />; },
|
|
66
|
+
};
|
|
@@ -103,3 +103,14 @@ export var HashScrolledProbe = {
|
|
|
103
103
|
<JumpToHash scrolledOn/>
|
|
104
104
|
</Bleed>); },
|
|
105
105
|
};
|
|
106
|
+
// For tests/interactions.spec.ts only: Probe with the address replaced and the heading kept in view. Scroll anchoring
|
|
107
|
+
// is off, as in a browser without it, so only OnThisPage can hold the heading when something loads above it
|
|
108
|
+
export var KeepProbe = {
|
|
109
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
110
|
+
render: function () { return (<Bleed>
|
|
111
|
+
<style>{"html, body { overflow-anchor: none; }"}</style>
|
|
112
|
+
<PageShell id="main" aside={<OnThisPage items={items} history="replace" keepInView/>}>
|
|
113
|
+
<Sections />
|
|
114
|
+
</PageShell>
|
|
115
|
+
</Bleed>); },
|
|
116
|
+
};
|
|
@@ -62,3 +62,36 @@ export var ClearAnchorProbe = {
|
|
|
62
62
|
tags: ["!dev", "!autodocs", "test-only"],
|
|
63
63
|
render: function () { return <ClearAnchorProbeBox />; },
|
|
64
64
|
};
|
|
65
|
+
// A Popover is a dialog and takes a name from `aria-label` or `aria-labelledby`. Around a Menu it stays unnamed.
|
|
66
|
+
var NamesProbeBox = function (_a) {
|
|
67
|
+
var labelled = _a.labelled;
|
|
68
|
+
var _b = useState(null), anchor = _b[0], setAnchor = _b[1];
|
|
69
|
+
var _c = useState(null), menuAnchor = _c[0], setMenuAnchor = _c[1];
|
|
70
|
+
return (<div style={{ padding: "100px" }}>
|
|
71
|
+
<button type="button" onClick={function (event) { return setAnchor(anchor ? null : event.currentTarget); }}>
|
|
72
|
+
Open named
|
|
73
|
+
</button>
|
|
74
|
+
<button type="button" onClick={function (event) { return setMenuAnchor(menuAnchor ? null : event.currentTarget); }}>
|
|
75
|
+
Open menu
|
|
76
|
+
</button>
|
|
77
|
+
{labelled ? (<Popover open={anchor !== null} anchorEl={anchor} onClose={function () { return setAnchor(null); }} aria-labelledby="names-probe-title">
|
|
78
|
+
<p id="names-probe-title">Details title</p>
|
|
79
|
+
</Popover>) : (<Popover open={anchor !== null} anchorEl={anchor} onClose={function () { return setAnchor(null); }} aria-label="Details">
|
|
80
|
+
<p>Details body</p>
|
|
81
|
+
</Popover>)}
|
|
82
|
+
<Popover open={menuAnchor !== null} anchorEl={menuAnchor} onClose={function () { return setMenuAnchor(null); }}>
|
|
83
|
+
<Menu navigable aria-label="Row actions" width={180}>
|
|
84
|
+
<MenuItem label="Edit" iconName="Edit" onClick={function () { return setMenuAnchor(null); }}/>
|
|
85
|
+
</Menu>
|
|
86
|
+
</Popover>
|
|
87
|
+
</div>);
|
|
88
|
+
};
|
|
89
|
+
export var NamesProbe = {
|
|
90
|
+
// For tests/interactions.spec.ts only: hidden from the sidebar and the docs, and skipped by the visual gate
|
|
91
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
92
|
+
render: function () { return <NamesProbeBox />; },
|
|
93
|
+
};
|
|
94
|
+
export var LabelledByProbe = {
|
|
95
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
96
|
+
render: function () { return <NamesProbeBox labelled/>; },
|
|
97
|
+
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import StatTile from "../components/statTile";
|
|
3
3
|
import { Grid } from "../components/layout";
|
|
4
|
+
import AppShell from "../components/appShell";
|
|
5
|
+
import SidePane from "../components/sidePane";
|
|
6
|
+
import Navigation, { NavigationGroup } from "../components/navigation";
|
|
7
|
+
import MenuItem from "../components/menuItem";
|
|
8
|
+
import Paragraph from "../components/paragraph";
|
|
4
9
|
var meta = {
|
|
5
10
|
title: "Components/StatTile",
|
|
6
11
|
component: StatTile,
|
|
@@ -16,7 +21,11 @@ var meta = {
|
|
|
16
21
|
loading: { control: "boolean" },
|
|
17
22
|
size: { control: "select", options: ["default", "large"] },
|
|
18
23
|
},
|
|
19
|
-
|
|
24
|
+
// A story that is a whole page sets `parameters.bleed` and gets no frame
|
|
25
|
+
decorators: [function (Story, _a) {
|
|
26
|
+
var parameters = _a.parameters;
|
|
27
|
+
return (parameters.bleed ? <Story /> : <div style={{ maxWidth: 720, padding: 16 }}><Story /></div>);
|
|
28
|
+
}],
|
|
20
29
|
};
|
|
21
30
|
export default meta;
|
|
22
31
|
export var Default = {
|
|
@@ -53,3 +62,39 @@ export var States = {
|
|
|
53
62
|
export var Large = {
|
|
54
63
|
args: { id: "stattile-large", label: "Monthly revenue", value: 48210, format: "money", previous: 44000, period: "month", size: "large", caption: "7 of 8 seats used" },
|
|
55
64
|
};
|
|
65
|
+
// A percent tile says its change in points: 12% against 9% is 'Up 3 pts', not 'Up 33%'
|
|
66
|
+
export var Percent = {
|
|
67
|
+
args: { id: "stattile-percent", label: "Open rate", value: 0.12, format: "percent", previous: 0.09 },
|
|
68
|
+
};
|
|
69
|
+
// Four tiles at their widest values inside an AppShell. Shot at 768px (the "tablet" tag).
|
|
70
|
+
// The probe arg `pane` opens a SidePane, which tests/interactions.spec.ts uses at 1280px.
|
|
71
|
+
function InAppShellBox(_a) {
|
|
72
|
+
var pane = _a.pane;
|
|
73
|
+
var _b = useState(false), navOpen = _b[0], setNavOpen = _b[1];
|
|
74
|
+
var _c = useState(pane), paneOpen = _c[0], setPaneOpen = _c[1];
|
|
75
|
+
return (<div>
|
|
76
|
+
<AppShell title="Overview" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={<Navigation aria-label="Main">
|
|
77
|
+
<NavigationGroup label="Reports">
|
|
78
|
+
<MenuItem size="small" iconName="LayoutDashboard" label="Overview" isSelected aria-current="page"/>
|
|
79
|
+
<MenuItem size="small" iconName="Users" label="People"/>
|
|
80
|
+
</NavigationGroup>
|
|
81
|
+
</Navigation>} pane={paneOpen && <SidePane title="Notes" onClose={function () { return setPaneOpen(false); }}><Paragraph>Numbers update every hour.</Paragraph></SidePane>}>
|
|
82
|
+
<Grid compact columns={4} from="lg">
|
|
83
|
+
<StatTile id="stattile-shell-revenue" label="Revenue" value={12400} format="money" previous={11000}/>
|
|
84
|
+
<StatTile id="stattile-shell-responses" label="Responses" value={1234567} previous={1000000}/>
|
|
85
|
+
<StatTile id="stattile-shell-time" label="Average time" value={8640000} format="duration" previous={9200000}/>
|
|
86
|
+
<StatTile id="stattile-shell-storage" label="Storage" value={1288490188} format="bytes" caption="of 5 GB"/>
|
|
87
|
+
</Grid>
|
|
88
|
+
</AppShell>
|
|
89
|
+
</div>);
|
|
90
|
+
}
|
|
91
|
+
export var InAppShell = {
|
|
92
|
+
tags: ["tablet"],
|
|
93
|
+
parameters: { layout: "fullscreen", bleed: true },
|
|
94
|
+
argTypes: { pane: { control: "boolean" } },
|
|
95
|
+
args: { pane: false },
|
|
96
|
+
render: function (_a) {
|
|
97
|
+
var pane = _a.pane;
|
|
98
|
+
return <InAppShellBox pane={pane}/>;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -27,3 +27,33 @@ var StackDemo = function () {
|
|
|
27
27
|
export var Stack = {
|
|
28
28
|
render: function () { return <StackDemo />; },
|
|
29
29
|
};
|
|
30
|
+
var AnnouncerProbeDemo = function (_a) {
|
|
31
|
+
var onMount = _a.onMount;
|
|
32
|
+
var ids = useRef([]);
|
|
33
|
+
var show = function (input) { return ids.current.push(toast(input)); };
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
if (onMount)
|
|
36
|
+
show({ type: "success", message: "Workspace ready" });
|
|
37
|
+
return function () {
|
|
38
|
+
ids.current.forEach(dismissToast);
|
|
39
|
+
ids.current = [];
|
|
40
|
+
};
|
|
41
|
+
}, [onMount]);
|
|
42
|
+
return (<div style={{ display: "flex", flexWrap: "wrap", gap: "8px" }}>
|
|
43
|
+
<Button size="small" type="secondary" state="enabled" label="One Toast" onClickButton={function () { return show({ type: "success", message: "Invite sent" }); }}/>
|
|
44
|
+
<Button size="small" type="secondary" state="enabled" label="Three Toasts" onClickButton={function () {
|
|
45
|
+
show({ type: "success", message: "Q3 plan deleted" });
|
|
46
|
+
show({ type: "info", message: "Sync runs every hour", secondMessage: "The next one starts at 1:00 PM." });
|
|
47
|
+
show({ type: "warning", message: "Two seats left" });
|
|
48
|
+
}}/>
|
|
49
|
+
<Button size="small" type="secondary" state="enabled" label="Same Toast Twice" onClickButton={function () { show("Copied"); show("Copied"); }}/>
|
|
50
|
+
<Button size="small" type="secondary" state="enabled" label="Error Toast" onClickButton={function () { return show({ type: "error", message: "Could not upload photo.jpg" }); }}/>
|
|
51
|
+
<Toaster />
|
|
52
|
+
</div>);
|
|
53
|
+
};
|
|
54
|
+
export var AnnouncerProbe = {
|
|
55
|
+
// For tests/interactions.spec.ts only: hidden from the sidebar and the docs, and skipped by the visual gate
|
|
56
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
57
|
+
args: { onMount: false },
|
|
58
|
+
render: function (args) { return <AnnouncerProbeDemo {...args}/>; },
|
|
59
|
+
};
|