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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import ItemList from "../components/itemList";
|
|
14
|
+
import { SettingsLayout } from "../components/settingsSection";
|
|
15
|
+
import Button from "../components/button";
|
|
16
|
+
import Paragraph from "../components/paragraph";
|
|
17
|
+
import TitleBar from "../components/titleBar";
|
|
18
|
+
import TextField from "../components/textField";
|
|
19
|
+
var meta = {
|
|
20
|
+
title: "Components/ItemList",
|
|
21
|
+
component: ItemList,
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
var mail = [
|
|
25
|
+
{ id: "launch", label: "Ben Carter", secondLabel: "Launch plan is ready" },
|
|
26
|
+
{ id: "screens", label: "Omar Reyes", secondLabel: "New screens for Friday" },
|
|
27
|
+
{ id: "invoice", label: "Mia Park", secondLabel: "Invoice for October" },
|
|
28
|
+
{ id: "offsite", label: "Ana Silva", secondLabel: "Team offsite in March" },
|
|
29
|
+
{ id: "pricing", label: "Ben Carter", secondLabel: "Pricing table copy" },
|
|
30
|
+
{ id: "hiring", label: "Omar Reyes", secondLabel: "Two new designers" },
|
|
31
|
+
{ id: "budget", label: "Mia Park", secondLabel: "Budget for next year" },
|
|
32
|
+
{ id: "survey", label: "Leo Grant", secondLabel: "Survey results are in" },
|
|
33
|
+
{ id: "travel", label: "Ana Silva", secondLabel: "Travel for the offsite" },
|
|
34
|
+
{ id: "logo", label: "Ben Carter", secondLabel: "Logo files" },
|
|
35
|
+
{ id: "notes", label: "Omar Reyes", secondLabel: "Notes from Monday" },
|
|
36
|
+
{ id: "review", label: "Mia Park", secondLabel: "Review of the new home page" },
|
|
37
|
+
];
|
|
38
|
+
function InboxBox(_a) {
|
|
39
|
+
var rows = _a.rows, _b = _a.field, field = _b === void 0 ? false : _b, _c = _a.archive, archive = _c === void 0 ? false : _c, _d = _a.links, links = _d === void 0 ? false : _d;
|
|
40
|
+
var _e = React.useState(rows), list = _e[0], setList = _e[1];
|
|
41
|
+
var _f = React.useState(rows[0].id), current = _f[0], setCurrent = _f[1];
|
|
42
|
+
var _g = React.useState(false), open = _g[0], setOpen = _g[1];
|
|
43
|
+
var _h = React.useState(""), reply = _h[0], setReply = _h[1];
|
|
44
|
+
var item = list.find(function (m) { return m.id === current; });
|
|
45
|
+
var onArchive = function () {
|
|
46
|
+
var at = list.findIndex(function (m) { return m.id === current; });
|
|
47
|
+
var next = list.filter(function (m) { return m.id !== current; });
|
|
48
|
+
setList(next);
|
|
49
|
+
if (next.length)
|
|
50
|
+
setCurrent(next[Math.min(at, next.length - 1)].id);
|
|
51
|
+
};
|
|
52
|
+
return (<SettingsLayout navWidth="wide" showContent={open} back={<Button type="tertiary" size="small" state="enabled" label="Back to Inbox" decoIcon="ChevronLeft" onClickButton={function () { return setOpen(false); }}/>} nav={<ItemList id="inbox" aria-label="Inbox" items={links ? list.map(function (m) { return (__assign(__assign({}, m), { href: "#".concat(m.id) })); }) : list} selectedId={current} onSelect={function (id, how) {
|
|
53
|
+
setCurrent(id);
|
|
54
|
+
setOpen(true);
|
|
55
|
+
// An app replaces the address on a keyboard move, so Back does not step through each row. A click's link pushes it.
|
|
56
|
+
if (links && how === "keyboard")
|
|
57
|
+
window.history.replaceState(null, "", "#".concat(id));
|
|
58
|
+
}}/>}>
|
|
59
|
+
{item && (<>
|
|
60
|
+
<TitleBar title={item.secondLabel}/>
|
|
61
|
+
<Paragraph>{item.label}: the details are in the brief. Reply here when you have read it.</Paragraph>
|
|
62
|
+
{field && <TextField id="inbox-reply" label="Reply" value={reply} onChange={function (e) { return setReply(e.target.value); }}/>}
|
|
63
|
+
{archive && <Button type="secondary" size="small" state="enabled" label="Archive" decoIcon="Archive" onClickButton={onArchive}/>}
|
|
64
|
+
</>)}
|
|
65
|
+
</SettingsLayout>);
|
|
66
|
+
}
|
|
67
|
+
// Also shot at 375px, where the list is the whole screen until a row is opened
|
|
68
|
+
export var Inbox = {
|
|
69
|
+
tags: ["shell"],
|
|
70
|
+
render: function () { return <InboxBox rows={mail.slice(0, 5)}/>; },
|
|
71
|
+
};
|
|
72
|
+
// Test-only: twelve rows and a field in the detail.
|
|
73
|
+
export var InboxProbe = {
|
|
74
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
75
|
+
render: function () { return <InboxBox rows={mail} field/>; },
|
|
76
|
+
};
|
|
77
|
+
// Test-only: an Archive Button removes the open row.
|
|
78
|
+
export var RemoveProbe = {
|
|
79
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
80
|
+
render: function () { return <InboxBox rows={mail.slice(0, 4)} archive/>; },
|
|
81
|
+
};
|
|
82
|
+
// Test-only: link rows, as an app with an address per item has.
|
|
83
|
+
export var LinkProbe = {
|
|
84
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
85
|
+
render: function () { return <InboxBox rows={mail.slice(0, 5)} links/>; },
|
|
86
|
+
};
|
|
@@ -7,5 +7,9 @@ export declare const Gallery: Story;
|
|
|
7
7
|
export declare const One: Story;
|
|
8
8
|
export declare const Broken: Story;
|
|
9
9
|
export declare const BrokenThumbnail: Story;
|
|
10
|
+
export declare const WithVideo: Story;
|
|
11
|
+
export declare const BrokenPosterProbe: Story;
|
|
12
|
+
export declare const BrokenVideoProbe: Story;
|
|
13
|
+
export declare const OneVideoProbe: Story;
|
|
10
14
|
export declare const ThumbnailHydrateProbe: Story;
|
|
11
15
|
export declare const ThumbnailHydrateGoodProbe: Story;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
13
|
import { renderToString } from "react-dom/server";
|
|
3
14
|
import { hydrateRoot } from "react-dom/client";
|
|
@@ -46,6 +57,39 @@ export var BrokenThumbnail = {
|
|
|
46
57
|
tags: ["shell"],
|
|
47
58
|
render: function () { return <GalleryDemo images={brokenFirst}/>; },
|
|
48
59
|
};
|
|
60
|
+
// A short clip made for this repo (a ball rolling along the hillside, no sound) and its captions, from stories/assets,
|
|
61
|
+
// which Storybook serves at /media. The poster is the clip's first frame drawn again as an SVG.
|
|
62
|
+
var clip = "/media/hillside-ball.webm";
|
|
63
|
+
var clipCaptions = "/media/hillside-ball.vtt";
|
|
64
|
+
var clipPoster = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 240'%3E%3Crect width='320' height='240' fill='%23dfe9f2'/%3E%3Ccircle cx='240' cy='64' r='28' fill='%23f2c46d'/%3E%3Cpath d='M0 180 100 120l80 44 60-36 80 48v64H0z' fill='%232f6b4f'/%3E%3Ccircle cx='20' cy='200' r='14' fill='%23e08a5b'/%3E%3C/svg%3E";
|
|
65
|
+
var video = {
|
|
66
|
+
kind: "video",
|
|
67
|
+
src: clip,
|
|
68
|
+
poster: clipPoster,
|
|
69
|
+
alt: "A ball rolls along the foot of a green hillside",
|
|
70
|
+
captions: { src: clipCaptions, srclang: "en", label: "English" },
|
|
71
|
+
};
|
|
72
|
+
// Two images and a video between them. The video uses the browser's controls, never starts by itself and shows its
|
|
73
|
+
// captions; it pauses when the viewer steps away or closes.
|
|
74
|
+
export var WithVideo = {
|
|
75
|
+
tags: ["shell"],
|
|
76
|
+
render: function () { return <GalleryDemo images={[images[0], video, images[1]]}/>; },
|
|
77
|
+
};
|
|
78
|
+
// Test-only: closed, with a video whose poster fails (a data URL that is not an image).
|
|
79
|
+
export var BrokenPosterProbe = {
|
|
80
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
81
|
+
render: function () { return <GalleryDemo images={[images[0], __assign(__assign({}, video), { poster: "data:image/png;base64,bm90IGFuIGltYWdl" }), images[1]]}/>; },
|
|
82
|
+
};
|
|
83
|
+
// Test-only: open on a video that fails (a data URL that is not a video), with images after it.
|
|
84
|
+
export var BrokenVideoProbe = {
|
|
85
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
86
|
+
render: function () { return (<GalleryDemo images={[__assign(__assign({}, video), { src: "data:video/webm;base64,bm90IGEgdmlkZW8=" }), images[0], images[1]]} open/>); },
|
|
87
|
+
};
|
|
88
|
+
// Test-only: open on a lone video, so the viewer has no arrows and Close is the only button.
|
|
89
|
+
export var OneVideoProbe = {
|
|
90
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
91
|
+
render: function () { return <GalleryDemo images={[video]} open/>; },
|
|
92
|
+
};
|
|
49
93
|
// Test-only: the thumbnail's server markup is put on the page, its image fails (or, with a good image, loads), and
|
|
50
94
|
// only then does React hydrate it.
|
|
51
95
|
function HydrateProbe(_a) {
|
|
@@ -45,3 +45,20 @@ var PopoverWithMenuWrapper = function () {
|
|
|
45
45
|
export var WithMenu = {
|
|
46
46
|
render: function () { return <PopoverWithMenuWrapper />; },
|
|
47
47
|
};
|
|
48
|
+
// The caller clears the anchor as it closes: `open` and `anchorEl` change in the same render
|
|
49
|
+
var ClearAnchorProbeBox = function () {
|
|
50
|
+
var _a = useState(null), anchor = _a[0], setAnchor = _a[1];
|
|
51
|
+
return (<div style={{ padding: "100px" }}>
|
|
52
|
+
<button type="button" onClick={function (event) { return setAnchor(anchor ? null : event.currentTarget); }}>
|
|
53
|
+
Open probe
|
|
54
|
+
</button>
|
|
55
|
+
<Popover open={anchor !== null} anchorEl={anchor} onClose={function () { return setAnchor(null); }} returnFocus>
|
|
56
|
+
<input aria-label="Inside"/>
|
|
57
|
+
</Popover>
|
|
58
|
+
</div>);
|
|
59
|
+
};
|
|
60
|
+
export var ClearAnchorProbe = {
|
|
61
|
+
// For tests/interactions.spec.ts only: hidden from the sidebar and the docs, and skipped by the visual gate
|
|
62
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
63
|
+
render: function () { return <ClearAnchorProbeBox />; },
|
|
64
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneslash-design-system",
|
|
3
3
|
"description": "A design system for the Oneslash projects",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.23.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"storybook": "storybook dev -p 6006",
|
|
54
54
|
"build-storybook": "storybook build",
|
|
55
55
|
"pretest": "npm run build",
|
|
56
|
-
"test": "node --test scripts/*.test.js scripts/tokens/*.test.js scripts/cases/*.test.js",
|
|
56
|
+
"test": "node --test scripts/*.test.js scripts/tokens/*.test.js scripts/cases/*.test.js && npm run test:dates",
|
|
57
|
+
"test:dates": "TZ=America/New_York node --test scripts/date.test.js && TZ=Pacific/Auckland node --test scripts/date.test.js",
|
|
57
58
|
"check:contrast": "node scripts/check-contrast.js",
|
|
58
59
|
"test:visual": "playwright test tests/stories.spec.ts",
|
|
59
60
|
"test:visual:update": "playwright test tests/stories.spec.ts --update-snapshots",
|