Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/vale/styles/config/vocabularies/Elements/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,5 @@ spark line
spark lines
Alternatively
misprefixed
indicate
utilization
Comment on lines +361 to +362

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Missing nve-gauge vocabulary entry.

The new gauge.md doc page introduces the nve-gauge tag extensively, but it isn't added to the nve-* component-name list here (alphabetically it belongs between nve-file and nve-grid). This will likely cause Vale to flag the new docs.

📝 Proposed fix
 nve-file
+nve-gauge
 nve-grid

As per coding guidelines, "When Vale flags new technical terms, component names, or abbreviations as misspelled, add them to config/vale/styles/config/vocabularies/Elements/accept.txt."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config/vale/styles/config/vocabularies/Elements/accept.txt` around lines 361
- 362, Add the missing nve-gauge entry to the Elements vocabulary list in
accept.txt so Vale recognizes the new component name used by gauge.md. Keep it
in alphabetical order with the other nve-* entries, placing it between nve-file
and nve-grid, and ensure the list remains consistent with the component names
referenced in the docs.

Source: Coding guidelines

3 changes: 3 additions & 0 deletions projects/core/.visual/gauge.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions projects/core/.visual/gauge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions projects/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,18 @@
"types": "./dist/forms/define.d.ts",
"default": "./dist/forms/define.js"
},
"./gauge": {
"types": "./dist/gauge/index.d.ts",
"default": "./dist/gauge/index.js"
},
"./gauge/index.js": {
"types": "./dist/gauge/index.d.ts",
"default": "./dist/gauge/index.js"
},
"./gauge/define.js": {
"types": "./dist/gauge/define.d.ts",
"default": "./dist/gauge/define.js"
},
"./grid": {
"types": "./dist/grid/index.d.ts",
"default": "./dist/grid/index.js"
Expand Down
2 changes: 2 additions & 0 deletions projects/core/src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import '@nvidia-elements/core/format-datetime/define.js';
import '@nvidia-elements/core/format-number/define.js';
import '@nvidia-elements/core/format-relative-time/define.js';
import '@nvidia-elements/core/forms/define.js';
import '@nvidia-elements/core/gauge/define.js';
import '@nvidia-elements/core/grid/define.js';
import '@nvidia-elements/core/icon/define.js';
import '@nvidia-elements/core/icon-button/define.js';
Expand Down Expand Up @@ -99,6 +100,7 @@ export * from '@nvidia-elements/core/format-datetime';
export * from '@nvidia-elements/core/format-number';
export * from '@nvidia-elements/core/format-relative-time';
export * from '@nvidia-elements/core/forms';
export * from '@nvidia-elements/core/gauge';
export * from '@nvidia-elements/core/grid';
export * from '@nvidia-elements/core/icon';
export * from '@nvidia-elements/core/icon-button';
Expand Down
13 changes: 13 additions & 0 deletions projects/core/src/gauge/define.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { define } from '@nvidia-elements/core/internal';
import { Gauge } from '@nvidia-elements/core/gauge';

define(Gauge);

declare global {
interface HTMLElementTagNameMap {
'nve-gauge': Gauge;
}
}
223 changes: 223 additions & 0 deletions projects/core/src/gauge/gauge.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
/* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
/* SPDX-License-Identifier: Apache-2.0 */

:host {
--color: var(--nve-sys-text-emphasis-color);
--background: var(--nve-sys-interaction-background);
--needle-background: var(--nve-sys-interaction-color);
--accent-color: var(--nve-sys-interaction-color);
--thumb-background: var(--accent-color);
--track-background: var(--accent-color);
--track-width: 8px;
--font-size: var(--nve-ref-font-size-400);
--gap: var(--nve-ref-space-xs);
--width: 128px;
--height: calc(var(--width) * 0.8627);
--_animation-duration: var(--nve-ref-animation-duration-250);

display: inline-block;
position: relative;
width: var(--width);
height: var(--height);
container-type: inline-size;
contain: layout;
text-box: trim-both cap alphabetic;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

.fill-dot-start,
.fill-dot-end {
r: calc(var(--track-width) / 2.4);
}

:host([size='sm']) {
--font-size: var(--nve-ref-font-size-300);
--width: 96px;

.fill-dot-start,
.fill-dot-end {
r: calc(var(--track-width) / 1.8);
}
}

:host([size='lg']) {
--font-size: var(--nve-ref-font-size-500);
--width: 160px;

.fill-dot-start,
.fill-dot-end {
r: calc(var(--track-width) / 3);
}
}
Comment on lines +32 to +50

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Needle thumb doesn't scale with gauge size.

.fill-dot-start/.fill-dot-end get size-specific radius overrides in :host([size='sm']) and :host([size='lg']) (Lines 36-39, 46-49), but .needle-line stroke-width and .needle-hub radius (Lines 136-145) only derive from --track-width, which is never overridden per size. The needle thumb will look disproportionately large/small relative to the gauge at sm/lg sizes compared to the dot thumb.

Suggested fix
 :host([size='sm']) {
   --font-size: var(--nve-ref-font-size-300);
   --width: 96px;

   .fill-dot-start,
   .fill-dot-end {
     r: calc(var(--track-width) / 1.8);
   }
+
+  .needle-hub {
+    r: calc(var(--track-width) / 2.2);
+  }
 }

 :host([size='lg']) {
   --font-size: var(--nve-ref-font-size-500);
   --width: 160px;

   .fill-dot-start,
   .fill-dot-end {
     r: calc(var(--track-width) / 3);
   }
+
+  .needle-hub {
+    r: calc(var(--track-width) / 3.6);
+  }
 }

Also applies to: 136-145

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/core/src/gauge/gauge.css` around lines 32 - 50, The needle thumb
sizing in the Gauge component is not tied to the size variants, so `needle-line`
and `needle-hub` stay proportional only to the default track width while
`fill-dot-start` and `fill-dot-end` already override size. Update the
`gauge.css` size rules in `:host([size='sm'])` and `:host([size='lg'])` to also
override the sizing variables or direct styles used by `.needle-line` and
`.needle-hub`, keeping the needle thumb visually consistent with the dot thumb
across `sm` and `lg` sizes.


