@deque/cauldron-react 3.0.1-canary.10f975c9 → 3.0.1-canary.343d9e04
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/lib/components/Panel/index.d.ts +2 -1
- package/lib/components/Tabs/Tabs.d.ts +3 -1
- package/lib/index.js +91 -51
- package/package.json +1 -1
|
@@ -7,10 +7,11 @@ interface PanelProps extends HTMLAttributes<HTMLElement> {
|
|
|
7
7
|
text: ReactElement<any>;
|
|
8
8
|
level: number | undefined;
|
|
9
9
|
};
|
|
10
|
+
collapsed?: boolean;
|
|
10
11
|
className?: string;
|
|
11
12
|
}
|
|
12
13
|
declare const Panel: {
|
|
13
|
-
({ children, className, heading, ...other }: PanelProps): JSX.Element;
|
|
14
|
+
({ children, collapsed, className, heading, ...other }: PanelProps): JSX.Element;
|
|
14
15
|
displayName: string;
|
|
15
16
|
propTypes: {
|
|
16
17
|
children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
@@ -5,6 +5,7 @@ declare type TabsProps = {
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
initialActiveIndex?: number;
|
|
7
7
|
thin?: boolean;
|
|
8
|
+
orientation?: 'horizontal' | 'vertical';
|
|
8
9
|
className?: string;
|
|
9
10
|
onChange?: ({ activeTabIndex, target }: {
|
|
10
11
|
activeTabIndex: number;
|
|
@@ -12,7 +13,7 @@ declare type TabsProps = {
|
|
|
12
13
|
}) => void;
|
|
13
14
|
} & Cauldron.LabelProps;
|
|
14
15
|
declare const Tabs: {
|
|
15
|
-
({ children, thin, initialActiveIndex, className, onChange, ...labelProp }: TabsProps): JSX.Element;
|
|
16
|
+
({ children, thin, orientation, initialActiveIndex, className, onChange, ...labelProp }: TabsProps): JSX.Element;
|
|
16
17
|
displayName: string;
|
|
17
18
|
propTypes: {
|
|
18
19
|
children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
@@ -20,6 +21,7 @@ declare const Tabs: {
|
|
|
20
21
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
21
22
|
initialActiveIndex: PropTypes.Requireable<number>;
|
|
22
23
|
thin: PropTypes.Requireable<boolean>;
|
|
24
|
+
orientation: PropTypes.Requireable<string>;
|
|
23
25
|
className: PropTypes.Requireable<string>;
|
|
24
26
|
};
|
|
25
27
|
};
|
package/lib/index.js
CHANGED
|
@@ -259,11 +259,11 @@ var Icon = React.forwardRef(function (_a, ref) {
|
|
|
259
259
|
var _b;
|
|
260
260
|
var label = _a.label, className = _a.className, type = _a.type, other = tslib.__rest(_a, ["label", "className", "type"]);
|
|
261
261
|
var isMounted = React.useRef(true);
|
|
262
|
-
var _c = type.match(/(.*)-(right|left|up|down)$/) || [
|
|
262
|
+
var _c = tslib.__read(type.match(/(.*)-(right|left|up|down)$/) || [
|
|
263
263
|
'',
|
|
264
264
|
type
|
|
265
|
-
], name = _c[1], direction = _c[2];
|
|
266
|
-
var _d = React.useState(null), IconSVG = _d[0], setIcon = _d[1];
|
|
265
|
+
], 3), name = _c[1], direction = _c[2];
|
|
266
|
+
var _d = tslib.__read(React.useState(null), 2), IconSVG = _d[0], setIcon = _d[1];
|
|
267
267
|
React.useEffect(function () {
|
|
268
268
|
isMounted.current = true;
|
|
269
269
|
// NOTE: we don't want to pollute test output with
|
|
@@ -479,9 +479,9 @@ var TopBar = /** @class */ (function (_super) {
|
|
|
479
479
|
args[_i] = arguments[_i];
|
|
480
480
|
}
|
|
481
481
|
// @ts-ignore we're just spreading the original args
|
|
482
|
-
_this.onKeyDown.apply(_this, args);
|
|
482
|
+
_this.onKeyDown.apply(_this, tslib.__spread(args));
|
|
483
483
|
if (child.props.onKeyDown) {
|
|
484
|
-
(_a = child.props).onKeyDown.apply(_a, args);
|
|
484
|
+
(_a = child.props).onKeyDown.apply(_a, tslib.__spread(args));
|
|
485
485
|
}
|
|
486
486
|
},
|
|
487
487
|
tabIndex: 0,
|
|
@@ -517,7 +517,7 @@ var TopBar = /** @class */ (function (_super) {
|
|
|
517
517
|
};
|
|
518
518
|
TopBar.prototype.onKeyDown = function (e) {
|
|
519
519
|
var key = keyname(e.which);
|
|
520
|
-
var menuItems = tslib.
|
|
520
|
+
var menuItems = tslib.__spread(this.menuItems);
|
|
521
521
|
// account for hidden side bar trigger (hamburger)
|
|
522
522
|
if (this.state.wide && this.props.hasTrigger) {
|
|
523
523
|
menuItems.shift();
|
|
@@ -669,7 +669,7 @@ var ClickOutsideListener = /** @class */ (function (_super) {
|
|
|
669
669
|
return ClickOutsideListener;
|
|
670
670
|
}(React__default.Component));
|
|
671
671
|
|
|
672
|
-
var _a = [38, 40, 9, 13, 32, 27], up = _a[0], down = _a[1], tab = _a[2], enter = _a[3], space = _a[4], esc = _a[5];
|
|
672
|
+
var _a = tslib.__read([38, 40, 9, 13, 32, 27], 6), up = _a[0], down = _a[1], tab = _a[2], enter = _a[3], space = _a[4], esc = _a[5];
|
|
673
673
|
var OptionsMenuList = /** @class */ (function (_super) {
|
|
674
674
|
tslib.__extends(OptionsMenuList, _super);
|
|
675
675
|
function OptionsMenuList(props) {
|
|
@@ -797,7 +797,7 @@ var OptionsMenuList = /** @class */ (function (_super) {
|
|
|
797
797
|
return OptionsMenuList;
|
|
798
798
|
}(React__default.Component));
|
|
799
799
|
|
|
800
|
-
var
|
|
800
|
+
var _a$1 = tslib.__read([40], 1), down$1 = _a$1[0];
|
|
801
801
|
var OptionsMenu = /** @class */ (function (_super) {
|
|
802
802
|
tslib.__extends(OptionsMenu, _super);
|
|
803
803
|
function OptionsMenu(props) {
|
|
@@ -999,8 +999,8 @@ var NavBar = function (_a) {
|
|
|
999
999
|
var children = _a.children, className = _a.className, _b = _a.collapsed, collapsed = _b === void 0 ? false : _b, _c = _a.navTriggerLabel, navTriggerLabel = _c === void 0 ? 'MAIN MENU' : _c, propId = _a.propId;
|
|
1000
1000
|
var navRef = React.useRef(null);
|
|
1001
1001
|
var triggerRef = React.useRef(null);
|
|
1002
|
-
var _d = React.useState(false), showDropdown = _d[0], setShowDropdown = _d[1];
|
|
1003
|
-
var
|
|
1002
|
+
var _d = tslib.__read(React.useState(false), 2), showDropdown = _d[0], setShowDropdown = _d[1];
|
|
1003
|
+
var _e = tslib.__read([propId] || nextId.useId(1, 'navbar'), 1), menuId = _e[0];
|
|
1004
1004
|
var showNavItems = !collapsed || (collapsed && showDropdown);
|
|
1005
1005
|
var handleOutSideEvent = function (e) {
|
|
1006
1006
|
var _a;
|
|
@@ -1136,9 +1136,9 @@ var SideBar = /** @class */ (function (_super) {
|
|
|
1136
1136
|
SideBar.prototype.animate = function () {
|
|
1137
1137
|
var _this = this;
|
|
1138
1138
|
var show = this.props.show;
|
|
1139
|
-
var _a = show
|
|
1139
|
+
var _a = tslib.__read(show
|
|
1140
1140
|
? ['SideBar--show', 'SideBar--show SideBar--active']
|
|
1141
|
-
: ['SideBar--show', ''], first = _a[0], second = _a[1];
|
|
1141
|
+
: ['SideBar--show', ''], 2), first = _a[0], second = _a[1];
|
|
1142
1142
|
this.setState({ animateClass: first });
|
|
1143
1143
|
// css3 animations require transition classes to be added on separate tics
|
|
1144
1144
|
setTimeout(function () {
|
|
@@ -1472,14 +1472,14 @@ var fireCustomEvent = function (show, button) {
|
|
|
1472
1472
|
function Tooltip(_a) {
|
|
1473
1473
|
var _this = this;
|
|
1474
1474
|
var propId = _a.id, _b = _a.placement, initialPlacement = _b === void 0 ? 'auto' : _b, children = _a.children, portal = _a.portal, target = _a.target, _c = _a.association, association = _c === void 0 ? 'aria-describedby' : _c, _d = _a.variant, variant = _d === void 0 ? 'text' : _d, _e = _a.show, showProp = _e === void 0 ? false : _e, _f = _a.hideElementOnHidden, hideElementOnHidden = _f === void 0 ? false : _f, className = _a.className, props = tslib.__rest(_a, ["id", "placement", "children", "portal", "target", "association", "variant", "show", "hideElementOnHidden", "className"]);
|
|
1475
|
-
var
|
|
1475
|
+
var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'tooltip'), 1), id = _g[0];
|
|
1476
1476
|
var hovering = React.useRef(false);
|
|
1477
|
-
var
|
|
1478
|
-
var
|
|
1479
|
-
var
|
|
1480
|
-
var
|
|
1481
|
-
var
|
|
1482
|
-
var
|
|
1477
|
+
var _h = tslib.__read(React.useState(initialPlacement), 2), placement = _h[0], setPlacement = _h[1];
|
|
1478
|
+
var _j = tslib.__read(React.useState(!!showProp), 2), showTooltip = _j[0], setShowTooltip = _j[1];
|
|
1479
|
+
var _k = tslib.__read(React.useState(null), 2), targetElement = _k[0], setTargetElement = _k[1];
|
|
1480
|
+
var _l = tslib.__read(React.useState(null), 2), tooltipElement = _l[0], setTooltipElement = _l[1];
|
|
1481
|
+
var _m = tslib.__read(React.useState(null), 2), arrowElement = _m[0], setArrowElement = _m[1];
|
|
1482
|
+
var _o = reactPopper.usePopper(targetElement, tooltipElement, {
|
|
1483
1483
|
placement: initialPlacement,
|
|
1484
1484
|
modifiers: [
|
|
1485
1485
|
{ name: 'preventOverflow', options: { padding: 8 } },
|
|
@@ -1487,7 +1487,7 @@ function Tooltip(_a) {
|
|
|
1487
1487
|
{ name: 'offset', options: { offset: [0, 8] } },
|
|
1488
1488
|
{ name: 'arrow', options: { padding: 5, element: arrowElement } }
|
|
1489
1489
|
]
|
|
1490
|
-
}), styles =
|
|
1490
|
+
}), styles = _o.styles, attributes = _o.attributes, update = _o.update;
|
|
1491
1491
|
var show = function () { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1492
1492
|
return tslib.__generator(this, function (_a) {
|
|
1493
1493
|
switch (_a.label) {
|
|
@@ -1740,19 +1740,29 @@ var Pointout = /** @class */ (function (_super) {
|
|
|
1740
1740
|
}
|
|
1741
1741
|
};
|
|
1742
1742
|
_this.handleOffscreenFocusIn = function (_a) {
|
|
1743
|
+
var e_1, _b;
|
|
1743
1744
|
var target = _a.target;
|
|
1744
|
-
var
|
|
1745
|
+
var _c = _this, offscreenRef = _c.offscreenRef, visibleRef = _c.visibleRef, getFocusableElements = _c.getFocusableElements;
|
|
1745
1746
|
var offscreenFocusable = getFocusableElements(offscreenRef);
|
|
1746
1747
|
var visibleFocusable = getFocusableElements(visibleRef);
|
|
1747
1748
|
var elementIndex = offscreenFocusable.findIndex(function (element) { return element === target; });
|
|
1748
1749
|
if (elementIndex === -1 || !visibleFocusable[elementIndex]) {
|
|
1749
1750
|
return;
|
|
1750
1751
|
}
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
var
|
|
1754
|
-
|
|
1755
|
-
|
|
1752
|
+
try {
|
|
1753
|
+
// Tag focusable elements
|
|
1754
|
+
for (var visibleFocusable_1 = tslib.__values(visibleFocusable), visibleFocusable_1_1 = visibleFocusable_1.next(); !visibleFocusable_1_1.done; visibleFocusable_1_1 = visibleFocusable_1.next()) {
|
|
1755
|
+
var element = visibleFocusable_1_1.value;
|
|
1756
|
+
element.setAttribute('data-focusable', 'true');
|
|
1757
|
+
element.setAttribute('tabindex', '-1');
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1761
|
+
finally {
|
|
1762
|
+
try {
|
|
1763
|
+
if (visibleFocusable_1_1 && !visibleFocusable_1_1.done && (_b = visibleFocusable_1["return"])) _b.call(visibleFocusable_1);
|
|
1764
|
+
}
|
|
1765
|
+
finally { if (e_1) throw e_1.error; }
|
|
1756
1766
|
}
|
|
1757
1767
|
visibleFocusable[elementIndex].classList.add('Pointout--focus-active');
|
|
1758
1768
|
};
|
|
@@ -1785,7 +1795,7 @@ var Pointout = /** @class */ (function (_super) {
|
|
|
1785
1795
|
top -= rect.top - portalNode.scrollTop;
|
|
1786
1796
|
left -= rect.left - portalNode.scrollLeft;
|
|
1787
1797
|
}
|
|
1788
|
-
var
|
|
1798
|
+
var _e = tslib.__read(arrowPosition.split('-'), 1), arrowBoxSide = _e[0];
|
|
1789
1799
|
var style;
|
|
1790
1800
|
switch (arrowBoxSide) {
|
|
1791
1801
|
case 'right':
|
|
@@ -2237,7 +2247,7 @@ var Select = React__default.forwardRef(function (_a, ref) {
|
|
|
2237
2247
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2238
2248
|
var onChangeEvent = onChange !== null && onChange !== void 0 ? onChange : (function () { });
|
|
2239
2249
|
var isControlled = typeof value !== 'undefined';
|
|
2240
|
-
var _c = React.useState(value || defaultValue || ''), currentValue = _c[0], setCurrentValue = _c[1];
|
|
2250
|
+
var _c = tslib.__read(React.useState(value || defaultValue || ''), 2), currentValue = _c[0], setCurrentValue = _c[1];
|
|
2241
2251
|
var handleChange = function (e) {
|
|
2242
2252
|
onChangeEvent(e);
|
|
2243
2253
|
if (isControlled) {
|
|
@@ -2294,8 +2304,8 @@ var RadioGroup = function (_a) {
|
|
|
2294
2304
|
_b = _a.onChange,
|
|
2295
2305
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2296
2306
|
onChange = _b === void 0 ? function () { } : _b, className = _a.className, other = tslib.__rest(_a, ["name", "radios", "defaultValue", "value", "onChange", "className"]);
|
|
2297
|
-
var _c = React.useState(value || defaultValue || null), currentValue = _c[0], setCurrentValue = _c[1];
|
|
2298
|
-
var _d = React.useState(null), focusIndex = _d[0], setFocusIndex = _d[1];
|
|
2307
|
+
var _c = tslib.__read(React.useState(value || defaultValue || null), 2), currentValue = _c[0], setCurrentValue = _c[1];
|
|
2308
|
+
var _d = tslib.__read(React.useState(null), 2), focusIndex = _d[0], setFocusIndex = _d[1];
|
|
2299
2309
|
var inputs = React.useRef([]);
|
|
2300
2310
|
var handleChange = function (value) { return setCurrentValue(value); };
|
|
2301
2311
|
var onRadioFocus = function (index) { return setFocusIndex(index); };
|
|
@@ -2364,8 +2374,8 @@ RadioGroup.displayName = 'RadioGroup';
|
|
|
2364
2374
|
|
|
2365
2375
|
var Checkbox = React.forwardRef(function (_a, ref) {
|
|
2366
2376
|
var id = _a.id, label = _a.label, error = _a.error, checkboxRef = _a.checkboxRef, className = _a.className, onChange = _a.onChange, ariaDescribedby = _a["aria-describedby"], _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, other = tslib.__rest(_a, ["id", "label", "error", "checkboxRef", "className", "onChange", 'aria-describedby', "disabled", "checked"]);
|
|
2367
|
-
var _d = React.useState(checked), isChecked = _d[0], setIsChecked = _d[1];
|
|
2368
|
-
var _e = React.useState(false), focused = _e[0], setFocused = _e[1];
|
|
2377
|
+
var _d = tslib.__read(React.useState(checked), 2), isChecked = _d[0], setIsChecked = _d[1];
|
|
2378
|
+
var _e = tslib.__read(React.useState(false), 2), focused = _e[0], setFocused = _e[1];
|
|
2369
2379
|
var checkRef = React.useRef(null);
|
|
2370
2380
|
React.useEffect(function () {
|
|
2371
2381
|
setIsChecked(checked);
|
|
@@ -8092,8 +8102,8 @@ var useDidUpdate = function (effect, dependencies) {
|
|
|
8092
8102
|
};
|
|
8093
8103
|
|
|
8094
8104
|
var Tabs = function (_a) {
|
|
8095
|
-
var children = _a.children, thin = _a.thin, _b = _a.initialActiveIndex, initialActiveIndex =
|
|
8096
|
-
var
|
|
8105
|
+
var children = _a.children, thin = _a.thin, _b = _a.orientation, orientation = _b === void 0 ? 'horizontal' : _b, _c = _a.initialActiveIndex, initialActiveIndex = _c === void 0 ? 0 : _c, className = _a.className, onChange = _a.onChange, labelProp = tslib.__rest(_a, ["children", "thin", "orientation", "initialActiveIndex", "className", "onChange"]);
|
|
8106
|
+
var _d = tslib.__read(React.useState(initialActiveIndex), 2), activeIndex = _d[0], setActiveIndex = _d[1];
|
|
8097
8107
|
var tabsRef = React.useRef(null);
|
|
8098
8108
|
var focusedTabRef = React.useRef(null);
|
|
8099
8109
|
var tabs = React__default.Children.toArray(children).filter(function (child) { return child.type === Tab; });
|
|
@@ -8104,34 +8114,48 @@ var Tabs = function (_a) {
|
|
|
8104
8114
|
var handleKeyDown = function (event) {
|
|
8105
8115
|
var key = event.key;
|
|
8106
8116
|
var newIndex = activeIndex;
|
|
8117
|
+
var forward;
|
|
8118
|
+
var backward;
|
|
8119
|
+
if (orientation === 'horizontal') {
|
|
8120
|
+
forward = 'ArrowRight';
|
|
8121
|
+
backward = 'ArrowLeft';
|
|
8122
|
+
}
|
|
8123
|
+
else {
|
|
8124
|
+
forward = 'ArrowDown';
|
|
8125
|
+
backward = 'ArrowUp';
|
|
8126
|
+
}
|
|
8107
8127
|
switch (key) {
|
|
8108
|
-
case
|
|
8128
|
+
case backward: {
|
|
8109
8129
|
newIndex = activeIndex - 1;
|
|
8110
8130
|
// circularity
|
|
8111
8131
|
if (newIndex === -1) {
|
|
8112
8132
|
newIndex = tabCount - 1;
|
|
8113
8133
|
}
|
|
8114
8134
|
setActiveIndex(newIndex);
|
|
8135
|
+
event.preventDefault();
|
|
8115
8136
|
break;
|
|
8116
8137
|
}
|
|
8117
|
-
case
|
|
8138
|
+
case forward: {
|
|
8118
8139
|
newIndex = activeIndex + 1;
|
|
8119
8140
|
// circularity
|
|
8120
8141
|
if (newIndex === tabCount) {
|
|
8121
8142
|
newIndex = 0;
|
|
8122
8143
|
}
|
|
8123
8144
|
setActiveIndex(newIndex);
|
|
8145
|
+
event.preventDefault();
|
|
8124
8146
|
break;
|
|
8125
8147
|
}
|
|
8126
8148
|
case 'Home': {
|
|
8127
8149
|
newIndex = 0;
|
|
8128
8150
|
setActiveIndex(newIndex);
|
|
8151
|
+
event.preventDefault();
|
|
8129
8152
|
break;
|
|
8130
8153
|
}
|
|
8131
8154
|
case 'End': {
|
|
8132
8155
|
event.preventDefault();
|
|
8133
8156
|
newIndex = tabCount - 1;
|
|
8134
8157
|
setActiveIndex(newIndex);
|
|
8158
|
+
event.preventDefault();
|
|
8135
8159
|
break;
|
|
8136
8160
|
}
|
|
8137
8161
|
}
|
|
@@ -8141,7 +8165,7 @@ var Tabs = function (_a) {
|
|
|
8141
8165
|
var _b;
|
|
8142
8166
|
var _c = child.props, target = _c.target, propId = _c.id, other = tslib.__rest(_c, ["target", "id"]);
|
|
8143
8167
|
var selected = index === activeIndex;
|
|
8144
|
-
var
|
|
8168
|
+
var _d = tslib.__read(propId ? [propId] : nextId.useId(1, 'tab'), 1), id = _d[0];
|
|
8145
8169
|
React.useEffect(function () {
|
|
8146
8170
|
var _a;
|
|
8147
8171
|
(_a = target.current) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-labelledby', id);
|
|
@@ -8164,7 +8188,9 @@ var Tabs = function (_a) {
|
|
|
8164
8188
|
}
|
|
8165
8189
|
}, [activeIndex]);
|
|
8166
8190
|
return (React__default.createElement("div", { className: classNames('Tabs', className, {
|
|
8167
|
-
'Tabs--thin': thin
|
|
8191
|
+
'Tabs--thin': thin,
|
|
8192
|
+
'Tabs--vertical': orientation === 'vertical',
|
|
8193
|
+
'Tabs--horizontal': orientation === 'horizontal'
|
|
8168
8194
|
}), ref: tabsRef },
|
|
8169
8195
|
React__default.createElement("ul", tslib.__assign({ role: "tablist", className: "Tablist" }, labelProp, { onKeyDown: handleKeyDown }), tabComponents)));
|
|
8170
8196
|
};
|
|
@@ -8175,12 +8201,13 @@ Tabs.propTypes = {
|
|
|
8175
8201
|
'aria-labelledby': PropTypes.string,
|
|
8176
8202
|
initialActiveIndex: PropTypes.number,
|
|
8177
8203
|
thin: PropTypes.bool,
|
|
8204
|
+
orientation: PropTypes.string,
|
|
8178
8205
|
className: PropTypes.string
|
|
8179
8206
|
};
|
|
8180
8207
|
|
|
8181
8208
|
var TabPanel = React.forwardRef(function (_a, ref) {
|
|
8182
8209
|
var children = _a.children, propId = _a.id, className = _a.className, other = tslib.__rest(_a, ["children", "id", "className"]);
|
|
8183
|
-
var
|
|
8210
|
+
var _b = tslib.__read(propId ? [propId] : nextId.useId(1, 'tabpanel'), 1), id = _b[0];
|
|
8184
8211
|
return (React__default.createElement("div", tslib.__assign({ role: "tabpanel", className: classNames('TabPanel', className), id: id, ref: ref }, other), children));
|
|
8185
8212
|
});
|
|
8186
8213
|
TabPanel.displayName = 'TabPanel';
|
|
@@ -8257,12 +8284,15 @@ Stepper.propTypes = {
|
|
|
8257
8284
|
};
|
|
8258
8285
|
|
|
8259
8286
|
var Panel = function (_a) {
|
|
8260
|
-
var
|
|
8287
|
+
var _b;
|
|
8288
|
+
var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
|
|
8261
8289
|
var Heading = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
|
|
8262
8290
|
? heading.level
|
|
8263
8291
|
: 2);
|
|
8264
8292
|
var headingId = typeof heading === 'object' && 'id' in heading ? heading.id : randomId();
|
|
8265
|
-
return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className
|
|
8293
|
+
return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
|
|
8294
|
+
_b['Panel--collapsed'] = collapsed,
|
|
8295
|
+
_b)) }, other),
|
|
8266
8296
|
React__default.createElement(Heading, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
|
|
8267
8297
|
? heading.text
|
|
8268
8298
|
: heading),
|
|
@@ -8337,9 +8367,9 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
|
|
|
8337
8367
|
var isFirstPage = currentPage === 1;
|
|
8338
8368
|
return (React__default.createElement("div", tslib.__assign({ ref: ref, className: classNames('Pagination', className) }, other),
|
|
8339
8369
|
React__default.createElement("ul", null,
|
|
8340
|
-
React__default.createElement("li", null, isFirstPage ? (React__default.createElement(TooltipTabstop, { tooltip: firstPageLabel, placement: tooltipPlacement },
|
|
8370
|
+
React__default.createElement("li", null, isFirstPage ? (React__default.createElement(TooltipTabstop, { hideElementOnHidden: true, association: "aria-labelledby", tooltip: firstPageLabel, placement: tooltipPlacement },
|
|
8341
8371
|
React__default.createElement(Icon, { type: "chevron-double-left" }))) : (React__default.createElement(IconButton, { icon: "chevron-double-left", tooltipPlacement: tooltipPlacement, label: firstPageLabel, onClick: onFirstPageClick }))),
|
|
8342
|
-
React__default.createElement("li", null, isFirstPage ? (React__default.createElement(TooltipTabstop, { tooltip: previousPageLabel, placement: tooltipPlacement },
|
|
8372
|
+
React__default.createElement("li", null, isFirstPage ? (React__default.createElement(TooltipTabstop, { hideElementOnHidden: true, association: "aria-labelledby", tooltip: previousPageLabel, placement: tooltipPlacement },
|
|
8343
8373
|
React__default.createElement(Icon, { type: "chevron-left" }))) : (React__default.createElement(IconButton, { icon: "chevron-left", tooltipPlacement: tooltipPlacement, label: previousPageLabel, onClick: onPreviousPageClick }))),
|
|
8344
8374
|
React__default.createElement("li", null,
|
|
8345
8375
|
React__default.createElement("span", { role: "log", "aria-atomic": "true" }, statusLabel || (React__default.createElement("span", null,
|
|
@@ -8350,9 +8380,9 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
|
|
|
8350
8380
|
React__default.createElement("strong", null, itemEnd),
|
|
8351
8381
|
" of ",
|
|
8352
8382
|
React__default.createElement("strong", null, totalItems))))),
|
|
8353
|
-
React__default.createElement("li", null, isLastPage ? (React__default.createElement(TooltipTabstop, { tooltip: nextPageLabel, placement: tooltipPlacement },
|
|
8383
|
+
React__default.createElement("li", null, isLastPage ? (React__default.createElement(TooltipTabstop, { hideElementOnHidden: true, association: "aria-labelledby", tooltip: nextPageLabel, placement: tooltipPlacement },
|
|
8354
8384
|
React__default.createElement(Icon, { type: "chevron-right" }))) : (React__default.createElement(IconButton, { icon: "chevron-right", tooltipPlacement: tooltipPlacement, label: nextPageLabel, onClick: onNextPageClick }))),
|
|
8355
|
-
React__default.createElement("li", null, isLastPage ? (React__default.createElement(TooltipTabstop, { tooltip: lastPageLabel, placement: tooltipPlacement },
|
|
8385
|
+
React__default.createElement("li", null, isLastPage ? (React__default.createElement(TooltipTabstop, { hideElementOnHidden: true, association: "aria-labelledby", tooltip: lastPageLabel, placement: tooltipPlacement },
|
|
8356
8386
|
React__default.createElement(Icon, { type: "chevron-double-right" }))) : (React__default.createElement(IconButton, { icon: "chevron-double-right", tooltipPlacement: tooltipPlacement, label: lastPageLabel, onClick: onLastPageClick }))))));
|
|
8357
8387
|
});
|
|
8358
8388
|
Pagination.displayName = 'Pagination';
|
|
@@ -8390,7 +8420,7 @@ var DARK_THEME_CLASS = 'cauldron--theme-dark';
|
|
|
8390
8420
|
var ThemeContext = React.createContext({});
|
|
8391
8421
|
var ThemeProvider = function (_a) {
|
|
8392
8422
|
var children = _a.children, _b = _a.context, context = _b === void 0 ? document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
|
|
8393
|
-
var _d = React.useState(initialTheme), theme = _d[0], setTheme = _d[1];
|
|
8423
|
+
var _d = tslib.__read(React.useState(initialTheme), 2), theme = _d[0], setTheme = _d[1];
|
|
8394
8424
|
var getThemeFromContext = function () {
|
|
8395
8425
|
return context.classList.contains(DARK_THEME_CLASS) ? 'dark' : 'light';
|
|
8396
8426
|
};
|
|
@@ -8403,12 +8433,22 @@ var ThemeProvider = function (_a) {
|
|
|
8403
8433
|
}, [context, theme]);
|
|
8404
8434
|
// Use a MutationObserver to track changes to the classes outside of the context of React
|
|
8405
8435
|
var handleMutation = function (mutationList) {
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
mutation
|
|
8410
|
-
|
|
8436
|
+
var e_1, _a;
|
|
8437
|
+
try {
|
|
8438
|
+
for (var mutationList_1 = tslib.__values(mutationList), mutationList_1_1 = mutationList_1.next(); !mutationList_1_1.done; mutationList_1_1 = mutationList_1.next()) {
|
|
8439
|
+
var mutation = mutationList_1_1.value;
|
|
8440
|
+
if (mutation.type === 'attributes' &&
|
|
8441
|
+
mutation.attributeName === 'class') {
|
|
8442
|
+
setTheme(getThemeFromContext());
|
|
8443
|
+
}
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8447
|
+
finally {
|
|
8448
|
+
try {
|
|
8449
|
+
if (mutationList_1_1 && !mutationList_1_1.done && (_a = mutationList_1["return"])) _a.call(mutationList_1);
|
|
8411
8450
|
}
|
|
8451
|
+
finally { if (e_1) throw e_1.error; }
|
|
8412
8452
|
}
|
|
8413
8453
|
};
|
|
8414
8454
|
React.useEffect(function () {
|