@redvars/peacock 3.6.2 → 3.7.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.
Files changed (200) hide show
  1. package/dist/ButtonConstants-D06bY4uy.js +114 -0
  2. package/dist/ButtonConstants-D06bY4uy.js.map +1 -0
  3. package/dist/{BaseHyperlinkMixin-BNuwbiEf.js → NativeHyperlinkMixin-DrYXyfMQ.js} +8 -10
  4. package/dist/NativeHyperlinkMixin-DrYXyfMQ.js.map +1 -0
  5. package/dist/assets/components.css +1 -1
  6. package/dist/assets/components.css.map +1 -1
  7. package/dist/assets/styles.css +1 -1
  8. package/dist/assets/styles.css.map +1 -1
  9. package/dist/button-colors-Dwnez1tR.js +586 -0
  10. package/dist/button-colors-Dwnez1tR.js.map +1 -0
  11. package/dist/button-group.js +8 -8
  12. package/dist/button-group.js.map +1 -1
  13. package/dist/button.js +236 -133
  14. package/dist/button.js.map +1 -1
  15. package/dist/calendar-column-view.js +0 -1
  16. package/dist/calendar-column-view.js.map +1 -1
  17. package/dist/calendar-month-view.js +0 -1
  18. package/dist/calendar-month-view.js.map +1 -1
  19. package/dist/canvas.js +126 -107
  20. package/dist/canvas.js.map +1 -1
  21. package/dist/card-content.js +0 -1
  22. package/dist/card-content.js.map +1 -1
  23. package/dist/card.js +96 -90
  24. package/dist/card.js.map +1 -1
  25. package/dist/cb-compound-expression.js +4 -1
  26. package/dist/cb-compound-expression.js.map +1 -1
  27. package/dist/cb-divider.js +0 -1
  28. package/dist/cb-divider.js.map +1 -1
  29. package/dist/cb-expression.js +0 -2
  30. package/dist/cb-expression.js.map +1 -1
  31. package/dist/cb-predicate.js +0 -1
  32. package/dist/cb-predicate.js.map +1 -1
  33. package/dist/code-highlighter.js +23 -6
  34. package/dist/code-highlighter.js.map +1 -1
  35. package/dist/custom-elements-jsdocs.json +5079 -17882
  36. package/dist/custom-elements.json +19272 -19314
  37. package/dist/fab.js +181 -117
  38. package/dist/fab.js.map +1 -1
  39. package/dist/flow-designer.js +4 -4
  40. package/dist/icon-button-DJ0kZXYr.js +318 -0
  41. package/dist/icon-button-DJ0kZXYr.js.map +1 -0
  42. package/dist/index.js +7 -7
  43. package/dist/{navigation-rail-CD7IrqbN.js → navigation-rail-CM_svs5_.js} +1311 -730
  44. package/dist/navigation-rail-CM_svs5_.js.map +1 -0
  45. package/dist/observe-slot-change-D8Xg-kSS.js +60 -0
  46. package/dist/observe-slot-change-D8Xg-kSS.js.map +1 -0
  47. package/dist/peacock-loader.js +10 -7
  48. package/dist/peacock-loader.js.map +1 -1
  49. package/dist/popover-content.js +0 -1
  50. package/dist/popover-content.js.map +1 -1
  51. package/dist/search.js +15 -15
  52. package/dist/search.js.map +1 -1
  53. package/dist/src/__controllers/attachable-controller.d.ts +109 -0
  54. package/dist/src/__mixins/{BaseButtonMixin.d.ts → NativeButtonMixin.d.ts} +3 -3
  55. package/dist/src/__mixins/{BaseHyperlinkMixin.d.ts → NativeHyperlinkMixin.d.ts} +3 -4
  56. package/dist/src/__utils/is-link.d.ts +1 -0
  57. package/dist/src/__utils/observe-slot-change.d.ts +1 -1
  58. package/dist/src/accordion/accordion-item.d.ts +0 -1
  59. package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +0 -1
  60. package/dist/src/button/ButtonConstants.d.ts +1 -0
  61. package/dist/src/button/GroupButtonInterface.d.ts +4 -0
  62. package/dist/src/button/button/button.d.ts +32 -7
  63. package/dist/src/button/button-group/button-group.d.ts +2 -1
  64. package/dist/src/button/icon-button/icon-button.d.ts +26 -5
  65. package/dist/src/button/index.d.ts +1 -1
  66. package/dist/src/calendar/calendar-column-view.d.ts +0 -1
  67. package/dist/src/calendar/calendar-month-view.d.ts +0 -1
  68. package/dist/src/canvas/canvas.d.ts +3 -3
  69. package/dist/src/card/card-content.d.ts +0 -1
  70. package/dist/src/card/card.d.ts +9 -6
  71. package/dist/src/chip/chip/chip.d.ts +22 -3
  72. package/dist/src/condition-builder/cb-compound-expression.d.ts +0 -1
  73. package/dist/src/condition-builder/cb-divider.d.ts +0 -1
  74. package/dist/src/condition-builder/cb-expression.d.ts +0 -1
  75. package/dist/src/condition-builder/cb-predicate.d.ts +0 -1
  76. package/dist/src/fab/fab.d.ts +20 -6
  77. package/dist/src/field/field.d.ts +1 -0
  78. package/dist/src/focus-ring/focus-ring.d.ts +26 -20
  79. package/dist/src/image/image.d.ts +2 -2
  80. package/dist/src/index.d.ts +1 -0
  81. package/dist/src/input/input.d.ts +1 -3
  82. package/dist/src/item/index.d.ts +1 -0
  83. package/dist/src/item/item.d.ts +49 -0
  84. package/dist/src/link/link.d.ts +1 -1
  85. package/dist/src/list/list-item.d.ts +1 -2
  86. package/dist/src/menu/menu-item/menu-item.d.ts +9 -11
  87. package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -1
  88. package/dist/src/navigation-rail/navigation-rail-item.d.ts +0 -2
  89. package/dist/src/navigation-rail/navigation-rail.d.ts +2 -6
  90. package/dist/src/popover/popover-content.d.ts +0 -1
  91. package/dist/src/ripple/ripple.d.ts +9 -1
  92. package/dist/src/search/search.d.ts +2 -6
  93. package/dist/src/segmented-button/segmented-button.d.ts +0 -1
  94. package/dist/src/select/option.d.ts +0 -1
  95. package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +0 -1
  96. package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +0 -1
  97. package/dist/src/tabs/tab-panel.d.ts +0 -1
  98. package/dist/src/tabs/tab.d.ts +4 -6
  99. package/dist/test/item.test.d.ts +1 -0
  100. package/dist/tsconfig.tsbuildinfo +1 -1
  101. package/package.json +4 -2
  102. package/readme.md +2 -2
  103. package/scss/components.scss +0 -1
  104. package/scss/mixin.scss +33 -13
  105. package/scss/styles.scss +1 -3
  106. package/src/__controllers/attachable-controller.ts +198 -0
  107. package/src/__mixins/NativeButtonMixin.ts +87 -0
  108. package/src/__mixins/{BaseHyperlinkMixin.ts → NativeHyperlinkMixin.ts} +15 -15
  109. package/src/__utils/is-link.ts +3 -0
  110. package/src/__utils/observe-slot-change.ts +46 -14
  111. package/src/accordion/accordion-item.scss +1 -1
  112. package/src/accordion/accordion-item.ts +0 -1
  113. package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +0 -1
  114. package/src/button/ButtonConstants.ts +1 -0
  115. package/src/button/GroupButtonInterface.ts +4 -0
  116. package/src/button/button/button-colors.scss +2 -2
  117. package/src/button/button/button-layers.scss +124 -0
  118. package/src/button/button/button-sizes.scss +31 -53
  119. package/src/button/button/button.scss +139 -262
  120. package/src/button/button/button.ts +260 -106
  121. package/src/button/button/only-button.scss +13 -0
  122. package/src/button/button-group/button-group.ts +59 -17
  123. package/src/button/icon-button/icon-button-sizes.scss +12 -27
  124. package/src/button/icon-button/icon-button.ts +191 -83
  125. package/src/button/index.ts +1 -1
  126. package/src/calendar/calendar-column-view.ts +0 -1
  127. package/src/calendar/calendar-month-view.ts +0 -1
  128. package/src/canvas/canvas.scss +18 -6
  129. package/src/canvas/canvas.ts +125 -103
  130. package/src/card/card-content.ts +2 -3
  131. package/src/card/card.scss +87 -95
  132. package/src/card/card.ts +62 -60
  133. package/src/chip/chip/chip.scss +66 -71
  134. package/src/chip/chip/chip.ts +155 -56
  135. package/src/code-highlighter/code-highlighter.scss +1 -1
  136. package/src/code-highlighter/code-highlighter.ts +20 -5
  137. package/src/condition-builder/cb-compound-expression.scss +4 -0
  138. package/src/condition-builder/cb-compound-expression.ts +0 -1
  139. package/src/condition-builder/cb-divider.ts +0 -1
  140. package/src/condition-builder/cb-expression.scss +0 -1
  141. package/src/condition-builder/cb-expression.ts +0 -1
  142. package/src/condition-builder/cb-predicate.ts +0 -1
  143. package/src/elevation/elevation.scss +5 -1
  144. package/src/empty-state/empty-state.scss +1 -0
  145. package/src/fab/fab-colors.scss +2 -2
  146. package/src/fab/fab-sizes.scss +24 -34
  147. package/src/fab/fab.scss +77 -71
  148. package/src/fab/fab.ts +141 -65
  149. package/src/field/field.ts +6 -0
  150. package/src/focus-ring/focus-ring.ts +81 -72
  151. package/src/image/image.scss +21 -16
  152. package/src/image/image.ts +13 -14
  153. package/src/index.ts +1 -0
  154. package/src/input/input.ts +16 -25
  155. package/src/item/index.ts +1 -0
  156. package/src/item/item.scss +195 -0
  157. package/src/item/item.ts +362 -0
  158. package/src/link/link.scss +1 -10
  159. package/src/link/link.ts +4 -2
  160. package/src/list/list-item.ts +8 -8
  161. package/src/menu/menu/menu.ts +5 -9
  162. package/src/menu/menu-item/menu-item.scss +30 -108
  163. package/src/menu/menu-item/menu-item.ts +102 -133
  164. package/src/menu/sub-menu/sub-menu.ts +6 -3
  165. package/src/navigation-rail/navigation-rail-item.scss +5 -0
  166. package/src/navigation-rail/navigation-rail-item.ts +10 -15
  167. package/src/navigation-rail/navigation-rail.ts +2 -6
  168. package/src/peacock-loader.ts +5 -1
  169. package/src/popover/popover-content.ts +0 -1
  170. package/src/ripple/ripple.ts +52 -20
  171. package/src/search/search.scss +3 -0
  172. package/src/search/search.ts +11 -16
  173. package/src/segmented-button/segmented-button.ts +0 -1
  174. package/src/select/option.ts +1 -2
  175. package/src/select/select.scss +1 -10
  176. package/src/select/select.ts +2 -0
  177. package/src/sidebar-menu/sidebar-menu-item.ts +0 -1
  178. package/src/sidebar-menu/sidebar-sub-menu.ts +0 -1
  179. package/src/skeleton/skeleton.scss +5 -1
  180. package/src/tabs/tab-panel.ts +0 -1
  181. package/src/tabs/tab.ts +60 -70
  182. package/src/text/text.css-component.scss +3 -21
  183. package/src/tooltip/tooltip.scss +5 -8
  184. package/src/tooltip/tooltip.ts +1 -2
  185. package/dist/BaseButton-BNFAYn-S.js +0 -219
  186. package/dist/BaseButton-BNFAYn-S.js.map +0 -1
  187. package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +0 -1
  188. package/dist/button-colors-AvGh22Zn.js +0 -561
  189. package/dist/button-colors-AvGh22Zn.js.map +0 -1
  190. package/dist/icon-button-ohxHhy4t.js +0 -247
  191. package/dist/icon-button-ohxHhy4t.js.map +0 -1
  192. package/dist/navigation-rail-CD7IrqbN.js.map +0 -1
  193. package/dist/observe-slot-change-BGJfgg2E.js +0 -31
  194. package/dist/observe-slot-change-BGJfgg2E.js.map +0 -1
  195. package/dist/src/button/BaseButton.d.ts +0 -28
  196. package/dist/src/focus-ring/FocusAttachableController.d.ts +0 -8
  197. package/src/__mixins/BaseButtonMixin.ts +0 -83
  198. package/src/button/BaseButton.ts +0 -113
  199. package/src/focus-ring/FocusAttachableController.ts +0 -28
  200. package/src/popover/tooltip.css-component.scss +0 -19
