@urbanos/react-discovery-ui 2.1.58 → 2.1.59

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.
@@ -39,6 +39,9 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
39
39
  _this.state = {
40
40
  expanded: isDesktop || props.expanded
41
41
  };
42
+ var title = typeof _this.props.title === 'string' || typeof _this.props.title === 'number' ? String(_this.props.title) : '';
43
+ var normalizedTitle = title.replace(/\s+/g, '-').toLowerCase();
44
+ _this.contentId = "collapsable-box-content-".concat(normalizedTitle || 'content');
42
45
  return _this;
43
46
  }
44
47
  _inherits(_default, _Component);
@@ -58,7 +61,15 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
58
61
  key: "render",
59
62
  value: function render() {
60
63
  var _this2 = this;
61
- return /*#__PURE__*/React.createElement("collapsable-box", null, /*#__PURE__*/React.createElement("div", {
64
+ var childrenWithContentId = _react.Children.map(this.props.children, function (child) {
65
+ if (! /*#__PURE__*/(0, _react.isValidElement)(child)) return child;
66
+ return /*#__PURE__*/(0, _react.cloneElement)(child, {
67
+ contentId: _this2.contentId
68
+ });
69
+ });
70
+ return /*#__PURE__*/React.createElement("div", {
71
+ className: "collapsable-box ".concat(this.props.className || '')
72
+ }, /*#__PURE__*/React.createElement("div", {
62
73
  "data-testid": this.props.testId,
63
74
  className: "header-container ".concat(this.headerOpenClass()),
64
75
  onClick: function onClick(e) {
@@ -73,7 +84,8 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
73
84
  role: "button",
74
85
  tabIndex: "0",
75
86
  "aria-label": [this.props.title, extractText(this.props.headerHtml)].filter(Boolean).join(': ') || 'collapsable box',
76
- "aria-pressed": this.state.expanded
87
+ "aria-controls": this.contentId,
88
+ "aria-expanded": this.state.expanded
77
89
  }, /*#__PURE__*/React.createElement("div", {
78
90
  className: "header-text-items"
79
91
  }, /*#__PURE__*/React.createElement("div", {
@@ -82,7 +94,9 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
82
94
  expanded: this.state.expanded
83
95
  })), /*#__PURE__*/React.createElement(_reactCollapse.Collapse, {
84
96
  isOpened: this.state.expanded
85
- }, this.props.children));
97
+ }, /*#__PURE__*/React.createElement("div", {
98
+ id: this.contentId
99
+ }, childrenWithContentId)));
86
100
  }
87
101
  }]);
88
102
  }(_react.Component);
@@ -1,9 +1,7 @@
1
1
  @import '../../styles/mixins.scss';
2
2
  @import '../../styles/variables.scss';
3
3
 
4
- collapsable-box {
5
- @include custom-element();
6
-
4
+ .collapsable-box {
7
5
  border: 1px solid $light-grey;
8
6
  width: 100%;
9
7
  margin-top: 2.5rem;
@@ -31,6 +31,7 @@ var VisualizationListMenuItem = function VisualizationListMenuItem(_ref) {
31
31
  setUserNeedsLoginInfo(false);
32
32
  };
33
33
  return /*#__PURE__*/React.createElement("visualization-list-menu-item", null, /*#__PURE__*/React.createElement(_tabButton.default, {
34
+ "aria-label": "Saved workspaces",
34
35
  "data-testid": "visualization-list-menu-item",
35
36
  className: "button-".concat(isAuthenticated ? 'enabled' : 'disabled', " ").concat(userNeedsLoginInfo && 'dialog-open'),
36
37
  onClick: showLoginPrompt
@@ -49,6 +49,7 @@ var VisualizationSaveMenuItem = function VisualizationSaveMenuItem(props) {
49
49
  return !isAuthenticated || (0, _lodash.isEmpty)(title) || actionNotAllowed;
50
50
  };
51
51
  return /*#__PURE__*/React.createElement("visualization-save-menu-item", null, /*#__PURE__*/React.createElement(_tabButton.default, {
52
+ "aria-label": "Save workspace",
52
53
  "data-testid": "save-icon",
53
54
  disabled: !isSaveable,
54
55
  className: "header-item save-icon ".concat(isDialogOpen && 'saving'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urbanos/react-discovery-ui",
3
- "version": "2.1.58",
3
+ "version": "2.1.59",
4
4
  "description": "React component for dataset discovery UI",
5
5
  "main": "./lib/ReactDiscoveryUI.js",
6
6
  "repository": {