@kubex/zinc 1.1.146 → 1.1.148

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubex/zinc",
3
- "version": "1.1.146",
3
+ "version": "1.1.148",
4
4
  "description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
5
5
  "keywords": [
6
6
  "web components",
@@ -70,6 +70,8 @@ export default class ZnConfirm extends ZincElement {
70
70
 
71
71
  @property() cancelText: string = "Cancel";
72
72
 
73
+ @property() closeText: string = "Close";
74
+
73
75
  @property({type: Boolean, attribute: 'hide-icon'}) hideIcon: boolean = false;
74
76
 
75
77
  /**
@@ -228,12 +230,16 @@ export default class ZnConfirm extends ZincElement {
228
230
  <slot></slot>`}
229
231
  </div>
230
232
 
231
- <zn-button outline color="${this.type}" slot="footer" dialog-closer disabled=${this.loading || nothing}>
232
- ${this.cancelText}
233
- </zn-button>
234
- <zn-button color="${this.type}" slot="footer" @click="${this.submitDialog}" disabled=${this.loading || nothing}>
235
- ${this.confirmText}
236
- </zn-button>
233
+ ${this.failed ? html`
234
+ <zn-button color="${this.type}" slot="footer" dialog-closer>
235
+ ${this.closeText}
236
+ </zn-button>` : html`
237
+ <zn-button outline color="${this.type}" slot="footer" dialog-closer disabled=${this.loading || nothing}>
238
+ ${this.cancelText}
239
+ </zn-button>
240
+ <zn-button color="${this.type}" slot="footer" @click="${this.submitDialog}" disabled=${this.loading || nothing}>
241
+ ${this.confirmText}
242
+ </zn-button>`}
237
243
 
238
244
  <slot name="footer-text" slot="footer-text">${this.footerText}</slot>
239
245
  </zn-dialog>`;
@@ -28,7 +28,7 @@ async function submittedConfirm() {
28
28
  click(buttons[1]);
29
29
  await (confirm as never as {updateComplete: Promise<void>}).updateComplete;
30
30
 
31
- return {confirm, form, dialog, cancel: buttons[0] as HTMLElement & {disabled: boolean}};
31
+ return {confirm, form, dialog};
32
32
  }
33
33
 
34
34
  const closer = (dialog: Element) => dialog.shadowRoot!.querySelector('.dialog__close')!;
@@ -62,7 +62,7 @@ describe('<zn-confirm-modal>', () => {
62
62
  });
63
63
 
64
64
  it('reports failure when the response carries a danger alert', async () => {
65
- const {confirm, form, dialog, cancel} = await submittedConfirm();
65
+ const {confirm, form, dialog} = await submittedConfirm();
66
66
 
67
67
  settle(form, 'complete', {
68
68
  response: {status: 200, actions: [{action: 'alert', style: 'error', title: 'Deployment stopped'}]}
@@ -72,10 +72,21 @@ describe('<zn-confirm-modal>', () => {
72
72
  expect(confirm.shadowRoot!.textContent).to.contain('Failed');
73
73
  expect(confirm.shadowRoot!.textContent).to.contain('Deployment stopped');
74
74
  expect(confirm.shadowRoot!.textContent).to.not.contain('Loading');
75
- expect(cancel.disabled).to.be.false;
76
75
  expect(closer(dialog).disabled).to.be.false;
77
76
  });
78
77
 
78
+ it('offers only a close button once the request has failed', async () => {
79
+ const {confirm, form} = await submittedConfirm();
80
+
81
+ settle(form, 'error', {});
82
+ await (confirm as never as {updateComplete: Promise<void>}).updateComplete;
83
+
84
+ const buttons = confirm.shadowRoot!.querySelectorAll('zn-button[slot="footer"]');
85
+ expect(buttons.length).to.equal(1);
86
+ expect(buttons[0].textContent!.trim()).to.equal('Close');
87
+ expect(buttons[0].hasAttribute('dialog-closer')).to.be.true;
88
+ });
89
+
79
90
  it('reports failure when the request errors', async () => {
80
91
  const {confirm, form, dialog} = await submittedConfirm();
81
92
 
@@ -342,6 +342,7 @@ function renderInlineConditional(block: string): TemplateResult | null {
342
342
  * @csspart include-picker - The inline Include picker opened from the toolbar or "/include".
343
343
  *
344
344
  * @cssproperty --remarkd-editor-max-height - The tallest the editor grows before its body scrolls. Defaults to `100dvh`.
345
+ * @cssproperty --remarkd-editor-min-height - The shortest the body renders while empty. Defaults to `10rem`.
345
346
  */
346
347
  export default class ZnRemarkdEditor extends ZincElement implements ZincFormControl {
347
348
  static styles: CSSResultGroup = unsafeCSS(styles);
@@ -54,7 +54,7 @@
54
54
 
55
55
  .remarkd-editor__body {
56
56
  padding: var(--zn-spacing-large) var(--zn-spacing-large) var(--zn-spacing-large) 52px;
57
- min-height: 10rem;
57
+ min-height: var(--remarkd-editor-min-height, 10rem);
58
58
  overflow-y: auto;
59
59
  }
60
60
 
@@ -70,7 +70,7 @@
70
70
 
71
71
  .remarkd-editor__raw {
72
72
  flex: 1;
73
- min-height: 10rem;
73
+ min-height: var(--remarkd-editor-min-height, 10rem);
74
74
  resize: vertical;
75
75
  border: 0;
76
76
  background: transparent;