@deque/cauldron-react 6.27.0-canary.3efa41db → 6.27.0-canary.5b4497f5
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/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 +17 -16
- 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;
|
|
@@ -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));
|
|
@@ -3042,8 +3043,8 @@ var ImpactBadge = React.forwardRef(function (_a, ref) {
|
|
|
3042
3043
|
ImpactBadge.displayName = 'ImpactBadge';
|
|
3043
3044
|
|
|
3044
3045
|
var TagButton = React__default["default"].forwardRef(function (_a, ref) {
|
|
3045
|
-
var label = _a.label, value = _a.value, icon = _a.icon, className = _a.className, rest = tslib.__rest(_a, ["label", "value", "icon", "className"]);
|
|
3046
|
-
return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), ref: ref }, rest),
|
|
3046
|
+
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"]);
|
|
3047
|
+
return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), size: size, ref: ref }, rest),
|
|
3047
3048
|
React__default["default"].createElement(TagLabel, null, label),
|
|
3048
3049
|
value,
|
|
3049
3050
|
React__default["default"].createElement(Icon, { className: "TagButton__icon", type: icon })));
|
|
@@ -3186,23 +3187,25 @@ var TableHead = React.forwardRef(function (_a, ref) {
|
|
|
3186
3187
|
TableHead.displayName = 'TableHead';
|
|
3187
3188
|
|
|
3188
3189
|
var TableHeader = React.forwardRef(function (_a, ref) {
|
|
3189
|
-
var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className,
|
|
3190
|
+
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"]);
|
|
3190
3191
|
var tableHeaderRef = useSharedRef(ref);
|
|
3191
|
-
var
|
|
3192
|
+
var _c = useTable(), layout = _c.layout, columns = _c.columns;
|
|
3192
3193
|
var tableGridStyles = useTableGridStyles({
|
|
3193
3194
|
elementRef: tableHeaderRef,
|
|
3194
3195
|
align: align,
|
|
3195
3196
|
columns: columns,
|
|
3196
3197
|
layout: layout
|
|
3197
3198
|
});
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3199
|
+
React.useEffect(function () {
|
|
3200
|
+
if (process.env.NODE_ENV === 'production')
|
|
3201
|
+
return;
|
|
3202
|
+
if (_sortAscendingAnnouncement !== undefined ||
|
|
3203
|
+
_sortDescendingAnnouncement !== undefined) {
|
|
3204
|
+
console.warn('[TableHeader] The following props are deprecated and no longer used: sortAscendingAnnouncement, sortDescendingAnnouncement. ' +
|
|
3205
|
+
'Sort state is communicated via aria-sort. ' +
|
|
3206
|
+
'See https://cauldron.dequelabs.com/components/Table for more information.');
|
|
3207
|
+
}
|
|
3208
|
+
}, [_sortAscendingAnnouncement, _sortDescendingAnnouncement]);
|
|
3206
3209
|
return (React__default["default"].createElement("th", tslib.__assign({ ref: tableHeaderRef, "aria-sort": sortDirection, className: classNames__default["default"](variant === 'cell'
|
|
3207
3210
|
? ['TableCell', 'TableHeader--cell-variant']
|
|
3208
3211
|
: 'TableHeader', className, {
|
|
@@ -3210,9 +3213,7 @@ var TableHeader = React.forwardRef(function (_a, ref) {
|
|
|
3210
3213
|
'TableHeader--sort-descending': sortDirection === 'descending'
|
|
3211
3214
|
}), style: tslib.__assign(tslib.__assign({}, tableGridStyles), style) }, other), !!onSort && !!sortDirection ? (React__default["default"].createElement("button", { onClick: onSort, className: "TableHeader__sort-button", type: "button" },
|
|
3212
3215
|
children,
|
|
3213
|
-
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" })))
|
|
3214
|
-
React__default["default"].createElement(Offscreen, null,
|
|
3215
|
-
React__default["default"].createElement("span", { role: "status", "aria-live": "polite" }, announcement)))) : (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" }))))) : (children)));
|
|
3216
3217
|
});
|
|
3217
3218
|
TableHeader.displayName = 'TableHeader';
|
|
3218
3219
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "6.27.0-canary.
|
|
3
|
+
"version": "6.27.0-canary.5b4497f5",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|