@redvars/peacock 3.5.0 → 3.5.1
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/dist/BaseButton-DuASuVth.js +219 -0
- package/dist/BaseButton-DuASuVth.js.map +1 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +12 -27
- package/dist/banner.js.map +1 -1
- package/dist/{button-DMN1dPAg.js → button-DouvOfEU.js} +77 -251
- package/dist/button-DouvOfEU.js.map +1 -0
- package/dist/{button-group-CX9CUUXk.js → button-group-CEdMwvJJ.js} +71 -42
- package/dist/button-group-CEdMwvJJ.js.map +1 -0
- package/dist/button-group.js +5 -5
- package/dist/button.js +3 -3
- package/dist/card.js +18 -73
- package/dist/card.js.map +1 -1
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -2
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -2
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/code-highlighter.js +2 -1
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +3105 -1494
- package/dist/custom-elements.json +9244 -7829
- package/dist/fab.js +421 -9
- package/dist/fab.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/{select-4pl4XBj7.js → navigation-rail-Lxetd5-Z.js} +2214 -1090
- package/dist/navigation-rail-Lxetd5-Z.js.map +1 -0
- package/dist/notification.js +3 -2
- package/dist/notification.js.map +1 -1
- package/dist/peacock-loader.js +22 -10
- package/dist/peacock-loader.js.map +1 -1
- package/dist/search.js +4 -0
- package/dist/search.js.map +1 -1
- package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
- package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
- package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
- package/dist/src/banner/banner.d.ts +0 -4
- package/dist/src/button/BaseButton.d.ts +4 -47
- package/dist/src/button/button/button.d.ts +32 -3
- package/dist/src/button/button-group/button-group.d.ts +2 -2
- package/dist/src/button/icon-button/icon-button.d.ts +33 -8
- package/dist/src/card/card.d.ts +4 -15
- package/dist/src/fab/fab.d.ts +4 -35
- package/dist/src/focus-ring/focus-ring.d.ts +11 -5
- package/dist/src/index.d.ts +3 -1
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/navigation-rail/index.d.ts +2 -0
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
- package/dist/src/sidebar-menu/index.d.ts +3 -0
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
- package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
- package/dist/src/toolbar/toolbar.d.ts +10 -10
- package/dist/src/tooltip/tooltip.d.ts +3 -0
- package/dist/src/url-field/index.d.ts +1 -0
- package/dist/src/url-field/url-field.d.ts +48 -0
- package/dist/test/sidebar-menu.test.d.ts +1 -0
- package/dist/toolbar.js +10 -10
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/readme.md +73 -65
- package/scss/mixin.scss +16 -0
- package/src/__mixins/BaseButtonMixin.ts +83 -0
- package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
- package/src/__mixins/MixinConstructor.ts +1 -0
- package/src/{__base_element → __mixins}/README.md +2 -2
- package/src/banner/banner.scss +18 -22
- package/src/banner/banner.ts +1 -7
- package/src/button/BaseButton.ts +11 -100
- package/src/button/button/button-sizes.scss +4 -2
- package/src/button/button/button.ts +76 -23
- package/src/button/button-group/button-group.ts +2 -2
- package/src/button/icon-button/icon-button.ts +75 -33
- package/src/card/card.ts +11 -71
- package/src/chart-bar/chart-bar.ts +9 -14
- package/src/chart-bar/chart-stacked-bar.ts +12 -18
- package/src/chart-doughnut/chart-doughnut.ts +23 -27
- package/src/chart-pie/chart-pie.ts +19 -23
- package/src/checkbox/checkbox.scss +17 -34
- package/src/checkbox/checkbox.ts +3 -1
- package/src/code-highlighter/code-highlighter.scss +1 -0
- package/src/code-highlighter/code-highlighter.ts +1 -1
- package/src/date-picker/date-picker.ts +1 -1
- package/src/elevation/elevation.scss +5 -5
- package/src/fab/fab.ts +29 -100
- package/src/focus-ring/focus-ring.ts +47 -40
- package/src/index.ts +3 -1
- package/src/input/input.ts +3 -1
- package/src/link/link.ts +2 -2
- package/src/menu/menu-item/menu-item.ts +3 -1
- package/src/navigation-rail/index.ts +2 -0
- package/src/navigation-rail/navigation-rail-item.scss +216 -0
- package/src/navigation-rail/navigation-rail-item.ts +223 -0
- package/src/navigation-rail/navigation-rail.scss +72 -0
- package/src/navigation-rail/navigation-rail.ts +149 -0
- package/src/notification/notification.ts +3 -2
- package/src/number-field/number-field.ts +6 -4
- package/src/pagination/pagination.ts +6 -4
- package/src/peacock-loader.ts +22 -5
- package/src/search/search.ts +4 -0
- package/src/sidebar-menu/demo/index.html +68 -0
- package/src/sidebar-menu/index.ts +3 -0
- package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
- package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
- package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
- package/src/sidebar-menu/sidebar-menu.ts +182 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
- package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
- package/src/skeleton/skeleton.scss +18 -24
- package/src/snackbar/snackbar.ts +1 -1
- package/src/tabs/tab.ts +4 -3
- package/src/text/text.css-component.scss +7 -1
- package/src/time-picker/time-picker.ts +1 -1
- package/src/toolbar/toolbar.ts +10 -10
- package/src/tooltip/tooltip.ts +24 -0
- package/src/url-field/index.ts +1 -0
- package/src/url-field/url-field.scss +50 -0
- package/src/url-field/url-field.ts +239 -0
- package/dist/button-DMN1dPAg.js.map +0 -1
- package/dist/button-group-CX9CUUXk.js.map +0 -1
- package/dist/fab-C5Nzxk0E.js +0 -497
- package/dist/fab-C5Nzxk0E.js.map +0 -1
- package/dist/select-4pl4XBj7.js.map +0 -1
- package/dist/spread-B5cgadZl.js +0 -32
- package/dist/spread-B5cgadZl.js.map +0 -1
- package/dist/src/__base_element/BaseHyperlink.d.ts +0 -20
- package/dist/src/tree-view/index.d.ts +0 -2
- package/dist/src/tree-view/tree-node.d.ts +0 -69
- package/dist/src/tree-view/tree-view.d.ts +0 -40
- package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
- package/dist/test/tree-view.test.d.ts +0 -1
- package/dist/throttle-C7ZAPqtu.js +0 -24
- package/dist/throttle-C7ZAPqtu.js.map +0 -1
- package/src/__base_element/BaseHyperlink.ts +0 -42
- package/src/tree-view/demo/index.html +0 -57
- package/src/tree-view/index.ts +0 -2
- package/src/tree-view/tree-node.scss +0 -101
- package/src/tree-view/tree-node.ts +0 -268
- package/src/tree-view/tree-view.ts +0 -182
- package/src/tree-view/wc-tree-view.ts +0 -9
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { a as i, _ as __decorate,
|
|
1
|
+
import { a as i, _ as __decorate, I as IndividualComponent, b } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
3
|
import { r } from './state-DwbEjqVk.js';
|
|
4
|
-
import { e
|
|
4
|
+
import { e } from './class-map-YU7g0o3B.js';
|
|
5
|
+
import { B as BaseButton, o, s as spread } from './BaseButton-DuASuVth.js';
|
|
5
6
|
import { o as observerSlotChangesWithCallback } from './observe-slot-change-BGJfgg2E.js';
|
|
6
|
-
import { t as throttle } from './
|
|
7
|
-
import { s as spread } from './spread-B5cgadZl.js';
|
|
8
|
-
import { e } from './query-QBcUV-L_.js';
|
|
9
|
-
import { i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
|
|
7
|
+
import { t as throttle } from './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
10
8
|
|
|
11
9
|
var css_248z$2 = i`* {
|
|
12
10
|
box-sizing: border-box;
|
|
@@ -626,11 +624,13 @@ var css_248z = i`:host([size=xs]),
|
|
|
626
624
|
letter-spacing: 0 !important;
|
|
627
625
|
}
|
|
628
626
|
|
|
629
|
-
:host([size=xl])
|
|
627
|
+
:host([size=xl]),
|
|
628
|
+
:host([size=extra-large]) {
|
|
630
629
|
--button-height: 8.5rem;
|
|
631
630
|
}
|
|
632
631
|
|
|
633
|
-
:host([size=xl]) .button
|
|
632
|
+
:host([size=xl]) .button,
|
|
633
|
+
:host([size=extra-large]) .button {
|
|
634
634
|
--_button-icon-size: 2.5rem;
|
|
635
635
|
--_button_container-padding: 4rem;
|
|
636
636
|
font-size: 2rem !important;
|
|
@@ -639,224 +639,6 @@ var css_248z = i`:host([size=xs]),
|
|
|
639
639
|
letter-spacing: 0 !important;
|
|
640
640
|
}`;
|
|
641
641
|
|
|
642
|
-
/**
|
|
643
|
-
* 3. Apply the type annotation to the variable.
|
|
644
|
-
*/
|
|
645
|
-
const BaseHyperlink = (superclass) => {
|
|
646
|
-
// Naming the class (BaseHyperlinkElement) instead of using 'Mixin' or anonymous
|
|
647
|
-
// prevents the "__childPart" visibility error.
|
|
648
|
-
class BaseHyperlinkElement extends superclass {
|
|
649
|
-
constructor() {
|
|
650
|
-
super(...arguments);
|
|
651
|
-
this.target = '_self';
|
|
652
|
-
}
|
|
653
|
-
__isLink() {
|
|
654
|
-
return !!this.href;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
__decorate([
|
|
658
|
-
n({ reflect: true })
|
|
659
|
-
], BaseHyperlinkElement.prototype, "href", void 0);
|
|
660
|
-
__decorate([
|
|
661
|
-
n()
|
|
662
|
-
], BaseHyperlinkElement.prototype, "target", void 0);
|
|
663
|
-
return BaseHyperlinkElement;
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
class BaseButton extends BaseHyperlink(i$1) {
|
|
667
|
-
constructor() {
|
|
668
|
-
super(...arguments);
|
|
669
|
-
this.htmlType = 'button';
|
|
670
|
-
/**
|
|
671
|
-
* The visual style of the button.
|
|
672
|
-
*
|
|
673
|
-
* Possible variant values:
|
|
674
|
-
* `"filled"` is a filled button.
|
|
675
|
-
* `"outlined"` is an outlined button.
|
|
676
|
-
* `"text"` is a transparent button.
|
|
677
|
-
* `"tonal"` is a light color button.
|
|
678
|
-
* `"elevated"` is elevated button
|
|
679
|
-
*/
|
|
680
|
-
this.variant = 'filled';
|
|
681
|
-
/**
|
|
682
|
-
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
683
|
-
*/
|
|
684
|
-
this.color = 'primary';
|
|
685
|
-
/**
|
|
686
|
-
* Button size.
|
|
687
|
-
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
688
|
-
*/
|
|
689
|
-
this.size = 'sm';
|
|
690
|
-
/**
|
|
691
|
-
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
692
|
-
*/
|
|
693
|
-
this.disabled = false;
|
|
694
|
-
this.skeleton = false;
|
|
695
|
-
/**
|
|
696
|
-
* If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.
|
|
697
|
-
*/
|
|
698
|
-
this.softDisabled = false;
|
|
699
|
-
/**
|
|
700
|
-
* If button is disabled, the reason why it is disabled.
|
|
701
|
-
*/
|
|
702
|
-
this.disabledReason = '';
|
|
703
|
-
this.toggle = false;
|
|
704
|
-
this.selected = false;
|
|
705
|
-
/**
|
|
706
|
-
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
707
|
-
*/
|
|
708
|
-
this.throttleDelay = 200;
|
|
709
|
-
/**
|
|
710
|
-
* States
|
|
711
|
-
*/
|
|
712
|
-
this.isPressed = false;
|
|
713
|
-
this.__handlePress = (event) => {
|
|
714
|
-
if (this.disabled || this.skeleton || this.softDisabled)
|
|
715
|
-
return;
|
|
716
|
-
if (event instanceof KeyboardEvent &&
|
|
717
|
-
event.type === 'keydown' &&
|
|
718
|
-
(event.key === 'Enter' || event.key === ' ')) {
|
|
719
|
-
this.isPressed = true;
|
|
720
|
-
}
|
|
721
|
-
else if (event.type === 'mousedown') {
|
|
722
|
-
this.isPressed = true;
|
|
723
|
-
}
|
|
724
|
-
else {
|
|
725
|
-
this.isPressed = false;
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
this.__dispatchClickWithThrottle = event => {
|
|
729
|
-
this.__dispatchClick(event);
|
|
730
|
-
};
|
|
731
|
-
this.__dispatchClick = (event) => {
|
|
732
|
-
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
733
|
-
// prevent the click from propagating to other event listeners as well as
|
|
734
|
-
// prevent the default action.
|
|
735
|
-
if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
|
|
736
|
-
event.stopImmediatePropagation();
|
|
737
|
-
event.preventDefault();
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
if (!isActivationClick(event) || !this.buttonElement) {
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
if (this.toggle) {
|
|
744
|
-
this.selected = !this.selected;
|
|
745
|
-
}
|
|
746
|
-
this.focus();
|
|
747
|
-
dispatchActivationClick(this.buttonElement);
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
focus() {
|
|
751
|
-
this.buttonElement?.focus();
|
|
752
|
-
}
|
|
753
|
-
blur() {
|
|
754
|
-
this.buttonElement?.blur();
|
|
755
|
-
}
|
|
756
|
-
connectedCallback() {
|
|
757
|
-
super.connectedCallback();
|
|
758
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
759
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
760
|
-
}
|
|
761
|
-
disconnectedCallback() {
|
|
762
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
763
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
764
|
-
super.disconnectedCallback();
|
|
765
|
-
}
|
|
766
|
-
__convertTypeToVariantAndColor() {
|
|
767
|
-
if (this.type === 'primary') {
|
|
768
|
-
this.color = 'primary';
|
|
769
|
-
this.variant = 'filled';
|
|
770
|
-
}
|
|
771
|
-
else if (this.type === 'secondary') {
|
|
772
|
-
this.color = 'surface';
|
|
773
|
-
this.variant = 'filled';
|
|
774
|
-
}
|
|
775
|
-
else if (this.type === 'tertiary') {
|
|
776
|
-
this.color = 'primary';
|
|
777
|
-
this.variant = 'text';
|
|
778
|
-
}
|
|
779
|
-
else if (this.type === 'danger') {
|
|
780
|
-
this.color = 'danger';
|
|
781
|
-
this.variant = 'filled';
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
get __disabledReasonID() {
|
|
785
|
-
return this.disabled && this.disabledReason
|
|
786
|
-
? BaseButton.DISABLED_REASON_ID
|
|
787
|
-
: undefined;
|
|
788
|
-
}
|
|
789
|
-
__renderDisabledReason() {
|
|
790
|
-
const disabledReasonID = this.__disabledReasonID;
|
|
791
|
-
if (disabledReasonID)
|
|
792
|
-
return b `<div
|
|
793
|
-
id=${disabledReasonID}
|
|
794
|
-
role="tooltip"
|
|
795
|
-
aria-label=${this.disabledReason}
|
|
796
|
-
class="screen-reader-only"
|
|
797
|
-
>
|
|
798
|
-
${this.disabledReason}
|
|
799
|
-
</div>`;
|
|
800
|
-
return A;
|
|
801
|
-
}
|
|
802
|
-
__renderTooltip() {
|
|
803
|
-
if (this.tooltip) {
|
|
804
|
-
return b `<wc-tooltip for="button">${this.tooltip}</wc-tooltip>`;
|
|
805
|
-
}
|
|
806
|
-
return A;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
BaseButton.DISABLED_REASON_ID = 'disabled-reason';
|
|
810
|
-
__decorate([
|
|
811
|
-
n({ type: String })
|
|
812
|
-
], BaseButton.prototype, "htmlType", void 0);
|
|
813
|
-
__decorate([
|
|
814
|
-
n({ type: String })
|
|
815
|
-
], BaseButton.prototype, "type", void 0);
|
|
816
|
-
__decorate([
|
|
817
|
-
n()
|
|
818
|
-
], BaseButton.prototype, "variant", void 0);
|
|
819
|
-
__decorate([
|
|
820
|
-
n({ reflect: true })
|
|
821
|
-
], BaseButton.prototype, "color", void 0);
|
|
822
|
-
__decorate([
|
|
823
|
-
n({ reflect: true })
|
|
824
|
-
], BaseButton.prototype, "size", void 0);
|
|
825
|
-
__decorate([
|
|
826
|
-
n({ type: Boolean, reflect: true })
|
|
827
|
-
], BaseButton.prototype, "disabled", void 0);
|
|
828
|
-
__decorate([
|
|
829
|
-
n({ type: Boolean, reflect: true })
|
|
830
|
-
], BaseButton.prototype, "skeleton", void 0);
|
|
831
|
-
__decorate([
|
|
832
|
-
n({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
|
|
833
|
-
], BaseButton.prototype, "softDisabled", void 0);
|
|
834
|
-
__decorate([
|
|
835
|
-
n({ attribute: 'disabled-reason' })
|
|
836
|
-
], BaseButton.prototype, "disabledReason", void 0);
|
|
837
|
-
__decorate([
|
|
838
|
-
n({ reflect: true })
|
|
839
|
-
], BaseButton.prototype, "configAria", void 0);
|
|
840
|
-
__decorate([
|
|
841
|
-
n({ type: Boolean, reflect: true })
|
|
842
|
-
], BaseButton.prototype, "toggle", void 0);
|
|
843
|
-
__decorate([
|
|
844
|
-
n({ type: Boolean, reflect: true })
|
|
845
|
-
], BaseButton.prototype, "selected", void 0);
|
|
846
|
-
__decorate([
|
|
847
|
-
n()
|
|
848
|
-
], BaseButton.prototype, "throttleDelay", void 0);
|
|
849
|
-
__decorate([
|
|
850
|
-
n()
|
|
851
|
-
], BaseButton.prototype, "tooltip", void 0);
|
|
852
|
-
__decorate([
|
|
853
|
-
r()
|
|
854
|
-
], BaseButton.prototype, "isPressed", void 0);
|
|
855
|
-
__decorate([
|
|
856
|
-
e('.button')
|
|
857
|
-
], BaseButton.prototype, "buttonElement", void 0);
|
|
858
|
-
|
|
859
|
-
var _Button_tabindex;
|
|
860
642
|
/**
|
|
861
643
|
* @label Button
|
|
862
644
|
* @tag wc-button
|
|
@@ -902,12 +684,31 @@ var _Button_tabindex;
|
|
|
902
684
|
let Button = class Button extends BaseButton {
|
|
903
685
|
constructor() {
|
|
904
686
|
super(...arguments);
|
|
905
|
-
_Button_tabindex.set(this, 0);
|
|
906
687
|
/**
|
|
907
688
|
* Icon alignment.
|
|
908
689
|
* Possible values are `"start"`, `"end"`. Defaults to `"end"`.
|
|
909
690
|
*/
|
|
910
691
|
this.iconAlign = 'end';
|
|
692
|
+
/**
|
|
693
|
+
* Button size.
|
|
694
|
+
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
|
695
|
+
*/
|
|
696
|
+
this.size = 'sm';
|
|
697
|
+
/**
|
|
698
|
+
* The visual style of the button.
|
|
699
|
+
*
|
|
700
|
+
* Possible variant values:
|
|
701
|
+
* `"filled"` is a filled button.
|
|
702
|
+
* `"outlined"` is an outlined button.
|
|
703
|
+
* `"text"` is a transparent button.
|
|
704
|
+
* `"tonal"` is a light color button.
|
|
705
|
+
* `"elevated"` is elevated button
|
|
706
|
+
*/
|
|
707
|
+
this.variant = 'filled';
|
|
708
|
+
/**
|
|
709
|
+
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
710
|
+
*/
|
|
711
|
+
this.color = 'primary';
|
|
911
712
|
this.slotHasContent = false;
|
|
912
713
|
}
|
|
913
714
|
focus() {
|
|
@@ -916,16 +717,6 @@ let Button = class Button extends BaseButton {
|
|
|
916
717
|
blur() {
|
|
917
718
|
this.buttonElement?.blur();
|
|
918
719
|
}
|
|
919
|
-
connectedCallback() {
|
|
920
|
-
super.connectedCallback();
|
|
921
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
922
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
923
|
-
}
|
|
924
|
-
disconnectedCallback() {
|
|
925
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
926
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
927
|
-
super.disconnectedCallback();
|
|
928
|
-
}
|
|
929
720
|
firstUpdated() {
|
|
930
721
|
this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
|
|
931
722
|
observerSlotChangesWithCallback(this.renderRoot.querySelector('slot'), hasContent => {
|
|
@@ -934,6 +725,24 @@ let Button = class Button extends BaseButton {
|
|
|
934
725
|
});
|
|
935
726
|
this.__convertTypeToVariantAndColor();
|
|
936
727
|
}
|
|
728
|
+
__convertTypeToVariantAndColor() {
|
|
729
|
+
if (this.type === 'primary') {
|
|
730
|
+
this.color = 'primary';
|
|
731
|
+
this.variant = 'filled';
|
|
732
|
+
}
|
|
733
|
+
else if (this.type === 'secondary') {
|
|
734
|
+
this.color = 'surface';
|
|
735
|
+
this.variant = 'filled';
|
|
736
|
+
}
|
|
737
|
+
else if (this.type === 'tertiary') {
|
|
738
|
+
this.color = 'primary';
|
|
739
|
+
this.variant = 'text';
|
|
740
|
+
}
|
|
741
|
+
else if (this.type === 'danger') {
|
|
742
|
+
this.color = 'danger';
|
|
743
|
+
this.variant = 'filled';
|
|
744
|
+
}
|
|
745
|
+
}
|
|
937
746
|
render() {
|
|
938
747
|
const isLink = this.__isLink();
|
|
939
748
|
const cssClasses = {
|
|
@@ -950,16 +759,17 @@ let Button = class Button extends BaseButton {
|
|
|
950
759
|
};
|
|
951
760
|
if (!isLink) {
|
|
952
761
|
return b `<button
|
|
953
|
-
class=${e
|
|
762
|
+
class=${e(cssClasses)}
|
|
954
763
|
id="button"
|
|
955
|
-
tabindex=${__classPrivateFieldGet(this, _Button_tabindex, "f")}
|
|
956
764
|
type=${this.htmlType}
|
|
957
765
|
@click=${this.__dispatchClickWithThrottle}
|
|
958
766
|
@mousedown=${this.__handlePress}
|
|
959
767
|
@keydown=${this.__handlePress}
|
|
960
768
|
@keyup=${this.__handlePress}
|
|
961
|
-
|
|
962
|
-
aria-
|
|
769
|
+
|
|
770
|
+
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
771
|
+
?aria-disabled=${this.softDisabled}
|
|
772
|
+
|
|
963
773
|
?disabled=${this.disabled}
|
|
964
774
|
${spread(this.configAria)}
|
|
965
775
|
>
|
|
@@ -968,18 +778,20 @@ let Button = class Button extends BaseButton {
|
|
|
968
778
|
${this.__renderTooltip()}`;
|
|
969
779
|
}
|
|
970
780
|
return b `<a
|
|
971
|
-
class=${e
|
|
781
|
+
class=${e(cssClasses)}
|
|
972
782
|
id="button"
|
|
973
|
-
tabindex=${__classPrivateFieldGet(this, _Button_tabindex, "f")}
|
|
974
783
|
href=${this.href}
|
|
975
784
|
target=${this.target}
|
|
976
|
-
|
|
785
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
786
|
+
@click=${this.__dispatchClick}
|
|
977
787
|
@mousedown=${this.__handlePress}
|
|
978
788
|
@keydown=${this.__handlePress}
|
|
979
789
|
@keyup=${this.__handlePress}
|
|
980
790
|
role="button"
|
|
981
|
-
|
|
982
|
-
aria-
|
|
791
|
+
|
|
792
|
+
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
793
|
+
?aria-disabled=${this.softDisabled}
|
|
794
|
+
|
|
983
795
|
${spread(this.configAria)}
|
|
984
796
|
>
|
|
985
797
|
${this.renderButtonContent()}
|
|
@@ -988,7 +800,7 @@ let Button = class Button extends BaseButton {
|
|
|
988
800
|
}
|
|
989
801
|
renderButtonContent() {
|
|
990
802
|
return b `
|
|
991
|
-
<wc-focus-ring class="focus-ring"
|
|
803
|
+
<wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
|
|
992
804
|
<wc-elevation class="elevation"></wc-elevation>
|
|
993
805
|
<div class="neo-background"></div>
|
|
994
806
|
<div class="background"></div>
|
|
@@ -1004,15 +816,29 @@ let Button = class Button extends BaseButton {
|
|
|
1004
816
|
<slot name="icon"></slot>
|
|
1005
817
|
</div>
|
|
1006
818
|
|
|
1007
|
-
${this.__renderDisabledReason()}
|
|
819
|
+
${this.__renderDisabledReason(this.softDisabled)}
|
|
1008
820
|
`;
|
|
1009
821
|
}
|
|
1010
822
|
};
|
|
1011
|
-
_Button_tabindex = new WeakMap();
|
|
1012
823
|
Button.styles = [css_248z$2, css_248z$1, css_248z];
|
|
1013
824
|
__decorate([
|
|
1014
825
|
n({ attribute: 'icon-align' })
|
|
1015
826
|
], Button.prototype, "iconAlign", void 0);
|
|
827
|
+
__decorate([
|
|
828
|
+
n({ reflect: true })
|
|
829
|
+
], Button.prototype, "size", void 0);
|
|
830
|
+
__decorate([
|
|
831
|
+
n({ type: String })
|
|
832
|
+
], Button.prototype, "type", void 0);
|
|
833
|
+
__decorate([
|
|
834
|
+
n()
|
|
835
|
+
], Button.prototype, "variant", void 0);
|
|
836
|
+
__decorate([
|
|
837
|
+
n({ reflect: true })
|
|
838
|
+
], Button.prototype, "color", void 0);
|
|
839
|
+
__decorate([
|
|
840
|
+
n({ reflect: true })
|
|
841
|
+
], Button.prototype, "configAria", void 0);
|
|
1016
842
|
__decorate([
|
|
1017
843
|
r()
|
|
1018
844
|
], Button.prototype, "slotHasContent", void 0);
|
|
@@ -1020,5 +846,5 @@ Button = __decorate([
|
|
|
1020
846
|
IndividualComponent
|
|
1021
847
|
], Button);
|
|
1022
848
|
|
|
1023
|
-
export { Button as B, css_248z$1 as a,
|
|
1024
|
-
//# sourceMappingURL=button-
|
|
849
|
+
export { Button as B, css_248z$1 as a, css_248z$2 as c };
|
|
850
|
+
//# sourceMappingURL=button-DouvOfEU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-DouvOfEU.js","sources":["../../src/button/button/button.ts"],"sourcesContent":["import { html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './button.scss';\nimport colorStyles from './button-colors.scss';\nimport sizeStyles from './button-sizes.scss';\nimport { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';\nimport { throttle } from '@/__utils/throttle.js';\nimport { spread } from '@/__directive/spread.js';\nimport { BaseButton } from '../BaseButton.js';\n\n/**\n * @label Button\n * @tag wc-button\n * @rawTag button\n *\n * @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.\n * @overview\n * <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>\n *\n * @cssprop --button-container-shape: Defines the border radius of the button container shape.\n *\n * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.\n * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.\n *\n *\n * @cssprop --filled-button-container-color: Color of the filled button container.\n * @cssprop --filled-button-label-text-color: Text color of the filled button label.\n *\n * @cssprop --outlined-button-container-color: Color of the outlined button container.\n * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.\n *\n * @cssprop --text-button-label-text-color: Text color of the text button label.\n *\n * @cssprop --tonal-button-container-color: Color of the tonal button container.\n * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.\n *\n * @cssprop --elevated-button-container-color: Color of the elevated button container.\n * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.\n *\n * @cssprop --neo-button-container-color: Color of the neo button container.\n * @cssprop --neo-button-label-text-color: Text color of the neo button label.\n *\n * @fires {MouseEvent} click - Dispatched when the button is clicked.\n *\n * @example\n * ```html\n * <wc-button>Button</wc-button>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class Button extends BaseButton {\n static override styles = [styles, colorStyles, sizeStyles];\n\n /**\n * Icon alignment.\n * Possible values are `\"start\"`, `\"end\"`. Defaults to `\"end\"`.\n */\n @property({ attribute: 'icon-align' })\n iconAlign: 'start' | 'end' = 'end';\n\n /**\n * Button size.\n * Possible values are `\"xs\"`, `\"sm\"`, `\"md\"`, `\"lg\"`, `\"xl\"`. Defaults to `\"sm\"`.\n */\n @property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * Type is preset of color and variant. Type will be only applied.\n *\n */\n @property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';\n \n /**\n * The visual style of the button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"text\"` is a transparent button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is elevated button\n */\n @property() variant:\n | 'elevated'\n | 'filled'\n | 'tonal'\n | 'outlined'\n | 'text'\n | 'neo' = 'filled';\n \n /**\n * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'surface'\n | 'on-surface' = 'primary';\n\n /**\n * Additional ARIA attributes to pass to the inner button/anchor element.\n */\n @property({ reflect: true })\n configAria?: { [key: string]: any };\n\n @state()\n private slotHasContent = false;\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n observerSlotChangesWithCallback(\n this.renderRoot.querySelector('slot'),\n hasContent => {\n this.slotHasContent = hasContent;\n this.requestUpdate();\n },\n );\n\n this.__convertTypeToVariantAndColor();\n }\n\n __convertTypeToVariantAndColor() {\n if (this.type === 'primary') {\n this.color = 'primary';\n this.variant = 'filled';\n } else if (this.type === 'secondary') {\n this.color = 'surface';\n this.variant = 'filled';\n } else if (this.type === 'tertiary') {\n this.color = 'primary';\n this.variant = 'text';\n } else if (this.type === 'danger') {\n this.color = 'danger';\n this.variant = 'filled';\n }\n }\n\n override render() {\n const isLink = this.__isLink();\n\n const cssClasses = {\n button: true,\n 'button-element': true,\n [`size-${this.size}`]: true,\n [`variant-${this.variant}`]: true,\n [`color-${this.color}`]: true,\n disabled: this.disabled || this.softDisabled,\n pressed: this.isPressed,\n 'has-content': this.slotHasContent,\n 'show-skeleton': this.skeleton,\n [`icon-align-${this.iconAlign}`]: true,\n };\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n type=${this.htmlType}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n\n aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}\n ?aria-disabled=${this.softDisabled}\n\n ?disabled=${this.disabled}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </button>\n ${this.__renderTooltip()}`;\n }\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n href=${this.href}\n target=${this.target}\n tabindex=${this.disabled ? '-1' : '0'}\n @click=${this.__dispatchClick}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n\n aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}\n ?aria-disabled=${this.softDisabled}\n\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </a>\n ${this.__renderTooltip()}`;\n }\n\n renderButtonContent() {\n return html`\n <wc-focus-ring class=\"focus-ring\" for='button'></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"neo-background\"></div>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n <div class=\"button-content\">\n <div class=\"slot-container\">\n <slot></slot>\n </div>\n\n <slot name=\"icon\"></slot>\n </div>\n\n ${this.__renderDisabled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AAA,MAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAKQ,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAME,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAM/B,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACS,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAG5B,UAAA,CAAA;AADP,IAAAC,CAAK;AACyB,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AA1DpB,MAAM,GAAA,UAAA,CAAA;IADlB;AACY,CAAA,EAAA,MAAM,CAmLlB;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as i, _ as __decorate,
|
|
1
|
+
import { a as i, _ as __decorate, b, I as IndividualComponent, i as i$1 } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
3
|
import { e } from './class-map-YU7g0o3B.js';
|
|
4
|
-
import { c as css_248z$2, a as css_248z$3,
|
|
5
|
-
import { s as spread } from './
|
|
6
|
-
import { t as throttle } from './
|
|
4
|
+
import { c as css_248z$2, a as css_248z$3, B as Button } from './button-DouvOfEU.js';
|
|
5
|
+
import { B as BaseButton, o, s as spread } from './BaseButton-DuASuVth.js';
|
|
6
|
+
import { t as throttle } from './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
7
7
|
|
|
8
8
|
var css_248z$1 = i`* {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -114,7 +114,6 @@ var css_248z = i`.button {
|
|
|
114
114
|
--_button-icon-size: 2.5rem;
|
|
115
115
|
}`;
|
|
116
116
|
|
|
117
|
-
var _IconButton_tabindex;
|
|
118
117
|
/**
|
|
119
118
|
* @label Icon Button
|
|
120
119
|
* @tag wc-icon-button
|
|
@@ -154,15 +153,33 @@ var _IconButton_tabindex;
|
|
|
154
153
|
*
|
|
155
154
|
* @example
|
|
156
155
|
* ```html
|
|
157
|
-
* <wc-icon-button name="home"></wc-icon-button>
|
|
156
|
+
* <wc-icon-button><wc-icon name="home"></wc-icon></wc-icon-button>
|
|
158
157
|
* ```
|
|
159
158
|
* @tags display
|
|
160
159
|
*/
|
|
161
160
|
class IconButton extends BaseButton {
|
|
162
161
|
constructor() {
|
|
163
162
|
super(...arguments);
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Button size.
|
|
165
|
+
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
|
166
|
+
*/
|
|
167
|
+
this.size = 'sm';
|
|
168
|
+
/**
|
|
169
|
+
* The visual style of the button.
|
|
170
|
+
*
|
|
171
|
+
* Possible variant values:
|
|
172
|
+
* `"filled"` is a filled button.
|
|
173
|
+
* `"outlined"` is an outlined button.
|
|
174
|
+
* `"text"` is a transparent button.
|
|
175
|
+
* `"tonal"` is a light color button.
|
|
176
|
+
* `"elevated"` is elevated button
|
|
177
|
+
*/
|
|
178
|
+
this.variant = 'filled';
|
|
179
|
+
/**
|
|
180
|
+
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
181
|
+
*/
|
|
182
|
+
this.color = 'primary';
|
|
166
183
|
}
|
|
167
184
|
focus() {
|
|
168
185
|
this.buttonElement?.focus();
|
|
@@ -170,20 +187,28 @@ class IconButton extends BaseButton {
|
|
|
170
187
|
blur() {
|
|
171
188
|
this.buttonElement?.blur();
|
|
172
189
|
}
|
|
173
|
-
connectedCallback() {
|
|
174
|
-
super.connectedCallback();
|
|
175
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
176
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
177
|
-
}
|
|
178
|
-
disconnectedCallback() {
|
|
179
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
180
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
181
|
-
super.disconnectedCallback();
|
|
182
|
-
}
|
|
183
190
|
firstUpdated() {
|
|
184
191
|
this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
|
|
185
192
|
this.__convertTypeToVariantAndColor();
|
|
186
193
|
}
|
|
194
|
+
__convertTypeToVariantAndColor() {
|
|
195
|
+
if (this.type === 'primary') {
|
|
196
|
+
this.color = 'primary';
|
|
197
|
+
this.variant = 'filled';
|
|
198
|
+
}
|
|
199
|
+
else if (this.type === 'secondary') {
|
|
200
|
+
this.color = 'surface';
|
|
201
|
+
this.variant = 'filled';
|
|
202
|
+
}
|
|
203
|
+
else if (this.type === 'tertiary') {
|
|
204
|
+
this.color = 'primary';
|
|
205
|
+
this.variant = 'text';
|
|
206
|
+
}
|
|
207
|
+
else if (this.type === 'danger') {
|
|
208
|
+
this.color = 'danger';
|
|
209
|
+
this.variant = 'filled';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
187
212
|
render() {
|
|
188
213
|
const isLink = this.__isLink();
|
|
189
214
|
const cssClasses = {
|
|
@@ -200,14 +225,15 @@ class IconButton extends BaseButton {
|
|
|
200
225
|
return b `<button
|
|
201
226
|
class=${e(cssClasses)}
|
|
202
227
|
id="button"
|
|
203
|
-
tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
|
|
204
228
|
type=${this.htmlType}
|
|
205
229
|
@click=${this.__dispatchClickWithThrottle}
|
|
206
230
|
@mousedown=${this.__handlePress}
|
|
207
231
|
@keydown=${this.__handlePress}
|
|
208
232
|
@keyup=${this.__handlePress}
|
|
209
|
-
|
|
210
|
-
aria-
|
|
233
|
+
|
|
234
|
+
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
235
|
+
?aria-disabled=${this.softDisabled}
|
|
236
|
+
|
|
211
237
|
?disabled=${this.disabled}
|
|
212
238
|
${spread(this.configAria)}
|
|
213
239
|
>
|
|
@@ -218,16 +244,18 @@ class IconButton extends BaseButton {
|
|
|
218
244
|
return b `<a
|
|
219
245
|
class=${e(cssClasses)}
|
|
220
246
|
id="button"
|
|
221
|
-
tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
|
|
222
247
|
href=${this.href}
|
|
223
248
|
target=${this.target}
|
|
224
|
-
|
|
249
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
250
|
+
@click=${this.__dispatchClick}
|
|
225
251
|
@mousedown=${this.__handlePress}
|
|
226
252
|
@keydown=${this.__handlePress}
|
|
227
253
|
@keyup=${this.__handlePress}
|
|
228
254
|
role="button"
|
|
229
|
-
|
|
230
|
-
aria-
|
|
255
|
+
|
|
256
|
+
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
257
|
+
?aria-disabled=${this.softDisabled}
|
|
258
|
+
|
|
231
259
|
${spread(this.configAria)}
|
|
232
260
|
>
|
|
233
261
|
${this.renderButtonContent()}
|
|
@@ -236,7 +264,7 @@ class IconButton extends BaseButton {
|
|
|
236
264
|
}
|
|
237
265
|
renderButtonContent() {
|
|
238
266
|
return b `
|
|
239
|
-
<wc-focus-ring class="focus-ring"
|
|
267
|
+
<wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
|
|
240
268
|
<wc-elevation class="elevation"></wc-elevation>
|
|
241
269
|
<div class="neo-background"></div>
|
|
242
270
|
<div class="background"></div>
|
|
@@ -245,28 +273,29 @@ class IconButton extends BaseButton {
|
|
|
245
273
|
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
246
274
|
|
|
247
275
|
<div class="button-content">
|
|
248
|
-
<
|
|
249
|
-
name=${this.name}
|
|
250
|
-
src=${this.src}
|
|
251
|
-
provider=${this.provider}
|
|
252
|
-
></wc-icon>
|
|
276
|
+
<slot></slot>
|
|
253
277
|
</div>
|
|
254
278
|
|
|
255
|
-
${this.__renderDisabledReason()}
|
|
279
|
+
${this.__renderDisabledReason(this.softDisabled)}
|
|
256
280
|
`;
|
|
257
281
|
}
|
|
258
282
|
}
|
|
259
|
-
_IconButton_tabindex = new WeakMap();
|
|
260
283
|
IconButton.styles = [css_248z$2, css_248z$3, css_248z];
|
|
261
284
|
__decorate([
|
|
262
|
-
n({
|
|
263
|
-
], IconButton.prototype, "
|
|
264
|
-
__decorate([
|
|
265
|
-
n({ type: String, reflect: true })
|
|
266
|
-
], IconButton.prototype, "src", void 0);
|
|
285
|
+
n({ reflect: true })
|
|
286
|
+
], IconButton.prototype, "size", void 0);
|
|
267
287
|
__decorate([
|
|
268
288
|
n({ type: String })
|
|
269
|
-
], IconButton.prototype, "
|
|
289
|
+
], IconButton.prototype, "type", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
n()
|
|
292
|
+
], IconButton.prototype, "variant", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
n({ reflect: true })
|
|
295
|
+
], IconButton.prototype, "color", void 0);
|
|
296
|
+
__decorate([
|
|
297
|
+
n({ reflect: true })
|
|
298
|
+
], IconButton.prototype, "configAria", void 0);
|
|
270
299
|
|
|
271
300
|
/**
|
|
272
301
|
* @label Button Group
|
|
@@ -278,8 +307,8 @@ __decorate([
|
|
|
278
307
|
* @example
|
|
279
308
|
* ```html
|
|
280
309
|
* <wc-button-group variant="connected">
|
|
281
|
-
* <wc-icon-button name="home"
|
|
282
|
-
* <wc-icon-button name="alarm"
|
|
310
|
+
* <wc-icon-button toggle selected><wc-icon name="home"></wc-icon></wc-icon-button>
|
|
311
|
+
* <wc-icon-button toggle><wc-icon name="alarm"></wc-icon></wc-icon-button>
|
|
283
312
|
* </wc-button-group>
|
|
284
313
|
* ```
|
|
285
314
|
*
|
|
@@ -432,4 +461,4 @@ ButtonGroup = __decorate([
|
|
|
432
461
|
], ButtonGroup);
|
|
433
462
|
|
|
434
463
|
export { ButtonGroup as B, IconButton as I };
|
|
435
|
-
//# sourceMappingURL=button-group-
|
|
464
|
+
//# sourceMappingURL=button-group-CEdMwvJJ.js.map
|