11import * as React from 'react'
22
3+ import { Box } from '../box'
34import { selectWithNone } from '../utils/storybook-helper'
45
56import { ControlActionButton } from './control-action-button'
@@ -38,20 +39,21 @@ export function PlaygroundStory({
3839} : PlaygroundArgs ) {
3940 return (
4041 < section className = "story playground" >
41- < ControlPresentation
42- maxWidth = { maxWidth }
43- startSlot = { startSlot ? < InfoIcon /> : undefined }
44- endSlot = { endSlot ? < ChevronDownIcon /> : undefined }
45- >
46- < input
47- aria-label = "Demo input"
48- placeholder = { placeholder }
49- readOnly = { readOnly }
50- disabled = { disabled }
51- aria-invalid = { invalid || undefined }
52- defaultValue = { defaultValue }
53- />
54- </ ControlPresentation >
42+ < Box maxWidth = { maxWidth } >
43+ < ControlPresentation
44+ startSlot = { startSlot ? < InfoIcon /> : undefined }
45+ endSlot = { endSlot ? < ChevronDownIcon /> : undefined }
46+ >
47+ < input
48+ aria-label = "Demo input"
49+ placeholder = { placeholder }
50+ readOnly = { readOnly }
51+ disabled = { disabled }
52+ aria-invalid = { invalid || undefined }
53+ defaultValue = { defaultValue }
54+ />
55+ </ ControlPresentation >
56+ </ Box >
5557 </ section >
5658 )
5759}
@@ -83,13 +85,11 @@ PlaygroundStory.parameters = {
8385export function PlaceholderStory ( ) {
8486 return (
8587 < section className = "story" >
86- < ControlPresentation
87- maxWidth = "small"
88- startSlot = { < InfoIcon /> }
89- endSlot = { < ChevronDownIcon /> }
90- >
91- < input aria-label = "Placeholder" placeholder = "Select a value" />
92- </ ControlPresentation >
88+ < Box maxWidth = "small" >
89+ < ControlPresentation startSlot = { < InfoIcon /> } endSlot = { < ChevronDownIcon /> } >
90+ < input aria-label = "Placeholder" placeholder = "Select a value" />
91+ </ ControlPresentation >
92+ </ Box >
9393 </ section >
9494 )
9595}
@@ -102,13 +102,11 @@ PlaceholderStory.parameters = {
102102export function WithValueStory ( ) {
103103 return (
104104 < section className = "story" >
105- < ControlPresentation
106- maxWidth = "small"
107- startSlot = { < InfoIcon /> }
108- endSlot = { < ChevronDownIcon /> }
109- >
110- < input aria-label = "With value" defaultValue = "Sample value" />
111- </ ControlPresentation >
105+ < Box maxWidth = "small" >
106+ < ControlPresentation startSlot = { < InfoIcon /> } endSlot = { < ChevronDownIcon /> } >
107+ < input aria-label = "With value" defaultValue = "Sample value" />
108+ </ ControlPresentation >
109+ </ Box >
112110 </ section >
113111 )
114112}
@@ -121,13 +119,11 @@ WithValueStory.parameters = {
121119export function ReadOnlyStory ( ) {
122120 return (
123121 < section className = "story" >
124- < ControlPresentation
125- maxWidth = "small"
126- startSlot = { < InfoIcon /> }
127- endSlot = { < ChevronDownIcon /> }
128- >
129- < input aria-label = "Read-only" defaultValue = "Sample value" readOnly />
130- </ ControlPresentation >
122+ < Box maxWidth = "small" >
123+ < ControlPresentation startSlot = { < InfoIcon /> } endSlot = { < ChevronDownIcon /> } >
124+ < input aria-label = "Read-only" defaultValue = "Sample value" readOnly />
125+ </ ControlPresentation >
126+ </ Box >
131127 </ section >
132128 )
133129}
@@ -140,13 +136,11 @@ ReadOnlyStory.parameters = {
140136export function DisabledStory ( ) {
141137 return (
142138 < section className = "story" >
143- < ControlPresentation
144- maxWidth = "small"
145- startSlot = { < InfoIcon /> }
146- endSlot = { < ChevronDownIcon /> }
147- >
148- < input aria-label = "Disabled" defaultValue = "Sample value" disabled />
149- </ ControlPresentation >
139+ < Box maxWidth = "small" >
140+ < ControlPresentation startSlot = { < InfoIcon /> } endSlot = { < ChevronDownIcon /> } >
141+ < input aria-label = "Disabled" defaultValue = "Sample value" disabled />
142+ </ ControlPresentation >
143+ </ Box >
150144 </ section >
151145 )
152146}
@@ -159,13 +153,11 @@ DisabledStory.parameters = {
159153export function ErrorStory ( ) {
160154 return (
161155 < section className = "story" >
162- < ControlPresentation
163- maxWidth = "small"
164- startSlot = { < InfoIcon /> }
165- endSlot = { < ChevronDownIcon /> }
166- >
167- < input aria-label = "Error" defaultValue = "Invalid value" aria-invalid />
168- </ ControlPresentation >
156+ < Box maxWidth = "small" >
157+ < ControlPresentation startSlot = { < InfoIcon /> } endSlot = { < ChevronDownIcon /> } >
158+ < input aria-label = "Error" defaultValue = "Invalid value" aria-invalid />
159+ </ ControlPresentation >
160+ </ Box >
169161 </ section >
170162 )
171163}
@@ -178,9 +170,11 @@ ErrorStory.parameters = {
178170export function EndSlotAsUnitStory ( ) {
179171 return (
180172 < section className = "story" >
181- < ControlPresentation maxWidth = "small" startSlot = { < InfoIcon /> } endSlot = "kg" >
182- < input aria-label = "Weight" type = "number" defaultValue = "72" />
183- </ ControlPresentation >
173+ < Box maxWidth = "small" >
174+ < ControlPresentation startSlot = { < InfoIcon /> } endSlot = "kg" >
175+ < input aria-label = "Weight" type = "number" defaultValue = "72" />
176+ </ ControlPresentation >
177+ </ Box >
184178 </ section >
185179 )
186180}
@@ -193,13 +187,14 @@ EndSlotAsUnitStory.parameters = {
193187export function EndSlotAsClearButtonStory ( ) {
194188 return (
195189 < section className = "story" >
196- < ControlPresentation
197- maxWidth = "small"
198- startSlot = { < InfoIcon /> }
199- endSlot = { < ControlActionButton icon = { < XIcon /> } aria-label = "Clear" /> }
200- >
201- < input aria-label = "Search" defaultValue = "sample query" />
202- </ ControlPresentation >
190+ < Box maxWidth = "small" >
191+ < ControlPresentation
192+ startSlot = { < InfoIcon /> }
193+ endSlot = { < ControlActionButton icon = { < XIcon /> } aria-label = "Clear" /> }
194+ >
195+ < input aria-label = "Search" defaultValue = "sample query" />
196+ </ ControlPresentation >
197+ </ Box >
203198 </ section >
204199 )
205200}
@@ -212,21 +207,19 @@ EndSlotAsClearButtonStory.parameters = {
212207export function WrappingSelectStory ( ) {
213208 return (
214209 < section className = "story" >
215- < ControlPresentation
216- maxWidth = "small"
217- startSlot = { < InfoIcon /> }
218- endSlot = { < ChevronDownIcon /> }
219- >
220- < select
221- aria-label = "Favourite fruit"
222- defaultValue = "banana"
223- style = { { appearance : 'none' } }
224- >
225- < option value = "apple" > Apple</ option >
226- < option value = "banana" > Banana</ option >
227- < option value = "cherry" > Cherry</ option >
228- </ select >
229- </ ControlPresentation >
210+ < Box maxWidth = "small" >
211+ < ControlPresentation startSlot = { < InfoIcon /> } endSlot = { < ChevronDownIcon /> } >
212+ < select
213+ aria-label = "Favourite fruit"
214+ defaultValue = "banana"
215+ style = { { appearance : 'none' } }
216+ >
217+ < option value = "apple" > Apple</ option >
218+ < option value = "banana" > Banana</ option >
219+ < option value = "cherry" > Cherry</ option >
220+ </ select >
221+ </ ControlPresentation >
222+ </ Box >
230223 </ section >
231224 )
232225}
0 commit comments