@nulogy/components 8.15.2 → 8.16.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.
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
@@ -41989,6 +41989,14 @@
41989
41989
  }, children));
41990
41990
  };
41991
41991
 
41992
+ var sidebarWidths = {
41993
+ xs: "400px",
41994
+ s: "520px",
41995
+ m: "640px",
41996
+ l: "768px",
41997
+ xl: "1024px"
41998
+ };
41999
+
41992
42000
  var focusFirstElement = function focusFirstElement() {
41993
42001
  var FOCUSABLE_EL_SELECTOR = "button, a[href], select, textarea, input, [tabindex]:not([tabindex='-1'])";
41994
42002
  var focusable = document.querySelectorAll(FOCUSABLE_EL_SELECTOR);
@@ -42030,11 +42038,13 @@
42030
42038
  });
42031
42039
  };
42032
42040
 
42033
- var Sidebar = function Sidebar(_a) {
42041
+ function Sidebar(_a) {
42042
+ var _b;
42043
+
42034
42044
  var _a$p = _a.p,
42035
- p = _a$p === void 0 ? "x3" : _a$p,
42045
+ p = _a$p === void 0 ? "x2" : _a$p,
42036
42046
  _a$width = _a.width,
42037
- width = _a$width === void 0 ? "400px" : _a$width,
42047
+ width = _a$width === void 0 ? "xs" : _a$width,
42038
42048
  children = _a.children,
42039
42049
  onClose = _a.onClose,
42040
42050
  title = _a.title,
@@ -42058,8 +42068,11 @@
42058
42068
  disableScroll = _a$disableScroll === void 0 ? true : _a$disableScroll,
42059
42069
  _a$hideCloseButton = _a.hideCloseButton,
42060
42070
  hideCloseButton = _a$hideCloseButton === void 0 ? false : _a$hideCloseButton,
42061
- zIndex = _a.zIndex,
42062
- props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton", "zIndex"]);
42071
+ _a$zIndex = _a.zIndex,
42072
+ zIndex = _a$zIndex === void 0 ? "sidebar" : _a$zIndex,
42073
+ helpText = _a.helpText,
42074
+ renderHelpText = _a.renderHelpText,
42075
+ props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton", "zIndex", "helpText", "renderHelpText"]);
42063
42076
 
42064
42077
  var closeButton = React.useRef(null);
42065
42078
 
@@ -42072,7 +42085,10 @@
42072
42085
 
42073
42086
  var sideBarRef = React.useRef(null);
42074
42087
  var contentRef = React.useRef(null);
42088
+ var selectedWidth = (_b = sidebarWidths[width]) !== null && _b !== void 0 ? _b : width;
42075
42089
  React.useEffect(function () {
42090
+ var _a;
42091
+
42076
42092
  if (closeButton.current && isOpen) {
42077
42093
  if (closeButton && closeButton.current) {
42078
42094
  closeButton.current.focus();
@@ -42081,7 +42097,7 @@
42081
42097
  }
42082
42098
  } else if (shouldUpdateFocus) {
42083
42099
  if (triggerRef) {
42084
- triggerRef.current.focus();
42100
+ (_a = triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
42085
42101
  } else {
42086
42102
  focusFirstElement();
42087
42103
  }
@@ -42141,11 +42157,11 @@
42141
42157
  position: "fixed",
42142
42158
  top: top,
42143
42159
  right: offset,
42144
- width: typeof width === "string" ? {
42160
+ width: typeof selectedWidth === "string" ? {
42145
42161
  default: "100%",
42146
- small: width
42147
- } : width,
42148
- zIndex: zIndex || "sidebar",
42162
+ small: selectedWidth
42163
+ } : selectedWidth,
42164
+ zIndex: zIndex,
42149
42165
  ref: sideBarRef
42150
42166
  }, props), /*#__PURE__*/React__default["default"].createElement(Flex, {
42151
42167
  p: p,
@@ -42157,9 +42173,14 @@
42157
42173
  overflowBehaviour: "contain"
42158
42174
  }
42159
42175
  }, /*#__PURE__*/React__default["default"].createElement(Flex, {
42160
- justifyContent: "space-between",
42161
- alignItems: "flex-start",
42176
+ flexDirection: "column",
42162
42177
  pb: "x3"
42178
+ }, /*#__PURE__*/React__default["default"].createElement(Flex, {
42179
+ flexDirection: "column",
42180
+ pb: "x2"
42181
+ }, /*#__PURE__*/React__default["default"].createElement(Flex, {
42182
+ justifyContent: "space-between",
42183
+ alignItems: "flex-start"
42163
42184
  }, title && /*#__PURE__*/React__default["default"].createElement(Flex, {
42164
42185
  alignItems: "center",
42165
42186
  height: "100%"
@@ -42174,7 +42195,13 @@
42174
42195
  onClick: onClose,
42175
42196
  "data-testid": closeButtonTestId,
42176
42197
  "aria-label": closeButtonAriaLabel || t("close")
42177
- }))), /*#__PURE__*/React__default["default"].createElement(AnimatedBox, {
42198
+ }))), renderHelpText ? renderHelpText() : helpText && /*#__PURE__*/React__default["default"].createElement(Text, {
42199
+ pt: "x1",
42200
+ color: "midGrey"
42201
+ }, helpText)), /*#__PURE__*/React__default["default"].createElement(Divider$1, {
42202
+ m: "0 -8px",
42203
+ width: "calc(100% + 16px)"
42204
+ })), /*#__PURE__*/React__default["default"].createElement(AnimatedBox, {
42178
42205
  variants: childVariants,
42179
42206
  animate: isOpen ? "open" : "closed",
42180
42207
  flexGrow: 1,
@@ -42192,7 +42219,7 @@
42192
42219
  }, footer), overlay && disableScroll && isOpen && /*#__PURE__*/React__default["default"].createElement(PreventBodyElementScrolling, {
42193
42220
  scrollRef: sideBarRef
42194
42221
  })));
