@fluid-topics/ft-confirm-button 1.2.52 → 1.2.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
2
  import { FtIcons } from "@fluid-topics/ft-icon";
3
3
  import { FtdsModalConfirm } from "@fluid-topics/ft-modal";
4
4
  import { FtdsConfirmButtonProperties } from "./ftds-confirm-button.properties";
5
- import { DesignSystemSize, DesignSystemFamily } from "@fluid-topics/design-system-variables";
5
+ import { DesignSystemFamily, DesignSystemSize } from "@fluid-topics/design-system-variables";
6
6
  import { Position } from "@fluid-topics/ft-tooltip";
7
7
  export declare class ConfirmEvent extends CustomEvent<void> {
8
8
  constructor();
@@ -28,6 +28,9 @@ export declare class FtdsConfirmButton extends FtLitElement implements FtdsConfi
28
28
  loading: boolean;
29
29
  disabled: boolean;
30
30
  modal: FtdsModalConfirm;
31
+ slotElement: HTMLSlotElement;
32
+ private hasSlottedContent;
31
33
  protected render(): import("lit-html").TemplateResult<1>;
32
34
  private askConfirmation;
35
+ private onSlotchange;
33
36
  }
@@ -10,7 +10,7 @@ import { css, html } from "lit";
10
10
  import { FtdsButton } from "@fluid-topics/ft-button";
11
11
  import { FtIcons } from "@fluid-topics/ft-icon";
12
12
  import { FtdsModalConfirm } from "@fluid-topics/ft-modal";
13
- import { DesignSystemSize, DesignSystemFamily } from "@fluid-topics/design-system-variables";
13
+ import { DesignSystemFamily, DesignSystemSize } from "@fluid-topics/design-system-variables";
14
14
  export class ConfirmEvent extends CustomEvent {
15
15
  constructor() {
16
16
  super("confirm");
@@ -35,6 +35,7 @@ let FtdsConfirmButton = class FtdsConfirmButton extends FtLitElement {
35
35
  this.cancelIcon = FtIcons.CLOSE;
36
36
  this.loading = false;
37
37
  this.disabled = false;
38
+ this.hasSlottedContent = false;
38
39
  }
39
40
  render() {
40
41
  return html `
@@ -49,7 +50,8 @@ let FtdsConfirmButton = class FtdsConfirmButton extends FtLitElement {
49
50
  size=${this.buttonSize}
50
51
  family=${this.buttonFamily}
51
52
  @click=${() => this.askConfirmation()}>
52
- <slot>${this.buttonText}</slot>
53
+ <slot @slotchange=${this.onSlotchange}></slot>
54
+ ${this.hasSlottedContent ? html `` : html `${this.buttonText}`}
53
55
  </ftds-button>
54
56
  <ftds-modal-confirm heading=${this.heading}
55
57
  text=${this.text}
@@ -66,6 +68,10 @@ let FtdsConfirmButton = class FtdsConfirmButton extends FtLitElement {
66
68
  this.dispatchEvent(new ConfirmEvent());
67
69
  }
68
70
  }
71
+ onSlotchange() {
72
+ this.hasSlottedContent = this.slotElement.assignedNodes().length > 0;
73
+ this.requestUpdate();
74
+ }
69
75
  };
70
76
  FtdsConfirmButton.elementDefinitions = {
71
77
  "ftds-button": FtdsButton,
@@ -126,6 +132,9 @@ __decorate([
126
132
  __decorate([
127
133
  query("ftds-modal-confirm")
128
134
  ], FtdsConfirmButton.prototype, "modal", void 0);
135
+ __decorate([
136
+ query("slot")
137
+ ], FtdsConfirmButton.prototype, "slotElement", void 0);
129
138
  FtdsConfirmButton = __decorate([
130
139
  customElement("ftds-confirm-button")
131
140
  ], FtdsConfirmButton);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-confirm-button",
3
- "version": "1.2.52",
3
+ "version": "1.2.53",
4
4
  "description": "A two step confirmation button",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,11 +19,11 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-wc-utils": "1.2.52",
22
+ "@fluid-topics/ft-wc-utils": "1.2.53",
23
23
  "lit": "3.1.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@fluid-topics/ft-wc-test-utils": "1.2.52"
26
+ "@fluid-topics/ft-wc-test-utils": "1.2.53"
27
27
  },
28
- "gitHead": "5bdea3806bc9a17448a0533c5c3ecfee0cfa8bac"
28
+ "gitHead": "bd51f81f7882978f24a88c30c24427c56f2faa86"
29
29
  }