carbon-react 116.1.2 → 116.2.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/esm/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/esm/components/accordion/accordion.component.d.ts +1 -1
- package/esm/components/accordion/accordion.component.js +2 -2
- package/esm/components/accordion/accordion.style.d.ts +1 -1
- package/esm/components/accordion/accordion.style.js +1 -1
- package/esm/components/date/date.component.js +9 -1
- package/esm/components/date/date.style.js +5 -2
- package/esm/components/detail/detail.component.d.ts +19 -0
- package/esm/components/detail/detail.component.js +176 -42
- package/esm/components/detail/detail.style.d.ts +10 -0
- package/esm/components/detail/index.d.ts +2 -1
- package/esm/components/drawer/drawer.component.d.ts +1 -1
- package/esm/components/icon/icon.component.js +1 -1
- package/esm/components/menu/index.d.ts +1 -0
- package/esm/components/tabs/__internal__/tab-title/index.d.ts +2 -1
- package/esm/components/tabs/__internal__/tab-title/index.js +1 -1
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.d.ts +37 -3
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +99 -97
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.d.ts +18 -4
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.js +14 -50
- package/esm/components/tabs/__internal__/tabs-header/index.d.ts +2 -1
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.component.d.ts +13 -0
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.component.js +8 -8
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.style.d.ts +6 -6
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.style.js +8 -27
- package/esm/components/tabs/index.d.ts +3 -2
- package/esm/components/tabs/tab/index.d.ts +2 -2
- package/esm/components/tabs/tab/tab.component.d.ts +53 -0
- package/esm/components/tabs/tab/tab.component.js +180 -61
- package/esm/components/tabs/tab/tab.style.d.ts +8 -1
- package/esm/components/tabs/tab/tab.style.js +1 -6
- package/esm/components/tabs/tabs.component.d.ts +49 -0
- package/esm/components/tabs/tabs.component.js +188 -70
- package/esm/components/tabs/tabs.style.d.ts +5 -1
- package/esm/components/tabs/tabs.style.js +2 -8
- package/esm/components/textbox/textbox.component.d.ts +1 -1
- package/lib/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/lib/components/accordion/accordion.component.d.ts +1 -1
- package/lib/components/accordion/accordion.component.js +2 -2
- package/lib/components/accordion/accordion.style.d.ts +1 -1
- package/lib/components/accordion/accordion.style.js +1 -1
- package/lib/components/date/date.component.js +9 -1
- package/lib/components/date/date.style.js +5 -2
- package/lib/components/detail/detail.component.d.ts +19 -0
- package/lib/components/detail/detail.component.js +178 -47
- package/lib/components/detail/detail.style.d.ts +10 -0
- package/lib/components/detail/index.d.ts +2 -1
- package/lib/components/drawer/drawer.component.d.ts +1 -1
- package/lib/components/icon/icon.component.js +1 -1
- package/lib/components/menu/index.d.ts +1 -0
- package/lib/components/tabs/__internal__/tab-title/index.d.ts +2 -1
- package/lib/components/tabs/__internal__/tab-title/index.js +10 -2
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.d.ts +37 -3
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +99 -97
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.d.ts +18 -4
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.js +17 -53
- package/lib/components/tabs/__internal__/tabs-header/index.d.ts +2 -1
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.component.d.ts +13 -0
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.component.js +8 -8
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.d.ts +6 -6
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.js +9 -31
- package/lib/components/tabs/index.d.ts +3 -2
- package/lib/components/tabs/tab/index.d.ts +2 -2
- package/lib/components/tabs/tab/tab.component.d.ts +53 -0
- package/lib/components/tabs/tab/tab.component.js +181 -64
- package/lib/components/tabs/tab/tab.style.d.ts +8 -1
- package/lib/components/tabs/tab/tab.style.js +1 -7
- package/lib/components/tabs/tabs.component.d.ts +49 -0
- package/lib/components/tabs/tabs.component.js +188 -73
- package/lib/components/tabs/tabs.style.d.ts +5 -1
- package/lib/components/tabs/tabs.style.js +2 -9
- package/lib/components/textbox/textbox.component.d.ts +1 -1
- package/package.json +1 -1
- package/esm/components/detail/detail.d.ts +0 -16
- package/esm/components/tabs/__internal__/tab-title/tab-title.d.ts +0 -47
- package/esm/components/tabs/__internal__/tabs-header/tab-header.d.ts +0 -16
- package/esm/components/tabs/tab/tab.d.ts +0 -54
- package/esm/components/tabs/tabs.d.ts +0 -51
- package/lib/components/detail/detail.d.ts +0 -16
- package/lib/components/tabs/__internal__/tab-title/tab-title.d.ts +0 -47
- package/lib/components/tabs/__internal__/tabs-header/tab-header.d.ts +0 -16
- package/lib/components/tabs/tab/tab.d.ts +0 -54
- package/lib/components/tabs/tabs.d.ts +0 -51
|
@@ -2,7 +2,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState, createRef, cloneElement, Children } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
5
|
import Tab from "./tab";
|
|
7
6
|
import Event from "../../__internal__/utils/helpers/events";
|
|
8
7
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
@@ -10,8 +9,6 @@ import StyledTabs from "./tabs.style";
|
|
|
10
9
|
import TabsHeader from "./__internal__/tabs-header";
|
|
11
10
|
import TabTitle from "./__internal__/tab-title";
|
|
12
11
|
import { DrawerSidebarContext } from "../drawer";
|
|
13
|
-
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
14
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
15
12
|
|
|
16
13
|
const Tabs = ({
|
|
17
14
|
align = "left",
|
|
@@ -30,7 +27,13 @@ const Tabs = ({
|
|
|
30
27
|
showValidationsSummary,
|
|
31
28
|
...rest
|
|
32
29
|
}) => {
|
|
30
|
+
if (position !== "left" && headerWidth !== undefined) {
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.error("Invalid usage of prop headerWidth in Tabs. The headerWidth can be used only if position is set to left");
|
|
33
|
+
}
|
|
33
34
|
/** The children nodes converted into an Array */
|
|
35
|
+
|
|
36
|
+
|
|
34
37
|
const filteredChildren = useMemo(() => Children.toArray(children).filter(child => child), [children]);
|
|
35
38
|
/** Array of the tabIds for the child nodes */
|
|
36
39
|
|
|
@@ -84,7 +87,12 @@ const Tabs = ({
|
|
|
84
87
|
}
|
|
85
88
|
}, [onTabChange, isTabSelected, hasTabStop]);
|
|
86
89
|
const blurPreviousSelectedTab = useCallback(() => {
|
|
87
|
-
const
|
|
90
|
+
const {
|
|
91
|
+
current
|
|
92
|
+
} = previousSelectedTabId;
|
|
93
|
+
const previousTabIndex = current ? tabIds.indexOf(current) :
|
|
94
|
+
/* istanbul ignore next */
|
|
95
|
+
-1;
|
|
88
96
|
/* istanbul ignore else */
|
|
89
97
|
|
|
90
98
|
if (previousTabIndex !== -1) {
|
|
@@ -119,7 +127,11 @@ const Tabs = ({
|
|
|
119
127
|
/** Focuses the tab for the reference specified */
|
|
120
128
|
|
|
121
129
|
|
|
122
|
-
const focusTab = ref =>
|
|
130
|
+
const focusTab = ref => {
|
|
131
|
+
var _ref$current;
|
|
132
|
+
|
|
133
|
+
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
|
134
|
+
};
|
|
123
135
|
/** Will trigger the tab at the given index. */
|
|
124
136
|
|
|
125
137
|
|
|
@@ -211,7 +223,7 @@ const Tabs = ({
|
|
|
211
223
|
onClick: handleTabClick,
|
|
212
224
|
onKeyDown: handleKeyDown(index),
|
|
213
225
|
ref: tabRefs[index],
|
|
214
|
-
tabIndex: isTabSelected(tabId) || hasTabStop(tabId) ?
|
|
226
|
+
tabIndex: isTabSelected(tabId) || hasTabStop(tabId) ? 0 : -1,
|
|
215
227
|
title: title,
|
|
216
228
|
href: href,
|
|
217
229
|
isTabSelected: isTabSelected(tabId),
|
|
@@ -279,75 +291,181 @@ const Tabs = ({
|
|
|
279
291
|
|
|
280
292
|
return /*#__PURE__*/React.createElement(StyledTabs, _extends({
|
|
281
293
|
className: className,
|
|
282
|
-
position: isInSidebar ? "left" : position
|
|
283
|
-
updateErrors: updateErrors,
|
|
284
|
-
updateWarnings: updateWarnings
|
|
294
|
+
position: isInSidebar ? "left" : position
|
|
285
295
|
}, tagComponent("tabs", rest), {
|
|
286
296
|
isInSidebar: isInSidebar,
|
|
287
297
|
headerWidth: headerWidth
|
|
288
298
|
}, rest), renderTabHeaders(), renderTabs());
|
|
289
299
|
};
|
|
290
300
|
|
|
291
|
-
Tabs.propTypes = {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
301
|
+
Tabs.propTypes = {
|
|
302
|
+
"align": PropTypes.oneOf(["left", "right"]),
|
|
303
|
+
"borders": PropTypes.oneOf(["no left side", "no right side", "no sides", "off", "on"]),
|
|
304
|
+
"children": PropTypes.node,
|
|
305
|
+
"className": PropTypes.string,
|
|
306
|
+
"extendedLine": PropTypes.bool,
|
|
307
|
+
"headerWidth": PropTypes.string,
|
|
308
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
309
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
310
|
+
"description": PropTypes.string,
|
|
311
|
+
"toString": PropTypes.func.isRequired,
|
|
312
|
+
"valueOf": PropTypes.func.isRequired
|
|
313
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
314
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
315
|
+
"description": PropTypes.string,
|
|
316
|
+
"toString": PropTypes.func.isRequired,
|
|
317
|
+
"valueOf": PropTypes.func.isRequired
|
|
318
|
+
}), PropTypes.string]),
|
|
319
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
320
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
321
|
+
"description": PropTypes.string,
|
|
322
|
+
"toString": PropTypes.func.isRequired,
|
|
323
|
+
"valueOf": PropTypes.func.isRequired
|
|
324
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
325
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
326
|
+
"description": PropTypes.string,
|
|
327
|
+
"toString": PropTypes.func.isRequired,
|
|
328
|
+
"valueOf": PropTypes.func.isRequired
|
|
329
|
+
}), PropTypes.string]),
|
|
330
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
331
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
332
|
+
"description": PropTypes.string,
|
|
333
|
+
"toString": PropTypes.func.isRequired,
|
|
334
|
+
"valueOf": PropTypes.func.isRequired
|
|
335
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
336
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
337
|
+
"description": PropTypes.string,
|
|
338
|
+
"toString": PropTypes.func.isRequired,
|
|
339
|
+
"valueOf": PropTypes.func.isRequired
|
|
340
|
+
}), PropTypes.string]),
|
|
341
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
342
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
343
|
+
"description": PropTypes.string,
|
|
344
|
+
"toString": PropTypes.func.isRequired,
|
|
345
|
+
"valueOf": PropTypes.func.isRequired
|
|
346
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
347
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
348
|
+
"description": PropTypes.string,
|
|
349
|
+
"toString": PropTypes.func.isRequired,
|
|
350
|
+
"valueOf": PropTypes.func.isRequired
|
|
351
|
+
}), PropTypes.string]),
|
|
352
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
353
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
354
|
+
"description": PropTypes.string,
|
|
355
|
+
"toString": PropTypes.func.isRequired,
|
|
356
|
+
"valueOf": PropTypes.func.isRequired
|
|
357
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
358
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
359
|
+
"description": PropTypes.string,
|
|
360
|
+
"toString": PropTypes.func.isRequired,
|
|
361
|
+
"valueOf": PropTypes.func.isRequired
|
|
362
|
+
}), PropTypes.string]),
|
|
363
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
364
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
365
|
+
"description": PropTypes.string,
|
|
366
|
+
"toString": PropTypes.func.isRequired,
|
|
367
|
+
"valueOf": PropTypes.func.isRequired
|
|
368
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
369
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
370
|
+
"description": PropTypes.string,
|
|
371
|
+
"toString": PropTypes.func.isRequired,
|
|
372
|
+
"valueOf": PropTypes.func.isRequired
|
|
373
|
+
}), PropTypes.string]),
|
|
374
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
375
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
376
|
+
"description": PropTypes.string,
|
|
377
|
+
"toString": PropTypes.func.isRequired,
|
|
378
|
+
"valueOf": PropTypes.func.isRequired
|
|
379
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
380
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
381
|
+
"description": PropTypes.string,
|
|
382
|
+
"toString": PropTypes.func.isRequired,
|
|
383
|
+
"valueOf": PropTypes.func.isRequired
|
|
384
|
+
}), PropTypes.string]),
|
|
385
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
386
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
387
|
+
"description": PropTypes.string,
|
|
388
|
+
"toString": PropTypes.func.isRequired,
|
|
389
|
+
"valueOf": PropTypes.func.isRequired
|
|
390
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
391
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
392
|
+
"description": PropTypes.string,
|
|
393
|
+
"toString": PropTypes.func.isRequired,
|
|
394
|
+
"valueOf": PropTypes.func.isRequired
|
|
395
|
+
}), PropTypes.string]),
|
|
396
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
397
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
398
|
+
"description": PropTypes.string,
|
|
399
|
+
"toString": PropTypes.func.isRequired,
|
|
400
|
+
"valueOf": PropTypes.func.isRequired
|
|
401
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
402
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
403
|
+
"description": PropTypes.string,
|
|
404
|
+
"toString": PropTypes.func.isRequired,
|
|
405
|
+
"valueOf": PropTypes.func.isRequired
|
|
406
|
+
}), PropTypes.string]),
|
|
407
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
408
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
409
|
+
"description": PropTypes.string,
|
|
410
|
+
"toString": PropTypes.func.isRequired,
|
|
411
|
+
"valueOf": PropTypes.func.isRequired
|
|
412
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
413
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
414
|
+
"description": PropTypes.string,
|
|
415
|
+
"toString": PropTypes.func.isRequired,
|
|
416
|
+
"valueOf": PropTypes.func.isRequired
|
|
417
|
+
}), PropTypes.string]),
|
|
418
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
419
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
420
|
+
"description": PropTypes.string,
|
|
421
|
+
"toString": PropTypes.func.isRequired,
|
|
422
|
+
"valueOf": PropTypes.func.isRequired
|
|
423
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
424
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
425
|
+
"description": PropTypes.string,
|
|
426
|
+
"toString": PropTypes.func.isRequired,
|
|
427
|
+
"valueOf": PropTypes.func.isRequired
|
|
428
|
+
}), PropTypes.string]),
|
|
429
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
430
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
431
|
+
"description": PropTypes.string,
|
|
432
|
+
"toString": PropTypes.func.isRequired,
|
|
433
|
+
"valueOf": PropTypes.func.isRequired
|
|
434
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
435
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
436
|
+
"description": PropTypes.string,
|
|
437
|
+
"toString": PropTypes.func.isRequired,
|
|
438
|
+
"valueOf": PropTypes.func.isRequired
|
|
439
|
+
}), PropTypes.string]),
|
|
440
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
441
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
442
|
+
"description": PropTypes.string,
|
|
443
|
+
"toString": PropTypes.func.isRequired,
|
|
444
|
+
"valueOf": PropTypes.func.isRequired
|
|
445
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
446
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
447
|
+
"description": PropTypes.string,
|
|
448
|
+
"toString": PropTypes.func.isRequired,
|
|
449
|
+
"valueOf": PropTypes.func.isRequired
|
|
450
|
+
}), PropTypes.string]),
|
|
451
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
452
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
453
|
+
"description": PropTypes.string,
|
|
454
|
+
"toString": PropTypes.func.isRequired,
|
|
455
|
+
"valueOf": PropTypes.func.isRequired
|
|
456
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
457
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
458
|
+
"description": PropTypes.string,
|
|
459
|
+
"toString": PropTypes.func.isRequired,
|
|
460
|
+
"valueOf": PropTypes.func.isRequired
|
|
461
|
+
}), PropTypes.string]),
|
|
462
|
+
"onTabChange": PropTypes.func,
|
|
463
|
+
"position": PropTypes.oneOf(["left", "top"]),
|
|
464
|
+
"renderHiddenTabs": PropTypes.bool,
|
|
465
|
+
"selectedTabId": PropTypes.string,
|
|
466
|
+
"showValidationsSummary": PropTypes.bool,
|
|
467
|
+
"size": PropTypes.oneOf(["default", "large"]),
|
|
468
|
+
"validationStatusOverride": PropTypes.object,
|
|
469
|
+
"variant": PropTypes.oneOf(["alternate", "default"])
|
|
352
470
|
};
|
|
353
471
|
export { Tabs, Tab };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { TabsProps } from ".";
|
|
2
|
+
export interface StyledTabsProps extends Pick<TabsProps, "headerWidth" | "position"> {
|
|
3
|
+
isInSidebar?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const StyledTabs: import("styled-components").StyledComponent<"div", any, StyledTabsProps, never>;
|
|
1
6
|
export default StyledTabs;
|
|
2
|
-
declare const StyledTabs: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
3
|
import BaseTheme from "../../style/themes/base";
|
|
5
4
|
import { StyledTabsHeaderWrapper } from "./__internal__/tabs-header/tabs-header.style";
|
|
6
5
|
import StyledTab from "./tab/tab.style";
|
|
7
6
|
const StyledTabs = styled.div`
|
|
8
7
|
${({
|
|
9
8
|
position,
|
|
10
|
-
|
|
9
|
+
isInSidebar,
|
|
11
10
|
headerWidth
|
|
12
11
|
}) => css`
|
|
13
12
|
color: var(--colorsActionMinorYin090);
|
|
@@ -23,7 +22,7 @@ const StyledTabs = styled.div`
|
|
|
23
22
|
}
|
|
24
23
|
`}
|
|
25
24
|
|
|
26
|
-
${!
|
|
25
|
+
${!isInSidebar && css`
|
|
27
26
|
display: flex;
|
|
28
27
|
`}
|
|
29
28
|
|
|
@@ -34,11 +33,6 @@ const StyledTabs = styled.div`
|
|
|
34
33
|
${margin}
|
|
35
34
|
`;
|
|
36
35
|
StyledTabs.defaultProps = {
|
|
37
|
-
position: "top",
|
|
38
36
|
theme: BaseTheme
|
|
39
37
|
};
|
|
40
|
-
StyledTabs.propTypes = {
|
|
41
|
-
position: PropTypes.oneOf(["top", "left"]),
|
|
42
|
-
hasCustomTarget: PropTypes.bool
|
|
43
|
-
};
|
|
44
38
|
export default StyledTabs;
|
|
@@ -25,7 +25,7 @@ export interface CommonTextboxProps extends ValidationProps, MarginProps, Omit<C
|
|
|
25
25
|
formattedValue?: string;
|
|
26
26
|
/**
|
|
27
27
|
* Unique identifier for the input.
|
|
28
|
-
* Label id will be based on it, using following pattern:
|
|
28
|
+
* Label id will be based on it, using following pattern: [id]-label.
|
|
29
29
|
* Will use a randomly generated GUID if none is provided.
|
|
30
30
|
*/
|
|
31
31
|
id?: string;
|
|
@@ -17,7 +17,7 @@ declare const Events: {
|
|
|
17
17
|
/**
|
|
18
18
|
* Determines if event is a keyboard event
|
|
19
19
|
*/
|
|
20
|
-
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is React.KeyboardEvent<Element
|
|
20
|
+
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is KeyboardEvent | React.KeyboardEvent<Element>;
|
|
21
21
|
/**
|
|
22
22
|
* Determines if a number key along the top of the keyboard or a number key on the
|
|
23
23
|
* keypad is pressed
|
|
@@ -3,7 +3,7 @@ import { SpaceProps } from "styled-system";
|
|
|
3
3
|
import { StyledAccordionContainerProps } from "./accordion.style";
|
|
4
4
|
export interface AccordionProps extends StyledAccordionContainerProps, SpaceProps {
|
|
5
5
|
/** Width of the buttonHeading when it's set, defaults to 150px */
|
|
6
|
-
buttonWidth?: number;
|
|
6
|
+
buttonWidth?: number | string;
|
|
7
7
|
/** Content of the Accordion component */
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
/** Set the default state of expansion of the Accordion if component is meant to be used as uncontrolled */
|
|
@@ -49,7 +49,7 @@ const Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
49
49
|
warning,
|
|
50
50
|
info,
|
|
51
51
|
buttonHeading,
|
|
52
|
-
buttonWidth =
|
|
52
|
+
buttonWidth = "150px",
|
|
53
53
|
openTitle,
|
|
54
54
|
...rest
|
|
55
55
|
}, ref) => {
|
|
@@ -152,7 +152,7 @@ exports.Accordion = Accordion;
|
|
|
152
152
|
Accordion.propTypes = {
|
|
153
153
|
"borders": _propTypes.default.oneOf(["default", "full", "none"]),
|
|
154
154
|
"buttonHeading": _propTypes.default.bool,
|
|
155
|
-
"buttonWidth": _propTypes.default.number,
|
|
155
|
+
"buttonWidth": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
156
156
|
"children": _propTypes.default.node,
|
|
157
157
|
"defaultExpanded": _propTypes.default.bool,
|
|
158
158
|
"disableContentPadding": _propTypes.default.bool,
|
|
@@ -28,7 +28,7 @@ interface StyledAccordionHeadingsContainerProps {
|
|
|
28
28
|
declare const StyledAccordionHeadingsContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionHeadingsContainerProps, never>;
|
|
29
29
|
interface StyledAccordionTitleContainerProps {
|
|
30
30
|
buttonHeading?: boolean;
|
|
31
|
-
buttonWidth?: number;
|
|
31
|
+
buttonWidth?: number | string;
|
|
32
32
|
hasButtonProps?: boolean;
|
|
33
33
|
iconAlign?: "left" | "right";
|
|
34
34
|
size?: "large" | "small";
|
|
@@ -180,7 +180,7 @@ const StyledAccordionTitleContainer = _styledComponents.default.div`
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
${buttonWidth && (0, _styledComponents.css)`
|
|
183
|
-
width: ${buttonWidth}px;
|
|
183
|
+
width: ${typeof buttonWidth === "number" ? `${buttonWidth}px` : buttonWidth};
|
|
184
184
|
`}
|
|
185
185
|
`}
|
|
186
186
|
`}
|
|
@@ -70,6 +70,9 @@ const DateInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
70
70
|
tooltipPosition,
|
|
71
71
|
value,
|
|
72
72
|
inputRef,
|
|
73
|
+
inputWidth,
|
|
74
|
+
labelWidth,
|
|
75
|
+
maxWidth,
|
|
73
76
|
...rest
|
|
74
77
|
}, ref) => {
|
|
75
78
|
const wrapperRef = (0, _react.useRef)();
|
|
@@ -336,7 +339,9 @@ const DateInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
336
339
|
"data-element": dataElement,
|
|
337
340
|
"data-role": dataRole
|
|
338
341
|
}, marginProps, {
|
|
339
|
-
applyDateRangeStyling: !!inputRefMap
|
|
342
|
+
applyDateRangeStyling: !!inputRefMap,
|
|
343
|
+
maxWidth: maxWidth,
|
|
344
|
+
inputWidth: inputWidth
|
|
340
345
|
}), /*#__PURE__*/_react.default.createElement(_textbox.default, _extends({}, (0, _utils2.filterOutStyledSystemSpacingProps)(rest), {
|
|
341
346
|
inputRef: inputRef,
|
|
342
347
|
value: computedValue(),
|
|
@@ -358,6 +363,9 @@ const DateInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
358
363
|
size: size,
|
|
359
364
|
disabled: disabled,
|
|
360
365
|
readOnly: readOnly,
|
|
366
|
+
inputWidth: inputWidth,
|
|
367
|
+
labelWidth: labelWidth,
|
|
368
|
+
maxWidth: maxWidth,
|
|
361
369
|
m: 0
|
|
362
370
|
})), /*#__PURE__*/_react.default.createElement(_datePicker.default, {
|
|
363
371
|
disablePortal: disablePortal,
|
|
@@ -40,8 +40,10 @@ const StyledDateInput = _styledComponents.default.div`
|
|
|
40
40
|
& ${_inputPresentation.default} {
|
|
41
41
|
flex: none;
|
|
42
42
|
width: ${({
|
|
43
|
+
inputWidth,
|
|
44
|
+
maxWidth,
|
|
43
45
|
size
|
|
44
|
-
}) => datePickerWidth[size]};
|
|
46
|
+
}) => maxWidth || inputWidth ? "" : datePickerWidth[size]};
|
|
45
47
|
|
|
46
48
|
${_input.default} {
|
|
47
49
|
margin-right: -8px;
|
|
@@ -50,11 +52,12 @@ const StyledDateInput = _styledComponents.default.div`
|
|
|
50
52
|
|
|
51
53
|
${({
|
|
52
54
|
applyDateRangeStyling,
|
|
55
|
+
maxWidth,
|
|
53
56
|
size,
|
|
54
57
|
labelInline
|
|
55
58
|
}) => applyDateRangeStyling && !labelInline && (0, _styledComponents.css)`
|
|
56
59
|
${_formField.FieldLineStyle} {
|
|
57
|
-
max-width: ${datePickerWidth[size]};
|
|
60
|
+
max-width: ${maxWidth || datePickerWidth[size]}};
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
${_validationMessage.default}, ${_label.default} {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { IconType } from "../icon";
|
|
4
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
5
|
+
export interface DetailProps extends MarginProps, TagProps {
|
|
6
|
+
/** Custom className. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** The type of icon to use. */
|
|
9
|
+
icon?: IconType;
|
|
10
|
+
/** A small detail to display under the main content. */
|
|
11
|
+
footnote?: string;
|
|
12
|
+
/** The rendered children of the component. */
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const Detail: {
|
|
16
|
+
({ className, icon, footnote, children, ...rest }: DetailProps): JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
export default Detail;
|