@ni/nimble-react 0.8.2 → 0.10.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.
@@ -1,5 +1,11 @@
1
1
  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';
3
3
  export { type Dialog, DialogUserDismissed };
4
4
  export declare const NimbleDialog: import("@lit/react").ReactWebComponent<Dialog<void>, {}>;
5
- export type DialogRef = LegacyRef<Dialog>;
5
+ /**
6
+ * Helper to assign Dialog refs with generics to ref bindings
7
+ * See: https://github.com/ni/nimble/issues/2784
8
+ * @param dialogRef A ref to a dialog created with `useRef`
9
+ * @returns A ref type compatible with normal `ref` bindings
10
+ */
11
+ export declare const fromDialogRef: <T>(dialogRef: RefObject<Dialog<T> | null>) => RefAttributes<Dialog>["ref"];
@@ -2,4 +2,11 @@ import { Dialog, UserDismissed as DialogUserDismissed } from '@ni/nimble-compone
2
2
  import { wrap } from '../utilities/react-wrapper';
3
3
  export { DialogUserDismissed };
4
4
  export const NimbleDialog = wrap(Dialog);
5
+ /**
6
+ * Helper to assign Dialog refs with generics to ref bindings
7
+ * See: https://github.com/ni/nimble/issues/2784
8
+ * @param dialogRef A ref to a dialog created with `useRef`
9
+ * @returns A ref type compatible with normal `ref` bindings
10
+ */
11
+ export const fromDialogRef = (dialogRef) => dialogRef;
5
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAErG,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAe,mBAAmB,EAAE,CAAC;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import { Dialog, UserDismissed as DialogUserDismissed } from '@ni/nimble-components/dist/esm/dialog';\nimport type { LegacyRef } from 'react';\nimport { wrap } from '../utilities/react-wrapper';\n\nexport { type Dialog, DialogUserDismissed };\nexport const NimbleDialog = wrap(Dialog);\n\nexport type DialogRef = LegacyRef<Dialog>;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAErG,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAe,mBAAmB,EAAE,CAAC;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAI,SAAsC,EAAgC,EAAE,CAAC,SAAyC,CAAC","sourcesContent":["import { Dialog, UserDismissed as DialogUserDismissed } from '@ni/nimble-components/dist/esm/dialog';\nimport type { RefAttributes, RefObject } from 'react';\nimport { wrap } from '../utilities/react-wrapper';\n\nexport { type Dialog, DialogUserDismissed };\nexport const NimbleDialog = wrap(Dialog);\n\n/**\n * Helper to assign Dialog refs with generics to ref bindings\n * See: https://github.com/ni/nimble/issues/2784\n * @param dialogRef A ref to a dialog created with `useRef`\n * @returns A ref type compatible with normal `ref` bindings\n */\nexport const fromDialogRef = <T>(dialogRef: RefObject<Dialog<T> | null>): RefAttributes<Dialog>['ref'] => dialogRef as RefAttributes<Dialog>['ref'];\n"]}
@@ -1,6 +1,12 @@
1
1
  import { Drawer, UserDismissed as DrawerUserDismissed } from '@ni/nimble-components/dist/esm/drawer';
2
2
  import { DrawerLocation } from '@ni/nimble-components/dist/esm/drawer/types';
3
- import type { LegacyRef } from 'react';
3
+ import type { RefAttributes, RefObject } from 'react';
4
4
  export { type Drawer, DrawerUserDismissed, DrawerLocation };
5
5
  export declare const NimbleDrawer: import("@lit/react").ReactWebComponent<Drawer<void>, {}>;
6
- export type DrawerRef = LegacyRef<Drawer>;
6
+ /**
7
+ * Helper to assign Drawer refs with generics to ref bindings
8
+ * See: https://github.com/ni/nimble/issues/2784
9
+ * @param drawerRef A ref to a drawer created with `useRef`
10
+ * @returns A ref type compatible with normal `ref` bindings
11
+ */
12
+ export declare const fromDrawerRef: <T>(drawerRef: RefObject<Drawer<T> | null>) => RefAttributes<Drawer>["ref"];
@@ -3,4 +3,11 @@ import { DrawerLocation } from '@ni/nimble-components/dist/esm/drawer/types';
3
3
  import { wrap } from '../utilities/react-wrapper';
