@nulogy/components 8.15.2 → 8.15.3

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.
package/README.md CHANGED
@@ -36,7 +36,7 @@ If your application supports Simplified Chinese, you'll also need to load [Noto
36
36
 
37
37
  Note that loading fonts from Google API is just an example and not the most performant way to load fonts for your application. You'll most likely want to include the font's inside your existing asset pipeline.
38
38
 
39
- ### 2. Wrap your appliction in our theme provider
39
+ ### 2. Wrap your application in our theme provider
40
40
 
41
41
  Wrap your application in the NDSProvider component to access Nulogy's theme values and add typographic defaults.
42
42
 
@@ -74,17 +74,21 @@ A `locale` prop can be passed to `<NDSProvider />` to change the language of ari
74
74
 
75
75
  ## 🎨 UI Kit
76
76
 
77
- Designers can use NDS in Sketch by downloading the [UI Kit](https://share.goabstract.com/73221fd2-6626-43c8-b95c-e4bec74741ab). See the [Designers' Getting Started Guide](https://nulogy.design/guides/designers/) for more detail.
77
+ Designers can use NDS in Sketch by downloading the [UI Kit](https://share.goabstract.com/73221fd2-6626-43c8-b95c-e4bec74741ab). See the [Designers' Getting Started Guide](https://nulogy.design/guides/designers/) for more details.
78
78
 
79
79
  ## 📚 Documentation
80
80
 
81
81
  Component documentation and usage guides are stored in the [github.com/nulogy/nulogy.design](https://github.com/nulogy/nulogy.design) repository.
82
82
 
83
+ ## 👋 Work requests
84
+
85
+ If you encounter a bug, need a new component or new capability of an existing component, or need any other type of support please file a work request in [GitHub Issues](https://github.com/nulogy/design-system/issues). To learn more about how to file a request and what to expect please read [How to file NDS work request](https://github.com/nulogy/design-system/wiki/How-to-file-NDS-work-request).
86
+ - [#design-system](slack://channel?team=T024N2KKA&id=CBAFQ4X7X)
87
+
83
88
  ## 🙌 Contributing
84
89
 
85
90
  Please see [Contributing.MD](https://github.com/nulogy/design-system/blob/master/CONTRIBUTING.md) if you work at Nulogy and would like to contribute.
86
91
 
87
-
88
92
  ## 💬 Questions
89
93
 
90
94
  - [#design-system](slack://channel?team=T024N2KKA&id=CBAFQ4X7X)
package/dist/main.js CHANGED
@@ -49073,9 +49073,11 @@
49073
49073
 
49074
49074
  var renderColumns = function renderColumns(allColumns) {
49075
49075
  return allColumns.map(function (column) {
49076
+ var _a, _b;
49077
+
49076
49078
  return /*#__PURE__*/React__default["default"].createElement(StyledTh, {
49077
49079
  scope: "col",
49078
- key: column.dataKey,
49080
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49079
49081
  width: column.width,
49080
49082
  compact: compact,
49081
49083
  "data-testid": "table-head",
@@ -49094,7 +49096,8 @@
49094
49096
  var columnPropType = PropTypes__default["default"].shape({
49095
49097
  align: PropTypes__default["default"].oneOf(["right", "left", "center"]),
49096
49098
  label: PropTypes__default["default"].string,
49097
- dataKey: PropTypes__default["default"].string,
49099
+ dataKey: PropTypes__default["default"].oneOf([PropTypes__default["default"].string, PropTypes__default["default"].number]),
49100
+ key: PropTypes__default["default"].oneOf([PropTypes__default["default"].string, PropTypes__default["default"].number]),
49098
49101
  cellFormatter: PropTypes__default["default"].func,
49099
49102
  cellRenderer: PropTypes__default["default"].func,
49100
49103
  headerRenderer: PropTypes__default["default"].func,
@@ -49224,9 +49227,11 @@
49224
49227
  onMouseEnter = _ref3.onMouseEnter;
49225
49228
 
49226
49229
  var renderAllCells = function renderAllCells() {
49227
- return columns.map(function (column) {
49230
+ return columns.map(function (column, index) {
49231
+ var _a, _b;
49232
+
49228
49233
  return /*#__PURE__*/React__default["default"].createElement(TableCell, {
49229
- key: column.dataKey,
49234
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49230
49235
  row: row,
49231
49236
  column: column,
49232
49237
  cellData: row[column.dataKey],
@@ -49347,13 +49352,15 @@
49347
49352
  });
49348
49353
  var numberOfControlColumns = columns.length - columnsWithoutControls.length;
49349
49354
  return /*#__PURE__*/React__default["default"].createElement(StyledFooterRow, null, columnsWithoutControls.map(function (column, index) {
49355
+ var _a, _b;
49356
+
49350
49357
  return index === 0 ? /*#__PURE__*/React__default["default"].createElement(StyledTh, {
49351
49358
  key: column.dataKey,
49352
49359
  scope: "row",
49353
49360
  colSpan: numberOfControlColumns + 1,
49354
49361
  compact: compact
49355
49362
  }, row[column.dataKey]) : !loading && /*#__PURE__*/React__default["default"].createElement(TableCell, {
49356
- key: column.dataKey,
49363
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49357
49364
  row: row,
49358
49365
  column: {
49359
49366
  dataKey: column.dataKey,
@@ -49050,9 +49050,11 @@ var TableHead = function TableHead(_ref3) {
49050
49050
 
49051
49051
  var renderColumns = function renderColumns(allColumns) {
49052
49052
  return allColumns.map(function (column) {
49053
+ var _a, _b;
49054
+
49053
49055
  return /*#__PURE__*/React__default.createElement(StyledTh, {
49054
49056
  scope: "col",
49055
- key: column.dataKey,
49057
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49056
49058
  width: column.width,
49057
49059
  compact: compact,
49058
49060
  "data-testid": "table-head",
@@ -49071,7 +49073,8 @@ TableHead.defaultProps = {
49071
49073
  var columnPropType = PropTypes.shape({
49072
49074
  align: PropTypes.oneOf(["right", "left", "center"]),
49073
49075
  label: PropTypes.string,
49074
- dataKey: PropTypes.string,
49076
+ dataKey: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
49077
+ key: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
49075
49078
  cellFormatter: PropTypes.func,
49076
49079
  cellRenderer: PropTypes.func,
49077
49080
  headerRenderer: PropTypes.func,
@@ -49201,9 +49204,11 @@ var TableBodyRow = function TableBodyRow(_ref3) {
49201
49204
  onMouseEnter = _ref3.onMouseEnter;
49202
49205
 
49203
49206
  var renderAllCells = function renderAllCells() {
49204
- return columns.map(function (column) {
49207
+ return columns.map(function (column, index) {
49208
+ var _a, _b;
49209
+
49205
49210
  return /*#__PURE__*/React__default.createElement(TableCell, {
49206
- key: column.dataKey,
49211
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49207
49212
  row: row,
49208
49213
  column: column,
49209
49214
  cellData: row[column.dataKey],
@@ -49324,13 +49329,15 @@ var TableFooterRow = function TableFooterRow(_ref2) {
49324
49329
  });
49325
49330
  var numberOfControlColumns = columns.length - columnsWithoutControls.length;
49326
49331
  return /*#__PURE__*/React__default.createElement(StyledFooterRow, null, columnsWithoutControls.map(function (column, index) {
49332
+ var _a, _b;
49333
+
49327
49334
  return index === 0 ? /*#__PURE__*/React__default.createElement(StyledTh, {
49328
49335
  key: column.dataKey,
49329
49336
  scope: "row",
49330
49337
  colSpan: numberOfControlColumns + 1,
49331
49338
  compact: compact
49332
49339
  }, row[column.dataKey]) : !loading && /*#__PURE__*/React__default.createElement(TableCell, {
49333
- key: column.dataKey,
49340
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49334
49341
  row: row,
49335
49342
  column: {
49336
49343
  dataKey: column.dataKey,
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  declare const _default: {
3
3
  title: string;
4
+ chromatic: {
5
+ diffThreshold: number;
6
+ };
4
7
  };
5
8
  export default _default;
6
9
  export declare const _DropdownMenu: {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { ColumnType, RowType } from "./Table.types";
2
+ import { RowType, Columns } from "./Table.types";
3
3
  export type BaseTableProps = {
4
- columns: ColumnType[];
4
+ columns: Columns;
5
5
  rows: RowType[];
6
6
  noRowsContent?: string;
7
7
  keyField?: string;
@@ -34,8 +34,8 @@ declare class StatefulTable extends Component<StatefulTableProps, StatefulTableS
34
34
  deselectAllAriaLabel: any;
35
35
  paginationCss: any;
36
36
  paginationProps: {};
37
- columns?: import("./Table.types").ColumnType[];
38
- rows?: any[];
37
+ columns?: import("./Table.types").Columns;
38
+ rows?: unknown[];
39
39
  noRowsContent?: string;
40
40
  keyField?: string;
41
41
  id?: string;
@@ -1,31 +1,39 @@
1
- /// <reference types="react" />
1
+ import { Key } from "react";
2
2
  import PropTypes from "prop-types";
3
- export type RowType = any;
3
+ export type RowType = unknown;
4
4
  export type CellInfoType = {
5
- cellData: any;
5
+ cellData: unknown;
6
6
  column: ColumnType;
7
7
  row: RowType;
8
8
  };
9
9
  type ColumnInfoType = {
10
- align?: string;
10
+ align?: ColumnAlignment;
11
11
  label: string;
12
- dataKey?: string;
13
- width?: string;
12
+ dataKey?: Key;
13
+ width?: string | number;
14
14
  };
15
+ type ColumnAlignment = "left" | "right" | "center";
15
16
  export type ColumnType = {
16
- align?: string;
17
+ align?: ColumnAlignment;
17
18
  label?: string;
18
- dataKey?: string;
19
- cellFormatter?: (cell: CellInfoType) => React.ReactNode | JSX.Element;
20
- cellRenderer?: (cell: CellInfoType) => React.ReactNode | JSX.Element;
21
- headerRenderer?: (column: ColumnInfoType) => React.ReactNode | JSX.Element;
22
- headerFormatter?: (column: ColumnInfoType) => React.ReactNode | JSX.Element;
23
- width?: string;
24
- };
19
+ cellFormatter?: (cell: CellInfoType) => React.ReactNode;
20
+ cellRenderer?: (cell: CellInfoType) => React.ReactNode;
21
+ headerRenderer?: (column: ColumnInfoType) => React.ReactNode;
22
+ headerFormatter?: (column: ColumnInfoType) => React.ReactNode;
23
+ width?: string | number;
24
+ } & ({
25
+ key: Key;
26
+ dataKey?: never | undefined;
27
+ } | {
28
+ dataKey: Key;
29
+ key?: never | undefined;
30
+ });
31
+ export type Columns = ColumnType[];
25
32
  export declare const columnPropType: PropTypes.Requireable<PropTypes.InferProps<{
26
33
  align: PropTypes.Requireable<string>;
27
34
  label: PropTypes.Requireable<string>;
28
- dataKey: PropTypes.Requireable<string>;
35
+ dataKey: PropTypes.Requireable<PropTypes.Requireable<string> | PropTypes.Requireable<number>>;
36
+ key: PropTypes.Requireable<PropTypes.Requireable<string> | PropTypes.Requireable<number>>;
29
37
  cellFormatter: PropTypes.Requireable<(...args: any[]) => any>;
30
38
  cellRenderer: PropTypes.Requireable<(...args: any[]) => any>;
31
39
  headerRenderer: PropTypes.Requireable<(...args: any[]) => any>;
@@ -37,7 +45,8 @@ export declare const rowPropType: PropTypes.Requireable<{
37
45
  export declare const columnsPropType: PropTypes.Requireable<PropTypes.InferProps<{
38
46
  align: PropTypes.Requireable<string>;
39
47
  label: PropTypes.Requireable<string>;
40
- dataKey: PropTypes.Requireable<string>;
48
+ dataKey: PropTypes.Requireable<PropTypes.Requireable<string> | PropTypes.Requireable<number>>;
49
+ key: PropTypes.Requireable<PropTypes.Requireable<string> | PropTypes.Requireable<number>>;
41
50
  cellFormatter: PropTypes.Requireable<(...args: any[]) => any>;
42
51
  cellRenderer: PropTypes.Requireable<(...args: any[]) => any>;
43
52
  headerRenderer: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1,18 +1,20 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
+ import { RowType, Columns } from "./Table.types";
3
4
  declare const TableFoot: {
4
- ({ columns, rows, keyField, loading, compact }: {
5
- columns: any;
6
- rows: any;
7
- keyField: any;
8
- loading: any;
9
- compact: any;
5
+ ({ columns, rows, keyField, loading, compact, }: {
6
+ columns: Columns;
7
+ rows: RowType[];
8
+ keyField?: string;
9
+ loading?: boolean;
10
+ compact?: boolean;
10
11
  }): React.JSX.Element;
11
12
  propTypes: {
12
13
  columns: PropTypes.Validator<PropTypes.InferProps<{
13
14
  align: PropTypes.Requireable<string>;
14
15
  label: PropTypes.Requireable<string>;
15
- dataKey: PropTypes.Requireable<string>;
16
+ dataKey: PropTypes.Requireable<PropTypes.Requireable<number> | PropTypes.Requireable<string>>;
17
+ key: PropTypes.Requireable<PropTypes.Requireable<number> | PropTypes.Requireable<string>>;
16
18
  cellFormatter: PropTypes.Requireable<(...args: any[]) => any>;
17
19
  cellRenderer: PropTypes.Requireable<(...args: any[]) => any>;
18
20
  headerRenderer: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { ColumnType } from "./Table.types";
2
+ import { Columns } from "./Table.types";
3
3
  type TableHeadProps = {
4
- columns: ColumnType[];
4
+ columns: Columns;
5
5
  compact?: boolean;
6
6
  sticky?: boolean;
7
7
  };
package/package.json CHANGED
@@ -1,24 +1,28 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "8.15.2",
3
+ "version": "8.15.3",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "scripts": {
10
- "chromatic": "npx chromatic --project-token $CHROMATIC_TOKEN --exit-zero-on-changes",
11
- "lint": "yarn run tsc && yarn run eslint",
12
- "eslint": "eslint --config ./.eslintrc .'*/**/*.{js,ts,tsx}'",
13
- "lint:fix": "yarn run eslint --fix",
14
- "start": "concurrently \"yarn build:watch\" \"start-storybook -p 9999\"",
10
+ "new": "plop",
11
+ "start": "concurrently \"yarn build --watch\" \"start-storybook -p 9999\"",
12
+ "start:e2e": "yarn concurrently --kill-others \"yarn start --ci\" \"yarn wait-on http://localhost:9999 && cypress open\"",
15
13
  "build": "rollup -c",
16
- "build:watch": "yarn build --watch",
17
- "build-storybook": "build-storybook",
18
- "e2e:start": "yarn concurrently --kill-others \"yarn start --ci\" \"yarn wait-on http://localhost:9999 && cypress open\"",
19
- "e2e:test": "yarn build-storybook && yarn concurrently --success \"first\" --kill-others \"yarn http-server -p 9999 ./storybook-static\" \"yarn wait-on http://localhost:9999 && yarn cypress run\"",
20
- "test": "yarn lint && yarn jest && yarn e2e:test",
21
- "new": "plop"
14
+ "build:storybook": "build-storybook",
15
+ "check": "yarn check:types && yarn check:lint && yarn check:format",
16
+ "check:types": "tsc && cd cypress && tsc --noEmit",
17
+ "check:lint": "eslint --config ./.eslintrc .'*/**/*.{js,ts,tsx}'",
18
+ "check:format": "prettier -c .",
19
+ "fix": "yarn fix:lint && yarn fix:format",
20
+ "fix:lint": "yarn check:lint --fix",
21
+ "fix:format": "prettier -w .",
22
+ "test": "yarn test:components && yarn run test:e2e",
23
+ "test:components": "jest",
24
+ "test:e2e": "yarn build:storybook && yarn concurrently --success \"first\" --kill-others \"yarn http-server -p 9999 ./storybook-static\" \"yarn wait-on http://localhost:9999 && yarn cypress run\"",
25
+ "test:visual": "npx chromatic --project-token $CHROMATIC_TOKEN --exit-zero-on-changes"
22
26
  },
23
27
  "license": "MIT",
24
28
  "author": "Nulogy <info@nulogy.com> (https://github.com/nulogy)",
@@ -58,7 +62,7 @@
58
62
  "@babel/plugin-transform-runtime": "^7.9.6",
59
63
  "@babel/preset-env": "7.3.1",
60
64
  "@babel/preset-typescript": "^7.10.4",
61
- "@nulogy/eslint-config-nulogy": "^0.0.1-alpha.2",
65
+ "@nulogy/eslint-config-nulogy": "^1.0.0",
62
66
  "@nulogy/icons": "^4.26.0",
63
67
  "@rollup/plugin-babel": "^5.0.0",
64
68
  "@rollup/plugin-node-resolve": "^7.1.3",
@@ -98,7 +102,7 @@
98
102
  "babel-preset-react": "6.24.1",
99
103
  "chromatic": "^6.0.6",
100
104
  "concurrently": "^5.2.0",
101
- "cypress": "^4.0.0",
105
+ "cypress": "^13.2.0",
102
106
  "cypress-enter-plugin": "^1.0.1",
103
107
  "cypress-plugin-tab": "^1.0.1",
104
108
  "enzyme": "3.11.0",
@@ -164,7 +168,7 @@
164
168
  },
165
169
  "husky": {
166
170
  "hooks": {
167
- "pre-push": "yarn lint"
171
+ "pre-push": "yarn run check"
168
172
  }
169
173
  },
170
174
  "jest": {
@@ -178,10 +182,12 @@
178
182
  "transformIgnorePatterns": [
179
183
  "node_modules/(?!(@nulogy|storybook-addon-performance))"
180
184
  ],
185
+ "testPathIgnorePatterns": [
186
+ "<rootDir>/cypress"
187
+ ],
181
188
  "testMatch": [
182
- "**/src/**/*.spec.tsx",
183
- "**/src/**/*.spec.ts",
184
- "**/spec/**/*.spec.tsx"
189
+ "**/*.spec.tsx",
190
+ "**/*.spec.ts"
185
191
  ],
186
192
  "setupFiles": [
187
193
  "<rootDir>/spec/support/registerContext.js"