@swiftwc/ui 0.0.0-dev.39 → 0.0.0-dev.40

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.
@@ -166,7 +166,7 @@ export class PickerView extends FormAssociatedBase {
166
166
  const currentValueLabel = this.querySelector(':scope>label-view:not([slot])') ?? this.appendChild($(`<label-view></label-view>`, '>1'));
167
167
  // reset state
168
168
  currentValueLabel.setAttribute('system-image', 'dots-three'); // overwritten
169
- currentValueLabel.setAttribute('title', this.#selection); // overwritten
169
+ currentValueLabel.setAttribute('title', this.#currentValueLabel); // overwritten
170
170
  // clear all siblings
171
171
  for (const el of this.querySelectorAll(':scope>:not([slot])'))
172
172
  if (currentValueLabel !== el)
@@ -202,7 +202,7 @@ export class PickerView extends FormAssociatedBase {
202
202
  el.remove();
203
203
  const currentValueLabel = menu.querySelector(':scope>label-view[slot=label]') ?? menu.appendChild($(`<label-view slot="label"></label-view>`, '>1'));
204
204
  currentValueLabel.setAttribute('system-image', 'dots-three'); // overwritten
205
- currentValueLabel.setAttribute('title', this.#selection); // overwritten
205
+ currentValueLabel.setAttribute('title', this.#currentValueLabel); // overwritten
206
206
  _a.#reflectButtons([...(this.#slots?.get('list')?.assignedElements() ?? [])], menu);
207
207
  break;
208
208
  }
@@ -587,24 +587,30 @@ export class PickerView extends FormAssociatedBase {
587
587
  for (const el of this.#spawn.querySelectorAll('list-view button[value]:not([slot])'))
588
588
  el.querySelector('label-view[system-image="check"]')?.style.setProperty('visibility', el.getAttribute('value') === this.#selection ? 'visible' : 'hidden');
589
589
  }
590
- #reflectCurrentValueLabel() {
591
- const selectedTag = this.#slots
590
+ get #currentTag() {
591
+ return this.#slots
592
592
  ?.get('list')
593
593
  ?.assignedElements({ flatten: true })
594
594
  .flatMap((el) => [...(el.matches('option') ? [el] : []), ...el.querySelectorAll('option')])
595
- .find((el) => this.#selection === extractTagFromOption(el)), cvl = selectedTag ? extractCurrentValueFromOption(selectedTag) : '', final = (this.getAttribute('current-value-label') ?? '').replaceAll('{{selection}}', this.#selection).replaceAll('{{currentValueLabel}}', this.#selection) || cvl || this.#selection;
595
+ .find((el) => this.#selection === extractTagFromOption(el));
596
+ }
597
+ get #currentValueLabel() {
598
+ const cvl = this.#currentTag ? extractCurrentValueFromOption(this.#currentTag) : '';
599
+ return (this.getAttribute('current-value-label') ?? '').replaceAll('{{selection}}', this.#selection).replaceAll('{{currentValueLabel}}', this.#selection) || cvl || this.#selection;
600
+ }
601
+ #reflectCurrentValueLabel() {
596
602
  switch (this.pickerStyle) {
597
603
  case 'sheet':
598
604
  case 'navigation-link': {
599
605
  const currentValueLabel = this.querySelector(':scope>label-view:not([slot])');
600
606
  currentValueLabel?.setAttribute('system-image', 'dots-three');
601
- currentValueLabel?.setAttribute('title', final);
607
+ currentValueLabel?.setAttribute('title', this.#currentValueLabel);
602
608
  break;
603
609
  }
604
610
  case 'menu': {
605
611
  const currentValueLabel = this.querySelector(':scope>menu-view:not([slot])>label-view[slot=label]');
606
612
  currentValueLabel?.setAttribute('system-image', 'dots-three');
607
- currentValueLabel?.setAttribute('title', final);
613
+ currentValueLabel?.setAttribute('title', this.#currentValueLabel);
608
614
  break;
609
615
  }
610
616
  case 'inline':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.39",
3
+ "version": "0.0.0-dev.40",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"