-
Notifications
You must be signed in to change notification settings - Fork 8
/
number-field-matrix.stories.ts
56 lines (51 loc) · 1.63 KB
/
number-field-matrix.stories.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type { Story, Meta } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';
import { html, ViewTemplate } from '@microsoft/fast-element';
import { createRenderer } from '../../utilities/tests/storybook';
import {
createMatrix,
themeWrapper,
disabledStates,
DisabledState
} from '../../utilities/tests/matrix';
import '../index';
import { hiddenWrapper } from '../../utilities/tests/hidden';
const metadata: Meta = {
title: 'Tests/Number Field',
decorators: [withXD],
parameters: {
design: {
artboardUrl:
'https://xd.adobe.com/view/8ce280ab-1559-4961-945c-182955c7780b-d9b1/screen/eaa9ee19-4411-4648-b19d-41f61f9a01cf/specs/'
},
controls: { hideNoControlsWarning: true }
}
};
export default metadata;
const valueStates = [
['Placeholder', null, 'placeholder'],
['Value', '1234', null]
];
type ValueState = typeof valueStates[number];
const component = (
[disabledName, disabled]: DisabledState,
[valueName, valueValue, placeholderValue]: ValueState
): ViewTemplate => html`
<nimble-number-field
value="${() => valueValue}"
placeholder="${() => placeholderValue}"
?disabled="${() => disabled}"
>
${() => valueName} ${() => disabledName}
</nimble-number-field>
`;
export const numberFieldThemeMatrix: Story = createRenderer(
themeWrapper(createMatrix(component, [disabledStates, valueStates]))
);
export const hiddenNumberField: Story = createRenderer(
hiddenWrapper(
html`<nimble-number-field hidden
>Hidden number field</nimble-number-field
>`
)
);