@deque/cauldron-react 5.6.2 → 5.7.0-canary.ade57cca
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.
|
@@ -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;
|
|
@@ -5,7 +5,7 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
totalItems: number;
|
|
6
6
|
itemsPerPage?: number;
|
|
7
7
|
currentPage?: number;
|
|
8
|
-
statusLabel?:
|
|
8
|
+
statusLabel?: ContentNode;
|
|
9
9
|
firstPageLabel?: ContentNode;
|
|
10
10
|
previousPageLabel?: ContentNode;
|
|
11
11
|
nextPageLabel?: ContentNode;
|
package/lib/contexts/theme.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
declare type Theme = 'light' | 'dark';
|
|
3
4
|
interface ProviderProps {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
context?: HTMLElement;
|
|
6
|
-
initialTheme?:
|
|
7
|
+
initialTheme?: Theme;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
interface State {
|
|
10
|
+
theme: Theme;
|
|
11
|
+
}
|
|
12
|
+
interface Methods {
|
|
13
|
+
toggleTheme: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare const ThemeContext: React.Context<State & Methods>;
|
|
9
16
|
declare const ThemeProvider: {
|
|
10
17
|
({ children, context, initialTheme }: ProviderProps): JSX.Element;
|
|
11
18
|
propTypes: {
|
|
@@ -13,5 +20,5 @@ declare const ThemeProvider: {
|
|
|
13
20
|
initialTheme: PropTypes.Requireable<string>;
|
|
14
21
|
};
|
|
15
22
|
};
|
|
16
|
-
declare function useThemeContext():
|
|
23
|
+
declare function useThemeContext(): State & Methods;
|
|
17
24
|
export { ThemeContext, ThemeProvider, useThemeContext };
|
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,9 +9121,45 @@ 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
|
-
var ThemeContext = React.createContext({
|
|
9157
|
+
var ThemeContext = React.createContext({
|
|
9158
|
+
theme: 'light',
|
|
9159
|
+
toggleTheme: function () {
|
|
9160
|
+
throw new Error('ThemeContext not initialized');
|
|
9161
|
+
}
|
|
9162
|
+
});
|
|
9127
9163
|
var ThemeProvider = function (_a) {
|
|
9128
9164
|
var children = _a.children, _b = _a.context, context = _b === void 0 ? document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
|
|
9129
9165
|
var _d = tslib.__read(React.useState(initialTheme), 2), theme = _d[0], setTheme = _d[1];
|
|
@@ -9231,6 +9267,7 @@ exports.ModalContent = ModalContent;
|
|
|
9231
9267
|
exports.ModalFooter = ModalFooter;
|
|
9232
9268
|
exports.NavBar = NavBar;
|
|
9233
9269
|
exports.NavItem = NavItem;
|
|
9270
|
+
exports.Notice = Notice;
|
|
9234
9271
|
exports.Offscreen = Offscreen;
|
|
9235
9272
|
exports.OptionsMenu = OptionsMenu;
|
|
9236
9273
|
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.ade57cca",
|
|
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
|
+
}
|