@deque/cauldron-react 6.26.0 → 6.27.0-canary.06fc1451
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/Button/index.d.ts +11 -2
- package/lib/components/CopyButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.d.ts +0 -12
- package/lib/components/ProgressBar/index.d.ts +1 -0
- package/lib/components/RadioGroup/index.d.ts +1 -1
- package/lib/components/Table/TableHeader.d.ts +2 -0
- package/lib/components/Tag/index.d.ts +2 -1
- package/lib/components/TagButton/index.d.ts +4 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +26 -36
- package/package.json +1 -1
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import React, { type ButtonHTMLAttributes, type Ref } from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TagSize } from '../Tag';
|
|
3
|
+
interface ButtonBaseProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
4
|
buttonRef?: Ref<HTMLButtonElement>;
|
|
4
|
-
variant?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'danger' | 'danger-secondary' | 'link' | 'tag' | 'badge';
|
|
5
5
|
thin?: boolean;
|
|
6
6
|
}
|
|
7
|
+
interface ButtonTagProps extends ButtonBaseProps {
|
|
8
|
+
variant: 'tag';
|
|
9
|
+
size?: TagSize;
|
|
10
|
+
}
|
|
11
|
+
interface ButtonNonTagProps extends ButtonBaseProps {
|
|
12
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'danger' | 'danger-secondary' | 'link' | 'badge';
|
|
13
|
+
size?: never;
|
|
14
|
+
}
|
|
15
|
+
export type ButtonProps = ButtonTagProps | ButtonNonTagProps;
|
|
7
16
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
17
|
export default Button;
|
|
@@ -3,7 +3,7 @@ import { ContentNode } from '../../types';
|
|
|
3
3
|
import Button from '../Button';
|
|
4
4
|
import Tooltip from '../Tooltip';
|
|
5
5
|
type ButtonProps = React.ComponentProps<typeof Button>;
|
|
6
|
-
export interface CopyButtonProps extends Omit<ButtonProps, 'onCopy' | 'onClick'> {
|
|
6
|
+
export interface CopyButtonProps extends Omit<ButtonProps, 'onCopy' | 'onClick' | 'size'> {
|
|
7
7
|
value: string;
|
|
8
8
|
variant?: Extract<ButtonProps['variant'], 'primary' | 'secondary' | 'tertiary'>;
|
|
9
9
|
children?: ContentNode;
|
|
@@ -7,18 +7,6 @@ export interface IconButtonProps extends PolymorphicProps<React.HTMLAttributes<H
|
|
|
7
7
|
label: React.ReactNode;
|
|
8
8
|
tooltipProps?: Omit<TooltipProps, 'children' | 'target'>;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated use `tooltipProps.placement` instead
|
|
12
|
-
*/
|
|
13
|
-
tooltipPlacement?: TooltipProps['placement'];
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated use `tooltipProps.variant` instead
|
|
16
|
-
*/
|
|
17
|
-
tooltipVariant?: TooltipProps['variant'];
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated use `tooltipProps.portal` instead
|
|
20
|
-
*/
|
|
21
|
-
tooltipPortal?: TooltipProps['portal'];
|
|
22
10
|
variant?: 'primary' | 'secondary' | 'tertiary' | 'error';
|
|
23
11
|
large?: boolean;
|
|
24
12
|
}
|
|
@@ -4,6 +4,7 @@ type ProgressBarProps = {
|
|
|
4
4
|
progress: number;
|
|
5
5
|
progressMax?: number;
|
|
6
6
|
progressMin?: number;
|
|
7
|
+
thin?: boolean;
|
|
7
8
|
} & Cauldron.LabelProps & React.HTMLAttributes<HTMLDivElement>;
|
|
8
9
|
declare const ProgressBar: React.ForwardRefExoticComponent<ProgressBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
10
|
export default ProgressBar;
|
|
@@ -9,7 +9,7 @@ export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElemen
|
|
|
9
9
|
className?: string;
|
|
10
10
|
radios: RadioItem[];
|
|
11
11
|
defaultValue?: string;
|
|
12
|
-
value?:
|
|
12
|
+
value?: string;
|
|
13
13
|
inline?: boolean;
|
|
14
14
|
onChange?: (radio: RadioItem, input: HTMLElement) => void;
|
|
15
15
|
}
|
|
@@ -4,7 +4,9 @@ type SortDirection = 'ascending' | 'descending' | 'none';
|
|
|
4
4
|
interface TableHeaderProps extends Omit<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, 'align'> {
|
|
5
5
|
sortDirection?: SortDirection;
|
|
6
6
|
onSort?: () => void;
|
|
7
|
+
/** @deprecated No longer used. Sort state is communicated via aria-sort. */
|
|
7
8
|
sortAscendingAnnouncement?: string;
|
|
9
|
+
/** @deprecated No longer used. Sort state is communicated via aria-sort. */
|
|
8
10
|
sortDescendingAnnouncement?: string;
|
|
9
11
|
align?: ColumnAlignment;
|
|
10
12
|
variant?: 'header' | 'cell';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export type TagSize = 'default' | 'small';
|
|
2
3
|
interface TagProps {
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
className?: string;
|
|
5
|
-
size?:
|
|
6
|
+
size?: TagSize;
|
|
6
7
|
}
|
|
7
8
|
export declare const TagLabel: {
|
|
8
9
|
({ children, className, ...other }: TagProps): React.JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { IconType } from '../Icon';
|
|
3
3
|
import { ContentNode } from '../../types';
|
|
4
|
-
|
|
4
|
+
import { type TagSize } from '../Tag';
|
|
5
|
+
interface TagButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
5
6
|
label: ContentNode;
|
|
6
7
|
value: ContentNode;
|
|
7
8
|
icon: IconType;
|
|
8
9
|
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
size?: TagSize;
|
|
9
11
|
}
|
|
10
12
|
declare const TagButton: React.ForwardRefExoticComponent<TagButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
13
|
export default TagButton;
|
package/lib/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export { default as Sidebar, SideBarItem } from './components/SideBar';
|
|
|
37
37
|
export { default as Code } from './components/Code';
|
|
38
38
|
export { default as LoaderOverlay } from './components/LoaderOverlay';
|
|
39
39
|
export { default as Line } from './components/Line';
|
|
40
|
-
export { default as Tag, TagLabel } from './components/Tag';
|
|
40
|
+
export { default as Tag, TagLabel, type TagSize } from './components/Tag';
|
|
41
41
|
export { default as Badge, BadgeLabel } from './components/Badge';
|
|
42
42
|
export { default as ImpactBadge } from './components/ImpactBadge';
|
|
43
43
|
export { default as TagButton } from './components/TagButton';
|
package/lib/index.js
CHANGED
|
@@ -1768,7 +1768,7 @@ var SkipLink = /** @class */ (function (_super) {
|
|
|
1768
1768
|
}(React__default["default"].Component));
|
|
1769
1769
|
|
|
1770
1770
|
var Button = React.forwardRef(function (_a, ref) {
|
|
1771
|
-
var _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, thin = _a.thin, children = _a.children, className = _a.className, buttonRef = _a.buttonRef, other = tslib.__rest(_a, ["variant", "thin", "children", "className", "buttonRef"]);
|
|
1771
|
+
var _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, thin = _a.thin, size = _a.size, children = _a.children, className = _a.className, buttonRef = _a.buttonRef, other = tslib.__rest(_a, ["variant", "thin", "size", "children", "className", "buttonRef"]);
|
|
1772
1772
|
return (React__default["default"].createElement("button", tslib.__assign({ type: "button", className: classNames__default["default"](className, {
|
|
1773
1773
|
'Button--primary': variant === 'primary',
|
|
1774
1774
|
'Button--secondary': variant === 'secondary',
|
|
@@ -1779,6 +1779,7 @@ var Button = React.forwardRef(function (_a, ref) {
|
|
|
1779
1779
|
Link: variant === 'link',
|
|
1780
1780
|
Tag: variant === 'tag',
|
|
1781
1781
|
'Button--tag': variant === 'tag',
|
|
1782
|
+
'Tag--small': variant === 'tag' && size === 'small',
|
|
1782
1783
|
'Button--thin': thin,
|
|
1783
1784
|
'Button--badge': variant === 'badge'
|
|
1784
1785
|
}), ref: ref || buttonRef }, other), children));
|
|
@@ -2118,7 +2119,7 @@ var looksLikeLink = function (props) {
|
|
|
2118
2119
|
return 'to' in props || 'href' in props;
|
|
2119
2120
|
};
|
|
2120
2121
|
var IconButton = React.forwardRef(function (_a, ref) {
|
|
2121
|
-
var _b = _a.as, Component = _b === void 0 ? 'button' : _b, icon = _a.icon, label = _a.label,
|
|
2122
|
+
var _b = _a.as, Component = _b === void 0 ? 'button' : _b, icon = _a.icon, label = _a.label, _c = _a.tooltipProps, tooltipPropsProp = _c === void 0 ? {} : _c, className = _a.className, _d = _a.variant, variant = _d === void 0 ? 'secondary' : _d, disabled = _a.disabled, _e = _a.tabIndex, tabIndex = _e === void 0 ? 0 : _e, large = _a.large, other = tslib.__rest(_a, ["as", "icon", "label", "tooltipProps", "className", "variant", "disabled", "tabIndex", "large"]);
|
|
2122
2123
|
var internalRef = React.useRef();
|
|
2123
2124
|
React.useImperativeHandle(ref, function () { return internalRef.current; });
|
|
2124
2125
|
// Configure additional properties based on the type of the Component
|
|
@@ -2136,15 +2137,7 @@ var IconButton = React.forwardRef(function (_a, ref) {
|
|
|
2136
2137
|
accessibilityProps['aria-disabled'] = disabled;
|
|
2137
2138
|
}
|
|
2138
2139
|
}
|
|
2139
|
-
|
|
2140
|
-
if (!!tooltipPlacement || !!tooltipVariant || !!tooltipPortal) {
|
|
2141
|
-
React__default["default"].useEffect(function () {
|
|
2142
|
-
console.warn('[IconButton] The following props are deprecated: tooltipPlacement, tooltipVariant, tooltipPortal. ' +
|
|
2143
|
-
'See https://cauldron.dequelabs.com/components/IconButton for recommended replacement.');
|
|
2144
|
-
}, []);
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
var tooltipProps = tslib.__assign({ placement: tooltipPlacement || 'auto', variant: tooltipVariant, portal: tooltipPortal, association: 'aria-labelledby', hideElementOnHidden: true }, tooltipPropsProp);
|
|
2140
|
+
var tooltipProps = tslib.__assign({ placement: 'auto', association: 'aria-labelledby', hideElementOnHidden: true }, tooltipPropsProp);
|
|
2148
2141
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2149
2142
|
React__default["default"].createElement(Component, tslib.__assign({ className: classNames__default["default"](className, {
|
|
2150
2143
|
IconButton: true,
|
|
@@ -2444,7 +2437,9 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
2444
2437
|
var _d = tslib.__read(React.useState(value || defaultValue || null), 2), currentValue = _d[0], setCurrentValue = _d[1];
|
|
2445
2438
|
var _e = tslib.__read(React.useState(null), 2), focusIndex = _e[0], setFocusIndex = _e[1];
|
|
2446
2439
|
var inputs = React.useRef([]);
|
|
2447
|
-
var handleChange = function (value) {
|
|
2440
|
+
var handleChange = function (value) {
|
|
2441
|
+
return setCurrentValue(value !== null && value !== void 0 ? value : null);
|
|
2442
|
+
};
|
|
2448
2443
|
var onRadioFocus = function (index) { return setFocusIndex(index); };
|
|
2449
2444
|
var onRadioBlur = function () { return setFocusIndex(null); };
|
|
2450
2445
|
var onRadioClick = function (index) {
|
|
@@ -2469,10 +2464,9 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
2469
2464
|
return (React__default["default"].createElement("div", { className: "Radio__wrap", key: id },
|
|
2470
2465
|
React__default["default"].createElement("div", { className: classNames__default["default"]('Radio is--flex-row', className) },
|
|
2471
2466
|
React__default["default"].createElement("input", tslib.__assign({ type: "radio", name: name, value: radioValue, id: id, ref: function (input) {
|
|
2472
|
-
if (
|
|
2473
|
-
|
|
2467
|
+
if (input) {
|
|
2468
|
+
inputs.current[index] = input;
|
|
2474
2469
|
}
|
|
2475
|
-
inputs.current.push(input);
|
|
2476
2470
|
}, onFocus: function () { return onRadioFocus(index); }, onBlur: function () { return onRadioBlur(); }, onChange: function () {
|
|
2477
2471
|
var _a;
|
|
2478
2472
|
handleChange(radioValue);
|
|
@@ -2489,10 +2483,6 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
2489
2483
|
'Field__labelDescription--disabled': disabled
|
|
2490
2484
|
}) }, labelDescription))));
|
|
2491
2485
|
});
|
|
2492
|
-
// reset the input refs array
|
|
2493
|
-
// refs get clobbered every re-render anyway and this supports "dynamic" radios
|
|
2494
|
-
// (changing the number of radio buttons for example)
|
|
2495
|
-
inputs.current = [];
|
|
2496
2486
|
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"](className, { 'Radio--inline': inline }), role: "radiogroup", ref: ref }, other), radioButtons));
|
|
2497
2487
|
});
|
|
2498
2488
|
RadioGroup.displayName = 'RadioGroup';
|
|
@@ -3045,8 +3035,8 @@ var ImpactBadge = React.forwardRef(function (_a, ref) {
|
|
|
3045
3035
|
ImpactBadge.displayName = 'ImpactBadge';
|
|
3046
3036
|
|
|
3047
3037
|
var TagButton = React__default["default"].forwardRef(function (_a, ref) {
|
|
3048
|
-
var label = _a.label, value = _a.value, icon = _a.icon, className = _a.className, rest = tslib.__rest(_a, ["label", "value", "icon", "className"]);
|
|
3049
|
-
return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), ref: ref }, rest),
|
|
3038
|
+
var label = _a.label, value = _a.value, icon = _a.icon, className = _a.className, size = _a.size, rest = tslib.__rest(_a, ["label", "value", "icon", "className", "size"]);
|
|
3039
|
+
return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), size: size, ref: ref }, rest),
|
|
3050
3040
|
React__default["default"].createElement(TagLabel, null, label),
|
|
3051
3041
|
value,
|
|
3052
3042
|
React__default["default"].createElement(Icon, { className: "TagButton__icon", type: icon })));
|
|
@@ -3189,23 +3179,25 @@ var TableHead = React.forwardRef(function (_a, ref) {
|
|
|
3189
3179
|
TableHead.displayName = 'TableHead';
|
|
3190
3180
|
|
|
3191
3181
|
var TableHeader = React.forwardRef(function (_a, ref) {
|
|
3192
|
-
var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className,
|
|
3182
|
+
var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className, _sortAscendingAnnouncement = _a.sortAscendingAnnouncement, _sortDescendingAnnouncement = _a.sortDescendingAnnouncement, align = _a.align, _b = _a.variant, variant = _b === void 0 ? 'header' : _b, style = _a.style, other = tslib.__rest(_a, ["children", "sortDirection", "onSort", "className", "sortAscendingAnnouncement", "sortDescendingAnnouncement", "align", "variant", "style"]);
|
|
3193
3183
|
var tableHeaderRef = useSharedRef(ref);
|
|
3194
|
-
var
|
|
3184
|
+
var _c = useTable(), layout = _c.layout, columns = _c.columns;
|
|
3195
3185
|
var tableGridStyles = useTableGridStyles({
|
|
3196
3186
|
elementRef: tableHeaderRef,
|
|
3197
3187
|
align: align,
|
|
3198
3188
|
columns: columns,
|
|
3199
3189
|
layout: layout
|
|
3200
3190
|
});
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3191
|
+
React.useEffect(function () {
|
|
3192
|
+
if (process.env.NODE_ENV === 'production')
|
|
3193
|
+
return;
|
|
3194
|
+
if (_sortAscendingAnnouncement !== undefined ||
|
|
3195
|
+
_sortDescendingAnnouncement !== undefined) {
|
|
3196
|
+
console.warn('[TableHeader] The following props are deprecated and no longer used: sortAscendingAnnouncement, sortDescendingAnnouncement. ' +
|
|
3197
|
+
'Sort state is communicated via aria-sort. ' +
|
|
3198
|
+
'See https://cauldron.dequelabs.com/components/Table for more information.');
|
|
3199
|
+
}
|
|
3200
|
+
}, [_sortAscendingAnnouncement, _sortDescendingAnnouncement]);
|
|
3209
3201
|
return (React__default["default"].createElement("th", tslib.__assign({ ref: tableHeaderRef, "aria-sort": sortDirection, className: classNames__default["default"](variant === 'cell'
|
|
3210
3202
|
? ['TableCell', 'TableHeader--cell-variant']
|
|
3211
3203
|
: 'TableHeader', className, {
|
|
@@ -3213,9 +3205,7 @@ var TableHeader = React.forwardRef(function (_a, ref) {
|
|
|
3213
3205
|
'TableHeader--sort-descending': sortDirection === 'descending'
|
|
3214
3206
|
}), style: tslib.__assign(tslib.__assign({}, tableGridStyles), style) }, other), !!onSort && !!sortDirection ? (React__default["default"].createElement("button", { onClick: onSort, className: "TableHeader__sort-button", type: "button" },
|
|
3215
3207
|
children,
|
|
3216
|
-
React__default["default"].createElement("span", { "aria-hidden": "true" }, sortDirection === 'none' ? (React__default["default"].createElement(Icon, { type: "sort-triangle" })) : sortDirection === 'ascending' ? (React__default["default"].createElement(Icon, { type: "table-sort-ascending" })) : (React__default["default"].createElement(Icon, { type: "table-sort-descending" })))
|
|
3217
|
-
React__default["default"].createElement(Offscreen, null,
|
|
3218
|
-
React__default["default"].createElement("span", { role: "status", "aria-live": "polite" }, announcement)))) : (children)));
|
|
3208
|
+
React__default["default"].createElement("span", { "aria-hidden": "true" }, sortDirection === 'none' ? (React__default["default"].createElement(Icon, { type: "sort-triangle" })) : sortDirection === 'ascending' ? (React__default["default"].createElement(Icon, { type: "table-sort-ascending" })) : (React__default["default"].createElement(Icon, { type: "table-sort-descending" }))))) : (children)));
|
|
3219
3209
|
});
|
|
3220
3210
|
TableHeader.displayName = 'TableHeader';
|
|
3221
3211
|
|
|
@@ -3419,9 +3409,9 @@ var Stepper = function (_a) {
|
|
|
3419
3409
|
Stepper.displayName = 'Stepper';
|
|
3420
3410
|
|
|
3421
3411
|
var ProgressBar = React.forwardRef(function (_a, ref) {
|
|
3422
|
-
var _b = _a.progress, progress = _b === void 0 ? 0 : _b, _c = _a.progressMax, progressMax = _c === void 0 ? 100 : _c, _d = _a.progressMin, progressMin = _d === void 0 ? 0 : _d, props = tslib.__rest(_a, ["progress", "progressMax", "progressMin"]);
|
|
3412
|
+
var _b = _a.progress, progress = _b === void 0 ? 0 : _b, _c = _a.progressMax, progressMax = _c === void 0 ? 100 : _c, _d = _a.progressMin, progressMin = _d === void 0 ? 0 : _d, thin = _a.thin, props = tslib.__rest(_a, ["progress", "progressMax", "progressMin", "thin"]);
|
|
3423
3413
|
var className = props.className, otherProps = tslib.__rest(props, ["className"]);
|
|
3424
|
-
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('ProgressBar', className), role: "progressbar", "aria-valuemin": progressMin, "aria-valuemax": progressMax, "aria-valuenow": progress, ref: ref }, otherProps),
|
|
3414
|
+
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('ProgressBar', { 'ProgressBar--thin': thin }, className), role: "progressbar", "aria-valuemin": progressMin, "aria-valuemax": progressMax, "aria-valuenow": progress, ref: ref }, otherProps),
|
|
3425
3415
|
React__default["default"].createElement("div", { className: "ProgressBar--fill", style: { width: "".concat(Math.min((progress / progressMax) * 100, 100), "%") } })));
|
|
3426
3416
|
});
|
|
3427
3417
|
ProgressBar.displayName = 'ProgressBar';
|
package/package.json
CHANGED