Skip to content

Commit 31dc886

Browse files
use properties correclty
1 parent 4f518b6 commit 31dc886

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

packages/web-component/src/index.ts

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ function updateAttributes(
6666
}
6767
}
6868

69-
function isBooleanPropValue(value: string | null) {
70-
if (value === "true" || value === "") return true;
71-
if (value === "false") return false;
72-
return undefined;
73-
}
74-
7569
export class PanelGroup extends LitElement {
7670
private observer: ResizeObserver;
7771
private cleanupChildrenObserver: () => void;
@@ -284,14 +278,14 @@ export class Panel extends LitElement {
284278
max?: string;
285279
@property({ type: String, reflect: true })
286280
default?: string;
287-
@property({ type: String, reflect: true })
288-
collapsible?: string;
289-
@property({ type: String, reflect: true })
290-
defaultCollapsed?: string;
281+
@property({ type: Boolean, reflect: true })
282+
collapsible?: boolean;
283+
@property({ type: Boolean, reflect: true })
284+
defaultCollapsed?: boolean;
291285
@property({ type: String, reflect: true })
292286
collapsedSize?: string;
293-
@property({ type: String, reflect: true })
294-
isStaticAtRest?: string;
287+
@property({ type: Boolean, reflect: true })
288+
isStaticAtRest?: boolean;
295289

296290
@consume({ context: contextContext })
297291
@property({ attribute: false })
@@ -354,19 +348,17 @@ export class Panel extends LitElement {
354348
id: this.id,
355349
min: this.getAttribute("min") as Unit | undefined,
356350
max: this.getAttribute("max") as Unit | undefined,
357-
collapsible: isBooleanPropValue(this.getAttribute("collapsible")),
358-
collapsed: isBooleanPropValue(this.getAttribute("collapsed")),
351+
collapsible: this.collapsible,
352+
collapsed: this.collapsed,
359353
collapsedSize: this.getAttribute("collapsedSize") as Unit | undefined,
360354
onCollapseChange: this.onCollapseChange
361355
? { current: (e) => this.onCollapseChange?.(e, this) }
362356
: undefined,
363357
collapseAnimation: this.collapseAnimation,
364358
onResize: this.onResize ? { current: this.onResize } : undefined,
365-
defaultCollapsed: isBooleanPropValue(
366-
this.getAttribute("defaultCollapsed")
367-
),
368-
default: this.getAttribute("default") as Unit | undefined,
369-
isStaticAtRest: isBooleanPropValue(this.getAttribute("isStaticAtRest")),
359+
defaultCollapsed: this.defaultCollapsed,
360+
default: this.default as Unit | undefined,
361+
isStaticAtRest: this.isStaticAtRest,
370362
});
371363
}
372364

@@ -637,6 +629,7 @@ export class PanelResizer extends LitElement {
637629
updated(changedProperties: PropertyValues) {
638630
if (changedProperties.has("size")) {
639631
const currentHandleData = this.getHandleData();
632+
640633
if (
641634
currentHandleData &&
642635
haveConstraintsChangedForPanelHandle(
@@ -648,6 +641,7 @@ export class PanelResizer extends LitElement {
648641
}
649642
}
650643
}
644+
651645
disconnectedCallback(): void {
652646
requestAnimationFrame(() =>
653647
this.send({ type: "unregisterPanelHandle", id: this.id })

0 commit comments

Comments
 (0)