4
4
  export { DrawerUserDismissed, DrawerLocation };
5
5
  export const NimbleDrawer = wrap(Drawer);
6
+ /**
7
+ * Helper to assign Drawer refs with generics to ref bindings
8
+ * See: https://github.com/ni/nimble/issues/2784
9
+ * @param drawerRef A ref to a drawer created with `useRef`
10
+ * @returns A ref type compatible with normal `ref` bindings
11
+ */
12
+ export const fromDrawerRef = (drawerRef) => drawerRef;
6
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAe,mBAAmB,EAAE,cAAc,EAAE,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import { Drawer, UserDismissed as DrawerUserDismissed } from '@ni/nimble-components/dist/esm/drawer';\nimport { DrawerLocation } from '@ni/nimble-components/dist/esm/drawer/types';\nimport type { LegacyRef } from 'react';\nimport { wrap } from '../utilities/react-wrapper';\n\nexport { type Drawer, DrawerUserDismissed, DrawerLocation };\nexport const NimbleDrawer = wrap(Drawer);\n\nexport type DrawerRef = LegacyRef<Drawer>;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAe,mBAAmB,EAAE,cAAc,EAAE,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAI,SAAsC,EAAgC,EAAE,CAAC,SAAyC,CAAC","sourcesContent":["import { Drawer, UserDismissed as DrawerUserDismissed } from '@ni/nimble-components/dist/esm/drawer';\nimport { DrawerLocation } from '@ni/nimble-components/dist/esm/drawer/types';\nimport type { RefAttributes, RefObject } from 'react';\nimport { wrap } from '../utilities/react-wrapper';\n\nexport { type Drawer, DrawerUserDismissed, DrawerLocation };\nexport const NimbleDrawer = wrap(Drawer);\n\n/**\n * Helper to assign Drawer refs with generics to ref bindings\n * See: https://github.com/ni/nimble/issues/2784\n * @param drawerRef A ref to a drawer created with `useRef`\n * @returns A ref type compatible with normal `ref` bindings\n */\nexport const fromDrawerRef = <T>(drawerRef: RefObject<Drawer<T> | null>): RefAttributes<Drawer>['ref'] => drawerRef as RefAttributes<Drawer>['ref'];\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Table } from '@ni/nimble-components/dist/esm/table';
2
2
  import type { TableActionMenuToggleEventDetail, TableRowExpansionToggleEventDetail, TableColumnConfigurationChangeEventDetail, TableRowSelectionEventDetail, TableRecord, TableSetRecordHierarchyOptions } from '@ni/nimble-components/dist/esm/table/types';
3
- import type { LegacyRef } from 'react';
3
+ import type { RefAttributes, RefObject } from 'react';
4
4
  import { type EventName } from '../utilities/react-wrapper';
5
5
  export { type Table, type TableRecord, type TableSetRecordHierarchyOptions };
6
6
  export declare const NimbleTable: import("@lit/react").ReactWebComponent<Table<TableRecord>, {
@@ -25,4 +25,10 @@ export interface TableColumnConfigurationChangeEvent extends CustomEvent<TableCo
25
25
  export interface TableRowExpandToggleEvent extends CustomEvent<TableRowExpansionToggleEventDetail> {
26
26
  target: Table;
27
27
  }
28
- export type TableRef = LegacyRef<Table>;
28
+ /**
29
+ * Helper to assign Table refs with generics to ref bindings
30
+ * See: https://github.com/ni/nimble/issues/2784
31
+ * @param tableRef A ref to a table created with `useRef`
32
+ * @returns A ref type compatible with normal `ref` bindings
33
+ */
34
+ export declare const fromTableRef: <T extends TableRecord>(tableRef: RefObject<Table<T> | null>) => RefAttributes<Table>["ref"];
@@ -10,4 +10,11 @@ export const NimbleTable = wrap(Table, {
10
10
  onRowExpandToggle: 'row-expand-toggle',
11
11
  }
12
12
  });
