File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
packages/stencil-library/src/components Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ pid-collapsible.resize-both {
3232 max-width : 100% !important ; /* Prevent exceeding parent container */
3333 will-change : width, height; /* Hint to the browser to optimize for resizing */
3434 transition : none !important ; /* Disable transitions during resize for better performance */
35+ min-height : fit-content; /* Ensure the component expands to fit its content */
36+ min-width : fit-content; /* Ensure the component expands to fit its content */
3537}
3638
3739/*
Original file line number Diff line number Diff line change @@ -338,6 +338,7 @@ export class PidCollapsible {
338338 if ( ! this . currentHeight || this . currentHeight === `${ this . lineHeight } px` ) {
339339 this . currentHeight = this . initialHeight || `${ optimalHeight } px` ;
340340 } else {
341+ // Set the height to exactly match the content height plus padding
341342 this . currentHeight = `${ optimalHeight } px` ;
342343 }
343344
Original file line number Diff line number Diff line change @@ -193,11 +193,20 @@ export class PidComponent {
193193 // Initialize component ID for references
194194 this . ensureComponentId ( ) ;
195195
196- // Ensure collapsible gets proper initial width after load
196+ // Ensure collapsible gets proper initial width and open state after load
197197 setTimeout ( ( ) => {
198198 const collapsible = this . el . querySelector ( 'pid-collapsible' ) ;
199- if ( collapsible && typeof ( collapsible as any ) . recalculateContentDimensions === 'function' ) {
200- ( collapsible as any ) . recalculateContentDimensions ( ) ;
199+ if ( collapsible ) {
200+ // Set open state explicitly based on openByDefault property
201+ if ( this . openByDefault ) {
202+ ( collapsible as any ) . open = true ;
203+ ( collapsible as any ) . expanded = true ;
204+ }
205+
206+ // Recalculate dimensions after setting open state
207+ if ( typeof ( collapsible as any ) . recalculateContentDimensions === 'function' ) {
208+ ( collapsible as any ) . recalculateContentDimensions ( ) ;
209+ }
201210 }
202211 } , 0 ) ;
203212 }
You can’t perform that action at this time.
0 commit comments