Skip to content

Commit ed6ab8b

Browse files
authored
Merge branch 'main' into unit-format
2 parents e36ea03 + 224ec91 commit ed6ab8b

19 files changed

Lines changed: 199 additions & 86 deletions

File tree

beachball.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ module.exports = {
1010
return `- ${entry.comment} ([ni/nimble@${entry.commit.substring(0, 7)}](https://github.com/ni/nimble/commit/${entry.commit}))`;
1111
}
1212
}
13-
}
13+
},
14+
ignorePatterns: [
15+
'**/docs/**',
16+
'**/specs/**',
17+
'**/tests/**',
18+
]
1419
};

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-workspace/nimble-react/CHANGELOG.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
{
22
"name": "@ni/nimble-react",
33
"entries": [
4+
{
5+
"date": "Thu, 15 Jan 2026 05:18:11 GMT",
6+
"version": "0.10.0",
7+
"tag": "@ni/nimble-react_v0.10.0",
8+
"comments": {
9+
"minor": [
10+
{
11+
"author": "1588923+rajsite@users.noreply.github.com",
12+
"package": "@ni/nimble-react",
13+
"commit": "414a6b5000e34f9a3cb6bc8c7594f05dec69e277",
14+
"comment": "Create fromDialogRef, fromDrawerRef, and fromTableRef helpers"
15+
}
16+
]
17+
}
18+
},
419
{
520
"date": "Fri, 02 Jan 2026 06:16:54 GMT",
621
"version": "0.9.0",

packages/react-workspace/nimble-react/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# Change Log - @ni/nimble-react
22

3-
<!-- This log was last generated on Fri, 02 Jan 2026 06:16:54 GMT and should not be manually modified. -->
3+
<!-- This log was last generated on Thu, 15 Jan 2026 05:18:11 GMT and should not be manually modified. -->
44

55
<!-- Start content -->
66

7+
## 0.10.0
8+
9+
Thu, 15 Jan 2026 05:18:11 GMT
10+
11+
### Minor changes
12+
13+
- Create fromDialogRef, fromDrawerRef, and fromTableRef helpers ([ni/nimble@414a6b5](https://github.com/ni/nimble/commit/414a6b5000e34f9a3cb6bc8c7594f05dec69e277))
14+
715
## 0.9.0
816

917
Fri, 02 Jan 2026 06:16:54 GMT

packages/react-workspace/nimble-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ni/nimble-react",
3-
"version": "0.9.0",
3+
"version": "0.10.0",
44
"description": "React components for the NI Nimble Design System",
55
"keywords": [
66
"ni",
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import { Dialog, UserDismissed as DialogUserDismissed } from '@ni/nimble-components/dist/esm/dialog';
2-
import type { LegacyRef } from 'react';
2+
import type { RefAttributes, RefObject } from 'react';
33
import { wrap } from '../utilities/react-wrapper';
44

55
export { type Dialog, DialogUserDismissed };
66
export const NimbleDialog = wrap(Dialog);
77

8-
export type DialogRef = LegacyRef<Dialog>;
8+
/**
9+
* Helper to assign Dialog refs with generics to ref bindings
10+
* See: https://github.com/ni/nimble/issues/2784
11+
* @param dialogRef A ref to a dialog created with `useRef`
12+
* @returns A ref type compatible with normal `ref` bindings
13+
*/
14+
export const fromDialogRef = <T>(dialogRef: RefObject<Dialog<T> | null>): RefAttributes<Dialog>['ref'] => dialogRef as RefAttributes<Dialog>['ref'];
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import { Drawer, UserDismissed as DrawerUserDismissed } from '@ni/nimble-components/dist/esm/drawer';
22
import { DrawerLocation } from '@ni/nimble-components/dist/esm/drawer/types';
3-
import type { LegacyRef } from 'react';
3+
import type { RefAttributes, RefObject } from 'react';
44
import { wrap } from '../utilities/react-wrapper';
55

66
export { type Drawer, DrawerUserDismissed, DrawerLocation };
77
export const NimbleDrawer = wrap(Drawer);
88

9-
export type DrawerRef = LegacyRef<Drawer>;
9+
/**
10+
* Helper to assign Drawer refs with generics to ref bindings
11+
* See: https://github.com/ni/nimble/issues/2784
12+
* @param drawerRef A ref to a drawer created with `useRef`
13+
* @returns A ref type compatible with normal `ref` bindings
14+
*/
15+
export const fromDrawerRef = <T>(drawerRef: RefObject<Drawer<T> | null>): RefAttributes<Drawer>['ref'] => drawerRef as RefAttributes<Drawer>['ref'];

packages/react-workspace/nimble-react/src/table/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
TableRecord,
88
TableSetRecordHierarchyOptions
99
} from '@ni/nimble-components/dist/esm/table/types';
10-
import type { LegacyRef } from 'react';
10+
import type { RefAttributes, RefObject } from 'react';
1111
import { wrap, type EventName } from '../utilities/react-wrapper';
1212

1313
export { type Table, type TableRecord, type TableSetRecordHierarchyOptions };
@@ -36,4 +36,10 @@ export interface TableRowExpandToggleEvent extends CustomEvent<TableRowExpansion
3636
target: Table;
3737
}
3838

39-
export type TableRef = LegacyRef<Table>;
39+
/**
40+
* Helper to assign Table refs with generics to ref bindings
41+
* See: https://github.com/ni/nimble/issues/2784
42+
* @param tableRef A ref to a table created with `useRef`
43+
* @returns A ref type compatible with normal `ref` bindings
44+
*/
45+
export const fromTableRef = <T extends TableRecord>(tableRef: RefObject<Table<T> | null>): RefAttributes<Table>['ref'] => tableRef as RefAttributes<Table>['ref'];

packages/react-workspace/react-client-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"scripts": {
77
"start": "vite",
88
"build": "tsc -b && vite build",
9-
"test": "tsc -p ./tsconfig.legacy.json",
109
"lint": "eslint .",
1110
"format": "eslint . --fix",
1211
"pack": "npm pack"

packages/react-workspace/react-client-app/src/components/App.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { NimbleCheckbox } from '@ni/nimble-react/checkbox';
1616
import { NimbleRadioGroup } from '@ni/nimble-react/radio-group';
1717
import { NimbleRadio } from '@ni/nimble-react/radio';
1818
import { NimbleTextField } from '@ni/nimble-react/text-field';
19-
import { NimbleDialog, type Dialog, type DialogRef, DialogUserDismissed } from '@ni/nimble-react/dialog';
20-
import { NimbleDrawer, type Drawer, type DrawerRef, DrawerUserDismissed, DrawerLocation } from '@ni/nimble-react/drawer';
19+
import { NimbleDialog, type Dialog, DialogUserDismissed, fromDialogRef } from '@ni/nimble-react/dialog';
20+
import { NimbleDrawer, type Drawer, DrawerUserDismissed, DrawerLocation, fromDrawerRef } from '@ni/nimble-react/drawer';
2121
import { NimbleMenu } from '@ni/nimble-react/menu';
2222
import { NimbleMenuItem, type MenuItemChangeEvent } from '@ni/nimble-react/menu-item';
2323
import { NimbleAnchorMenuItem } from '@ni/nimble-react/anchor-menu-item';
@@ -27,7 +27,7 @@ import { NimbleIconCheck } from '@ni/nimble-react/icons/check';
2727
import { NimbleIconXmarkCheck } from '@ni/nimble-react/icons/xmark-check';
2828
import { NimbleSpinner } from '@ni/nimble-react/spinner';
2929
import { NimbleSwitch } from '@ni/nimble-react/switch';
30-
import { NimbleTable, type Table, type TableRef, type TableRowExpandToggleEvent, type TableRecord, type TableSetRecordHierarchyOptions } from '@ni/nimble-react/table';
30+
import { NimbleTable, type Table, type TableRowExpandToggleEvent, type TableRecord, type TableSetRecordHierarchyOptions, fromTableRef } from '@ni/nimble-react/table';
3131
import { NimbleTableColumnText } from '@ni/nimble-react/table-column/text';
3232
import { NimbleTableColumnAnchor } from '@ni/nimble-react/table-column/anchor';
3333
import { NimbleTableColumnDateText } from '@ni/nimble-react/table-column/date-text';
@@ -668,9 +668,7 @@ export function App(): React.JSX.Element {
668668
<div className="sub-container">
669669
<div className="container-label">Dialog</div>
670670
<NimbleDialog
671-
// Note: Generic types such as Dialog require using the workaround ref type
672-
// See: https://github.com/ni/nimble/issues/2784
673-
ref={dialogRef as unknown as DialogRef}
671+
ref={fromDialogRef(dialogRef)}
674672
>
675673
<span slot="title">This is a dialog</span>
676674
<div>It opened when you pushed the button</div>
@@ -691,9 +689,7 @@ export function App(): React.JSX.Element {
691689
<div className="sub-container">
692690
<div className="container-label">Drawer</div>
693691
<NimbleDrawer
694-
// Note: Generic types such as Drawer require using the workaround ref type
695-
// See: https://github.com/ni/nimble/issues/2784
696-
ref={drawerRef as unknown as DrawerRef}
692+
ref={fromDrawerRef(drawerRef)}
697693
location={drawerLocation}
698694
>
699695
<header>This is a drawer</header>
@@ -931,9 +927,7 @@ export function App(): React.JSX.Element {
931927
<div className="sub-container">
932928
<div className="container-label">Table</div>
933929
<NimbleTable
934-
// Note: Generic types such as Table require using the workaround ref type
935-
// See: https://github.com/ni/nimble/issues/2784
936-
ref={tableRef as unknown as TableRef}
930+
ref={fromTableRef(tableRef)}
937931
idFieldName="id"
938932
parentIdFieldName="parentId"
939933
selectionMode="multiple"
@@ -1028,9 +1022,7 @@ export function App(): React.JSX.Element {
10281022
<div className="sub-container">
10291023
<div className="container-label">Table with delayed hierarchy</div>
10301024
<NimbleTable
1031-
// Note: Generic types such as Table require using the workaround ref type
1032-
// See: https://github.com/ni/nimble/issues/2784
1033-
ref={delayedHierarchyTableRef as unknown as TableRef}
1025+
ref={fromTableRef(delayedHierarchyTableRef)}
10341026
idFieldName="id" parentIdFieldName="parentId" selectionMode="multiple"
10351027
onRowExpandToggle={onRowExpandToggle}
10361028
>

0 commit comments

Comments
 (0)