13
+ /**
14
+ * Helper to assign Table refs with generics to ref bindings
15
+ * See: https://github.com/ni/nimble/issues/2784
16
+ * @param tableRef A ref to a table created with `useRef`
17
+ * @returns A ref type compatible with normal `ref` bindings
18
+ */
19
+ export const fromTableRef = (tableRef) => tableRef;
13
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAU7D,OAAO,EAAE,IAAI,EAAkB,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAqE,CAAC;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE;IACnC,MAAM,EAAE;QACJ,wBAAwB,EAAE,0BAAyE;QACnG,kBAAkB,EAAE,oBAA6D;QACjF,iBAAiB,EAAE,kBAA0D;QAC7E,2BAA2B,EAAE,6BAA+E;QAC5G,iBAAiB,EAAE,mBAA2D;KACjF;CACJ,CAAC,CAAC","sourcesContent":["import { Table } from '@ni/nimble-components/dist/esm/table';\nimport type {\n TableActionMenuToggleEventDetail,\n TableRowExpansionToggleEventDetail,\n TableColumnConfigurationChangeEventDetail,\n TableRowSelectionEventDetail,\n TableRecord,\n TableSetRecordHierarchyOptions\n} from '@ni/nimble-components/dist/esm/table/types';\nimport type { LegacyRef } from 'react';\nimport { wrap, type EventName } from '../utilities/react-wrapper';\n\nexport { type Table, type TableRecord, type TableSetRecordHierarchyOptions };\nexport const NimbleTable = wrap(Table, {\n events: {\n onActionMenuBeforeToggle: 'action-menu-beforetoggle' as EventName<TableActionMenuBeforeToggleEvent>,\n onActionMenuToggle: 'action-menu-toggle' as EventName<TableActionMenuToggleEvent>,\n onSelectionChange: 'selection-change' as EventName<TableSelectionChangeEvent>,\n onColumnConfigurationChange: 'column-configuration-change' as EventName<TableColumnConfigurationChangeEvent>,\n onRowExpandToggle: 'row-expand-toggle' as EventName<TableRowExpandToggleEvent>,\n }\n});\nexport interface TableActionMenuBeforeToggleEvent extends CustomEvent<TableActionMenuToggleEventDetail> {\n target: Table;\n}\nexport interface TableActionMenuToggleEvent extends CustomEvent<TableActionMenuToggleEventDetail> {\n target: Table;\n}\nexport interface TableSelectionChangeEvent extends CustomEvent<TableRowSelectionEventDetail> {\n target: Table;\n}\nexport interface TableColumnConfigurationChangeEvent extends CustomEvent<TableColumnConfigurationChangeEventDetail> {\n target: Table;\n}\nexport interface TableRowExpandToggleEvent extends CustomEvent<TableRowExpansionToggleEventDetail> {\n target: Table;\n}\n\nexport type TableRef = LegacyRef<Table>;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAU7D,OAAO,EAAE,IAAI,EAAkB,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAqE,CAAC;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE;IACnC,MAAM,EAAE;QACJ,wBAAwB,EAAE,0BAAyE;QACnG,kBAAkB,EAAE,oBAA6D;QACjF,iBAAiB,EAAE,kBAA0D;QAC7E,2BAA2B,EAAE,6BAA+E;QAC5G,iBAAiB,EAAE,mBAA2D;KACjF;CACJ,CAAC,CAAC;AAiBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAwB,QAAoC,EAA+B,EAAE,CAAC,QAAuC,CAAC","sourcesContent":["import { Table } from '@ni/nimble-components/dist/esm/table';\nimport type {\n TableActionMenuToggleEventDetail,\n TableRowExpansionToggleEventDetail,\n TableColumnConfigurationChangeEventDetail,\n TableRowSelectionEventDetail,\n TableRecord,\n TableSetRecordHierarchyOptions\n} from '@ni/nimble-components/dist/esm/table/types';\nimport type { RefAttributes, RefObject } from 'react';\nimport { wrap, type EventName } from '../utilities/react-wrapper';\n\nexport { type Table, type TableRecord, type TableSetRecordHierarchyOptions };\nexport const NimbleTable = wrap(Table, {\n events: {\n onActionMenuBeforeToggle: 'action-menu-beforetoggle' as EventName<TableActionMenuBeforeToggleEvent>,\n onActionMenuToggle: 'action-menu-toggle' as EventName<TableActionMenuToggleEvent>,\n onSelectionChange: 'selection-change' as EventName<TableSelectionChangeEvent>,\n onColumnConfigurationChange: 'column-configuration-change' as EventName<TableColumnConfigurationChangeEvent>,\n onRowExpandToggle: 'row-expand-toggle' as EventName<TableRowExpandToggleEvent>,\n }\n});\nexport interface TableActionMenuBeforeToggleEvent extends CustomEvent<TableActionMenuToggleEventDetail> {\n target: Table;\n}\nexport interface TableActionMenuToggleEvent extends CustomEvent<TableActionMenuToggleEventDetail> {\n target: Table;\n}\nexport interface TableSelectionChangeEvent extends CustomEvent<TableRowSelectionEventDetail> {\n target: Table;\n}\nexport interface TableColumnConfigurationChangeEvent extends CustomEvent<TableColumnConfigurationChangeEventDetail> {\n target: Table;\n}\nexport interface TableRowExpandToggleEvent extends CustomEvent<TableRowExpansionToggleEventDetail> {\n target: Table;\n}\n\n/**\n * Helper to assign Table refs with generics to ref bindings\n * See: https://github.com/ni/nimble/issues/2784\n * @param tableRef A ref to a table created with `useRef`\n * @returns A ref type compatible with normal `ref` bindings\n */\nexport const fromTableRef = <T extends TableRecord>(tableRef: RefObject<Table<T> | null>): RefAttributes<Table>['ref'] => tableRef as RefAttributes<Table>['ref'];\n"]}
@@ -9,4 +9,4 @@ export function wrap(elementClass, options = {}) {
9
9
  tagName: customElements.getName(elementClass)
10
10
  });
