@deque/cauldron-react 6.1.0 → 6.2.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/lib/cauldron.css +2 -0
- package/lib/index.js +43 -13
- package/lib/src/components/Checkbox/Checkbox.test.d.ts +1 -0
- package/lib/src/components/Combobox/Combobox.d.ts +1 -1
- package/lib/src/components/Tag/index.test.d.ts +1 -0
- package/lib/src/components/TextField/TextField.test.d.ts +1 -0
- package/lib/src/components/TextField/index.d.ts +1 -1
- package/lib/src/components/Timeline/Timeline.d.ts +6 -0
- package/lib/src/components/Timeline/TimelineItem.d.ts +6 -0
- package/lib/src/components/Timeline/index.d.ts +2 -0
- package/lib/src/components/Timeline/timeline.test.d.ts +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/utils/setRef.d.ts +1 -1
- package/package.json +7 -23
package/lib/cauldron.css
CHANGED
package/lib/index.js
CHANGED
|
@@ -1345,7 +1345,8 @@ SideBarItem.defaultProps = {
|
|
|
1345
1345
|
*/
|
|
1346
1346
|
var AriaIsolate = /** @class */ (function () {
|
|
1347
1347
|
function AriaIsolate(el) {
|
|
1348
|
-
|
|
1348
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-constructor
|
|
1349
|
+
if (typeof HTMLElement === 'undefined' || !(el instanceof HTMLElement)) {
|
|
1349
1350
|
throw new Error('AriaIsolate must be instantiated with a valid HTML element');
|
|
1350
1351
|
}
|
|
1351
1352
|
this.element = el;
|
|
@@ -1735,7 +1736,9 @@ function Tooltip(_a) {
|
|
|
1735
1736
|
}), ref: setTooltipElement, role: "tooltip", style: styles.popper }, attributes.popper, props),
|
|
1736
1737
|
variant !== 'big' && (React__default["default"].createElement("div", { className: "TooltipArrow", ref: setArrowElement, style: styles.arrow })),
|
|
1737
1738
|
children), (portal && 'current' in portal ? portal.current : portal) ||
|
|
1738
|
-
|
|
1739
|
+
(
|
|
1740
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
1741
|
+
document === null || document === void 0 ? void 0 : document.body))
|
|
1739
1742
|
: null));
|
|
1740
1743
|
}
|
|
1741
1744
|
Tooltip.displayName = 'Tooltip';
|
|
@@ -2339,7 +2342,7 @@ var TextField = /** @class */ (function (_super) {
|
|
|
2339
2342
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2340
2343
|
_a.onChange;
|
|
2341
2344
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2342
|
-
_a.defaultValue; var _b = _a.error, error = _b === void 0 ? null : _b, requiredText = _a.requiredText, multiline = _a.multiline, ariaDescribedby = _a["aria-describedby"], other = tslib.__rest(_a, ["label", "fieldRef", "value", "onChange", "defaultValue", "error", "requiredText", "multiline", 'aria-describedby']);
|
|
2345
|
+
_a.defaultValue; var _b = _a.error, error = _b === void 0 ? null : _b, requiredText = _a.requiredText, multiline = _a.multiline, ariaDescribedby = _a["aria-describedby"], className = _a.className, other = tslib.__rest(_a, ["label", "fieldRef", "value", "onChange", "defaultValue", "error", "requiredText", "multiline", 'aria-describedby', "className"]);
|
|
2343
2346
|
// typescript can't infer the type so it's complaining about
|
|
2344
2347
|
// textarea and input props being incompatible
|
|
2345
2348
|
// we should probably fix this
|
|
@@ -2356,7 +2359,7 @@ var TextField = /** @class */ (function (_super) {
|
|
|
2356
2359
|
}), htmlFor: this.inputId },
|
|
2357
2360
|
React__default["default"].createElement("span", null, label),
|
|
2358
2361
|
isRequired && (React__default["default"].createElement("span", { className: "Field__required-text" }, requiredText))),
|
|
2359
|
-
React__default["default"].createElement(Field, tslib.__assign({ className: classNames__default["default"]({
|
|
2362
|
+
React__default["default"].createElement(Field, tslib.__assign({ className: classNames__default["default"](className, {
|
|
2360
2363
|
'Field__text-input': !multiline,
|
|
2361
2364
|
Field__textarea: multiline,
|
|
2362
2365
|
'Field--has-error': error
|
|
@@ -2369,7 +2372,7 @@ var TextField = /** @class */ (function (_super) {
|
|
|
2369
2372
|
TextField.prototype.onChange = function (e) {
|
|
2370
2373
|
var _a, _b;
|
|
2371
2374
|
if (this.props.onChange) {
|
|
2372
|
-
this.props.onChange(((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) || '', e);
|
|
2375
|
+
this.props.onChange(((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) || /* istanbul ignore next: default value */ '', e);
|
|
2373
2376
|
}
|
|
2374
2377
|
if (typeof this.props.value !== 'undefined') {
|
|
2375
2378
|
return;
|
|
@@ -3694,7 +3697,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3694
3697
|
var noMatchingOptions = !!(value === null || value === void 0 ? void 0 : value.length) && !matchingOptions.size && (React__default["default"].createElement(NoMatchingOptions, null));
|
|
3695
3698
|
var comboboxListbox = (React__default["default"].createElement(Listbox, { className: classNames__default["default"]('Combobox__listbox', {
|
|
3696
3699
|
'Combobox__listbox--open': open
|
|
3697
|
-
}), role:
|
|
3700
|
+
}), role: noMatchingOptions ? 'presentation' : 'listbox', "aria-labelledby": noMatchingOptions ? undefined : "".concat(id, "-label"), id: "".concat(id, "-listbox"), value: selectedValue, onMouseDown: handleComboboxOptionMouseDown, onClick: handleComboboxOptionClick, onSelectionChange: handleSelectionChange, onActiveChange: handleActiveChange, ref: listboxRef, tabIndex: undefined, "aria-activedescendant": undefined },
|
|
3698
3701
|
comboboxOptions,
|
|
3699
3702
|
noMatchingOptions));
|
|
3700
3703
|
var errorId = "".concat(id, "-error");
|
|
@@ -3717,10 +3720,13 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3717
3720
|
onClick: handleInputClick },
|
|
3718
3721
|
React__default["default"].createElement("input", tslib.__assign({ type: "text", id: "".concat(id, "-input"), ref: inputRef, value: value, role: "combobox", "aria-autocomplete": !isAutoComplete ? 'none' : 'list', "aria-controls": "".concat(id, "-listbox"), "aria-expanded": open, "aria-haspopup": "listbox", "aria-activedescendant": open && activeDescendant ? activeDescendant.element.id : undefined }, inputProps, { onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur })),
|
|
3719
3722
|
React__default["default"].createElement("span", { className: "Combobox__arrow" })),
|
|
3720
|
-
React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: value, formValue: formValue, selectedValue: selectedValue, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValue: setFormValue }, portal
|
|
3721
|
-
? reactDom.createPortal(comboboxListbox,
|
|
3723
|
+
React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: value, formValue: formValue, selectedValue: selectedValue, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValue: setFormValue }, portal && typeof document !== 'undefined'
|
|
3724
|
+
? reactDom.createPortal(comboboxListbox,
|
|
3725
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
3726
|
+
portal instanceof HTMLElement
|
|
3722
3727
|
? portal
|
|
3723
3728
|
: portal.current ||
|
|
3729
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
3724
3730
|
/* istanbul ignore next: default fallback value */ document.body)
|
|
3725
3731
|
: comboboxListbox),
|
|
3726
3732
|
hasError && (React__default["default"].createElement("div", { className: "Error", id: errorId }, error))));
|
|
@@ -3868,10 +3874,25 @@ var Popover = React.forwardRef(function (_a, ref) {
|
|
|
3868
3874
|
}), ref: popoverRef, role: "dialog", style: styles.popper }, attributes.popper, additionalProps, props),
|
|
3869
3875
|
React__default["default"].createElement("div", { className: "Popover__popoverArrow", ref: setArrowElement, style: styles.arrow }),
|
|
3870
3876
|
React__default["default"].createElement("div", { className: "Popover__borderLeft" }),
|
|
3871
|
-
variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children)))), (portal && 'current' in portal ? portal.current : portal) ||
|
|
3877
|
+
variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children)))), (portal && 'current' in portal ? portal.current : portal) ||
|
|
3878
|
+
// Dependent on "isBrowser" check above:
|
|
3879
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
3880
|
+
document.body);
|
|
3872
3881
|
});
|
|
3873
3882
|
Popover.displayName = 'Popover';
|
|
3874
3883
|
|
|
3884
|
+
function Timeline(_a) {
|
|
3885
|
+
var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
|
|
3886
|
+
return (React__default["default"].createElement("ol", tslib.__assign({ className: classNames__default["default"]('Timeline', className) }, props), children));
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3889
|
+
function TimelineItem(_a) {
|
|
3890
|
+
var className = _a.className, children = _a.children, icon = _a.icon, props = tslib.__rest(_a, ["className", "children", "icon"]);
|
|
3891
|
+
return (React__default["default"].createElement("li", tslib.__assign({ className: classNames__default["default"]('TimelineItem', className) }, props),
|
|
3892
|
+
React__default["default"].createElement("span", { className: "TimelineItem__separator" }, icon),
|
|
3893
|
+
React__default["default"].createElement("div", { className: "TimelineItem__details" }, children)));
|
|
3894
|
+
}
|
|
3895
|
+
|
|
3875
3896
|
var LIGHT_THEME_CLASS = 'cauldron--theme-light';
|
|
3876
3897
|
var DARK_THEME_CLASS = 'cauldron--theme-dark';
|
|
3877
3898
|
var ThemeContext = React.createContext({
|
|
@@ -3881,17 +3902,21 @@ var ThemeContext = React.createContext({
|
|
|
3881
3902
|
}
|
|
3882
3903
|
});
|
|
3883
3904
|
var ThemeProvider = function (_a) {
|
|
3884
|
-
var children = _a.children,
|
|
3905
|
+
var children = _a.children,
|
|
3906
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
3907
|
+
_b = _a.context,
|
|
3908
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
3909
|
+
context = _b === void 0 ? document === null || document === void 0 ? void 0 : document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
|
|
3885
3910
|
var _d = tslib.__read(React.useState(initialTheme), 2), theme = _d[0], setTheme = _d[1];
|
|
3886
3911
|
var getThemeFromContext = function () {
|
|
3887
|
-
return context.classList.contains(DARK_THEME_CLASS) ? 'dark' : 'light';
|
|
3912
|
+
return (context === null || context === void 0 ? void 0 : context.classList.contains(DARK_THEME_CLASS)) ? 'dark' : 'light';
|
|
3888
3913
|
};
|
|
3889
3914
|
var toggleTheme = function () {
|
|
3890
3915
|
return setTheme(getThemeFromContext() === 'dark' ? 'light' : 'dark');
|
|
3891
3916
|
};
|
|
3892
3917
|
React.useEffect(function () {
|
|
3893
|
-
context.classList.toggle(LIGHT_THEME_CLASS, theme === 'light');
|
|
3894
|
-
context.classList.toggle(DARK_THEME_CLASS, theme === 'dark');
|
|
3918
|
+
context === null || context === void 0 ? void 0 : context.classList.toggle(LIGHT_THEME_CLASS, theme === 'light');
|
|
3919
|
+
context === null || context === void 0 ? void 0 : context.classList.toggle(DARK_THEME_CLASS, theme === 'dark');
|
|
3895
3920
|
}, [context, theme]);
|
|
3896
3921
|
// Use a MutationObserver to track changes to the classes outside of the context of React
|
|
3897
3922
|
var handleMutation = function (mutationList) {
|
|
@@ -3914,6 +3939,9 @@ var ThemeProvider = function (_a) {
|
|
|
3914
3939
|
}
|
|
3915
3940
|
};
|
|
3916
3941
|
React.useEffect(function () {
|
|
3942
|
+
if (!context) {
|
|
3943
|
+
return;
|
|
3944
|
+
}
|
|
3917
3945
|
var observer = new MutationObserver(handleMutation);
|
|
3918
3946
|
observer.observe(context, {
|
|
3919
3947
|
childList: false,
|
|
@@ -4024,6 +4052,8 @@ exports.TagLabel = TagLabel;
|
|
|
4024
4052
|
exports.TextField = TextField;
|
|
4025
4053
|
exports.ThemeContext = ThemeContext;
|
|
4026
4054
|
exports.ThemeProvider = ThemeProvider;
|
|
4055
|
+
exports.Timeline = Timeline;
|
|
4056
|
+
exports.TimelineItem = TimelineItem;
|
|
4027
4057
|
exports.Toast = Toast;
|
|
4028
4058
|
exports.Tooltip = Tooltip;
|
|
4029
4059
|
exports.TooltipContent = TooltipContent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -28,5 +28,5 @@ interface ComboboxProps extends React.InputHTMLAttributes<Omit<HTMLInputElement,
|
|
|
28
28
|
portal?: React.RefObject<HTMLElement> | HTMLElement;
|
|
29
29
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
30
30
|
}
|
|
31
|
-
declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<
|
|
31
|
+
declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
32
|
export default Combobox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInput
|
|
|
4
4
|
error?: React.ReactNode;
|
|
5
5
|
defaultValue?: string;
|
|
6
6
|
onChange?: (value: string, e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
7
|
-
fieldRef
|
|
7
|
+
fieldRef?: React.Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
8
8
|
requiredText?: string;
|
|
9
9
|
multiline?: boolean;
|
|
10
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/src/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { default as Notice } from './components/Notice';
|
|
|
53
53
|
export { default as Listbox, ListboxOption, ListboxGroup } from './components/Listbox';
|
|
54
54
|
export { default as Combobox, ComboboxOption, ComboboxGroup } from './components/Combobox';
|
|
55
55
|
export { default as Popover } from './components/Popover';
|
|
56
|
+
export { default as Timeline, TimelineItem } from './components/Timeline';
|
|
56
57
|
/**
|
|
57
58
|
* Helpers / Utils
|
|
58
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function setRef<T>(ref: React.Ref<T
|
|
1
|
+
export default function setRef<T>(ref: React.Ref<T> | undefined, element: T): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
@@ -44,10 +44,11 @@
|
|
|
44
44
|
"@rollup/plugin-typescript": "^11.1.2",
|
|
45
45
|
"@svgr/rollup": "^6.1.2",
|
|
46
46
|
"@testing-library/jest-dom": "^6.1.3",
|
|
47
|
-
"@testing-library/react": "
|
|
47
|
+
"@testing-library/react": "^12",
|
|
48
|
+
"@testing-library/user-event": "^14.5.2",
|
|
48
49
|
"@types/classnames": "^2.2.10",
|
|
49
50
|
"@types/enzyme-adapter-react-16": "^1.0.9",
|
|
50
|
-
"@types/jest": "^
|
|
51
|
+
"@types/jest": "^29.5.11",
|
|
51
52
|
"@types/jest-axe": "^3.5.4",
|
|
52
53
|
"@types/node": "^17.0.42",
|
|
53
54
|
"@types/react": "^18.0.12",
|
|
@@ -60,8 +61,9 @@
|
|
|
60
61
|
"concurrently": "^5.3.0",
|
|
61
62
|
"enzyme": "^3.11.0",
|
|
62
63
|
"enzyme-adapter-react-16": "^1.15.2",
|
|
63
|
-
"jest": "^
|
|
64
|
+
"jest": "^29.7.0",
|
|
64
65
|
"jest-axe": "^8.0.0",
|
|
66
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
65
67
|
"nyc": "^15.0.1",
|
|
66
68
|
"postcss-cli": "^7.1.1",
|
|
67
69
|
"postcss-import": "^12.0.1",
|
|
@@ -70,6 +72,7 @@
|
|
|
70
72
|
"react-dom": "^16.13.1",
|
|
71
73
|
"rollup": "^2.23.0",
|
|
72
74
|
"sinon": "^10.0.0",
|
|
75
|
+
"ts-node": "^10.9.2",
|
|
73
76
|
"typescript": "~5.0.0"
|
|
74
77
|
},
|
|
75
78
|
"repository": {
|
|
@@ -95,24 +98,5 @@
|
|
|
95
98
|
"coverage",
|
|
96
99
|
"test/**/*.js"
|
|
97
100
|
]
|
|
98
|
-
},
|
|
99
|
-
"jest": {
|
|
100
|
-
"setupFilesAfterEnv": [
|
|
101
|
-
"<rootDir>__tests__/setupTests.ts"
|
|
102
|
-
],
|
|
103
|
-
"testMatch": [
|
|
104
|
-
"**/__tests__/src/**/*.js",
|
|
105
|
-
"**/__tests__/demo/**/*.js",
|
|
106
|
-
"**/src/components/**/*.test.tsx"
|
|
107
|
-
],
|
|
108
|
-
"collectCoverageFrom": [
|
|
109
|
-
"src/**/*.{ts,tsx}"
|
|
110
|
-
],
|
|
111
|
-
"moduleNameMapper": {
|
|
112
|
-
"\\.(css|less)$": "<rootDir>/__tests__/styleMock.js",
|
|
113
|
-
"react-syntax-highlighter/dist/esm/light": "<rootDir>/__tests__/reactSyntaxHighlighterMock.js",
|
|
114
|
-
"react-syntax-highlighter/dist/esm/languages/hljs/(.*)": "<rootDir>/__tests__/hljsMock.js",
|
|
115
|
-
"\\.svg$": "<rootDir>/__tests__/svgMock.js"
|
|
116
|
-
}
|
|
117
101
|
}
|
|
118
102
|
}
|