@getflip/swirl-components 0.87.0 → 0.87.2

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/components.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-08-22T13:59:57",
2
+ "timestamp": "2023-08-23T13:55:31",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "3.3.1",
@@ -7,7 +7,7 @@ const floatingUi_dom_esm = require('./floating-ui.dom.esm-39236b6a.js');
7
7
  const index$1 = require('./index-2ddd0598.js');
8
8
  const utils = require('./utils-c00c09b9.js');
9
9
 
10
- const swirlAutocompleteCss = ".sc-swirl-autocomplete-h{display:block}.sc-swirl-autocomplete-h *.sc-swirl-autocomplete{box-sizing:border-box}.autocomplete--inactive.sc-swirl-autocomplete .autocomplete__listbox-container.sc-swirl-autocomplete{display:none}.autocomplete__listbox-container.sc-swirl-autocomplete{position:fixed;z-index:var(--s-z-40);overflow:hidden;padding-top:var(--s-space-8);padding-bottom:var(--s-space-8);border-radius:var(--s-border-radius-sm);background-color:var(--s-surface-overlay-default);animation:autocomplete-enter 0.1s;box-shadow:var(--s-shadow-level-1)}.autocomplete__listbox-container.sc-swirl-autocomplete:empty{display:none}.autocomplete__spinner.sc-swirl-autocomplete{display:flex;padding:var(--s-space-16);justify-content:center;align-items:center}.autocomplete__multi-select-tags.sc-swirl-autocomplete{margin-bottom:var(--s-space-4);margin-top:var(--swirl-autocomplete-tags-margin-top)}@keyframes autocomplete-enter{from{opacity:0}to{opacity:1}}";
10
+ const swirlAutocompleteCss = ".sc-swirl-autocomplete-h{display:block}.sc-swirl-autocomplete-h *.sc-swirl-autocomplete{box-sizing:border-box}.autocomplete--inactive.sc-swirl-autocomplete .autocomplete__listbox-container.sc-swirl-autocomplete{display:none}.autocomplete__listbox-container.sc-swirl-autocomplete{position:fixed;z-index:var(--s-z-40);overflow-x:hidden;overflow-y:auto;max-height:18rem;padding-top:var(--s-space-8);padding-bottom:var(--s-space-8);border-radius:var(--s-border-radius-sm);background-color:var(--s-surface-overlay-default);animation:autocomplete-enter 0.1s;box-shadow:var(--s-shadow-level-1)}.autocomplete__listbox-container.sc-swirl-autocomplete:empty{display:none}.autocomplete__spinner.sc-swirl-autocomplete{display:flex;padding:var(--s-space-16);justify-content:center;align-items:center}.autocomplete__multi-select-tags.sc-swirl-autocomplete{margin-top:var(--swirl-autocomplete-tags-margin-top);margin-bottom:var(--s-space-4)}@keyframes autocomplete-enter{from{opacity:0}to{opacity:1}}";
11
11
 
12
12
  const SwirlAutocomplete = class {
13
13
  constructor(hostRef) {
@@ -39,11 +39,15 @@ const SwirlButton = class {
39
39
  }
40
40
  componentDidLoad() {
41
41
  this.forceIconProps(this.desktopMediaQuery.matches);
42
+ this.updateFormAttribute();
42
43
  this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
43
44
  }
44
45
  componentDidRender() {
45
46
  this.forceIconProps(this.desktopMediaQuery.matches);
46
47
  }
48
+ watchFormProp() {
49
+ this.updateFormAttribute();
50
+ }
47
51
  disconnectedCallback() {
48
52
  this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
49
53
  }
@@ -63,6 +67,17 @@ const SwirlButton = class {
63
67
  }
64
68
  return undefined;
65
69
  }
70
+ updateFormAttribute() {
71
+ // Workaround: form attribute cannot be set via Stencil JSX
72
+ // https://github.com/ionic-team/stencil/issues/2703
73
+ const isLink = Boolean(this.href);
74
+ if (isLink || !Boolean(this.form)) {
75
+ this.buttonEl?.removeAttribute("form");
76
+ }
77
+ else {
78
+ this.buttonEl?.setAttribute("form", this.form);
79
+ }
80
+ }
66
81
  render() {
67
82
  const hideLabel = (this.hideLabel && Boolean(this.icon)) ||
68
83
  (this.variant === "floating" && this.intent === "default");
@@ -73,8 +88,12 @@ const SwirlButton = class {
73
88
  "button--pill": this.pill,
74
89
  });
75
90
  const Tag = isLink ? "a" : "button";
76
- return (index.h(index.Host, { style: { pointerEvents: this.disabled ? "none" : "" } }, index.h(Tag, { "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled && !isLink ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-haspopup": this.swirlAriaHaspopup, "aria-label": ariaLabel, class: className, disabled: isLink ? undefined : this.disabled, download: isLink ? undefined : this.download, form: isLink ? undefined : this.form, href: this.href, name: isLink ? undefined : this.name, target: isLink ? this.target : undefined, type: isLink ? undefined : this.type, value: isLink ? undefined : this.value }, this.icon && (index.h("span", { class: "button__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), !hideLabel && index.h("span", { class: "button__label" }, this.label))));
91
+ return (index.h(index.Host, { style: { pointerEvents: this.disabled ? "none" : "" } }, index.h(Tag, { "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled && !isLink ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-haspopup": this.swirlAriaHaspopup, "aria-label": ariaLabel, class: className, disabled: isLink ? undefined : this.disabled, download: isLink ? undefined : this.download, form: isLink ? undefined : this.form, href: this.href, name: isLink ? undefined : this.name, ref: (el) => (this.buttonEl = el), target: isLink ? this.target : undefined, type: isLink ? undefined : this.type, value: isLink ? undefined : this.value }, this.icon && (index.h("span", { class: "button__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), !hideLabel && index.h("span", { class: "button__label" }, this.label))));
77
92
  }
93
+ get el() { return index.getElement(this); }
94
+ static get watchers() { return {
95
+ "form": ["watchFormProp"]
96
+ }; }
78
97
  };
79
98
  SwirlButton.style = swirlButtonCss;
80
99