@arbor-education/design-system.components 0.21.1 → 0.22.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/CHANGELOG.md +12 -0
- package/component-library.md +15 -14
- package/dist/components/articleCard/ArticleCard.d.ts +2 -2
- package/dist/components/articleCard/ArticleCard.d.ts.map +1 -1
- package/dist/components/articleCard/ArticleCard.js +3 -3
- package/dist/components/articleCard/ArticleCard.js.map +1 -1
- package/dist/components/articleCard/ArticleCard.stories.d.ts +11 -3
- package/dist/components/articleCard/ArticleCard.stories.d.ts.map +1 -1
- package/dist/components/articleCard/ArticleCard.stories.js +16 -11
- package/dist/components/articleCard/ArticleCard.stories.js.map +1 -1
- package/dist/components/iconText/IconText.d.ts +43 -0
- package/dist/components/iconText/IconText.d.ts.map +1 -0
- package/dist/components/iconText/IconText.js +29 -0
- package/dist/components/iconText/IconText.js.map +1 -0
- package/dist/components/{icoText/IcoText.stories.d.ts → iconText/IconText.stories.d.ts} +8 -9
- package/dist/components/iconText/IconText.stories.d.ts.map +1 -0
- package/dist/components/{icoText/IcoText.stories.js → iconText/IconText.stories.js} +81 -81
- package/dist/components/iconText/IconText.stories.js.map +1 -0
- package/dist/components/iconText/IconText.test.d.ts +2 -0
- package/dist/components/iconText/IconText.test.d.ts.map +1 -0
- package/dist/components/{icoText/IcoText.test.js → iconText/IconText.test.js} +6 -6
- package/dist/components/iconText/IconText.test.js.map +1 -0
- package/dist/components/modal/Modal.d.ts +1 -0
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +2 -2
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/tag/Tag.d.ts +14 -1
- package/dist/components/tag/Tag.d.ts.map +1 -1
- package/dist/components/tag/Tag.js +9 -3
- package/dist/components/tag/Tag.js.map +1 -1
- package/dist/components/tag/Tag.stories.d.ts +1 -1
- package/dist/components/tag/Tag.stories.d.ts.map +1 -1
- package/dist/components/tag/Tag.stories.js +3 -3
- package/dist/components/tag/Tag.stories.js.map +1 -1
- package/dist/components/tag/Tag.test.js +36 -5
- package/dist/components/tag/Tag.test.js.map +1 -1
- package/dist/components/tagList/TagList.d.ts +49 -0
- package/dist/components/tagList/TagList.d.ts.map +1 -0
- package/dist/components/tagList/TagList.js +114 -0
- package/dist/components/tagList/TagList.js.map +1 -0
- package/dist/components/tagList/TagList.stories.d.ts +130 -0
- package/dist/components/tagList/TagList.stories.d.ts.map +1 -0
- package/dist/components/tagList/TagList.stories.js +443 -0
- package/dist/components/tagList/TagList.stories.js.map +1 -0
- package/dist/components/{icoText/IcoText.test.d.ts → tagList/TagList.test.d.ts} +1 -1
- package/dist/components/tagList/TagList.test.d.ts.map +1 -0
- package/dist/components/tagList/TagList.test.js +246 -0
- package/dist/components/tagList/TagList.test.js.map +1 -0
- package/dist/components/tagList/useTagListCollapsedLayout.d.ts +19 -0
- package/dist/components/tagList/useTagListCollapsedLayout.d.ts.map +1 -0
- package/dist/components/tagList/useTagListCollapsedLayout.js +48 -0
- package/dist/components/tagList/useTagListCollapsedLayout.js.map +1 -0
- package/dist/components/tagList/useVisibleTags.d.ts +18 -0
- package/dist/components/tagList/useVisibleTags.d.ts.map +1 -0
- package/dist/components/tagList/useVisibleTags.js +41 -0
- package/dist/components/tagList/useVisibleTags.js.map +1 -0
- package/dist/index.css +130 -10
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/hooks/useElementWidth.d.ts +2 -0
- package/dist/utils/hooks/useElementWidth.d.ts.map +1 -0
- package/dist/utils/hooks/useElementWidth.js +30 -0
- package/dist/utils/hooks/useElementWidth.js.map +1 -0
- package/dist/utils/hooks/useMeasuredChildWidths.d.ts +8 -0
- package/dist/utils/hooks/useMeasuredChildWidths.d.ts.map +1 -0
- package/dist/utils/hooks/useMeasuredChildWidths.js +26 -0
- package/dist/utils/hooks/useMeasuredChildWidths.js.map +1 -0
- package/dist/utils/hooks/useRovingFocus.d.ts +18 -0
- package/dist/utils/hooks/useRovingFocus.d.ts.map +1 -0
- package/dist/utils/hooks/useRovingFocus.js +130 -0
- package/dist/utils/hooks/useRovingFocus.js.map +1 -0
- package/dist/utils/hooks/useRovingFocus.test.d.ts +2 -0
- package/dist/utils/hooks/useRovingFocus.test.d.ts.map +1 -0
- package/dist/utils/hooks/useRovingFocus.test.js +59 -0
- package/dist/utils/hooks/useRovingFocus.test.js.map +1 -0
- package/dist/utils/spacedWidths.d.ts +3 -0
- package/dist/utils/spacedWidths.d.ts.map +1 -0
- package/dist/utils/spacedWidths.js +28 -0
- package/dist/utils/spacedWidths.js.map +1 -0
- package/dist/utils/spacedWidths.test.d.ts +2 -0
- package/dist/utils/spacedWidths.test.d.ts.map +1 -0
- package/dist/utils/spacedWidths.test.js +17 -0
- package/dist/utils/spacedWidths.test.js.map +1 -0
- package/package.json +1 -1
- package/src/components/articleCard/ArticleCard.stories.tsx +17 -12
- package/src/components/articleCard/ArticleCard.tsx +9 -9
- package/src/components/{icoText/IcoText.stories.tsx → iconText/IconText.stories.tsx} +112 -112
- package/src/components/{icoText/IcoText.test.tsx → iconText/IconText.test.tsx} +10 -10
- package/src/components/{icoText/IcoText.tsx → iconText/IconText.tsx} +27 -20
- package/src/components/modal/Modal.tsx +5 -1
- package/src/components/tag/Tag.stories.tsx +4 -4
- package/src/components/tag/Tag.test.tsx +62 -5
- package/src/components/tag/Tag.tsx +61 -3
- package/src/components/tag/tag.scss +80 -9
- package/src/components/tagList/TagList.stories.tsx +564 -0
- package/src/components/tagList/TagList.test.tsx +342 -0
- package/src/components/tagList/TagList.tsx +296 -0
- package/src/components/tagList/tagList.scss +56 -0
- package/src/components/tagList/useTagListCollapsedLayout.ts +83 -0
- package/src/components/tagList/useVisibleTags.ts +74 -0
- package/src/index.scss +2 -1
- package/src/index.ts +3 -1
- package/src/tokens.scss +2 -1
- package/src/utils/hooks/useElementWidth.ts +39 -0
- package/src/utils/hooks/useMeasuredChildWidths.ts +39 -0
- package/src/utils/hooks/useRovingFocus.test.tsx +105 -0
- package/src/utils/hooks/useRovingFocus.ts +163 -0
- package/src/utils/spacedWidths.test.ts +20 -0
- package/src/utils/spacedWidths.ts +37 -0
- package/dist/components/icoText/IcoText.d.ts +0 -37
- package/dist/components/icoText/IcoText.d.ts.map +0 -1
- package/dist/components/icoText/IcoText.js +0 -29
- package/dist/components/icoText/IcoText.js.map +0 -1
- package/dist/components/icoText/IcoText.stories.d.ts.map +0 -1
- package/dist/components/icoText/IcoText.stories.js.map +0 -1
- package/dist/components/icoText/IcoText.test.d.ts.map +0 -1
- package/dist/components/icoText/IcoText.test.js.map +0 -1
- /package/src/components/{icoText/icoText.scss → iconText/iconText.scss} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Controls, Heading as DocHeading,
|
|
3
|
-
import {
|
|
2
|
+
import { Controls, Heading as DocHeading, Primary as DocPrimary, Markdown, Stories, Subtitle, Title, } from '@storybook/addon-docs/blocks';
|
|
3
|
+
import { IconText } from './IconText.js';
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
// Docs page content
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
const DESCRIPTION_INTRO = [
|
|
8
|
-
'`
|
|
8
|
+
'`IconText` is a compound layout component that pairs an icon in a left rail with a heading and/or paragraph.',
|
|
9
9
|
'It is the canonical icon-plus-text primitive in this design system — used internally by `ArticleCard`',
|
|
10
10
|
'and available for direct use in any context that needs an icon anchoring labelled content.',
|
|
11
11
|
].join(' ');
|
|
@@ -46,25 +46,25 @@ const USAGE_GUIDANCE = [
|
|
|
46
46
|
'| Content inside a navigable card | [`ArticleCard`](?path=/docs/components-card-articlecard--docs) |',
|
|
47
47
|
'| Icon with no text | [`Icon`](?path=/docs/components-icon--docs) directly |',
|
|
48
48
|
'| Long-form prose | Semantic HTML `<p>` with a separate heading |',
|
|
49
|
-
'| Interactive element | Wrap `
|
|
49
|
+
'| Interactive element | Wrap `IconText` inside a `Card` or `Button` — never add `onClick` to `IconText` itself |',
|
|
50
50
|
].join('\n');
|
|
51
51
|
const DEVELOPER_NOTES = [
|
|
52
52
|
'### Critical usage patterns',
|
|
53
53
|
'',
|
|
54
|
-
'**`
|
|
55
|
-
'The root inspects `children`, pulls out any `
|
|
54
|
+
'**`IconText.Icon` is automatically hoisted to the left rail** regardless of position in JSX.',
|
|
55
|
+
'The root inspects `children`, pulls out any `IconText.Icon` elements into a flex-shrink-0 left column,',
|
|
56
56
|
'and places all other children (Heading, Paragraph) in the content column.',
|
|
57
57
|
'',
|
|
58
58
|
'```tsx',
|
|
59
|
-
'<
|
|
60
|
-
' <
|
|
61
|
-
' <
|
|
62
|
-
' <
|
|
63
|
-
'</
|
|
59
|
+
'<IconText>',
|
|
60
|
+
' <IconText.Icon name="guardians" />',
|
|
61
|
+
' <IconText.Heading>Year 9 Attendance</IconText.Heading>',
|
|
62
|
+
' <IconText.Paragraph>28 pupils · 94.2% this term</IconText.Paragraph>',
|
|
63
|
+
'</IconText>',
|
|
64
64
|
'```',
|
|
65
65
|
'',
|
|
66
|
-
'**`
|
|
67
|
-
'heading hierarchy is correct before using `
|
|
66
|
+
'**`IconText.Heading` always renders as `<h4>`.** There is no `level` prop. Verify your document',
|
|
67
|
+
'heading hierarchy is correct before using `IconText` as a standalone heading.',
|
|
68
68
|
'',
|
|
69
69
|
'**Omit `screenReaderText` for decorative icons.** The icon is rendered with `aria-hidden="true"`',
|
|
70
70
|
'when `screenReaderText` is absent. The heading or surrounding text should carry the accessible meaning.',
|
|
@@ -75,16 +75,16 @@ const DEVELOPER_NOTES = [
|
|
|
75
75
|
'',
|
|
76
76
|
'- Decorative icons (no `screenReaderText`): `aria-hidden="true"` — screen readers skip them',
|
|
77
77
|
'- Meaningful icons: provide `screenReaderText` so the icon has an accessible label',
|
|
78
|
-
'- `
|
|
79
|
-
'- `
|
|
78
|
+
'- `IconText.Heading` renders `<h4>` — verify your document heading hierarchy',
|
|
79
|
+
'- `IconText.Paragraph` renders `<p>` — semantically appropriate for supporting text',
|
|
80
80
|
'',
|
|
81
81
|
'---',
|
|
82
82
|
'',
|
|
83
83
|
'### TypeScript types',
|
|
84
84
|
'',
|
|
85
85
|
'```ts',
|
|
86
|
-
"import {
|
|
87
|
-
"import type {
|
|
86
|
+
"import { IconText } from '@arbor-education/design-system.components';",
|
|
87
|
+
"import type { IconTextProps, IconTextIconProps, IconTextHeadingProps, IconTextParagraphProps } from '@arbor-education/design-system.components';",
|
|
88
88
|
'```',
|
|
89
89
|
].join('\n');
|
|
90
90
|
const RELATED_COMPONENTS = [
|
|
@@ -96,19 +96,19 @@ const PROPS_INTRO = 'The preview below is wired to the **Controls** panel — tw
|
|
|
96
96
|
// ---------------------------------------------------------------------------
|
|
97
97
|
// Custom DocsPage
|
|
98
98
|
// ---------------------------------------------------------------------------
|
|
99
|
-
function
|
|
100
|
-
return (_jsxs(_Fragment, { children: [_jsx(Title, {}), _jsx(Subtitle, {}), _jsx(Markdown, { children: DESCRIPTION_INTRO }), _jsx(DocHeading, { children: "Interactive example" }), _jsx(Markdown, { children: PROPS_INTRO }), _jsx(DocPrimary, {}), _jsx(Controls, {}), _jsx(DocHeading, { children: "
|
|
99
|
+
function IconTextDocsPage() {
|
|
100
|
+
return (_jsxs(_Fragment, { children: [_jsx(Title, {}), _jsx(Subtitle, {}), _jsx(Markdown, { children: DESCRIPTION_INTRO }), _jsx(DocHeading, { children: "Interactive example" }), _jsx(Markdown, { children: PROPS_INTRO }), _jsx(DocPrimary, {}), _jsx(Controls, {}), _jsx(DocHeading, { children: "IconText.Icon props" }), _jsx(Markdown, { children: ICON_PROPS }), _jsx(DocHeading, { children: "IconText.Heading props" }), _jsx(Markdown, { children: HEADING_PROPS }), _jsx(DocHeading, { children: "IconText.Paragraph props" }), _jsx(Markdown, { children: PARAGRAPH_PROPS }), _jsx(DocHeading, { children: "Usage guidance" }), _jsx(Markdown, { children: USAGE_GUIDANCE }), _jsx(DocHeading, { children: "Developer notes" }), _jsx(Markdown, { children: DEVELOPER_NOTES }), _jsx(DocHeading, { children: "Examples" }), _jsx(Stories, { title: "" }), _jsx(Markdown, { children: RELATED_COMPONENTS })] }));
|
|
101
101
|
}
|
|
102
102
|
// ---------------------------------------------------------------------------
|
|
103
103
|
// Meta
|
|
104
104
|
// ---------------------------------------------------------------------------
|
|
105
105
|
const meta = {
|
|
106
|
-
title: 'Components/
|
|
107
|
-
component:
|
|
106
|
+
title: 'Components/IconText',
|
|
107
|
+
component: IconText,
|
|
108
108
|
tags: ['autodocs'],
|
|
109
109
|
parameters: {
|
|
110
110
|
layout: 'padded',
|
|
111
|
-
docs: { page:
|
|
111
|
+
docs: { page: IconTextDocsPage },
|
|
112
112
|
},
|
|
113
113
|
argTypes: {
|
|
114
114
|
className: {
|
|
@@ -118,7 +118,7 @@ const meta = {
|
|
|
118
118
|
},
|
|
119
119
|
children: {
|
|
120
120
|
control: false,
|
|
121
|
-
description: 'Compose using `
|
|
121
|
+
description: 'Compose using `IconText.Icon`, `IconText.Heading`, and `IconText.Paragraph` sub-components.',
|
|
122
122
|
table: { type: { summary: 'ReactNode' } },
|
|
123
123
|
},
|
|
124
124
|
},
|
|
@@ -137,20 +137,20 @@ const withDescription = (story, description) => ({
|
|
|
137
137
|
// ---------------------------------------------------------------------------
|
|
138
138
|
// Template components
|
|
139
139
|
// ---------------------------------------------------------------------------
|
|
140
|
-
const IconSizesTemplate = () => (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-xlarge)' }, children: [12, 16, 24].map(size => (_jsxs("div", { children: [_jsx("p", { className: "ds-text", style: { margin: '0 0 var(--spacing-small)', color: 'var(--color-grey-600)' }, children: `size={${size}}` }), _jsxs(
|
|
140
|
+
const IconSizesTemplate = () => (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-xlarge)' }, children: [12, 16, 24].map(size => (_jsxs("div", { children: [_jsx("p", { className: "ds-text", style: { margin: '0 0 var(--spacing-small)', color: 'var(--color-grey-600)' }, children: `size={${size}}` }), _jsxs(IconText, { children: [_jsx(IconText.Icon, { name: "guardians", size: size }), _jsx(IconText.Heading, { children: "Year 9 Attendance" }), _jsx(IconText.Paragraph, { children: "28 pupils \u00B7 94.2% average this term" })] })] }, size))) }));
|
|
141
141
|
const IconColorsTemplate = () => (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-xlarge)' }, children: [
|
|
142
142
|
{ color: 'var(--color-semantic-info-600)', label: 'Info — var(--color-semantic-info-600)' },
|
|
143
143
|
{ color: 'var(--color-semantic-success-600)', label: 'Success — var(--color-semantic-success-600)' },
|
|
144
144
|
{ color: 'var(--color-semantic-warning-600)', label: 'Warning — var(--color-semantic-warning-600)' },
|
|
145
145
|
{ color: 'var(--color-semantic-destructive-600)', label: 'Destructive — var(--color-semantic-destructive-600)' },
|
|
146
|
-
].map(({ color, label }) => (_jsxs("div", { children: [_jsx("p", { className: "ds-text", style: { margin: '0 0 var(--spacing-small)', color: 'var(--color-grey-600)' }, children: label }), _jsxs(
|
|
147
|
-
const MultipleParagraphsTemplate = () => (_jsxs(
|
|
146
|
+
].map(({ color, label }) => (_jsxs("div", { children: [_jsx("p", { className: "ds-text", style: { margin: '0 0 var(--spacing-small)', color: 'var(--color-grey-600)' }, children: label }), _jsxs(IconText, { children: [_jsx(IconText.Icon, { name: "triangle-alert", color: color }), _jsx(IconText.Heading, { children: "Attendance alert" }), _jsx(IconText.Paragraph, { children: "3 pupils below 90% this half-term" })] })] }, color))) }));
|
|
147
|
+
const MultipleParagraphsTemplate = () => (_jsxs(IconText, { children: [_jsx(IconText.Icon, { name: "date" }), _jsx(IconText.Heading, { children: "Parents' evening \u2014 Tuesday 14 May" }), _jsx(IconText.Paragraph, { children: "4:00 pm \u2013 7:00 pm \u00B7 Main Hall" }), _jsx(IconText.Paragraph, { children: "Appointments available every 10 minutes. Please arrive 5 minutes early." })] }));
|
|
148
148
|
// ---------------------------------------------------------------------------
|
|
149
149
|
// Stories
|
|
150
150
|
// ---------------------------------------------------------------------------
|
|
151
151
|
export const Default = withDescription({
|
|
152
|
-
render: () => (_jsxs(
|
|
153
|
-
}, 'The full canonical composition — `
|
|
152
|
+
render: () => (_jsxs(IconText, { children: [_jsx(IconText.Icon, { name: "guardians" }), _jsx(IconText.Heading, { children: "Year 9 Attendance" }), _jsx(IconText.Paragraph, { children: "28 pupils \u00B7 94.2% average this term" })] })),
|
|
153
|
+
}, 'The full canonical composition — `IconText.Icon` in the left rail, `IconText.Heading` and `IconText.Paragraph` in the content column.');
|
|
154
154
|
export const HeadingOnly = withDescription({
|
|
155
155
|
parameters: {
|
|
156
156
|
controls: { disable: true },
|
|
@@ -158,14 +158,14 @@ export const HeadingOnly = withDescription({
|
|
|
158
158
|
source: {
|
|
159
159
|
language: 'tsx',
|
|
160
160
|
code: `
|
|
161
|
-
import {
|
|
161
|
+
import { IconText } from '@arbor-education/design-system.components';
|
|
162
162
|
|
|
163
163
|
function HeadingOnlyExample() {
|
|
164
164
|
return (
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
</
|
|
165
|
+
<IconText>
|
|
166
|
+
<IconText.Icon name="book-open" />
|
|
167
|
+
<IconText.Heading>Assessment policy</IconText.Heading>
|
|
168
|
+
</IconText>
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
171
|
export default HeadingOnlyExample;
|
|
@@ -173,7 +173,7 @@ export default HeadingOnlyExample;
|
|
|
173
173
|
},
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
|
-
render: () => (_jsxs(
|
|
176
|
+
render: () => (_jsxs(IconText, { children: [_jsx(IconText.Icon, { name: "book-open" }), _jsx(IconText.Heading, { children: "Assessment policy" })] })),
|
|
177
177
|
}, 'Icon + Heading with no Paragraph — the compact pattern for short navigational labels.');
|
|
178
178
|
export const WithoutIcon = withDescription({
|
|
179
179
|
parameters: {
|
|
@@ -182,14 +182,14 @@ export const WithoutIcon = withDescription({
|
|
|
182
182
|
source: {
|
|
183
183
|
language: 'tsx',
|
|
184
184
|
code: `
|
|
185
|
-
import {
|
|
185
|
+
import { IconText } from '@arbor-education/design-system.components';
|
|
186
186
|
|
|
187
187
|
function WithoutIconExample() {
|
|
188
188
|
return (
|
|
189
|
-
<
|
|
190
|
-
<
|
|
191
|
-
<
|
|
192
|
-
</
|
|
189
|
+
<IconText>
|
|
190
|
+
<IconText.Heading>Behaviour report</IconText.Heading>
|
|
191
|
+
<IconText.Paragraph>No incidents recorded this week. All targets met.</IconText.Paragraph>
|
|
192
|
+
</IconText>
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
195
|
export default WithoutIconExample;
|
|
@@ -197,8 +197,8 @@ export default WithoutIconExample;
|
|
|
197
197
|
},
|
|
198
198
|
},
|
|
199
199
|
},
|
|
200
|
-
render: () => (_jsxs(
|
|
201
|
-
}, 'Heading + Paragraph with no icon. The left rail disappears cleanly — `
|
|
200
|
+
render: () => (_jsxs(IconText, { children: [_jsx(IconText.Heading, { children: "Behaviour report" }), _jsx(IconText.Paragraph, { children: "No incidents recorded this week. All targets met." })] })),
|
|
201
|
+
}, 'Heading + Paragraph with no icon. The left rail disappears cleanly — `IconText.Icon` is entirely optional.');
|
|
202
202
|
export const IconWithScreenReaderText = withDescription({
|
|
203
203
|
parameters: {
|
|
204
204
|
controls: { disable: true },
|
|
@@ -206,19 +206,19 @@ export const IconWithScreenReaderText = withDescription({
|
|
|
206
206
|
source: {
|
|
207
207
|
language: 'tsx',
|
|
208
208
|
code: `
|
|
209
|
-
import {
|
|
209
|
+
import { IconText } from '@arbor-education/design-system.components';
|
|
210
210
|
|
|
211
211
|
function IconWithScreenReaderTextExample() {
|
|
212
212
|
return (
|
|
213
|
-
<
|
|
214
|
-
<
|
|
213
|
+
<IconText>
|
|
214
|
+
<IconText.Icon
|
|
215
215
|
name="triangle-alert"
|
|
216
216
|
color="var(--color-semantic-warning-600)"
|
|
217
217
|
screenReaderText="Warning"
|
|
218
218
|
/>
|
|
219
|
-
<
|
|
220
|
-
<
|
|
221
|
-
</
|
|
219
|
+
<IconText.Heading>Attendance below target</IconText.Heading>
|
|
220
|
+
<IconText.Paragraph>Alice Johnson — 78.4% this term. Intervention recommended.</IconText.Paragraph>
|
|
221
|
+
</IconText>
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
export default IconWithScreenReaderTextExample;
|
|
@@ -226,7 +226,7 @@ export default IconWithScreenReaderTextExample;
|
|
|
226
226
|
},
|
|
227
227
|
},
|
|
228
228
|
},
|
|
229
|
-
render: () => (_jsxs(
|
|
229
|
+
render: () => (_jsxs(IconText, { children: [_jsx(IconText.Icon, { name: "triangle-alert", color: "var(--color-semantic-warning-600)", screenReaderText: "Warning" }), _jsx(IconText.Heading, { children: "Attendance below target" }), _jsx(IconText.Paragraph, { children: "Alice Johnson \u2014 78.4% this term. Intervention recommended." })] })),
|
|
230
230
|
}, 'When the icon carries meaning not conveyed by the heading text, provide `screenReaderText`. Without it the icon is `aria-hidden="true"`. Here the warning triangle conveys severity — screen readers announce "Warning, Attendance below target".');
|
|
231
231
|
export const IconSizes = withDescription({
|
|
232
232
|
parameters: {
|
|
@@ -235,26 +235,26 @@ export const IconSizes = withDescription({
|
|
|
235
235
|
source: {
|
|
236
236
|
language: 'tsx',
|
|
237
237
|
code: `
|
|
238
|
-
import {
|
|
238
|
+
import { IconText } from '@arbor-education/design-system.components';
|
|
239
239
|
|
|
240
240
|
function IconSizesExample() {
|
|
241
241
|
return (
|
|
242
242
|
<>
|
|
243
|
-
<
|
|
244
|
-
<
|
|
245
|
-
<
|
|
246
|
-
<
|
|
247
|
-
</
|
|
248
|
-
<
|
|
249
|
-
<
|
|
250
|
-
<
|
|
251
|
-
<
|
|
252
|
-
</
|
|
253
|
-
<
|
|
254
|
-
<
|
|
255
|
-
<
|
|
256
|
-
<
|
|
257
|
-
</
|
|
243
|
+
<IconText>
|
|
244
|
+
<IconText.Icon name="guardians" size={12} />
|
|
245
|
+
<IconText.Heading>size 12</IconText.Heading>
|
|
246
|
+
<IconText.Paragraph>Use in very compact contexts</IconText.Paragraph>
|
|
247
|
+
</IconText>
|
|
248
|
+
<IconText>
|
|
249
|
+
<IconText.Icon name="guardians" size={16} />
|
|
250
|
+
<IconText.Heading>size 16</IconText.Heading>
|
|
251
|
+
<IconText.Paragraph>Use in moderately compact contexts</IconText.Paragraph>
|
|
252
|
+
</IconText>
|
|
253
|
+
<IconText>
|
|
254
|
+
<IconText.Icon name="guardians" size={24} />
|
|
255
|
+
<IconText.Heading>size 24 (default)</IconText.Heading>
|
|
256
|
+
<IconText.Paragraph>Standard — aligns best with h4 line-height</IconText.Paragraph>
|
|
257
|
+
</IconText>
|
|
258
258
|
</>
|
|
259
259
|
);
|
|
260
260
|
}
|
|
@@ -264,7 +264,7 @@ export default IconSizesExample;
|
|
|
264
264
|
},
|
|
265
265
|
},
|
|
266
266
|
render: IconSizesTemplate,
|
|
267
|
-
}, 'All three supported icon sizes — 12, 16, and 24 (default). Use smaller sizes only in compact contexts such as table cells or dense lists. The `24` default aligns best with `
|
|
267
|
+
}, 'All three supported icon sizes — 12, 16, and 24 (default). Use smaller sizes only in compact contexts such as table cells or dense lists. The `24` default aligns best with `IconText.Heading`\'s h4 line-height.');
|
|
268
268
|
export const IconColors = withDescription({
|
|
269
269
|
parameters: {
|
|
270
270
|
controls: { disable: true },
|
|
@@ -272,15 +272,15 @@ export const IconColors = withDescription({
|
|
|
272
272
|
source: {
|
|
273
273
|
language: 'tsx',
|
|
274
274
|
code: `
|
|
275
|
-
import {
|
|
275
|
+
import { IconText } from '@arbor-education/design-system.components';
|
|
276
276
|
|
|
277
277
|
function IconColorsExample() {
|
|
278
278
|
return (
|
|
279
|
-
<
|
|
280
|
-
<
|
|
281
|
-
<
|
|
282
|
-
<
|
|
283
|
-
</
|
|
279
|
+
<IconText>
|
|
280
|
+
<IconText.Icon name="triangle-alert" color="var(--color-semantic-warning-600)" />
|
|
281
|
+
<IconText.Heading>Attendance alert</IconText.Heading>
|
|
282
|
+
<IconText.Paragraph>3 pupils below 90% this half-term</IconText.Paragraph>
|
|
283
|
+
</IconText>
|
|
284
284
|
);
|
|
285
285
|
}
|
|
286
286
|
export default IconColorsExample;
|
|
@@ -289,7 +289,7 @@ export default IconColorsExample;
|
|
|
289
289
|
},
|
|
290
290
|
},
|
|
291
291
|
render: IconColorsTemplate,
|
|
292
|
-
}, 'The `color` prop on `
|
|
292
|
+
}, 'The `color` prop on `IconText.Icon` accepts any CSS value — always use design token variables, never hardcoded hex. Semantic tokens (`--color-semantic-*`) are most appropriate for status-indicating icons.');
|
|
293
293
|
export const MultipleParagraphs = withDescription({
|
|
294
294
|
parameters: {
|
|
295
295
|
controls: { disable: true },
|
|
@@ -297,16 +297,16 @@ export const MultipleParagraphs = withDescription({
|
|
|
297
297
|
source: {
|
|
298
298
|
language: 'tsx',
|
|
299
299
|
code: `
|
|
300
|
-
import {
|
|
300
|
+
import { IconText } from '@arbor-education/design-system.components';
|
|
301
301
|
|
|
302
302
|
function MultipleParagraphsExample() {
|
|
303
303
|
return (
|
|
304
|
-
<
|
|
305
|
-
<
|
|
306
|
-
<
|
|
307
|
-
<
|
|
308
|
-
<
|
|
309
|
-
</
|
|
304
|
+
<IconText>
|
|
305
|
+
<IconText.Icon name="date" />
|
|
306
|
+
<IconText.Heading>Parents' evening — Tuesday 14 May</IconText.Heading>
|
|
307
|
+
<IconText.Paragraph>4:00 pm – 7:00 pm · Main Hall</IconText.Paragraph>
|
|
308
|
+
<IconText.Paragraph>Appointments every 10 minutes. Please arrive 5 minutes early.</IconText.Paragraph>
|
|
309
|
+
</IconText>
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
312
|
export default MultipleParagraphsExample;
|
|
@@ -315,5 +315,5 @@ export default MultipleParagraphsExample;
|
|
|
315
315
|
},
|
|
316
316
|
},
|
|
317
317
|
render: MultipleParagraphsTemplate,
|
|
318
|
-
}, 'Multiple `
|
|
319
|
-
//# sourceMappingURL=
|
|
318
|
+
}, 'Multiple `IconText.Paragraph` sub-components stack vertically in the content column. Use for supplementary detail lines below the primary heading.');
|
|
319
|
+
//# sourceMappingURL=IconText.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconText.stories.js","sourceRoot":"","sources":["../../../src/components/iconText/IconText.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,OAAO,IAAI,UAAU,EACrB,OAAO,IAAI,UAAU,EACrB,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,GACN,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG;IACxB,8GAA8G;IAC9G,uGAAuG;IACvG,4FAA4F;CAC7F,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,UAAU,GAAG;IACjB,yCAAyC;IACzC,mBAAmB;IACnB,iEAAiE;IACjE,8DAA8D;IAC9D,yFAAyF;IACzF,kHAAkH;IAClH,yDAAyD;CAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,aAAa,GAAG;IACpB,yCAAyC;IACzC,mBAAmB;IACnB,+DAA+D;IAC/D,qFAAqF;CACtF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,eAAe,GAAG;IACtB,yCAAyC;IACzC,mBAAmB;IACnB,iEAAiE;IACjE,sFAAsF;CACvF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,EAAE;IACF,oHAAoH;IACpH,yEAAyE;IACzE,6DAA6D;IAC7D,EAAE;IACF,KAAK;IACL,EAAE;IACF,qBAAqB;IACrB,EAAE;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E;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;CAyBf,CAAC,IAAI,EAAE;aACC;SACF;KACF;IACD,MAAM,EAAE,iBAAiB;CAC1B,EACD,mNAAmN,CACpN,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU,eAAe,CAC9C;IACE,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC3B,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE;;;;;;;;;;;;;CAaf,CAAC,IAAI,EAAE;aACC;SACF;KACF;IACD,MAAM,EAAE,kBAAkB;CAC3B,EACD,8MAA8M,CAC/M,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAU,eAAe,CACtD;IACE,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC3B,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE;;;;;;;;;;;;;;CAcf,CAAC,IAAI,EAAE;aACC;SACF;KACF;IACD,MAAM,EAAE,0BAA0B;CACnC,EACD,oJAAoJ,CACrJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconText.test.d.ts","sourceRoot":"","sources":["../../../src/components/iconText/IconText.test.tsx"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { render, screen, within } from '@testing-library/react';
|
|
3
2
|
import '@testing-library/jest-dom/vitest';
|
|
3
|
+
import { render, screen, within } from '@testing-library/react';
|
|
4
4
|
import { describe, expect, test } from 'vitest';
|
|
5
|
-
import {
|
|
6
|
-
describe('
|
|
5
|
+
import { IconText } from './IconText.js';
|
|
6
|
+
describe('IconText', () => {
|
|
7
7
|
test('renders icon children before content children and keeps content in the content wrapper', () => {
|
|
8
|
-
const { container } = render(_jsxs(
|
|
8
|
+
const { container } = render(_jsxs(IconText, { children: [_jsx(IconText.Heading, { children: "Article title" }), _jsx(IconText.Icon, { name: "eye", screenReaderText: "Views" }), _jsx(IconText.Paragraph, { children: "Helpful supporting copy" }), _jsx("span", { children: "Metadata" }), _jsx(IconText.Icon, { name: "eye", screenReaderText: "More views" })] }));
|
|
9
9
|
const root = container.querySelector('.ds-ico-text');
|
|
10
10
|
const content = container.querySelector('.ds-ico-text__content');
|
|
11
11
|
if (!content) {
|
|
12
|
-
throw new Error('Expected
|
|
12
|
+
throw new Error('Expected IconText content wrapper to exist');
|
|
13
13
|
}
|
|
14
14
|
const iconElements = Array.from(root?.querySelectorAll(':scope > .ds-ico-text__icon') ?? []);
|
|
15
15
|
expect(iconElements).toHaveLength(2);
|
|
@@ -24,4 +24,4 @@ describe('IcoText', () => {
|
|
|
24
24
|
expect(screen.getAllByRole('img', { hidden: true })).toHaveLength(2);
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=IconText.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconText.test.js","sourceRoot":"","sources":["../../../src/components/iconText/IconText.test.tsx"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,wFAAwF,EAAE,GAAG,EAAE;QAClG,MAAM,EAAE,SAAS,EAAE,GAAG,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C,CAAC,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAC9F,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACjF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAClE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,KAAK,iBAAiB,GAAG;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,YAAY,4CAAuC,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AACA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ModalTitle.js';
|
|
11
11
|
export const ModalContext = createContext({});
|
|
12
12
|
export const Modal = (props) => {
|
|
13
|
-
const { className, overlayClassName, open, portalTarget, children, closeHandler, hideCloseButton = false, title, } = props;
|
|
13
|
+
const { className, overlayClassName, open, portalTarget, contentId, children, closeHandler, hideCloseButton = false, title, } = props;
|
|
14
14
|
const overlayRef = useRef(null);
|
|
15
|
-
return (_jsx(PopupParentContext.Provider, { value: overlayRef, children: _jsx(ModalContext.Provider, { value: { closeHandler }, children: _jsx(Dialog.Root, { open: open, children: _jsx(Dialog.Portal, { container: portalTarget, children: _jsx(Dialog.Overlay, { ref: overlayRef, className: classNames('ds-modal__overlay', overlayClassName), children: _jsxs(Dialog.Content, { className: classNames('ds-modal__container', className), children: [title && _jsx(ModalHeader, { children: _jsx(ModalTitle, { children: title }) }), children, !hideCloseButton && _jsx(ModalCloseButon, { className: "ds-modal__close-button--top-right" })] }) }) }) }) }) }));
|
|
15
|
+
return (_jsx(PopupParentContext.Provider, { value: overlayRef, children: _jsx(ModalContext.Provider, { value: { closeHandler }, children: _jsx(Dialog.Root, { open: open, children: _jsx(Dialog.Portal, { container: portalTarget, children: _jsx(Dialog.Overlay, { ref: overlayRef, className: classNames('ds-modal__overlay', overlayClassName), children: _jsxs(Dialog.Content, { id: contentId, className: classNames('ds-modal__container', className), children: [title && _jsx(ModalHeader, { children: _jsx(ModalTitle, { children: title }) }), children, !hideCloseButton && _jsx(ModalCloseButon, { className: "ds-modal__close-button--top-right" })] }) }) }) }) }) }));
|
|
16
16
|
};
|
|
17
17
|
Modal.Header = ModalHeader;
|
|
18
18
|
Modal.Body = ModalBody;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAy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AAC;IAEV,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEhD,OAAO,CACL,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAC5C,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,YAAY,EAAE,YAC5C,KAAC,MAAM,CAAC,IAAI,IAAC,IAAI,EAAE,IAAI,YACrB,KAAC,MAAM,CAAC,MAAM,IAAC,SAAS,EAAE,YAAY,YACpC,KAAC,MAAM,CAAC,OAAO,IAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,YAE3F,MAAC,MAAM,CAAC,OAAO,IAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,aACnF,KAAK,IAAI,KAAC,WAAW,cAAC,KAAC,UAAU,cAAE,KAAK,GAAc,GAAc,EACpE,QAAQ,EACR,CAAC,eAAe,IAAI,KAAC,eAAe,IAAC,SAAS,EAAC,mCAAmC,GAAG,IACvE,GACF,GACH,GACJ,GACQ,GACI,CAC/B,CAAC;AACJ,CAAC,CAAC;AAEF,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;AAC3B,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;AACvB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;AAC3B,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;AACpC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
1
2
|
export type TagColor = 'neutral' | 'orange' | 'blue' | 'green' | 'purple' | 'teal' | 'salmon' | 'yellow';
|
|
2
3
|
export type TagProps = {
|
|
3
4
|
children: React.ReactNode;
|
|
@@ -5,11 +6,23 @@ export type TagProps = {
|
|
|
5
6
|
selected?: boolean;
|
|
6
7
|
slotStart?: React.ReactNode;
|
|
7
8
|
slotEnd?: React.ReactNode;
|
|
9
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
11
|
+
onFocus?: React.FocusEventHandler<HTMLButtonElement>;
|
|
12
|
+
actionLabel?: string;
|
|
13
|
+
actionButtonTabIndex?: 0 | -1;
|
|
14
|
+
actionRef?: React.Ref<HTMLButtonElement>;
|
|
8
15
|
onRemove?: () => void;
|
|
9
16
|
removeLabel?: string;
|
|
17
|
+
onRemoveKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
18
|
+
onRemoveFocus?: React.FocusEventHandler<HTMLButtonElement>;
|
|
10
19
|
removeButtonTabIndex?: 0 | -1;
|
|
20
|
+
removeButtonRef?: React.Ref<HTMLButtonElement>;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
ariaControls?: string;
|
|
23
|
+
ariaExpanded?: ButtonHTMLAttributes<HTMLButtonElement>['aria-expanded'];
|
|
11
24
|
};
|
|
12
|
-
export declare const Tag: ({ children, color, selected, slotStart, slotEnd, onRemove, removeLabel, removeButtonTabIndex, }: TagProps) => React.JSX.Element;
|
|
25
|
+
export declare const Tag: ({ children, color, selected, slotStart, slotEnd, onClick, onKeyDown, onFocus, actionLabel, actionButtonTabIndex, actionRef, onRemove, removeLabel, onRemoveKeyDown, onRemoveFocus, removeButtonTabIndex, removeButtonRef, disabled, ariaControls, ariaExpanded, }: TagProps) => React.JSX.Element;
|
|
13
26
|
export declare namespace Tag {
|
|
14
27
|
type Color = TagColor;
|
|
15
28
|
type Props = TagProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../../src/components/tag/Tag.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../../src/components/tag/Tag.tsx"],"names":[],"mappings":"AAEA,OAA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,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,eAAe,CAAC,CAAC;CACzE,CAAC;AAEF,eAAO,MAAM,GAAG,GAAI,mQAqBjB,QAAQ,KAAG,KAAK,CAAC,GAAG,CAAC,OA0DvB,CAAC;AAEF,yBAAiB,GAAG,CAAC;IACnB,KAAY,KAAK,GAAG,QAAQ,CAAC;IAC7B,KAAY,KAAK,GAAG,QAAQ,CAAC;CAC9B"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { Icon } from '../icon/Icon.js';
|
|
4
|
-
export const Tag = ({ children, color = 'neutral', selected = false, slotStart, slotEnd, onRemove, removeLabel = 'Remove', removeButtonTabIndex = 0, }) => {
|
|
4
|
+
export const Tag = ({ children, color = 'neutral', selected = false, slotStart, slotEnd, onClick, onKeyDown, onFocus, actionLabel, actionButtonTabIndex = 0, actionRef, onRemove, removeLabel = 'Remove', onRemoveKeyDown, onRemoveFocus, removeButtonTabIndex = 0, removeButtonRef, disabled = false, ariaControls, ariaExpanded, }) => {
|
|
5
|
+
const tagContent = onClick
|
|
6
|
+
? (_jsxs("button", { type: "button", className: "ds-tag__content ds-tag__action", "aria-label": actionLabel, "aria-controls": ariaControls, "aria-expanded": ariaExpanded, onClick: onClick, onKeyDown: onKeyDown, onFocus: onFocus, tabIndex: actionButtonTabIndex, ref: actionRef, disabled: disabled, children: [slotStart && _jsx("span", { className: "ds-tag__slot-start", children: slotStart }), _jsx("span", { className: "ds-tag__label", children: children }), slotEnd && _jsx("span", { className: "ds-tag__slot-end", children: slotEnd })] }))
|
|
7
|
+
: (_jsxs("span", { className: "ds-tag__content", children: [slotStart && _jsx("span", { className: "ds-tag__slot-start", children: slotStart }), _jsx("span", { className: "ds-tag__label", children: children }), slotEnd && _jsx("span", { className: "ds-tag__slot-end", children: slotEnd })] }));
|
|
5
8
|
return (_jsxs("span", { className: classNames('ds-tag', `ds-tag--${color}`, {
|
|
6
9
|
'ds-tag--selected': selected,
|
|
7
|
-
|
|
10
|
+
'ds-tag--interactive': Boolean(onClick),
|
|
11
|
+
'ds-tag--removable': Boolean(onRemove),
|
|
12
|
+
'ds-tag--disabled': disabled,
|
|
13
|
+
}), children: [tagContent, onRemove && (_jsx("button", { type: "button", className: "ds-tag__remove", "aria-label": removeLabel, onClick: (e) => {
|
|
8
14
|
e.stopPropagation();
|
|
9
15
|
onRemove();
|
|
10
|
-
}, tabIndex: removeButtonTabIndex, children: _jsx(Icon, { name: "x", size: 12 }) }))] }));
|
|
16
|
+
}, onKeyDown: onRemoveKeyDown, onFocus: onRemoveFocus, tabIndex: removeButtonTabIndex, ref: removeButtonRef, disabled: disabled, children: _jsx(Icon, { name: "x", size: 12 }) }))] }));
|
|
11
17
|
};
|
|
12
18
|
//# sourceMappingURL=Tag.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/components/tag/Tag.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/components/tag/Tag.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAmC5C,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,EAClB,QAAQ,EACR,KAAK,GAAG,SAAS,EACjB,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EACP,WAAW,EACX,oBAAoB,GAAG,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,WAAW,GAAG,QAAQ,EACtB,eAAe,EACf,aAAa,EAC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AC,eAAe,EAAE,CAAC;oBACpB,QAAQ,EAAE,CAAC;gBACb,CAAC,EACD,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,QAAQ,YAElB,KAAC,IAAI,IAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,EAAE,GAAI,GACpB,CACV,IACI,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { Tag, type TagColor } from './Tag.js';
|
|
|
3
3
|
declare function TagDocsPage(): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
|
-
component: ({ children, color, selected, slotStart, slotEnd, onRemove, removeLabel, removeButtonTabIndex, }: import("./Tag.js").TagProps) => React.JSX.Element;
|
|
6
|
+
component: ({ children, color, selected, slotStart, slotEnd, onClick, onKeyDown, onFocus, actionLabel, actionButtonTabIndex, actionRef, onRemove, removeLabel, onRemoveKeyDown, onRemoveFocus, removeButtonTabIndex, removeButtonRef, disabled, ariaControls, ariaExpanded, }: import("./Tag.js").TagProps) => React.JSX.Element;
|
|
7
7
|
tags: string[];
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tag/Tag.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tag.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tag/Tag.stories.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAiH9C,iBAAS,WAAW,4CAmBnB;AAwBD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHkB,CAAC;AAE7B,eAAe,IAAI,CAAC;AAIpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;AAgIlC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAuBxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAwCxB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAwBtB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAuBrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAuBtB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAuBzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KA+B3B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAwBvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAiC/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAuClC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAwBjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAqC/B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Controls, Heading as DocHeading,
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { fn } from 'storybook/test';
|
|
2
|
+
import { Controls, Heading as DocHeading, Primary as DocPrimary, Markdown, Stories, Subtitle, Title, } from '@storybook/addon-docs/blocks';
|
|
5
3
|
import { Dot } from '../dot/Dot.js';
|
|
6
4
|
import { Icon } from '../icon/Icon.js';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { fn } from 'storybook/test';
|
|
7
7
|
import { Tag } from './Tag.js';
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
// Docs page content
|