Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
016dd15
Add OK basic slider component
Copilot Aug 28, 2026
b0cb180
Add OK React slider wrapper
Copilot Aug 28, 2026
dbbf9a5
Scope slider to TestHub namespace
Copilot Aug 29, 2026
3577776
Align slider visuals with switch
Copilot Aug 29, 2026
ae9ad82
Add slider value feedback
Copilot Aug 29, 2026
8d2ec57
Refine slider thumb and labels
Copilot Aug 29, 2026
26c2893
Keep slider value stable on hover
Copilot Aug 29, 2026
10dd851
Make slider width responsive
Copilot Aug 29, 2026
971f1dc
Make vertical slider height responsive
Copilot Aug 29, 2026
aa40e11
Document slider minimum length
Copilot Aug 29, 2026
0d040d0
Match slider fill to pressed thumb
Copilot Aug 29, 2026
63b7623
Minor fixes.
atmgrifter00 Aug 29, 2026
6176c12
Remove unused slider token import
Copilot Aug 29, 2026
179c2e2
Show slider range labels while active
Copilot Aug 29, 2026
3e5bf1f
Add slider coverage and CSS convention fixes
Copilot Aug 30, 2026
e628e36
Clarify disabled slider hover styles
Copilot Aug 30, 2026
b563e06
Address slider review clarity
Copilot Aug 30, 2026
80ad2d9
Simplify slider test fixtures
Copilot Aug 30, 2026
e370db1
Combine slider orientation matrix states
Copilot Aug 30, 2026
e3860f3
Name slider matrix size
Copilot Aug 30, 2026
00ca867
Disable Vite HMR in karma config to fix flaky test disconnects
Copilot Aug 30, 2026
dfea43a
Revert nimble-components test workaround
Copilot Aug 30, 2026
e93ac86
Matrix test label style fix
atmgrifter00 Aug 30, 2026
03fdb3f
Fix vertical slider.
atmgrifter00 Aug 30, 2026
4223a27
Add `showMinMax` and fix some styling issues.
atmgrifter00 Aug 30, 2026
bac0c01
Handling PR feedback.
atmgrifter00 Aug 30, 2026
18b1fa6
Merge branch 'main' into copilot/add-ok-component-for-fast-slider
atmgrifter00 Aug 30, 2026
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 .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
/**/Ts/** @jattasNI

@rajsite rajsite Aug 30, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pretty much there. Question around accessing internal apis and gave some style feedback since was in the area but generally nimble owners won't be doing reviews of ok component content and focus on repo layout / infra.
Other repo layout considerations:

/**/fv/** @jattasNI @fredvisser
/**/Fv/** @jattasNI @fredvisser
/**/th/** @atmgrifter00
/**/Th/** @atmgrifter00
/packages/nimble-tokens @rajsite @jattasNI @fredvisser
/packages/storybook/.storybook @rajsite @jattasNI @fredvisser

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Totally up to you whether these are in scope, but a few things I noticed that might be useful for others:

  1. label
  2. error state
  3. Angular wrappers
  4. Blazor wrappers

"type": "minor",
"comment": "Add the TestHub slider component",
"packageName": "@ni/ok-components",
"email": "198982749+Copilot@users.noreply.github.com",
"dependentChangeType": "none"
}
7 changes: 7 additions & 0 deletions change/@ni-ok-react-7f04b43d-439e-4848-b394-511e0909be4d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Comment thread
atmgrifter00 marked this conversation as resolved.
"type": "minor",
"comment": "Add React wrapper for the TestHub slider",
"packageName": "@ni/ok-react",
"email": "198982749+Copilot@users.noreply.github.com",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/ok-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@ni/fast-foundation": "^10.2.5",
"@ni/fast-web-utilities": "^10.0.0",
"@ni/nimble-components": "^35.13.0",
"@ni/nimble-tokens": "^8.19.0",
"@ni/spright-components": "^6.22.0",
"tslib": "^2.2.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/ok-components/src/all-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import '@ni/spright-components/dist/esm/all-components';

import './th/all-th';
import './fv/all-fv';
import './ex/all-ex';
import './ts/all-ts';
1 change: 1 addition & 0 deletions packages/ok-components/src/th/all-th.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './slider';
111 changes: 111 additions & 0 deletions packages/ok-components/src/th/slider/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { attr } from '@ni/fast-element';
import {
DesignSystem,
Slider as FoundationSlider,
type SliderOptions
} from '@ni/fast-foundation';
import { Orientation } from '@ni/fast-web-utilities';
import { styles } from './styles';
import { template } from './template';
import { ThSliderShowMinMax } from './types';

export { ThSliderShowMinMax };

interface FoundationSliderInternals {
calculateNewValue: (rawValue: number) => number;
convertToConstrainedValue: (value: number) => number;
}

declare global {
interface HTMLElementTagNameMap {
'ok-th-slider': ThSlider;
}
}

/**
* A Nimble-styled slider control.
*/
export class ThSlider extends FoundationSlider {
/**
* Whether the current value is displayed next to the thumb.
*/
@attr({ attribute: 'value-visible', mode: 'boolean' })
public valueVisible = false;

/**
* Controls when the minimum and maximum value labels are displayed.
*/
@attr({ attribute: 'show-min-max' })
public showMinMax: ThSliderShowMinMax = ThSliderShowMinMax.hover;

/** @internal */
public valueLabel?: HTMLSpanElement;

private verticalMappingInitialized = false;

/** @internal */
public override connectedCallback(): void {
super.connectedCallback();

if (!this.verticalMappingInitialized) {
const internals = this as unknown as FoundationSliderInternals;
const calculateFoundationValue = internals.calculateNewValue;
internals.calculateNewValue = rawValue => calculateFoundationValue(
this.orientation === Orientation.vertical
? this.trackMinHeight + this.trackHeight - rawValue
: rawValue
);
this.verticalMappingInitialized = true;
}

this.updateValueLabel();
}

/** @internal */
public override valueChanged(previous: string, next: string): void {
super.valueChanged(previous, next);
this.updateValueLabel();
}

/** @internal */
public override increment(): void {
if (this.orientation !== Orientation.vertical) {
super.increment();
return;
}

this.setVerticalValue(Number(this.value) + Number(this.step));
}

/** @internal */
public override decrement(): void {
if (this.orientation !== Orientation.vertical) {
super.decrement();
return;
}

this.setVerticalValue(Number(this.value) - Number(this.step));
}

private setVerticalValue(value: number): void {
const internals = this as unknown as FoundationSliderInternals;
const constrainedValue = internals.convertToConstrainedValue(value);
this.value = `${Math.min(this.max, Math.max(this.min, constrainedValue))}`;
}

private updateValueLabel(): void {
if (this.valueLabel) {
this.valueLabel.textContent = this.value;
}
}
}

const okThSlider = ThSlider.compose<SliderOptions>({
baseName: 'th-slider',
baseClass: FoundationSlider,
template,
styles
});

DesignSystem.getOrCreate().withPrefix('ok').register(okThSlider());
export const thSliderTag = 'ok-th-slider';
Loading