42195
- };
42222
+ }
42196
42223
 
42197
42224
  var LoadingAnimation = function LoadingAnimation(_ref) {
42198
42225
  var inactive = _ref.inactive;
@@ -49073,9 +49100,11 @@
49073
49100
 
49074
49101
  var renderColumns = function renderColumns(allColumns) {
49075
49102
  return allColumns.map(function (column) {
49103
+ var _a, _b;
49104
+
49076
49105
  return /*#__PURE__*/React__default["default"].createElement(StyledTh, {
49077
49106
  scope: "col",
49078
- key: column.dataKey,
49107
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49079
49108
  width: column.width,
49080
49109
  compact: compact,
49081
49110
  "data-testid": "table-head",
@@ -49094,7 +49123,8 @@
49094
49123
  var columnPropType = PropTypes__default["default"].shape({
49095
49124
  align: PropTypes__default["default"].oneOf(["right", "left", "center"]),
49096
49125
  label: PropTypes__default["default"].string,
49097
- dataKey: PropTypes__default["default"].string,
49126
+ dataKey: PropTypes__default["default"].oneOf([PropTypes__default["default"].string, PropTypes__default["default"].number]),
49127
+ key: PropTypes__default["default"].oneOf([PropTypes__default["default"].string, PropTypes__default["default"].number]),
49098
49128
  cellFormatter: PropTypes__default["default"].func,
49099
49129
  cellRenderer: PropTypes__default["default"].func,
49100
49130
  headerRenderer: PropTypes__default["default"].func,
@@ -49224,9 +49254,11 @@
49224
49254
  onMouseEnter = _ref3.onMouseEnter;
49225
49255
 
49226
49256
  var renderAllCells = function renderAllCells() {
49227
- return columns.map(function (column) {
49257
+ return columns.map(function (column, index) {
49258
+ var _a, _b;
49259
+
49228
49260
  return /*#__PURE__*/React__default["default"].createElement(TableCell, {
49229
- key: column.dataKey,
49261
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49230
49262
  row: row,
49231
49263
  column: column,
49232
49264
  cellData: row[column.dataKey],
@@ -49347,13 +49379,15 @@
49347
49379
  });
49348
49380
  var numberOfControlColumns = columns.length - columnsWithoutControls.length;
49349
49381
  return /*#__PURE__*/React__default["default"].createElement(StyledFooterRow, null, columnsWithoutControls.map(function (column, index) {
49382
+ var _a, _b;
49383
+
49350
49384
  return index === 0 ? /*#__PURE__*/React__default["default"].createElement(StyledTh, {
49351
49385
  key: column.dataKey,
49352
49386
  scope: "row",
49353
49387
  colSpan: numberOfControlColumns + 1,
49354
49388
  compact: compact
49355
49389
  }, row[column.dataKey]) : !loading && /*#__PURE__*/React__default["default"].createElement(TableCell, {
49356
- key: column.dataKey,
49390
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49357
49391
  row: row,
49358
49392
  column: {
49359
49393
  dataKey: column.dataKey,
@@ -41966,6 +41966,14 @@ var Page = function Page(_a) {
41966
41966
  }, children));
41967
41967
  };
41968
41968
 
41969
+ var sidebarWidths = {
41970
+ xs: "400px",
41971
+ s: "520px",
41972
+ m: "640px",
41973
+ l: "768px",
41974
+ xl: "1024px"
41975
+ };
41976
+
41969
41977
  var focusFirstElement = function focusFirstElement() {
41970
41978
  var FOCUSABLE_EL_SELECTOR = "button, a[href], select, textarea, input, [tabindex]:not([tabindex='-1'])";
41971
41979
  var focusable = document.querySelectorAll(FOCUSABLE_EL_SELECTOR);
@@ -42007,11 +42015,13 @@ var SidebarOverlay = function SidebarOverlay(_ref) {
42007
42015
  });
42008
42016
  };
42009
42017
 
42010
- var Sidebar = function Sidebar(_a) {
42018
+ function Sidebar(_a) {
42019
+ var _b;
42020
+
42011
42021
  var _a$p = _a.p,
42012
- p = _a$p === void 0 ? "x3" : _a$p,
42022
+ p = _a$p === void 0 ? "x2" : _a$p,
42013
42023
  _a$width = _a.width,
42014
- width = _a$width === void 0 ? "400px" : _a$width,
42024
+ width = _a$width === void 0 ? "xs" : _a$width,
42015
42025
  children = _a.children,
42016
42026
  onClose = _a.onClose,
42017
42027
  title = _a.title,
@@ -42035,8 +42045,11 @@ var Sidebar = function Sidebar(_a) {
42035
42045
  disableScroll = _a$disableScroll === void 0 ? true : _a$disableScroll,
42036
42046
  _a$hideCloseButton = _a.hideCloseButton,
42037
42047
  hideCloseButton = _a$hideCloseButton === void 0 ? false : _a$hideCloseButton,
42038
- zIndex = _a.zIndex,
42039
- props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton", "zIndex"]);
42048
+ _a$zIndex = _a.zIndex,
42049
+ zIndex = _a$zIndex === void 0 ? "sidebar" : _a$zIndex,
42050
+ helpText = _a.helpText,
42051
+ renderHelpText = _a.renderHelpText,
42052
+ props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton", "zIndex", "helpText", "renderHelpText"]);
42040
42053
 
42041
42054
  var closeButton = useRef(null);
42042
42055
 
@@ -42049,7 +42062,10 @@ var Sidebar = function Sidebar(_a) {
42049
42062
 
42050
42063
  var sideBarRef = useRef(null);
42051
42064
  var contentRef = useRef(null);
42065
+ var selectedWidth = (_b = sidebarWidths[width]) !== null && _b !== void 0 ? _b : width;
42052
42066
  useEffect(function () {
42067
+ var _a;
42068
+
42053
42069
  if (closeButton.current && isOpen) {
42054
42070
  if (closeButton && closeButton.current) {
42055
42071
  closeButton.current.focus();
@@ -42058,7 +42074,7 @@ var Sidebar = function Sidebar(_a) {
42058
42074
  }
42059
42075
  } else if (shouldUpdateFocus) {
42060
42076
  if (triggerRef) {
42061
- triggerRef.current.focus();
42077
+ (_a = triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
42062
42078
  } else {
42063
42079
  focusFirstElement();
42064
42080
  }
@@ -42118,11 +42134,11 @@ var Sidebar = function Sidebar(_a) {
42118
42134
  position: "fixed",
42119
42135
  top: top,
42120
42136
  right: offset,
42121
- width: typeof width === "string" ? {
42137
+ width: typeof selectedWidth === "string" ? {
42122
42138
  default: "100%",
42123
- small: width
42124
- } : width,
42125
- zIndex: zIndex || "sidebar",
42139
+ small: selectedWidth
42140
+ } : selectedWidth,
42141
+ zIndex: zIndex,
42126
42142
  ref: sideBarRef
42127
42143
  }, props), /*#__PURE__*/React__default.createElement(Flex, {
42128
42144
  p: p,
@@ -42134,9 +42150,14 @@ var Sidebar = function Sidebar(_a) {
42134
42150
  overflowBehaviour: "contain"
42135
42151
  }
42136
42152
  }, /*#__PURE__*/React__default.createElement(Flex, {
42137
- justifyContent: "space-between",
42138
- alignItems: "flex-start",
42153
+ flexDirection: "column",
42139
42154
  pb: "x3"
42155
+ }, /*#__PURE__*/React__default.createElement(Flex, {
42156
+ flexDirection: "column",
42157
+ pb: "x2"
42158
+ }, /*#__PURE__*/React__default.createElement(Flex, {
42159
+ justifyContent: "space-between",
42160
+ alignItems: "flex-start"
42140
42161
  }, title && /*#__PURE__*/React__default.createElement(Flex, {
42141
42162
  alignItems: "center",
42142
42163
  height: "100%"
@@ -42151,7 +42172,13 @@ var Sidebar = function Sidebar(_a) {
42151
42172
  onClick: onClose,
42152
42173
  "data-testid": closeButtonTestId,
42153
42174
  "aria-label": closeButtonAriaLabel || t("close")
42154
- }))), /*#__PURE__*/React__default.createElement(AnimatedBox, {
42175
+ }))), renderHelpText ? renderHelpText() : helpText && /*#__PURE__*/React__default.createElement(Text, {
42176
+ pt: "x1",
42177
+ color: "midGrey"
42178
+ }, helpText)), /*#__PURE__*/React__default.createElement(Divider$1, {
42179
+ m: "0 -8px",
42180
+ width: "calc(100% + 16px)"
42181
+ })), /*#__PURE__*/React__default.createElement(AnimatedBox, {
42155
42182
  variants: childVariants,
42156
42183
  animate: isOpen ? "open" : "closed",
42157
42184
  flexGrow: 1,
@@ -42169,7 +42196,7 @@ var Sidebar = function Sidebar(_a) {
42169
42196
  }, footer), overlay && disableScroll && isOpen && /*#__PURE__*/React__default.createElement(PreventBodyElementScrolling, {
42170
42197
  scrollRef: sideBarRef
42171
42198
  })));
42172
- };
42199
+ }
42173
42200
 
42174
42201
  var LoadingAnimation = function LoadingAnimation(_ref) {
42175
42202
  var inactive = _ref.inactive;
@@ -49050,9 +49077,11 @@ var TableHead = function TableHead(_ref3) {
49050
49077
 
49051
49078
  var renderColumns = function renderColumns(allColumns) {
49052
49079
  return allColumns.map(function (column) {
49080
+ var _a, _b;
49081
+
49053
49082
  return /*#__PURE__*/React__default.createElement(StyledTh, {
49054
49083
  scope: "col",
49055
- key: column.dataKey,
49084
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49056
49085
  width: column.width,
49057
49086
  compact: compact,
49058
49087
  "data-testid": "table-head",
@@ -49071,7 +49100,8 @@ TableHead.defaultProps = {
49071
49100
  var columnPropType = PropTypes.shape({
49072
49101
  align: PropTypes.oneOf(["right", "left", "center"]),
49073
49102
  label: PropTypes.string,
49074
- dataKey: PropTypes.string,
49103
+ dataKey: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
49104
+ key: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
49075
49105
  cellFormatter: PropTypes.func,
49076
49106
  cellRenderer: PropTypes.func,
49077
49107
  headerRenderer: PropTypes.func,
@@ -49201,9 +49231,11 @@ var TableBodyRow = function TableBodyRow(_ref3) {
49201
49231
  onMouseEnter = _ref3.onMouseEnter;
49202
49232
 
49203
49233
  var renderAllCells = function renderAllCells() {
49204
- return columns.map(function (column) {
49234
+ return columns.map(function (column, index) {
49235
+ var _a, _b;
49236
+
49205
49237
  return /*#__PURE__*/React__default.createElement(TableCell, {
49206
- key: column.dataKey,
49238
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49207
49239
  row: row,
49208
49240
  column: column,
49209
49241
  cellData: row[column.dataKey],
@@ -49324,13 +49356,15 @@ var TableFooterRow = function TableFooterRow(_ref2) {
49324
49356
  });
49325
49357
  var numberOfControlColumns = columns.length - columnsWithoutControls.length;
49326
49358
  return /*#__PURE__*/React__default.createElement(StyledFooterRow, null, columnsWithoutControls.map(function (column, index) {
49359
+ var _a, _b;
49360
+
49327
49361
  return index === 0 ? /*#__PURE__*/React__default.createElement(StyledTh, {
49328
49362
  key: column.dataKey,
49329
49363
  scope: "row",
49330
49364
  colSpan: numberOfControlColumns + 1,
49331
49365
  compact: compact
49332
49366
  }, row[column.dataKey]) : !loading && /*#__PURE__*/React__default.createElement(TableCell, {
49333
- key: column.dataKey,
49367
+ key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index,
49334
49368
  row: row,
49335
49369
  column: {
49336
49370
  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,20 +1,25 @@
1
1
  import React, { RefObject } from "react";
2
2
  import { AnimatedBoxProps } from "../Box/Box";
3
- type SidebarProps = AnimatedBoxProps & {
3
+ type PredefinedSidebarWidth = "xs" | "s" | "m" | "l" | "xl";
4
+ type SidebarWidth = PredefinedSidebarWidth | (string & {});
5
+ type SidebarProps = Omit<AnimatedBoxProps, "width"> & {
4
6
  children?: React.ReactNode;
5
- onClose?: (arg: any) => any;
7
+ onClose?: () => void;
6
8
  title?: string;
7
9
  isOpen?: boolean;
8
10
  footer?: React.ReactNode;
9
11
  closeButtonTestId?: string;
10
12
  closeButtonAriaLabel?: string;
11
13
  offset?: string;
12
- triggerRef?: RefObject<any>;
14
+ triggerRef?: RefObject<HTMLInputElement | HTMLButtonElement>;
13
15
  duration?: number;
14
16
  closeOnOutsideClick?: boolean;
15
17
  overlay?: boolean;
16
18
  disableScroll?: boolean;
17
19
  hideCloseButton?: boolean;
20
+ width?: SidebarWidth;
21
+ helpText?: React.ReactNode;
22
+ renderHelpText?: () => React.ReactNode;
18
23
  };
19
- declare const Sidebar: React.FC<SidebarProps>;
24
+ declare function Sidebar({ p, width, children, onClose, title, isOpen, footer, closeButtonTestId, closeButtonAriaLabel, offset, triggerRef, duration, top, closeOnOutsideClick, overlay, disableScroll, hideCloseButton, zIndex, helpText, renderHelpText, ...props }: SidebarProps): React.JSX.Element;
20
25
  export default Sidebar;
@@ -16,3 +16,7 @@ export declare const WithCustomOffset: () => React.JSX.Element;
16
16
  export declare const DontCloseOnOutsideClick: () => React.JSX.Element;
17
17
  export declare const WithoutCloseButton: () => React.JSX.Element;
18
18
  export declare const WithALongTitle: () => React.JSX.Element;
19
+ export declare const WithDifferentWidths: () => React.JSX.Element;
20
+ export declare const WithHelpText: () => React.JSX.Element;
21
+ export declare const WithOtherElementsInHelpText: () => React.JSX.Element;
22
+ export declare const WithARenderedHelpText: () => React.JSX.Element;
@@ -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.16.0",
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"