oneslash-design-system 2.6.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.
|
@@ -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 {};
|
package/dist/components/list.jsx
CHANGED
|
@@ -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
|
-
//
|
|
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 =
|
|
7
|
-
|
|
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
|
-
</
|
|
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" } };
|