@kubex/zinc 1.1.156 → 1.1.158
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/custom-elements.json +74 -74
- package/dist/vscode.html-custom-data.json +11 -11
- package/dist/web-types.json +23 -23
- package/dist/zn.min.js +401 -399
- package/package.json +1 -1
- package/src/components/button/button.component.ts +10 -6
- package/src/components/button/button.scss +10 -2
package/package.json
CHANGED
|
@@ -374,8 +374,9 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
374
374
|
protected render(): unknown {
|
|
375
375
|
const isLink = this._isLink();
|
|
376
376
|
const showCancel = this.loading && this.autoClick;
|
|
377
|
+
const resolvedIconSize = this.iconSize ? this.iconSize : 20;
|
|
377
378
|
const icon = this.icon && !this.loading ? html`
|
|
378
|
-
<zn-icon part="icon" src="${this.icon}" id="xy2" size="${
|
|
379
|
+
<zn-icon part="icon" src="${this.icon}" id="xy2" size="${resolvedIconSize}"
|
|
379
380
|
color="${ifDefined(this.iconColor)}" fill="${ifDefined(this.iconFill)}"
|
|
380
381
|
library="${ifDefined(this.iconLibrary)}"></zn-icon>`
|
|
381
382
|
: '';
|
|
@@ -384,10 +385,13 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
384
385
|
// accessible name. Buttons with content keep their text as the name.
|
|
385
386
|
const hasContent = this.hasSlotController.test('[default]') || !!this.content;
|
|
386
387
|
const ariaLabel = this.label || (hasContent ? undefined : this.tooltip);
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
388
|
+
const buttonStyles = {
|
|
389
|
+
...(this.iconButton ? {
|
|
390
|
+
'--icon-button-color': this.getIconButtonColor(this.color),
|
|
391
|
+
'--icon-button-hover-color': this.getIconButtonColor(this.hoverColor || 'primary')
|
|
392
|
+
} : {}),
|
|
393
|
+
...(this.icon ? {'--button-icon-size': `${resolvedIconSize}px`} : {}),
|
|
394
|
+
};
|
|
391
395
|
|
|
392
396
|
// A removed `notification` attribute lands here as null, not undefined
|
|
393
397
|
const notification = this.notification ?? undefined;
|
|
@@ -434,7 +438,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
434
438
|
aria-label="${ifDefined(ariaLabel)}"
|
|
435
439
|
data-notification="${ifDefined(notification)}"
|
|
436
440
|
disabled="${this.disabled || nothing}"
|
|
437
|
-
style=${styleMap(
|
|
441
|
+
style=${styleMap(buttonStyles)}
|
|
438
442
|
@click="${this.handleClick}">
|
|
439
443
|
${this.iconPosition === 'left' ? icon : ''}
|
|
440
444
|
<slot part="label"
|
|
@@ -200,15 +200,23 @@
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
.button--with-icon.button--with-content:not(.button--icon-button) {
|
|
203
|
+
// Icon glyphs are drawn inset ~2 units inside their 24-unit box, so the icon
|
|
204
|
+
// is narrower than the space it takes. Pull that slack out on both sides so
|
|
205
|
+
// the gaps read as equal to the text edge opposite.
|
|
206
|
+
--icon-optical-inset: calc(var(--button-icon-size, 20px) / 12);
|
|
207
|
+
--icon-gap: calc(var(--zn-base-px) - var(--icon-optical-inset));
|
|
208
|
+
|
|
203
209
|
&.button--icon-left {
|
|
204
210
|
zn-icon {
|
|
205
|
-
margin-
|
|
211
|
+
margin-left: calc(var(--icon-optical-inset) * -1);
|
|
212
|
+
margin-right: var(--icon-gap);
|
|
206
213
|
}
|
|
207
214
|
}
|
|
208
215
|
|
|
209
216
|
&.button--icon-right {
|
|
210
217
|
zn-icon {
|
|
211
|
-
margin-left: var(--
|
|
218
|
+
margin-left: var(--icon-gap);
|
|
219
|
+
margin-right: calc(var(--icon-optical-inset) * -1);
|
|
212
220
|
}
|
|
213
221
|
}
|
|
214
222
|
}
|