@deque/cauldron-react 4.6.0-canary.9fd91f42 → 4.7.0-canary.02e686cb
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.
|
@@ -9,10 +9,10 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
previousPageLabel?: string;
|
|
10
10
|
nextPageLabel?: string;
|
|
11
11
|
lastPageLabel?: string;
|
|
12
|
-
onNextPageClick?: () => void;
|
|
13
|
-
onPreviousPageClick?: () => void;
|
|
14
|
-
onFirstPageClick?: () => void;
|
|
15
|
-
onLastPageClick?: () => void;
|
|
12
|
+
onNextPageClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
+
onPreviousPageClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
14
|
+
onFirstPageClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
onLastPageClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
16
16
|
tooltipPlacement?: Placement;
|
|
17
17
|
thin?: boolean;
|
|
18
18
|
className?: string;
|
|
@@ -16,6 +16,7 @@ interface PageStatus {
|
|
|
16
16
|
currentPage: number;
|
|
17
17
|
pageStart: number;
|
|
18
18
|
pageEnd: number;
|
|
19
|
+
setCurrentPage: (page: number) => void;
|
|
19
20
|
}
|
|
20
21
|
export declare const usePagination: ({ totalItems, initialPageSize, initialPage }: Options) => {
|
|
21
22
|
pagination: PaginationResults;
|
|
@@ -8,6 +8,7 @@ export interface ToastProps {
|
|
|
8
8
|
toastRef: React.Ref<HTMLDivElement>;
|
|
9
9
|
focus?: boolean;
|
|
10
10
|
show?: boolean;
|
|
11
|
+
dismissible?: boolean;
|
|
11
12
|
children: React.ReactNode;
|
|
12
13
|
}
|
|
13
14
|
interface ToastState {
|
|
@@ -24,6 +25,7 @@ export default class Toast extends React.Component<ToastProps, ToastState> {
|
|
|
24
25
|
toastRef: () => void;
|
|
25
26
|
focus: boolean;
|
|
26
27
|
show: boolean;
|
|
28
|
+
dismissible: boolean;
|
|
27
29
|
};
|
|
28
30
|
static propTypes: {
|
|
29
31
|
children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
@@ -35,6 +37,7 @@ export default class Toast extends React.Component<ToastProps, ToastState> {
|
|
|
35
37
|
}>>;
|
|
36
38
|
focus: PropTypes.Requireable<boolean>;
|
|
37
39
|
show: PropTypes.Requireable<boolean>;
|
|
40
|
+
dismissible: PropTypes.Requireable<boolean>;
|
|
38
41
|
};
|
|
39
42
|
static displayName: string;
|
|
40
43
|
private el;
|
package/lib/index.js
CHANGED
|
@@ -2339,7 +2339,7 @@ var Toast = /** @class */ (function (_super) {
|
|
|
2339
2339
|
var _a = this.props, type = _a.type, children = _a.children,
|
|
2340
2340
|
// prevent `onDismiss` from being passed-through to DOM
|
|
2341
2341
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2342
|
-
onDismiss = _a.onDismiss, dismissText = _a.dismissText, toastRef = _a.toastRef, focus = _a.focus, show = _a.show, otherProps = tslib.__rest(_a, ["type", "children", "onDismiss", "dismissText", "toastRef", "focus", "show"]);
|
|
2342
|
+
onDismiss = _a.onDismiss, dismissText = _a.dismissText, toastRef = _a.toastRef, focus = _a.focus, show = _a.show, dismissible = _a.dismissible, otherProps = tslib.__rest(_a, ["type", "children", "onDismiss", "dismissText", "toastRef", "focus", "show", "dismissible"]);
|
|
2343
2343
|
var scrim = type === 'action-needed' && show ? (React__default.createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
|
|
2344
2344
|
var defaultProps = {
|
|
2345
2345
|
tabIndex: -1,
|
|
@@ -2356,7 +2356,7 @@ var Toast = /** @class */ (function (_super) {
|
|
|
2356
2356
|
React__default.createElement("div", { className: "Toast__message" },
|
|
2357
2357
|
React__default.createElement(Icon, { type: typeMap[type].icon }),
|
|
2358
2358
|
React__default.createElement("div", { className: "Toast__message-content" }, children)),
|
|
2359
|
-
type !== 'action-needed' && (React__default.createElement("button", { type: "button", className: 'Toast__dismiss', "aria-label": dismissText, onClick: this.dismissToast },
|
|
2359
|
+
type !== 'action-needed' && dismissible && (React__default.createElement("button", { type: "button", className: 'Toast__dismiss', "aria-label": dismissText, onClick: this.dismissToast },
|
|
2360
2360
|
React__default.createElement(Icon, { type: "close" })))),
|
|
2361
2361
|
scrim));
|
|
2362
2362
|
};
|
|
@@ -2407,7 +2407,8 @@ var Toast = /** @class */ (function (_super) {
|
|
|
2407
2407
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2408
2408
|
toastRef: function () { },
|
|
2409
2409
|
focus: true,
|
|
2410
|
-
show: false
|
|
2410
|
+
show: false,
|
|
2411
|
+
dismissible: true
|
|
2411
2412
|
};
|
|
2412
2413
|
Toast.propTypes = {
|
|
2413
2414
|
// the ui to be added as the message of the toast
|
|
@@ -2426,7 +2427,9 @@ var Toast = /** @class */ (function (_super) {
|
|
|
2426
2427
|
// whether or not to focus the toast
|
|
2427
2428
|
focus: PropTypes.bool,
|
|
2428
2429
|
// whether or not to show the toast
|
|
2429
|
-
show: PropTypes.bool
|
|
2430
|
+
show: PropTypes.bool,
|
|
2431
|
+
// whether or not the toast is dismissible
|
|
2432
|
+
dismissible: PropTypes.bool
|
|
2430
2433
|
};
|
|
2431
2434
|
Toast.displayName = 'Toast';
|
|
2432
2435
|
return Toast;
|
|
@@ -8365,7 +8368,6 @@ var Tabs = function (_a) {
|
|
|
8365
8368
|
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"]);
|
|
8366
8369
|
var _d = tslib.__read(React.useState(initialActiveIndex), 2), activeIndex = _d[0], setActiveIndex = _d[1];
|
|
8367
8370
|
var tabsRef = React.useRef(null);
|
|
8368
|
-
var focusedTabRef = React.useRef(null);
|
|
8369
8371
|
var tabs = React__default.Children.toArray(children).filter(function (child) { return child.type === Tab; });
|
|
8370
8372
|
var tabCount = tabs.length;
|
|
8371
8373
|
var handleClick = function (index) {
|
|
@@ -8438,14 +8440,15 @@ var Tabs = function (_a) {
|
|
|
8438
8440
|
}, [activeIndex]);
|
|
8439
8441
|
var config = tslib.__assign((_a = { id: id, className: classNames('Tab', {
|
|
8440
8442
|
'Tab--active': selected
|
|
8441
|
-
}), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.
|
|
8443
|
+
}), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.onClick = function () { return handleClick(index); }, _a), other);
|
|
8442
8444
|
return React__default.cloneElement(child, config);
|
|
8443
8445
|
});
|
|
8444
8446
|
useDidUpdate(function () {
|
|
8445
8447
|
var _a;
|
|
8446
|
-
(_a =
|
|
8448
|
+
var activeTab = (_a = tabsRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(':scope > [role="tablist"] > [aria-selected="true"]');
|
|
8449
|
+
activeTab === null || activeTab === void 0 ? void 0 : activeTab.focus();
|
|
8447
8450
|
if (typeof onChange === 'function') {
|
|
8448
|
-
onChange({ activeTabIndex: activeIndex, target:
|
|
8451
|
+
onChange({ activeTabIndex: activeIndex, target: activeTab });
|
|
8449
8452
|
}
|
|
8450
8453
|
}, [activeIndex]);
|
|
8451
8454
|
return (React__default.createElement("div", { className: classNames('Tabs', className, {
|
|
@@ -8717,7 +8720,8 @@ var usePagination = function (_a) {
|
|
|
8717
8720
|
var pageStatus = {
|
|
8718
8721
|
currentPage: currentPage,
|
|
8719
8722
|
pageStart: pageStart,
|
|
8720
|
-
pageEnd: pageEnd
|
|
8723
|
+
pageEnd: pageEnd,
|
|
8724
|
+
setCurrentPage: setCurrentPage
|
|
8721
8725
|
};
|
|
8722
8726
|
return { pagination: pagination, pageStatus: pageStatus };
|
|
8723
8727
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0-canary.02e686cb",
|
|
4
4
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"react-router-dom": "^5.1.2",
|
|
81
81
|
"rollup": "^2.23.0",
|
|
82
82
|
"sinon": "^10.0.0",
|
|
83
|
-
"ts-node": "^10.
|
|
83
|
+
"ts-node": "^10.9.1",
|
|
84
84
|
"typescript": "^4.7.3"
|
|
85
85
|
},
|
|
86
86
|
"repository": {
|