@carbon/react 1.77.0 → 1.78.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1038 -916
- package/es/components/Accordion/AccordionItem.js +1 -1
- package/es/components/BadgeIndicator/index.d.ts +23 -0
- package/es/components/BadgeIndicator/index.js +45 -0
- package/es/components/Breadcrumb/Breadcrumb.d.ts +5 -0
- package/es/components/Breadcrumb/Breadcrumb.js +8 -2
- package/es/components/Button/Button.d.ts +9 -0
- package/es/components/Button/Button.js +13 -0
- package/es/components/ComboBox/ComboBox.js +19 -15
- package/es/components/ComboButton/index.js +0 -1
- package/es/components/ContextMenu/useContextMenu.d.ts +0 -1
- package/es/components/ContextMenu/useContextMenu.js +1 -2
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +3 -2
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +1 -1
- package/es/components/IconButton/index.d.ts +7 -1
- package/es/components/IconButton/index.js +18 -2
- package/es/components/IconIndicator/index.d.ts +1 -1
- package/es/components/InlineLoading/InlineLoading.js +2 -5
- package/es/components/Menu/Menu.d.ts +1 -0
- package/es/components/Menu/Menu.js +5 -7
- package/es/components/Menu/MenuContext.d.ts +4 -4
- package/es/components/Menu/MenuContext.js +6 -1
- package/es/components/Menu/MenuItem.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +15 -23
- package/es/components/MenuButton/index.js +14 -2
- package/es/components/Modal/Modal.d.ts +3 -3
- package/es/components/Modal/Modal.js +9 -3
- package/es/components/Modal/next/index.d.ts +1 -5
- package/es/components/MultiSelect/MultiSelect.js +3 -2
- package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +5 -2
- package/es/components/MultiSelect/tools/sorting.js +8 -7
- package/es/components/Notification/Notification.js +5 -6
- package/es/components/NumberInput/NumberInput.js +12 -12
- package/es/components/OverflowMenu/OverflowMenu.d.ts +8 -20
- package/es/components/OverflowMenu/OverflowMenu.js +7 -9
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
- package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +11 -2
- package/es/components/ShapeIndicator/index.d.ts +29 -0
- package/es/components/ShapeIndicator/index.js +92 -0
- package/es/components/Tabs/Tabs.d.ts +6 -4
- package/es/components/Tabs/Tabs.js +27 -8
- package/es/components/Tag/OperationalTag.d.ts +1 -36
- package/es/components/Tag/OperationalTag.js +7 -5
- package/es/components/Text/Text.d.ts +11 -9
- package/es/components/Text/Text.js +6 -6
- package/es/components/Text/TextDirection.d.ts +7 -9
- package/es/components/Text/TextDirection.js +5 -2
- package/es/components/Text/TextDirectionContext.d.ts +14 -0
- package/es/components/Text/TextDirectionContext.js +6 -2
- package/es/components/Text/createTextComponent.d.ts +5 -5
- package/es/components/Text/createTextComponent.js +5 -4
- package/es/components/Text/index.d.ts +6 -7
- package/es/components/Text/index.js +3 -2
- package/es/components/Tile/Tile.d.ts +6 -0
- package/es/components/Tile/Tile.js +5 -9
- package/es/components/Toggletip/index.d.ts +3 -2
- package/es/components/Tooltip/DefinitionTooltip.d.ts +4 -0
- package/es/components/Tooltip/DefinitionTooltip.js +7 -1
- package/es/components/Tooltip/Tooltip.d.ts +5 -66
- package/es/components/Tooltip/Tooltip.js +26 -26
- package/es/components/UIShell/HeaderGlobalAction.d.ts +9 -0
- package/es/components/UIShell/HeaderGlobalAction.js +16 -1
- package/es/index.d.ts +4 -1
- package/es/index.js +2 -1
- package/es/internal/FloatingMenu.d.ts +83 -0
- package/es/internal/FloatingMenu.js +216 -408
- package/es/internal/wrapFocus.js +1 -1
- package/lib/components/Accordion/AccordionItem.js +1 -1
- package/lib/components/BadgeIndicator/index.d.ts +23 -0
- package/lib/components/BadgeIndicator/index.js +56 -0
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +5 -0
- package/lib/components/Breadcrumb/Breadcrumb.js +8 -2
- package/lib/components/Button/Button.d.ts +9 -0
- package/lib/components/Button/Button.js +13 -0
- package/lib/components/ComboBox/ComboBox.js +19 -15
- package/lib/components/ComboButton/index.js +0 -1
- package/lib/components/ContextMenu/useContextMenu.d.ts +0 -1
- package/lib/components/ContextMenu/useContextMenu.js +1 -2
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +2 -1
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +1 -1
- package/lib/components/IconButton/index.d.ts +7 -1
- package/lib/components/IconButton/index.js +18 -2
- package/lib/components/IconIndicator/index.d.ts +1 -1
- package/lib/components/InlineLoading/InlineLoading.js +2 -5
- package/lib/components/Menu/Menu.d.ts +1 -0
- package/lib/components/Menu/Menu.js +5 -7
- package/lib/components/Menu/MenuContext.d.ts +4 -4
- package/lib/components/Menu/MenuContext.js +6 -1
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +14 -22
- package/lib/components/MenuButton/index.js +14 -2
- package/lib/components/Modal/Modal.d.ts +3 -3
- package/lib/components/Modal/Modal.js +9 -3
- package/lib/components/Modal/next/index.d.ts +1 -5
- package/lib/components/MultiSelect/MultiSelect.js +2 -1
- package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +5 -2
- package/lib/components/MultiSelect/tools/sorting.js +8 -7
- package/lib/components/Notification/Notification.js +5 -6
- package/lib/components/NumberInput/NumberInput.js +12 -12
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +8 -20
- package/lib/components/OverflowMenu/OverflowMenu.js +7 -9
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
- package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +11 -2
- package/lib/components/ShapeIndicator/index.d.ts +29 -0
- package/lib/components/ShapeIndicator/index.js +104 -0
- package/lib/components/Tabs/Tabs.d.ts +6 -4
- package/lib/components/Tabs/Tabs.js +42 -23
- package/lib/components/Tag/OperationalTag.d.ts +1 -36
- package/lib/components/Tag/OperationalTag.js +6 -4
- package/lib/components/Text/Text.d.ts +11 -9
- package/lib/components/Text/Text.js +5 -5
- package/lib/components/Text/TextDirection.d.ts +7 -9
- package/lib/components/Text/TextDirection.js +5 -2
- package/lib/components/Text/TextDirectionContext.d.ts +14 -0
- package/lib/components/Text/TextDirectionContext.js +6 -2
- package/lib/components/Text/createTextComponent.d.ts +5 -5
- package/lib/components/Text/createTextComponent.js +5 -4
- package/lib/components/Text/index.d.ts +6 -7
- package/lib/components/Text/index.js +4 -3
- package/lib/components/Tile/Tile.d.ts +6 -0
- package/lib/components/Tile/Tile.js +5 -9
- package/lib/components/Toggletip/index.d.ts +3 -2
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +4 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +7 -1
- package/lib/components/Tooltip/Tooltip.d.ts +5 -66
- package/lib/components/Tooltip/Tooltip.js +26 -26
- package/lib/components/UIShell/HeaderGlobalAction.d.ts +9 -0
- package/lib/components/UIShell/HeaderGlobalAction.js +16 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +42 -40
- package/lib/internal/FloatingMenu.d.ts +83 -0
- package/lib/internal/FloatingMenu.js +216 -409
- package/lib/internal/wrapFocus.js +1 -1
- package/package.json +5 -5
- package/scss/components/badge-indicator/_badge-indicator.scss +9 -0
- package/scss/components/badge-indicator/_index.scss +9 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
|
+
var iconsReact = require('@carbon/icons-react');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
|
+
|
|
25
|
+
var _path;
|
|
26
|
+
const ShapeIndicatorKinds = ['failed', 'critical', 'high', 'medium', 'low', 'cautious', 'undefined', 'stable', 'informative', 'incomplete', 'draft'];
|
|
27
|
+
|
|
28
|
+
// TODO: update to import '@carbon/icons-react'
|
|
29
|
+
const incompleteIcon = props => /*#__PURE__*/React__default["default"].createElement("svg", _rollupPluginBabelHelpers["extends"]({
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
width: 16,
|
|
32
|
+
height: 16,
|
|
33
|
+
fill: "none",
|
|
34
|
+
"aria-hidden": "true"
|
|
35
|
+
}, props), /*#__PURE__*/React__default["default"].createElement("path", {
|
|
36
|
+
fill: "#fff",
|
|
37
|
+
fillOpacity: 0.01,
|
|
38
|
+
d: "M0 0h16v16H0z",
|
|
39
|
+
style: {
|
|
40
|
+
mixBlendMode: 'multiply'
|
|
41
|
+
}
|
|
42
|
+
}), _path || (_path = /*#__PURE__*/React__default["default"].createElement("path", {
|
|
43
|
+
fill: "#161616",
|
|
44
|
+
d: "M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm0 2a4.004 4.004 0 0 1 4 4H4a4.004 4.004 0 0 1 4-4Z"
|
|
45
|
+
})));
|
|
46
|
+
const shapeTypes = {
|
|
47
|
+
failed: iconsReact.Critical,
|
|
48
|
+
critical: iconsReact.CriticalSeverity,
|
|
49
|
+
high: iconsReact.Caution,
|
|
50
|
+
medium: iconsReact.DiamondFill,
|
|
51
|
+
low: iconsReact.LowSeverity,
|
|
52
|
+
cautious: iconsReact.Caution,
|
|
53
|
+
undefined: iconsReact.DiamondFill,
|
|
54
|
+
stable: iconsReact.CircleFill,
|
|
55
|
+
informative: iconsReact.LowSeverity,
|
|
56
|
+
incomplete: incompleteIcon,
|
|
57
|
+
draft: iconsReact.CircleStroke
|
|
58
|
+
};
|
|
59
|
+
const ShapeIndicator = /*#__PURE__*/React__default["default"].forwardRef(function ShapeIndicatorContent(_ref, ref) {
|
|
60
|
+
let {
|
|
61
|
+
className: customClassName,
|
|
62
|
+
kind,
|
|
63
|
+
label,
|
|
64
|
+
textSize = 12,
|
|
65
|
+
...rest
|
|
66
|
+
} = _ref;
|
|
67
|
+
const prefix = usePrefix.usePrefix();
|
|
68
|
+
const classNames = cx__default["default"](`${prefix}--shape-indicator`, customClassName, {
|
|
69
|
+
[`${prefix}--shape-indicator--14`]: textSize == 14
|
|
70
|
+
});
|
|
71
|
+
const ShapeForKind = shapeTypes[kind];
|
|
72
|
+
if (!ShapeForKind) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
76
|
+
className: classNames,
|
|
77
|
+
ref: ref
|
|
78
|
+
}, /*#__PURE__*/React__default["default"].createElement(ShapeForKind, {
|
|
79
|
+
size: 16,
|
|
80
|
+
className: `${prefix}--shape-indicator--${kind}`
|
|
81
|
+
}), label);
|
|
82
|
+
});
|
|
83
|
+
ShapeIndicator.propTypes = {
|
|
84
|
+
/**
|
|
85
|
+
* Specify an optional className to add.
|
|
86
|
+
*/
|
|
87
|
+
className: PropTypes__default["default"].string,
|
|
88
|
+
/**
|
|
89
|
+
* Specify the kind of the Shape Indicator
|
|
90
|
+
*/
|
|
91
|
+
kind: PropTypes__default["default"].oneOf(ShapeIndicatorKinds).isRequired,
|
|
92
|
+
/**
|
|
93
|
+
* Label next to the shape.
|
|
94
|
+
*/
|
|
95
|
+
label: PropTypes__default["default"].string.isRequired,
|
|
96
|
+
/**
|
|
97
|
+
* Specify the text size of the Shape Indicator. Defaults to 12.
|
|
98
|
+
*/
|
|
99
|
+
textSize: PropTypes__default["default"].oneOf([12, 14])
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
exports.ShapeIndicator = ShapeIndicator;
|
|
103
|
+
exports.ShapeIndicatorKinds = ShapeIndicatorKinds;
|
|
104
|
+
exports["default"] = ShapeIndicator;
|
|
@@ -353,10 +353,11 @@ export interface TabProps extends HTMLAttributes<HTMLElement> {
|
|
|
353
353
|
secondaryLabel?: string;
|
|
354
354
|
}
|
|
355
355
|
declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLElement>>;
|
|
356
|
-
/**
|
|
357
|
-
* IconTab
|
|
358
|
-
*/
|
|
359
356
|
export interface IconTabProps extends DivAttributes {
|
|
357
|
+
/**
|
|
358
|
+
* **Experimental**: Display an empty dot badge on the Tab.
|
|
359
|
+
*/
|
|
360
|
+
badgeIndicator?: boolean;
|
|
360
361
|
/**
|
|
361
362
|
* Provide an icon to be rendered inside `IconTab` as the visual label for Tab.
|
|
362
363
|
*/
|
|
@@ -377,7 +378,8 @@ export interface IconTabProps extends DivAttributes {
|
|
|
377
378
|
* Provide the label to be rendered inside the Tooltip. The label will use
|
|
378
379
|
* `aria-labelledby` and will fully describe the child node that is provided.
|
|
379
380
|
* This means that if you have text in the child node it will not be
|
|
380
|
-
* announced to the screen reader.
|
|
381
|
+
* announced to the screen reader. If using the badgeIndicator then provide a
|
|
382
|
+
* label with describing that there is a new notification.
|
|
381
383
|
*/
|
|
382
384
|
label: ReactNode;
|
|
383
385
|
/**
|
|
@@ -36,9 +36,10 @@ var deprecate = require('../../prop-types/deprecate.js');
|
|
|
36
36
|
var useEvent = require('../../internal/useEvent.js');
|
|
37
37
|
var useMatchMedia = require('../../internal/useMatchMedia.js');
|
|
38
38
|
require('../Text/index.js');
|
|
39
|
+
var index = require('../BadgeIndicator/index.js');
|
|
39
40
|
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js');
|
|
40
|
-
var Text = require('../Text/Text.js');
|
|
41
41
|
var match = require('../../internal/keyboard/match.js');
|
|
42
|
+
var Text = require('../Text/Text.js');
|
|
42
43
|
var keys = require('../../internal/keyboard/keys.js');
|
|
43
44
|
|
|
44
45
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -47,7 +48,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
47
48
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
48
49
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
49
50
|
|
|
50
|
-
var _ChevronLeft, _ChevronRight;
|
|
51
|
+
var _ChevronLeft, _ChevronRight, _BadgeIndicator;
|
|
51
52
|
const verticalTabHeight = 64;
|
|
52
53
|
|
|
53
54
|
// Used to manage the overall state of the Tabs
|
|
@@ -804,23 +805,26 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
804
805
|
onTabCloseRequest
|
|
805
806
|
} = React__default["default"].useContext(TabsContext);
|
|
806
807
|
const {
|
|
807
|
-
index,
|
|
808
|
+
index: index$1,
|
|
808
809
|
hasSecondaryLabel,
|
|
809
810
|
contained
|
|
810
811
|
} = React__default["default"].useContext(TabContext);
|
|
812
|
+
const {
|
|
813
|
+
badgeIndicator
|
|
814
|
+
} = React__default["default"].useContext(IconTabContext) || {};
|
|
811
815
|
const dismissIconRef = React.useRef(null);
|
|
812
816
|
const tabRef = React.useRef(null);
|
|
813
817
|
const ref = useMergedRefs.useMergedRefs([forwardRef, tabRef]);
|
|
814
818
|
const [ignoreHover, setIgnoreHover] = React.useState(false);
|
|
815
|
-
const id = `${baseId}-tab-${index}`;
|
|
816
|
-
const panelId = `${baseId}-tabpanel-${index}`;
|
|
819
|
+
const id = `${baseId}-tab-${index$1}`;
|
|
820
|
+
const panelId = `${baseId}-tabpanel-${index$1}`;
|
|
817
821
|
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
818
822
|
const isEllipsisActive = element => {
|
|
819
823
|
setIsEllipsisApplied(element.offsetHeight < element.scrollHeight);
|
|
820
824
|
return element.offsetHeight < element.scrollHeight;
|
|
821
825
|
};
|
|
822
826
|
const className = cx__default["default"](`${prefix}--tabs__nav-item`, `${prefix}--tabs__nav-link`, {
|
|
823
|
-
[`${prefix}--tabs__nav-item--selected`]: selectedIndex === index,
|
|
827
|
+
[`${prefix}--tabs__nav-item--selected`]: selectedIndex === index$1,
|
|
824
828
|
[`${prefix}--tabs__nav-item--disabled`]: disabled,
|
|
825
829
|
[`${prefix}--tabs__nav-item--hover-off`]: ignoreHover
|
|
826
830
|
}, customClassName);
|
|
@@ -856,7 +860,7 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
856
860
|
}, [prefix, id]);
|
|
857
861
|
const handleClose = evt => {
|
|
858
862
|
evt.stopPropagation();
|
|
859
|
-
onTabCloseRequest?.(index);
|
|
863
|
+
onTabCloseRequest?.(index$1);
|
|
860
864
|
|
|
861
865
|
// set focus after removing tab
|
|
862
866
|
if (tabRef.current && tabRef.current.parentElement) {
|
|
@@ -867,7 +871,7 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
867
871
|
}).length;
|
|
868
872
|
|
|
869
873
|
// if not removing last tab focus on next tab
|
|
870
|
-
if (tabRef.current && index + 1 !== tabCount) {
|
|
874
|
+
if (tabRef.current && index$1 + 1 !== tabCount) {
|
|
871
875
|
tabRef.current.focus();
|
|
872
876
|
}
|
|
873
877
|
// if removing last tab focus on previous tab
|
|
@@ -890,21 +894,21 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
890
894
|
})
|
|
891
895
|
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
892
896
|
type: "button",
|
|
893
|
-
tabIndex: selectedIndex === index && dismissable ? 0 : -1,
|
|
897
|
+
tabIndex: selectedIndex === index$1 && dismissable ? 0 : -1,
|
|
894
898
|
"aria-disabled": disabled,
|
|
895
|
-
"aria-hidden": selectedIndex === index && dismissable ? 'false' : 'true',
|
|
899
|
+
"aria-hidden": selectedIndex === index$1 && dismissable ? 'false' : 'true',
|
|
896
900
|
disabled: disabled,
|
|
897
901
|
className: cx__default["default"]({
|
|
898
902
|
[`${prefix}--tabs__nav-item--close-icon`]: dismissable,
|
|
899
903
|
[`${prefix}--visually-hidden`]: !dismissable,
|
|
900
|
-
[`${prefix}--tabs__nav-item--close-icon--selected`]: selectedIndex === index,
|
|
904
|
+
[`${prefix}--tabs__nav-item--close-icon--selected`]: selectedIndex === index$1,
|
|
901
905
|
[`${prefix}--tabs__nav-item--close-icon--disabled`]: disabled
|
|
902
906
|
}),
|
|
903
907
|
onClick: handleClose,
|
|
904
908
|
title: `Remove ${typeof children === 'string' ? children : ''} tab`,
|
|
905
909
|
ref: dismissIconRef
|
|
906
910
|
}, /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, {
|
|
907
|
-
"aria-hidden": selectedIndex === index && dismissable ? 'false' : 'true',
|
|
911
|
+
"aria-hidden": selectedIndex === index$1 && dismissable ? 'false' : 'true',
|
|
908
912
|
"aria-label": `Press delete to remove ${typeof children === 'string' ? children : ''} tab`
|
|
909
913
|
})));
|
|
910
914
|
const hasIcon = Icon ?? dismissable;
|
|
@@ -921,7 +925,7 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
921
925
|
}, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
922
926
|
"aria-controls": panelId,
|
|
923
927
|
"aria-disabled": disabled,
|
|
924
|
-
"aria-selected": selectedIndex === index,
|
|
928
|
+
"aria-selected": selectedIndex === index$1,
|
|
925
929
|
ref: ref,
|
|
926
930
|
id: id,
|
|
927
931
|
role: "tab",
|
|
@@ -932,11 +936,11 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
932
936
|
if (disabled) {
|
|
933
937
|
return;
|
|
934
938
|
}
|
|
935
|
-
setSelectedIndex(index);
|
|
939
|
+
setSelectedIndex(index$1);
|
|
936
940
|
onClick?.(evt);
|
|
937
941
|
},
|
|
938
942
|
onKeyDown: handleKeyDown,
|
|
939
|
-
tabIndex: selectedIndex === index ? '0' : '-1',
|
|
943
|
+
tabIndex: selectedIndex === index$1 ? '0' : '-1',
|
|
940
944
|
type: "button"
|
|
941
945
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
942
946
|
className: `${prefix}--tabs__nav-item-label-wrapper`
|
|
@@ -951,7 +955,7 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
951
955
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
952
956
|
"aria-controls": panelId,
|
|
953
957
|
"aria-disabled": disabled,
|
|
954
|
-
"aria-selected": selectedIndex === index,
|
|
958
|
+
"aria-selected": selectedIndex === index$1,
|
|
955
959
|
ref: ref,
|
|
956
960
|
id: id,
|
|
957
961
|
role: "tab",
|
|
@@ -961,11 +965,11 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
961
965
|
if (disabled) {
|
|
962
966
|
return;
|
|
963
967
|
}
|
|
964
|
-
setSelectedIndex(index);
|
|
968
|
+
setSelectedIndex(index$1);
|
|
965
969
|
onClick?.(evt);
|
|
966
970
|
},
|
|
967
971
|
onKeyDown: handleKeyDown,
|
|
968
|
-
tabIndex: selectedIndex === index ? '0' : '-1',
|
|
972
|
+
tabIndex: selectedIndex === index$1 ? '0' : '-1',
|
|
969
973
|
type: "button"
|
|
970
974
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
971
975
|
className: `${prefix}--tabs__nav-item-label-wrapper`
|
|
@@ -985,7 +989,7 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref10, forwardRef) {
|
|
|
985
989
|
as: "div",
|
|
986
990
|
className: `${prefix}--tabs__nav-item-secondary-label`,
|
|
987
991
|
title: secondaryLabel
|
|
988
|
-
}, secondaryLabel)), DismissIcon);
|
|
992
|
+
}, secondaryLabel), !disabled && badgeIndicator && (_BadgeIndicator || (_BadgeIndicator = /*#__PURE__*/React__default["default"].createElement(index.BadgeIndicator, null)))), DismissIcon);
|
|
989
993
|
});
|
|
990
994
|
Tab.propTypes = {
|
|
991
995
|
/**
|
|
@@ -1036,8 +1040,10 @@ Tab.propTypes = {
|
|
|
1036
1040
|
* IconTab
|
|
1037
1041
|
*/
|
|
1038
1042
|
|
|
1043
|
+
const IconTabContext = /*#__PURE__*/React.createContext(false);
|
|
1039
1044
|
const IconTab = /*#__PURE__*/React__default["default"].forwardRef(function IconTab(_ref11, ref) {
|
|
1040
1045
|
let {
|
|
1046
|
+
badgeIndicator,
|
|
1041
1047
|
children,
|
|
1042
1048
|
className: customClassName,
|
|
1043
1049
|
defaultOpen = false,
|
|
@@ -1047,8 +1053,16 @@ const IconTab = /*#__PURE__*/React__default["default"].forwardRef(function IconT
|
|
|
1047
1053
|
...rest
|
|
1048
1054
|
} = _ref11;
|
|
1049
1055
|
const prefix = usePrefix.usePrefix();
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1056
|
+
const value = React.useMemo(() => ({
|
|
1057
|
+
badgeIndicator
|
|
1058
|
+
}), [badgeIndicator]);
|
|
1059
|
+
const hasSize20 = /*#__PURE__*/React__default["default"].isValidElement(children) && children.props?.size === 20;
|
|
1060
|
+
const classNames = cx__default["default"](`${prefix}--tabs__nav-item--icon-only`, customClassName, {
|
|
1061
|
+
[`${prefix}--tabs__nav-item--icon-only__20`]: hasSize20
|
|
1062
|
+
});
|
|
1063
|
+
return /*#__PURE__*/React__default["default"].createElement(IconTabContext.Provider, {
|
|
1064
|
+
value: value
|
|
1065
|
+
}, /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
|
|
1052
1066
|
align: "bottom",
|
|
1053
1067
|
defaultOpen: defaultOpen,
|
|
1054
1068
|
className: `${prefix}--icon-tooltip`,
|
|
@@ -1058,9 +1072,13 @@ const IconTab = /*#__PURE__*/React__default["default"].forwardRef(function IconT
|
|
|
1058
1072
|
}, /*#__PURE__*/React__default["default"].createElement(Tab, _rollupPluginBabelHelpers["extends"]({
|
|
1059
1073
|
className: classNames,
|
|
1060
1074
|
ref: ref
|
|
1061
|
-
}, rest), children));
|
|
1075
|
+
}, rest), children)));
|
|
1062
1076
|
});
|
|
1063
1077
|
IconTab.propTypes = {
|
|
1078
|
+
/**
|
|
1079
|
+
* **Experimental**: Display an empty dot badge on the Tab.
|
|
1080
|
+
*/
|
|
1081
|
+
badgeIndicator: PropTypes__default["default"].bool,
|
|
1064
1082
|
/**
|
|
1065
1083
|
* Provide an icon to be rendered inside `IconTab` as the visual label for Tab.
|
|
1066
1084
|
*/
|
|
@@ -1081,7 +1099,8 @@ IconTab.propTypes = {
|
|
|
1081
1099
|
* Provide the label to be rendered inside the Tooltip. The label will use
|
|
1082
1100
|
* `aria-labelledby` and will fully describe the child node that is provided.
|
|
1083
1101
|
* This means that if you have text in the child node it will not be
|
|
1084
|
-
* announced to the screen reader.
|
|
1102
|
+
* announced to the screen reader. If using the badgeIndicator then provide a
|
|
1103
|
+
* label with describing that there is a new notification.
|
|
1085
1104
|
*/
|
|
1086
1105
|
label: PropTypes__default["default"].node.isRequired,
|
|
1087
1106
|
/**
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import React, { MouseEventHandler } from 'react';
|
|
9
8
|
import { PolymorphicProps } from '../../types/common';
|
|
10
9
|
import { SIZES } from './Tag';
|
|
@@ -54,40 +53,6 @@ export interface OperationalTagBaseProps {
|
|
|
54
53
|
type?: keyof typeof TYPES;
|
|
55
54
|
}
|
|
56
55
|
export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
|
|
57
|
-
declare const OperationalTag:
|
|
58
|
-
<T extends React.ElementType>({ className, disabled, id, renderIcon, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
59
|
-
propTypes: {
|
|
60
|
-
/**
|
|
61
|
-
* Provide a custom className that is applied to the containing <span>
|
|
62
|
-
*/
|
|
63
|
-
className: PropTypes.Requireable<string>;
|
|
64
|
-
/**
|
|
65
|
-
* Specify if the `OperationalTag` is disabled
|
|
66
|
-
*/
|
|
67
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
68
|
-
/**
|
|
69
|
-
* Specify the id for the tag.
|
|
70
|
-
*/
|
|
71
|
-
id: PropTypes.Requireable<string>;
|
|
72
|
-
/**
|
|
73
|
-
* Optional prop to render a custom icon.
|
|
74
|
-
* Can be a React component class
|
|
75
|
-
*/
|
|
76
|
-
renderIcon: PropTypes.Requireable<object>;
|
|
77
|
-
/**
|
|
78
|
-
* Specify the size of the Tag. Currently supports either `sm`,
|
|
79
|
-
* `md` (default) or `lg` sizes.
|
|
80
|
-
*/
|
|
81
|
-
size: PropTypes.Requireable<string>;
|
|
82
|
-
/**
|
|
83
|
-
* Provide text to be rendered inside of a the tag.
|
|
84
|
-
*/
|
|
85
|
-
text: PropTypes.Requireable<string>;
|
|
86
|
-
/**
|
|
87
|
-
* Specify the type of the `Tag`
|
|
88
|
-
*/
|
|
89
|
-
type: PropTypes.Requireable<string>;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
56
|
+
declare const OperationalTag: React.ForwardRefExoticComponent<Omit<OperationalTagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
92
57
|
export declare const types: string[];
|
|
93
58
|
export default OperationalTag;
|
|
@@ -20,6 +20,7 @@ require('../Tooltip/DefinitionTooltip.js');
|
|
|
20
20
|
var Tooltip = require('../Tooltip/Tooltip.js');
|
|
21
21
|
require('../Text/index.js');
|
|
22
22
|
var isEllipsisActive = require('./isEllipsisActive.js');
|
|
23
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
23
24
|
var Text = require('../Text/Text.js');
|
|
24
25
|
|
|
25
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -40,7 +41,7 @@ const TYPES = {
|
|
|
40
41
|
'cool-gray': 'Cool-Gray',
|
|
41
42
|
'warm-gray': 'Warm-Gray'
|
|
42
43
|
};
|
|
43
|
-
const OperationalTag = _ref => {
|
|
44
|
+
const OperationalTag = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
|
|
44
45
|
let {
|
|
45
46
|
className,
|
|
46
47
|
disabled,
|
|
@@ -61,6 +62,7 @@ const OperationalTag = _ref => {
|
|
|
61
62
|
setIsEllipsisApplied(isEllipsisActive.isEllipsisActive(newElement));
|
|
62
63
|
}, [prefix, tagRef]);
|
|
63
64
|
const tooltipClasses = cx__default["default"](`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
|
|
65
|
+
const combinedRef = mergeRefs["default"](tagRef, forwardRef);
|
|
64
66
|
if (isEllipsisApplied) {
|
|
65
67
|
return /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
|
|
66
68
|
label: text,
|
|
@@ -70,7 +72,7 @@ const OperationalTag = _ref => {
|
|
|
70
72
|
onMouseEnter: () => false,
|
|
71
73
|
closeOnActivation: true
|
|
72
74
|
}, /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
|
|
73
|
-
ref:
|
|
75
|
+
ref: combinedRef,
|
|
74
76
|
type: type,
|
|
75
77
|
size: size,
|
|
76
78
|
renderIcon: renderIcon,
|
|
@@ -83,7 +85,7 @@ const OperationalTag = _ref => {
|
|
|
83
85
|
}, text)));
|
|
84
86
|
}
|
|
85
87
|
return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
|
|
86
|
-
ref:
|
|
88
|
+
ref: combinedRef,
|
|
87
89
|
type: type,
|
|
88
90
|
size: size,
|
|
89
91
|
renderIcon: renderIcon,
|
|
@@ -94,7 +96,7 @@ const OperationalTag = _ref => {
|
|
|
94
96
|
title: text,
|
|
95
97
|
className: `${prefix}--tag__label`
|
|
96
98
|
}, text));
|
|
97
|
-
};
|
|
99
|
+
});
|
|
98
100
|
OperationalTag.propTypes = {
|
|
99
101
|
/**
|
|
100
102
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { type ElementType, type ReactElement, type ReactNode } from 'react';
|
|
8
|
+
import { PolymorphicComponentPropWithRef, PolymorphicRef } from '../../internal/PolymorphicProps';
|
|
9
|
+
import { type TextDir } from '.';
|
|
10
10
|
export interface TextBaseProps {
|
|
11
|
-
dir?: TextDir
|
|
11
|
+
dir?: TextDir;
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
}
|
|
14
|
-
export type TextProps<T extends
|
|
15
|
-
type TextComponent = <T extends
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export type TextProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, TextBaseProps>;
|
|
15
|
+
type TextComponent = <T extends ElementType = 'span'>(props: TextProps<T> & {
|
|
16
|
+
ref?: PolymorphicRef<T>;
|
|
17
|
+
}) => ReactElement | null;
|
|
18
|
+
export declare const Text: TextComponent;
|
|
19
|
+
export {};
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
|
+
require('./index.js');
|
|
15
16
|
var TextDirectionContext = require('./TextDirectionContext.js');
|
|
16
17
|
|
|
17
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -19,14 +20,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
20
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
20
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
22
|
|
|
22
|
-
const Text = /*#__PURE__*/
|
|
23
|
+
const Text = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
23
24
|
let {
|
|
24
25
|
as,
|
|
25
26
|
children,
|
|
26
27
|
dir = 'auto',
|
|
27
28
|
...rest
|
|
28
29
|
} = _ref;
|
|
29
|
-
// TODO: Update with context typing once its been converted to TS
|
|
30
30
|
const context = React.useContext(TextDirectionContext.TextDirectionContext);
|
|
31
31
|
const textProps = {};
|
|
32
32
|
const BaseComponent = as ?? 'span';
|
|
@@ -78,11 +78,11 @@ Text.propTypes = {
|
|
|
78
78
|
*/
|
|
79
79
|
dir: PropTypes__default["default"].oneOf(['ltr', 'rtl', 'auto'])
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
const getTextFromChildren = children => {
|
|
82
82
|
if (typeof children === 'string') {
|
|
83
83
|
return children;
|
|
84
84
|
}
|
|
85
|
-
const text =
|
|
85
|
+
const text = React.Children.map(children, child => {
|
|
86
86
|
if (typeof child === 'string') {
|
|
87
87
|
return child;
|
|
88
88
|
}
|
|
@@ -94,6 +94,6 @@ function getTextFromChildren(children) {
|
|
|
94
94
|
return text[0];
|
|
95
95
|
}
|
|
96
96
|
return text;
|
|
97
|
-
}
|
|
97
|
+
};
|
|
98
98
|
|
|
99
99
|
exports.Text = Text;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { ReactNode } from 'react';
|
|
9
|
-
|
|
10
|
-
export type GetTextDirection = (text: string | string[] | undefined) => TextDir;
|
|
9
|
+
import { type GetTextDirection, type TextDir } from '.';
|
|
11
10
|
export interface TextDirectionProps {
|
|
12
|
-
children: ReactNode
|
|
11
|
+
children: ReactNode;
|
|
13
12
|
dir?: TextDir;
|
|
14
13
|
getTextDirection?: GetTextDirection;
|
|
15
14
|
}
|
|
16
|
-
declare
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export declare const TextDirection: {
|
|
16
|
+
({ children, dir, getTextDirection, }: TextDirectionProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
propTypes: {
|
|
19
18
|
/**
|
|
20
19
|
* Provide children to be rendered inside of this component
|
|
21
20
|
*/
|
|
@@ -31,5 +30,4 @@ declare namespace TextDirection {
|
|
|
31
30
|
*/
|
|
32
31
|
getTextDirection: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
32
|
};
|
|
34
|
-
}
|
|
35
|
-
export { TextDirection };
|
|
33
|
+
};
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var PropTypes = require('prop-types');
|
|
13
13
|
var React = require('react');
|
|
14
|
+
require('./index.js');
|
|
14
15
|
var TextDirectionContext = require('./TextDirectionContext.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -18,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
19
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
const TextDirection = _ref => {
|
|
22
23
|
let {
|
|
23
24
|
children,
|
|
24
25
|
dir = 'auto',
|
|
@@ -33,11 +34,13 @@ function TextDirection(_ref) {
|
|
|
33
34
|
}, [dir]);
|
|
34
35
|
React.useEffect(() => {
|
|
35
36
|
savedCallback.current = getTextDirection;
|
|
37
|
+
// TODO: Is this `useEffect` supposed to have a dependency on
|
|
38
|
+
// `getTextDirection`?
|
|
36
39
|
});
|
|
37
40
|
return /*#__PURE__*/React__default["default"].createElement(TextDirectionContext.TextDirectionContext.Provider, {
|
|
38
41
|
value: value
|
|
39
42
|
}, children);
|
|
40
|
-
}
|
|
43
|
+
};
|
|
41
44
|
TextDirection.propTypes = {
|
|
42
45
|
/**
|
|
43
46
|
* Provide children to be rendered inside of this component
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { type MutableRefObject } from 'react';
|
|
8
|
+
export type TextDir = 'ltr' | 'rtl' | 'auto' | string;
|
|
9
|
+
export type GetTextDirection = (text: string | string[] | undefined) => TextDir;
|
|
10
|
+
export interface TextDirectionContextType {
|
|
11
|
+
direction: TextDir;
|
|
12
|
+
getTextDirection: MutableRefObject<GetTextDirection | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare const TextDirectionContext: import("react").Context<TextDirectionContextType>;
|
|
@@ -11,7 +11,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const TextDirectionContext = /*#__PURE__*/React.createContext({
|
|
15
|
+
direction: 'auto',
|
|
16
|
+
getTextDirection: {
|
|
17
|
+
current: undefined
|
|
18
|
+
}
|
|
19
|
+
});
|
|
16
20
|
|
|
17
21
|
exports.TextDirectionContext = TextDirectionContext;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
8
|
-
import { TextProps } from '
|
|
7
|
+
import { type ElementType } from 'react';
|
|
8
|
+
import { TextProps } from '.';
|
|
9
9
|
/**
|
|
10
10
|
* Create a text component wrapper for a given text node type. Useful for
|
|
11
11
|
* returning a `Text` component for a text node like a `<label>`.
|
|
12
12
|
* @param {string} element
|
|
13
13
|
* @param {string} displayName
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
16
|
-
(props: TextProps<
|
|
15
|
+
export declare const createTextComponent: (element: ElementType, displayName: string) => {
|
|
16
|
+
(props: TextProps<ElementType>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var React = require('react');
|
|
14
|
+
require('./index.js');
|
|
14
15
|
var Text = require('./Text.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -23,16 +24,16 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
24
|
* @param {string} element
|
|
24
25
|
* @param {string} displayName
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const createTextComponent = (element, displayName) => {
|
|
28
|
+
const TextWrapper = props => {
|
|
28
29
|
return /*#__PURE__*/React__default["default"].createElement(Text.Text, _rollupPluginBabelHelpers["extends"]({
|
|
29
30
|
as: element
|
|
30
31
|
}, props));
|
|
31
|
-
}
|
|
32
|
+
};
|
|
32
33
|
if (process.env.NODE_ENV !== "production") {
|
|
33
34
|
TextWrapper.displayName = displayName;
|
|
34
35
|
}
|
|
35
36
|
return TextWrapper;
|
|
36
|
-
}
|
|
37
|
+
};
|
|
37
38
|
|
|
38
39
|
exports.createTextComponent = createTextComponent;
|