Skip to content

Commit d9cd3a0

Browse files
committed
docs: update stories to test input fields in tables
1 parent 2460fab commit d9cd3a0

File tree

2 files changed

+51
-36
lines changed

2 files changed

+51
-36
lines changed

packages/uui-table/lib/uui-table-cell.story.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import '.';
2-
3-
import { Story } from '@storybook/web-components';
1+
import type { Meta, StoryFn } from '@storybook/web-components';
42
import { html } from 'lit';
53

6-
import { UUITableCellElement } from './uui-table-cell.element';
4+
import type { UUITableCellElement } from './uui-table-cell.element';
5+
6+
import '@umbraco-ui/uui-input/lib';
7+
import './uui-table-cell.element';
78

8-
export default {
9+
const meta: Meta<typeof UUITableCellElement> = {
910
title: 'Layout/Table/Table Cell',
1011
component: 'uui-table-cell',
1112
id: 'uui-table-cell',
1213
};
1314

14-
export const AAAOverview: Story<UUITableCellElement> = props =>
15-
html`
15+
export default meta;
16+
17+
const Template: StoryFn<UUITableCellElement> = props => {
18+
return html`
1619
<uui-table
1720
aria-label="Random Umbraco Words"
1821
aria-describedby="table-description">
@@ -29,6 +32,12 @@ export const AAAOverview: Story<UUITableCellElement> = props =>
2932
?clip-text=${props.clipText}>
3033
Rocks
3134
</uui-table-cell>
35+
<uui-table-cell
36+
?disable-child-interaction=${props.disableChildInteraction}
37+
?no-padding=${props.noPadding}
38+
?clip-text=${props.clipText}>
39+
<uui-input placeholder="Type your own thing"></uui-input>
40+
</uui-table-cell>
3241
<uui-table-cell
3342
?disable-child-interaction=${props.disableChildInteraction}
3443
?no-padding=${props.noPadding}
@@ -38,6 +47,9 @@ export const AAAOverview: Story<UUITableCellElement> = props =>
3847
</uui-table-row>
3948
</uui-table>
4049
`;
50+
};
51+
52+
export const AAAOverview = Template.bind({});
4153
AAAOverview.storyName = 'Overview';
4254
AAAOverview.args = {
4355
slot: 'Very very very Very very very Very very very Very very very Very very very long sentence',

packages/uui-table/lib/uui-table-row.story.ts

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
1-
import '.';
2-
3-
import { Story } from '@storybook/web-components';
1+
import { Meta, StoryFn } from '@storybook/web-components';
42
import { html } from 'lit';
53

64
import { ArrayOfUmbracoWords } from '../../../storyhelpers/UmbracoWordGenerator';
5+
import type { UUITableRowElement } from './uui-table-row.element';
6+
7+
import '@umbraco-ui/uui-input/lib';
8+
import './uui-table-row.element';
79

8-
export default {
10+
const meta: Meta<typeof UUITableRowElement> = {
911
title: 'Layout/Table/Table Row',
1012
component: 'uui-table-row',
1113
id: 'uui-table-row',
1214
};
1315

14-
export const AAAOverview: Story = () =>
15-
html`
16-
<uui-table
17-
aria-label="Random Umbraco Words"
18-
aria-describedby="table-description">
19-
<uui-table-row>
20-
${ArrayOfUmbracoWords(3).map(
16+
export default meta;
17+
18+
const Template: StoryFn<UUITableRowElement> = props => {
19+
return html`
20+
<uui-table>
21+
<uui-table-row
22+
?selectable=${props.selectable}
23+
?selectOnly=${props.selectOnly}>
24+
${ArrayOfUmbracoWords(5).map(
25+
el => html`<uui-table-cell>${el}</uui-table-cell>`
26+
)}
27+
</uui-table-row>
28+
<uui-table-row
29+
?selectable=${props.selectable}
30+
?selectOnly=${props.selectOnly}>
31+
<uui-table-cell>
32+
<uui-input placeholder="Type your own thing"></uui-input>
33+
</uui-table-cell>
34+
${ArrayOfUmbracoWords(5).map(
2135
el => html`<uui-table-cell>${el}</uui-table-cell>`
2236
)}
2337
</uui-table-row>
2438
</uui-table>
2539
`;
40+
};
41+
42+
export const AAAOverview = Template.bind({});
2643
AAAOverview.storyName = 'Overview';
2744

2845
AAAOverview.parameters = {
@@ -43,24 +60,10 @@ AAAOverview.parameters = {
4360
},
4461
};
4562

46-
export const SelectableRows: Story = () =>
47-
html`
48-
<div style="width: 100%;">
49-
<uui-table>
50-
<uui-table-row selectable>
51-
${ArrayOfUmbracoWords(5).map(
52-
el => html`<uui-table-cell>${el}</uui-table-cell>`
53-
)}
54-
</uui-table-row>
55-
<uui-table-row selectable>
56-
${ArrayOfUmbracoWords(5).map(
57-
el => html`<uui-table-cell>${el}</uui-table-cell>`
58-
)}
59-
</uui-table-row>
60-
</uui-table>
61-
</div>
62-
`;
63-
63+
export const SelectableRows = Template.bind({});
64+
SelectableRows.args = {
65+
selectable: true,
66+
};
6467
SelectableRows.parameters = {
6568
docs: {
6669
source: {

0 commit comments

Comments
 (0)