@doist/reactist 14.1.0 → 15.1.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/dist/reactist.cjs.development.js +509 -238
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/components/menu/menu.js +5 -2
- package/es/components/menu/menu.js.map +1 -1
- package/es/index.js +3 -2
- package/es/index.js.map +1 -1
- package/es/new-components/base-field/base-field.js +2 -2
- package/es/new-components/base-field/base-field.js.map +1 -1
- package/es/new-components/deprecated-modal/modal.js +219 -0
- package/es/new-components/deprecated-modal/modal.js.map +1 -0
- package/es/new-components/deprecated-modal/modal.module.css.js +4 -0
- package/es/new-components/deprecated-modal/modal.module.css.js.map +1 -0
- package/es/new-components/modal/modal.js +64 -11
- package/es/new-components/modal/modal.js.map +1 -1
- package/es/new-components/modal/modal.module.css.js +1 -1
- package/es/new-components/text-area/text-area.js +7 -3
- package/es/new-components/text-area/text-area.js.map +1 -1
- package/es/new-components/text-area/text-area.module.css.js +1 -1
- package/lib/components/menu/menu.js +1 -1
- package/lib/components/menu/menu.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +1 -1
- package/lib/new-components/base-field/base-field.d.ts +14 -9
- package/lib/new-components/base-field/base-field.js +1 -1
- package/lib/new-components/base-field/base-field.js.map +1 -1
- package/lib/new-components/deprecated-modal/index.d.ts +1 -0
- package/lib/new-components/deprecated-modal/modal-stories-components.d.ts +35 -0
- package/lib/new-components/deprecated-modal/modal.d.ts +157 -0
- package/lib/new-components/deprecated-modal/modal.js +2 -0
- package/lib/new-components/deprecated-modal/modal.js.map +1 -0
- package/lib/new-components/deprecated-modal/modal.module.css.js +2 -0
- package/lib/new-components/deprecated-modal/modal.module.css.js.map +1 -0
- package/lib/new-components/deprecated-modal/modal.test.d.ts +1 -0
- package/lib/new-components/modal/modal-stories-components.d.ts +2 -1
- package/lib/new-components/modal/modal.d.ts +1 -1
- package/lib/new-components/modal/modal.js +1 -1
- package/lib/new-components/modal/modal.js.map +1 -1
- package/lib/new-components/modal/modal.module.css.js +1 -1
- package/lib/new-components/text-area/text-area.d.ts +1 -1
- package/lib/new-components/text-area/text-area.js +1 -1
- package/lib/new-components/text-area/text-area.js.map +1 -1
- package/lib/new-components/text-area/text-area.module.css.js +1 -1
- package/lib/new-components/text-area/text-area.test.d.ts +1 -0
- package/package.json +5 -4
- package/styles/menu.css +1 -1
- package/styles/reactist.css +6 -5
- package/styles/text-area.css +1 -1
- package/styles/text-area.module.css.css +1 -1
|
@@ -10,14 +10,16 @@ var classNames = _interopDefault(require('classnames'));
|
|
|
10
10
|
var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
|
|
11
11
|
var tooltip = require('ariakit/tooltip');
|
|
12
12
|
var ariakitUtils = require('ariakit-utils');
|
|
13
|
-
var tab = require('ariakit/tab');
|
|
14
|
-
var dialog = require('@reach/dialog');
|
|
15
13
|
var FocusLock = _interopDefault(require('react-focus-lock'));
|
|
14
|
+
var ariaHidden = require('aria-hidden');
|
|
15
|
+
var dialog = require('ariakit/dialog');
|
|
16
|
+
var portal = require('ariakit/portal');
|
|
17
|
+
var tab = require('ariakit/tab');
|
|
16
18
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
17
19
|
var dayjs = _interopDefault(require('dayjs'));
|
|
18
20
|
var LocalizedFormat = _interopDefault(require('dayjs/plugin/localizedFormat'));
|
|
19
21
|
var Ariakit = require('ariakit/menu');
|
|
20
|
-
var
|
|
22
|
+
var dialog$1 = require('@reach/dialog');
|
|
21
23
|
|
|
22
24
|
function ownKeys(object, enumerableOnly) {
|
|
23
25
|
var keys = Object.keys(object);
|
|
@@ -1203,7 +1205,7 @@ function BaseField({
|
|
|
1203
1205
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
1204
1206
|
className: [className, modules_540a88ff.container, tone === 'error' ? modules_540a88ff.error : null, variant === 'bordered' ? modules_540a88ff.bordered : null],
|
|
1205
1207
|
maxWidth: maxWidth
|
|
1206
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
1208
|
+
}, label || secondaryLabel || auxiliaryLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
1207
1209
|
as: "span",
|
|
1208
1210
|
display: "flex",
|
|
1209
1211
|
justifyContent: "spaceBetween",
|
|
@@ -1219,7 +1221,7 @@ function BaseField({
|
|
|
1219
1221
|
}, "\u00A0(", secondaryLabel, ")") : null), auxiliaryLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
1220
1222
|
className: modules_540a88ff.auxiliaryLabel,
|
|
1221
1223
|
paddingLeft: "small"
|
|
1222
|
-
}, auxiliaryLabel) : null), children(childrenProps)), message ? /*#__PURE__*/React.createElement(FieldMessage, {
|
|
1224
|
+
}, auxiliaryLabel) : null) : null, children(childrenProps)), message ? /*#__PURE__*/React.createElement(FieldMessage, {
|
|
1223
1225
|
id: messageId,
|
|
1224
1226
|
tone: tone
|
|
1225
1227
|
}, message) : null, hint ? /*#__PURE__*/React.createElement(FieldHint, {
|
|
@@ -1463,9 +1465,9 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
|
|
|
1463
1465
|
}, hint) : null);
|
|
1464
1466
|
});
|
|
1465
1467
|
|
|
1466
|
-
var modules_2728c236 = {"
|
|
1468
|
+
var modules_2728c236 = {"textAreaContainer":"_61447829","bordered":"_76f4ad88","error":"_4df3452b"};
|
|
1467
1469
|
|
|
1468
|
-
const _excluded$k = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth"];
|
|
1470
|
+
const _excluded$k = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "hidden", "aria-describedby"];
|
|
1469
1471
|
|
|
1470
1472
|
function TextArea(_ref) {
|
|
1471
1473
|
let {
|
|
@@ -1477,7 +1479,9 @@ function TextArea(_ref) {
|
|
|
1477
1479
|
hint,
|
|
1478
1480
|
message,
|
|
1479
1481
|
tone,
|
|
1480
|
-
maxWidth
|
|
1482
|
+
maxWidth,
|
|
1483
|
+
hidden,
|
|
1484
|
+
'aria-describedby': ariaDescribedBy
|
|
1481
1485
|
} = _ref,
|
|
1482
1486
|
props = _objectWithoutProperties(_ref, _excluded$k);
|
|
1483
1487
|
|
|
@@ -1490,7 +1494,9 @@ function TextArea(_ref) {
|
|
|
1490
1494
|
hint: hint,
|
|
1491
1495
|
message: message,
|
|
1492
1496
|
tone: tone,
|
|
1493
|
-
|
|
1497
|
+
hidden: hidden,
|
|
1498
|
+
"aria-describedby": ariaDescribedBy,
|
|
1499
|
+
className: [modules_2728c236.textAreaContainer, tone === 'error' ? modules_2728c236.error : null, variant === 'bordered' ? modules_2728c236.bordered : null],
|
|
1494
1500
|
maxWidth: maxWidth
|
|
1495
1501
|
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1496
1502
|
width: "full",
|
|
@@ -1536,194 +1542,72 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
|
1536
1542
|
}))));
|
|
1537
1543
|
});
|
|
1538
1544
|
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
* when a given value has been changed from a previous call,
|
|
1542
|
-
* it will return the value prior to the change.
|
|
1543
|
-
*
|
|
1544
|
-
* Example:
|
|
1545
|
-
*
|
|
1546
|
-
* const [x, setX] = useState(1)
|
|
1547
|
-
* const prevX = usePrevious(x)
|
|
1548
|
-
*
|
|
1549
|
-
* Suppose `setX(2)` is called, then in the next component render
|
|
1550
|
-
* x = 2 and prevX = 1
|
|
1551
|
-
*/
|
|
1545
|
+
function getInitials(name) {
|
|
1546
|
+
var _initials;
|
|
1552
1547
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
ref.current = value;
|
|
1557
|
-
}, [value]);
|
|
1558
|
-
return ref.current;
|
|
1559
|
-
}
|
|
1548
|
+
if (!name) {
|
|
1549
|
+
return '';
|
|
1550
|
+
}
|
|
1560
1551
|
|
|
1561
|
-
|
|
1552
|
+
const seed = name.trim().split(' ');
|
|
1553
|
+
const firstInitial = seed[0];
|
|
1554
|
+
const lastInitial = seed[seed.length - 1];
|
|
1555
|
+
let initials = firstInitial == null ? void 0 : firstInitial[0];
|
|
1562
1556
|
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
* Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
|
|
1569
|
-
*/
|
|
1557
|
+
if (firstInitial != null && lastInitial != null && initials != null && // Better readable this way.
|
|
1558
|
+
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
1559
|
+
firstInitial[0] !== lastInitial[0]) {
|
|
1560
|
+
initials += lastInitial[0];
|
|
1561
|
+
}
|
|
1570
1562
|
|
|
1571
|
-
|
|
1572
|
-
children,
|
|
1573
|
-
selectedId,
|
|
1574
|
-
defaultSelectedId,
|
|
1575
|
-
variant = 'neutral',
|
|
1576
|
-
onSelectedIdChange
|
|
1577
|
-
}) {
|
|
1578
|
-
const tabState = tab.useTabState({
|
|
1579
|
-
selectedId,
|
|
1580
|
-
setSelectedId: onSelectedIdChange
|
|
1581
|
-
});
|
|
1582
|
-
const previousDefaultSelectedId = usePrevious(defaultSelectedId);
|
|
1583
|
-
const {
|
|
1584
|
-
selectedId: actualSelectedId,
|
|
1585
|
-
select
|
|
1586
|
-
} = tabState;
|
|
1587
|
-
React.useEffect(function selectDefaultTab() {
|
|
1588
|
-
if (!selectedId && defaultSelectedId !== previousDefaultSelectedId && defaultSelectedId !== actualSelectedId && defaultSelectedId !== undefined) {
|
|
1589
|
-
select(defaultSelectedId);
|
|
1590
|
-
}
|
|
1591
|
-
}, [selectedId, defaultSelectedId, actualSelectedId, select, previousDefaultSelectedId]);
|
|
1592
|
-
const memoizedTabState = React.useMemo(function memoizeTabState() {
|
|
1593
|
-
return {
|
|
1594
|
-
tabState,
|
|
1595
|
-
variant
|
|
1596
|
-
};
|
|
1597
|
-
}, [variant, tabState]);
|
|
1598
|
-
return /*#__PURE__*/React.createElement(TabsContext.Provider, {
|
|
1599
|
-
value: memoizedTabState
|
|
1600
|
-
}, children);
|
|
1563
|
+
return (_initials = initials) == null ? void 0 : _initials.toUpperCase();
|
|
1601
1564
|
}
|
|
1602
|
-
/**
|
|
1603
|
-
* Represents the individual tab elements within the group. Each `<Tab>` must have a corresponding `<TabPanel>` component.
|
|
1604
|
-
*/
|
|
1605
|
-
|
|
1606
|
-
const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
|
|
1607
|
-
let {
|
|
1608
|
-
as,
|
|
1609
|
-
children,
|
|
1610
|
-
id,
|
|
1611
|
-
exceptionallySetClassName
|
|
1612
|
-
} = _ref,
|
|
1613
|
-
props = _objectWithoutProperties(_ref, _excluded$m);
|
|
1614
1565
|
|
|
1615
|
-
|
|
1566
|
+
function emailToIndex(email, maxIndex) {
|
|
1567
|
+
const seed = email.split('@')[0];
|
|
1568
|
+
const hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0;
|
|
1569
|
+
return hash % maxIndex;
|
|
1570
|
+
}
|
|
1616
1571
|
|
|
1617
|
-
|
|
1618
|
-
return null;
|
|
1619
|
-
}
|
|
1572
|
+
var modules_08f3eeac = {"avatar":"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
|
|
1620
1573
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
tabState
|
|
1624
|
-
} = tabContextValue;
|
|
1625
|
-
return /*#__PURE__*/React.createElement(tab.Tab, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1626
|
-
as: as,
|
|
1627
|
-
className: classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + variant]),
|
|
1628
|
-
id: id,
|
|
1629
|
-
state: tabState,
|
|
1630
|
-
ref: ref
|
|
1631
|
-
}), children);
|
|
1632
|
-
});
|
|
1633
|
-
/**
|
|
1634
|
-
* A component used to group `<Tab>` elements together.
|
|
1635
|
-
*/
|
|
1574
|
+
const _excluded$m = ["user", "avatarUrl", "size", "className", "colorList", "exceptionallySetClassName"];
|
|
1575
|
+
const AVATAR_COLORS = ['#fcc652', '#e9952c', '#e16b2d', '#d84b40', '#e8435a', '#e5198a', '#ad3889', '#86389c', '#a8a8a8', '#98be2f', '#5d9d50', '#5f9f85', '#5bbcb6', '#32a3bf', '#2bafeb', '#2d88c3', '#3863cc', '#5e5e5e'];
|
|
1636
1576
|
|
|
1637
|
-
function
|
|
1577
|
+
function Avatar(_ref) {
|
|
1638
1578
|
let {
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1579
|
+
user,
|
|
1580
|
+
avatarUrl,
|
|
1581
|
+
size = 'l',
|
|
1582
|
+
className,
|
|
1583
|
+
colorList = AVATAR_COLORS,
|
|
1584
|
+
exceptionallySetClassName
|
|
1585
|
+
} = _ref,
|
|
1586
|
+
props = _objectWithoutProperties(_ref, _excluded$m);
|
|
1645
1587
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1588
|
+
const userInitials = getInitials(user.name) || getInitials(user.email);
|
|
1589
|
+
const avatarSize = size ? size : 'l';
|
|
1590
|
+
const style = avatarUrl ? {
|
|
1591
|
+
backgroundImage: "url(" + avatarUrl + ")",
|
|
1592
|
+
textIndent: '-9999px' // hide the initials
|
|
1649
1593
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
return (
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
React.createElement(Box, null, /*#__PURE__*/React.createElement(tab.TabList, _objectSpread2({
|
|
1659
|
-
state: tabState,
|
|
1660
|
-
as: Box,
|
|
1661
|
-
position: "relative",
|
|
1662
|
-
width: "maxContent"
|
|
1663
|
-
}, props), /*#__PURE__*/React.createElement(Box, {
|
|
1664
|
-
className: classNames(modules_40c67f5b.track, modules_40c67f5b["track-" + space], modules_40c67f5b["track-" + variant])
|
|
1665
|
-
}), /*#__PURE__*/React.createElement(Inline, {
|
|
1666
|
-
space: space
|
|
1667
|
-
}, children)))
|
|
1668
|
-
);
|
|
1594
|
+
} : {
|
|
1595
|
+
backgroundColor: colorList[emailToIndex(user.email, colorList.length)]
|
|
1596
|
+
};
|
|
1597
|
+
const sizeClassName = getClassNames(modules_08f3eeac, 'size', avatarSize);
|
|
1598
|
+
return /*#__PURE__*/React__default.createElement(Box, _objectSpread2({
|
|
1599
|
+
className: [className, modules_08f3eeac.avatar, sizeClassName, exceptionallySetClassName],
|
|
1600
|
+
style: style
|
|
1601
|
+
}, props), userInitials);
|
|
1669
1602
|
}
|
|
1670
|
-
/**
|
|
1671
|
-
* Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a corresponding `<Tab>` component.
|
|
1672
|
-
*/
|
|
1673
|
-
|
|
1674
|
-
const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref3, ref) {
|
|
1675
|
-
let {
|
|
1676
|
-
children,
|
|
1677
|
-
id,
|
|
1678
|
-
as,
|
|
1679
|
-
render = 'always'
|
|
1680
|
-
} = _ref3,
|
|
1681
|
-
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
1682
|
-
|
|
1683
|
-
const tabContextValue = React.useContext(TabsContext);
|
|
1684
|
-
const [tabRendered, setTabRendered] = React.useState(false);
|
|
1685
|
-
const tabIsActive = (tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId) === id;
|
|
1686
|
-
React.useEffect(function trackTabRenderedState() {
|
|
1687
|
-
if (!tabRendered && tabIsActive) {
|
|
1688
|
-
setTabRendered(true);
|
|
1689
|
-
}
|
|
1690
|
-
}, [tabRendered, tabIsActive]);
|
|
1691
|
-
|
|
1692
|
-
if (!tabContextValue) {
|
|
1693
|
-
return null;
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
const {
|
|
1697
|
-
tabState
|
|
1698
|
-
} = tabContextValue;
|
|
1699
|
-
const shouldRender = render === 'always' || render === 'active' && tabIsActive || render === 'lazy' && (tabIsActive || tabRendered);
|
|
1700
|
-
return shouldRender ? /*#__PURE__*/React.createElement(tab.TabPanel, _objectSpread2(_objectSpread2({
|
|
1701
|
-
tabId: id
|
|
1702
|
-
}, props), {}, {
|
|
1703
|
-
state: tabState,
|
|
1704
|
-
as: as,
|
|
1705
|
-
ref: ref
|
|
1706
|
-
}), children) : null;
|
|
1707
|
-
});
|
|
1708
|
-
/**
|
|
1709
|
-
* Allows content to be rendered based on the current tab being selected while outside of the TabPanel
|
|
1710
|
-
* component. Can be placed freely within the main `<Tabs>` component.
|
|
1711
|
-
*/
|
|
1712
1603
|
|
|
1713
|
-
|
|
1714
|
-
children
|
|
1715
|
-
}) {
|
|
1716
|
-
const tabContextValue = React.useContext(TabsContext);
|
|
1717
|
-
return tabContextValue ? children({
|
|
1718
|
-
selectedId: tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId
|
|
1719
|
-
}) : null;
|
|
1720
|
-
}
|
|
1604
|
+
Avatar.displayName = 'Avatar';
|
|
1721
1605
|
|
|
1722
|
-
var modules_8f59d13b = {"
|
|
1606
|
+
var modules_8f59d13b = {"overlay":"_868392ae","fadein":"_63d7ee15","fitContent":"b8548bf2","container":"_31956461","full":"_1007df83","large":"_10c275aa","medium":"_0ac526b4","small":"_30f38fdb","xlarge":"_54868e8b","expand":"c0bc68bc","buttonContainer":"_6527332a","headerContent":"_4750dc1b"};
|
|
1723
1607
|
|
|
1724
1608
|
const _excluded$n = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
1725
|
-
_excluded2$
|
|
1726
|
-
_excluded3
|
|
1609
|
+
_excluded2$1 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
1610
|
+
_excluded3 = ["exceptionallySetClassName", "children"],
|
|
1727
1611
|
_excluded4 = ["exceptionallySetClassName", "withDivider"],
|
|
1728
1612
|
_excluded5 = ["children"];
|
|
1729
1613
|
const ModalContext = /*#__PURE__*/React.createContext({
|
|
@@ -1757,23 +1641,65 @@ function Modal(_ref) {
|
|
|
1757
1641
|
} = _ref,
|
|
1758
1642
|
props = _objectWithoutProperties(_ref, _excluded$n);
|
|
1759
1643
|
|
|
1644
|
+
const setVisible = React.useCallback(visible => {
|
|
1645
|
+
if (!visible) {
|
|
1646
|
+
onDismiss == null ? void 0 : onDismiss();
|
|
1647
|
+
}
|
|
1648
|
+
}, [onDismiss]);
|
|
1649
|
+
const state = dialog.useDialogState({
|
|
1650
|
+
visible: isOpen,
|
|
1651
|
+
setVisible
|
|
1652
|
+
});
|
|
1760
1653
|
const contextValue = React.useMemo(() => ({
|
|
1761
1654
|
onDismiss,
|
|
1762
1655
|
height
|
|
1763
1656
|
}), [onDismiss, height]);
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1657
|
+
const portalRef = React.useRef(null);
|
|
1658
|
+
const dialogRef = React.useRef(null);
|
|
1659
|
+
const backdropRef = React.useRef(null);
|
|
1660
|
+
const handleBackdropClick = React.useCallback(event => {
|
|
1661
|
+
var _dialogRef$current, _backdropRef$current;
|
|
1662
|
+
|
|
1663
|
+
if ( // The focus lock element takes up the same space as the backdrop and is where the event bubbles up from,
|
|
1664
|
+
// so instead of checking the backdrop as the event target, we need to make sure it's just above the dialog
|
|
1665
|
+
!((_dialogRef$current = dialogRef.current) != null && _dialogRef$current.contains(event.target)) && // Events fired from other portals will bubble up to the backdrop, even if it isn't a child in the DOM
|
|
1666
|
+
(_backdropRef$current = backdropRef.current) != null && _backdropRef$current.contains(event.target)) {
|
|
1667
|
+
event.stopPropagation();
|
|
1668
|
+
onDismiss == null ? void 0 : onDismiss();
|
|
1669
|
+
}
|
|
1670
|
+
}, [onDismiss]);
|
|
1671
|
+
React.useLayoutEffect(function disableAccessibilityTreeOutside() {
|
|
1672
|
+
if (!isOpen || !portalRef.current) {
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
return ariaHidden.hideOthers(portalRef.current);
|
|
1677
|
+
}, [isOpen]);
|
|
1678
|
+
|
|
1679
|
+
if (!isOpen) {
|
|
1680
|
+
return null;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
return /*#__PURE__*/React.createElement(portal.Portal // @ts-expect-error `portalRef` doesn't accept MutableRefObject initialized as null
|
|
1684
|
+
, {
|
|
1685
|
+
// @ts-expect-error `portalRef` doesn't accept MutableRefObject initialized as null
|
|
1686
|
+
portalRef: portalRef
|
|
1687
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
1688
|
+
"data-testid": "modal-overlay",
|
|
1689
|
+
"data-overlay": true,
|
|
1769
1690
|
className: classNames(modules_8f59d13b.overlay, modules_8f59d13b[height], modules_8f59d13b[width]),
|
|
1770
|
-
|
|
1691
|
+
onClick: handleBackdropClick,
|
|
1692
|
+
ref: backdropRef
|
|
1771
1693
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
1772
1694
|
autoFocus: autoFocus,
|
|
1773
1695
|
whiteList: isNotInternalFrame,
|
|
1774
1696
|
returnFocus: true
|
|
1775
|
-
}, /*#__PURE__*/React.createElement(dialog.
|
|
1697
|
+
}, /*#__PURE__*/React.createElement(dialog.Dialog, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1698
|
+
ref: dialogRef,
|
|
1776
1699
|
as: Box,
|
|
1700
|
+
state: state,
|
|
1701
|
+
hideOnEscape: true,
|
|
1702
|
+
preventBodyScroll: true,
|
|
1777
1703
|
borderRadius: "full",
|
|
1778
1704
|
background: "default",
|
|
1779
1705
|
display: "flex",
|
|
@@ -1781,10 +1707,19 @@ function Modal(_ref) {
|
|
|
1781
1707
|
overflow: "hidden",
|
|
1782
1708
|
height: height === 'expand' ? 'full' : undefined,
|
|
1783
1709
|
flexGrow: height === 'expand' ? 1 : 0,
|
|
1784
|
-
className: [exceptionallySetClassName, modules_8f59d13b.container]
|
|
1710
|
+
className: [exceptionallySetClassName, modules_8f59d13b.container],
|
|
1711
|
+
// Disable focus lock as we set up our own using ReactFocusLock
|
|
1712
|
+
modal: false,
|
|
1713
|
+
autoFocus: false,
|
|
1714
|
+
autoFocusOnShow: false,
|
|
1715
|
+
autoFocusOnHide: false,
|
|
1716
|
+
// Disable portal and backdrop as we control their markup
|
|
1717
|
+
portal: false,
|
|
1718
|
+
backdrop: false,
|
|
1719
|
+
hideOnInteractOutside: false
|
|
1785
1720
|
}), /*#__PURE__*/React.createElement(ModalContext.Provider, {
|
|
1786
1721
|
value: contextValue
|
|
1787
|
-
}, children))));
|
|
1722
|
+
}, children)))));
|
|
1788
1723
|
}
|
|
1789
1724
|
/**
|
|
1790
1725
|
* The close button rendered by ModalHeader. Provided independently so that consumers can customize
|
|
@@ -1828,7 +1763,7 @@ function ModalHeader(_ref2) {
|
|
|
1828
1763
|
withDivider = false,
|
|
1829
1764
|
exceptionallySetClassName
|
|
1830
1765
|
} = _ref2,
|
|
1831
|
-
props = _objectWithoutProperties(_ref2, _excluded2$
|
|
1766
|
+
props = _objectWithoutProperties(_ref2, _excluded2$1);
|
|
1832
1767
|
|
|
1833
1768
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1834
1769
|
as: "header",
|
|
@@ -1870,7 +1805,7 @@ function ModalBody(_ref3) {
|
|
|
1870
1805
|
exceptionallySetClassName,
|
|
1871
1806
|
children
|
|
1872
1807
|
} = _ref3,
|
|
1873
|
-
props = _objectWithoutProperties(_ref3, _excluded3
|
|
1808
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
1874
1809
|
|
|
1875
1810
|
const {
|
|
1876
1811
|
height
|
|
@@ -1924,66 +1859,188 @@ function ModalActions(_ref5) {
|
|
|
1924
1859
|
}, children));
|
|
1925
1860
|
}
|
|
1926
1861
|
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
1941
|
-
firstInitial[0] !== lastInitial[0]) {
|
|
1942
|
-
initials += lastInitial[0];
|
|
1943
|
-
}
|
|
1862
|
+
/**
|
|
1863
|
+
* usePrevious tracks the change of the given value -
|
|
1864
|
+
* when a given value has been changed from a previous call,
|
|
1865
|
+
* it will return the value prior to the change.
|
|
1866
|
+
*
|
|
1867
|
+
* Example:
|
|
1868
|
+
*
|
|
1869
|
+
* const [x, setX] = useState(1)
|
|
1870
|
+
* const prevX = usePrevious(x)
|
|
1871
|
+
*
|
|
1872
|
+
* Suppose `setX(2)` is called, then in the next component render
|
|
1873
|
+
* x = 2 and prevX = 1
|
|
1874
|
+
*/
|
|
1944
1875
|
|
|
1945
|
-
|
|
1876
|
+
function usePrevious(value) {
|
|
1877
|
+
const ref = React.useRef(null);
|
|
1878
|
+
React.useEffect(() => {
|
|
1879
|
+
ref.current = value;
|
|
1880
|
+
}, [value]);
|
|
1881
|
+
return ref.current;
|
|
1946
1882
|
}
|
|
1947
1883
|
|
|
1948
|
-
|
|
1949
|
-
const seed = email.split('@')[0];
|
|
1950
|
-
const hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0;
|
|
1951
|
-
return hash % maxIndex;
|
|
1952
|
-
}
|
|
1884
|
+
var modules_40c67f5b = {"tab":"a1064a3b","track":"_06f1b8a1","tab-neutral":"dabbec7d","tab-themed":"e6f5ae4e","track-neutral":"_43913ce5","track-themed":"_39bdfdde","track-xsmall":"_1c148f4e","track-small":"_2a370df5","track-medium":"_77430437","track-large":"_33db5352","track-xlarge":"_60bf9564","track-xxlarge":"_29a35080"};
|
|
1953
1885
|
|
|
1954
|
-
|
|
1886
|
+
const _excluded$o = ["as", "children", "id", "exceptionallySetClassName"],
|
|
1887
|
+
_excluded2$2 = ["children", "space"],
|
|
1888
|
+
_excluded3$1 = ["children", "id", "as", "render"];
|
|
1889
|
+
const TabsContext = /*#__PURE__*/React.createContext(null);
|
|
1890
|
+
/**
|
|
1891
|
+
* Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
|
|
1892
|
+
*/
|
|
1955
1893
|
|
|
1956
|
-
|
|
1957
|
-
|
|
1894
|
+
function Tabs({
|
|
1895
|
+
children,
|
|
1896
|
+
selectedId,
|
|
1897
|
+
defaultSelectedId,
|
|
1898
|
+
variant = 'neutral',
|
|
1899
|
+
onSelectedIdChange
|
|
1900
|
+
}) {
|
|
1901
|
+
const tabState = tab.useTabState({
|
|
1902
|
+
selectedId,
|
|
1903
|
+
setSelectedId: onSelectedIdChange
|
|
1904
|
+
});
|
|
1905
|
+
const previousDefaultSelectedId = usePrevious(defaultSelectedId);
|
|
1906
|
+
const {
|
|
1907
|
+
selectedId: actualSelectedId,
|
|
1908
|
+
select
|
|
1909
|
+
} = tabState;
|
|
1910
|
+
React.useEffect(function selectDefaultTab() {
|
|
1911
|
+
if (!selectedId && defaultSelectedId !== previousDefaultSelectedId && defaultSelectedId !== actualSelectedId && defaultSelectedId !== undefined) {
|
|
1912
|
+
select(defaultSelectedId);
|
|
1913
|
+
}
|
|
1914
|
+
}, [selectedId, defaultSelectedId, actualSelectedId, select, previousDefaultSelectedId]);
|
|
1915
|
+
const memoizedTabState = React.useMemo(function memoizeTabState() {
|
|
1916
|
+
return {
|
|
1917
|
+
tabState,
|
|
1918
|
+
variant
|
|
1919
|
+
};
|
|
1920
|
+
}, [variant, tabState]);
|
|
1921
|
+
return /*#__PURE__*/React.createElement(TabsContext.Provider, {
|
|
1922
|
+
value: memoizedTabState
|
|
1923
|
+
}, children);
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Represents the individual tab elements within the group. Each `<Tab>` must have a corresponding `<TabPanel>` component.
|
|
1927
|
+
*/
|
|
1958
1928
|
|
|
1959
|
-
function
|
|
1929
|
+
const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
|
|
1960
1930
|
let {
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
className,
|
|
1965
|
-
colorList = AVATAR_COLORS,
|
|
1931
|
+
as,
|
|
1932
|
+
children,
|
|
1933
|
+
id,
|
|
1966
1934
|
exceptionallySetClassName
|
|
1967
1935
|
} = _ref,
|
|
1968
1936
|
props = _objectWithoutProperties(_ref, _excluded$o);
|
|
1969
1937
|
|
|
1970
|
-
const
|
|
1971
|
-
const avatarSize = size ? size : 'l';
|
|
1972
|
-
const style = avatarUrl ? {
|
|
1973
|
-
backgroundImage: "url(" + avatarUrl + ")",
|
|
1974
|
-
textIndent: '-9999px' // hide the initials
|
|
1938
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1975
1939
|
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1940
|
+
if (!tabContextValue) {
|
|
1941
|
+
return null;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
const {
|
|
1945
|
+
variant,
|
|
1946
|
+
tabState
|
|
1947
|
+
} = tabContextValue;
|
|
1948
|
+
return /*#__PURE__*/React.createElement(tab.Tab, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1949
|
+
as: as,
|
|
1950
|
+
className: classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + variant]),
|
|
1951
|
+
id: id,
|
|
1952
|
+
state: tabState,
|
|
1953
|
+
ref: ref
|
|
1954
|
+
}), children);
|
|
1955
|
+
});
|
|
1956
|
+
/**
|
|
1957
|
+
* A component used to group `<Tab>` elements together.
|
|
1958
|
+
*/
|
|
1959
|
+
|
|
1960
|
+
function TabList(_ref2) {
|
|
1961
|
+
let {
|
|
1962
|
+
children,
|
|
1963
|
+
space = 'xsmall'
|
|
1964
|
+
} = _ref2,
|
|
1965
|
+
props = _objectWithoutProperties(_ref2, _excluded2$2);
|
|
1966
|
+
|
|
1967
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1968
|
+
|
|
1969
|
+
if (!tabContextValue) {
|
|
1970
|
+
return null;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
const {
|
|
1974
|
+
tabState,
|
|
1975
|
+
variant
|
|
1976
|
+
} = tabContextValue;
|
|
1977
|
+
return (
|
|
1978
|
+
/*#__PURE__*/
|
|
1979
|
+
// The extra <Box> prevents <Inline>'s negative margins from collapsing when used in a flex container
|
|
1980
|
+
// which will render the track with the wrong height
|
|
1981
|
+
React.createElement(Box, null, /*#__PURE__*/React.createElement(tab.TabList, _objectSpread2({
|
|
1982
|
+
state: tabState,
|
|
1983
|
+
as: Box,
|
|
1984
|
+
position: "relative",
|
|
1985
|
+
width: "maxContent"
|
|
1986
|
+
}, props), /*#__PURE__*/React.createElement(Box, {
|
|
1987
|
+
className: classNames(modules_40c67f5b.track, modules_40c67f5b["track-" + space], modules_40c67f5b["track-" + variant])
|
|
1988
|
+
}), /*#__PURE__*/React.createElement(Inline, {
|
|
1989
|
+
space: space
|
|
1990
|
+
}, children)))
|
|
1991
|
+
);
|
|
1984
1992
|
}
|
|
1993
|
+
/**
|
|
1994
|
+
* Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a corresponding `<Tab>` component.
|
|
1995
|
+
*/
|
|
1985
1996
|
|
|
1986
|
-
|
|
1997
|
+
const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref3, ref) {
|
|
1998
|
+
let {
|
|
1999
|
+
children,
|
|
2000
|
+
id,
|
|
2001
|
+
as,
|
|
2002
|
+
render = 'always'
|
|
2003
|
+
} = _ref3,
|
|
2004
|
+
props = _objectWithoutProperties(_ref3, _excluded3$1);
|
|
2005
|
+
|
|
2006
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
2007
|
+
const [tabRendered, setTabRendered] = React.useState(false);
|
|
2008
|
+
const tabIsActive = (tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId) === id;
|
|
2009
|
+
React.useEffect(function trackTabRenderedState() {
|
|
2010
|
+
if (!tabRendered && tabIsActive) {
|
|
2011
|
+
setTabRendered(true);
|
|
2012
|
+
}
|
|
2013
|
+
}, [tabRendered, tabIsActive]);
|
|
2014
|
+
|
|
2015
|
+
if (!tabContextValue) {
|
|
2016
|
+
return null;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
const {
|
|
2020
|
+
tabState
|
|
2021
|
+
} = tabContextValue;
|
|
2022
|
+
const shouldRender = render === 'always' || render === 'active' && tabIsActive || render === 'lazy' && (tabIsActive || tabRendered);
|
|
2023
|
+
return shouldRender ? /*#__PURE__*/React.createElement(tab.TabPanel, _objectSpread2(_objectSpread2({
|
|
2024
|
+
tabId: id
|
|
2025
|
+
}, props), {}, {
|
|
2026
|
+
state: tabState,
|
|
2027
|
+
as: as,
|
|
2028
|
+
ref: ref
|
|
2029
|
+
}), children) : null;
|
|
2030
|
+
});
|
|
2031
|
+
/**
|
|
2032
|
+
* Allows content to be rendered based on the current tab being selected while outside of the TabPanel
|
|
2033
|
+
* component. Can be placed freely within the main `<Tabs>` component.
|
|
2034
|
+
*/
|
|
2035
|
+
|
|
2036
|
+
function TabAwareSlot({
|
|
2037
|
+
children
|
|
2038
|
+
}) {
|
|
2039
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
2040
|
+
return tabContextValue ? children({
|
|
2041
|
+
selectedId: tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId
|
|
2042
|
+
}) : null;
|
|
2043
|
+
}
|
|
1987
2044
|
|
|
1988
2045
|
const _excluded$p = ["type", "variant", "size", "loading", "disabled", "tooltip", "onClick", "children"];
|
|
1989
2046
|
/**
|
|
@@ -2943,11 +3000,13 @@ const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref3, ref)
|
|
|
2943
3000
|
} = React.useContext(MenuContext);
|
|
2944
3001
|
return state.visible ? /*#__PURE__*/React.createElement(portal.Portal, {
|
|
2945
3002
|
preserveTabOrder: true
|
|
3003
|
+
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
3004
|
+
returnFocus: true
|
|
2946
3005
|
}, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2947
3006
|
state: state,
|
|
2948
3007
|
ref: ref,
|
|
2949
3008
|
className: classNames('reactist_menulist', exceptionallySetClassName)
|
|
2950
|
-
}))) : null;
|
|
3009
|
+
})))) : null;
|
|
2951
3010
|
});
|
|
2952
3011
|
/**
|
|
2953
3012
|
* A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`
|
|
@@ -3110,6 +3169,212 @@ Select.defaultProps = {
|
|
|
3110
3169
|
disabled: false
|
|
3111
3170
|
};
|
|
3112
3171
|
|
|
3172
|
+
var modules_8f59d13b$1 = {"reach-portal":"_37bef8d8","fadein":"_77f9687f","fitContent":"bcc4e0a5","container":"d4832c2d","full":"b0c3b021","large":"_573d6aa5","medium":"_8550d996","small":"_43bb18f5","xlarge":"_57b4159d","overlay":"cb63f300","expand":"e741893e","buttonContainer":"bb1ce281","headerContent":"c5ef989c"};
|
|
3173
|
+
|
|
3174
|
+
const _excluded$v = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
3175
|
+
_excluded2$4 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
3176
|
+
_excluded3$3 = ["exceptionallySetClassName", "children"],
|
|
3177
|
+
_excluded4$2 = ["exceptionallySetClassName", "withDivider"],
|
|
3178
|
+
_excluded5$2 = ["children"];
|
|
3179
|
+
const ModalContext$1 = /*#__PURE__*/React.createContext({
|
|
3180
|
+
onDismiss: undefined,
|
|
3181
|
+
height: 'fitContent'
|
|
3182
|
+
});
|
|
3183
|
+
|
|
3184
|
+
function isNotInternalFrame$1(element) {
|
|
3185
|
+
return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe');
|
|
3186
|
+
}
|
|
3187
|
+
/**
|
|
3188
|
+
* Renders a modal that sits on top of the rest of the content in the entire page.
|
|
3189
|
+
*
|
|
3190
|
+
* Follows the WAI-ARIA Dialog (Modal) Pattern.
|
|
3191
|
+
*
|
|
3192
|
+
* @see DeprecatedModalHeader
|
|
3193
|
+
* @see DeprecatedModalFooter
|
|
3194
|
+
* @see DeprecatedModalBody
|
|
3195
|
+
* @deprecated
|
|
3196
|
+
*/
|
|
3197
|
+
|
|
3198
|
+
|
|
3199
|
+
function DeprecatedModal(_ref) {
|
|
3200
|
+
let {
|
|
3201
|
+
isOpen,
|
|
3202
|
+
onDismiss,
|
|
3203
|
+
height = 'fitContent',
|
|
3204
|
+
width = 'medium',
|
|
3205
|
+
exceptionallySetClassName,
|
|
3206
|
+
autoFocus = true,
|
|
3207
|
+
children
|
|
3208
|
+
} = _ref,
|
|
3209
|
+
props = _objectWithoutProperties(_ref, _excluded$v);
|
|
3210
|
+
|
|
3211
|
+
const contextValue = React.useMemo(() => ({
|
|
3212
|
+
onDismiss,
|
|
3213
|
+
height
|
|
3214
|
+
}), [onDismiss, height]);
|
|
3215
|
+
return /*#__PURE__*/React.createElement(dialog$1.DialogOverlay, {
|
|
3216
|
+
isOpen: isOpen,
|
|
3217
|
+
onDismiss: onDismiss,
|
|
3218
|
+
dangerouslyBypassFocusLock // We're setting up our own focus lock below
|
|
3219
|
+
: true,
|
|
3220
|
+
className: classNames(modules_8f59d13b$1.overlay, modules_8f59d13b$1[height], modules_8f59d13b$1[width]),
|
|
3221
|
+
"data-testid": "modal-overlay"
|
|
3222
|
+
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
3223
|
+
autoFocus: autoFocus,
|
|
3224
|
+
whiteList: isNotInternalFrame$1,
|
|
3225
|
+
returnFocus: true
|
|
3226
|
+
}, /*#__PURE__*/React.createElement(dialog$1.DialogContent, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3227
|
+
as: Box,
|
|
3228
|
+
borderRadius: "full",
|
|
3229
|
+
background: "default",
|
|
3230
|
+
display: "flex",
|
|
3231
|
+
flexDirection: "column",
|
|
3232
|
+
overflow: "hidden",
|
|
3233
|
+
height: height === 'expand' ? 'full' : undefined,
|
|
3234
|
+
flexGrow: height === 'expand' ? 1 : 0,
|
|
3235
|
+
className: [exceptionallySetClassName, modules_8f59d13b$1.container]
|
|
3236
|
+
}), /*#__PURE__*/React.createElement(ModalContext$1.Provider, {
|
|
3237
|
+
value: contextValue
|
|
3238
|
+
}, children))));
|
|
3239
|
+
}
|
|
3240
|
+
/**
|
|
3241
|
+
* The close button rendered by ModalHeader. Provided independently so that consumers can customize
|
|
3242
|
+
* the button's label.
|
|
3243
|
+
*
|
|
3244
|
+
* @see DeprecatedModalHeader
|
|
3245
|
+
*/
|
|
3246
|
+
|
|
3247
|
+
function DeprecatedModalCloseButton(props) {
|
|
3248
|
+
const {
|
|
3249
|
+
onDismiss
|
|
3250
|
+
} = React.useContext(ModalContext$1);
|
|
3251
|
+
const [includeInTabOrder, setIncludeInTabOrder] = React.useState(false);
|
|
3252
|
+
const [isMounted, setIsMounted] = React.useState(false);
|
|
3253
|
+
React.useEffect(function skipAutoFocus() {
|
|
3254
|
+
if (isMounted) {
|
|
3255
|
+
setIncludeInTabOrder(true);
|
|
3256
|
+
} else {
|
|
3257
|
+
setIsMounted(true);
|
|
3258
|
+
}
|
|
3259
|
+
}, [isMounted]);
|
|
3260
|
+
return /*#__PURE__*/React.createElement(Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3261
|
+
variant: "quaternary",
|
|
3262
|
+
onClick: onDismiss,
|
|
3263
|
+
icon: /*#__PURE__*/React.createElement(CloseIcon, null),
|
|
3264
|
+
tabIndex: includeInTabOrder ? 0 : -1
|
|
3265
|
+
}));
|
|
3266
|
+
}
|
|
3267
|
+
/**
|
|
3268
|
+
* Renders a standard modal header area with an optional close button.
|
|
3269
|
+
*
|
|
3270
|
+
* @see DeprecatedModal
|
|
3271
|
+
* @see DeprecatedModalFooter
|
|
3272
|
+
* @see DeprecatedModalBody
|
|
3273
|
+
*/
|
|
3274
|
+
|
|
3275
|
+
function DeprecatedModalHeader(_ref2) {
|
|
3276
|
+
let {
|
|
3277
|
+
children,
|
|
3278
|
+
button = true,
|
|
3279
|
+
withDivider = false,
|
|
3280
|
+
exceptionallySetClassName
|
|
3281
|
+
} = _ref2,
|
|
3282
|
+
props = _objectWithoutProperties(_ref2, _excluded2$4);
|
|
3283
|
+
|
|
3284
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3285
|
+
as: "header",
|
|
3286
|
+
paddingLeft: "large",
|
|
3287
|
+
paddingRight: button === false || button === null ? 'large' : 'small',
|
|
3288
|
+
paddingY: "small",
|
|
3289
|
+
className: exceptionallySetClassName
|
|
3290
|
+
}), /*#__PURE__*/React.createElement(Columns, {
|
|
3291
|
+
space: "large",
|
|
3292
|
+
alignY: "center"
|
|
3293
|
+
}, /*#__PURE__*/React.createElement(Column, {
|
|
3294
|
+
width: "auto"
|
|
3295
|
+
}, children), button === false || button === null ? /*#__PURE__*/React.createElement("div", {
|
|
3296
|
+
className: modules_8f59d13b$1.headerContent
|
|
3297
|
+
}) : /*#__PURE__*/React.createElement(Column, {
|
|
3298
|
+
width: "content",
|
|
3299
|
+
exceptionallySetClassName: modules_8f59d13b$1.buttonContainer,
|
|
3300
|
+
"data-testid": "button-container"
|
|
3301
|
+
}, typeof button === 'boolean' ? /*#__PURE__*/React.createElement(DeprecatedModalCloseButton, {
|
|
3302
|
+
"aria-label": "Close modal",
|
|
3303
|
+
autoFocus: false
|
|
3304
|
+
}) : button))), withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null);
|
|
3305
|
+
}
|
|
3306
|
+
/**
|
|
3307
|
+
* Renders the body of a modal.
|
|
3308
|
+
*
|
|
3309
|
+
* Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
|
|
3310
|
+
* things, that the contet of the modal body expands or contracts depending on the modal height
|
|
3311
|
+
* setting or the size of the content. The body content also automatically scrolls when it's too
|
|
3312
|
+
* large to fit the available space.
|
|
3313
|
+
*
|
|
3314
|
+
* @see DeprecatedModal
|
|
3315
|
+
* @see DeprecatedModalHeader
|
|
3316
|
+
* @see DeprecatedModalFooter
|
|
3317
|
+
*/
|
|
3318
|
+
|
|
3319
|
+
function DeprecatedModalBody(_ref3) {
|
|
3320
|
+
let {
|
|
3321
|
+
exceptionallySetClassName,
|
|
3322
|
+
children
|
|
3323
|
+
} = _ref3,
|
|
3324
|
+
props = _objectWithoutProperties(_ref3, _excluded3$3);
|
|
3325
|
+
|
|
3326
|
+
const {
|
|
3327
|
+
height
|
|
3328
|
+
} = React.useContext(ModalContext$1);
|
|
3329
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3330
|
+
className: exceptionallySetClassName,
|
|
3331
|
+
flexGrow: height === 'expand' ? 1 : 0,
|
|
3332
|
+
height: height === 'expand' ? 'full' : undefined,
|
|
3333
|
+
overflow: "auto"
|
|
3334
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
3335
|
+
padding: "large",
|
|
3336
|
+
paddingBottom: "xxlarge"
|
|
3337
|
+
}, children));
|
|
3338
|
+
}
|
|
3339
|
+
/**
|
|
3340
|
+
* Renders a standard modal footer area.
|
|
3341
|
+
*
|
|
3342
|
+
* @see DeprecatedModal
|
|
3343
|
+
* @see DeprecatedModalHeader
|
|
3344
|
+
* @see DeprecatedModalBody
|
|
3345
|
+
*/
|
|
3346
|
+
|
|
3347
|
+
function DeprecatedModalFooter(_ref4) {
|
|
3348
|
+
let {
|
|
3349
|
+
exceptionallySetClassName,
|
|
3350
|
+
withDivider = false
|
|
3351
|
+
} = _ref4,
|
|
3352
|
+
props = _objectWithoutProperties(_ref4, _excluded4$2);
|
|
3353
|
+
|
|
3354
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({
|
|
3355
|
+
as: "footer"
|
|
3356
|
+
}, props), {}, {
|
|
3357
|
+
className: exceptionallySetClassName,
|
|
3358
|
+
padding: "large"
|
|
3359
|
+
})));
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3362
|
+
* A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
|
|
3363
|
+
* @see DeprecatedModalFooter
|
|
3364
|
+
*/
|
|
3365
|
+
|
|
3366
|
+
function DeprecatedModalActions(_ref5) {
|
|
3367
|
+
let {
|
|
3368
|
+
children
|
|
3369
|
+
} = _ref5,
|
|
3370
|
+
props = _objectWithoutProperties(_ref5, _excluded5$2);
|
|
3371
|
+
|
|
3372
|
+
return /*#__PURE__*/React.createElement(DeprecatedModalFooter, _objectSpread2({}, props), /*#__PURE__*/React.createElement(Inline, {
|
|
3373
|
+
align: "right",
|
|
3374
|
+
space: "large"
|
|
3375
|
+
}, children));
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3113
3378
|
exports.Alert = Alert;
|
|
3114
3379
|
exports.Avatar = Avatar;
|
|
3115
3380
|
exports.Box = Box;
|
|
@@ -3123,6 +3388,12 @@ exports.Columns = Columns;
|
|
|
3123
3388
|
exports.DeprecatedButton = Button$1;
|
|
3124
3389
|
exports.DeprecatedDropdown = Dropdown;
|
|
3125
3390
|
exports.DeprecatedInput = Input;
|
|
3391
|
+
exports.DeprecatedModal = DeprecatedModal;
|
|
3392
|
+
exports.DeprecatedModalActions = DeprecatedModalActions;
|
|
3393
|
+
exports.DeprecatedModalBody = DeprecatedModalBody;
|
|
3394
|
+
exports.DeprecatedModalCloseButton = DeprecatedModalCloseButton;
|
|
3395
|
+
exports.DeprecatedModalFooter = DeprecatedModalFooter;
|
|
3396
|
+
exports.DeprecatedModalHeader = DeprecatedModalHeader;
|
|
3126
3397
|
exports.DeprecatedSelect = Select;
|
|
3127
3398
|
exports.Divider = Divider;
|
|
3128
3399
|
exports.Heading = Heading;
|