@@ -1,219 +0,0 @@
1
- import { A, _ as __decorate, b, i as i$1 } from './IndividualComponent-DUINtMGK.js';
2
- import { e, i, t } from './directive-ZPhl09Yt.js';
3
- import { n } from './property-1psGvXOq.js';
4
- import { r } from './state-DwbEjqVk.js';
5
- import { e as e$1 } from './query-QBcUV-L_.js';
6
- import { i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
7
- import { B as BaseHyperlinkMixin } from './BaseHyperlinkMixin-BNuwbiEf.js';
8
-
9
- /**
10
- * @license
11
- * Copyright 2018 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const o=o=>o??A;
14
-
15
- class SpreadDirective extends i {
16
- constructor(partInfo) {
17
- super(partInfo);
18
- if (partInfo.type !== t.ELEMENT) {
19
- throw new Error('spread() can only be used on elements');
20
- }
21
- }
22
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
- render(_props) {
24
- return '';
25
- }
26
- update(part, [props]) {
27
- if (!props)
28
- return;
29
- // eslint-disable-next-line guard-for-in,no-restricted-syntax
30
- for (const key in props) {
31
- const value = props[key];
32
- if (value === undefined || value === null) {
33
- part.element.removeAttribute(key);
34
- }
35
- else {
36
- part.element.setAttribute(key, value);
37
- }
38
- }
39
- }
40
- }
41
- const spread = e(SpreadDirective);
42
-
43
- /**
44
- * 2. Apply the type annotation to the variable.
45
- */
46
- const BaseButtonMixin = (superclass) => {
47
- // Naming the class (BaseButtonElement) instead of using 'Mixin' or anonymous
48
- // prevents the "__childPart" visibility error.
49
- class BaseButtonElement extends superclass {
50
- constructor() {
51
- super(...arguments);
52
- /**
53
- * The type of the underlying `<button>` element. Maps to the native `type` attribute.
54
- * Possible values are `"button"`, `"submit"`, `"reset"`. Defaults to `"button"`.
55
- */
56
- this.htmlType = 'button';
57
- /**
58
- * When `true`, the button is disabled and cannot be interacted with. Reflects to the `disabled` attribute. Defaults to `false`.
59
- */
60
- this.disabled = false;
61
- /**
62
- * When `true`, the button is visually styled as disabled and cannot be interacted with, but remains focusable.
63
- * Use this in combination with `disabledReason` to communicate why the button is unavailable.
64
- * Reflects to the `soft-disabled` attribute. Defaults to `false`.
65
- */
66
- this.softDisabled = false;
67
- /**
68
- * A human-readable explanation of why the button is disabled or soft-disabled.
69
- * Rendered as a visually hidden tooltip and linked via `aria-describedby` for accessibility.
70
- * Maps to the `disabled-reason` attribute.
71
- */
72
- this.disabledReason = '';
73
- /**
74
- * The `id` of the `<form>` element to associate the button with.
75
- * If omitted, the button is associated with its nearest ancestor form.
76
- * Maps to the native `form` attribute.
77
- */
78
- this.form = '';
79
- /**
80
- * The name of the button, submitted as part of a name/value pair when the associated form is submitted.
81
- * Maps to the native `name` attribute.
82
- */
83
- this.name = '';
84
- /**
85
- * The value of the button, submitted as part of a name/value pair when the associated form is submitted.
86
- * Maps to the native `value` attribute.
87
- */
88
- this.value = '';
89
- }
90
- }
91
- __decorate([
92
- n({ type: String })
93
- ], BaseButtonElement.prototype, "htmlType", void 0);
94
- __decorate([
95
- n({ type: Boolean, reflect: true })
96
- ], BaseButtonElement.prototype, "disabled", void 0);
97
- __decorate([
98
- n({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
99
- ], BaseButtonElement.prototype, "softDisabled", void 0);
100
- __decorate([
101
- n({ attribute: 'disabled-reason' })
102
- ], BaseButtonElement.prototype, "disabledReason", void 0);
103
- __decorate([
104
- n()
105
- ], BaseButtonElement.prototype, "form", void 0);
106
- __decorate([
107
- n()
108
- ], BaseButtonElement.prototype, "name", void 0);
109
- __decorate([
110
- n()
111
- ], BaseButtonElement.prototype, "value", void 0);
112
- return BaseButtonElement;
113
- };
114
-
115
- class BaseButton extends BaseButtonMixin(BaseHyperlinkMixin(i$1)) {
116
- constructor() {
117
- super(...arguments);
118
- this.skeleton = false;
119
- this.toggle = false;
120
- this.selected = false;
121
- /**
122
- * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
123
- */
124
- this.throttleDelay = 200;
125
- /**
126
- * States
127
- */
128
- this.isPressed = false;
129
- this.__handlePress = (event) => {
130
- if (this.disabled || this.skeleton || this.softDisabled)
131
- return;
132
- if (event instanceof KeyboardEvent &&
133
- event.type === 'keydown' &&
134
- (event.key === 'Enter' || event.key === ' ')) {
135
- this.isPressed = true;
136
- }
137
- else if (event.type === 'mousedown') {
138
- this.isPressed = true;
139
- }
140
- else {
141
- this.isPressed = false;
142
- }
143
- };
144
- this.__dispatchClickWithThrottle = event => {
145
- this.__dispatchClick(event);
146
- };
147
- this.__dispatchClick = (event) => {
148
- // If the button is soft-disabled or a disabled link, we need to explicitly
149
- // prevent the click from propagating to other event listeners as well as
150
- // prevent the default action.
151
- if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
152
- event.stopImmediatePropagation();
153
- event.preventDefault();
154
- return;
155
- }
156
- if (!isActivationClick(event) || !this.buttonElement) {
157
- return;
158
- }
159
- if (this.toggle) {
160
- this.selected = !this.selected;
161
- }
162
- this.focus();
163
- dispatchActivationClick(this.buttonElement);
164
- };
165
- }
166
- connectedCallback() {
167
- super.connectedCallback();
168
- this.addEventListener('click', this.__dispatchClickWithThrottle);
169
- window.addEventListener('mouseup', this.__handlePress);
170
- }
171
- disconnectedCallback() {
172
- window.removeEventListener('mouseup', this.__handlePress);
173
- this.removeEventListener('click', this.__dispatchClickWithThrottle);
174
- super.disconnectedCallback();
175
- }
176
- __renderDisabledReason(softDisabled) {
177
- if (softDisabled)
178
- return b `<div
179
- id=${BaseButton.DISABLED_REASON_ID}
180
- role="tooltip"
181
- aria-label=${this.disabledReason}
182
- class="screen-reader-only"
183
- >
184
- ${this.disabledReason}
185
- </div>`;
186
- return A;
187
- }
188
- __renderTooltip() {
189
- if (this.tooltip) {
190
- return b `<wc-tooltip for="button">${this.tooltip}</wc-tooltip>`;
191
- }
192
- return A;
193
- }
194
- }
195
- BaseButton.DISABLED_REASON_ID = 'disabled-reason';
196
- __decorate([
197
- n({ type: Boolean, reflect: true })
198
- ], BaseButton.prototype, "skeleton", void 0);
199
- __decorate([
200
- n({ type: Boolean, reflect: true })
201
- ], BaseButton.prototype, "toggle", void 0);
202
- __decorate([
203
- n({ type: Boolean, reflect: true })
204
- ], BaseButton.prototype, "selected", void 0);
205
- __decorate([
206
- n()
207
- ], BaseButton.prototype, "throttleDelay", void 0);
208
- __decorate([
209
- n()
210
- ], BaseButton.prototype, "tooltip", void 0);
211
- __decorate([
212
- r()
213
- ], BaseButton.prototype, "isPressed", void 0);
214
- __decorate([
215
- e$1('.button')
216
- ], BaseButton.prototype, "buttonElement", void 0);
217
-
218
- export { BaseButton as B, BaseButtonMixin as a, o, spread as s };
219
- //# sourceMappingURL=BaseButton-BNFAYn-S.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseButton-BNFAYn-S.js","sources":["../node_modules/lit-html/directives/if-defined.js","../../src/__directive/spread.ts","../../src/__mixins/BaseButtonMixin.ts","../../src/button/BaseButton.ts"],"sourcesContent":["import{nothing as t}from\"../lit-html.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o=o=>o??t;export{o as ifDefined};\n//# sourceMappingURL=if-defined.js.map\n","import {\n directive,\n Directive,\n ElementPart,\n PartInfo,\n PartType,\n} from 'lit/directive.js';\n\nclass SpreadDirective extends Directive {\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.ELEMENT) {\n throw new Error('spread() can only be used on elements');\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n render(_props: { [key: string]: any } | undefined) {\n return '';\n }\n\n update(part: ElementPart, [props]: [{ [key: string]: any } | undefined]) {\n if (!props) return;\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const key in props) {\n const value = props[key];\n if (value === undefined || value === null) {\n part.element.removeAttribute(key);\n } else {\n part.element.setAttribute(key, value);\n }\n }\n }\n}\n\nexport const spread = directive(SpreadDirective);\n","import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { MixinConstructor } from './MixinConstructor.js';\n\n\n/**\n * 1. Define an interface for the members the mixin adds.\n * This makes the type annotation much cleaner.\n */\nexport interface BaseButtonInterface {\n htmlType: 'button' | 'submit' | 'reset';\n disabled: boolean;\n softDisabled: boolean;\n disabledReason: string;\n form: string;\n name: string;\n value: string;\n}\n\n/**\n * 2. Apply the type annotation to the variable.\n */\nconst BaseButtonMixin: <T extends MixinConstructor<LitElement>>(superclass: T) => T & MixinConstructor<BaseButtonInterface> = <T extends MixinConstructor<LitElement>>(superclass: T) => {\n // Naming the class (BaseButtonElement) instead of using 'Mixin' or anonymous \n // prevents the \"__childPart\" visibility error.\n class BaseButtonElement extends superclass implements BaseButtonInterface {\n\n /**\n * The type of the underlying `<button>` element. Maps to the native `type` attribute.\n * Possible values are `\"button\"`, `\"submit\"`, `\"reset\"`. Defaults to `\"button\"`.\n */\n @property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =\n 'button';\n\n /**\n * When `true`, the button is disabled and cannot be interacted with. Reflects to the `disabled` attribute. Defaults to `false`.\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n /**\n * When `true`, the button is visually styled as disabled and cannot be interacted with, but remains focusable.\n * Use this in combination with `disabledReason` to communicate why the button is unavailable.\n * Reflects to the `soft-disabled` attribute. Defaults to `false`.\n */\n @property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })\n softDisabled: boolean = false;\n\n /**\n * A human-readable explanation of why the button is disabled or soft-disabled.\n * Rendered as a visually hidden tooltip and linked via `aria-describedby` for accessibility.\n * Maps to the `disabled-reason` attribute.\n */\n @property({ attribute: 'disabled-reason' })\n disabledReason: string = '';\n\n /**\n * The `id` of the `<form>` element to associate the button with.\n * If omitted, the button is associated with its nearest ancestor form.\n * Maps to the native `form` attribute.\n */\n @property()\n form: string = '';\n\n /**\n * The name of the button, submitted as part of a name/value pair when the associated form is submitted.\n * Maps to the native `name` attribute.\n */\n @property()\n name: string = '';\n\n /**\n * The value of the button, submitted as part of a name/value pair when the associated form is submitted.\n * Maps to the native `value` attribute.\n */\n @property()\n value: string = '';\n }\n\n return BaseButtonElement as T & MixinConstructor<BaseButtonInterface>;\n};\n\nexport default BaseButtonMixin;","import { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { dispatchActivationClick, isActivationClick } from '../__utils/dispatch-event-utils.js';\nimport BaseHyperlinkMixin from '@/__mixins/BaseHyperlinkMixin.js';\nimport BaseButtonMixin from '@/__mixins/BaseButtonMixin.js';\n\n\n\nexport class BaseButton extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {\n protected static readonly DISABLED_REASON_ID = 'disabled-reason';\n\n \n color?: string;\n\n variant?: string;\n\n @property({ type: Boolean, reflect: true }) skeleton: boolean = false;\n \n @property({ type: Boolean, reflect: true }) toggle: boolean = false;\n\n @property({ type: Boolean, reflect: true }) selected: boolean = false;\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n @property() tooltip?: string;\n\n /**\n * States\n */\n @state()\n isPressed = false;\n\n @query('.button') readonly buttonElement!: HTMLElement | null;\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('click', this.__dispatchClickWithThrottle);\n window.addEventListener('mouseup', this.__handlePress);\n }\n\n override disconnectedCallback() {\n window.removeEventListener('mouseup', this.__handlePress);\n this.removeEventListener('click', this.__dispatchClickWithThrottle);\n super.disconnectedCallback();\n }\n\n __handlePress = (event: KeyboardEvent | MouseEvent) => {\n if (this.disabled || this.skeleton || this.softDisabled) return;\n if (\n event instanceof KeyboardEvent &&\n event.type === 'keydown' &&\n (event.key === 'Enter' || event.key === ' ')\n ) {\n this.isPressed = true;\n } else if (event.type === 'mousedown') {\n this.isPressed = true;\n } else {\n this.isPressed = false;\n }\n };\n\n __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =\n event => {\n this.__dispatchClick(event);\n };\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n // If the button is soft-disabled or a disabled link, we need to explicitly\n // prevent the click from propagating to other event listeners as well as\n // prevent the default action.\n if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n\n if (this.toggle) {\n this.selected = !this.selected;\n }\n\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n \n\n __renderDisabledReason(softDisabled: boolean) {\n if (softDisabled)\n return html`<div\n id=${BaseButton.DISABLED_REASON_ID}\n role=\"tooltip\"\n aria-label=${this.disabledReason}\n class=\"screen-reader-only\"\n >\n ${this.disabledReason}\n </div>`;\n return nothing;\n }\n\n __renderTooltip() {\n if (this.tooltip) {\n return html`<wc-tooltip for=\"button\">${this.tooltip}</wc-tooltip>`;\n }\n return nothing;\n }\n}\n"],"names":["t","Directive","PartType","directive","property","LitElement","html","nothing","state","query"],"mappings":";;;;;;;;AACA;AACA;AACA;AACA;AACA,GAAQ,MAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAEA;;ACGjB,MAAM,eAAgB,SAAQC,CAAS,CAAA;AACrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAC5B,KAAK,CAAC,QAAQ,CAAC;QACf,IAAI,QAAQ,CAAC,IAAI,KAAKC,CAAQ,CAAC,OAAO,EAAE;AACtC,YAAA,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC;QAC1D;IACF;;AAGA,I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A,MAAA,CAAA;AAK1D,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAuB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAEpB,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAoB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAM7B,UAAA,CAAA;AADC,IAAAI,CAAK;AACY,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAES,UAAA,CAAA;IAA1BC,GAAK,CAAC,SAAS;AAA8C,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;;;;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseHyperlinkMixin-BNuwbiEf.js","sources":["../../src/__utils/throttle.ts","../../src/__mixins/BaseHyperlinkMixin.ts"],"sourcesContent":["export function throttle(\n func: Function,\n delay: number,\n options = { leading: true, trailing: true },\n) {\n let timerId: any;\n let lastExec = 0;\n\n return function (...args: any[]) {\n // @ts-ignore\n const context = this;\n const now = Date.now();\n\n const shouldCallNow = options.leading && now - lastExec >= delay;\n\n if (shouldCallNow) {\n func.apply(context, args);\n lastExec = now;\n } else if (options.trailing && !timerId) {\n timerId = setTimeout(() => {\n func.apply(context, args);\n lastExec = Date.now();\n timerId = null;\n }, delay);\n }\n };\n}","import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { MixinConstructor } from './MixinConstructor.js';\n\n\n/**\n * 1. Define an interface for the members the mixin adds.\n * This makes the type annotation much cleaner.\n */\nexport interface BaseHyperlinkInterface {\n href?: string;\n target: '_self' | '_parent' | '_blank' | '_top' | string;\n rel?: string;\n download?: string;\n __isLink(): boolean;\n}\n\n/**\n * 2. Apply the type annotation to the variable.\n */\nconst BaseHyperlinkMixin: <T extends MixinConstructor<LitElement>>(superclass: T) => T & MixinConstructor<BaseHyperlinkInterface> = <T extends MixinConstructor<LitElement>>(superclass: T) => {\n // Naming the class (BaseHyperlinkElement) instead of using 'Mixin' or anonymous \n // prevents the \"__childPart\" visibility error.\n class BaseHyperlinkElement extends superclass implements BaseHyperlinkInterface {\n /**\n * The URL that the hyperlink points to. When set, the component renders as an `<a>` element.\n * Maps to the native `href` attribute.\n */\n @property({ reflect: true })\n href?: string;\n\n /**\n * Where to display the linked URL. Maps to the native `target` attribute.\n * Possible values are `\"_self\"`, `\"_blank\"`, `\"_parent\"`, `\"_top\"`, or a custom frame name.\n * When using `\"_blank\"`, consider setting `rel=\"noopener noreferrer\"` for security. Defaults to `\"_self\"`.\n */\n @property()\n target: '_self' | '_parent' | '_blank' | '_top' | string = '_self';\n\n /**\n * The relationship between the current document and the linked URL.\n * Maps to the native `rel` attribute on the rendered `<a>` element.\n * When `target=\"_blank\"`, use `\"noopener noreferrer\"` to prevent tab-napping attacks.\n */\n @property()\n rel?: string;\n\n /**\n * Causes the browser to download the linked URL instead of navigating to it.\n * If a string value is provided, it is used as the suggested filename.\n * Omit or leave undefined to preserve normal navigation behaviour.\n * Maps to the native `download` attribute. Only applies when `href` is set.\n */\n @property()\n download?: string;\n\n /**\n * Returns `true` when `href` is set, indicating the component should render as a link.\n */\n __isLink(): boolean {\n return !!this.href;\n }\n }\n\n return BaseHyperlinkElement as T & MixinConstructor<BaseHyperlinkInterface>;\n};\n\nexport default BaseHyperlinkMixin;"],"names":["property"],"mappings":";;;SAAgB,QAAQ,CACtB,IAAc,EACd,KAAa,EACb,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAA;AAE3C,IAAA,IAAI,OAAY;IAChB,IAAI,QAAQ,GAAG,CAAC;IAEhB,OAAO,UAAU,GAAG,IAAW,EAAA;;QAE7B,MAAM,OAAO,GAAG,IAAI;AACpB,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;QAEtB,MAAM,aAAa,GAAG,OAAO,CAAC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