@proximus/lavender-autocomplete 2.0.0-alpha.102 → 2.0.0-alpha.103

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,6 +2,7 @@ import '@proximus/lavender-dropdown';
2
2
  import '@proximus/lavender-input';
3
3
  import { type Dropdown } from '@proximus/lavender-dropdown';
4
4
  import { type Input } from '@proximus/lavender-input';
5
+ import { WithExtraAttributes } from '@proximus/lavender-common';
5
6
  /**
6
7
  * @summary An autocomplete input component with dropdown suggestions.
7
8
  * @attr {number} size - Visible width of the input in characters.
@@ -17,7 +18,7 @@ import { type Input } from '@proximus/lavender-input';
17
18
  * @slot status-text - Slot for the validation/status message (use `role="alert"` for errors, `role="status"` for success).
18
19
  * @slot dropdown-content - Slot for dropdown content items such as `px-autocomplete-header` and `px-autocomplete-option`.
19
20
  */
20
- export declare class Autocomplete extends HTMLElement {
21
+ export declare class Autocomplete extends WithExtraAttributes {
21
22
  #private;
22
23
  static formAssociated: boolean;
23
24
  private internals;
package/dist/index.es.js CHANGED
@@ -3,7 +3,7 @@ var re = (s) => {
3
3
  };
4
4
  var B = (s, e, t) => e.has(s) || re("Cannot " + t);
5
5
  var a = (s, e, t) => (B(s, e, "read from private field"), t ? t.call(s) : e.get(s)), l = (s, e, t) => e.has(s) ? re("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), g = (s, e, t, i) => (B(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), u = (s, e, t) => (B(s, e, "access private method"), t);
6
- import { WithExtraAttributes as E, log as p, PxElement as ne, iconSizeValuesKC as Se, cssTokenBreakpoints as f, paddingValues as v, gapValues as ce, boxShadowValues as Le, backgroundSizeValues as Ee, noBorderRadiusValues as De, borderRadiusValues as Te, borderSideValues as Re, borderValues as Me, gradientValues as oe, backgroundColorValues as I, borderColorValues as se, checkName as T, AttributeBreakpointHandlerDelegate as je, fontweightValues as He, fontsizeValues as Be, colorValues as Pe, isFalsy as P } from "@proximus/lavender-common";
6
+ import { WithExtraAttributes as S, log as p, PxElement as ne, iconSizeValuesKC as Se, cssTokenBreakpoints as f, paddingValues as v, gapValues as ce, boxShadowValues as Le, backgroundSizeValues as Ee, noBorderRadiusValues as De, borderRadiusValues as Te, borderSideValues as Re, borderValues as Me, gradientValues as oe, backgroundColorValues as I, borderColorValues as se, checkName as T, AttributeBreakpointHandlerDelegate as je, fontweightValues as He, fontsizeValues as Be, colorValues as Pe, isFalsy as P } from "@proximus/lavender-common";
7
7
  const Ie = ":host .dropdown-content{background-color:var(--px-color-background-surface-default);border-radius:var(--px-radius-main);box-shadow:0 4px 6px -1px #25252514;overflow:hidden}:host([inverted]) .dropdown-content{background-color:var(--px-color-background-surface-dark)}", Fe = ':host{position:relative}::slotted([slot="popover"]){position:absolute;border-radius:var(--px-radius-main, 8px);background:var(--px-color-background-container-light-default, #fff);box-shadow:0 20px 25px -5px #25252514;margin:0;padding:var(--px-padding-xs-mobile) 0;border:0;right:0;width:auto}:host([grow]) ::slotted([slot="trigger"]):after{right:0;padding-right:var(--px-padding-xs-mobile)}:host([anchoralignment="top-left"]) ::slotted([slot="popover"]){top:auto}:host([anchoralignment="top-right"]) ::slotted([slot="popover"]){top:auto}:host([anchoralignment="bottom-right"]) ::slotted([slot="popover"]){left:auto}@media screen and (max-width: 47.938rem){::slotted([slot="trigger"]){display:block;width:100%}:host([anchoralignment="top-left"]) ::slotted([slot="popover"]){left:var(--px-padding-s-mobile)}:host([anchoralignment="top-right"]) ::slotted([slot="popover"]){left:var(--px-padding-s-mobile)}}@media screen and (min-width: 48rem){::slotted([slot="popover"]){padding-block:var(--px-padding-s-desktop);right:auto;width:auto}}', qe = [
8
8
  "top-left",
9
9
  "top-right",
@@ -25,7 +25,7 @@ const le = new CSSStyleSheet();
25
25
  le.replaceSync(Fe);
26
26
  const D = "bottom-left";
27
27
  var C, pe, k, w, de;
28
- class Oe extends E {
28
+ class Oe extends S {
29
29
  constructor() {
30
30
  super(le);
31
31
  l(this, C);
@@ -384,18 +384,18 @@ const _ = class _ extends H {
384
384
  _.nativeName = "textarea";
385
385
  let q = _;
386
386
  customElements.get("px-textarea") || customElements.define("px-textarea", q);
387
- var L, N;
387
+ var E, N;
388
388
  const U = class U extends H {
389
389
  constructor() {
390
390
  super();
391
- l(this, L);
391
+ l(this, E);
392
392
  }
393
393
  template() {
394
394
  return "<select></select>";
395
395
  }
396
396
  connectedCallback() {
397
- super.connectedCallback(), u(this, L, N).call(this), this.observer = new MutationObserver(() => {
398
- u(this, L, N).call(this);
397
+ super.connectedCallback(), u(this, E, N).call(this), this.observer = new MutationObserver(() => {
398
+ u(this, E, N).call(this);
399
399
  }), this.observer.observe(this, {
400
400
  childList: !0,
401
401
  subtree: !0
@@ -405,7 +405,7 @@ const U = class U extends H {
405
405
  this.observer.disconnect();
406
406
  }
407
407
  };
408
- L = new WeakSet(), N = function() {
408
+ E = new WeakSet(), N = function() {
409
409
  const t = Array.from(this.children).filter((i) => {
410
410
  const r = i.tagName.toLowerCase();
411
411
  return r === "option" || r === "optgroup";
@@ -449,11 +449,11 @@ let Z = J;
449
449
  customElements.get("px-fileupload") || customElements.define("px-fileupload", Z);
450
450
  const he = new CSSStyleSheet();
451
451
  he.replaceSync(Ie);
452
- var A, $, b, be, z, S;
453
- const Q = class Q extends HTMLElement {
452
+ var A, $, b, be, z, L;
453
+ const Q = class Q extends S {
454
454
  constructor() {
455
455
  var t;
456
- super();
456
+ super(he);
457
457
  l(this, b);
458
458
  l(this, A);
459
459
  l(this, $);
@@ -481,11 +481,13 @@ const Q = class Q extends HTMLElement {
481
481
  let n;
482
482
  i.key === "ArrowDown" ? n = o < r.length - 1 ? o + 1 : 0 : n = o > 0 ? o - 1 : r.length - 1, r[n].focus();
483
483
  }), g(this, z, () => {
484
- this.$input.value ? (this.$input.$el.setAttribute("aria-expanded", "true"), this.$dropDown.showPopover()) : (this.$input.$el.setAttribute("aria-expanded", "false"), this.$dropDown.hidePopover(), this.$input.focus()), u(this, b, S).call(this);
485
- }), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [he], this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this);
484
+ var i;
485
+ this.$input.value ? (this.$input.$el.setAttribute("aria-expanded", "true"), this.$dropDownContent.style.width = `${(i = this.$input.shadowRoot.querySelector("input")) == null ? void 0 : i.offsetWidth}px`, this.$dropDown.showPopover()) : (this.$input.$el.setAttribute("aria-expanded", "false"), this.$dropDown.hidePopover(), this.$input.focus()), u(this, b, L).call(this);
486
+ }), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this);
486
487
  }
487
488
  static get observedAttributes() {
488
489
  return [
490
+ ...super.observedAttributes,
489
491
  "size",
490
492
  "state",
491
493
  "extended",
@@ -496,7 +498,20 @@ const Q = class Q extends HTMLElement {
496
498
  ];
497
499
  }
498
500
  attributeChangedCallback(t, i, r) {
499
- r !== null ? this.$input.setAttribute(t, r) : this.$input.removeAttribute(t);
501
+ switch (t) {
502
+ case "size":
503
+ case "state":
504
+ case "extended":
505
+ case "extended--mobile":
506
+ case "extended--tablet":
507
+ case "extended--laptop":
508
+ case "extended--desktop":
509
+ r !== null ? this.$input.setAttribute(t, r) : this.$input.removeAttribute(t);
510
+ break;
511
+ default:
512
+ super.attributeChangedCallback(t, i, r);
513
+ break;
514
+ }
500
515
  }
501
516
  connectedCallback() {
502
517
  var i, r;
@@ -511,16 +526,16 @@ const Q = class Q extends HTMLElement {
511
526
  return this.$input.value;
512
527
  }
513
528
  set value(t) {
514
- this.$input.value = t, this.$input.$el.setAttribute("aria-expanded", "false"), this.$dropDown.hidePopover(), this.$input.$el.focus(), u(this, b, S).call(this);
529
+ this.$input.value = t, this.$input.$el.setAttribute("aria-expanded", "false"), this.$dropDown.hidePopover(), this.$input.$el.focus(), u(this, b, L).call(this);
515
530
  }
516
531
  get name() {
517
532
  return this.getAttribute("name");
518
533
  }
519
534
  formResetCallback() {
520
- this.$input.value = "", u(this, b, S).call(this);
535
+ this.$input.value = "", u(this, b, L).call(this);
521
536
  }
522
537
  formStateRestoreCallback(t) {
523
- this.$input.value = t, u(this, b, S).call(this);
538
+ this.$input.value = t, u(this, b, L).call(this);
524
539
  }
525
540
  get $dropDown() {
526
541
  return this.shadowRoot.querySelector("px-dropdown");
@@ -541,7 +556,7 @@ A = new WeakMap(), $ = new WeakMap(), b = new WeakSet(), be = function() {
541
556
  "px-autocomplete-option:not([disabled])"
542
557
  )
543
558
  );
544
- }, z = new WeakMap(), S = function() {
559
+ }, z = new WeakMap(), L = function() {
545
560
  var t;
546
561
  if (this.name) {
547
562
  const i = new FormData();
@@ -602,7 +617,7 @@ const Ge = [
602
617
  ), We = ":host{display:inline-flex;flex-direction:column;justify-content:center}svg{font-size:var(--px-size-icon-s);line-height:var(--px-font-line-height-xs);width:1em;height:1em;color:var(--px-color-icon-accent-default)}.inherit{color:inherit}.brand{color:var(--px-color-icon-brand-default)}.accent{color:var(--px-color-icon-accent-default)}.neutral{color:var(--px-color-icon-neutral-default)}.dimmed{color:var(--px-color-icon-dimmed-default)}.purpose-success{color:var(--px-color-icon-purpose-success-default)}.purpose-warning{color:var(--px-color-icon-purpose-warning-default)}.purpose-error{color:var(--px-color-icon-purpose-error-default)}.purpose-unlimited{color:var(--px-color-icon-purpose-unlimited-default)}.purpose-promo{color:var(--px-color-icon-purpose-promo-default)}.state-hover:hover{color:var(--px-color-icon-state-hover-default)}.state-active:active{color:var(--px-color-icon-state-active-default)}.state-disabled{color:var(--px-color-icon-state-disabled-default)}:host([inverted]) svg{color:var(--px-color-icon-accent-inverted)}:host([inverted]) .inherit{color:inherit}:host([inverted]) .brand{color:var(--px-color-icon-brand-inverted)}:host([inverted]) .accent{color:var(--px-color-icon-accent-inverted)}:host([inverted]) .neutral{color:var(--px-color-icon-neutral-inverted)}:host([inverted]) .dimmed{color:var(--px-color-icon-dimmed-inverted)}:host([inverted]) .purpose-success{color:var(--px-color-icon-purpose-success-inverted)}:host([inverted]) .purpose-warning{color:var(--px-color-icon-purpose-warning-inverted)}:host([inverted]) .purpose-error{color:var(--px-color-icon-purpose-error-inverted)}:host([inverted]) .purpose-unlimited{color:var(--px-color-icon-purpose-unlimited-inverted)}:host([inverted]) .purpose-promo{color:var(--px-color-icon-purpose-promo-inverted)}:host([inverted]) .state-hover:hover{color:var(--px-color-icon-state-hover-inverted)}:host([inverted]) .state-active:active{color:var(--px-color-icon-state-active-inverted)}:host([inverted]) .state-disabled{color:var(--px-color-icon-state-disabled-inverted)}.size-xs{font-size:var(--px-size-icon-xs)}.size-s{font-size:var(--px-size-icon-s)}.size-m{font-size:var(--px-size-icon-m)}.size-l{font-size:var(--px-size-icon-l)}.size-xl{font-size:var(--px-size-icon-xl)}", ge = new CSSStyleSheet();
603
618
  ge.replaceSync(We);
604
619
  var y, h, R;
605
- class Ye extends E {
620
+ class Ye extends S {
606
621
  constructor(...t) {
607
622
  var i;
608
623
  super(...t, ge);
@@ -797,7 +812,7 @@ const _e = [
797
812
  void 0,
798
813
  "subgrid-gap"
799
814
  )
800
- ], V = class V extends E {
815
+ ], V = class V extends S {
801
816
  constructor() {
802
817
  super(fe, ...Je), this.template = () => `<div class="container">
803
818
  <slot></slot>
@@ -1504,7 +1519,7 @@ const Ve = [
1504
1519
  "space-around",
1505
1520
  "space-evenly"
1506
1521
  ], it = ["", "default", "nowrap", "wrap", "wrap-reverse"], rt = ["", "visible", "hidden", "scroll", "auto"];
1507
- class Y extends E {
1522
+ class Y extends S {
1508
1523
  constructor() {
1509
1524
  super(xe), this.overflowXAttributeDelegate = new je(
1510
1525
  this,
@@ -1899,7 +1914,7 @@ class at extends HTMLElement {
1899
1914
  customElements.get("px-spacer") || customElements.define("px-spacer", at);
1900
1915
  const nt = ":host{display:block;box-sizing:border-box}slot[name=body-container]{min-height:100vh}#image-sticky-box{margin-top:-2.5rem}", ve = new CSSStyleSheet();
1901
1916
  ve.replaceSync(nt);
1902
- class ct extends E {
1917
+ class ct extends S {
1903
1918
  constructor() {
1904
1919
  super(ve), this.template = (e) => `
1905
1920
  <px-container border-radius="none" padding="none">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-autocomplete",
3
- "version": "2.0.0-alpha.102",
3
+ "version": "2.0.0-alpha.103",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",