@muonic/muon 0.0.2-experimental-120-a646376.0 → 0.0.2-experimental-123-c739cfa.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.
@@ -1,5 +1,6 @@
1
1
  import { Card } from '@muonic/muon/components/card';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
+ import { StandardLink as CTALink } from '../cta/story';
3
4
 
4
5
  const details = setup('card', Card);
5
6
 
@@ -11,14 +12,15 @@ const innerDetail = (args) => `
11
12
  <div slot="footer">${args.footer}</div>
12
13
  `;
13
14
 
14
- export const Standard = (args) => details.template(args, innerDetail);
15
+ const StandardTemplate = (args) => details.template(args, innerDetail);
16
+ export const Standard = StandardTemplate.bind({});
15
17
  Standard.args = {
16
18
  header: 'Where can I buy an ice cream?',
17
19
  content: `<p>We have the most wonderful shop just in town, that sells a whole variety of different ice creams. Just pop on in and we can get you sorted with your favourite flavour!</p>`,
18
- footer: ` We've even got a free <a href='#!'>smartphone app</a>.`
20
+ footer: `We've even got a free <a href='#!'>smartphone app</a>.`
19
21
  };
20
22
 
21
- export const StandardWithImage = (args) => details.template(args, innerDetail);
23
+ export const StandardWithImage = StandardTemplate.bind({});
22
24
  StandardWithImage.args = {
23
25
  image: 'https://blog.nucleus.design/vanilla-first/vanilla-ice-cream-cone.jpg',
24
26
  alt: '',
@@ -26,5 +28,17 @@ StandardWithImage.args = {
26
28
  header: 'Where can I buy an ice cream?',
27
29
  content: `<p>We have the most wonderful shop just in town, that sells a whole variety of different ice creams. Just pop on in and we can get you sorted with your favourite flavour!</p>
28
30
  <p>We have the most wonderful shop just in town, that sells a whole variety of different ice creams. Just pop on in and we can get you sorted with your favourite flavour!</p>`,
29
- footer: ` We've even got a free <a href='#!'>smartphone app</a>.`
31
+ footer: `We've even got a free <a href='#!'>smartphone app</a>.`
32
+ };
33
+
34
+ const innerDetailWithCTA = (args) => `
35
+ <h2 slot="header">${args.header}</h2>
36
+ ${args.content}
37
+ <div slot="footer">${CTALink(args.footer)}</div>
38
+ `;
39
+ export const StandardWithCTA = (args) => details.template(args, innerDetailWithCTA);
40
+ StandardWithCTA.args = {
41
+ header: 'Where can I buy an ice cream?',
42
+ content: `<p>We have the most wonderful shop just in town, that sells a whole variety of different ice creams. Just pop on in and we can get you sorted with your favourite flavour!</p>`,
43
+ footer: { text: 'Click Here', href: '#!' }
30
44
  };
@@ -1,4 +1,3 @@
1
- import { staticHTML } from '@muonic/muon';
2
1
  import { Cta } from '@muonic/muon/components/cta';
3
2
  import setup from '@muonic/muon/storybook/stories';
4
3
 
@@ -7,86 +6,84 @@ const tag = details.getTagEl();
7
6
 
8
7
  export default details.defaultValues;
9
8
 
10
- export const Standard = (args) => details.template(args, (args) => args.text);
9
+ const StandardTemplate = (args) => details.template(args, (args) => args.text);
10
+ const ButtonTemplate = (args) => {
11
+ const dArgs = details.dynamicArgs(args);
12
+
13
+ return `<${tag} ${dArgs} ._isButton=${true}>${args.text}</${tag}>`;
14
+ };
15
+ const FormTemplate = (args) => `<form>${details.template(args, (args) => args.text)}</form>`;
16
+ const WithinLinkTemplate = (args) => `<a href="${args.link}">${details.template(args, (args) => args.text)}</a>`;
17
+ const WithinButtonTemplate = (args) => `<button>${details.template(args, (args) => args.text)}</button>`;
18
+
19
+ export const Standard = StandardTemplate.bind({});
11
20
  Standard.args = { text: 'Highpoint' };
12
21
 
13
- export const Disabled = (args) => details.template(args, (args) => args.text);
22
+ export const Disabled = StandardTemplate.bind({});
14
23
  Disabled.args = { text: 'Highpoint', disabled: true };
15
24
 
16
- export const Hidden = (args) => details.template(args, (args) => args.text);
25
+ export const Hidden = StandardTemplate.bind({});
17
26
  Hidden.args = { text: 'Highpoint', hidden: true };
18
27
 
19
- export const Loading = (args) => details.template(args, (args) => args.text);
28
+ export const Loading = StandardTemplate.bind({});
20
29
  Loading.args = { text: 'Highpoint', loading: true };
21
30
 
22
- export const StandardLink = (args) => details.template(args, (args) => args.text);
31
+ export const StandardLink = StandardTemplate.bind({});
23
32
  StandardLink.storyName = 'Standard [link]';
24
33
  StandardLink.args = { text: 'Highpoint', href: '#!' };
25
34
 
26
- export const DisabledLink = (args) => details.template(args, (args) => args.text);
35
+ export const DisabledLink = StandardTemplate.bind({});
27
36
  DisabledLink.storyName = 'Disabled [link]';
28
37
  DisabledLink.args = { text: 'Highpoint', disabled: true, href: '#!' };
29
38
 
30
- export const LoadingLink = (args) => details.template(args, (args) => args.text);
39
+ export const LoadingLink = StandardTemplate.bind({});
31
40
  LoadingLink.storyName = 'Loading [link]';
32
41
  LoadingLink.args = { text: 'Highpoint', loading: true, href: '#!' };
33
42
 
34
- export const StandardButton = (args) => {
35
- const dArgs = details.dynamicArgs(args);
36
-
37
- return staticHTML`<${tag} ${dArgs} ._isButton=${true}>${args.text}</${tag}>`;
38
- };
43
+ export const StandardButton = ButtonTemplate.bind({});
39
44
  StandardButton.storyName = 'Standard [button]';
40
45
  StandardButton.args = { text: 'Highpoint' };
41
46
 
42
- export const DisabledButton = (args) => {
43
- const dArgs = details.dynamicArgs(args);
44
-
45
- return staticHTML`<${tag} ${dArgs} ._isButton=${true}>${args.text}</${tag}>`;
46
- };
47
+ export const DisabledButton = ButtonTemplate.bind({});
47
48
  DisabledButton.storyName = 'Disabled [button]';
48
49
  DisabledButton.args = { text: 'Highpoint', disabled: true };
49
50
 
50
- export const LoadingButton = (args) => {
51
- const dArgs = details.dynamicArgs(args);
52
-
53
- return staticHTML`<${tag} ${dArgs} ._isButton=${true}>${args.text}</${tag}>`;
54
- };
51
+ export const LoadingButton = ButtonTemplate.bind({});
55
52
  LoadingButton.storyName = 'Loading [button]';
56
53
  LoadingButton.args = { text: 'Highpoint', loading: true };
57
54
 
58
- export const StandardForm = (args) => staticHTML`<form>${details.template(args, (args) => args.text)}</form>`;
55
+ export const StandardForm = FormTemplate.bind({});
59
56
  StandardForm.storyName = 'Standard [within form]';
60
57
  StandardForm.args = { text: 'Highpoint' };
61
58
 
62
- export const DisabledForm = (args) => staticHTML`<form>${details.template(args, (args) => args.text)}</form>`;
59
+ export const DisabledForm = FormTemplate.bind({});
63
60
  DisabledForm.storyName = 'Disabled [within form]';
64
61
  DisabledForm.args = { text: 'Highpoint', disabled: true };
65
62
 
66
- export const LoadingForm = (args) => staticHTML`<a href="${args.link}">${details.template(args, (args) => args.text)}</a>`;
67
- LoadingForm.storyName = 'Loading [within link]';
63
+ export const LoadingForm = FormTemplate.bind({});
64
+ LoadingForm.storyName = 'Loading [within form]';
68
65
  LoadingForm.args = { text: 'Highpoint', loading: true };
69
66
 
70
- export const StandardWithinLink = (args) => staticHTML`<a href="${args.link}">${details.template(args, (args) => args.text)}</a>`;
67
+ export const StandardWithinLink = WithinLinkTemplate.bind({});
71
68
  StandardWithinLink.storyName = 'Standard [within link]';
72
69
  StandardWithinLink.args = { text: 'Highpoint', link: '#!' };
73
70
 
74
- export const DisabledWithinLink = (args) => staticHTML`<a href="${args.link}">${details.template(args, (args) => args.text)}</a>`;
71
+ export const DisabledWithinLink = WithinLinkTemplate.bind({});
75
72
  DisabledWithinLink.storyName = 'Disabled [within link]';
76
73
  DisabledWithinLink.args = { text: 'Highpoint', disabled: true, link: '#!' };
77
74
 
78
- export const LoadingWithinLink = (args) => staticHTML`<a href="${args.link}">${details.template(args, (args) => args.text)}</a>`;
75
+ export const LoadingWithinLink = WithinLinkTemplate.bind({});
79
76
  LoadingWithinLink.storyName = 'Loading [within link]';
80
77
  LoadingWithinLink.args = { text: 'Highpoint', loading: true, link: '#!' };
81
78
 
82
- export const StandardWithinButton = (args) => staticHTML`<button>${details.template(args, (args) => args.text)}</button>`;
79
+ export const StandardWithinButton = WithinButtonTemplate.bind({});
83
80
  StandardWithinButton.storyName = 'Standard [within button]';
84
81
  StandardWithinButton.args = { text: 'Highpoint', link: '#!' };
85
82
 
86
- export const DisabledWithinButton = (args) => staticHTML`<button disabled>${details.template(args, (args) => args.text)}</button>`;
83
+ export const DisabledWithinButton = WithinButtonTemplate.bind({});
87
84
  DisabledWithinButton.storyName = 'Disabled [within button]';
88
85
  DisabledWithinButton.args = { text: 'Highpoint', disabled: true, link: '#!' };
89
86
 
90
- export const LoadingWithinButton = (args) => staticHTML`<button>${details.template(args, (args) => args.text)}</button>`;
87
+ export const LoadingWithinButton = WithinButtonTemplate.bind({});
91
88
  LoadingWithinButton.storyName = 'Loading [within button]';
92
89
  LoadingWithinButton.args = { text: 'Highpoint', loading: true, link: '#!' };
@@ -10,13 +10,14 @@ const innerDetail = (args) => `
10
10
  ${args.content}
11
11
  `;
12
12
 
13
- export const Standard = (args) => details.template(args, innerDetail);
13
+ const StandardTemplate = (args) => details.template(args, innerDetail);
14
+ export const Standard = StandardTemplate.bind({});
14
15
  Standard.args = {
15
16
  heading: 'Where can I buy an ice cream?',
16
17
  content: 'We have the most wonderful shop just in town, that sells a whole variety of different ice creams. Just pop on in and we can get you sorted with your favourite flavour!'
17
18
  };
18
19
 
19
- export const WithIcon = (args) => details.template(args, innerDetail);
20
+ export const WithIcon = StandardTemplate.bind({});
20
21
  WithIcon.args = {
21
22
  icon: 'dot-circle',
22
23
  heading: 'Where can I buy an ice cream?',
@@ -1,5 +1,7 @@
1
1
  import { Form } from '@muonic/muon/components/form';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
+ import { Text, Email, Checkbox } from '../inputter/story';
4
+ import { Standard as SubmitCTA } from '../cta/story';
3
5
 
4
6
  const details = setup('form', Form);
5
7
 
@@ -7,29 +9,30 @@ export default details.defaultValues;
7
9
 
8
10
  const innerDetail = () => `
9
11
  <form>
10
- <muon-inputter helper="Useful information to help populate this field." validation='["isRequired"]' name="username">
11
- <label slot="label">Name</label>
12
- <input type="text" placeholder="e.g. Placeholder" name="username"/>
13
- </muon-inputter>
14
-
15
- <muon-inputter value="" helper="How can we help you?" validation="[&quot;isRequired&quot;,&quot;isEmail&quot;]" autocomplete="email">
16
- <label slot="label">Email</label>
17
- <input type="email" placeholder="e.g. my@email.com" autocomplete="email" name="useremail">
18
- <div slot="tip-details">By providing clarification on why this information is necessary.</div>
19
- </muon-inputter>
12
+ ${Text({ ...Text.args,
13
+ name: 'username',
14
+ label: 'Name'
15
+ })}
16
+ ${Email({ ...Email.args,
17
+ name: 'useremail'
18
+ })}
20
19
 
21
20
  <label for="user-id">User ID<label>
22
21
  <input type="text" id="user-id" name="user-id" required/>
23
22
 
24
- <muon-inputter heading="What options do you like?" helper="How can we help you?" validation='["isRequired"]' value="b">
25
- <input type="checkbox" name="checkboxes" value="a" id="check-01">
26
- <label for="check-01">Option A</label>
27
- <input type="checkbox" name="checkboxes" value="b" id="check-02">
28
- <label for="check-02">Option B</label>
29
- <div slot="tip-details">By providing clarification on why this information is necessary.</div>
30
- </muon-inputter>
23
+ ${Checkbox({ ...Checkbox.args,
24
+ value: 'b',
25
+ options: [
26
+ { label: 'Option A', value: 'a' },
27
+ { label: 'Option B', value: 'b' }
28
+ ]
29
+ })}
30
+
31
31
  <input type="reset" />
32
- <muon-cta type="submit">Submit</muon-cta>
32
+ ${SubmitCTA({ ...SubmitCTA.args,
33
+ type: 'submit',
34
+ text: 'Submit'
35
+ })}
33
36
  <form>`;
34
37
 
35
38
  export const Standard = (args) => details.template(args, innerDetail);
@@ -1,8 +1,26 @@
1
1
  import { Icon } from '@muonic/muon/components/icon';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
+ import {
4
+ ICON_CONFIG_SIZES
5
+ } from '@muonic/muon/build/tokens/es6/muon-tokens.mjs';
3
6
 
4
7
  const details = setup('icon', Icon);
5
8
 
9
+ details.defaultValues.argTypes = {
10
+ ...details.defaultValues.argTypes,
11
+ iconSize: {
12
+ table: {
13
+ disable: true
14
+ }
15
+ },
16
+ size: {
17
+ control: {
18
+ type: 'select',
19
+ options: [...ICON_CONFIG_SIZES]
20
+ }
21
+ }
22
+ };
23
+
6
24
  export default details.defaultValues;
7
25
 
8
26
  export const Standard = (args) => details.template(args);
@@ -5,8 +5,10 @@ const details = setup('image', Image);
5
5
 
6
6
  export default details.defaultValues;
7
7
 
8
- export const Standard = (args) => details.template(args, (args) => args.text);
8
+ const StandardTemplate = (args) => details.template(args, (args) => args.text);
9
+
10
+ export const Standard = StandardTemplate.bind({});
9
11
  Standard.args = { src: 'https://blog.nucleus.design/vanilla-first/vanilla-ice-cream-cone.jpg', placeholder: '(src).thumb.48.48.png' };
10
12
 
11
- export const Background = (args) => details.template(args, (args) => args.text);
13
+ export const Background = StandardTemplate.bind({});
12
14
  Background.args = { src: 'https://blog.nucleus.design/multi-branding/Multibrand.jpg', placeholder: '(src).thumb.48.48.png', background: true };
@@ -1,8 +1,18 @@
1
1
  import { Inputter } from '@muonic/muon/components/inputter';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
-
3
+ import customValidation from '@muon/utils/validation/index.js';
4
4
  const details = setup('inputter', Inputter);
5
5
 
6
+ details.defaultValues.argTypes = {
7
+ ...details.defaultValues.argTypes,
8
+ validation: {
9
+ control: {
10
+ type: 'multi-select',
11
+ options: [...Object.keys(customValidation)]
12
+ }
13
+ }
14
+ };
15
+
6
16
  export default details.defaultValues;
7
17
 
8
18
  const labelTemplate = (args) => `
@@ -13,13 +23,26 @@ const tipDetailsTemplate = (args) => `
13
23
  <div slot="tip-details">${args.tip}</div>
14
24
  `;
15
25
 
16
- const innerText = (args) => `
26
+ const autoCompleteTemplate = (args) => `
27
+ ${args.autocomplete ? `autocomplete="${args.autocomplete}"` : ''}
28
+ `;
29
+
30
+ const placeHolderTemplate = (args) => `
31
+ ${args.placeholder ? `placeholder="${args.placeholder}"` : ''}
32
+ `;
33
+
34
+ const disabledTemplate = (args) => `
35
+ ${args.disabled ? `disabled` : ''}
36
+ `;
37
+
38
+ const slottedContent = (args) => `
17
39
  ${args.label ? labelTemplate(args) : ''}
18
- <input type="${args.inputtype}" placeholder="${args.placeholder}">
40
+ <input type="${args.inputtype}" ${placeHolderTemplate(args)} ${autoCompleteTemplate(args)} ${disabledTemplate(args)}>
19
41
  ${args.tip ? tipDetailsTemplate(args) : ''}
20
42
  `;
21
43
 
22
- export const Text = (args) => details.template(args, innerText);
44
+ const InputterStandardTemplate = (args) => details.template(args, slottedContent);
45
+ export const Text = InputterStandardTemplate.bind({});
23
46
  Text.args = {
24
47
  inputtype: 'text',
25
48
  label: 'Text',
@@ -29,13 +52,7 @@ Text.args = {
29
52
  placeholder: 'e.g. Placeholder'
30
53
  };
31
54
 
32
- const innerEmail = (args) => `
33
- ${args.label ? labelTemplate(args) : ''}
34
- <input type="${args.inputtype}" placeholder="${args.placeholder}" autocomplete="${args.autocomplete}">
35
- ${args.tip ? tipDetailsTemplate(args) : ''}
36
- `;
37
-
38
- export const Email = (args) => details.template(args, innerEmail);
55
+ export const Email = InputterStandardTemplate.bind({});
39
56
  Email.args = {
40
57
  inputtype: 'email',
41
58
  label: 'Email',
@@ -47,13 +64,7 @@ Email.args = {
47
64
  autocomplete: 'email'
48
65
  };
49
66
 
50
- const innerTel = (args) => `
51
- ${args.label ? labelTemplate(args) : ''}
52
- <input type="${args.inputtype}" placeholder="${args.placeholder}" autocomplete="${args.autocomplete}">
53
- ${args.tip ? tipDetailsTemplate(args) : ''}
54
- `;
55
-
56
- export const Tel = (args) => details.template(args, innerTel);
67
+ export const Tel = InputterStandardTemplate.bind({});
57
68
  Tel.args = {
58
69
  inputtype: 'tel',
59
70
  label: 'Tel',
@@ -65,52 +76,29 @@ Tel.args = {
65
76
  autocomplete: 'tel'
66
77
  };
67
78
 
68
- const innerSearch = (args) => `
69
- ${args.label ? labelTemplate(args) : ''}
70
- <input type="${args.inputtype}">
71
- ${args.tip ? tipDetailsTemplate(args) : ''}
72
- `;
73
-
74
- export const Search = (args) => details.template(args, innerSearch);
79
+ export const Search = InputterStandardTemplate.bind({});
75
80
  Search.args = {
76
81
  inputtype: 'search',
77
82
  label: 'Search'
78
83
  };
79
84
 
80
- const innerPassword = (args) => `
81
- ${args.label ? labelTemplate(args) : ''}
82
- <input type="${args.inputtype}">
83
- ${args.tip ? tipDetailsTemplate(args) : ''}
84
- `;
85
-
86
- export const Password = (args) => details.template(args, innerPassword);
85
+ export const Password = InputterStandardTemplate.bind({});
87
86
  Password.args = {
88
87
  inputtype: 'password',
89
88
  label: 'Password'
90
89
  };
91
90
 
92
- const innerDisabled = (args) => `
93
- ${args.label ? labelTemplate(args) : ''}
94
- <input type="${args.inputtype}" placeholder="${args.placeholder}" disabled>
95
- ${args.tip ? tipDetailsTemplate(args) : ''}
96
- `;
97
-
98
- export const Disabled = (args) => details.template(args, innerDisabled);
91
+ export const Disabled = InputterStandardTemplate.bind({});
99
92
  Disabled.args = {
100
93
  inputtype: 'text',
101
94
  label: 'Disabled',
102
95
  value: '',
103
96
  validation: ['isRequired'],
104
- placeholder: 'e.g. Placeholder'
97
+ placeholder: 'e.g. Placeholder',
98
+ disabled: true
105
99
  };
106
100
 
107
- const innerDate = (args) => `
108
- ${args.label ? labelTemplate(args) : ''}
109
- <input type="${args.inputtype}">
110
- ${args.tip ? tipDetailsTemplate(args) : ''}
111
- `;
112
-
113
- export const Date = (args) => details.template(args, innerDate);
101
+ export const Date = InputterStandardTemplate.bind({});
114
102
  Date.args = {
115
103
  inputtype: 'date',
116
104
  label: 'Date',
@@ -119,7 +107,7 @@ Date.args = {
119
107
  validation: ['isRequired', 'minDate(\'01/01/2022\')']
120
108
  };
121
109
 
122
- export const DateMask = (args) => details.template(args, innerText);
110
+ export const DateMask = InputterStandardTemplate.bind({});
123
111
  DateMask.args = {
124
112
  inputtype: 'text',
125
113
  label: 'Date Mask',
@@ -130,7 +118,7 @@ DateMask.args = {
130
118
  validation: ['isRequired', 'minDate(\'01/01/2022\')']
131
119
  };
132
120
 
133
- export const Mask = (args) => details.template(args, innerText);
121
+ export const Mask = InputterStandardTemplate.bind({});
134
122
  Mask.args = {
135
123
  inputtype: 'text',
136
124
  label: 'Mask',
@@ -140,7 +128,7 @@ Mask.args = {
140
128
  validation: ['isRequired']
141
129
  };
142
130
 
143
- export const Separator = (args) => details.template(args, innerText);
131
+ export const Separator = InputterStandardTemplate.bind({});
144
132
  Separator.args = {
145
133
  inputtype: 'text',
146
134
  label: 'Separator',
@@ -178,54 +166,55 @@ Textarea.args = {
178
166
  placeholder: 'e.g. Provide information'
179
167
  };
180
168
 
181
- const innerCheckbox = (args) => `
182
- <input type="checkbox" name="checkboxes" value="a" checked id="check-01">
183
- <label for="check-01">Option A</label>
184
- <input type="checkbox" name="checkboxes" value="b" id="check-02">
185
- <label for="check-02">Option B</label>
186
- <input type="checkbox" name="checkboxes" value="c" id="check-03">
187
- <label for="check-03">Option C</label>
188
- <input type="checkbox" name="checkboxes" value="d" disabled id="check-04">
189
- <label for="check-04">Option D</label>
169
+ const innerMultiple = (args) => `
170
+ ${args.options?.map((option, i) => {
171
+ const states = option.states?.join(' ') ?? '';
172
+ const id = `${args.inputtype}-${i + 1}`;
173
+ return `
174
+ <input type="${args.inputtype}" name="${args.name}" value="${option.value}" ${states} id="${id}">
175
+ <label for="${id}">${option.label}</label>
176
+ `;
177
+ }).join(' ')}
190
178
  ${args.tip ? tipDetailsTemplate(args) : ''}
191
179
  `;
192
180
 
193
- export const Checkbox = (args) => details.template(args, innerCheckbox);
181
+ const InputterMultipleTemplate = (args) => details.template(args, innerMultiple);
182
+ export const Checkbox = InputterMultipleTemplate.bind({});
194
183
  Checkbox.args = {
184
+ inputtype: 'checkbox',
195
185
  heading: 'What options do you like?',
196
186
  helper: 'How can we help you?',
197
187
  tip: 'By providing clarification on why this information is necessary.',
198
- validation: ['isRequired']
188
+ validation: ['isRequired'],
189
+ name: 'checkboxes',
190
+ options: [
191
+ { label: 'Option A', value: 'a', states: ['checked'] },
192
+ { label: 'Option B', value: 'b' },
193
+ { label: 'Option C', value: 'c' },
194
+ { label: 'Option D', value: 'd', states: ['disabled'] }
195
+ ]
199
196
  };
200
197
 
201
- const innerRadio = (args) => `
202
- <input type="radio" name="radiobuttons" value="a" checked id="radio-01">
203
- <label for="radio-01">Choice A</label>
204
- <input type="radio" name="radiobuttons" value="b" id="radio-02">
205
- <label for="radio-02">Choice B</label>
206
- <input type="radio" name="radiobuttons" value="c" id="radio-03">
207
- <label for="radio-03">Option C</label>
208
- <input type="radio" name="radiobuttons" value="d" disabled id="radio-04">
209
- <label for="radio-04">Choice D</label>
210
- ${args.tip ? tipDetailsTemplate(args) : ''}
211
- `;
212
-
213
- export const Radio = (args) => details.template(args, innerRadio);
198
+ export const Radio = InputterMultipleTemplate.bind({});
214
199
  Radio.args = {
200
+ inputtype: 'radio',
215
201
  heading: 'Which choice would you prefer?',
216
202
  helper: 'How can we help you?',
217
203
  tip: 'By providing clarification on why this information is necessary.',
218
- validation: ['isRequired']
204
+ validation: ['isRequired'],
205
+ name: 'radiobuttons',
206
+ options: [
207
+ { label: 'Choice A', value: 'a', states: ['checked'] },
208
+ { label: 'Choice B', value: 'b' },
209
+ { label: 'Choice C', value: 'c' },
210
+ { label: 'Choice D', value: 'd', states: ['disabled'] }
211
+ ]
219
212
  };
220
213
 
221
214
  const innerSelect = (args) => `
222
215
  <label slot="label">${args.label}</label>
223
- <select name="select">
224
- <option value="">Please select</option>
225
- <option value="value-01">Value one</option>
226
- <option value="value-02">Value two</option>
227
- <option value="value-03">Value three</option>
228
- <option value="value-04">Value four</option>
216
+ <select name="${args.name}">
217
+ ${args.options?.map((option) => `<option value="${option.value}">${option.label}</option>`).join(' ')}
229
218
  </select>
230
219
  `;
231
220
 
@@ -233,5 +222,13 @@ export const Select = (args) => details.template(args, innerSelect);
233
222
  Select.args = {
234
223
  label: 'Select',
235
224
  value: '',
236
- validation: ['isRequired']
225
+ validation: ['isRequired'],
226
+ name: 'select',
227
+ options: [
228
+ { label: 'Please select', value: '' },
229
+ { label: 'Value one', value: 'value-01' },
230
+ { label: 'Value two', value: 'value-02' },
231
+ { label: 'Value three', value: 'value-03' },
232
+ { label: 'Value four', value: 'value-04' }
233
+ ]
237
234
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muonic/muon",
3
- "version": "0.0.2-experimental-120-a646376.0",
3
+ "version": "0.0.2-experimental-123-c739cfa.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -49,9 +49,9 @@
49
49
  "web-component-analyzer": "1.1.6"
50
50
  },
51
51
  "devDependencies": {
52
- "@open-wc/testing": "3.1.5",
53
- "@web/dev-server-esbuild": "0.3.0",
54
- "@web/test-runner": "0.13.30",
52
+ "@open-wc/testing": "3.1.6",
53
+ "@web/dev-server-esbuild": "0.3.1",
54
+ "@web/test-runner": "0.13.31",
55
55
  "@web/test-runner-browserstack": "0.5.0",
56
56
  "@web/test-runner-playwright": "0.8.9",
57
57
  "sinon": "14.0.0"
@@ -1,4 +1,3 @@
1
- import { html, unsafeStatic } from 'lit/static-html.js';
2
1
  export default (name, el) => {
3
2
  const prefix = process.env.MUON_PREFIX;
4
3
  const element = `${prefix}-${name}`;
@@ -41,7 +40,7 @@ export default (name, el) => {
41
40
  };
42
41
 
43
42
  const getTagEl = () => {
44
- return unsafeStatic(element);
43
+ return element;
45
44
  };
46
45
 
47
46
  const dynamicArgs = (args) => {
@@ -64,14 +63,14 @@ export default (name, el) => {
64
63
  }
65
64
  }).filter((arg) => arg).join(' ');
66
65
 
67
- return unsafeStatic(dArgs);
66
+ return dArgs;
68
67
  };
69
68
 
70
69
  const template = (args, inner) => {
71
70
  const tag = getTagEl();
72
71
  const dArgs = dynamicArgs(args);
73
72
 
74
- return html`<${tag} ${dArgs}>${inner ? unsafeStatic(inner(args)) : ''}</${tag}>`;
73
+ return `<${tag} ${dArgs}>${inner ? inner(args) : ''}</${tag}>`;
75
74
  };
76
75
 
77
76
  return {