From 729fd83f57296c9eaab859db0844a659d901de6d Mon Sep 17 00:00:00 2001 From: Francesca Giannino Date: Mon, 5 Aug 2024 13:17:01 +0200 Subject: [PATCH] fix: fix close prop --- packages/ui-stencil-vue/lib/components.ts | 2 +- packages/ui-stencil/src/components.d.ts | 4 ++-- .../orama-sliding-panel.tsx | 21 +++++-------------- .../internal/orama-sliding-panel/readme.md | 8 +++---- .../orama-search-box/orama-search-box.tsx | 2 +- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/packages/ui-stencil-vue/lib/components.ts b/packages/ui-stencil-vue/lib/components.ts index c141c242..084e7ae9 100644 --- a/packages/ui-stencil-vue/lib/components.ts +++ b/packages/ui-stencil-vue/lib/components.ts @@ -139,7 +139,7 @@ export const OramaSearchResults = /*@__PURE__*/ defineContainer('orama-sliding-panel', undefined, [ 'open', - 'onClosed' + 'closed' ]); diff --git a/packages/ui-stencil/src/components.d.ts b/packages/ui-stencil/src/components.d.ts index 4b25e208..e6f5ab42 100644 --- a/packages/ui-stencil/src/components.d.ts +++ b/packages/ui-stencil/src/components.d.ts @@ -114,7 +114,7 @@ export namespace Components { "sections": SearchResultBySection[]; } interface OramaSlidingPanel { - "onClosed": () => void; + "closed": () => void; "open": boolean; } interface OramaText { @@ -447,7 +447,7 @@ declare namespace LocalJSX { "sections"?: SearchResultBySection[]; } interface OramaSlidingPanel { - "onClosed"?: () => void; + "closed"?: () => void; "open"?: boolean; } interface OramaText { diff --git a/packages/ui-stencil/src/components/internal/orama-sliding-panel/orama-sliding-panel.tsx b/packages/ui-stencil/src/components/internal/orama-sliding-panel/orama-sliding-panel.tsx index f02ecac9..b118a8cb 100644 --- a/packages/ui-stencil/src/components/internal/orama-sliding-panel/orama-sliding-panel.tsx +++ b/packages/ui-stencil/src/components/internal/orama-sliding-panel/orama-sliding-panel.tsx @@ -1,4 +1,4 @@ -import { Component, Prop, State, h, Element, Watch } from '@stencil/core' +import { Component, Prop, State, h, Element, Watch, Event } from '@stencil/core' import '@phosphor-icons/webcomponents/dist/icons/PhX.mjs' @Component({ @@ -9,20 +9,17 @@ import '@phosphor-icons/webcomponents/dist/icons/PhX.mjs' export class SlideInPanel { @Element() el: HTMLElement @Prop() open = false - @Prop() onClosed: () => void + @Prop() closed: () => void @State() isOpen: boolean = this.open - panelRef: HTMLElement - buttonRef: HTMLElement - @Watch('open') openChanged() { this.isOpen = this.open } closePanel() { - if (this.onClosed) { - this.onClosed() + if (this.closed) { + this.closed() } this.isOpen = false } @@ -32,7 +29,6 @@ export class SlideInPanel {
-
(this.panelRef = el as HTMLElement)} - class="slide-container-inner" - > +
diff --git a/packages/ui-stencil/src/components/internal/orama-sliding-panel/readme.md b/packages/ui-stencil/src/components/internal/orama-sliding-panel/readme.md index cde67d2a..6b38e916 100644 --- a/packages/ui-stencil/src/components/internal/orama-sliding-panel/readme.md +++ b/packages/ui-stencil/src/components/internal/orama-sliding-panel/readme.md @@ -7,10 +7,10 @@ ## Properties -| Property | Attribute | Description | Type | Default | -| ---------- | --------- | ----------- | ------------ | ----------- | -| `onClosed` | -- | | `() => void` | `undefined` | -| `open` | `open` | | `boolean` | `false` | +| Property | Attribute | Description | Type | Default | +| -------- | --------- | ----------- | ------------ | ----------- | +| `closed` | -- | | `() => void` | `undefined` | +| `open` | `open` | | `boolean` | `false` | ## Dependencies diff --git a/packages/ui-stencil/src/components/orama-search-box/orama-search-box.tsx b/packages/ui-stencil/src/components/orama-search-box/orama-search-box.tsx index 391376e1..203fbeff 100644 --- a/packages/ui-stencil/src/components/orama-search-box/orama-search-box.tsx +++ b/packages/ui-stencil/src/components/orama-search-box/orama-search-box.tsx @@ -169,7 +169,7 @@ export class SearchBox { {this.windowWidth > 1024 && ( { + closed={() => { globalContext.currentTask = 'search' }} >