oneslash-design-system 2.14.2 → 2.15.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.
Files changed (52) hide show
  1. package/README.md +10 -0
  2. package/dist/DESIGN.md +134 -1
  3. package/dist/cases/agent-asks-before-risky-action.md +29 -0
  4. package/dist/cases/agent-cancels-when-unanswered.md +27 -0
  5. package/dist/cases/agent-refuses-clearly.md +31 -0
  6. package/dist/cases/agent-says-what-it-is.md +29 -0
  7. package/dist/cases/agent-shows-progress.md +30 -0
  8. package/dist/cases/agent-shows-sources.md +26 -0
  9. package/dist/cases/login-page/centered.d.ts +1 -0
  10. package/dist/cases/login-page/centered.jsx +69 -0
  11. package/dist/cases/login-page/email-only.d.ts +1 -0
  12. package/dist/cases/login-page/email-only.jsx +56 -0
  13. package/dist/cases/login-page/provider-first.d.ts +1 -0
  14. package/dist/cases/login-page/provider-first.jsx +63 -0
  15. package/dist/cases/login-page/split.d.ts +1 -0
  16. package/dist/cases/login-page/split.jsx +76 -0
  17. package/dist/cases/login-page.md +356 -0
  18. package/dist/cases.json +256 -0
  19. package/dist/components/brandIcon.d.ts +12 -0
  20. package/dist/components/brandIcon.jsx +24 -0
  21. package/dist/components/form.d.ts +11 -0
  22. package/dist/components/form.jsx +22 -0
  23. package/dist/components/image.d.ts +14 -0
  24. package/dist/components/image.jsx +6 -0
  25. package/dist/components/layout.d.ts +18 -1
  26. package/dist/components/layout.jsx +16 -0
  27. package/dist/components/line.d.ts +3 -1
  28. package/dist/components/line.jsx +8 -1
  29. package/dist/components/tabsContainer.jsx +4 -2
  30. package/dist/components/tooltip.jsx +3 -1
  31. package/dist/designTokens.d.ts +1 -0
  32. package/dist/designTokens.js +1 -0
  33. package/dist/native-mapping.json +17 -1
  34. package/dist/stories/BrandIcon.stories.d.ts +9 -0
  35. package/dist/stories/BrandIcon.stories.jsx +19 -0
  36. package/dist/stories/Cases.generated.stories.d.ts +8 -0
  37. package/dist/stories/Cases.generated.stories.jsx +12 -0
  38. package/dist/stories/Form.stories.d.ts +6 -0
  39. package/dist/stories/Form.stories.jsx +26 -0
  40. package/dist/stories/Image.stories.d.ts +7 -0
  41. package/dist/stories/Image.stories.jsx +18 -0
  42. package/dist/stories/Line.stories.d.ts +1 -0
  43. package/dist/stories/Line.stories.jsx +12 -0
  44. package/dist/stories/PageComponents.stories.d.ts +2 -0
  45. package/dist/stories/PageComponents.stories.jsx +15 -1
  46. package/dist/tailwind-preset-auto.js +2 -1
  47. package/dist/tailwind-preset.js +2 -1
  48. package/dist/theme-auto.css +1 -0
  49. package/dist/theme.css +1 -0
  50. package/dist/tokens.css +1 -0
  51. package/dist/tokens.json +7 -0
  52. package/package.json +4 -2
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ // A Tailwind class that sets a width or a height, with any variant or `!` in front
3
+ var SIZE_CLASS = /(^|[\s:!])(w|h|size)-/;
4
+ var GITHUB = 'M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12';
5
+ var APPLE = 'M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701';
6
+ var marks = {
7
+ github: <path fill="currentColor" d={GITHUB}/>,
8
+ apple: <path fill="currentColor" d={APPLE}/>,
9
+ google: (<>
10
+ <path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
11
+ <path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
12
+ <path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/>
13
+ <path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/>
14
+ </>),
15
+ };
16
+ // `strokeWidth` and any other prop a Button's icon slot passes is not a prop here, so it never reaches the DOM
17
+ export default function BrandIcon(_a) {
18
+ var name = _a.name, _b = _a.size, size = _b === void 0 ? 16 : _b, className = _a.className, title = _a.title;
19
+ var sizedByClass = !!className && SIZE_CLASS.test(className);
20
+ return (<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" {...(sizedByClass ? {} : { width: size, height: size })} className={className} {...(title ? { role: 'img', 'aria-label': title } : { 'aria-hidden': true })}>
21
+ {title && <title>{title}</title>}
22
+ {marks[name]}
23
+ </svg>);
24
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { Gap } from './layout';
3
+ interface FormProps {
4
+ children: React.ReactNode;
5
+ /** Called when the form is submitted, from a submit Button or the Enter key. The page does not reload. */
6
+ onSubmit: () => void;
7
+ gap?: Gap;
8
+ 'aria-label'?: string;
9
+ }
10
+ export default function Form({ children, onSubmit, gap, 'aria-label': ariaLabel }: FormProps): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ var gaps = {
4
+ small: 'gap-small',
5
+ medium: 'gap-medium',
6
+ large: 'gap-large',
7
+ xlarge: 'gap-xlarge',
8
+ xxlarge: 'gap-xxlarge',
9
+ huge: 'gap-huge',
10
+ giant: 'gap-giant',
11
+ };
12
+ // A column of fields that submits as one. Put a Button with `htmlType="submit"` inside it.
13
+ // The browser does not validate; the app shows its own errors.
14
+ export default function Form(_a) {
15
+ var children = _a.children, onSubmit = _a.onSubmit, _b = _a.gap, gap = _b === void 0 ? 'large' : _b, ariaLabel = _a["aria-label"];
16
+ return (<form noValidate aria-label={ariaLabel} className={"flex flex-col ".concat(gaps[gap])} onSubmit={function (event) {
17
+ event.preventDefault();
18
+ onSubmit();
19
+ }}>
20
+ {children}
21
+ </form>);
22
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface ImageProps {
3
+ src: string;
4
+ /** Required. Use "" for an image that only decorates. */
5
+ alt: string;
6
+ /** Pixel size of the file. Set both so the browser keeps the space before the image loads. */
7
+ width?: number;
8
+ height?: number;
9
+ /** How the image fills its box. Not set, the browser default applies. Inside a `Figure` with `crop`, the figure fills the frame and `fit` has no effect. */
10
+ fit?: 'cover' | 'contain';
11
+ loading?: 'lazy' | 'eager';
12
+ }
13
+ export default function Image({ src, alt, width, height, fit, loading }: ImageProps): React.JSX.Element;
14
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ var fits = { cover: 'object-cover', contain: 'object-contain' };
3
+ export default function Image(_a) {
4
+ var src = _a.src, alt = _a.alt, width = _a.width, height = _a.height, fit = _a.fit, loading = _a.loading;
5
+ return <img src={src} alt={alt} width={width} height={height} loading={loading} className={fit ? fits[fit] : undefined}/>;
6
+ }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- type Gap = 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | 'huge' | 'giant';
2
+ export type Gap = 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | 'huge' | 'giant';
3
3
  interface LayoutProps {
4
4
  children: React.ReactNode;
5
5
  gap?: Gap;
@@ -20,4 +20,21 @@ interface GridProps extends LayoutProps {
20
20
  }
21
21
  export declare function Grid({ children, columns, compact, align, gap, className }: GridProps): React.JSX.Element;
22
22
  export declare function PageSection({ children, gap, className }: LayoutProps): React.JSX.Element;
23
+ interface CenterProps {
24
+ children: React.ReactNode;
25
+ /** `form` is a narrow column, `page` the width of a page. */
26
+ width?: 'form' | 'page';
27
+ /** Take at least the window height and center the column vertically too. */
28
+ fill?: boolean;
29
+ gap?: Gap;
30
+ }
31
+ export declare function Center({ children, width, fill, gap }: CenterProps): React.JSX.Element;
32
+ interface SplitProps {
33
+ /** The first half, on a panel. It is not shown below the medium breakpoint. */
34
+ aside: React.ReactNode;
35
+ children: React.ReactNode;
36
+ /** Take at least the window height. */
37
+ fill?: boolean;
38
+ }
39
+ export declare function Split({ aside, children, fill }: SplitProps): React.JSX.Element;
23
40
  export {};
@@ -41,3 +41,19 @@ export function PageSection(_a) {
41
41
  var children = _a.children, _b = _a.gap, gap = _b === void 0 ? 'huge' : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
42
42
  return <section className={"flex flex-col ".concat(gaps[gap], " ").concat(className)}>{children}</section>;
43
43
  }
44
+ // A column centered in the window. For a page that is one narrow thing, such as a form.
45
+ export function Center(_a) {
46
+ var children = _a.children, _b = _a.width, width = _b === void 0 ? 'form' : _b, _c = _a.fill, fill = _c === void 0 ? false : _c, _d = _a.gap, gap = _d === void 0 ? 'xlarge' : _d;
47
+ return (<div className={"mx-auto flex w-full flex-col px-xlarge ".concat(width === 'page' ? 'max-w-page' : 'max-w-form', " ").concat(fill ? 'min-h-screen justify-center' : '', " ").concat(gaps[gap])}>
48
+ {children}
49
+ </div>);
50
+ }
51
+ // A page of two equal halves from the medium breakpoint up. Below it, only the children.
52
+ // Put a `<Center fill>` in the second half to center a form in it.
53
+ export function Split(_a) {
54
+ var aside = _a.aside, children = _a.children, _b = _a.fill, fill = _b === void 0 ? false : _b;
55
+ return (<div className={"grid grid-cols-1 md:grid-cols-2 ".concat(fill ? 'min-h-screen' : '')}>
56
+ <div className="hidden md:flex items-center justify-center bg-background-panel p-xxlarge">{aside}</div>
57
+ <div>{children}</div>
58
+ </div>);
59
+ }
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  interface LineProps {
3
+ /** A short word between two lines, such as "or". Horizontal only; ignored when vertical. */
4
+ label?: string;
3
5
  direction?: 'horizontal' | 'vertical';
4
6
  className?: string;
5
7
  }
6
- export default function Line({ direction, className, }: LineProps): React.JSX.Element;
8
+ export default function Line({ label, direction, className, }: LineProps): React.JSX.Element;
7
9
  export {};
@@ -1,10 +1,17 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
  export default function Line(_a) {
4
- var _b = _a.direction, direction = _b === void 0 ? 'horizontal' : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
4
+ var label = _a.label, _b = _a.direction, direction = _b === void 0 ? 'horizontal' : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
5
5
  var baseClasses = 'bg-misc-divider';
6
6
  if (direction === 'vertical') {
7
7
  return (<div className={"".concat(baseClasses, " w-px h-full ").concat(className)}/>);
8
8
  }
9
+ if (label) {
10
+ return (<div className={"flex items-center gap-medium w-full ".concat(className)}>
11
+ <div className={"".concat(baseClasses, " h-px flex-1")}/>
12
+ <span className="text-caption text-fg-secondary">{label}</span>
13
+ <div className={"".concat(baseClasses, " h-px flex-1")}/>
14
+ </div>);
15
+ }
9
16
  return (<div className={"".concat(baseClasses, " h-px w-full ").concat(className)}/>);
10
17
  }
@@ -1,5 +1,7 @@
1
1
  'use client';
2
- import React, { createContext, useLayoutEffect, useRef, useState } from 'react';
2
+ import React, { createContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
+ // useLayoutEffect warns on a server render, where it cannot run; useEffect is the same there and silent
4
+ var useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
3
5
  // Lets a Tab know a container draws its selected background (the sliding pill)
4
6
  export var TabsContainerContext = createContext(false);
5
7
  export default function TabsContainer(_a) {
@@ -8,7 +10,7 @@ export default function TabsContainer(_a) {
8
10
  var containerRef = useRef(null);
9
11
  var selectedRef = useRef(null);
10
12
  var _b = useState(null), indicator = _b[0], setIndicator = _b[1];
11
- useLayoutEffect(function () {
13
+ useIsomorphicLayoutEffect(function () {
12
14
  var _a;
13
15
  var container = containerRef.current;
14
16
  if (!container)
@@ -2,6 +2,8 @@
2
2
  import React, { useState, useRef, useLayoutEffect, useEffect, useId } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import { useOverlayTransition } from './useOverlayTransition';
5
+ // useLayoutEffect warns on a server render, where it cannot run; useEffect is the same there and silent
6
+ var useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
5
7
  var VIEWPORT_MARGIN = 8;
6
8
  var OFFSET = 4;
7
9
  // Hover delay so tooltips don't flash while the pointer passes over
@@ -18,7 +20,7 @@ export default function Tooltip(_a) {
18
20
  var triggerRef = useRef(null);
19
21
  var tooltipId = useId();
20
22
  // Measure the trigger and the tooltip, then place the tooltip where it fits entirely on screen
21
- useLayoutEffect(function () {
23
+ useIsomorphicLayoutEffect(function () {
22
24
  if (!mounted) {
23
25
  setCoords(null);
24
26
  return;
@@ -1583,6 +1583,7 @@ export declare namespace measure {
1583
1583
  export declare let container: {
1584
1584
  page: string;
1585
1585
  'page-wide': string;
1586
+ form: string;
1586
1587
  };
1587
1588
  export declare namespace stage {
1588
1589
  let short: string;
@@ -208,6 +208,7 @@ var base = {
208
208
  container: {
209
209
  page: '48rem',
210
210
  'page-wide': '64rem',
211
+ form: '24rem',
211
212
  },
212
213
  stage: {
213
214
  short: '20rem',
@@ -12,6 +12,11 @@
12
12
  "compose": "`Button`, `OutlinedButton`",
13
13
  "note": "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`."
14
14
  },
15
+ {
16
+ "ods": "brandIcon",
17
+ "swiftui": "the provider's own button where one exists (`SignInWithAppleButton`), else an asset in the app",
18
+ "compose": "an asset in the app"
19
+ },
15
20
  {
16
21
  "ods": "checkBox",
17
22
  "swiftui": "`Toggle` (switch on iOS, `.toggleStyle(.checkbox)` on macOS)",
@@ -35,6 +40,12 @@
35
40
  "compose": "Not applicable: web page pattern",
36
41
  "note": "In an app screen: an `Image` with a caption `Text` in the caption text style."
37
42
  },
43
+ {
44
+ "ods": "form",
45
+ "swiftui": "`Form`",
46
+ "compose": "A `Column` of fields; submit from the keyboard action",
47
+ "note": "On Apple the system lays the fields out; do not add spacing."
48
+ },
38
49
  {
39
50
  "ods": "heading",
40
51
  "swiftui": "`Text` with the type role's text style and `.accessibilityAddTraits(.isHeader)`",
@@ -50,11 +61,16 @@
50
61
  "swiftui": "`Button` with a `Label` and `.labelStyle(.iconOnly)`",
51
62
  "compose": "`IconButton`"
52
63
  },
64
+ {
65
+ "ods": "image",
66
+ "swiftui": "`Image` / `AsyncImage`",
67
+ "compose": "`Image` with the app's image loader"
68
+ },
53
69
  {
54
70
  "ods": "layout",
55
71
  "swiftui": "Not applicable: web page pattern",
56
72
  "compose": "Not applicable: web page pattern",
57
- "note": "In an app screen: `VStack` / `HStack` / `Grid`; Compose `Column` / `Row` / `LazyVerticalGrid`."
73
+ "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."
58
74
  },
59
75
  {
60
76
  "ods": "line",
@@ -0,0 +1,9 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import BrandIcon from "../components/brandIcon";
3
+ declare const meta: Meta<typeof BrandIcon>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof BrandIcon>;
6
+ export declare const Google: Story;
7
+ export declare const GitHub: Story;
8
+ export declare const Apple: Story;
9
+ export declare const InAButton: Story;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import BrandIcon from "../components/brandIcon";
3
+ import Button from "../components/button";
4
+ var meta = {
5
+ title: "Components/BrandIcon",
6
+ component: BrandIcon,
7
+ argTypes: {
8
+ name: { control: "select", options: ["google", "github", "apple"] },
9
+ size: { control: "number" },
10
+ title: { control: "text" },
11
+ },
12
+ };
13
+ export default meta;
14
+ export var Google = { args: { name: "google", size: 24 } };
15
+ export var GitHub = { args: { name: "github", size: 24 } };
16
+ export var Apple = { args: { name: "apple", size: 24 } };
17
+ export var InAButton = {
18
+ render: function () { return (<Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google"/>}/>); },
19
+ };
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ type Story = StoryObj;
5
+ export declare const LoginPage_Centered: Story;
6
+ export declare const LoginPage_Split: Story;
7
+ export declare const LoginPage_ProviderFirst: Story;
8
+ export declare const LoginPage_EmailOnly: Story;
@@ -0,0 +1,12 @@
1
+ // Generated from cases/ by npm run build. Do not edit.
2
+ import React from "react";
3
+ import LoginPage_CenteredExample from "../cases/login-page/centered";
4
+ import LoginPage_SplitExample from "../cases/login-page/split";
5
+ import LoginPage_ProviderFirstExample from "../cases/login-page/provider-first";
6
+ import LoginPage_EmailOnlyExample from "../cases/login-page/email-only";
7
+ var meta = { title: "Cases" };
8
+ export default meta;
9
+ export var LoginPage_Centered = { render: function () { return <LoginPage_CenteredExample />; } };
10
+ export var LoginPage_Split = { render: function () { return <LoginPage_SplitExample />; } };
11
+ export var LoginPage_ProviderFirst = { render: function () { return <LoginPage_ProviderFirstExample />; } };
12
+ export var LoginPage_EmailOnly = { render: function () { return <LoginPage_EmailOnlyExample />; } };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Form from "../components/form";
3
+ declare const meta: Meta<typeof Form>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Form>;
6
+ export declare const Default: Story;
@@ -0,0 +1,26 @@
1
+ import React, { useState } from "react";
2
+ import Form from "../components/form";
3
+ import TextField from "../components/textField";
4
+ import Button from "../components/button";
5
+ var meta = {
6
+ title: "Components/Form",
7
+ component: Form,
8
+ argTypes: {
9
+ gap: {
10
+ control: "select",
11
+ options: ["small", "medium", "large", "xlarge", "xxlarge", "huge", "giant"],
12
+ },
13
+ },
14
+ };
15
+ export default meta;
16
+ export var Default = {
17
+ render: function (args) {
18
+ var _a = useState(""), email = _a[0], setEmail = _a[1];
19
+ var _b = useState(""), password = _b[0], setPassword = _b[1];
20
+ return (<Form {...args} aria-label="Sign in" onSubmit={function () { return alert("Submitted"); }}>
21
+ <TextField id="form-email" label="Email" type="email" value={email} onChange={function (e) { return setEmail(e.target.value); }}/>
22
+ <TextField id="form-password" label="Password" type="password" value={password} onChange={function (e) { return setPassword(e.target.value); }}/>
23
+ <Button size="medium" type="primary" state="enabled" label="Sign in" htmlType="submit"/>
24
+ </Form>);
25
+ },
26
+ };
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Image from "../components/image";
3
+ declare const meta: Meta<typeof Image>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Image>;
6
+ export declare const Default: Story;
7
+ export declare const Decoration: Story;
@@ -0,0 +1,18 @@
1
+ import Image from "../components/image";
2
+ var meta = {
3
+ title: "Components/Image",
4
+ component: Image,
5
+ argTypes: {
6
+ fit: { control: "select", options: [undefined, "cover", "contain"] },
7
+ loading: { control: "select", options: [undefined, "lazy", "eager"] },
8
+ },
9
+ };
10
+ export default meta;
11
+ var src = "data:image/svg+xml;utf8," +
12
+ encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180"><rect width="320" height="180" fill="#888"/></svg>');
13
+ export var Default = {
14
+ args: { src: src, alt: "A grey rectangle", width: 320, height: 180 },
15
+ };
16
+ export var Decoration = {
17
+ args: { src: src, alt: "", width: 160, height: 90, fit: "cover" },
18
+ };
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof Line>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Line>;
6
6
  export declare const Horizontal: Story;
7
+ export declare const WithLabel: Story;
7
8
  export declare const Vertical: Story;
8
9
  export declare const InFlexContainer: Story;
9
10
  export declare const BetweenSections: Story;
@@ -4,6 +4,7 @@ var meta = {
4
4
  title: "Components/Line",
5
5
  component: Line,
6
6
  argTypes: {
7
+ label: { control: "text" },
7
8
  direction: {
8
9
  control: "select",
9
10
  options: ["horizontal", "vertical"],
@@ -23,6 +24,17 @@ export var Horizontal = {
23
24
  </div>); },
24
25
  ],
25
26
  };
27
+ export var WithLabel = {
28
+ args: {
29
+ direction: "horizontal",
30
+ label: "or",
31
+ },
32
+ decorators: [
33
+ function (Story) { return (<div style={{ width: "100%", padding: "16px" }}>
34
+ <Story />
35
+ </div>); },
36
+ ],
37
+ };
26
38
  export var Vertical = {
27
39
  args: {
28
40
  direction: "vertical",
@@ -4,3 +4,5 @@ export default meta;
4
4
  type Story = StoryObj;
5
5
  export declare const Page: Story;
6
6
  export declare const FactsAndFigures: Story;
7
+ export declare const CenteredColumn: Story;
8
+ export declare const TwoHalves: Story;
@@ -9,7 +9,7 @@ import FactsRow from "../components/factsRow";
9
9
  import LinkCard from "../components/linkCard";
10
10
  import Figure from "../components/figure";
11
11
  import Tag from "../components/tag";
12
- import { Cluster, Grid, PageSection, Stack } from "../components/layout";
12
+ import { Center, Cluster, Grid, PageSection, Split, Stack } from "../components/layout";
13
13
  var meta = {
14
14
  title: "Pages/Page components",
15
15
  };
@@ -74,3 +74,17 @@ export var FactsAndFigures = {
74
74
  </Grid>
75
75
  </Stack>); },
76
76
  };
77
+ export var CenteredColumn = {
78
+ render: function () { return (<Center>
79
+ <SectionIntro name="Sign in"/>
80
+ <Paragraph tone="secondary">A narrow column in the middle of the page.</Paragraph>
81
+ </Center>); },
82
+ };
83
+ export var TwoHalves = {
84
+ render: function () { return (<Split aside={<Paragraph>The aside shows from the medium breakpoint up.</Paragraph>}>
85
+ <Center fill>
86
+ <SectionIntro name="Sign in"/>
87
+ <Paragraph tone="secondary">The other half holds the page.</Paragraph>
88
+ </Center>
89
+ </Split>); },
90
+ };
@@ -290,7 +290,8 @@ module.exports = {
290
290
  "measure-body": "var(--os-measure-body)",
291
291
  "measure-wide": "var(--os-measure-wide)",
292
292
  "page": "var(--os-container-page)",
293
- "page-wide": "var(--os-container-page-wide)"
293
+ "page-wide": "var(--os-container-page-wide)",
294
+ "form": "var(--os-container-form)"
294
295
  },
295
296
  "fontSize": {
296
297
  "h1": [
@@ -284,7 +284,8 @@ module.exports = {
284
284
  "measure-body": "var(--os-measure-body)",
285
285
  "measure-wide": "var(--os-measure-wide)",
286
286
  "page": "var(--os-container-page)",
287
- "page-wide": "var(--os-container-page-wide)"
287
+ "page-wide": "var(--os-container-page-wide)",
288
+ "form": "var(--os-container-form)"
288
289
  },
289
290
  "fontSize": {
290
291
  "h1": [
@@ -278,4 +278,5 @@
278
278
  --container-measure-wide: var(--os-measure-wide);
279
279
  --container-page: var(--os-container-page);
280
280
  --container-page-wide: var(--os-container-page-wide);
281
+ --container-form: var(--os-container-form);
281
282
  }
package/dist/theme.css CHANGED
@@ -273,4 +273,5 @@
273
273
  --container-measure-wide: var(--os-measure-wide);
274
274
  --container-page: var(--os-container-page);
275
275
  --container-page-wide: var(--os-container-page-wide);
276
+ --container-form: var(--os-container-form);
276
277
  }
package/dist/tokens.css CHANGED
@@ -29,6 +29,7 @@
29
29
  --os-measure-wide: 75ch;
30
30
  --os-container-page: 48rem;
31
31
  --os-container-page-wide: 64rem;
32
+ --os-container-form: 24rem;
32
33
  --os-stage-short: 20rem;
33
34
  --os-stage-tall: 26rem;
34
35
  }
package/dist/tokens.json CHANGED
@@ -20361,6 +20361,13 @@
20361
20361
  "value": 64,
20362
20362
  "unit": "rem"
20363
20363
  }
20364
+ },
20365
+ "form": {
20366
+ "$type": "dimension",
20367
+ "$value": {
20368
+ "value": 24,
20369
+ "unit": "rem"
20370
+ }
20364
20371
  }
20365
20372
  },
20366
20373
  "stage": {
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.14.2",
4
+ "version": "2.15.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "./dist/index.js",
@@ -18,6 +18,8 @@
18
18
  "./tokens.json": "./dist/tokens.json",
19
19
  "./native-mapping.json": "./dist/native-mapping.json",
20
20
  "./DESIGN.md": "./dist/DESIGN.md",
21
+ "./cases.json": "./dist/cases.json",
22
+ "./cases/*": "./dist/cases/*",
21
23
  "./tokens": {
22
24
  "types": "./dist/designTokens.d.ts",
23
25
  "default": "./dist/designTokens.js"
@@ -43,7 +45,7 @@
43
45
  "storybook": "storybook dev -p 6006",
44
46
  "build-storybook": "storybook build",
45
47
  "pretest": "npm run build",
46
- "test": "node --test scripts/*.test.js scripts/tokens/*.test.js",
48
+ "test": "node --test scripts/*.test.js scripts/tokens/*.test.js scripts/cases/*.test.js",
47
49
  "check:contrast": "node scripts/check-contrast.js",
48
50
  "test:visual": "playwright test",
49
51
  "test:visual:update": "playwright test --update-snapshots"