orcs-design-system 3.2.41 → 3.2.43

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.
@@ -118,6 +118,7 @@ export const ActionsMenuBody = _ref2 => {
118
118
  direction = "right-start",
119
119
  menuWidth,
120
120
  customTriggerComponent,
121
+ renderTrigger,
121
122
  children,
122
123
  ariaLabel = "Options Menu",
123
124
  onTriggerFocus,
@@ -158,8 +159,12 @@ export const ActionsMenuBody = _ref2 => {
158
159
  className: "action-menu-icon"
159
160
  })
160
161
  });
162
+ if (renderTrigger) {
163
+ triggerComponent = renderTrigger(triggerProps);
164
+ }
161
165
  if (customTriggerComponent) {
162
166
  triggerComponent = /*#__PURE__*/_jsx("div", {
167
+ role: "button",
163
168
  ...triggerProps,
164
169
  children: customTriggerComponent
165
170
  });
@@ -244,6 +249,8 @@ ActionsMenuBody.propTypes = {
244
249
  menuRightPosition: PropTypes.string,
245
250
  menuWidth: PropTypes.string,
246
251
  customTriggerComponent: PropTypes.node,
252
+ renderTrigger: PropTypes.func,
253
+ "data-testid": PropTypes.string,
247
254
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
248
255
  theme: PropTypes.object,
249
256
  ariaLabel: PropTypes.string
@@ -271,6 +278,7 @@ ActionsMenu.propTypes = {
271
278
  isOpen: PropTypes.bool,
272
279
  direction: PropTypes.oneOf(["left", "right", "top", "bottom", "top-start", "top-end", "bottom-start", "bottom-end", "left-start", "left-end", "right-start", "right-end"]),
273
280
  customTriggerComponent: PropTypes.node,
281
+ renderTrigger: PropTypes.func,
274
282
  closeOnClick: PropTypes.bool,
275
283
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
276
284
  /** Specifies the colour theme */
@@ -341,6 +349,13 @@ ActionsMenu.__docgenInfo = {
341
349
  },
342
350
  "required": false
343
351
  },
352
+ "renderTrigger": {
353
+ "description": "",
354
+ "type": {
355
+ "name": "func"
356
+ },
357
+ "required": false
358
+ },
344
359
  "closeOnClick": {
345
360
  "description": "",
346
361
  "type": {
@@ -423,6 +438,10 @@ ActionsMenuBody.__docgenInfo = {
423
438
  "value": "\"ActionsMenu\"",
424
439
  "computed": false
425
440
  },
441
+ "description": "",
442
+ "type": {
443
+ "name": "string"
444
+ },
426
445
  "required": false
427
446
  },
428
447
  "onTriggerFocus": {
@@ -495,6 +514,13 @@ ActionsMenuBody.__docgenInfo = {
495
514
  },
496
515
  "required": false
497
516
  },
517
+ "renderTrigger": {
518
+ "description": "",
519
+ "type": {
520
+ "name": "func"
521
+ },
522
+ "required": false
523
+ },
498
524
  "children": {
499
525
  "description": "",
500
526
  "type": {
@@ -55,11 +55,11 @@ const Tabs = _ref4 => {
55
55
  } = _ref4;
56
56
  const [isMounted, setIsMounted] = useState(false);
57
57
  const containerRef = useRef(null);
58
- const showMoreButtonRef = useRef();
59
58
  const containerVisibleWidth = useRef(0);
60
59
  const [showMoreTabs, setShowMoreTabs] = useState([]);
61
60
  const calculateVisibility = useCallback(actionElements => {
62
- const showMoreButtonWidth = showMoreButtonRef?.current?.offsetWidth ?? 0;
61
+ const showMoreButton = document.getElementById("show-more-button");
62
+ const showMoreButtonWidth = showMoreButton?.offsetWidth ?? 0;
63
63
  // as we loop through the tabs, we need to calculate the width of the visible tabs.
64
64
  let calculatedWidth = showMoreTabs.length ? showMoreButtonWidth : 0;
65
65
 
@@ -121,19 +121,24 @@ const Tabs = _ref4 => {
121
121
  gap: tabsGap
122
122
  },
123
123
  ref: containerRef,
124
+ role: "tablist",
124
125
  children: [visibleTabsList.map((tab, i) => /*#__PURE__*/_jsx(Tab, {
125
126
  className: tab.className,
126
127
  id: tab.id,
127
128
  "data-testid": tab["data-testid"],
128
129
  tabInShowMore: showMoreTabs.includes(i),
129
130
  to: tab.path,
131
+ role: "tab",
130
132
  children: tab.label
131
133
  }, tab.path)), /*#__PURE__*/_jsx(ActionsMenu, {
132
134
  direction: "bottom-end",
133
- customTriggerComponent: /*#__PURE__*/_jsxs(ShowMoreButton, {
134
- ref: showMoreButtonRef,
135
+ role: "presentation",
136
+ renderTrigger: props => /*#__PURE__*/_jsxs(ShowMoreButton, {
137
+ ...props,
135
138
  showMoreVisible: showMoreTabsList.length,
139
+ id: "show-more-button",
136
140
  className: showMoreItemActive && "hasActive",
141
+ role: "tab",
137
142
  children: [/*#__PURE__*/_jsx(FlexItem, {
138
143
  flex: "0 0 auto",
139
144
  children: "More"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.2.41",
3
+ "version": "3.2.43",
4
4
  "engines": {
5
5
  "node": "20.12.2"
6
6
  },