vira 30.2.1 → 30.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.
@@ -32,4 +32,10 @@ export declare const ViraButton: import("element-vir").DeclarativeElementDefinit
32
32
  * @default false
33
33
  */
34
34
  expandToFitIcon: boolean;
35
- }>, {}, {}, "vira-button-outline-style" | "vira-button-danger-style" | "vira-button-ghost-style" | "vira-button-disabled" | "vira-button-expand-to-fit-icon" | "vira-button-icon-only" | "vira-button-plain-style" | "vira-button-default-style", "vira-button-padding" | "vira-button-internal-foreground-color" | "vira-button-internal-background-color" | "vira-button-border-color", readonly [], readonly []>;
35
+ /**
36
+ * If `true`, a menu trigger caret (like in ViraDropdown or ViraSelect) is rendered.
37
+ *
38
+ * @default false
39
+ */
40
+ showMenuCaret: boolean;
41
+ }>, {}, {}, "vira-button-outline-style" | "vira-button-danger-style" | "vira-button-ghost-style" | "vira-button-disabled" | "vira-button-expand-to-fit-icon" | "vira-button-icon-only" | "vira-button-plain-style" | "vira-button-default-style" | "vira-button-with-menu-caret", "vira-button-padding" | "vira-button-internal-foreground-color" | "vira-button-internal-background-color" | "vira-button-border-color", readonly [], readonly []>;
@@ -1,4 +1,5 @@
1
1
  import { css, html, nothing } from 'element-vir';
2
+ import { ChevronDown24Icon } from '../icons/index.js';
2
3
  import { viraDisabledStyles } from '../styles/disabled.js';
3
4
  import { viraAnimationDurations } from '../styles/durations.js';
4
5
  import { createFocusStyles } from '../styles/focus.js';
@@ -41,6 +42,7 @@ export const ViraButton = defineViraElement()({
41
42
  'vira-button-icon-only': ({ inputs }) => !!inputs.icon && !inputs.text,
42
43
  'vira-button-plain-style': ({ inputs }) => inputs.buttonStyle === ViraButtonStyle.Plain,
43
44
  'vira-button-default-style': ({ inputs }) => !inputs.buttonStyle || inputs.buttonStyle === ViraButtonStyle.Default,
45
+ 'vira-button-with-menu-caret': ({ inputs }) => !!inputs.showMenuCaret,
44
46
  },
45
47
  cssVars: {
46
48
  'vira-button-padding': '5px 10px',
@@ -176,6 +178,16 @@ export const ViraButton = defineViraElement()({
176
178
  align-items: center;
177
179
  }
178
180
  }
181
+
182
+ .caret-icon {
183
+ padding-left: 4px;
184
+ }
185
+
186
+ ${hostClasses['vira-button-with-menu-caret'].selector} {
187
+ button {
188
+ padding-right: 4px;
189
+ }
190
+ }
179
191
  `,
180
192
  render: ({ inputs }) => {
181
193
  const iconTemplate = inputs.icon
@@ -192,8 +204,19 @@ export const ViraButton = defineViraElement()({
192
204
  : html `
193
205
  <span class="empty-text">&nbsp;</span>
194
206
  `;
207
+ const caretIconTemplate = inputs.showMenuCaret
208
+ ? html `
209
+ <${ViraIcon.assign({
210
+ icon: ChevronDown24Icon,
211
+ })}
212
+ class="caret-icon"
213
+ ></${ViraIcon}>
214
+ `
215
+ : nothing;
195
216
  return html `
196
- <button ?disabled=${inputs.disabled}>${iconTemplate} ${textTemplate}</button>
217
+ <button ?disabled=${inputs.disabled}>
218
+ ${iconTemplate}${textTemplate}${caretIconTemplate}
219
+ </button>
197
220
  `;
198
221
  },
199
222
  });
@@ -12,7 +12,6 @@ import { viraThemeByKeys } from '../styles/vira-color-theme-object.js';
12
12
  import { viraTheme } from '../styles/vira-color-theme.js';
13
13
  import { defineViraElement } from '../util/define-vira-element.js';
14
14
  import { ViraIcon } from './vira-icon.element.js';
15
- // need to add hover colors to unchecked tags
16
15
  function generateThemeCss(colorVariant) {
17
16
  if (!check.hasKey(viraColorVariantToColorName, colorVariant)) {
18
17
  throw new Error(`No ViraTag color for variant '${colorVariant}'`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "30.2.1",
3
+ "version": "30.3.0",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",