oneslash-design-system 2.7.1 → 2.8.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.
- package/dist/components/checkBox.jsx +1 -1
- package/dist/components/pageHeader.d.ts +3 -1
- package/dist/components/pageHeader.jsx +3 -2
- package/dist/components/radioGroup.jsx +1 -1
- package/dist/stories/PageHeader.stories.d.ts +8 -0
- package/dist/stories/PageHeader.stories.jsx +23 -0
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export default function Checkbox(_a) {
|
|
|
14
14
|
setIsChecked(event.target.checked);
|
|
15
15
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.target.checked);
|
|
16
16
|
};
|
|
17
|
-
return (<label className={"group flex items-start ".concat(disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>
|
|
17
|
+
return (<label className={"group relative flex items-start ".concat(disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>
|
|
18
18
|
{/* Native input keeps keyboard focus, Space to toggle and screen-reader semantics */}
|
|
19
19
|
<input type="checkbox" className="peer sr-only" checked={isChecked} disabled={disabled} onChange={handleChange}/>
|
|
20
20
|
<span className={"relative flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full ".concat(stateTransition, "\n peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-0 peer-focus-visible:outline-fg-primary\n ").concat(disabled ? '' : 'group-hover:bg-action-selected')}>
|
|
@@ -3,11 +3,13 @@ interface PageHeaderProps {
|
|
|
3
3
|
/** A small line over the title: where this page sits. */
|
|
4
4
|
eyebrow?: string;
|
|
5
5
|
title: string;
|
|
6
|
+
/** The element: h1 to h3. Pick the one that fits the page's outline; it does not change the size. */
|
|
7
|
+
level?: 1 | 2 | 3;
|
|
6
8
|
lede?: React.ReactNode;
|
|
7
9
|
facts?: {
|
|
8
10
|
label: string;
|
|
9
11
|
value: React.ReactNode;
|
|
10
12
|
}[];
|
|
11
13
|
}
|
|
12
|
-
export default function PageHeader({ eyebrow, title, lede, facts }: PageHeaderProps): React.JSX.Element;
|
|
14
|
+
export default function PageHeader({ eyebrow, title, level, lede, facts }: PageHeaderProps): React.JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -2,13 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import FactsRow from './factsRow';
|
|
3
3
|
import Paragraph from './paragraph';
|
|
4
4
|
export default function PageHeader(_a) {
|
|
5
|
-
var eyebrow = _a.eyebrow, title = _a.title, lede = _a.lede, facts = _a.facts;
|
|
5
|
+
var eyebrow = _a.eyebrow, title = _a.title, _b = _a.level, level = _b === void 0 ? 1 : _b, lede = _a.lede, facts = _a.facts;
|
|
6
|
+
var Tag = "h".concat(level);
|
|
6
7
|
return (<div className="flex flex-col gap-huge">
|
|
7
8
|
<div className="flex flex-col gap-large">
|
|
8
9
|
{eyebrow && (<Paragraph tone="secondary" size="body2" measure="none">
|
|
9
10
|
{eyebrow}
|
|
10
11
|
</Paragraph>)}
|
|
11
|
-
<
|
|
12
|
+
<Tag className="text-h3 text-fg-primary md:text-h2">{title}</Tag>
|
|
12
13
|
{lede && (<Paragraph tone="secondary" measure="lede">
|
|
13
14
|
{lede}
|
|
14
15
|
</Paragraph>)}
|
|
@@ -8,7 +8,7 @@ export default function RadioGroup(_a) {
|
|
|
8
8
|
return (<div role="radiogroup" className={"flex ".concat(direction === 'horizontal' ? 'gap-4' : 'flex-col gap-2')}>
|
|
9
9
|
{options.map(function (option) {
|
|
10
10
|
var isSelected = selectedValue === option.value;
|
|
11
|
-
return (<label key={option.value} className="group flex items-start cursor-pointer">
|
|
11
|
+
return (<label key={option.value} className="group relative flex items-start cursor-pointer">
|
|
12
12
|
<input type="radio" name={groupName} value={option.value} checked={isSelected} onChange={function () { return onChange(option.value); }} className="peer sr-only"/>
|
|
13
13
|
{/* Hover halo and hit area, same as Checkbox */}
|
|
14
14
|
<span className={"relative flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full ".concat(stateTransition, "\n group-hover:bg-action-selected\n peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-0 peer-focus-visible:outline-fg-primary")}>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import PageHeader from "../components/pageHeader";
|
|
3
|
+
declare const meta: Meta<typeof PageHeader>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PageHeader>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
/** Renders an h2; the type style is the same as the default. */
|
|
8
|
+
export declare const Level2: Story;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PageHeader from "../components/pageHeader";
|
|
3
|
+
var meta = {
|
|
4
|
+
title: "Components/PageHeader",
|
|
5
|
+
component: PageHeader,
|
|
6
|
+
args: {
|
|
7
|
+
eyebrow: "Design Translation · 2011",
|
|
8
|
+
title: "Geocentric Clock",
|
|
9
|
+
lede: "The arm stays still and the numbers come to it.",
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
level: { control: "select", options: [1, 2, 3] },
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
function (Story) { return (<div style={{ padding: "16px" }}>
|
|
16
|
+
<Story />
|
|
17
|
+
</div>); },
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export var Default = {};
|
|
22
|
+
/** Renders an h2; the type style is the same as the default. */
|
|
23
|
+
export var Level2 = { args: { level: 2 } };
|