oneslash-design-system 2.22.0 → 2.23.1
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 +12 -1
- package/dist/cases/admin-inbox/split.jsx +22 -10
- package/dist/cases/admin-inbox.md +28 -23
- package/dist/cases/api-keys.md +1 -1
- package/dist/cases/breadcrumb/back-link.d.ts +1 -0
- package/dist/cases/breadcrumb/back-link.jsx +23 -0
- package/dist/cases/breadcrumb/trail.d.ts +1 -0
- package/dist/cases/breadcrumb/trail.jsx +28 -0
- package/dist/cases/breadcrumb.md +105 -0
- package/dist/cases/date-field/calendar.d.ts +1 -0
- package/dist/cases/date-field/calendar.jsx +80 -0
- package/dist/cases/date-field/typed.d.ts +1 -0
- package/dist/cases/date-field/typed.jsx +58 -0
- package/dist/cases/date-field.md +232 -0
- package/dist/cases/docs-component-page/reference.jsx +11 -1
- package/dist/cases/docs-component-page.md +19 -8
- package/dist/cases/file-upload/files.d.ts +1 -0
- package/dist/cases/file-upload/files.jsx +118 -0
- package/dist/cases/file-upload/picture.d.ts +1 -0
- package/dist/cases/file-upload/picture.jsx +50 -0
- package/dist/cases/file-upload.md +270 -0
- package/dist/cases/filter-menu.md +1 -1
- package/dist/cases/image-viewer/with-video.d.ts +1 -0
- package/dist/cases/image-viewer/with-video.jsx +42 -0
- package/dist/cases/image-viewer.md +72 -4
- package/dist/cases/master-detail/split.jsx +17 -10
- package/dist/cases/master-detail.md +26 -24
- package/dist/cases/message-reactions/picker.d.ts +1 -0
- package/dist/cases/message-reactions/picker.jsx +145 -0
- package/dist/cases/message-reactions/quick-pick.jsx +1 -1
- package/dist/cases/message-reactions.md +184 -3
- package/dist/cases/page-header.md +1 -1
- package/dist/cases/people-row/names.d.ts +1 -0
- package/dist/cases/people-row/names.jsx +20 -0
- package/dist/cases/people-row/stack.d.ts +1 -0
- package/dist/cases/people-row/stack.jsx +33 -0
- package/dist/cases/people-row.md +110 -0
- package/dist/cases/profile-form/form.jsx +21 -10
- package/dist/cases/profile-form.md +38 -9
- package/dist/cases.json +306 -25
- package/dist/components/avatarStack.d.ts +22 -0
- package/dist/components/avatarStack.jsx +32 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.jsx +24 -0
- package/dist/components/calendar.d.ts +19 -0
- package/dist/components/calendar.jsx +126 -0
- package/dist/components/dateField.d.ts +35 -0
- package/dist/components/dateField.jsx +76 -0
- package/dist/components/dropZone.d.ts +53 -0
- package/dist/components/dropZone.jsx +136 -0
- package/dist/components/emojiPicker.d.ts +22 -0
- package/dist/components/emojiPicker.jsx +161 -0
- package/dist/components/itemList.d.ts +31 -0
- package/dist/components/itemList.jsx +81 -0
- package/dist/components/lightbox.d.ts +33 -9
- package/dist/components/lightbox.jsx +58 -27
- package/dist/components/menuItem.d.ts +1 -1
- package/dist/components/menuItem.jsx +3 -3
- package/dist/components/popover.jsx +7 -2
- package/dist/internal/date.d.ts +35 -0
- package/dist/internal/date.js +122 -0
- package/dist/internal/dropZone.d.ts +28 -0
- package/dist/internal/dropZone.js +42 -0
- package/dist/internal/emoji.d.ts +13 -0
- package/dist/internal/emoji.js +182 -0
- package/dist/internal/overlayStack.js +1 -1
- package/dist/internal/people.d.ts +1 -0
- package/dist/internal/people.js +12 -0
- package/dist/native-mapping.json +45 -3
- package/dist/stories/AvatarStack.stories.d.ts +7 -0
- package/dist/stories/AvatarStack.stories.jsx +46 -0
- package/dist/stories/Breadcrumb.stories.d.ts +7 -0
- package/dist/stories/Breadcrumb.stories.jsx +26 -0
- package/dist/stories/Calendar.stories.d.ts +6 -0
- package/dist/stories/Calendar.stories.jsx +15 -0
- package/dist/stories/Cases.generated.stories.d.ts +10 -0
- package/dist/stories/Cases.generated.stories.jsx +20 -0
- package/dist/stories/DateField.stories.d.ts +10 -0
- package/dist/stories/DateField.stories.jsx +132 -0
- package/dist/stories/DropZone.stories.d.ts +12 -0
- package/dist/stories/DropZone.stories.jsx +151 -0
- package/dist/stories/EmojiPicker.stories.d.ts +6 -0
- package/dist/stories/EmojiPicker.stories.jsx +92 -0
- package/dist/stories/ItemList.stories.d.ts +9 -0
- package/dist/stories/ItemList.stories.jsx +86 -0
- package/dist/stories/Lightbox.stories.d.ts +4 -0
- package/dist/stories/Lightbox.stories.jsx +44 -0
- package/dist/stories/Popover.stories.d.ts +1 -0
- package/dist/stories/Popover.stories.jsx +17 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
|
70
70
|
|
|
71
71
|
## Design cases
|
|
72
72
|
|
|
73
|
-
A case is one design situation with oneSlash's answer to it. A rule case has one answer, such as "an agent asks before a risky action". A design case has one to four options, each with a line on when to use it and a working example built only from this package. 2.
|
|
73
|
+
A case is one design situation with oneSlash's answer to it. A rule case has one answer, such as "an agent asks before a risky action". A design case has one to four options, each with a line on when to use it and a working example built only from this package. 2.23.0 has 123: fourteen rules and 109 design cases for auth pages, confirms and modals, states, chat and agent interfaces, settings and menus, shells and navigation, dashboards and billing, marketing and content pages, forms with dates and files.
|
|
74
74
|
|
|
75
75
|
- `oneslash-design-system/cases.json` lists every case with its rule text, options, Do and Don't lines, and the source of each example.
|
|
76
76
|
- `oneslash-design-system/cases/<id>.md` is one case as text, and `oneslash-design-system/cases/<id>/<option>.jsx` is the example itself.
|
package/dist/DESIGN.md
CHANGED
|
@@ -294,13 +294,19 @@ For each web component, the table gives the native control to use. System contro
|
|
|
294
294
|
| accordion | `DisclosureGroup` per item, with the title as its label | A `Column` of rows with `AnimatedVisibility` for the panel and `semantics { stateDescription }` on the row | One-open is app state (a selection the groups bind to). Deep links and the heading level are web only. |
|
|
295
295
|
| alert | `ODSBanner` for an inline message; `.alert` for one that needs a decision | `OdsBanner` for an inline message; `AlertDialog` for one that needs a decision | ODS has no native toast: on Android use `Snackbar` in a `SnackbarHost`. |
|
|
296
296
|
| appShell | `NavigationSplitView` with the sidebar, the content and an `.inspector`; on iPhone a `NavigationStack`, or a `TabView` of five places or fewer | `NavigationSuiteScaffold`; on a phone a `ModalNavigationDrawer` around a `Scaffold` | The split view collapses to a stack on iPhone and shows and hides the sidebar itself. The skip link is web only. |
|
|
297
|
+
| avatarStack | An `HStack(spacing: -8)` of avatars, each with a ring in the background color and a count `Text` in a circle past the limit, with `.accessibilityElement(children: .combine)` and a label naming the people | A `Row` with `Arrangement.spacedBy((-8).dp)` of avatars and a count circle, with `semantics(mergeDescendants = true)` and a label naming the people | To list everyone, make the stack a `Button` that opens a popover (iPad, Mac) or a sheet (iPhone) / a `DropdownMenu` or `ModalBottomSheet`. |
|
|
297
298
|
| button | `Button` with `.odsProminentButton()` for accent (`.odsProminentButton(.glass)` for the glass style), `.bordered` for primary | `Button`, `OutlinedButton` | Tertiary and text-only: `.borderless` / `TextButton`. On Apple, apply `.odsProminentButton()` to every prominent button. Under `odsTheme` the label of a `.borderedProminent` or `.glassProminent` button takes `text.primary`, not the system white, which is below 4.5:1 on the accent in default dark, forest light, forest dark, clay dark, indigo light, indigo dark, wine light, wine dark. In forest light it is the same color as the fill, so the label cannot be seen. The modifier keeps the system style and sets the label to `accent.contrast`. Compose needs nothing: `onPrimary` is `accent.contrast`. |
|
|
298
299
|
| brandIcon | the provider's own button where one exists (`SignInWithAppleButton`), else an asset in the app | an asset in the app | |
|
|
300
|
+
| breadcrumb | Not applicable: web page pattern | Not applicable: web page pattern | The system back button and the navigation title say where the person is. |
|
|
301
|
+
| calendar | `DatePicker` with `.datePickerStyle(.graphical)` and `in:` for the range | `DatePicker` with a `DatePickerState` whose `selectableDates` holds the range | The system calendar draws the month, today and the chosen day, and moves with the keyboard. Inside a field, use `dateField`. |
|
|
299
302
|
| checkBox | `Toggle` (switch on iOS, `.toggleStyle(.checkbox)` on macOS) | `Checkbox` | |
|
|
300
303
|
| codeBlock | `ScrollView(.horizontal)` with `Text(code).monospaced().textSelection(.enabled)` and a Copy `Button` | `SelectionContainer` around a `Text` in the code family with `horizontalScroll`, and a Copy `TextButton` | Show "Copied" for 2 seconds only after the write succeeds. No highlighting and no line numbers. One line to paste is a `copyField`. |
|
|
301
304
|
| composer | `TextField(_:text:axis: .vertical)` with `.lineLimit(1...6)` over a toolbar `HStack` of the tool `Button`s and a send `Button` | `OutlinedTextField` with `maxLines = 6` over a `Row` of the tool `IconButton`s and a send `IconButton` | On iPhone and Android, Return adds a line and the send button sends. While an agent works, send becomes Stop. |
|
|
302
305
|
| copyField | A `LabeledContent` row with the value in a `Text` (`.textSelection(.enabled)`) and a `Button` that sets `UIPasteboard` / `NSPasteboard` | An `OutlinedTextField` with `readOnly = true` and a `trailingIcon` `TextButton` that calls `LocalClipboard` | Show "Copied" for 2 seconds only after the write succeeds. Announce it for VoiceOver / TalkBack. A secret shown once gets the line under it. |
|
|
306
|
+
| dateField | `DatePicker` with `.datePickerStyle(.compact)` and `in:` for the range | `DatePicker` in a `DatePickerDialog`, opened from a read-only `OutlinedTextField`, with `selectableDates` for the range | The system picker cannot hold a day outside the range, so there is no out-of-range message. Store the day as `YYYY-MM-DD`, not a time. |
|
|
303
307
|
| drawer | `.sheet` with `.presentationDetents` on iPhone; `.inspector` on iPad and Mac | `ModalNavigationDrawer` for `side="start"`; `ModalBottomSheet` for `side="end"` | The system sheet, inspector and drawer handle the scrim, swipe to close and focus. `ModalBottomSheet` needs `@OptIn(ExperimentalMaterial3Api::class)`. |
|
|
308
|
+
| dropZone | `PhotosPicker` for pictures, or `.fileImporter` for files, behind a `Button`; add `.dropDestination(for:)` on macOS and iPad | `rememberLauncherForActivityResult` with `PickVisualMedia()` for pictures, or `OpenDocument()` for files, started from a `Button` | iPhone and Android have no drop target: the Button is the whole control. Check the type and size when the system hands the file back, and report the reason so the screen can write the error. |
|
|
309
|
+
| emojiPicker | No system picker control: a reaction offers a few presets in a `contextMenu`, and text takes emoji from the system emoji keyboard | `EmojiPickerView` from `androidx.emoji2:emoji2-emojipicker`, in an `AndroidView` inside a `ModalBottomSheet` | The system keyboard and `EmojiPickerView` bring the full set, skin tones and search, so the built-in 96 are web only. |
|
|
304
310
|
| emptyBox | `ContentUnavailableView` | `OdsEmptyState` | The system has this control on Apple, so ODS adds no part there. Material has none, so ODS does. |
|
|
305
311
|
| factsRow | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `LabeledContent` rows in a `Form` / `ListItem` rows. |
|
|
306
312
|
| figure | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: an `Image` with a caption `Text` in the caption text style. |
|
|
@@ -311,8 +317,9 @@ For each web component, the table gives the native control to use. System contro
|
|
|
311
317
|
| icon | `Image(systemName:)` (SF Symbols) | Material Symbols | |
|
|
312
318
|
| iconButton | `Button` with a `Label` and `.labelStyle(.iconOnly)` | `IconButton` | |
|
|
313
319
|
| image | `Image` / `AsyncImage` | `Image` with the app's image loader | |
|
|
320
|
+
| itemList | `List(selection:)` inside a `NavigationSplitView` | A `LazyColumn` in a list-detail scaffold (`ListDetailPaneScaffold`), with `Modifier.onKeyEvent` for the arrows | The system list moves its selection with the arrow keys and opens the detail; on iPhone and on a phone a row opens the detail. |
|
|
314
321
|
| layout | Not applicable: web page pattern | Not applicable: web page pattern | 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. |
|
|
315
|
-
| lightbox | `.fullScreenCover` holding a `TabView` with `.tabViewStyle(.page)`, one page per image | A full-width `Dialog` (`usePlatformDefaultWidth = false`) holding a `HorizontalPager`
|
|
322
|
+
| lightbox | `.fullScreenCover` holding a `TabView` with `.tabViewStyle(.page)`, one page per image; a `VideoPlayer` (AVKit) on a video page | A full-width `Dialog` (`usePlatformDefaultWidth = false`) holding a `HorizontalPager`; a Media3 `PlayerView` with subtitles on a video page | The system pager gives the swipe; keep a Close button and say "2 of 5" in the title. A video uses the system player and its captions, never starts by itself, and pauses when its page is left or the viewer closes. |
|
|
316
323
|
| line | `Divider` | `HorizontalDivider`, `VerticalDivider` | |
|
|
317
324
|
| link | `Link` | `Text` with a `LinkAnnotation.Url` in its `AnnotatedString` | |
|
|
318
325
|
| linkCard | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `NavigationLink` row in a `List` / a clickable `ListItem`. |
|
|
@@ -533,6 +540,7 @@ File: cases/success-feedback.md
|
|
|
533
540
|
| Login check loading | The app is checking whether the person is logged in, or running a step such as checking an invite, before it knows what to show. | cases/auth-gate-loading.md |
|
|
534
541
|
| Billing page | A workspace pays for a plan. One page says what it pays for, what it has used, how it pays and what it has paid. | cases/billing-page.md |
|
|
535
542
|
| Blog index | A visitor opens the blog to see what was written lately and to pick a post to read. | cases/blog-index.md |
|
|
543
|
+
| Breadcrumb | A page on a site sits under other pages, and the person needs to see where it is and go back up. | cases/breadcrumb.md |
|
|
536
544
|
| Breakdown of a total | A page shows how a total splits into parts, such as responses by model or comments by project. | cases/breakdown-list.md |
|
|
537
545
|
| Changelog | A visitor or a customer wants to know what changed in the product lately, and may be sent to one change from a message. | cases/changelog.md |
|
|
538
546
|
| Check your email | A person signed up, and the product sent a link to confirm their email. | cases/check-your-email.md |
|
|
@@ -546,6 +554,7 @@ File: cases/success-feedback.md
|
|
|
546
554
|
| Danger zone | A settings page offers actions that are hard or impossible to undo, such as deleting an account or a workspace, or leaving one. | cases/danger-zone.md |
|
|
547
555
|
| Dashboard | A page that opens an app and says how things are going and what waits on the person. | cases/dashboard.md |
|
|
548
556
|
| Data table page | A page is one long table of records, such as invoices or customers, that a person searches, sorts and acts on. | cases/data-table-page.md |
|
|
557
|
+
| Date field | A person gives one day, such as when a token expires or their date of birth. | cases/date-field.md |
|
|
549
558
|
| Device login | A CLI, an editor or another app opened the browser so the person can log in, and the login must reach that app. | cases/device-login.md |
|
|
550
559
|
| Docs component page | A person opens the page of one part of a design system or a code library to see what it looks like, how to write it and what it takes. | cases/docs-component-page.md |
|
|
551
560
|
| Email confirmed | A person opened the link that confirms their email. | cases/email-confirmed.md |
|
|
@@ -556,6 +565,7 @@ File: cases/success-feedback.md
|
|
|
556
565
|
| FAQ | A marketing page answers the questions a visitor asks before signing up. | cases/faq.md |
|
|
557
566
|
| Feature grid | A marketing page lists what the product does, so a visitor can see if it fits. | cases/feature-grid.md |
|
|
558
567
|
| Feedback form | A person sends feedback about the product from inside it. | cases/feedback-form.md |
|
|
568
|
+
| File upload | A person adds a file from their device, such as a new profile picture or the receipts for a report. | cases/file-upload.md |
|
|
559
569
|
| Filter menu | A person narrows a list by one choice, such as a date range, or turns the filter off. | cases/filter-menu.md |
|
|
560
570
|
| Forgot password | A person cannot remember their password and asks for a link to set a new one. | cases/forgot-password.md |
|
|
561
571
|
| Image viewer | A page shows images small, and a person wants to see one larger without leaving the page. | cases/image-viewer.md |
|
|
@@ -591,6 +601,7 @@ File: cases/success-feedback.md
|
|
|
591
601
|
| Short list on a dashboard | A dashboard section lists things that wait on the person, such as questions or comments, and the list may be longer than the section. | cases/paged-card.md |
|
|
592
602
|
| Password gate | Some work is private. A visitor needs the password to read it, and someone who does not have it needs to know how to ask. | cases/password-gate.md |
|
|
593
603
|
| Payment method | A workspace pays by card. The admin sees which card, changes it or removes it. | cases/payment-method.md |
|
|
604
|
+
| People on an item | A thread or a task shows who is on it, and the person can find out who they all are. | cases/people-row.md |
|
|
594
605
|
| Plan change confirm | An admin chose another plan. Before anything changes they need to know what it costs and when it starts. | cases/plan-change-confirm.md |
|
|
595
606
|
| Plan picker | An admin compares the plans a workspace can be on and chooses one. | cases/plan-picker.md |
|
|
596
607
|
| Pricing section | A visitor to the public site compares the plans and signs up for one. | cases/pricing-section.md |
|
|
@@ -13,8 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
import { useState } from 'react';
|
|
14
14
|
import PageShell from '../../components/pageShell';
|
|
15
15
|
import PageHeader from '../../components/pageHeader';
|
|
16
|
-
import
|
|
17
|
-
import MenuItem from '../../components/menuItem';
|
|
16
|
+
import ItemList from '../../components/itemList';
|
|
18
17
|
import { SettingsLayout } from '../../components/settingsSection';
|
|
19
18
|
import Heading from '../../components/heading';
|
|
20
19
|
import Paragraph from '../../components/paragraph';
|
|
@@ -35,19 +34,32 @@ export default function AdminInboxSplit() {
|
|
|
35
34
|
var _c = useState(first[0].id), openId = _c[0], setOpenId = _c[1];
|
|
36
35
|
// On a phone the list is the screen until a message is chosen, and Back returns to it.
|
|
37
36
|
var _d = useState(false), showDetail = _d[0], setShowDetail = _d[1];
|
|
37
|
+
// A real app passes the router from its framework, such as Next's useRouter(), and reads the open message from its
|
|
38
|
+
// address, so it can be shared and reloaded. Here both set the open message.
|
|
39
|
+
var router = {
|
|
40
|
+
push: function (url) { var _a; return setOpenId((_a = url.split('/').pop()) !== null && _a !== void 0 ? _a : first[0].id); },
|
|
41
|
+
replace: function (url) { var _a; return setOpenId((_a = url.split('/').pop()) !== null && _a !== void 0 ? _a : first[0].id); },
|
|
42
|
+
};
|
|
38
43
|
var message = (_a = messages.find(function (m) { return m.id === openId; })) !== null && _a !== void 0 ? _a : messages[0];
|
|
39
44
|
var unread = messages.filter(function (m) { return !m.read; }).length;
|
|
40
45
|
function toggle(id) {
|
|
41
46
|
setMessages(function (list) { return list.map(function (m) { return (m.id === id ? __assign(__assign({}, m), { read: !m.read }) : m); }); });
|
|
42
47
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// From md, Up and Down open the next message and focus follows. On a phone they move focus, and Enter opens.
|
|
49
|
+
var list = (<ItemList id="admin-inbox-split" aria-label="Messages" items={messages.map(function (m) { return ({
|
|
50
|
+
id: m.id,
|
|
51
|
+
label: m.from,
|
|
52
|
+
secondLabel: m.subject,
|
|
53
|
+
tag: m.read ? undefined : { label: 'Unread', color: 'info' },
|
|
54
|
+
}); })} selectedId={message.id} onSelect={function (id, how) {
|
|
55
|
+
// A move with the arrows replaces the address, so Back leaves the list instead of stepping through every message.
|
|
56
|
+
// With `href` rows, the link itself pushes on a click, so call only `replace`, on a keyboard move.
|
|
57
|
+
if (how === 'keyboard')
|
|
58
|
+
router.replace("/admin/messages/".concat(id));
|
|
59
|
+
else
|
|
60
|
+
router.push("/admin/messages/".concat(id));
|
|
61
|
+
setShowDetail(true);
|
|
62
|
+
}}/>);
|
|
51
63
|
return (<PageShell>
|
|
52
64
|
<Stack gap="xlarge">
|
|
53
65
|
<PageHeader level={1} title="Messages" lede={"".concat(unread, " of ").concat(messages.length, " unread")}/>
|
|
@@ -157,15 +157,14 @@ export default function AdminInboxList() {
|
|
|
157
157
|
|
|
158
158
|
Use when: Many messages arrive, and the owner works down them one after another.
|
|
159
159
|
|
|
160
|
-
Uses: `Button`, `Cluster`, `Heading`, `
|
|
160
|
+
Uses: `Button`, `Cluster`, `Heading`, `ItemList`, `PageHeader`, `PageShell`, `Paragraph`, `SettingsLayout`, `Stack`
|
|
161
161
|
|
|
162
162
|
```tsx
|
|
163
163
|
'use client';
|
|
164
164
|
import { useState } from 'react';
|
|
165
165
|
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
166
166
|
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
167
|
-
import
|
|
168
|
-
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
167
|
+
import ItemList from 'oneslash-design-system/components/itemList';
|
|
169
168
|
import { SettingsLayout } from 'oneslash-design-system/components/settingsSection';
|
|
170
169
|
import Heading from 'oneslash-design-system/components/heading';
|
|
171
170
|
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
@@ -190,6 +189,13 @@ export default function AdminInboxSplit() {
|
|
|
190
189
|
// On a phone the list is the screen until a message is chosen, and Back returns to it.
|
|
191
190
|
const [showDetail, setShowDetail] = useState(false);
|
|
192
191
|
|
|
192
|
+
// A real app passes the router from its framework, such as Next's useRouter(), and reads the open message from its
|
|
193
|
+
// address, so it can be shared and reloaded. Here both set the open message.
|
|
194
|
+
const router = {
|
|
195
|
+
push: (url: string) => setOpenId(url.split('/').pop() ?? first[0].id),
|
|
196
|
+
replace: (url: string) => setOpenId(url.split('/').pop() ?? first[0].id),
|
|
197
|
+
};
|
|
198
|
+
|
|
193
199
|
const message = messages.find((m) => m.id === openId) ?? messages[0];
|
|
194
200
|
const unread = messages.filter((m) => !m.read).length;
|
|
195
201
|
|
|
@@ -197,27 +203,26 @@ export default function AdminInboxSplit() {
|
|
|
197
203
|
setMessages((list) => list.map((m) => (m.id === id ? { ...m, read: !m.read } : m)));
|
|
198
204
|
}
|
|
199
205
|
|
|
206
|
+
// From md, Up and Down open the next message and focus follows. On a phone they move focus, and Enter opens.
|
|
200
207
|
const list = (
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
))}
|
|
220
|
-
</Navigation>
|
|
208
|
+
<ItemList
|
|
209
|
+
id="admin-inbox-split"
|
|
210
|
+
aria-label="Messages"
|
|
211
|
+
items={messages.map((m) => ({
|
|
212
|
+
id: m.id,
|
|
213
|
+
label: m.from,
|
|
214
|
+
secondLabel: m.subject,
|
|
215
|
+
tag: m.read ? undefined : { label: 'Unread', color: 'info' },
|
|
216
|
+
}))}
|
|
217
|
+
selectedId={message.id}
|
|
218
|
+
onSelect={(id, how) => {
|
|
219
|
+
// A move with the arrows replaces the address, so Back leaves the list instead of stepping through every message.
|
|
220
|
+
// With `href` rows, the link itself pushes on a click, so call only `replace`, on a keyboard move.
|
|
221
|
+
if (how === 'keyboard') router.replace(`/admin/messages/${id}`);
|
|
222
|
+
else router.push(`/admin/messages/${id}`);
|
|
223
|
+
setShowDetail(true);
|
|
224
|
+
}}
|
|
225
|
+
/>
|
|
221
226
|
);
|
|
222
227
|
|
|
223
228
|
return (
|
package/dist/cases/api-keys.md
CHANGED
|
@@ -6,7 +6,7 @@ A person makes keys that let a script or a service use the product as them, and
|
|
|
6
6
|
|
|
7
7
|
- List each key with its name, the start of the key in the mono face, when it was created and when it was last used. Say 'Never used' when it was not.
|
|
8
8
|
- Show only a prefix of 14 characters in the list, with an ellipsis. Never show a whole key again once the Modal is closed.
|
|
9
|
-
- Open a Modal titled 'Create Key' from a 'Create Key' Button, with
|
|
9
|
+
- Open a Modal titled 'Create Key' from a 'Create Key' Button, with 'Name', and 'Expires on' when keys can expire, as the case 'Date field' says. Then 'Cancel' and 'Create'.
|
|
10
10
|
- Say under the name what to put in it: 'Say what will use it, such as CI pipeline.'
|
|
11
11
|
- Keep the Modal open when the key is made, change its title to 'Key Created' and show the key in a `CopyField` with `reveal="once"` and `mono`. The field says 'Copy it now. You will not see it again.'
|
|
12
12
|
- Give the Modal one Button, 'Done'. Ignore Escape and a click outside while the key shows, so a stray click cannot lose it.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BreadcrumbBackLink(): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import PageShell from '../../components/pageShell';
|
|
3
|
+
import PageHeader from '../../components/pageHeader';
|
|
4
|
+
import Button from '../../components/button';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import { Cluster, Stack } from '../../components/layout';
|
|
7
|
+
export default function BreadcrumbBackLink() {
|
|
8
|
+
return (<PageShell>
|
|
9
|
+
<Stack gap="giant">
|
|
10
|
+
<Stack gap="large">
|
|
11
|
+
{/* One level up: a link named for the index it goes to */}
|
|
12
|
+
<Cluster>
|
|
13
|
+
<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Blog" href="/blog"/>
|
|
14
|
+
</Cluster>
|
|
15
|
+
<PageHeader level={1} title="How task threads work" lede="One piece of work and all of its talk, in one thread." facts={[{ label: 'Published', value: 'Nov 12, 2026' }]}/>
|
|
16
|
+
</Stack>
|
|
17
|
+
<Stack gap="large">
|
|
18
|
+
<Paragraph>A task thread holds the messages, the files and the decisions for one piece of work. Anyone who opens the task sees all of it.</Paragraph>
|
|
19
|
+
<Paragraph>When the work is done, the thread stays, so the reasons stay with it.</Paragraph>
|
|
20
|
+
</Stack>
|
|
21
|
+
</Stack>
|
|
22
|
+
</PageShell>);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BreadcrumbTrail(): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import PageShell from '../../components/pageShell';
|
|
3
|
+
import PageHeader from '../../components/pageHeader';
|
|
4
|
+
import Breadcrumb from '../../components/breadcrumb';
|
|
5
|
+
import SectionIntro from '../../components/sectionIntro';
|
|
6
|
+
import Paragraph from '../../components/paragraph';
|
|
7
|
+
import { PageSection, Stack } from '../../components/layout';
|
|
8
|
+
// Each level is named by its page's title. The last is this page, so it is not a link.
|
|
9
|
+
var trail = [
|
|
10
|
+
{ label: 'Docs', href: '/docs' },
|
|
11
|
+
{ label: 'Components', href: '/docs/components' },
|
|
12
|
+
{ label: 'Code Block' },
|
|
13
|
+
];
|
|
14
|
+
export default function BreadcrumbTrail() {
|
|
15
|
+
return (<PageShell>
|
|
16
|
+
<Stack gap="giant">
|
|
17
|
+
<Stack gap="large">
|
|
18
|
+
<Breadcrumb items={trail}/>
|
|
19
|
+
<PageHeader level={1} title="Code Block" lede="Shows code in a mono face, with a Copy Button and an optional file name."/>
|
|
20
|
+
</Stack>
|
|
21
|
+
<PageSection>
|
|
22
|
+
<SectionIntro id="breadcrumb-use" name="When to use it">
|
|
23
|
+
<Paragraph>Use it for a command or a file a person will copy. For a word of code inside a sentence, use inline code.</Paragraph>
|
|
24
|
+
</SectionIntro>
|
|
25
|
+
</PageSection>
|
|
26
|
+
</Stack>
|
|
27
|
+
</PageShell>);
|
|
28
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Breadcrumb
|
|
2
|
+
|
|
3
|
+
A page on a site sits under other pages, and the person needs to see where it is and go back up.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Put `Breadcrumb` above the `PageHeader`, from the top level down to this page.
|
|
8
|
+
- Name each level by its page's title: 'Docs', 'Components', 'Code Block'.
|
|
9
|
+
- Put the current page last. It is not a link, and it is marked as the current page.
|
|
10
|
+
- Link every other level to its page.
|
|
11
|
+
- Use a tertiary `Button` with `decoIcon="ChevronLeft"` and `href` for a page one level down, named for the index: 'Back to Blog'.
|
|
12
|
+
- Let a long trail wrap on a phone. Never cut a level short.
|
|
13
|
+
|
|
14
|
+
## Don't
|
|
15
|
+
|
|
16
|
+
- Do not put a breadcrumb in an app page. Follow the case 'Page header with actions': Back goes one step up.
|
|
17
|
+
- Do not repeat the page's title as a link in the trail. The last level is the page itself, as text.
|
|
18
|
+
- Do not show more than four levels. A trail that long says the site has too many levels.
|
|
19
|
+
- Do not name a level by its address or a code, such as 'docs' or 'cmp-12'.
|
|
20
|
+
- Do not use a breadcrumb for a page two levels deep. One link back to its index is enough.
|
|
21
|
+
|
|
22
|
+
## Option: A linked trail above the title
|
|
23
|
+
|
|
24
|
+
Use when: The page is three or more levels deep, such as a page in a docs site or a help center.
|
|
25
|
+
|
|
26
|
+
Uses: `Breadcrumb`, `PageHeader`, `PageSection`, `PageShell`, `Paragraph`, `SectionIntro`, `Stack`
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
'use client';
|
|
30
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
31
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
32
|
+
import Breadcrumb from 'oneslash-design-system/components/breadcrumb';
|
|
33
|
+
import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
34
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
35
|
+
import { PageSection, Stack } from 'oneslash-design-system/components/layout';
|
|
36
|
+
|
|
37
|
+
// Each level is named by its page's title. The last is this page, so it is not a link.
|
|
38
|
+
const trail = [
|
|
39
|
+
{ label: 'Docs', href: '/docs' },
|
|
40
|
+
{ label: 'Components', href: '/docs/components' },
|
|
41
|
+
{ label: 'Code Block' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export default function BreadcrumbTrail() {
|
|
45
|
+
return (
|
|
46
|
+
<PageShell>
|
|
47
|
+
<Stack gap="giant">
|
|
48
|
+
<Stack gap="large">
|
|
49
|
+
<Breadcrumb items={trail} />
|
|
50
|
+
<PageHeader level={1} title="Code Block" lede="Shows code in a mono face, with a Copy Button and an optional file name." />
|
|
51
|
+
</Stack>
|
|
52
|
+
<PageSection>
|
|
53
|
+
<SectionIntro id="breadcrumb-use" name="When to use it">
|
|
54
|
+
<Paragraph>Use it for a command or a file a person will copy. For a word of code inside a sentence, use inline code.</Paragraph>
|
|
55
|
+
</SectionIntro>
|
|
56
|
+
</PageSection>
|
|
57
|
+
</Stack>
|
|
58
|
+
</PageShell>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Option: One link back to the index
|
|
64
|
+
|
|
65
|
+
Use when: The page is two levels deep, one under its index, such as a post under the blog.
|
|
66
|
+
|
|
67
|
+
Uses: `Button`, `Cluster`, `PageHeader`, `PageShell`, `Paragraph`, `Stack`
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
'use client';
|
|
71
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
72
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
73
|
+
import Button from 'oneslash-design-system/components/button';
|
|
74
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
75
|
+
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
76
|
+
|
|
77
|
+
export default function BreadcrumbBackLink() {
|
|
78
|
+
return (
|
|
79
|
+
<PageShell>
|
|
80
|
+
<Stack gap="giant">
|
|
81
|
+
<Stack gap="large">
|
|
82
|
+
{/* One level up: a link named for the index it goes to */}
|
|
83
|
+
<Cluster>
|
|
84
|
+
<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Blog" href="/blog" />
|
|
85
|
+
</Cluster>
|
|
86
|
+
<PageHeader
|
|
87
|
+
level={1}
|
|
88
|
+
title="How task threads work"
|
|
89
|
+
lede="One piece of work and all of its talk, in one thread."
|
|
90
|
+
facts={[{ label: 'Published', value: 'Nov 12, 2026' }]}
|
|
91
|
+
/>
|
|
92
|
+
</Stack>
|
|
93
|
+
<Stack gap="large">
|
|
94
|
+
<Paragraph>A task thread holds the messages, the files and the decisions for one piece of work. Anyone who opens the task sees all of it.</Paragraph>
|
|
95
|
+
<Paragraph>When the work is done, the thread stays, so the reasons stay with it.</Paragraph>
|
|
96
|
+
</Stack>
|
|
97
|
+
</Stack>
|
|
98
|
+
</PageShell>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Native
|
|
104
|
+
|
|
105
|
+
On Apple the navigation stack and its back button do this job. On Android use the top app bar with Up.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function DateFieldCalendar(): import("react").JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Heading from '../../components/heading';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import Form from '../../components/form';
|
|
6
|
+
import FormField from '../../components/formField';
|
|
7
|
+
import TextField from '../../components/textField';
|
|
8
|
+
import DateField from '../../components/dateField';
|
|
9
|
+
import CopyField from '../../components/copyField';
|
|
10
|
+
import Button from '../../components/button';
|
|
11
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
12
|
+
// In an app, these fields sit in the 'Create Key' Modal of the case 'API keys'.
|
|
13
|
+
// "Today" in this example. A real app passes its own today as `min`, as 'YYYY-MM-DD'.
|
|
14
|
+
var today = '2026-11-16';
|
|
15
|
+
// The token the server made. A real app gets it once, in the reply to the create request.
|
|
16
|
+
var madeToken = 'acme_tok_9Rk2vQ7mXa4LwT8cZp1Hd6Ns';
|
|
17
|
+
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
18
|
+
// '2026-12-16' as 'Dec 16, 2026', for the line under the new token
|
|
19
|
+
function formatDay(day) {
|
|
20
|
+
var _a = day.split('-').map(Number), year = _a[0], month = _a[1], date = _a[2];
|
|
21
|
+
return "".concat(months[month - 1], " ").concat(date, ", ").concat(year);
|
|
22
|
+
}
|
|
23
|
+
export default function DateFieldCalendar() {
|
|
24
|
+
var _a = useState(''), name = _a[0], setName = _a[1];
|
|
25
|
+
var _b = useState(''), nameError = _b[0], setNameError = _b[1];
|
|
26
|
+
// The day as 'YYYY-MM-DD', or '' for no end date
|
|
27
|
+
var _c = useState(''), expires = _c[0], setExpires = _c[1];
|
|
28
|
+
// The field's own message for a date typed wrong. While it is set, the token is not created.
|
|
29
|
+
var _d = useState(null), expiresError = _d[0], setExpiresError = _d[1];
|
|
30
|
+
var _e = useState(false), creating = _e[0], setCreating = _e[1];
|
|
31
|
+
var _f = useState(null), made = _f[0], setMade = _f[1];
|
|
32
|
+
var timer = useRef();
|
|
33
|
+
// Stops the request if the example goes away before it ends.
|
|
34
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
35
|
+
function handleCreate() {
|
|
36
|
+
if (creating)
|
|
37
|
+
return;
|
|
38
|
+
setNameError(name.trim() ? '' : 'Enter a name for the token.');
|
|
39
|
+
// A date typed wrong shows its message under the field. An empty date means no end date.
|
|
40
|
+
if (!name.trim() || expiresError)
|
|
41
|
+
return;
|
|
42
|
+
setCreating(true);
|
|
43
|
+
// Stands in for the request to the server.
|
|
44
|
+
timer.current = setTimeout(function () {
|
|
45
|
+
setCreating(false);
|
|
46
|
+
setMade({ name: name.trim(), expires: expires });
|
|
47
|
+
}, 1200);
|
|
48
|
+
}
|
|
49
|
+
function handleDone() {
|
|
50
|
+
setMade(null);
|
|
51
|
+
setName('');
|
|
52
|
+
setExpires('');
|
|
53
|
+
setExpiresError(null);
|
|
54
|
+
}
|
|
55
|
+
return (<Center width="form">
|
|
56
|
+
<Stack gap="large">
|
|
57
|
+
<Stack gap="small">
|
|
58
|
+
<Heading level={1} size="h5">New access token</Heading>
|
|
59
|
+
<Paragraph tone="secondary" size="body2" measure="none">A token lets a script use Acme as you until the day it expires.</Paragraph>
|
|
60
|
+
</Stack>
|
|
61
|
+
{made ? (<Stack gap="large">
|
|
62
|
+
<CopyField id="date-field-token" label={made.name} value={madeToken} mono reveal="once"/>
|
|
63
|
+
<Paragraph size="body2" measure="none">{made.expires ? "Expires ".concat(formatDay(made.expires), ".") : 'Never expires.'}</Paragraph>
|
|
64
|
+
<Cluster>
|
|
65
|
+
<Button size="medium" type="primary" state="enabled" label="Done" onClickButton={handleDone}/>
|
|
66
|
+
</Cluster>
|
|
67
|
+
</Stack>) : (<Form aria-label="New access token" gap="large" onSubmit={handleCreate}>
|
|
68
|
+
<FormField id="date-field-name" label="Name" help="Say what will use it, such as Deploy script." error={nameError}>
|
|
69
|
+
{function (f) { return (<TextField id={f.id} aria-describedby={f['aria-describedby']} aria-invalid={f['aria-invalid']} value={name} disabled={creating} autoComplete="off" onChange={function (e) { setName(e.target.value); setNameError(''); }}/>); }}
|
|
70
|
+
</FormField>
|
|
71
|
+
{/* Typed as MM/DD/YYYY or picked from the calendar. A day before today says 'Choose Nov 16, 2026 or later.'
|
|
72
|
+
The second argument of onChange tells an empty field (no error) from a date typed wrong. */}
|
|
73
|
+
<DateField id="date-field-expires" label="Expires on" value={expires} onChange={function (day, detail) { setExpires(day); setExpiresError(detail.error); }} min={today} disabled={creating} helperText="MM/DD/YYYY. Leave empty for no end date."/>
|
|
74
|
+
<Cluster>
|
|
75
|
+
<Button size="medium" type="primary" state="enabled" label="Create Token" htmlType="submit" loading={creating}/>
|
|
76
|
+
</Cluster>
|
|
77
|
+
</Form>)}
|
|
78
|
+
</Stack>
|
|
79
|
+
</Center>);
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function DateFieldTyped(): import("react").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Heading from '../../components/heading';
|
|
4
|
+
import Form from '../../components/form';
|
|
5
|
+
import DateField from '../../components/dateField';
|
|
6
|
+
import Button from '../../components/button';
|
|
7
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
8
|
+
// "Today" in this example. A real app passes its own today as `max`, as 'YYYY-MM-DD'.
|
|
9
|
+
var today = '2026-11-16';
|
|
10
|
+
export default function DateFieldTyped() {
|
|
11
|
+
// The day as 'YYYY-MM-DD'
|
|
12
|
+
var _a = useState('1990-04-12'), saved = _a[0], setSaved = _a[1];
|
|
13
|
+
var _b = useState('1990-04-12'), birth = _b[0], setBirth = _b[1];
|
|
14
|
+
// The field's own message for a date typed wrong or after today. While it is set, nothing is saved.
|
|
15
|
+
var _c = useState(null), birthError = _c[0], setBirthError = _c[1];
|
|
16
|
+
// The form's message for an empty field
|
|
17
|
+
var _d = useState(''), error = _d[0], setError = _d[1];
|
|
18
|
+
var _e = useState(false), saving = _e[0], setSaving = _e[1];
|
|
19
|
+
var _f = useState(false), justSaved = _f[0], setJustSaved = _f[1];
|
|
20
|
+
var timers = useRef([]);
|
|
21
|
+
var savedTimer = useRef();
|
|
22
|
+
// Stops the request and the 'Saved' if the example goes away before they end.
|
|
23
|
+
useEffect(function () { return function () {
|
|
24
|
+
timers.current.forEach(clearTimeout);
|
|
25
|
+
clearTimeout(savedTimer.current);
|
|
26
|
+
}; }, []);
|
|
27
|
+
function handleSave() {
|
|
28
|
+
if (saving || birthError)
|
|
29
|
+
return;
|
|
30
|
+
if (!birth) {
|
|
31
|
+
setError('Enter your date of birth as MM/DD/YYYY.');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setError('');
|
|
35
|
+
setSaving(true);
|
|
36
|
+
// Stands in for the request to the server.
|
|
37
|
+
timers.current.push(setTimeout(function () {
|
|
38
|
+
setSaving(false);
|
|
39
|
+
setSaved(birth);
|
|
40
|
+
setJustSaved(true);
|
|
41
|
+
clearTimeout(savedTimer.current);
|
|
42
|
+
savedTimer.current = setTimeout(function () { return setJustSaved(false); }, 2000);
|
|
43
|
+
}, 1200));
|
|
44
|
+
}
|
|
45
|
+
var changed = birth !== saved;
|
|
46
|
+
return (<Center width="form">
|
|
47
|
+
<Stack gap="large">
|
|
48
|
+
<Heading level={1} size="h5">Personal details</Heading>
|
|
49
|
+
<Form aria-label="Personal details" gap="large" onSubmit={handleSave}>
|
|
50
|
+
{/* Typed only: a date of birth is years away, where paging a calendar would take too long */}
|
|
51
|
+
<DateField id="date-field-birth" label="Date of birth" value={birth} onChange={function (day, detail) { setBirth(day); setBirthError(detail.error); setJustSaved(false); setError(''); }} max={today} required calendar={false} disabled={saving} errorText={error || undefined}/>
|
|
52
|
+
<Cluster>
|
|
53
|
+
<Button size="medium" type="primary" state={changed || saving ? 'enabled' : 'disabled'} label={justSaved ? 'Saved' : 'Save'} htmlType="submit" loading={saving}/>
|
|
54
|
+
</Cluster>
|
|
55
|
+
</Form>
|
|
56
|
+
</Stack>
|
|
57
|
+
</Center>);
|
|
58
|
+
}
|