vira 32.0.0 → 32.1.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.
@@ -12,6 +12,8 @@ import { ViraThemeColorName } from '../styles/vira-color-theme-object.js';
12
12
  export declare const ViraButton: import("element-vir").DeclarativeElementDefinition<"vira-button", PartialWithUndefined<{
13
13
  text: string;
14
14
  icon: Readonly<ViraIconSvg>;
15
+ /** An optional icon rendered after the button text. */
16
+ rightSideIcon: Readonly<ViraIconSvg>;
15
17
  /** @default false */
16
18
  isDisabled: boolean;
17
19
  /**
@@ -35,10 +37,4 @@ export declare const ViraButton: import("element-vir").DeclarativeElementDefinit
35
37
  * @default ViraColorVariant.Plain
36
38
  */
37
39
  color: ViraColorVariant | ViraThemeColorName;
38
- /**
39
- * Set to `true` to render `icon` after `text` instead of before it.
40
- *
41
- * @default false
42
- */
43
- showIconOnRight: boolean;
44
40
  }>, {}, {}, "vira-button-color-red" | "vira-button-color-yellow" | "vira-button-color-green" | "vira-button-color-blue" | "vira-button-color-brand" | "vira-button-color-purple" | "vira-button-color-plain" | "vira-button-color-neutral" | "vira-button-color-teal" | "vira-button-color-pink" | "vira-button-color-grey" | "vira-button-disabled" | "vira-button-icon-only" | "vira-button-size-large" | "vira-button-size-medium" | "vira-button-size-small" | "vira-button-emphasis-standard" | "vira-button-emphasis-subtle", "vira-button-text-color" | "vira-button-background-color" | "vira-button-border-color" | "vira-button-hover-text-color" | "vira-button-hover-background-color" | "vira-button-hover-border-color" | "vira-button-active-text-color" | "vira-button-active-background-color" | "vira-button-active-border-color" | "vira-button-disabled-text-color" | "vira-button-disabled-background-color" | "vira-button-disabled-border-color" | "vira-button-border-width" | "vira-button-border-radius", readonly [], readonly []>;
@@ -166,7 +166,7 @@ export const ViraButton = defineViraElement()({
166
166
  return !!inputs.isDisabled;
167
167
  },
168
168
  'vira-button-icon-only'({ inputs }) {
169
- return !inputs.text && !!inputs.icon;
169
+ return !inputs.text && (!!inputs.icon || !!inputs.rightSideIcon);
170
170
  },
171
171
  },
172
172
  cssVars: {
@@ -368,13 +368,6 @@ export const ViraButton = defineViraElement()({
368
368
  `;
369
369
  },
370
370
  render({ inputs }) {
371
- const iconTemplate = inputs.icon
372
- ? html `
373
- <${ViraIcon.assign({
374
- icon: inputs.icon,
375
- })}></${ViraIcon}>
376
- `
377
- : nothing;
378
371
  const textTemplate = inputs.text
379
372
  ? html `
380
373
  <span class="text-template">${inputs.text}</span>
@@ -383,15 +376,23 @@ export const ViraButton = defineViraElement()({
383
376
  <span class="empty-text">&nbsp;</span>
384
377
  `;
385
378
  /* Both templates are interpolated with no whitespace between them so `+` selectors match. */
386
- const templates = inputs.showIconOnRight
387
- ? [
388
- textTemplate,
389
- iconTemplate,
390
- ]
391
- : [
392
- iconTemplate,
393
- textTemplate,
394
- ];
379
+ const templates = [
380
+ inputs.icon
381
+ ? html `
382
+ <${ViraIcon.assign({
383
+ icon: inputs.icon,
384
+ })}></${ViraIcon}>
385
+ `
386
+ : nothing,
387
+ textTemplate,
388
+ inputs.rightSideIcon
389
+ ? html `
390
+ <${ViraIcon.assign({
391
+ icon: inputs.rightSideIcon,
392
+ })}></${ViraIcon}>
393
+ `
394
+ : nothing,
395
+ ];
395
396
  return html `
396
397
  <button ?disabled=${inputs.isDisabled}>${templates}</button>
397
398
  `;
@@ -373,7 +373,6 @@ export const ViraInput = defineViraElement()({
373
373
  <input
374
374
  id=${ifDefined(inputs.label ? state.randomId : undefined)}
375
375
  aria-label=${ifDefined(inputs.label || undefined)}
376
- autofocus=${false}
377
376
  type=${calculateEffectiveInputType(inputs.type, state.showPassword)}
378
377
  style=${forcedInputWidthStyles}
379
378
  autocomplete=${ifDefined(shouldBlockBrowserHelps ? 'off' : undefined)}
@@ -5,6 +5,7 @@ import { classMap, css, defineElementEvent, html, listen, nothing, onDomCreated,
5
5
  import { routeHasPaths, } from 'spa-router-vir';
6
6
  import { themeDefaultKey } from 'theme-vir/dist/color-theme/color-theme.js';
7
7
  import { ChevronDown16Icon } from '../icons/icon-svgs/16/chevron-down-16.icon.js';
8
+ import { Check24Icon } from '../icons/icon-svgs/24/check-24.icon.js';
8
9
  import { createFocusStyles } from '../styles/focus.js';
9
10
  import { viraFontCssVars } from '../styles/font.js';
10
11
  import { viraFormCssVars } from '../styles/form-styles.js';
@@ -757,13 +758,13 @@ export const ViraTabs = defineViraElement()({
757
758
  /**
758
759
  * Hidden copies of the "more" button in each of its possible shapes, rendered inside the
759
760
  * measurement mirror so their true widths can be measured before choosing which one fits:
760
- * the default overflow label, and the collapsed selected tab's own label, with a caret.
761
+ * the default overflow label, and the collapsed selected tab's own label (with a checkmark
762
+ * and caret).
761
763
  */
762
764
  const measureMoreButtons = html `
763
765
  <${ViraButton.assign({
764
766
  text: overflowLabel,
765
- icon: ChevronDown16Icon,
766
- showIconOnRight: true,
767
+ rightSideIcon: ChevronDown16Icon,
767
768
  color: ViraColorVariant.Neutral,
768
769
  })}
769
770
  class="measure-more-default"
@@ -772,8 +773,8 @@ export const ViraTabs = defineViraElement()({
772
773
  ? html `
773
774
  <${ViraButton.assign({
774
775
  text: selectedTab.label,
775
- icon: ChevronDown16Icon,
776
- showIconOnRight: true,
776
+ icon: Check24Icon,
777
+ rightSideIcon: ChevronDown16Icon,
777
778
  color: ViraColorVariant.Neutral,
778
779
  })}
779
780
  class="measure-more-labeled"
@@ -792,8 +793,8 @@ export const ViraTabs = defineViraElement()({
792
793
  })}>
793
794
  <${ViraButton.assign({
794
795
  text: selectedIsCollapsed ? selectedTab?.label : overflowLabel,
795
- icon: ChevronDown16Icon,
796
- showIconOnRight: true,
796
+ icon: selectedIsCollapsed ? Check24Icon : undefined,
797
+ rightSideIcon: ChevronDown16Icon,
797
798
  color: ViraColorVariant.Neutral,
798
799
  })}
799
800
  slot=${ViraMenuTrigger.slotNames['vira-menu-trigger-trigger']}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "32.0.0",
3
+ "version": "32.1.1",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",