@mcp-b/web-components 0.2.22 → 0.3.0
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/README.md +93 -30
- package/dist/{alert-dialog-D25Oi_TS.js → alert-dialog-CGUwj_0U.js} +1 -1
- package/dist/{button-gg3JJxQZ.js → button-BbabhtKj.js} +121 -77
- package/dist/{button-BQofnUt4.d.ts → button-c5YKsC69.d.ts} +6 -3
- package/dist/{checkbox-DoFcDEKB.d.ts → checkbox-BtoypUxD.d.ts} +0 -6
- package/dist/{checkbox-C96lUDIM.js → checkbox-C97tlcf2.js} +11 -43
- package/dist/{color-input-Gae_-9w-.js → color-input-Dtp1v7A-.js} +14 -54
- package/dist/{color-input-Bky89xg_.d.ts → color-input-S29ZHwHE.d.ts} +0 -5
- package/dist/{color-picker-BYyZavkT.js → color-picker-Mnpc5u6E.js} +8 -4
- package/dist/{combobox-iERnTD3A.js → combobox-D4ji7M2B.js} +12 -33
- package/dist/{combobox-item-D2H1CMxC.d.ts → combobox-item-BnBtZyhw.d.ts} +3 -6
- package/dist/{comparison-B1-nMwmp.d.ts → comparison-CRvbwS7X.d.ts} +1 -0
- package/dist/{comparison-HJ1Zedhs.js → comparison-DQUpvkmg.js} +11 -3
- package/dist/components/alert-dialog/alert-dialog.js +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/carousel/carousel.js +1 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-input/color-input.d.ts +1 -1
- package/dist/components/color-input/color-input.js +1 -1
- package/dist/components/color-picker/color-picker.js +1 -1
- package/dist/components/combobox/combobox.d.ts +1 -1
- package/dist/components/combobox/combobox.js +1 -1
- package/dist/components/combobox-item/combobox-item.d.ts +1 -1
- package/dist/components/comparison/comparison.d.ts +1 -1
- package/dist/components/comparison/comparison.js +1 -1
- package/dist/components/copy/copy.js +4 -20
- package/dist/components/date/date.d.ts +1 -1
- package/dist/components/date/date.js +1 -1
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/dropdown/dropdown.js +1 -1
- package/dist/components/expander/expander.js +1 -1
- package/dist/components/file-input/file-input.d.ts +1 -1
- package/dist/components/file-input/file-input.js +1 -1
- package/dist/components/filter-bar/filter-bar.js +1 -1
- package/dist/components/index.d.ts +24 -24
- package/dist/components/index.js +44 -44
- package/dist/components/infinite-scroller/infinite-scroller.js +1 -1
- package/dist/components/listbox/listbox.d.ts +1 -1
- package/dist/components/listbox/listbox.js +1 -1
- package/dist/components/navicon/navicon.js +1 -1
- package/dist/components/number/number.js +1 -1
- package/dist/components/number-field/number-field.d.ts +1 -1
- package/dist/components/number-field/number-field.js +1 -1
- package/dist/components/pagination/pagination.js +1 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/preview-card/preview-card.js +1 -1
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +1 -1
- package/dist/components/radio-item/radio-item.js +1 -1
- package/dist/components/rating/rating.d.ts +1 -1
- package/dist/components/rating/rating.js +1 -1
- package/dist/components/scroller/scroller.js +1 -1
- package/dist/components/search-list/search-list.d.ts +1 -1
- package/dist/components/search-list/search-list.js +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.js +1 -1
- package/dist/components/share/share.js +1 -1
- package/dist/components/slide-activator/slide-activator.d.ts +1 -1
- package/dist/components/slide-activator/slide-activator.js +1 -1
- package/dist/components/slider/slider.d.ts +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.d.ts +1 -1
- package/dist/components/splitter/splitter.js +1 -1
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/tab-list/tab-list.js +1 -1
- package/dist/components/text-area/text-area.d.ts +1 -1
- package/dist/components/text-area/text-area.js +1 -1
- package/dist/components/text-field/text-field.d.ts +1 -1
- package/dist/components/text-field/text-field.js +1 -1
- package/dist/components/toast/toast.d.ts +1 -1
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/toast-item/toast-item.js +1 -1
- package/dist/components/toggle-icon/toggle-icon.d.ts +1 -1
- package/dist/components/toggle-icon/toggle-icon.js +1 -1
- package/dist/components/toggle-tag/toggle-tag.d.ts +1 -1
- package/dist/components/toggle-tag/toggle-tag.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/components/transition-group/transition-group.d.ts +1 -1
- package/dist/components/transition-group/transition-group.js +1 -1
- package/dist/components/zoomable-frame/zoomable-frame.js +1 -1
- package/dist/{date-6M6wfa8L.d.ts → date-DtaTBM71.d.ts} +1 -1
- package/dist/docs/custom-elements.json +126 -171
- package/dist/{dropdown-DM4tlF_p.js → dropdown-BPOpCp59.js} +58 -34
- package/dist/{dropdown-Bo00Vlr5.d.ts → dropdown-C5ldJu4g.d.ts} +5 -1
- package/dist/{localize-322EtXNX.d.ts → en-ss05iPjS.d.ts} +4 -1
- package/dist/{file-input-vZFm22Lo.js → file-input-B4VfcfTD.js} +17 -33
- package/dist/{file-input-D2D6YC0B.d.ts → file-input-CgsTcC1R.d.ts} +0 -5
- package/dist/{filter-bar-DJuDlx5f.js → filter-bar-DhQSMr3S.js} +1 -1
- package/dist/index.d.ts +25 -27
- package/dist/index.js +45 -48
- package/dist/{infinite-scroller-BmmtnWNt.js → infinite-scroller-DjeMswwE.js} +2 -2
- package/dist/{listbox-B0geidHW.js → listbox-BGHw-rUd.js} +13 -28
- package/dist/{listbox-DD4ujIJe.d.ts → listbox-DKoMIQA6.d.ts} +3 -5
- package/dist/{number-field-odk4lKXM.d.ts → number-field-T0rzObq9.d.ts} +0 -5
- package/dist/{number-field-BGH7JtNf.js → number-field-yME3rRZT.js} +44 -55
- package/dist/{popover-DJBrJ0za.js → popover-lsI6gqNk.js} +9 -32
- package/dist/{preview-card-C7H1FPfd.js → preview-card-D1msvOWP.js} +1 -1
- package/dist/{radio-8UZAUYXt.js → radio-4Cok4gJI.js} +11 -28
- package/dist/{radio-CieMa4zU.d.ts → radio-B4fz924Q.d.ts} +1 -4
- package/dist/{radio-item-BlhFgXsU.js → radio-item-DpP3GBPV.js} +2 -3
- package/dist/{rating-4xNsWumY.d.ts → rating-8BLXhAVl.d.ts} +1 -3
- package/dist/{rating-C1BcJDIO.js → rating-CSn-nU2R.js} +24 -34
- package/dist/{search-list-Clmrg8EV.js → search-list-BffPIgnw.js} +19 -10
- package/dist/{search-list-n0GYO7rh.d.ts → search-list-Cd3--X7Q.d.ts} +11 -1
- package/dist/{select-CkZK2jJn.d.ts → select-6H_sN4A2.d.ts} +0 -5
- package/dist/{select-DLIaRnA4.js → select-B6nkY6E-.js} +7 -43
- package/dist/{share-bsgXZCl7.js → share-C7dB9NYf.js} +3 -19
- package/dist/{slide-activator-D7bBz69E.d.ts → slide-activator-CB0Ztk_u.d.ts} +1 -0
- package/dist/{slide-activator-Dm1EvZtL.js → slide-activator-Dkv5_KPl.js} +10 -3
- package/dist/{slider-B90Il7x3.js → slider-DY-GuC8T.js} +35 -46
- package/dist/{slider-B0FVsV1o.d.ts → slider-uQQ-T_kn.d.ts} +2 -3
- package/dist/{splitter-MnD4In9H.js → splitter-DzC0hXGN.js} +14 -3
- package/dist/{splitter-DBDJAzsp.d.ts → splitter-KQVgGdvP.d.ts} +1 -0
- package/dist/{switch-Cief9M59.d.ts → switch-BUfFo074.d.ts} +0 -6
- package/dist/{switch-D0hWr37A.js → switch-Chij-EaQ.js} +11 -43
- package/dist/{tab-list-B_Ye_Oj9.js → tab-list-CVOUSpAh.js} +2 -2
- package/dist/{text-area-B_mjCE9W.d.ts → text-area-DFMKyk8y.d.ts} +0 -3
- package/dist/{text-area-Czixaz-_.js → text-area-DZVghSkO.js} +14 -51
- package/dist/{text-field-BClWMp6q.d.ts → text-field-DepP1gei.d.ts} +0 -5
- package/dist/{text-field-Cznb4Afc.js → text-field-gX5RovkE.js} +11 -52
- package/dist/{toast-cEBVK9NQ.d.ts → toast-CpyA3GYM.d.ts} +1 -1
- package/dist/{toast-DgkBQzQC.js → toast-CxfaWFY_.js} +2 -2
- package/dist/{toggle-icon-4oLDeEt4.js → toggle-icon-B3fZuslO.js} +9 -31
- package/dist/{toggle-icon-DlwMMWZL.d.ts → toggle-icon-sTLCOruF.d.ts} +0 -5
- package/dist/{toggle-tag-1sfTFJtg.js → toggle-tag--Gkp-CJJ.js} +7 -35
- package/dist/{toggle-tag-IVvMGT4R.d.ts → toggle-tag-DDBa6hAg.d.ts} +0 -5
- package/dist/{tooltip-DbyoPFNe.js → tooltip-bSXNhG9l.js} +9 -32
- package/dist/{transition-group-3hnAnwSd.js → transition-group-8PmQx0A5.js} +23 -4
- package/dist/{transition-group-DD_CjSNC.d.ts → transition-group-D134iT1k.d.ts} +8 -0
- package/dist/translations/en.d.ts +1 -5
- package/dist/translations/en.js +3 -6
- package/dist/translations/es.d.ts +1 -1
- package/dist/translations/es.js +2 -5
- package/dist/types/custom-element-jsx.d.ts +26 -10
- package/dist/utilities/anchored-surface.d.ts +36 -0
- package/dist/utilities/anchored-surface.js +46 -0
- package/dist/utilities/copy-feedback.d.ts +16 -0
- package/dist/utilities/copy-feedback.js +33 -0
- package/dist/utilities/form-validity.d.ts +28 -0
- package/dist/utilities/form-validity.js +33 -0
- package/dist/utilities/localize.d.ts +1 -1
- package/dist/utilities/localize.js +1 -0
- package/package.json +3 -2
- package/dist/{carousel-XopKISBQ.js → carousel-DpIqPTuO.js} +1 -1
- package/dist/{date-CJPmOdi9.js → date-CFIR88pX.js} +1 -1
- package/dist/{dialog-Cx46HMaZ.js → dialog-Ddvyn2d_.js} +1 -1
- package/dist/{expander-Bwvxj6Oa.js → expander-CMV4QCha.js} +1 -1
- package/dist/{navicon-_yMHY27-.js → navicon-B-5pY9gq.js} +1 -1
- package/dist/{number-BNtNXNF3.js → number-BYBxfOGw.js} +1 -1
- package/dist/{pagination-CrTQnuNW.js → pagination-VOzVTV8p.js} +1 -1
- package/dist/{scroller-LYgBVyfY.js → scroller-DZATZlDa.js} +1 -1
- package/dist/{spinner-C04Dmc0H.js → spinner-C9lQARtQ.js} +1 -1
- package/dist/{toast-item-CGvz92Qk.js → toast-item-DzSPG25R.js} +1 -1
- package/dist/{zoomable-frame-DxcjLGcF.js → zoomable-frame-BrjVkNMX.js} +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import "./icon-Df0H7LYB.js";
|
|
3
2
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
+
import { Localize } from "./utilities/localize.js";
|
|
4
|
+
import { mirrorNativeValidity } from "./utilities/form-validity.js";
|
|
4
5
|
import { css, html } from "lit";
|
|
5
6
|
import { property, query, state } from "lit/decorators.js";
|
|
6
7
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -348,14 +349,6 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
348
349
|
get focusableAnchor() {
|
|
349
350
|
return this.textBox;
|
|
350
351
|
}
|
|
351
|
-
connectedCallback() {
|
|
352
|
-
super.connectedCallback();
|
|
353
|
-
this.addEventListener("invalid", this.handleHostInvalid);
|
|
354
|
-
}
|
|
355
|
-
disconnectedCallback() {
|
|
356
|
-
super.disconnectedCallback();
|
|
357
|
-
this.removeEventListener("invalid", this.handleHostInvalid);
|
|
358
|
-
}
|
|
359
352
|
firstUpdated() {
|
|
360
353
|
new MutationObserver(() => this.syncDatalist()).observe(this, {
|
|
361
354
|
subtree: true,
|
|
@@ -370,24 +363,11 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
370
363
|
this.customStates.set("blank", this.value === "");
|
|
371
364
|
this.internals.setFormValue(this.value);
|
|
372
365
|
}
|
|
373
|
-
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.
|
|
374
|
-
if (this.hadUserInteraction || this.wasSubmitted) {
|
|
375
|
-
this.customStates.set("user-invalid", this.isInvalid);
|
|
376
|
-
this.customStates.set("user-valid", !this.isInvalid);
|
|
377
|
-
} else {
|
|
378
|
-
this.customStates.set("user-invalid", false);
|
|
379
|
-
this.customStates.set("user-valid", false);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
/** @internal Called when a containing fieldset is disabled. */
|
|
383
|
-
formDisabledCallback(isDisabled) {
|
|
384
|
-
this.disabled = isDisabled;
|
|
366
|
+
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.effectiveDisabled);
|
|
385
367
|
}
|
|
386
368
|
/** @internal Called when the form is reset. */
|
|
387
369
|
formResetCallback() {
|
|
388
|
-
|
|
389
|
-
this.hadUserInteraction = false;
|
|
390
|
-
this.wasSubmitted = false;
|
|
370
|
+
super.formResetCallback();
|
|
391
371
|
this.value = this.getAttribute("value") ?? "";
|
|
392
372
|
}
|
|
393
373
|
handleBlur() {
|
|
@@ -417,21 +397,13 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
417
397
|
this.customStates.set("focused", true);
|
|
418
398
|
this.dispatchEvent(new SigveloFocusEvent());
|
|
419
399
|
}
|
|
420
|
-
handleHostInvalid() {
|
|
421
|
-
this.wasSubmitted = true;
|
|
422
|
-
}
|
|
423
400
|
async handleInput() {
|
|
424
401
|
this.value = this.textBox.value;
|
|
425
402
|
await this.updateComplete;
|
|
426
403
|
this.dispatchEvent(new SigveloInputEvent());
|
|
427
404
|
}
|
|
428
405
|
handleKeyDown(event) {
|
|
429
|
-
if (event.key === "Enter"
|
|
430
|
-
const submitter = [...this.internals.form.elements].find((el) => {
|
|
431
|
-
return ["button", "input"].includes(el.localName) && el.type === "submit";
|
|
432
|
-
});
|
|
433
|
-
this.internals.form.requestSubmit(submitter);
|
|
434
|
-
}
|
|
406
|
+
if (event.key === "Enter") this.submitAssociatedForm();
|
|
435
407
|
}
|
|
436
408
|
handlePasswordToggleClick() {
|
|
437
409
|
this.isPasswordVisible = !this.isPasswordVisible;
|
|
@@ -452,21 +424,8 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
452
424
|
/** Sets the form control's validity */
|
|
453
425
|
async updateValidity() {
|
|
454
426
|
await this.updateComplete;
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
const flags = {
|
|
458
|
-
badInput: this.textBox.validity.badInput,
|
|
459
|
-
customError: hasCustomValidity,
|
|
460
|
-
patternMismatch: this.textBox.validity.patternMismatch,
|
|
461
|
-
rangeOverflow: this.textBox.validity.rangeOverflow,
|
|
462
|
-
rangeUnderflow: this.textBox.validity.rangeUnderflow,
|
|
463
|
-
stepMismatch: this.textBox.validity.stepMismatch,
|
|
464
|
-
tooLong: this.textBox.validity.tooLong,
|
|
465
|
-
tooShort: this.textBox.validity.tooShort,
|
|
466
|
-
typeMismatch: this.textBox.validity.typeMismatch,
|
|
467
|
-
valueMissing: this.textBox.validity.valueMissing
|
|
468
|
-
};
|
|
469
|
-
this.isInvalid = hasCustomValidity ? true : !this.textBox.validity.valid;
|
|
427
|
+
const { flags, validationMessage, isInvalid } = mirrorNativeValidity(this.textBox, this.getCustomValidity());
|
|
428
|
+
this.isInvalid = isInvalid;
|
|
470
429
|
this.internals.setValidity(flags, validationMessage, this.focusableAnchor);
|
|
471
430
|
}
|
|
472
431
|
/** Looks for a slotted datalist, clones, and links it to the text field. */
|
|
@@ -545,7 +504,7 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
545
504
|
lg: this.size === "lg",
|
|
546
505
|
xl: this.size === "xl",
|
|
547
506
|
pill: this.pill,
|
|
548
|
-
disabled: this.
|
|
507
|
+
disabled: this.effectiveDisabled
|
|
549
508
|
})}
|
|
550
509
|
@pointerdown=${this.handleVisualBoxPointerDown}
|
|
551
510
|
>
|
|
@@ -556,7 +515,7 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
556
515
|
part="text-box"
|
|
557
516
|
type=${this.type === "password" && this.isPasswordVisible ? "text" : this.type}
|
|
558
517
|
?autofocus=${this.autofocus}
|
|
559
|
-
?disabled=${this.
|
|
518
|
+
?disabled=${this.effectiveDisabled}
|
|
560
519
|
?readonly=${this.readonly}
|
|
561
520
|
?required=${this.required}
|
|
562
521
|
placeholder=${ifDefined(this.placeholder)}
|
|
@@ -582,7 +541,7 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
582
541
|
@keydown=${this.handleKeyDown}
|
|
583
542
|
/>
|
|
584
543
|
|
|
585
|
-
${this.type === "password" && this.value?.length > 0 && !this.
|
|
544
|
+
${this.type === "password" && this.value?.length > 0 && !this.effectiveDisabled && !this.readonly ? html`
|
|
586
545
|
<button
|
|
587
546
|
id="password-toggle-button"
|
|
588
547
|
part="toggle-password-button"
|
|
@@ -599,7 +558,7 @@ var SigveloTextField = class extends SigveloFormControlElement {
|
|
|
599
558
|
></sigvelo-icon>
|
|
600
559
|
</button>
|
|
601
560
|
` : ""}
|
|
602
|
-
${this.withClear && this.value?.length > 0 && !this.
|
|
561
|
+
${this.withClear && this.value?.length > 0 && !this.effectiveDisabled && !this.readonly ? html`
|
|
603
562
|
<button
|
|
604
563
|
id="clear-button"
|
|
605
564
|
part="clear-button"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as SigveloToastItem } from "./toast-item-BPpJT6vD.js";
|
|
2
|
-
import { t as SigveloTransitionGroup } from "./transition-group-
|
|
2
|
+
import { t as SigveloTransitionGroup } from "./transition-group-D134iT1k.js";
|
|
3
3
|
import { CSSResultGroup, PropertyValues } from "lit";
|
|
4
4
|
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
5
5
|
import { TransitionAnimation } from "@mcp-b/wc-support/utilities/animate";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
-
import "./toast-item-
|
|
3
|
-
import "./transition-group-
|
|
2
|
+
import "./toast-item-DzSPG25R.js";
|
|
3
|
+
import "./transition-group-8PmQx0A5.js";
|
|
4
4
|
import { css, html, render } from "lit";
|
|
5
5
|
import { property, query, state } from "lit/decorators.js";
|
|
6
6
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -627,36 +627,15 @@ var SigveloToggleIcon = class extends SigveloFormControlElement {
|
|
|
627
627
|
get focusableAnchor() {
|
|
628
628
|
return this.button;
|
|
629
629
|
}
|
|
630
|
-
connectedCallback() {
|
|
631
|
-
super.connectedCallback();
|
|
632
|
-
this.addEventListener("invalid", this.handleHostInvalid);
|
|
633
|
-
}
|
|
634
|
-
disconnectedCallback() {
|
|
635
|
-
super.disconnectedCallback();
|
|
636
|
-
this.removeEventListener("invalid", this.handleHostInvalid);
|
|
637
|
-
}
|
|
638
630
|
updated(changedProperties) {
|
|
639
631
|
this.updateValidity();
|
|
640
632
|
if (changedProperties.has("checked") || changedProperties.has("value")) this.internals.setFormValue(this.checked ? this.value : null);
|
|
641
633
|
if (changedProperties.has("checked")) this.customStates.set("checked", this.checked);
|
|
642
|
-
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.
|
|
643
|
-
if (this.hadUserInteraction || this.wasSubmitted) {
|
|
644
|
-
this.customStates.set("user-invalid", this.isInvalid);
|
|
645
|
-
this.customStates.set("user-valid", !this.isInvalid);
|
|
646
|
-
} else {
|
|
647
|
-
this.customStates.set("user-invalid", false);
|
|
648
|
-
this.customStates.set("user-valid", false);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
/** @internal Called when a containing fieldset is disabled. */
|
|
652
|
-
formDisabledCallback(isDisabled) {
|
|
653
|
-
this.disabled = isDisabled;
|
|
634
|
+
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.effectiveDisabled);
|
|
654
635
|
}
|
|
655
636
|
/** @internal Called when the form is reset. */
|
|
656
637
|
formResetCallback() {
|
|
657
|
-
|
|
658
|
-
this.hadUserInteraction = false;
|
|
659
|
-
this.wasSubmitted = false;
|
|
638
|
+
super.formResetCallback();
|
|
660
639
|
this.checked = this.hasAttribute("checked");
|
|
661
640
|
}
|
|
662
641
|
handleBlur() {
|
|
@@ -664,8 +643,9 @@ var SigveloToggleIcon = class extends SigveloFormControlElement {
|
|
|
664
643
|
this.dispatchEvent(new SigveloBlurEvent());
|
|
665
644
|
}
|
|
666
645
|
handleClick() {
|
|
667
|
-
if (this.
|
|
646
|
+
if (this.effectiveDisabled) return;
|
|
668
647
|
this.checked = !this.checked;
|
|
648
|
+
this.hadUserInteraction = true;
|
|
669
649
|
this.dispatchEvent(new SigveloChangeEvent());
|
|
670
650
|
this.dispatchEvent(new Event("change", {
|
|
671
651
|
bubbles: true,
|
|
@@ -678,19 +658,17 @@ var SigveloToggleIcon = class extends SigveloFormControlElement {
|
|
|
678
658
|
this.customStates.set("focused", true);
|
|
679
659
|
this.dispatchEvent(new SigveloFocusEvent());
|
|
680
660
|
}
|
|
681
|
-
handleHostInvalid() {
|
|
682
|
-
this.wasSubmitted = true;
|
|
683
|
-
}
|
|
684
661
|
/** Sets the form control's validity */
|
|
685
662
|
async updateValidity() {
|
|
686
663
|
await this.updateComplete;
|
|
687
664
|
const hasCustomValidity = this.getCustomValidity().length > 0;
|
|
665
|
+
const hasMissingValue = this.required && !this.checked;
|
|
688
666
|
const validationMessage = hasCustomValidity ? this.getCustomValidity() : VALIDATION_MESSAGE;
|
|
689
667
|
const flags = {
|
|
690
668
|
customError: hasCustomValidity,
|
|
691
|
-
valueMissing:
|
|
669
|
+
valueMissing: hasMissingValue
|
|
692
670
|
};
|
|
693
|
-
this.isInvalid = hasCustomValidity ? true :
|
|
671
|
+
this.isInvalid = hasCustomValidity ? true : hasMissingValue;
|
|
694
672
|
this.internals.setValidity(flags, validationMessage, this.focusableAnchor);
|
|
695
673
|
}
|
|
696
674
|
render() {
|
|
@@ -704,7 +682,7 @@ var SigveloToggleIcon = class extends SigveloFormControlElement {
|
|
|
704
682
|
lg: this.size === "lg",
|
|
705
683
|
xl: this.size === "xl",
|
|
706
684
|
checked: this.checked,
|
|
707
|
-
disabled: this.
|
|
685
|
+
disabled: this.effectiveDisabled
|
|
708
686
|
})}
|
|
709
687
|
data-effect=${this.effect}
|
|
710
688
|
name=${this.name}
|
|
@@ -712,7 +690,7 @@ var SigveloToggleIcon = class extends SigveloFormControlElement {
|
|
|
712
690
|
type="button"
|
|
713
691
|
aria-label=${this.label}
|
|
714
692
|
aria-pressed=${this.checked ? "true" : "false"}
|
|
715
|
-
.disabled=${this.
|
|
693
|
+
.disabled=${this.effectiveDisabled}
|
|
716
694
|
.required=${this.required}
|
|
717
695
|
@click=${this.handleClick}
|
|
718
696
|
@focus=${this.handleFocus}
|
|
@@ -335,17 +335,12 @@ declare class SigveloToggleIcon extends SigveloFormControlElement {
|
|
|
335
335
|
* Makes the toggle icon required. Form submission will not be allowed until the toggle icon is checked.
|
|
336
336
|
*/
|
|
337
337
|
required: boolean;
|
|
338
|
-
connectedCallback(): void;
|
|
339
|
-
disconnectedCallback(): void;
|
|
340
338
|
updated(changedProperties: PropertyValues<this>): void;
|
|
341
|
-
/** @internal Called when a containing fieldset is disabled. */
|
|
342
|
-
formDisabledCallback(isDisabled: boolean): void;
|
|
343
339
|
/** @internal Called when the form is reset. */
|
|
344
340
|
formResetCallback(): void;
|
|
345
341
|
private handleBlur;
|
|
346
342
|
private handleClick;
|
|
347
343
|
private handleFocus;
|
|
348
|
-
private handleHostInvalid;
|
|
349
344
|
/** Sets the form control's validity */
|
|
350
345
|
private updateValidity;
|
|
351
346
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { mirrorNativeValidity } from "./utilities/form-validity.js";
|
|
2
3
|
import { css, html } from "lit";
|
|
3
4
|
import { property, query, state } from "lit/decorators.js";
|
|
4
5
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -300,36 +301,15 @@ var SigveloToggleTag = class extends SigveloFormControlElement {
|
|
|
300
301
|
get focusableAnchor() {
|
|
301
302
|
return this.checkbox;
|
|
302
303
|
}
|
|
303
|
-
connectedCallback() {
|
|
304
|
-
super.connectedCallback();
|
|
305
|
-
this.addEventListener("invalid", this.handleHostInvalid);
|
|
306
|
-
}
|
|
307
|
-
disconnectedCallback() {
|
|
308
|
-
super.disconnectedCallback();
|
|
309
|
-
this.removeEventListener("invalid", this.handleHostInvalid);
|
|
310
|
-
}
|
|
311
304
|
updated(changedProperties) {
|
|
312
305
|
this.updateValidity();
|
|
313
306
|
if (changedProperties.has("checked") || changedProperties.has("value")) this.internals.setFormValue(this.checked ? this.value : null);
|
|
314
307
|
if (changedProperties.has("checked")) this.customStates.set("checked", this.checked);
|
|
315
|
-
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.
|
|
316
|
-
if (this.hadUserInteraction || this.wasSubmitted) {
|
|
317
|
-
this.customStates.set("user-invalid", this.isInvalid);
|
|
318
|
-
this.customStates.set("user-valid", !this.isInvalid);
|
|
319
|
-
} else {
|
|
320
|
-
this.customStates.set("user-invalid", false);
|
|
321
|
-
this.customStates.set("user-valid", false);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
/** @internal Called when a containing fieldset is disabled. */
|
|
325
|
-
formDisabledCallback(isDisabled) {
|
|
326
|
-
this.disabled = isDisabled;
|
|
308
|
+
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.effectiveDisabled);
|
|
327
309
|
}
|
|
328
310
|
/** @internal Called when the form is reset. */
|
|
329
311
|
formResetCallback() {
|
|
330
|
-
|
|
331
|
-
this.hadUserInteraction = false;
|
|
332
|
-
this.wasSubmitted = false;
|
|
312
|
+
super.formResetCallback();
|
|
333
313
|
this.checked = this.hasAttribute("checked");
|
|
334
314
|
}
|
|
335
315
|
handleClick() {
|
|
@@ -354,19 +334,11 @@ var SigveloToggleTag = class extends SigveloFormControlElement {
|
|
|
354
334
|
this.customStates.set("focused", true);
|
|
355
335
|
this.dispatchEvent(new SigveloFocusEvent());
|
|
356
336
|
}
|
|
357
|
-
handleHostInvalid() {
|
|
358
|
-
this.wasSubmitted = true;
|
|
359
|
-
}
|
|
360
337
|
/** Sets the form control's validity */
|
|
361
338
|
async updateValidity() {
|
|
362
339
|
await this.updateComplete;
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
const flags = {
|
|
366
|
-
customError: hasCustomValidity,
|
|
367
|
-
valueMissing: this.checkbox.validity.valueMissing
|
|
368
|
-
};
|
|
369
|
-
this.isInvalid = hasCustomValidity ? true : !this.checkbox.validity.valid;
|
|
340
|
+
const { flags, validationMessage, isInvalid } = mirrorNativeValidity(this.checkbox, this.getCustomValidity());
|
|
341
|
+
this.isInvalid = isInvalid;
|
|
370
342
|
this.internals.setValidity(flags, validationMessage, this.focusableAnchor);
|
|
371
343
|
}
|
|
372
344
|
/** Sets focus to the toggle tag. */
|
|
@@ -389,7 +361,7 @@ var SigveloToggleTag = class extends SigveloFormControlElement {
|
|
|
389
361
|
lg: this.size === "lg",
|
|
390
362
|
xl: this.size === "xl",
|
|
391
363
|
checked: this.checked,
|
|
392
|
-
disabled: this.
|
|
364
|
+
disabled: this.effectiveDisabled,
|
|
393
365
|
required: this.required
|
|
394
366
|
})}
|
|
395
367
|
>
|
|
@@ -398,7 +370,7 @@ var SigveloToggleTag = class extends SigveloFormControlElement {
|
|
|
398
370
|
type="checkbox"
|
|
399
371
|
value=${ifDefined(this.value)}
|
|
400
372
|
.checked=${live(this.checked)}
|
|
401
|
-
.disabled=${this.
|
|
373
|
+
.disabled=${this.effectiveDisabled}
|
|
402
374
|
.required=${this.required}
|
|
403
375
|
@change=${this.handleChange}
|
|
404
376
|
@click=${this.handleClick}
|
|
@@ -215,11 +215,7 @@ declare class SigveloToggleTag extends SigveloFormControlElement {
|
|
|
215
215
|
* Makes the toggle tag required. Form submission will not be allowed until the toggle tag is checked.
|
|
216
216
|
*/
|
|
217
217
|
required: boolean;
|
|
218
|
-
connectedCallback(): void;
|
|
219
|
-
disconnectedCallback(): void;
|
|
220
218
|
updated(changedProperties: PropertyValues<this>): void;
|
|
221
|
-
/** @internal Called when a containing fieldset is disabled. */
|
|
222
|
-
formDisabledCallback(isDisabled: boolean): void;
|
|
223
219
|
/** @internal Called when the form is reset. */
|
|
224
220
|
formResetCallback(): void;
|
|
225
221
|
private handleClick;
|
|
@@ -227,7 +223,6 @@ declare class SigveloToggleTag extends SigveloFormControlElement {
|
|
|
227
223
|
private handleChange;
|
|
228
224
|
private handleInput;
|
|
229
225
|
private handleFocus;
|
|
230
|
-
private handleHostInvalid;
|
|
231
226
|
/** Sets the form control's validity */
|
|
232
227
|
private updateValidity;
|
|
233
228
|
/** Sets focus to the toggle tag. */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { positionAnchoredSurface } from "./utilities/anchored-surface.js";
|
|
2
3
|
import { css, html } from "lit";
|
|
3
4
|
import { property, query } from "lit/decorators.js";
|
|
4
5
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
5
6
|
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
6
7
|
import { animateWithClass } from "@mcp-b/wc-support/utilities/animate";
|
|
7
8
|
import { SigveloBeforeCloseEvent, SigveloBeforeOpenEvent, SigveloCloseEvent, SigveloOpenEvent } from "@mcp-b/wc-support/events/open-close";
|
|
8
|
-
import {
|
|
9
|
+
import { autoUpdate } from "@floating-ui/dom";
|
|
9
10
|
import { createId } from "@mcp-b/wc-support/utilities/math";
|
|
10
11
|
//#region src/components/tooltip/tooltip.styles.ts
|
|
11
12
|
var tooltip_styles_default = css`
|
|
@@ -417,38 +418,14 @@ var SigveloTooltip = class extends SigveloElement {
|
|
|
417
418
|
/** @internal Repositions the tooltip */
|
|
418
419
|
reposition() {
|
|
419
420
|
if (!this.anchor) return;
|
|
420
|
-
|
|
421
|
+
positionAnchoredSurface({
|
|
422
|
+
anchor: this.anchor,
|
|
423
|
+
host: this,
|
|
424
|
+
surface: this.tooltip,
|
|
425
|
+
arrow: this.arrow,
|
|
421
426
|
placement: this.placement,
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
mainAxis: this.distance,
|
|
425
|
-
crossAxis: this.offset
|
|
426
|
-
}),
|
|
427
|
-
flip(),
|
|
428
|
-
shift(),
|
|
429
|
-
arrow({ element: this.arrow })
|
|
430
|
-
]
|
|
431
|
-
}).then(({ x, y, middlewareData, placement }) => {
|
|
432
|
-
this.setAttribute("data-placement", placement);
|
|
433
|
-
Object.assign(this.tooltip.style, {
|
|
434
|
-
left: `${x}px`,
|
|
435
|
-
top: `${y}px`
|
|
436
|
-
});
|
|
437
|
-
if (middlewareData.arrow) {
|
|
438
|
-
const arrowX = middlewareData.arrow.x;
|
|
439
|
-
const arrowY = middlewareData.arrow.y;
|
|
440
|
-
const staticSide = {
|
|
441
|
-
top: "bottom",
|
|
442
|
-
right: "left",
|
|
443
|
-
bottom: "top",
|
|
444
|
-
left: "right"
|
|
445
|
-
}[placement.split("-")[0]];
|
|
446
|
-
Object.assign(this.arrow.style, {
|
|
447
|
-
left: typeof arrowX === "number" ? `${arrowX}px` : "",
|
|
448
|
-
top: typeof arrowY === "number" ? `${arrowY}px` : "",
|
|
449
|
-
[staticSide]: "calc(var(--arrow-diagonal-size) * -1)"
|
|
450
|
-
});
|
|
451
|
-
}
|
|
427
|
+
distance: this.distance,
|
|
428
|
+
offset: this.offset
|
|
452
429
|
});
|
|
453
430
|
requestAnimationFrame(() => {
|
|
454
431
|
if (!this.anchor) return;
|
|
@@ -17,6 +17,15 @@ var transition_group_styles_default = css`
|
|
|
17
17
|
width: 100%;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/*
|
|
21
|
+
* Entering elements are hidden by attribute while sibling removals animate. The browser's own rule for that
|
|
22
|
+
* attribute is HTML-namespace-scoped, so an SVG child would stay visible and pop in early; this reaches any
|
|
23
|
+
* slotted element.
|
|
24
|
+
*/
|
|
25
|
+
slot::slotted([hidden]) {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
20
29
|
/* Don't allow clicks while the transition is running to prevent animation blips */
|
|
21
30
|
:host(:state(transitioning)) {
|
|
22
31
|
pointer-events: none;
|
|
@@ -624,7 +633,7 @@ var SigveloTransitionGroup = class extends SigveloElement {
|
|
|
624
633
|
removedElements.delete(el);
|
|
625
634
|
}
|
|
626
635
|
});
|
|
627
|
-
addedElements.forEach((_opts, el) => el.hidden
|
|
636
|
+
addedElements.forEach((_opts, el) => el.toggleAttribute("hidden", true));
|
|
628
637
|
removedElements.forEach((opts, el) => {
|
|
629
638
|
if (opts.nextSibling) opts.nextSibling.before(el);
|
|
630
639
|
else this.transitionContainer.append(el);
|
|
@@ -638,7 +647,7 @@ var SigveloTransitionGroup = class extends SigveloElement {
|
|
|
638
647
|
});
|
|
639
648
|
await Promise.allSettled(removeAnimations);
|
|
640
649
|
addedElements.forEach((_opts, el) => {
|
|
641
|
-
el.hidden
|
|
650
|
+
el.toggleAttribute("hidden", false);
|
|
642
651
|
el.style.opacity = "0";
|
|
643
652
|
});
|
|
644
653
|
const newContainerPosition = this.getBoundingClientRect();
|
|
@@ -652,7 +661,7 @@ var SigveloTransitionGroup = class extends SigveloElement {
|
|
|
652
661
|
duration,
|
|
653
662
|
easing: "ease"
|
|
654
663
|
}).finished);
|
|
655
|
-
|
|
664
|
+
this.animatableChildren.forEach((el) => {
|
|
656
665
|
const oldPosition = this.cachedElementPositions.get(el);
|
|
657
666
|
const newPosition = el.getBoundingClientRect();
|
|
658
667
|
if (!oldPosition || !hasDomRectMoved(oldPosition, newPosition) || addedElements.has(el) || removedElements.has(el)) return;
|
|
@@ -739,6 +748,16 @@ var SigveloTransitionGroup = class extends SigveloElement {
|
|
|
739
748
|
}
|
|
740
749
|
};
|
|
741
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* The children this group animates.
|
|
753
|
+
*
|
|
754
|
+
* `children` is a collection of plain `Element`s, and everything the group does to one — hiding it, clearing an
|
|
755
|
+
* inline opacity, animating a laid-out box — is `HTMLElement` vocabulary. Anything else in the container is left
|
|
756
|
+
* where it is rather than quietly mistyped.
|
|
757
|
+
*/
|
|
758
|
+
get animatableChildren() {
|
|
759
|
+
return [...this.transitionContainer.children].filter((el) => el instanceof HTMLElement);
|
|
760
|
+
}
|
|
742
761
|
startObservers() {
|
|
743
762
|
if (this.isObserving) return;
|
|
744
763
|
this.isObserving = true;
|
|
@@ -777,7 +796,7 @@ var SigveloTransitionGroup = class extends SigveloElement {
|
|
|
777
796
|
x: window.scrollX,
|
|
778
797
|
y: window.scrollY
|
|
779
798
|
};
|
|
780
|
-
|
|
799
|
+
this.animatableChildren.forEach((el) => {
|
|
781
800
|
this.cachedElementPositions.set(el, el.getBoundingClientRect());
|
|
782
801
|
});
|
|
783
802
|
}
|
|
@@ -580,6 +580,14 @@ declare class SigveloTransitionGroup extends SigveloElement {
|
|
|
580
580
|
* Gets a custom animation based on the users preference. If a custom animation isn't found, the default is returned.
|
|
581
581
|
*/
|
|
582
582
|
private getAnimation;
|
|
583
|
+
/**
|
|
584
|
+
* The children this group animates.
|
|
585
|
+
*
|
|
586
|
+
* `children` is a collection of plain `Element`s, and everything the group does to one — hiding it, clearing an
|
|
587
|
+
* inline opacity, animating a laid-out box — is `HTMLElement` vocabulary. Anything else in the container is left
|
|
588
|
+
* where it is rather than quietly mistyped.
|
|
589
|
+
*/
|
|
590
|
+
private get animatableChildren();
|
|
583
591
|
private handleMutations;
|
|
584
592
|
private handleResizes;
|
|
585
593
|
private handleVisibilityChange;
|
package/dist/translations/en.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerDefaultTranslation } from "
|
|
1
|
+
import { registerDefaultTranslation } from "@mcp-b/wc-support/utilities/localize";
|
|
2
2
|
//#region src/translations/en.ts
|
|
3
3
|
const translation = {
|
|
4
4
|
$code: "en",
|
|
@@ -56,12 +56,9 @@ const translation = {
|
|
|
56
56
|
share: "Share",
|
|
57
57
|
showPassword: "Show password",
|
|
58
58
|
show: "Show",
|
|
59
|
-
showingNumberOfTotalItems: (number, total) => {
|
|
60
|
-
if (number === 1) return `Showing ${number} of ${total} ${total === 1 ? "item" : "items"}`;
|
|
61
|
-
return `Showing ${number} of ${total} items`;
|
|
62
|
-
},
|
|
59
|
+
showingNumberOfTotalItems: (number, total) => `Showing ${number} of ${total} ${total === 1 ? "item" : "items"}`,
|
|
63
60
|
showingAllNumberItems: (number) => {
|
|
64
|
-
if (number === 1) return `Showing ${number} item`;
|
|
61
|
+
if (Number(number) === 1) return `Showing ${number} item`;
|
|
65
62
|
return `Showing all ${number} items`;
|
|
66
63
|
},
|
|
67
64
|
toggleNavigation: "Toggle navigation",
|
package/dist/translations/es.js
CHANGED
|
@@ -56,12 +56,9 @@ const translation = {
|
|
|
56
56
|
share: "Compartir",
|
|
57
57
|
showPassword: "Mostrar contraseña",
|
|
58
58
|
show: "Mostrar",
|
|
59
|
-
showingNumberOfTotalItems: (number, total) => {
|
|
60
|
-
if (number === 1) return `Mostrando ${number} de ${total} ${total === 1 ? "elemento" : "elementos"}`;
|
|
61
|
-
return `Mostrando ${number} de ${total} elementos`;
|
|
62
|
-
},
|
|
59
|
+
showingNumberOfTotalItems: (number, total) => `Mostrando ${number} de ${total} ${total === 1 ? "elemento" : "elementos"}`,
|
|
63
60
|
showingAllNumberItems: (number) => {
|
|
64
|
-
if (number === 1) return `Mostrando ${number} elemento`;
|
|
61
|
+
if (Number(number) === 1) return `Mostrando ${number} elemento`;
|
|
65
62
|
return `Mostrando todos los ${number} elementos`;
|
|
66
63
|
},
|
|
67
64
|
toggleNavigation: "Alternar navegación",
|