vira 26.4.0 → 26.4.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.
@@ -1,8 +1,8 @@
1
1
  import { type PartialWithUndefined } from '@augment-vir/common';
2
2
  /**
3
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.
4
+ * alternative that supports custom styling in _all_ browsers via CSS vars _and_ prevents background
5
+ * bleed.
6
6
  *
7
7
  * @category Progress
8
8
  * @category Elements
@@ -1,9 +1,10 @@
1
+ import { clamp } from '@augment-vir/common';
1
2
  import { css, html } from 'element-vir';
2
3
  import { defineViraElement } from './define-vira-element.js';
3
4
  /**
4
5
  * 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.
6
+ * alternative that supports custom styling in _all_ browsers via CSS vars _and_ prevents background
7
+ * bleed.
7
8
  *
8
9
  * @category Progress
9
10
  * @category Elements
@@ -28,18 +29,20 @@ export const ViraProgress = defineViraElement()({
28
29
  height: 10px;
29
30
  display: inline-flex;
30
31
  align-items: center;
31
- background-color: ${cssVars['vira-progress-background-color'].value};
32
32
  border-radius: ${cssVars['vira-progress-border-radius'].value};
33
33
  color: ${cssVars['vira-progress-foreground-color'].value};
34
+ overflow: hidden;
34
35
  }
35
36
 
36
37
  .progress-bar {
37
38
  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;
39
+ height: 100%;
40
+ }
41
+
42
+ .background-bar {
43
+ background-color: ${cssVars['vira-progress-background-color'].value};
44
+ height: 100%;
45
+ flex-grow: 1;
43
46
  }
44
47
  `,
45
48
  render({ inputs }) {
@@ -47,14 +50,19 @@ export const ViraProgress = defineViraElement()({
47
50
  const max = inputs.max || 100;
48
51
  const totalRange = max - min;
49
52
  const value = inputs.value - min;
50
- const percentFull = Math.round((value / totalRange) * 100);
53
+ const percentFull = clamp(Math.round((value / totalRange) * 100), { min: 0, max: 100 });
51
54
  return html `
52
55
  <div
53
56
  class="progress-bar"
54
- style=${css `
55
- width: calc(${percentFull}% + 1px);
56
- `}
57
+ style=${percentFull
58
+ ? css `
59
+ width: ${percentFull}%;
60
+ `
61
+ : css `
62
+ display: none;
63
+ `}
57
64
  ></div>
65
+ <div class="background-bar"></div>
58
66
  `;
59
67
  },
60
68
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "26.4.0",
3
+ "version": "26.4.1",
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.4.0"
70
+ "element-vir": "^26.4.1"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=22"