@nulogy/components 8.15.1 → 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
@@ -24973,10 +24973,12 @@
24973
24973
  id: id,
24974
24974
  backgroundColor: backgroundColor,
24975
24975
  showArrow: showArrow
24976
- }, restProps), React__default["default"].Children.map(children, function (child) {
24977
- return /*#__PURE__*/React__default["default"].cloneElement(child, Object.assign({
24978
- size: componentSize
24979
- }, child.props), child.props.children);
24976
+ }, restProps), typeof children === "function" ? children : React__default["default"].Children.map(children, function (child) {
24977
+ if ( /*#__PURE__*/React__default["default"].isValidElement(child)) {
24978
+ return /*#__PURE__*/React__default["default"].cloneElement(child, Object.assign({
24979
+ size: componentSize
24980
+ }, child.props), child.props.children);
24981
+ }
24980
24982
  })));
24981
24983
  });
24982
24984
 
@@ -49071,9 +49073,11 @@
49071
49073
 
49072
49074
  var renderColumns = function renderColumns(allColumns) {
49073
49075
  return allColumns.map(function (column) {
49076
+ var _a, _b;
49077
+
49074
49078
  return /*#__PURE__*/React__default["default"].createElement(StyledTh, {
49075
49079
  scope: "col",
49076
- key: column.dataKey,
49080
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49077
49081
  width: column.width,
49078
49082
  compact: compact,
49079
49083
  "data-testid": "table-head",
@@ -49092,7 +49096,8 @@
49092
49096
  var columnPropType = PropTypes__default["default"].shape({
49093
49097
  align: PropTypes__default["default"].oneOf(["right", "left", "center"]),
49094
49098
  label: PropTypes__default["default"].string,
49095
- 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]),
49096
49101
  cellFormatter: PropTypes__default["default"].func,
49097
49102
  cellRenderer: PropTypes__default["default"].func,
49098
49103
  headerRenderer: PropTypes__default["default"].func,
@@ -49222,9 +49227,11 @@
49222
49227
  onMouseEnter = _ref3.onMouseEnter;
49223
49228
 
49224
49229
  var renderAllCells = function renderAllCells() {
49225
- return columns.map(function (column) {
49230
+ return columns.map(function (column, index) {
49231
+ var _a, _b;
49232
+
49226
49233
  return /*#__PURE__*/React__default["default"].createElement(TableCell, {
49227
- key: column.dataKey,
49234
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49228
49235
  row: row,
49229
49236
  column: column,
49230
49237
  cellData: row[column.dataKey],
@@ -49345,13 +49352,15 @@
49345
49352
  });
49346
49353
  var numberOfControlColumns = columns.length - columnsWithoutControls.length;
49347
49354
  return /*#__PURE__*/React__default["default"].createElement(StyledFooterRow, null, columnsWithoutControls.map(function (column, index) {
49355
+ var _a, _b;
49356
+
49348
49357
  return index === 0 ? /*#__PURE__*/React__default["default"].createElement(StyledTh, {
49349
49358
  key: column.dataKey,
49350
49359
  scope: "row",
49351
49360
  colSpan: numberOfControlColumns + 1,
49352
49361
  compact: compact
49353
49362
  }, row[column.dataKey]) : !loading && /*#__PURE__*/React__default["default"].createElement(TableCell, {
49354
- key: column.dataKey,
49363
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49355
49364
  row: row,
49356
49365
  column: {
49357
49366
  dataKey: column.dataKey,
@@ -24950,10 +24950,12 @@ var DropdownMenu = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
24950
24950
  id: id,
24951
24951
  backgroundColor: backgroundColor,
24952
24952
  showArrow: showArrow
24953
- }, restProps), React__default.Children.map(children, function (child) {
24954
- return /*#__PURE__*/React__default.cloneElement(child, Object.assign({
24955
- size: componentSize
24956
- }, child.props), child.props.children);
24953
+ }, restProps), typeof children === "function" ? children : React__default.Children.map(children, function (child) {
24954
+ if ( /*#__PURE__*/React__default.isValidElement(child)) {
24955
+ return /*#__PURE__*/React__default.cloneElement(child, Object.assign({
24956
+ size: componentSize
24957
+ }, child.props), child.props.children);
24958
+ }
24957
24959
  })));
24958
24960
  });
24959
24961
 
@@ -49048,9 +49050,11 @@ var TableHead = function TableHead(_ref3) {
49048
49050
 
49049
49051
  var renderColumns = function renderColumns(allColumns) {
49050
49052
  return allColumns.map(function (column) {
49053
+ var _a, _b;
49054
+
49051
49055
  return /*#__PURE__*/React__default.createElement(StyledTh, {
49052
49056
  scope: "col",
49053
- key: column.dataKey,
49057
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49054
49058
  width: column.width,
49055
49059
  compact: compact,
49056
49060
  "data-testid": "table-head",
@@ -49069,7 +49073,8 @@ TableHead.defaultProps = {
49069
49073
  var columnPropType = PropTypes.shape({
49070
49074
  align: PropTypes.oneOf(["right", "left", "center"]),
49071
49075
  label: PropTypes.string,
49072
- dataKey: PropTypes.string,
49076
+ dataKey: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
49077
+ key: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
49073
49078
  cellFormatter: PropTypes.func,
49074
49079
  cellRenderer: PropTypes.func,
49075
49080
  headerRenderer: PropTypes.func,
@@ -49199,9 +49204,11 @@ var TableBodyRow = function TableBodyRow(_ref3) {
49199
49204
  onMouseEnter = _ref3.onMouseEnter;
49200
49205
 
49201
49206
  var renderAllCells = function renderAllCells() {
49202
- return columns.map(function (column) {
49207
+ return columns.map(function (column, index) {
49208
+ var _a, _b;
49209
+
49203
49210
  return /*#__PURE__*/React__default.createElement(TableCell, {
49204
- key: column.dataKey,
49211
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49205
49212
  row: row,
49206
49213
  column: column,
49207
49214
  cellData: row[column.dataKey],
@@ -49322,13 +49329,15 @@ var TableFooterRow = function TableFooterRow(_ref2) {
49322
49329
  });
49323
49330
  var numberOfControlColumns = columns.length - columnsWithoutControls.length;
49324
49331
  return /*#__PURE__*/React__default.createElement(StyledFooterRow, null, columnsWithoutControls.map(function (column, index) {
49332
+ var _a, _b;
49333
+
49325
49334
  return index === 0 ? /*#__PURE__*/React__default.createElement(StyledTh, {
49326
49335
  key: column.dataKey,
49327
49336
  scope: "row",
49328
49337
  colSpan: numberOfControlColumns + 1,
49329
49338
  compact: compact
49330
49339
  }, row[column.dataKey]) : !loading && /*#__PURE__*/React__default.createElement(TableCell, {
49331
- key: column.dataKey,
49340
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49332
49341
  row: row,
49333
49342
  column: {
49334
49343
  dataKey: column.dataKey,
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
- import { StyledProps } from "../StyledProps";
3
2
  import { ComponentSize } from "../NDSProvider/ComponentSizeContext";
3
+ import { StyledProps } from "../StyledProps";
4
4
  type DropdownMenuProps = {
5
5
  className?: string;
6
6
  size?: ComponentSize;
7
7
  id?: string;
8
8
  disabled?: boolean;
9
- trigger?: React.ReactNode | ((...args: any[]) => any);
9
+ trigger?: () => React.FunctionComponentElement<unknown>;
10
10
  backgroundColor?: string;
11
11
  showArrow?: boolean;
12
12
  placement?: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
@@ -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,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { DefaultNDSThemeType } from "../theme.type";
3
3
  type DropdownMenuContainerProps = {
4
+ id?: string;
4
5
  className?: string;
5
6
  backgroundColor?: string;
6
7
  showArrow?: boolean;
@@ -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.1",
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"