oneslash-design-system 2.5.0 → 2.7.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.
@@ -13,7 +13,7 @@ export declare function Stack({ children, gap, align, className }: StackProps):
13
13
  export declare function Cluster({ children, gap, className }: LayoutProps): React.JSX.Element;
14
14
  interface GridProps extends LayoutProps {
15
15
  /** How many columns from the medium breakpoint up. Below it: two for `compact`, otherwise one. */
16
- columns?: 2 | 3 | 4;
16
+ columns?: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
17
17
  compact?: boolean;
18
18
  /** `stretch` makes the items in a row the same height; `start` lets each keep its own. */
19
19
  align?: 'stretch' | 'start';
@@ -18,7 +18,17 @@ export function Cluster(_a) {
18
18
  var children = _a.children, _b = _a.gap, gap = _b === void 0 ? 'medium' : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
19
19
  return <div className={"flex flex-wrap items-center ".concat(gaps[gap], " ").concat(className)}>{children}</div>;
20
20
  }
21
- var mdColumns = { 2: 'md:grid-cols-2', 3: 'md:grid-cols-3', 4: 'md:grid-cols-4' };
21
+ var mdColumns = {
22
+ 2: 'md:grid-cols-2',
23
+ 3: 'md:grid-cols-3',
24
+ 4: 'md:grid-cols-4',
25
+ 5: 'md:grid-cols-5',
26
+ 6: 'md:grid-cols-6',
27
+ 7: 'md:grid-cols-7',
28
+ 8: 'md:grid-cols-8',
29
+ 9: 'md:grid-cols-9',
30
+ 10: 'md:grid-cols-10',
31
+ };
22
32
  export function Grid(_a) {
23
33
  var children = _a.children, _b = _a.columns, columns = _b === void 0 ? 2 : _b, _c = _a.compact, compact = _c === void 0 ? false : _c, _d = _a.align, align = _d === void 0 ? 'stretch' : _d, _e = _a.gap, gap = _e === void 0 ? 'large' : _e, _f = _a.className, className = _f === void 0 ? '' : _f;
24
34
  return (<div className={"grid ".concat(compact ? 'grid-cols-2' : 'grid-cols-1', " ").concat(mdColumns[columns], " ").concat(align === 'start' ? 'items-start' : '', " ").concat(gaps[gap], " ").concat(className)}>
@@ -3,7 +3,8 @@ interface ListProps {
3
3
  items: React.ReactNode[];
4
4
  size?: 'body1' | 'body2';
5
5
  tone?: 'primary' | 'secondary';
6
+ marker?: 'none' | 'dot' | 'number';
6
7
  className?: string;
7
8
  }
8
- export default function List({ items, size, tone, className }: ListProps): React.JSX.Element;
9
+ export default function List({ items, size, tone, marker, className }: ListProps): React.JSX.Element;
9
10
  export {};
@@ -1,10 +1,16 @@
1
1
  import React from 'react';
2
2
  var sizes = { body1: 'text-body1', body2: 'text-body2' };
3
3
  var tones = { primary: 'text-fg-primary', secondary: 'text-fg-secondary' };
4
- // A plain list, one line of text per item, a little apart.
4
+ // Markers are the browser's own, set outside the text so a wrapped line stays
5
+ // aligned; they take the list's text color, so they follow `tone`.
6
+ var markers = { dot: 'list-disc pl-xlarge', number: 'list-decimal pl-xlarge' };
7
+ // A list, one line of text per item, a little apart. `marker` puts a dot or a
8
+ // number before each item; numbers use an <ol>.
5
9
  export default function List(_a) {
6
- var items = _a.items, _b = _a.size, size = _b === void 0 ? 'body2' : _b, _c = _a.tone, tone = _c === void 0 ? 'primary' : _c, _d = _a.className, className = _d === void 0 ? '' : _d;
7
- return (<ul className={"flex flex-col gap-medium ".concat(sizes[size], " ").concat(tones[tone], " ").concat(className)}>
10
+ var items = _a.items, _b = _a.size, size = _b === void 0 ? 'body2' : _b, _c = _a.tone, tone = _c === void 0 ? 'primary' : _c, _d = _a.marker, marker = _d === void 0 ? 'none' : _d, _e = _a.className, className = _e === void 0 ? '' : _e;
11
+ var Tag = marker === 'number' ? 'ol' : 'ul';
12
+ var markerClass = marker === 'none' ? '' : "".concat(markers[marker], " ");
13
+ return (<Tag className={"flex flex-col gap-medium ".concat(markerClass).concat(sizes[size], " ").concat(tones[tone], " ").concat(className)}>
8
14
  {items.map(function (item, i) { return (<li key={i}>{item}</li>); })}
9
- </ul>);
15
+ </Tag>);
10
16
  }
@@ -0,0 +1,9 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import List from "../components/list";
3
+ declare const meta: Meta<typeof List>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof List>;
6
+ export declare const None: Story;
7
+ export declare const Dot: Story;
8
+ export declare const Number: Story;
9
+ export declare const SecondaryDot: Story;
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import List from "../components/list";
3
+ var items = [
4
+ "Short item",
5
+ "A longer item that is long enough to wrap onto a second line in a narrow column, to show the marker staying put.",
6
+ "Last item",
7
+ ];
8
+ var meta = {
9
+ title: "Components/List",
10
+ component: List,
11
+ args: { items: items },
12
+ argTypes: {
13
+ marker: { control: "select", options: ["none", "dot", "number"] },
14
+ size: { control: "select", options: ["body1", "body2"] },
15
+ tone: { control: "select", options: ["primary", "secondary"] },
16
+ },
17
+ decorators: [
18
+ function (Story) { return (<div style={{ width: "280px", padding: "16px" }}>
19
+ <Story />
20
+ </div>); },
21
+ ],
22
+ };
23
+ export default meta;
24
+ export var None = { args: { marker: "none" } };
25
+ export var Dot = { args: { marker: "dot" } };
26
+ export var Number = { args: { marker: "number" } };
27
+ export var SecondaryDot = { args: { marker: "dot", tone: "secondary" } };
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.5.0",
4
+ "version": "2.7.0",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",