@telus-uds/components-community.data-grid 1.3.5 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,12 +1,24 @@
1
1
  # Change Log - @telus-uds/components-community.data-grid
2
2
 
3
- This log was last generated on Tue, 10 Jun 2025 20:18:03 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 24 Jun 2025 18:53:53 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.4.0
8
+
9
+ Tue, 24 Jun 2025 18:53:53 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `Datagrid`: UDS-Casa datagrid sticky header while scrolling (vishal.jindal@telus.com)
14
+ - Bump @telus-uds/components-web to v4.7.0
15
+ - Bump @telus-uds/components-base to v3.10.0
16
+ - Bump @telus-uds/system-theme-tokens to v4.8.0
17
+ - Bump @telus-uds/browserslist-config to v1.0.5
18
+
7
19
  ## 1.3.5
8
20
 
9
- Tue, 10 Jun 2025 20:18:03 GMT
21
+ Tue, 10 Jun 2025 20:25:05 GMT
10
22
 
11
23
  ### Patches
12
24
 
@@ -35,7 +35,8 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
35
35
  variant,
36
36
  copy = 'en',
37
37
  testID = 'data-grid',
38
- isHeaderVisible
38
+ isHeaderVisible,
39
+ isHeaderSticky = false
39
40
  } = _ref;
40
41
  const themeTokens = (0, _componentsBase.useThemeTokens)('DataGrid', tokens, variant);
41
42
  const getCopy = (0, _componentsBase.useCopy)({
@@ -318,6 +319,7 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
318
319
  testID: testID,
319
320
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
320
321
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DataGridHead.default, {
322
+ isHeaderSticky: isHeaderSticky,
321
323
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DataGridRow.default, {
322
324
  type: _utility.ROW_TYPE.HEADING,
323
325
  children: HeaderContent
@@ -419,6 +421,10 @@ DataGrid.propTypes = {
419
421
  /**
420
422
  * Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
421
423
  */
422
- isHeaderVisible: _propTypes.default.bool
424
+ isHeaderVisible: _propTypes.default.bool,
425
+ /**
426
+ * Use isHeaderSticky prop to provide sticky header
427
+ */
428
+ isHeaderSticky: _propTypes.default.bool
423
429
  };
424
430
  var _default = exports.default = DataGrid;
@@ -6,14 +6,33 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
10
  var _jsxRuntime = require("react/jsx-runtime");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const StyledHeader = /*#__PURE__*/_styledComponents.default.thead.withConfig({
13
+ displayName: "DataGridHead__StyledHeader",
14
+ componentId: "[object Object]__sc-ogldi9-0"
15
+ })(["", ""], props => {
16
+ if (props.isHeaderSticky) {
17
+ return {
18
+ position: 'sticky',
19
+ top: '-9px',
20
+ zIndex: 1,
21
+ backgroundColor: 'white'
22
+ };
23
+ }
24
+ return `
25
+ position: relative;
26
+ `;
27
+ });
11
28
  const DataGridHead = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
12
29
  let {
13
- children
30
+ children,
31
+ isHeaderSticky
14
32
  } = _ref;
15
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
33
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeader, {
16
34
  ref: ref,
35
+ isHeaderSticky: isHeaderSticky,
17
36
  children: children
18
37
  });
19
38
  });
@@ -22,6 +41,10 @@ DataGridHead.propTypes = {
22
41
  /**
23
42
  * Accepts any React or HTML node
24
43
  */
25
- children: _propTypes.default.node
44
+ children: _propTypes.default.node,
45
+ /**
46
+ * Use isHeaderSticky prop to provide sticky header
47
+ */
48
+ isHeaderSticky: _propTypes.default.bool
26
49
  };
27
50
  var _default = exports.default = DataGridHead;
@@ -7,7 +7,6 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
10
- var _smoothScrollbarReact = require("smooth-scrollbar-react");
11
10
  var _jsxRuntime = require("react/jsx-runtime");
12
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -20,28 +19,18 @@ const StyledTable = /*#__PURE__*/_styledComponents.default.table.withConfig({
20
19
  displayName: "DataGridTable__StyledTable",
21
20
  componentId: "[object Object]__sc-aw7n7n-1"
22
21
  })(["width:100%;border-spacing:0;"]);
23
- const WrappedScrollbar = /*#__PURE__*/(0, _styledComponents.default)(_smoothScrollbarReact.Scrollbar).withConfig({
24
- displayName: "DataGridTable__WrappedScrollbar",
25
- componentId: "[object Object]__sc-aw7n7n-2"
26
- })(["width:100%;"]);
27
22
  const DataGridTable = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
28
23
  let {
29
24
  children,
30
25
  tokens,
31
- makeScrollBarAlwaysVisible,
32
26
  testID
33
27
  } = _ref;
34
28
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledWrapper, {
35
29
  tokens: tokens,
36
30
  ref: ref,
37
31
  testID: testID,
38
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedScrollbar, {
39
- alwaysShowTracks: makeScrollBarAlwaysVisible,
40
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
41
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledTable, {
42
- children: children
43
- })
44
- })
32
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledTable, {
33
+ children: children
45
34
  })