11
11
  }
12
- //# sourceMappingURL=index.js.map
12
+ //# sourceMappingURL=react-wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-wrapper.js","sourceRoot":"","sources":["../../../src/utilities/react-wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,MAAM,YAAY,CAAC;AAW5C,MAAM,UAAU,IAAI,CAChB,YAA4B,EAC5B,UAAsB,EAAE;IAExB,OAAO,eAAe,CAAO;QACzB,GAAG,OAAO;QACV,YAAY;QACZ,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,YAAY,CAAE;KACjD,CAAC,CAAC;AACP,CAAC","sourcesContent":["import type { EventName, Options, ReactWebComponent } from '@lit/react';\nimport { createComponent } from '@lit/react';\nimport React from 'react';\n\nexport { type EventName } from '@lit/react';\nexport interface EventNames {\n [key: string]: EventName | string;\n}\n\ntype Constructor<T> = new () => T;\ntype Opts<\n I extends HTMLElement,\n E extends EventNames = NonNullable<unknown>\n> = Omit<Options<I, E>, 'elementClass' | 'react' | 'tagName'>;\n\nexport function wrap<I extends HTMLElement, E extends EventNames = NonNullable<unknown>>(\n elementClass: Constructor<I>,\n options: Opts<I, E> = {},\n): ReactWebComponent<I, E> {\n return createComponent<I, E>({\n ...options,\n elementClass,\n react: React,\n tagName: customElements.getName(elementClass)!\n });\n}\n"]}
package/package.json CHANGED
@@ -1,17 +1,38 @@
1
1
  {
2
2
  "name": "@ni/nimble-react",
3
- "version": "0.8.2",
3
+ "version": "0.10.0",
4
4
  "description": "React components for the NI Nimble Design System",
5
5
  "keywords": [
6
6
  "ni",
7
7
  "nimble",
8
8
  "react"
9
9
  ],
10
+ "type": "module",
11
+ "exports": {
12
+ "./package.json": "./package.json",
13
+ "./styles/*": "./styles/*",
14
+ "./icons/*": {
15
+ "types": "./dist/esm/icons/*.d.ts",
16
+ "import": "./dist/esm/icons/*.js"
17
+ },
18
+ "./*": {
19
+ "types": "./dist/esm/*.d.ts",
20
+ "import": "./dist/esm/*/index.js"
21
+ }
22
+ },
23
+ "typesVersions": {
24
+ "*": {
25
+ "icons/*": [
26
+ "dist/esm/icons/*.d.ts"
27
+ ],
28
+ "*": [
29
+ "dist/esm/*/index.d.ts"
30
+ ]
31
+ }
32
+ },
10
33
  "scripts": {
11
34
  "build": "npm run build:icons && npm run build:components",
12
- "build:icons": "npm run build:icons:bundle && npm run build:icons:run",
13
- "build:icons:bundle": "rollup --bundleConfigAsCjs --config build/generate-icons/rollup.config.js",
14
- "build:icons:run": "node build/generate-icons/dist/index.js",
35
+ "build:icons": "node build/generate-icons.mjs",
15
36
  "build:components": "tsc -p ./tsconfig.json",
16
37
  "lint": "eslint .",
17
38
  "format": "eslint . --fix",
@@ -32,8 +53,6 @@
32
53
  "@ni/fast-web-utilities": "^10.0.0",
33
54
  "@ni/nimble-components": "^34.10.3",
34
55
  "@ni/nimble-tokens": "^8.13.6",
35
- "@rollup/plugin-node-resolve": "^16.0.0",
36
- "rollup": "^4.12.0",
37
56
  "typescript": "~5.8.3"
38
57
  },
39
58
  "peerDependencies": {
@@ -0,0 +1,4 @@
1
+ // Nimble React Fonts SCSS
2
+ // Only @use once in the global styles.scss
3
+
4
+ @forward '@ni/nimble-components/dist/fonts';
@@ -0,0 +1,4 @@
1
+ // Nimble React Tokens SCSS
2
+ // @use once per SCSS file that is leveraging the tokens (helpful for autocomplete features, etc)
3
+
4
+ @forward '@ni/nimble-components/dist/tokens';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/react-wrapper/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,MAAM,YAAY,CAAC;AAW5C,MAAM,UAAU,IAAI,CAChB,YAA4B,EAC5B,UAAsB,EAAE;IAExB,OAAO,eAAe,CAAO;QACzB,GAAG,OAAO;QACV,YAAY;QACZ,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,YAAY,CAAE;KACjD,CAAC,CAAC;AACP,CAAC","sourcesContent":["import type { EventName, Options, ReactWebComponent } from '@lit/react';\nimport { createComponent } from '@lit/react';\nimport React from 'react';\n\nexport { type EventName } from '@lit/react';\nexport interface EventNames {\n [key: string]: EventName | string;\n}\n\ntype Constructor<T> = new () => T;\ntype Opts<\n I extends HTMLElement,\n E extends EventNames = NonNullable<unknown>\n> = Omit<Options<I, E>, 'elementClass' | 'react' | 'tagName'>;\n\nexport function wrap<I extends HTMLElement, E extends EventNames = NonNullable<unknown>>(\n elementClass: Constructor<I>,\n options: Opts<I, E> = {},\n): ReactWebComponent<I, E> {\n return createComponent<I, E>({\n ...options,\n elementClass,\n react: React,\n tagName: customElements.getName(elementClass)!\n });\n}\n"]}