[internal-host] {
display: grid;
place-items: center;
position: relative;
height: 100%;
}

:host([shape='half']) {
--height: calc(var(--width) * 0.5313);
}

:host([shape='half']) [internal-host] {
place-items: end center;
}

svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
}

path {
fill: none;
stroke: white;
stroke-width: var(--track-width);
vector-effect: non-scaling-stroke;
}

path.background {
stroke-linecap: round;
}

path.gauge {
animation: gauge-progress-in var(--_animation-duration) var(--nve-ref-animation-easing-100);
stroke-linecap: butt;
stroke-dasharray: var(--_dash-progress) var(--_dash-gap);
transition: stroke-dasharray var(--_animation-duration) var(--nve-ref-animation-easing-100);
will-change: stroke-dasharray;
}

.background-surface,
.fill-surface {
inline-size: 100%;
block-size: 100%;
}

.background-surface {
background: var(--background);
}

.fill-surface {
background: var(--track-background);
}

.fill-dot-start {
fill: var(--track-background);
}

.fill-dot-end {
animation: gauge-dot-in var(--_animation-duration) var(--nve-ref-animation-easing-100);
fill: var(--thumb-background);
transform: rotate(var(--_dot-angle));
transform-box: view-box;
transform-origin: var(--_dot-origin);
transition: transform var(--_animation-duration) var(--nve-ref-animation-easing-100);
will-change: transform;
}

.fill-layer[hidden],
.fill-dot-start[hidden],
.fill-dot-end[hidden],
.needle[hidden] {
display: none;
}

.needle {
transform: rotate(var(--_needle-angle));
transform-box: view-box;
transform-origin: var(--_needle-origin);
will-change: transform;
}

.needle-line {
stroke: var(--needle-background);
stroke-linecap: round;
stroke-width: calc(var(--track-width) / 3);
}

.needle-hub {
fill: var(--needle-background);
r: calc(var(--track-width) / 3);
}

slot {
display: flex;
flex-direction: column;
place-items: center;
justify-content: center;
height: 100%;
gap: var(--gap);
color: var(--color);
font-size: var(--font-size);
font-weight: var(--nve-ref-font-weight-medium);
padding-block-start: calc(var(--track-width) * 2);
text-box: trim-both cap alphabetic;
line-height: 1;
}

:host([shape='half']) slot {
transform: translateY(1cqh);
}

:host([thumb='needle']) slot {
transform: translateY(1cqh);
justify-content: end;
}

:host([shape='half'][thumb='needle']) slot {
transform: translateY(2cqh);
}

::slotted(*) {
color: var(--color);
font-size: var(--font-size);
}
Comment on lines +175 to +178

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not override all consumer slotted typography.

::slotted(*) forces the same color and font-size onto every top-level child. That breaks multi-line content like projects/core/src/progress-gauge/progress-gauge.examples.ts Lines 110-113, where the secondary GPU label is explicitly marked nve-text="body sm muted" but will still render with the primary gauge text styling. Let the slot provide defaults via inheritance instead of restyling every assigned node.

Proposed fix
-::slotted(*) {
-  color: var(--color);
-  font-size: var(--font-size);
-}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
::slotted(*) {
color: var(--color);
font-size: var(--font-size);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/core/src/progress-gauge/progress-gauge.css` around lines 96 - 99,
The `::slotted(*)` rule in `progress-gauge.css` is overriding every assigned
child’s typography, including consumer-provided styles like the muted secondary
label in the progress gauge example. Remove the blanket `color` and `font-size`
application from the slot styling and let slotted content inherit defaults
instead, keeping any necessary styling scoped to the gauge’s internal elements
rather than all top-level slotted nodes.


:host([status='success']) {
--accent-color: var(--nve-sys-support-success-emphasis-color);
--background: var(--nve-sys-support-success-muted-color);
}

:host([status='warning']) {
--accent-color: var(--nve-sys-support-warning-emphasis-color);
--background: var(--nve-sys-support-warning-muted-color);
}

:host([status='danger']) {
--accent-color: var(--nve-sys-support-danger-emphasis-color);
--background: var(--nve-sys-support-danger-muted-color);
}

:host([status='accent']) {
--accent-color: var(--nve-sys-accent-secondary-background);
}

@media (prefers-reduced-motion: reduce) {
:host {
--_animation-duration: 0s;
}
}

@keyframes gauge-progress-in {
from {
stroke-dasharray: 0 var(--_dash-gap);
}

to {
stroke-dasharray: var(--_dash-progress) var(--_dash-gap);
}
}

@keyframes gauge-dot-in {
from {
transform: rotate(var(--_dot-start-angle));
}

to {
transform: rotate(var(--_dot-angle));
}
}
Loading