@deque/cauldron-react 6.27.0-canary.ccb9880a → 6.27.0-canary.e55bd76a
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,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;
|
|
@@ -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 })));
|
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.e55bd76a",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|