@deque/cauldron-react 3.0.1-canary.b5d7a8b3 → 3.0.1-canary.c221fa57
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.
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
as?: React.ElementType | string;
|
|
5
|
+
}
|
|
6
|
+
declare const FieldWrap: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
export default FieldWrap;
|
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
export interface LoaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
label?: string;
|
|
5
|
+
variant?: 'large' | 'small';
|
|
5
6
|
}
|
|
6
|
-
declare function Loader({ className, label, ...
|
|
7
|
+
declare function Loader({ className, variant, label, ...props }: LoaderProps): JSX.Element;
|
|
7
8
|
declare namespace Loader {
|
|
8
9
|
var propTypes: {
|
|
9
10
|
className: PropTypes.Requireable<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AxeLoader(): JSX.Element;
|
|
@@ -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.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { default as IssuePanel } from './components/IssuePanel';
|
|
|
46
46
|
export { default as ProgressBar } from './components/ProgressBar';
|
|
47
47
|
export { Address, AddressLine, AddressCityStateZip } from './components/Address';
|
|
48
48
|
export { default as Pagination } from './components/Pagination';
|
|
49
|
+
export { default as FieldWrap } from './components/FieldWrap';
|
|
49
50
|
/**
|
|
50
51
|
* Helpers / Utils
|
|
51
52
|
*/
|
package/lib/index.js
CHANGED
|
@@ -2197,8 +2197,7 @@ Link.propTypes = {
|
|
|
2197
2197
|
Link.displayName = 'Link';
|
|
2198
2198
|
|
|
2199
2199
|
function Loader(_a) {
|
|
2200
|
-
var className = _a.className, label = _a.label,
|
|
2201
|
-
var props = tslib.__assign(tslib.__assign({}, other), { className: classNames('Loader', className) });
|
|
2200
|
+
var className = _a.className, _b = _a.variant, variant = _b === void 0 ? 'small' : _b, label = _a.label, props = tslib.__rest(_a, ["className", "variant", "label"]);
|
|
2202
2201
|
if (label === null || label === void 0 ? void 0 : label.length) {
|
|
2203
2202
|
props['role'] = 'alert';
|
|
2204
2203
|
props.children = React__default.createElement(Offscreen, null, label);
|
|
@@ -2206,7 +2205,11 @@ function Loader(_a) {
|
|
|
2206
2205
|
else {
|
|
2207
2206
|
props['aria-hidden'] = true;
|
|
2208
2207
|
}
|
|
2209
|
-
return React__default.createElement("div", tslib.__assign({
|
|
2208
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader', className, variant === 'large'
|
|
2209
|
+
? 'Loader--large'
|
|
2210
|
+
: variant === 'small'
|
|
2211
|
+
? 'Loader--small'
|
|
2212
|
+
: '') }, props)));
|
|
2210
2213
|
}
|
|
2211
2214
|
Loader.propTypes = {
|
|
2212
2215
|
className: PropTypes.string
|
|
@@ -7946,9 +7949,24 @@ Code.propTypes = {
|
|
|
7946
7949
|
className: PropTypes.string
|
|
7947
7950
|
};
|
|
7948
7951
|
|
|
7952
|
+
function AxeLoader() {
|
|
7953
|
+
return (React__default.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0", y: "0", viewBox: "0 0 800 800" },
|
|
7954
|
+
React__default.createElement("path", { fill: "currentColor", d: "M641.4 555.6c-27.2-12.1-59.1.2-71.2 27.3-.5 1-.8 2.1-1.2 3.2H160l227.6-394.3 170.1 292.8 32.4-18.8L387.5 117 95 623.6h474c4.9 13.1 14.8 24.4 28.6 30.5 7.1 3.2 14.5 4.7 21.8 4.7 20.7 0 40.4-11.9 49.3-32 12.1-27.1-.1-59.1-27.3-71.2zm1.6 59.8c-5.8 13-21.1 18.9-34 13.1-13-5.8-18.9-21.1-13.1-34 4.3-9.6 13.7-15.3 23.6-15.3 3.5 0 7.1.7 10.4 2.2 13.1 5.7 18.9 21 13.1 34z" }),
|
|
7955
|
+
React__default.createElement("path", { fill: "currentColor", d: "M379 549.9h-27.6v-16.7c-7.4 13.5-22.8 20.2-39 20.2-37.1 0-58.9-28.9-58.9-61.6 0-36.5 26.4-61.4 58.9-61.4 21.1 0 34 11.2 39 20.5V434H379v115.9zm-97.8-57.4c0 14.3 10.3 35.2 35.2 35.2 15.4 0 25.5-8 30.8-18.6 2.7-5.1 4-10.5 4.4-16.2.2-5.5-.8-11.2-3.2-16.2-4.9-11-15.6-20.5-32.3-20.5-22.4 0-35 18.1-35 36.1v.2zM436.2 488.9l-39-54.8h33.3l22.6 35.6 22.6-35.6h32.9l-38.8 54.8 43.2 61h-34L453.1 510l-26.2 39.9h-33.5l42.8-61z" })));
|
|
7956
|
+
}
|
|
7957
|
+
|
|
7949
7958
|
var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
|
|
7950
|
-
var className = _a.className, other = tslib.__rest(_a, ["className"]);
|
|
7951
|
-
return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className
|
|
7959
|
+
var className = _a.className, variant = _a.variant, label = _a.label, other = tslib.__rest(_a, ["className", "variant", "label"]);
|
|
7960
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
|
|
7961
|
+
? 'Loader__overlay--large'
|
|
7962
|
+
: variant === 'small'
|
|
7963
|
+
? 'Loader__overlay--small'
|
|
7964
|
+
: ''), ref: ref }, other),
|
|
7965
|
+
React__default.createElement("div", { className: "Loader__overlay__loader" },
|
|
7966
|
+
React__default.createElement(Loader, { variant: variant }),
|
|
7967
|
+
React__default.createElement(AxeLoader, null)),
|
|
7968
|
+
label ? React__default.createElement("span", { className: "Loader__overlay__label" }, label) : null,
|
|
7969
|
+
other.children));
|
|
7952
7970
|
});
|
|
7953
7971
|
LoaderOverlay.propTypes = {
|
|
7954
7972
|
className: PropTypes.string
|
|
@@ -8074,8 +8092,8 @@ var useDidUpdate = function (effect, dependencies) {
|
|
|
8074
8092
|
};
|
|
8075
8093
|
|
|
8076
8094
|
var Tabs = function (_a) {
|
|
8077
|
-
var children = _a.children, thin = _a.thin, _b = _a.initialActiveIndex, initialActiveIndex =
|
|
8078
|
-
var
|
|
8095
|
+
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"]);
|
|
8096
|
+
var _d = React.useState(initialActiveIndex), activeIndex = _d[0], setActiveIndex = _d[1];
|
|
8079
8097
|
var tabsRef = React.useRef(null);
|
|
8080
8098
|
var focusedTabRef = React.useRef(null);
|
|
8081
8099
|
var tabs = React__default.Children.toArray(children).filter(function (child) { return child.type === Tab; });
|
|
@@ -8086,34 +8104,48 @@ var Tabs = function (_a) {
|
|
|
8086
8104
|
var handleKeyDown = function (event) {
|
|
8087
8105
|
var key = event.key;
|
|
8088
8106
|
var newIndex = activeIndex;
|
|
8107
|
+
var forward;
|
|
8108
|
+
var backward;
|
|
8109
|
+
if (orientation === 'horizontal') {
|
|
8110
|
+
forward = 'ArrowRight';
|
|
8111
|
+
backward = 'ArrowLeft';
|
|
8112
|
+
}
|
|
8113
|
+
else {
|
|
8114
|
+
forward = 'ArrowDown';
|
|
8115
|
+
backward = 'ArrowUp';
|
|
8116
|
+
}
|
|
8089
8117
|
switch (key) {
|
|
8090
|
-
case
|
|
8118
|
+
case backward: {
|
|
8091
8119
|
newIndex = activeIndex - 1;
|
|
8092
8120
|
// circularity
|
|
8093
8121
|
if (newIndex === -1) {
|
|
8094
8122
|
newIndex = tabCount - 1;
|
|
8095
8123
|
}
|
|
8096
8124
|
setActiveIndex(newIndex);
|
|
8125
|
+
event.preventDefault();
|
|
8097
8126
|
break;
|
|
8098
8127
|
}
|
|
8099
|
-
case
|
|
8128
|
+
case forward: {
|
|
8100
8129
|
newIndex = activeIndex + 1;
|
|
8101
8130
|
// circularity
|
|
8102
8131
|
if (newIndex === tabCount) {
|
|
8103
8132
|
newIndex = 0;
|
|
8104
8133
|
}
|
|
8105
8134
|
setActiveIndex(newIndex);
|
|
8135
|
+
event.preventDefault();
|
|
8106
8136
|
break;
|
|
8107
8137
|
}
|
|
8108
8138
|
case 'Home': {
|
|
8109
8139
|
newIndex = 0;
|
|
8110
8140
|
setActiveIndex(newIndex);
|
|
8141
|
+
event.preventDefault();
|
|
8111
8142
|
break;
|
|
8112
8143
|
}
|
|
8113
8144
|
case 'End': {
|
|
8114
8145
|
event.preventDefault();
|
|
8115
8146
|
newIndex = tabCount - 1;
|
|
8116
8147
|
setActiveIndex(newIndex);
|
|
8148
|
+
event.preventDefault();
|
|
8117
8149
|
break;
|
|
8118
8150
|
}
|
|
8119
8151
|
}
|
|
@@ -8146,7 +8178,9 @@ var Tabs = function (_a) {
|
|
|
8146
8178
|
}
|
|
8147
8179
|
}, [activeIndex]);
|
|
8148
8180
|
return (React__default.createElement("div", { className: classNames('Tabs', className, {
|
|
8149
|
-
'Tabs--thin': thin
|
|
8181
|
+
'Tabs--thin': thin,
|
|
8182
|
+
'Tabs--vertical': orientation === 'vertical',
|
|
8183
|
+
'Tabs--horizontal': orientation === 'horizontal'
|
|
8150
8184
|
}), ref: tabsRef },
|
|
8151
8185
|
React__default.createElement("ul", tslib.__assign({ role: "tablist", className: "Tablist" }, labelProp, { onKeyDown: handleKeyDown }), tabComponents)));
|
|
8152
8186
|
};
|
|
@@ -8157,6 +8191,7 @@ Tabs.propTypes = {
|
|
|
8157
8191
|
'aria-labelledby': PropTypes.string,
|
|
8158
8192
|
initialActiveIndex: PropTypes.number,
|
|
8159
8193
|
thin: PropTypes.bool,
|
|
8194
|
+
orientation: PropTypes.string,
|
|
8160
8195
|
className: PropTypes.string
|
|
8161
8196
|
};
|
|
8162
8197
|
|
|
@@ -8356,6 +8391,17 @@ Pagination.propTypes = {
|
|
|
8356
8391
|
className: PropTypes.string
|
|
8357
8392
|
};
|
|
8358
8393
|
|
|
8394
|
+
var FieldWrap = React__default.forwardRef(function (_a, ref) {
|
|
8395
|
+
var children = _a.children, className = _a.className, _b = _a.as, Component = _b === void 0 ? 'div' : _b, props = tslib.__rest(_a, ["children", "className", "as"]);
|
|
8396
|
+
return (React__default.createElement(Component, tslib.__assign({ ref: ref, className: classNames('Panel', className) }, props), children));
|
|
8397
|
+
});
|
|
8398
|
+
FieldWrap.displayName = 'FieldWrap';
|
|
8399
|
+
FieldWrap.propTypes = {
|
|
8400
|
+
children: PropTypes.node.isRequired,
|
|
8401
|
+
className: PropTypes.string,
|
|
8402
|
+
as: PropTypes.string
|
|
8403
|
+
};
|
|
8404
|
+
|
|
8359
8405
|
var LIGHT_THEME_CLASS = 'cauldron--theme-light';
|
|
8360
8406
|
var DARK_THEME_CLASS = 'cauldron--theme-dark';
|
|
8361
8407
|
var ThemeContext = React.createContext({});
|
|
@@ -8428,6 +8474,7 @@ exports.Dialog = Dialog;
|
|
|
8428
8474
|
exports.DialogContent = DialogContent;
|
|
8429
8475
|
exports.DialogFooter = DialogFooter;
|
|
8430
8476
|
exports.ExpandCollapsePanel = ExpandCollapsePanel;
|
|
8477
|
+
exports.FieldWrap = FieldWrap;
|
|
8431
8478
|
exports.Icon = Icon;
|
|
8432
8479
|
exports.IconButton = IconButton;
|
|
8433
8480
|
exports.IssuePanel = IssuePanel;
|