File tree 3 files changed +57
-0
lines changed
components/hds/layout/flex
showcase/app/templates/layouts
3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ export interface HdsLayoutFlexItemSignature {
16
16
basis ?: string | 0 ;
17
17
grow ?: boolean | number | string ;
18
18
shrink ?: boolean | number | string ;
19
+ // TODO final name TBD
20
+ enableCollapseBelowContentSize ?: boolean ;
19
21
} ;
20
22
Blocks : {
21
23
default : [ ] ;
@@ -79,6 +81,11 @@ export default class HdsLayoutFlexItem extends Component<HdsLayoutFlexItemSignat
79
81
classes . push ( 'hds-layout-flex-item--shrink-1' ) ;
80
82
}
81
83
84
+ // add a class based on the @enableCollapseBelowContentSize argument (applies a `min-width: 0`)
85
+ if ( this . args . enableCollapseBelowContentSize ) {
86
+ classes . push ( 'hds-layout-flex-item--enable-collapse-below-content-size' ) ;
87
+ }
88
+
82
89
return classes . join ( ' ' ) ;
83
90
}
84
91
}
Original file line number Diff line number Diff line change 99
99
.hds-layout-flex-item--shrink-1 {
100
100
flex-shrink : 1 ;
101
101
}
102
+
103
+ .hds-layout-flex-item--enable-collapse-below-content-size {
104
+ // this allows the element to shrink below its content's intrinsic minimum width (eg. used with elliptized text)
105
+ min-width : 0 ;
106
+ }
Original file line number Diff line number Diff line change 299
299
</SG .Item>
300
300
</Shw::Grid >
301
301
302
+ <Shw::Text::H3 >enableCollapseBelowContentSize (<code >min-width: 0</code >)</Shw::Text::H3 >
303
+
304
+ <Shw::Grid @columns ={{ 1 }} as |SG|>
305
+ <SG .Item @label =" first flex item has enableCollapseBelowContentSize=true" >
306
+ <Shw::Outliner {{ style max-width =" 600px" }} >
307
+ <Hds::Layout::Flex as |HLF|>
308
+ <HLF .Item @enableCollapseBelowContentSize ={{ true }} >
309
+ <Shw::Placeholder @height =" 40" @background =" #e4c5f3" >
310
+ <pre {{ style white-space =" nowrap" overflow =" hidden" text-overflow =" ellipsis" }} >item #1 with a very long text that might cause overflow issues</pre >
311
+ </Shw::Placeholder >
312
+ </HLF .Item>
313
+ <HLF .Item>
314
+ <Shw::Placeholder @text =" item #2 with width=150px" @width =" 150px" @height =" 40" @background =" #e5ffd2" />
315
+ </HLF .Item>
316
+ <HLF .Item>
317
+ <Shw::Placeholder @text =" item #3 with width=150px" @width =" 150px" @height =" 40" @background =" #d2f4ff" />
318
+ </HLF .Item>
319
+ <HLF .Item>
320
+ <Shw::Placeholder @text =" item #4" @height =" 40" @background =" #fff8d2" />
321
+ </HLF .Item>
322
+ </Hds::Layout::Flex >
323
+ </Shw::Outliner >
324
+ </SG .Item>
325
+ <SG .Item @label =" first flex item has basis=0px" >
326
+ <Shw::Outliner {{ style max-width =" 600px" }} >
327
+ <Hds::Layout::Flex as |HLF|>
328
+ <HLF .Item @basis =" 0px" >
329
+ <Shw::Placeholder @height =" 40" @background =" #e4c5f3" >
330
+ <pre {{ style white-space =" nowrap" overflow =" hidden" text-overflow =" ellipsis" }} >item #1 with a very long text that might cause overflow issues</pre >
331
+ </Shw::Placeholder >
332
+ </HLF .Item>
333
+ <HLF .Item>
334
+ <Shw::Placeholder @text =" item #2 with width=150px" @width =" 150px" @height =" 40" @background =" #e5ffd2" />
335
+ </HLF .Item>
336
+ <HLF .Item>
337
+ <Shw::Placeholder @text =" item #3 with width=150px" @width =" 150px" @height =" 40" @background =" #d2f4ff" />
338
+ </HLF .Item>
339
+ <HLF .Item>
340
+ <Shw::Placeholder @text =" item #4" @height =" 40" @background =" #fff8d2" />
341
+ </HLF .Item>
342
+ </Hds::Layout::Flex >
343
+ </Shw::Outliner >
344
+ </SG .Item>
345
+ </Shw::Grid >
346
+
302
347
</section >
You can’t perform that action at this time.
0 commit comments