46
35
  });
47
36
  });
@@ -55,10 +44,6 @@ DataGridTable.propTypes = {
55
44
  * Tokens passed to the component
56
45
  */
57
46
  tokens: _propTypes.default.object,
58
- /**
59
- * Set this to true to make scrollbar always visible when content is larger than the grid
60
- */
61
- makeScrollBarAlwaysVisible: _propTypes.default.bool,
62
47
  /**
63
48
  /**
64
49
  * Use in tests if the datagrid test cases need to find the element with the id.
@@ -26,7 +26,8 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
26
26
  variant,
27
27
  copy = 'en',
28
28
  testID = 'data-grid',
29
- isHeaderVisible
29
+ isHeaderVisible,
30
+ isHeaderSticky = false
30
31
  } = _ref;
31
32
  const themeTokens = useThemeTokens('DataGrid', tokens, variant);
32
33
  const getCopy = useCopy({
@@ -309,6 +310,7 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
309
310
  testID: testID,
310
311
  children: /*#__PURE__*/_jsxs(_Fragment, {
311
312
  children: [/*#__PURE__*/_jsx(DataGridHead, {
313
+ isHeaderSticky: isHeaderSticky,
312
314
  children: /*#__PURE__*/_jsx(DataGridRow, {
313
315
  type: ROW_TYPE.HEADING,
314
316
  children: HeaderContent
@@ -410,6 +412,10 @@ DataGrid.propTypes = {
410
412
  /**
411
413
  * Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
412
414
  */
413
- isHeaderVisible: PropTypes.bool
415
+ isHeaderVisible: PropTypes.bool,
416
+ /**
417
+ * Use isHeaderSticky prop to provide sticky header
418
+ */
419
+ isHeaderSticky: PropTypes.bool
414
420
  };
415
421
  export default DataGrid;
@@ -1,12 +1,31 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
+ const StyledHeader = /*#__PURE__*/styled.thead.withConfig({
6
+ displayName: "DataGridHead__StyledHeader",
7
+ componentId: "[object Object]__sc-ogldi9-0"
8
+ })(["", ""], props => {
9
+ if (props.isHeaderSticky) {
10
+ return {
11
+ position: 'sticky',
12
+ top: '-9px',
13
+ zIndex: 1,
14
+ backgroundColor: 'white'
15
+ };
16
+ }
17
+ return `
18
+ position: relative;
19
+ `;
20
+ });
4
21
  const DataGridHead = /*#__PURE__*/React.forwardRef((_ref, ref) => {
5
22
  let {
6
- children
23
+ children,
24
+ isHeaderSticky
7
25
  } = _ref;
8
- return /*#__PURE__*/_jsx("thead", {
26
+ return /*#__PURE__*/_jsx(StyledHeader, {
9
27
  ref: ref,
28
+ isHeaderSticky: isHeaderSticky,
10
29
  children: children
11
30
  });
12
31
  });
@@ -15,6 +34,10 @@ DataGridHead.propTypes = {
15
34
  /**
16
35
  * Accepts any React or HTML node
17
36
  */
18
- children: PropTypes.node
37
+ children: PropTypes.node,
38
+ /**
39
+ * Use isHeaderSticky prop to provide sticky header
40
+ */
41
+ isHeaderSticky: PropTypes.bool
19
42
  };
20
43
  export default DataGridHead;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled, { css } from 'styled-components';
4
- import { Scrollbar } from 'smooth-scrollbar-react';
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  const StyledWrapper = /*#__PURE__*/styled.div.withConfig({
7
6
  displayName: "DataGridTable__StyledWrapper",
@@ -11,28 +10,18 @@ const StyledTable = /*#__PURE__*/styled.table.withConfig({
11
10
  displayName: "DataGridTable__StyledTable",
12
11
  componentId: "[object Object]__sc-aw7n7n-1"
13
12
  })(["width:100%;border-spacing:0;"]);
14
- const WrappedScrollbar = /*#__PURE__*/styled(Scrollbar).withConfig({
15
- displayName: "DataGridTable__WrappedScrollbar",
16
- componentId: "[object Object]__sc-aw7n7n-2"
17
- })(["width:100%;"]);
18
13
  const DataGridTable = /*#__PURE__*/React.forwardRef((_ref, ref) => {
19
14
  let {
20
15
  children,
21
16
  tokens,
22
- makeScrollBarAlwaysVisible,
23
17
  testID
24
18
  } = _ref;
25
19
  return /*#__PURE__*/_jsx(StyledWrapper, {
26
20
  tokens: tokens,
27
21
  ref: ref,
28
22
  testID: testID,
29
- children: /*#__PURE__*/_jsx(WrappedScrollbar, {
30
- alwaysShowTracks: makeScrollBarAlwaysVisible,
31
- children: /*#__PURE__*/_jsx("div", {
32
- children: /*#__PURE__*/_jsx(StyledTable, {
33
- children: children
34
- })
35
- })
23
+ children: /*#__PURE__*/_jsx(StyledTable, {
24
+ children: children
36
25
  })
37
26
  });
38
27
  });
@@ -46,10 +35,6 @@ DataGridTable.propTypes = {
46
35
  * Tokens passed to the component
47
36
  */
48
37
  tokens: PropTypes.object,
49
- /**
50
- * Set this to true to make scrollbar always visible when content is larger than the grid
51
- */
52
- makeScrollBarAlwaysVisible: PropTypes.bool,
53
38
  /**
54
39
  /**
55
40
  * Use in tests if the datagrid test cases need to find the element with the id.
package/package.json CHANGED
@@ -5,12 +5,10 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "prop-types": "^15.7.2",
8
- "@telus-uds/components-web": "^4.6.1",
9
- "@telus-uds/components-base": "^3.9.0",
10
- "@telus-uds/system-theme-tokens": "^4.7.0",
11
- "styled-components": "6.1.13",
12
- "smooth-scrollbar": "8.8.4",
13
- "smooth-scrollbar-react": "2.4.1"
8
+ "@telus-uds/components-web": "^4.7.0",
9
+ "@telus-uds/components-base": "^3.10.0",
10
+ "@telus-uds/system-theme-tokens": "^4.8.0",
11
+ "styled-components": "6.1.13"
14
12
  },
15
13
  "devDependencies": {
16
14
  "@telus-uds/browserslist-config": "^1.0.4",
@@ -46,5 +44,5 @@
46
44
  "standard-engine": {
47
45
  "skip": true
48
46
  },
49
- "version": "1.3.5"
47
+ "version": "1.4.0"
50
48
  }
package/src/DataGrid.jsx CHANGED
@@ -52,7 +52,8 @@ const DataGrid = React.forwardRef(
52
52
  variant,
53
53
  copy = 'en',
54
54
  testID = 'data-grid',
55
- isHeaderVisible
55
+ isHeaderVisible,
56
+ isHeaderSticky = false
56
57
  },
57
58
  ref
58
59
  ) => {
@@ -428,7 +429,7 @@ const DataGrid = React.forwardRef(
428
429
  testID={testID}
429
430
  >
430
431
  <>
431
- <DataGridHead>
432
+ <DataGridHead isHeaderSticky={isHeaderSticky}>
432
433
  <DataGridRow type={ROW_TYPE.HEADING}>{HeaderContent}</DataGridRow>
433
434
  </DataGridHead>
434
435
  <DataGridBody>{BodyContent}</DataGridBody>
@@ -542,7 +543,11 @@ DataGrid.propTypes = {
542
543
  /**
543
544
  * Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
544
545
  */
545
- isHeaderVisible: PropTypes.bool
546
+ isHeaderVisible: PropTypes.bool,
547
+ /**
548
+ * Use isHeaderSticky prop to provide sticky header
549
+ */
550
+ isHeaderSticky: PropTypes.bool
546
551
  }
547
552
 
548
553
  export default DataGrid
@@ -1,7 +1,29 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
- const DataGridHead = React.forwardRef(({ children }, ref) => <thead ref={ref}>{children}</thead>)
4
+ import styled from 'styled-components'
5
+
6
+ const StyledHeader = styled.thead`
7
+ ${(props) => {
8
+ if (props.isHeaderSticky) {
9
+ return {
10
+ position: 'sticky',
11
+ top: '-9px',
12
+ zIndex: 1,
13
+ backgroundColor: 'white'
14
+ }
15
+ }
16
+ return `
17
+ position: relative;
18
+ `
19
+ }}
20
+ `
21
+
22
+ const DataGridHead = React.forwardRef(({ children, isHeaderSticky }, ref) => (
23
+ <StyledHeader ref={ref} isHeaderSticky={isHeaderSticky}>
24
+ {children}
25
+ </StyledHeader>
26
+ ))
5
27
 
6
28
  DataGridHead.displayName = 'DataGridHead'
7
29
 
@@ -9,7 +31,11 @@ DataGridHead.propTypes = {
9
31
  /**
10
32
  * Accepts any React or HTML node
11
33
  */
12
- children: PropTypes.node
34
+ children: PropTypes.node,
35
+ /**
36
+ * Use isHeaderSticky prop to provide sticky header
37
+ */
38
+ isHeaderSticky: PropTypes.bool
13
39
  }
14
40
 
15
41
  export default DataGridHead
@@ -1,7 +1,6 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import styled, { css } from 'styled-components'
4
- import { Scrollbar } from 'smooth-scrollbar-react'
5
4
 
6
5
  const StyledWrapper = styled.div`
7
6
  display: flex;
@@ -23,23 +22,13 @@ const StyledTable = styled.table`
23
22
  border-spacing: 0;
24
23
  `
25
24
 
26
- const WrappedScrollbar = styled(Scrollbar)`
27
- width: 100%;
28
- `
29
-
30
- const DataGridTable = React.forwardRef(
31
- ({ children, tokens, makeScrollBarAlwaysVisible, testID }, ref) => {
32
- return (
33
- <StyledWrapper tokens={tokens} ref={ref} testID={testID}>
34
- <WrappedScrollbar alwaysShowTracks={makeScrollBarAlwaysVisible}>
35
- <div>
36
- <StyledTable>{children}</StyledTable>
37
- </div>
38
- </WrappedScrollbar>
39
- </StyledWrapper>
40
- )
41
- }
42
- )
25
+ const DataGridTable = React.forwardRef(({ children, tokens, testID }, ref) => {
26
+ return (
27
+ <StyledWrapper tokens={tokens} ref={ref} testID={testID}>
28
+ <StyledTable>{children}</StyledTable>
29
+ </StyledWrapper>
30
+ )
31
+ })
43
32
 
44
33
  DataGridTable.displayName = 'DataGridTable'
45
34
 
@@ -52,10 +41,6 @@ DataGridTable.propTypes = {
52
41
  * Tokens passed to the component
53
42
  */
54
43
  tokens: PropTypes.object,
55
- /**
56
- * Set this to true to make scrollbar always visible when content is larger than the grid
57
- */
58
- makeScrollBarAlwaysVisible: PropTypes.bool,
59
44
  /**
60
45
  /**
61
46
  * Use in tests if the datagrid test cases need to find the element with the id.