@deque/cauldron-react 5.6.2 → 5.7.0-canary.7cfac7d0
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/NavBar/NavBar.d.ts +2 -3
- package/lib/components/Notice/index.d.ts +16 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +35 -3
- package/package.json +2 -2
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
interface NavBarProps {
|
|
3
|
+
interface NavBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
initialActiveIndex?: number;
|
|
6
5
|
className?: string;
|
|
7
6
|
collapsed?: boolean;
|
|
8
7
|
navTriggerLabel?: string;
|
|
9
8
|
propId?: string;
|
|
10
9
|
}
|
|
11
10
|
declare const NavBar: {
|
|
12
|
-
({ children, className, collapsed, navTriggerLabel, propId }: NavBarProps): JSX.Element;
|
|
11
|
+
({ children, className, collapsed, navTriggerLabel, propId, ...props }: NavBarProps): JSX.Element;
|
|
13
12
|
displayName: string;
|
|
14
13
|
propTypes: {
|
|
15
14
|
children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { IconType } from '../Icon';
|
|
3
|
+
import { ContentNode } from '../../types';
|
|
4
|
+
declare const iconTypeMap: {
|
|
5
|
+
caution: string;
|
|
6
|
+
danger: string;
|
|
7
|
+
info: string;
|
|
8
|
+
};
|
|
9
|
+
export interface NoticeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
10
|
+
type?: keyof typeof iconTypeMap;
|
|
11
|
+
title: ContentNode;
|
|
12
|
+
icon?: IconType;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const Notice: React.ForwardRefExoticComponent<NoticeProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default Notice;
|
package/lib/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export { default as Pagination, usePagination } from './components/Pagination';
|
|
|
51
51
|
export { default as FieldWrap } from './components/FieldWrap';
|
|
52
52
|
export { default as Breadcrumb, BreadcrumbItem, BreadcrumbLink } from './components/Breadcrumb';
|
|
53
53
|
export { default as TwoColumnPanel, ColumnHeader, ColumnGroupHeader, ColumnLeft, ColumnRight, ColumnList } from './components/TwoColumnPanel';
|
|
54
|
+
export { default as Notice } from './components/Notice';
|
|
54
55
|
/**
|
|
55
56
|
* Helpers / Utils
|
|
56
57
|
*/
|
package/lib/index.js
CHANGED
|
@@ -1282,7 +1282,7 @@ var TopBarMenu = /** @class */ (function (_super) {
|
|
|
1282
1282
|
}(React__default.Component));
|
|
1283
1283
|
|
|
1284
1284
|
var NavBar = function (_a) {
|
|
1285
|
-
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;
|
|
1285
|
+
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, props = tslib.__rest(_a, ["children", "className", "collapsed", "navTriggerLabel", "propId"]);
|
|
1286
1286
|
var navRef = React.useRef(null);
|
|
1287
1287
|
var triggerRef = React.useRef(null);
|
|
1288
1288
|
var _d = tslib.__read(React.useState(false), 2), showDropdown = _d[0], setShowDropdown = _d[1];
|
|
@@ -1314,9 +1314,9 @@ var NavBar = function (_a) {
|
|
|
1314
1314
|
var handleTriggerClick = function () {
|
|
1315
1315
|
setShowDropdown(!showDropdown);
|
|
1316
1316
|
};
|
|
1317
|
-
return (React__default.createElement("nav", { className: classNames('NavBar', className, {
|
|
1317
|
+
return (React__default.createElement("nav", tslib.__assign({ className: classNames('NavBar', className, {
|
|
1318
1318
|
'NavBar--collapsed': collapsed
|
|
1319
|
-
}), ref: navRef },
|
|
1319
|
+
}), ref: navRef }, props),
|
|
1320
1320
|
collapsed && (React__default.createElement("button", { "aria-haspopup": "true", "aria-expanded": showDropdown, "aria-controls": menuId, ref: triggerRef, onClick: handleTriggerClick, className: classNames('NavBar__trigger', {
|
|
1321
1321
|
'NavBar__trigger--active': showDropdown
|
|
1322
1322
|
}) },
|
|
@@ -9121,6 +9121,37 @@ ColumnList.propTypes = {
|
|
|
9121
9121
|
className: PropTypes.string
|
|
9122
9122
|
};
|
|
9123
9123
|
|
|
9124
|
+
var iconTypeMap = {
|
|
9125
|
+
caution: 'caution',
|
|
9126
|
+
danger: 'caution',
|
|
9127
|
+
info: 'info-circle'
|
|
9128
|
+
};
|
|
9129
|
+
var Notice = React.forwardRef(function (_a, ref) {
|
|
9130
|
+
var _b;
|
|
9131
|
+
var _c = _a.type, type = _c === void 0 ? 'info' : _c, title = _a.title, icon = _a.icon, children = _a.children, otherProps = tslib.__rest(_a, ["type", "title", "icon", "children"]);
|
|
9132
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames('Notice', (_b = {},
|
|
9133
|
+
_b["Notice--".concat(type)] = type,
|
|
9134
|
+
_b)), ref: ref }, otherProps),
|
|
9135
|
+
React__default.createElement("div", { className: "Notice__title" },
|
|
9136
|
+
React__default.createElement(Icon, { type: icon || iconTypeMap[type] }),
|
|
9137
|
+
title),
|
|
9138
|
+
children && React__default.createElement("div", { className: "Notice__content" }, children)));
|
|
9139
|
+
});
|
|
9140
|
+
Notice.displayName = 'Notice';
|
|
9141
|
+
Notice.propTypes = {
|
|
9142
|
+
// @ts-expect-error
|
|
9143
|
+
children: PropTypes.node,
|
|
9144
|
+
type: PropTypes.oneOf(['caution', 'info', 'danger']),
|
|
9145
|
+
// @ts-expect-error
|
|
9146
|
+
title: PropTypes.oneOfType([
|
|
9147
|
+
PropTypes.string,
|
|
9148
|
+
PropTypes.number,
|
|
9149
|
+
PropTypes.element
|
|
9150
|
+
]),
|
|
9151
|
+
// @ts-expect-error
|
|
9152
|
+
icon: PropTypes.string
|
|
9153
|
+
};
|
|
9154
|
+
|
|
9124
9155
|
var LIGHT_THEME_CLASS = 'cauldron--theme-light';
|
|
9125
9156
|
var DARK_THEME_CLASS = 'cauldron--theme-dark';
|
|
9126
9157
|
var ThemeContext = React.createContext({});
|
|
@@ -9231,6 +9262,7 @@ exports.ModalContent = ModalContent;
|
|
|
9231
9262
|
exports.ModalFooter = ModalFooter;
|
|
9232
9263
|
exports.NavBar = NavBar;
|
|
9233
9264
|
exports.NavItem = NavItem;
|
|
9265
|
+
exports.Notice = Notice;
|
|
9234
9266
|
exports.Offscreen = Offscreen;
|
|
9235
9267
|
exports.OptionsMenu = OptionsMenu;
|
|
9236
9268
|
exports.OptionsMenuItem = OptionsMenuItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0-canary.7cfac7d0",
|
|
4
4
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
5
5
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
6
6
|
"publishConfig": {
|
|
@@ -122,4 +122,4 @@
|
|
|
122
122
|
"\\.svg$": "<rootDir>/__tests__/svgMock.js"
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
}
|
|
125
|
+
}
|