oneslash-design-system 2.20.0 → 2.22.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 +34 -1
- package/dist/cases/about-page/profile.d.ts +1 -0
- package/dist/cases/about-page/profile.jsx +64 -0
- package/dist/cases/about-page.md +114 -0
- package/dist/cases/admin-inbox/list.d.ts +1 -0
- package/dist/cases/admin-inbox/list.jsx +104 -0
- package/dist/cases/admin-inbox/split.d.ts +1 -0
- package/dist/cases/admin-inbox/split.jsx +68 -0
- package/dist/cases/admin-inbox.md +254 -0
- package/dist/cases/api-keys.md +1 -1
- package/dist/cases/app-shell/top-tabs.jsx +10 -4
- package/dist/cases/app-shell.md +13 -5
- package/dist/cases/blog-index/cards.d.ts +1 -0
- package/dist/cases/blog-index/cards.jsx +45 -0
- package/dist/cases/blog-index/list.d.ts +1 -0
- package/dist/cases/blog-index/list.jsx +46 -0
- package/dist/cases/blog-index.md +160 -0
- package/dist/cases/changelog/by-month.d.ts +1 -0
- package/dist/cases/changelog/by-month.jsx +70 -0
- package/dist/cases/changelog/one-page.d.ts +1 -0
- package/dist/cases/changelog/one-page.jsx +70 -0
- package/dist/cases/changelog.md +200 -0
- package/dist/cases/code-sample/block.d.ts +1 -0
- package/dist/cases/code-sample/block.jsx +19 -0
- package/dist/cases/code-sample/command.d.ts +1 -0
- package/dist/cases/code-sample/command.jsx +17 -0
- package/dist/cases/code-sample.md +96 -0
- package/dist/cases/contact-page/form.d.ts +1 -0
- package/dist/cases/contact-page/form.jsx +83 -0
- package/dist/cases/contact-page/links.d.ts +1 -0
- package/dist/cases/contact-page/links.jsx +19 -0
- package/dist/cases/contact-page.md +142 -0
- package/dist/cases/docs-component-page/reference.d.ts +1 -0
- package/dist/cases/docs-component-page/reference.jsx +93 -0
- package/dist/cases/docs-component-page.md +144 -0
- package/dist/cases/faq/accordion.d.ts +1 -0
- package/dist/cases/faq/accordion.jsx +25 -0
- package/dist/cases/faq/open-list.d.ts +1 -0
- package/dist/cases/faq/open-list.jsx +27 -0
- package/dist/cases/faq.md +110 -0
- package/dist/cases/feature-grid/cards.d.ts +1 -0
- package/dist/cases/feature-grid/cards.jsx +33 -0
- package/dist/cases/feature-grid/rows.d.ts +1 -0
- package/dist/cases/feature-grid/rows.jsx +30 -0
- package/dist/cases/feature-grid.md +132 -0
- package/dist/cases/image-viewer/gallery.d.ts +1 -0
- package/dist/cases/image-viewer/gallery.jsx +32 -0
- package/dist/cases/image-viewer/single.d.ts +1 -0
- package/dist/cases/image-viewer/single.jsx +25 -0
- package/dist/cases/image-viewer.md +123 -0
- package/dist/cases/landing-hero/centered.d.ts +1 -0
- package/dist/cases/landing-hero/centered.jsx +22 -0
- package/dist/cases/landing-hero/split.d.ts +1 -0
- package/dist/cases/landing-hero/split.jsx +30 -0
- package/dist/cases/landing-hero.md +114 -0
- package/dist/cases/legal-page/sections.d.ts +1 -0
- package/dist/cases/legal-page/sections.jsx +61 -0
- package/dist/cases/legal-page.md +96 -0
- package/dist/cases/long-form-page/article.d.ts +1 -0
- package/dist/cases/long-form-page/article.jsx +58 -0
- package/dist/cases/long-form-page/with-contents.d.ts +1 -0
- package/dist/cases/long-form-page/with-contents.jsx +41 -0
- package/dist/cases/long-form-page.md +170 -0
- package/dist/cases/message-actions/hover-toolbar.jsx +11 -8
- package/dist/cases/message-actions/menu.jsx +10 -7
- package/dist/cases/message-actions.md +19 -13
- package/dist/cases/message-attachments/in-composer.jsx +2 -2
- package/dist/cases/message-attachments/in-message.jsx +16 -11
- package/dist/cases/message-attachments.md +29 -17
- package/dist/cases/one-main-action.md +33 -0
- package/dist/cases/overflow-menu/in-a-header.jsx +9 -6
- package/dist/cases/overflow-menu/on-a-row.jsx +9 -6
- package/dist/cases/overflow-menu.md +16 -10
- package/dist/cases/page-end/cta-band.d.ts +1 -0
- package/dist/cases/page-end/cta-band.jsx +24 -0
- package/dist/cases/page-end/next-link.d.ts +1 -0
- package/dist/cases/page-end/next-link.jsx +18 -0
- package/dist/cases/page-end.md +88 -0
- package/dist/cases/password-gate/inline.d.ts +1 -0
- package/dist/cases/password-gate/inline.jsx +94 -0
- package/dist/cases/password-gate/modal.d.ts +1 -0
- package/dist/cases/password-gate/modal.jsx +81 -0
- package/dist/cases/password-gate/page.d.ts +1 -0
- package/dist/cases/password-gate/page.jsx +82 -0
- package/dist/cases/password-gate.md +351 -0
- package/dist/cases/pricing-section/cards.d.ts +1 -0
- package/dist/cases/pricing-section/cards.jsx +41 -0
- package/dist/cases/pricing-section.md +87 -0
- package/dist/cases/product-cards/grid.d.ts +1 -0
- package/dist/cases/product-cards/grid.jsx +20 -0
- package/dist/cases/product-cards.md +71 -0
- package/dist/cases/reply-feedback/thumbs.jsx +11 -8
- package/dist/cases/reply-feedback/with-reason.jsx +11 -8
- package/dist/cases/reply-feedback.md +20 -14
- package/dist/cases/section-index/cards.d.ts +1 -0
- package/dist/cases/section-index/cards.jsx +25 -0
- package/dist/cases/section-index/list.d.ts +1 -0
- package/dist/cases/section-index/list.jsx +56 -0
- package/dist/cases/section-index.md +140 -0
- package/dist/cases/settings-page/top-tabs.jsx +9 -6
- package/dist/cases/settings-page.md +13 -7
- package/dist/cases/site-header.md +1 -1
- package/dist/cases/site-search/dialog.d.ts +1 -0
- package/dist/cases/site-search/dialog.jsx +131 -0
- package/dist/cases/site-search.md +176 -0
- package/dist/cases/tabbed-panels/tabs.d.ts +1 -0
- package/dist/cases/tabbed-panels/tabs.jsx +40 -0
- package/dist/cases/tabbed-panels.md +81 -0
- package/dist/cases.json +1177 -31
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.jsx +103 -0
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.jsx +2 -2
- package/dist/components/codeBlock.d.ts +26 -0
- package/dist/components/codeBlock.jsx +101 -0
- package/dist/components/lightbox.d.ts +34 -0
- package/dist/components/lightbox.jsx +206 -0
- package/dist/components/linkCard.d.ts +10 -1
- package/dist/components/linkCard.jsx +32 -6
- package/dist/components/menuItem.jsx +1 -1
- package/dist/components/modal.d.ts +10 -2
- package/dist/components/modal.jsx +17 -12
- package/dist/components/pageHeader.jsx +1 -1
- package/dist/components/searchDialog.d.ts +44 -0
- package/dist/components/searchDialog.jsx +152 -0
- package/dist/components/siteHeader.d.ts +13 -2
- package/dist/components/siteHeader.jsx +21 -12
- package/dist/components/tab.d.ts +5 -1
- package/dist/components/tab.jsx +2 -2
- package/dist/components/tabPanel.d.ts +16 -0
- package/dist/components/tabPanel.jsx +12 -0
- package/dist/components/tabsContainer.d.ts +5 -1
- package/dist/components/tabsContainer.jsx +2 -2
- package/dist/components/tag.d.ts +6 -1
- package/dist/components/tag.jsx +10 -5
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/internal/accordion.d.ts +4 -0
- package/dist/internal/accordion.js +53 -0
- package/dist/internal/combobox.d.ts +20 -0
- package/dist/internal/combobox.js +28 -0
- package/dist/internal/highlight.d.ts +5 -0
- package/dist/internal/highlight.js +18 -0
- package/dist/native-mapping.json +31 -1
- package/dist/stories/Accordion.stories.d.ts +11 -0
- package/dist/stories/Accordion.stories.jsx +93 -0
- package/dist/stories/Button.stories.jsx +12 -8
- package/dist/stories/Cases.generated.stories.d.ts +34 -0
- package/dist/stories/Cases.generated.stories.jsx +68 -0
- package/dist/stories/CodeBlock.stories.d.ts +12 -0
- package/dist/stories/CodeBlock.stories.jsx +65 -0
- package/dist/stories/Lightbox.stories.d.ts +11 -0
- package/dist/stories/Lightbox.stories.jsx +83 -0
- package/dist/stories/LinkCard.stories.d.ts +6 -0
- package/dist/stories/LinkCard.stories.jsx +17 -0
- package/dist/stories/MenuItem.stories.d.ts +1 -0
- package/dist/stories/MenuItem.stories.jsx +8 -0
- package/dist/stories/PageHeader.stories.d.ts +2 -0
- package/dist/stories/PageHeader.stories.jsx +13 -0
- package/dist/stories/SearchDialog.stories.d.ts +17 -0
- package/dist/stories/SearchDialog.stories.jsx +111 -0
- package/dist/stories/SiteHeader.stories.d.ts +4 -0
- package/dist/stories/SiteHeader.stories.jsx +89 -0
- package/dist/stories/TabPanel.stories.d.ts +7 -0
- package/dist/stories/TabPanel.stories.jsx +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Accordion's pure helpers, kept out of the public API (index.ts and the package exports do not reach internal/)
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
// The open ids to keep: only ids of real items, in item order, and at most one when only one may be open
|
|
12
|
+
export function normalizeOpen(open, ids, multiple) {
|
|
13
|
+
var known = ids.filter(function (id) { return open.includes(id); });
|
|
14
|
+
return multiple ? known : known.slice(0, 1);
|
|
15
|
+
}
|
|
16
|
+
// The open ids after the item `id` is toggled. In one-open mode opening an item closes the other.
|
|
17
|
+
export function toggleOpen(open, id, multiple) {
|
|
18
|
+
if (open.includes(id))
|
|
19
|
+
return open.filter(function (x) { return x !== id; });
|
|
20
|
+
return multiple ? __spreadArray(__spreadArray([], open, true), [id], false) : [id];
|
|
21
|
+
}
|
|
22
|
+
// The item a `#hash` names (`<prefix>-<item id>`), or null. A malformed hash names no item.
|
|
23
|
+
export function hashItem(hash, prefix, ids) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (hash.length < 2)
|
|
26
|
+
return null;
|
|
27
|
+
var target;
|
|
28
|
+
try {
|
|
29
|
+
target = decodeURIComponent(hash.slice(1));
|
|
30
|
+
}
|
|
31
|
+
catch (_b) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return (_a = ids.find(function (id) { return "".concat(prefix, "-").concat(id) === target; })) !== null && _a !== void 0 ? _a : null;
|
|
35
|
+
}
|
|
36
|
+
// The index of the heading a key moves focus to, or -1 when the key is not one of them.
|
|
37
|
+
// ArrowDown and ArrowUp wrap; Home and End go to the first and the last.
|
|
38
|
+
export function nextHeading(key, current, count) {
|
|
39
|
+
if (count === 0)
|
|
40
|
+
return -1;
|
|
41
|
+
switch (key) {
|
|
42
|
+
case 'ArrowDown':
|
|
43
|
+
return (current + 1) % count;
|
|
44
|
+
case 'ArrowUp':
|
|
45
|
+
return (current - 1 + count) % count;
|
|
46
|
+
case 'Home':
|
|
47
|
+
return 0;
|
|
48
|
+
case 'End':
|
|
49
|
+
return count - 1;
|
|
50
|
+
default:
|
|
51
|
+
return -1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function comboboxProps({ listId, open, activeId }: {
|
|
2
|
+
listId: string;
|
|
3
|
+
open: boolean;
|
|
4
|
+
activeId?: string;
|
|
5
|
+
}): {
|
|
6
|
+
role: "combobox";
|
|
7
|
+
'aria-autocomplete': "list";
|
|
8
|
+
'aria-expanded': boolean;
|
|
9
|
+
'aria-controls': string | undefined;
|
|
10
|
+
'aria-activedescendant': string | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare function comboboxKey(e: {
|
|
13
|
+
key: string;
|
|
14
|
+
isComposing?: boolean;
|
|
15
|
+
keyCode?: number;
|
|
16
|
+
}, active: number, count: number): {
|
|
17
|
+
move: number;
|
|
18
|
+
} | {
|
|
19
|
+
pick: number;
|
|
20
|
+
} | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// The search field that drives a list, kept out of the public API (index.ts and the package exports do not reach internal/).
|
|
2
|
+
// Focus stays in the field: the field is `role="combobox"`, points at the list with `aria-controls` and at the
|
|
3
|
+
// highlighted row with `aria-activedescendant`. The arrows move the highlight and stop at the ends, Enter picks the
|
|
4
|
+
// highlighted row, and Escape is the Modal's (it closes the dialog). The same pattern as the quick-switcher example.
|
|
5
|
+
export function comboboxProps(_a) {
|
|
6
|
+
var listId = _a.listId, open = _a.open, activeId = _a.activeId;
|
|
7
|
+
return {
|
|
8
|
+
role: 'combobox',
|
|
9
|
+
'aria-autocomplete': 'list',
|
|
10
|
+
'aria-expanded': open,
|
|
11
|
+
'aria-controls': open ? listId : undefined,
|
|
12
|
+
'aria-activedescendant': open ? activeId : undefined,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
// What a key in the field does with `count` rows and row `active` highlighted: move the highlight, pick a row, or nothing.
|
|
16
|
+
// An input method (Korean, Japanese, Chinese) uses Enter and the arrows while it composes, so they are left to it.
|
|
17
|
+
export function comboboxKey(e, active, count) {
|
|
18
|
+
if (e.isComposing || e.keyCode === 229 || count === 0)
|
|
19
|
+
return null;
|
|
20
|
+
var at = Math.min(Math.max(active, 0), count - 1);
|
|
21
|
+
if (e.key === 'ArrowDown')
|
|
22
|
+
return { move: Math.min(at + 1, count - 1) };
|
|
23
|
+
if (e.key === 'ArrowUp')
|
|
24
|
+
return { move: Math.max(at - 1, 0) };
|
|
25
|
+
if (e.key === 'Enter')
|
|
26
|
+
return { pick: at };
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SearchDialog's pure helper, kept out of the public API (index.ts and the package exports do not reach internal/)
|
|
2
|
+
var escape = function (word) { return word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); };
|
|
3
|
+
// Splits `text` on the words of `query` (split on white space), ignoring case. Every regex character in a word is
|
|
4
|
+
// taken literally, so 'c++ (beta)' marks 'c++' and '(beta)'. Longer words are tried first, so 'plan' and 'planning'
|
|
5
|
+
// mark all of 'planning'. Empty parts are left out.
|
|
6
|
+
export function highlightParts(text, query) {
|
|
7
|
+
var words = query.trim().split(/\s+/).filter(Boolean);
|
|
8
|
+
if (!text)
|
|
9
|
+
return [];
|
|
10
|
+
if (words.length === 0)
|
|
11
|
+
return [{ text: text, match: false }];
|
|
12
|
+
var pattern = new RegExp("(".concat(words.sort(function (a, b) { return b.length - a.length; }).map(escape).join('|'), ")"), 'gi');
|
|
13
|
+
// With one capture group, split puts each match at an odd index
|
|
14
|
+
return text
|
|
15
|
+
.split(pattern)
|
|
16
|
+
.map(function (part, i) { return ({ text: part, match: i % 2 === 1 }); })
|
|
17
|
+
.filter(function (part) { return part.text !== ''; });
|
|
18
|
+
}
|
package/dist/native-mapping.json
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"components": [
|
|
3
|
+
{
|
|
4
|
+
"ods": "accordion",
|
|
5
|
+
"swiftui": "`DisclosureGroup` per item, with the title as its label",
|
|
6
|
+
"compose": "A `Column` of rows with `AnimatedVisibility` for the panel and `semantics { stateDescription }` on the row",
|
|
7
|
+
"note": "One-open is app state (a selection the groups bind to). Deep links and the heading level are web only."
|
|
8
|
+
},
|
|
3
9
|
{
|
|
4
10
|
"ods": "alert",
|
|
5
11
|
"swiftui": "`ODSBanner` for an inline message; `.alert` for one that needs a decision",
|
|
@@ -28,6 +34,12 @@
|
|
|
28
34
|
"swiftui": "`Toggle` (switch on iOS, `.toggleStyle(.checkbox)` on macOS)",
|
|
29
35
|
"compose": "`Checkbox`"
|
|
30
36
|
},
|
|
37
|
+
{
|
|
38
|
+
"ods": "codeBlock",
|
|
39
|
+
"swiftui": "`ScrollView(.horizontal)` with `Text(code).monospaced().textSelection(.enabled)` and a Copy `Button`",
|
|
40
|
+
"compose": "`SelectionContainer` around a `Text` in the code family with `horizontalScroll`, and a Copy `TextButton`",
|
|
41
|
+
"note": "Show \"Copied\" for 2 seconds only after the write succeeds. No highlighting and no line numbers. One line to paste is a `copyField`."
|
|
42
|
+
},
|
|
31
43
|
{
|
|
32
44
|
"ods": "composer",
|
|
33
45
|
"swiftui": "`TextField(_:text:axis: .vertical)` with `.lineLimit(1...6)` over a toolbar `HStack` of the tool `Button`s and a send `Button`",
|
|
@@ -108,6 +120,12 @@
|
|
|
108
120
|
"compose": "Not applicable: web page pattern",
|
|
109
121
|
"note": "In an app screen: `VStack` / `HStack` / `Grid`; Compose `Column` / `Row` / `LazyVerticalGrid`. `Center` and `Split` are for web pages; a native screen is already one column."
|
|
110
122
|
},
|
|
123
|
+
{
|
|
124
|
+
"ods": "lightbox",
|
|
125
|
+
"swiftui": "`.fullScreenCover` holding a `TabView` with `.tabViewStyle(.page)`, one page per image",
|
|
126
|
+
"compose": "A full-width `Dialog` (`usePlatformDefaultWidth = false`) holding a `HorizontalPager`",
|
|
127
|
+
"note": "Images only. The system pager gives the swipe; keep a Close button and say \"2 of 5\" in the title."
|
|
128
|
+
},
|
|
111
129
|
{
|
|
112
130
|
"ods": "line",
|
|
113
131
|
"swiftui": "`Divider`",
|
|
@@ -156,7 +174,7 @@
|
|
|
156
174
|
"ods": "modal",
|
|
157
175
|
"swiftui": "`.sheet` or `.alert`",
|
|
158
176
|
"compose": "`ModalBottomSheet` or `AlertDialog`",
|
|
159
|
-
"note": "`ModalBottomSheet` needs `@OptIn(ExperimentalMaterial3Api::class)`."
|
|
177
|
+
"note": "`ModalBottomSheet` needs `@OptIn(ExperimentalMaterial3Api::class)`. `size=\"fill\"` is the full-screen cover: `.fullScreenCover` / a full-width `Dialog` (`usePlatformDefaultWidth = false`)."
|
|
160
178
|
},
|
|
161
179
|
{
|
|
162
180
|
"ods": "navigation",
|
|
@@ -216,6 +234,12 @@
|
|
|
216
234
|
"compose": "`RadioButton`s in a `Column` with `Modifier.selectableGroup()`",
|
|
217
235
|
"note": "`variant=\"card\"`: each option is a bordered card with the radio in it, a `Picker` with custom rows on iOS / selectable `Card`s with a `RadioButton` in a `selectableGroup` on Android."
|
|
218
236
|
},
|
|
237
|
+
{
|
|
238
|
+
"ods": "searchDialog",
|
|
239
|
+
"swiftui": "`.searchable` on the screen that lists the results, with `.searchSuggestions` for recent items",
|
|
240
|
+
"compose": "`SearchBar` with its results in the expanded content",
|
|
241
|
+
"note": "The system places the field and moves focus. Say the count, \"Searching\" and a failure as text, not color alone."
|
|
242
|
+
},
|
|
219
243
|
{
|
|
220
244
|
"ods": "sectionIntro",
|
|
221
245
|
"swiftui": "Not applicable: web page pattern",
|
|
@@ -299,6 +323,12 @@
|
|
|
299
323
|
"compose": "`PrimaryTabRow`",
|
|
300
324
|
"note": "One `Tab` inside `TabView` or one segment / one `Tab`. `TabRow` is deprecated in Material 3."
|
|
301
325
|
},
|
|
326
|
+
{
|
|
327
|
+
"ods": "tabPanel",
|
|
328
|
+
"swiftui": "The content view of a `TabView` page, or the view under a segmented `Picker`",
|
|
329
|
+
"compose": "The content under a `PrimaryTabRow`, shown for the selected index",
|
|
330
|
+
"note": "The system tab views already pair a tab with its content and name it for VoiceOver / TalkBack. On the web it adds `role=\"tabpanel\"`."
|
|
331
|
+
},
|
|
302
332
|
{
|
|
303
333
|
"ods": "tableCell",
|
|
304
334
|
"swiftui": "A `TableColumn` content view",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Accordion from "../components/accordion";
|
|
3
|
+
declare const meta: Meta<typeof Accordion>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Accordion>;
|
|
6
|
+
export declare const Faq: Story;
|
|
7
|
+
export declare const OneOpen: Story;
|
|
8
|
+
export declare const Single: Story;
|
|
9
|
+
export declare const DeepLink: Story;
|
|
10
|
+
export declare const DeepLinkJumped: Story;
|
|
11
|
+
export declare const DeepLinkScrolledOn: Story;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { useLayoutEffect } from "react";
|
|
2
|
+
import Accordion from "../components/accordion";
|
|
3
|
+
import SiteHeader from "../components/siteHeader";
|
|
4
|
+
import Paragraph from "../components/paragraph";
|
|
5
|
+
var meta = {
|
|
6
|
+
title: "Components/Accordion",
|
|
7
|
+
component: Accordion,
|
|
8
|
+
argTypes: {
|
|
9
|
+
multiple: { control: "boolean" },
|
|
10
|
+
headingLevel: { control: "select", options: [2, 3, 4] },
|
|
11
|
+
linkable: { control: "boolean" },
|
|
12
|
+
},
|
|
13
|
+
decorators: [function (Story) { return <div style={{ width: 560, maxWidth: "100%" }}><Story /></div>; }],
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
var faq = [
|
|
17
|
+
{
|
|
18
|
+
id: "plans",
|
|
19
|
+
title: "What is the difference between the plans?",
|
|
20
|
+
content: <Paragraph>Free is for trying Acme with a small team. Pro and Business add members, storage and AI agent responses.</Paragraph>,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "refunds",
|
|
24
|
+
title: "Can I get a refund?",
|
|
25
|
+
content: <Paragraph>Write to hello@acme.example within 14 days of a charge and we will return it.</Paragraph>,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "members",
|
|
29
|
+
title: "How do I add a member?",
|
|
30
|
+
content: <Paragraph>Open Settings, then Members, and send an invite by email. They join when they accept.</Paragraph>,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "export",
|
|
34
|
+
title: "Can I export my data?",
|
|
35
|
+
content: <Paragraph>Yes. Settings has an Export button that sends a file to your email.</Paragraph>,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
export var Faq = {
|
|
39
|
+
args: { id: "accordion-faq", items: faq, defaultOpen: ["plans"] },
|
|
40
|
+
};
|
|
41
|
+
export var OneOpen = {
|
|
42
|
+
args: { id: "accordion-one-open", items: faq, multiple: false, defaultOpen: ["refunds"] },
|
|
43
|
+
};
|
|
44
|
+
export var Single = {
|
|
45
|
+
args: { id: "accordion-single", items: faq.slice(0, 1) },
|
|
46
|
+
};
|
|
47
|
+
// Does what the browser does on a server-rendered page: jump to the #hash before any effect runs, so before the
|
|
48
|
+
// SiteHeader has set --os-header-offset. With scrolledOn the person then scrolls on, far from the heading.
|
|
49
|
+
var JumpToHash = function (_a) {
|
|
50
|
+
var _b = _a.scrolledOn, scrolledOn = _b === void 0 ? false : _b;
|
|
51
|
+
useLayoutEffect(function () {
|
|
52
|
+
var _a;
|
|
53
|
+
var id = decodeURIComponent(window.location.hash.slice(1));
|
|
54
|
+
if (id)
|
|
55
|
+
(_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "start", behavior: "instant" });
|
|
56
|
+
if (scrolledOn)
|
|
57
|
+
window.scrollTo({ top: document.documentElement.scrollHeight, behavior: "instant" });
|
|
58
|
+
}, [scrolledOn]);
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
var Page = function (_a) {
|
|
62
|
+
var scrolledOn = _a.scrolledOn, jump = _a.jump;
|
|
63
|
+
return (<div style={{ margin: "-1rem" }}>
|
|
64
|
+
<SiteHeader brand={{ href: "/", name: "Acme" }} links={[{ label: "Features", href: "#features" }]}/>
|
|
65
|
+
<main id="main" tabIndex={-1} style={{ padding: 16 }}>
|
|
66
|
+
<div style={{ height: 1400 }}>Tall page above</div>
|
|
67
|
+
<Accordion id="faq" items={faq} linkable multiple={false}/>
|
|
68
|
+
<div style={{ height: 1400 }}>Tall page below</div>
|
|
69
|
+
</main>
|
|
70
|
+
{jump && <JumpToHash scrolledOn={scrolledOn}/>}
|
|
71
|
+
</div>);
|
|
72
|
+
};
|
|
73
|
+
// For tests/interactions.spec.ts only: under a sticky SiteHeader with a tall page above and below, so `#faq-refunds` has to scroll
|
|
74
|
+
export var DeepLink = {
|
|
75
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
76
|
+
parameters: { layout: "fullscreen" },
|
|
77
|
+
decorators: [],
|
|
78
|
+
render: function () { return <Page />; },
|
|
79
|
+
};
|
|
80
|
+
// For tests/interactions.spec.ts only: the browser's own jump to the #hash happens first, as on a server-rendered page
|
|
81
|
+
export var DeepLinkJumped = {
|
|
82
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
83
|
+
parameters: { layout: "fullscreen" },
|
|
84
|
+
decorators: [],
|
|
85
|
+
render: function () { return <Page jump/>; },
|
|
86
|
+
};
|
|
87
|
+
// For tests/interactions.spec.ts only: jumped, then scrolled to the end of the page (a restored scroll position)
|
|
88
|
+
export var DeepLinkScrolledOn = {
|
|
89
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
90
|
+
parameters: { layout: "fullscreen" },
|
|
91
|
+
decorators: [],
|
|
92
|
+
render: function () { return <Page jump scrolledOn/>; },
|
|
93
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState } from "react";
|
|
2
2
|
import { ChevronDown, ChevronRight, ExternalLink, Plus, Star } from "lucide-react";
|
|
3
3
|
import Button from "../components/button";
|
|
4
|
+
import { Stack } from "../components/layout";
|
|
4
5
|
var meta = {
|
|
5
6
|
title: "Components/Button",
|
|
6
7
|
component: Button,
|
|
@@ -188,15 +189,18 @@ export var Submit = {
|
|
|
188
189
|
<Button size="medium" type="tertiary" state="enabled" label="Reset" htmlType="reset"/>
|
|
189
190
|
</form>); },
|
|
190
191
|
};
|
|
191
|
-
//
|
|
192
|
-
// label stays at the start and the icon sits at the far edge.
|
|
192
|
+
// `fullWidth` fills the container, as a <button> and as a link. A lone label is centered. With an
|
|
193
|
+
// action icon the label stays at the start and the icon sits at the far edge. Without it a link
|
|
194
|
+
// is as wide as its label, even in a stretching Stack.
|
|
193
195
|
export var FullWidth = {
|
|
194
|
-
render: function () { return (<div
|
|
195
|
-
<
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
render: function () { return (<div data-testid="column" style={{ width: "320px" }}>
|
|
197
|
+
<Stack gap="medium">
|
|
198
|
+
<Button size="medium" type="primary" state="enabled" label="Continue" fullWidth/>
|
|
199
|
+
<Button size="medium" type="secondary" state="enabled" label="Add item" decoIcon={Plus} fullWidth/>
|
|
200
|
+
<Button size="medium" type="tertiary" state="enabled" label="Filters" actionIcon={ChevronDown} fullWidth/>
|
|
201
|
+
<Button size="medium" type="primary" state="enabled" label="Link, full width" href="/gallery" fullWidth/>
|
|
202
|
+
<Button size="medium" type="primary" state="enabled" label="Link, fits content" href="/gallery"/>
|
|
203
|
+
</Stack>
|
|
200
204
|
</div>); },
|
|
201
205
|
};
|
|
202
206
|
// For tests/interactions.spec.ts: the ref reaches the <button> and the link, so focus can be moved to them
|
|
@@ -2,9 +2,12 @@ import type { Meta, StoryObj } from "@storybook/react";
|
|
|
2
2
|
declare const meta: Meta;
|
|
3
3
|
export default meta;
|
|
4
4
|
type Story = StoryObj;
|
|
5
|
+
export declare const AboutPage_Profile: Story;
|
|
5
6
|
export declare const AcceptInvite_SignedOut: Story;
|
|
6
7
|
export declare const AcceptInvite_SignedIn: Story;
|
|
7
8
|
export declare const AccountMenu_Menu: Story;
|
|
9
|
+
export declare const AdminInbox_List: Story;
|
|
10
|
+
export declare const AdminInbox_Split: Story;
|
|
8
11
|
export declare const AgentOptions_Cards: Story;
|
|
9
12
|
export declare const AgentPendingReply_Steps: Story;
|
|
10
13
|
export declare const AgentPendingReply_Streaming: Story;
|
|
@@ -21,15 +24,23 @@ export declare const AuthGateLoading_Spinner: Story;
|
|
|
21
24
|
export declare const AuthGateLoading_SpinnerWithLine: Story;
|
|
22
25
|
export declare const BillingPage_SelfServe: Story;
|
|
23
26
|
export declare const BillingPage_BilledElsewhere: Story;
|
|
27
|
+
export declare const BlogIndex_List: Story;
|
|
28
|
+
export declare const BlogIndex_Cards: Story;
|
|
24
29
|
export declare const BreakdownList_Bars: Story;
|
|
25
30
|
export declare const BreakdownList_Table: Story;
|
|
31
|
+
export declare const Changelog_OnePage: Story;
|
|
32
|
+
export declare const Changelog_ByMonth: Story;
|
|
26
33
|
export declare const CheckYourEmail_Page: Story;
|
|
27
34
|
export declare const CheckYourEmail_AlertOnLogin: Story;
|
|
35
|
+
export declare const CodeSample_Block: Story;
|
|
36
|
+
export declare const CodeSample_Command: Story;
|
|
28
37
|
export declare const CollapsibleSearch_Popover: Story;
|
|
29
38
|
export declare const ComposerLimit_Notice: Story;
|
|
30
39
|
export declare const ComposerLimit_NoticeWithAction: Story;
|
|
31
40
|
export declare const ConfirmDestructiveAction_Modal: Story;
|
|
32
41
|
export declare const ConfirmDestructiveAction_Inline: Story;
|
|
42
|
+
export declare const ContactPage_Form: Story;
|
|
43
|
+
export declare const ContactPage_Links: Story;
|
|
33
44
|
export declare const ConversationStarters_Chips: Story;
|
|
34
45
|
export declare const ConversationStarters_None: Story;
|
|
35
46
|
export declare const CreateModal_Quick: Story;
|
|
@@ -42,6 +53,7 @@ export declare const DataTablePage_Paged: Story;
|
|
|
42
53
|
export declare const DataTablePage_AllRows: Story;
|
|
43
54
|
export declare const DeviceLogin_ProviderFirst: Story;
|
|
44
55
|
export declare const DeviceLogin_Popup: Story;
|
|
56
|
+
export declare const DocsComponentPage_Reference: Story;
|
|
45
57
|
export declare const EmailConfirmed_Page: Story;
|
|
46
58
|
export declare const EmailConfirmed_AlertOnLogin: Story;
|
|
47
59
|
export declare const EmptyList_Region: Story;
|
|
@@ -51,11 +63,17 @@ export declare const EmptyNotSetUp_Pointer: Story;
|
|
|
51
63
|
export declare const EmptySearch_ClearSearch: Story;
|
|
52
64
|
export declare const ErrorPage_FullPage: Story;
|
|
53
65
|
export declare const ErrorPage_InShell: Story;
|
|
66
|
+
export declare const Faq_Accordion: Story;
|
|
67
|
+
export declare const Faq_OpenList: Story;
|
|
68
|
+
export declare const FeatureGrid_Cards: Story;
|
|
69
|
+
export declare const FeatureGrid_Rows: Story;
|
|
54
70
|
export declare const FeedbackForm_Modal: Story;
|
|
55
71
|
export declare const FilterMenu_Presets: Story;
|
|
56
72
|
export declare const FilterMenu_WithClear: Story;
|
|
57
73
|
export declare const ForgotPassword_InPlace: Story;
|
|
58
74
|
export declare const ForgotPassword_OwnPage: Story;
|
|
75
|
+
export declare const ImageViewer_Gallery: Story;
|
|
76
|
+
export declare const ImageViewer_Single: Story;
|
|
59
77
|
export declare const ImportChecklist_Modal: Story;
|
|
60
78
|
export declare const InlineFormFeedback_ButtonLabel: Story;
|
|
61
79
|
export declare const InlineFormFeedback_InlineAlert: Story;
|
|
@@ -66,6 +84,9 @@ export declare const InviteMember_ByEmail: Story;
|
|
|
66
84
|
export declare const InviteMember_ByLink: Story;
|
|
67
85
|
export declare const InvoiceList_Table: Story;
|
|
68
86
|
export declare const InvoiceList_WithUpcoming: Story;
|
|
87
|
+
export declare const LandingHero_Centered: Story;
|
|
88
|
+
export declare const LandingHero_Split: Story;
|
|
89
|
+
export declare const LegalPage_Sections: Story;
|
|
69
90
|
export declare const LoadFailure_Region: Story;
|
|
70
91
|
export declare const LoadFailure_Inline: Story;
|
|
71
92
|
export declare const LogOutConfirm_Modal: Story;
|
|
@@ -73,6 +94,8 @@ export declare const LoginPage_Centered: Story;
|
|
|
73
94
|
export declare const LoginPage_Split: Story;
|
|
74
95
|
export declare const LoginPage_ProviderFirst: Story;
|
|
75
96
|
export declare const LoginPage_EmailOnly: Story;
|
|
97
|
+
export declare const LongFormPage_Article: Story;
|
|
98
|
+
export declare const LongFormPage_WithContents: Story;
|
|
76
99
|
export declare const MasterDetail_Split: Story;
|
|
77
100
|
export declare const MasterDetail_ListThenPage: Story;
|
|
78
101
|
export declare const MembersList_Rows: Story;
|
|
@@ -100,10 +123,15 @@ export declare const OnOffSettings_List: Story;
|
|
|
100
123
|
export declare const OnThisPage_Aside: Story;
|
|
101
124
|
export declare const OverflowMenu_OnARow: Story;
|
|
102
125
|
export declare const OverflowMenu_InAHeader: Story;
|
|
126
|
+
export declare const PageEnd_CtaBand: Story;
|
|
127
|
+
export declare const PageEnd_NextLink: Story;
|
|
103
128
|
export declare const PageHeader_Actions: Story;
|
|
104
129
|
export declare const PageHeader_SubPage: Story;
|
|
105
130
|
export declare const PagedCard_Pager: Story;
|
|
106
131
|
export declare const PagedCard_SeeAll: Story;
|
|
132
|
+
export declare const PasswordGate_Page: Story;
|
|
133
|
+
export declare const PasswordGate_Inline: Story;
|
|
134
|
+
export declare const PasswordGate_Modal: Story;
|
|
107
135
|
export declare const PaymentMethod_OnFile: Story;
|
|
108
136
|
export declare const PaymentMethod_None: Story;
|
|
109
137
|
export declare const PlanChangeConfirm_Upgrade: Story;
|
|
@@ -111,6 +139,8 @@ export declare const PlanChangeConfirm_Downgrade: Story;
|
|
|
111
139
|
export declare const PlanChangeConfirm_Blocked: Story;
|
|
112
140
|
export declare const PlanPicker_Cards: Story;
|
|
113
141
|
export declare const PlanPicker_List: Story;
|
|
142
|
+
export declare const PricingSection_Cards: Story;
|
|
143
|
+
export declare const ProductCards_Grid: Story;
|
|
114
144
|
export declare const ProfileForm_Form: Story;
|
|
115
145
|
export declare const QuickSwitcher_Modal: Story;
|
|
116
146
|
export declare const RangeSwitch_Segmented: Story;
|
|
@@ -123,6 +153,8 @@ export declare const ReplySources_TagOnly: Story;
|
|
|
123
153
|
export declare const RouteLoading_FullScreen: Story;
|
|
124
154
|
export declare const RouteLoading_Region: Story;
|
|
125
155
|
export declare const ScopePicker_Menu: Story;
|
|
156
|
+
export declare const SectionIndex_Cards: Story;
|
|
157
|
+
export declare const SectionIndex_List: Story;
|
|
126
158
|
export declare const SetNewPassword_Form: Story;
|
|
127
159
|
export declare const SetNewPassword_InvalidLink: Story;
|
|
128
160
|
export declare const SettingsPage_TopTabs: Story;
|
|
@@ -138,11 +170,13 @@ export declare const SiteFooter_Simple: Story;
|
|
|
138
170
|
export declare const SiteFooter_Columns: Story;
|
|
139
171
|
export declare const SiteHeader_Links: Story;
|
|
140
172
|
export declare const SiteHeader_Sections: Story;
|
|
173
|
+
export declare const SiteSearch_Dialog: Story;
|
|
141
174
|
export declare const SlashCommandList_InComposer: Story;
|
|
142
175
|
export declare const StatRow_Tiles: Story;
|
|
143
176
|
export declare const StatRow_Featured: Story;
|
|
144
177
|
export declare const StatusLabel_Dot: Story;
|
|
145
178
|
export declare const StatusLabel_Text: Story;
|
|
179
|
+
export declare const TabbedPanels_Tabs: Story;
|
|
146
180
|
export declare const TagFilter_Tags: Story;
|
|
147
181
|
export declare const ThemeSwitcher_Menu: Story;
|
|
148
182
|
export declare const ThemeSwitcher_Segmented: Story;
|