vira 26.3.1 → 26.4.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.
@@ -14,3 +14,4 @@ export * from './vira-icon.element.js';
14
14
  export * from './vira-image.element.js';
15
15
  export * from './vira-input.element.js';
16
16
  export * from './vira-link.element.js';
17
+ export * from './vira-progress.element.js';
@@ -14,3 +14,4 @@ export * from './vira-icon.element.js';
14
14
  export * from './vira-image.element.js';
15
15
  export * from './vira-input.element.js';
16
16
  export * from './vira-link.element.js';
17
+ export * from './vira-progress.element.js';
@@ -0,0 +1,18 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
2
+ /**
3
+ * A [`<progress>`](https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/progress)
4
+ * alternative that supports custom styling in _all_ browsers via host styles or CSS variables _and_
5
+ * prevents background bleed-through on curved corners.
6
+ *
7
+ * @category Progress
8
+ * @category Elements
9
+ * @see https://electrovir.github.io/element-vir/vira/book/elements/vira-progress
10
+ */
11
+ export declare const ViraProgress: import("element-vir").DeclarativeElementDefinition<"vira-progress", Readonly<{
12
+ value: number;
13
+ } & PartialWithUndefined<{
14
+ /** @default 0 */
15
+ min: number;
16
+ /** @default 100 */
17
+ max: number;
18
+ }>>, {}, {}, "vira-progress-", "vira-progress-border-radius" | "vira-progress-background-color" | "vira-progress-foreground-color", readonly []>;
@@ -0,0 +1,60 @@
1
+ import { css, html } from 'element-vir';
2
+ import { defineViraElement } from './define-vira-element.js';
3
+ /**
4
+ * A [`<progress>`](https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/progress)
5
+ * alternative that supports custom styling in _all_ browsers via host styles or CSS variables _and_
6
+ * prevents background bleed-through on curved corners.
7
+ *
8
+ * @category Progress
9
+ * @category Elements
10
+ * @see https://electrovir.github.io/element-vir/vira/book/elements/vira-progress
11
+ */
12
+ export const ViraProgress = defineViraElement()({
13
+ tagName: 'vira-progress',
14
+ cssVars: {
15
+ /**
16
+ * The browser will automatically cap the border-radius at half of the element's smaller
17
+ * dimension which creates a perfect pill border radius.
18
+ */
19
+ 'vira-progress-border-radius': '99999999px',
20
+ 'vira-progress-background-color': '#eee',
21
+ 'vira-progress-foreground-color': 'dodgerblue',
22
+ },
23
+ styles: ({ cssVars }) => css `
24
+ :host {
25
+ /* Default width that can easily be overridden because it's applied on the host. */
26
+ width: 100px;
27
+ /* Default height that can easily be overridden because it's applied on the host. */
28
+ height: 10px;
29
+ display: inline-flex;
30
+ align-items: center;
31
+ background-color: ${cssVars['vira-progress-background-color'].value};
32
+ border-radius: ${cssVars['vira-progress-border-radius'].value};
33
+ color: ${cssVars['vira-progress-foreground-color'].value};
34
+ }
35
+
36
+ .progress-bar {
37
+ background-color: currentColor;
38
+ border-radius: calc(${cssVars['vira-progress-border-radius'].value} - 1px);
39
+ /* Add some extra pixels to prevent the background from bleeding through on the curved corners. */
40
+ height: calc(100% + 2px);
41
+ /* Overlap a bin on the left to prevent the background from bleeding through on the curved corners. */
42
+ margin-left: -1px;
43
+ }
44
+ `,
45
+ render({ inputs }) {
46
+ const min = inputs.min || 0;
47
+ const max = inputs.max || 100;
48
+ const totalRange = max - min;
49
+ const value = inputs.value - min;
50
+ const percentFull = Math.round((value / totalRange) * 100);
51
+ return html `
52
+ <div
53
+ class="progress-bar"
54
+ style=${css `
55
+ width: calc(${percentFull}% + 1px);
56
+ `}
57
+ ></div>
58
+ `;
59
+ },
60
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "26.3.1",
3
+ "version": "26.4.0",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",
@@ -67,7 +67,7 @@
67
67
  "vite-tsconfig-paths": "^5.1.4"
68
68
  },
69
69
  "peerDependencies": {
70
- "element-vir": "^26.3.1"
70
+ "element-vir": "^26.4.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=22"