@deque/cauldron-react 6.26.0 → 6.27.0-canary.058d302b
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/ProgressBar/index.d.ts +1 -0
- package/lib/components/RadioGroup/index.d.ts +1 -1
- 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 +11 -13
- 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,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
|
}
|
|
@@ -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));
|
|
@@ -2444,7 +2445,9 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
2444
2445
|
var _d = tslib.__read(React.useState(value || defaultValue || null), 2), currentValue = _d[0], setCurrentValue = _d[1];
|
|
2445
2446
|
var _e = tslib.__read(React.useState(null), 2), focusIndex = _e[0], setFocusIndex = _e[1];
|
|
2446
2447
|
var inputs = React.useRef([]);
|
|
2447
|
-
var handleChange = function (value) {
|
|
2448
|
+
var handleChange = function (value) {
|
|
2449
|
+
return setCurrentValue(value !== null && value !== void 0 ? value : null);
|
|
2450
|
+
};
|
|
2448
2451
|
var onRadioFocus = function (index) { return setFocusIndex(index); };
|
|
2449
2452
|
var onRadioBlur = function () { return setFocusIndex(null); };
|
|
2450
2453
|
var onRadioClick = function (index) {
|
|
@@ -2469,10 +2472,9 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
2469
2472
|
return (React__default["default"].createElement("div", { className: "Radio__wrap", key: id },
|
|
2470
2473
|
React__default["default"].createElement("div", { className: classNames__default["default"]('Radio is--flex-row', className) },
|
|
2471
2474
|
React__default["default"].createElement("input", tslib.__assign({ type: "radio", name: name, value: radioValue, id: id, ref: function (input) {
|
|
2472
|
-
if (
|
|
2473
|
-
|
|
2475
|
+
if (input) {
|
|
2476
|
+
inputs.current[index] = input;
|
|
2474
2477
|
}
|
|
2475
|
-
inputs.current.push(input);
|
|
2476
2478
|
}, onFocus: function () { return onRadioFocus(index); }, onBlur: function () { return onRadioBlur(); }, onChange: function () {
|
|
2477
2479
|
var _a;
|
|
2478
2480
|
handleChange(radioValue);
|
|
@@ -2489,10 +2491,6 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
2489
2491
|
'Field__labelDescription--disabled': disabled
|
|
2490
2492
|
}) }, labelDescription))));
|
|
2491
2493
|
});
|
|
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
2494
|
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"](className, { 'Radio--inline': inline }), role: "radiogroup", ref: ref }, other), radioButtons));
|
|
2497
2495
|
});
|
|
2498
2496
|
RadioGroup.displayName = 'RadioGroup';
|
|
@@ -3045,8 +3043,8 @@ var ImpactBadge = React.forwardRef(function (_a, ref) {
|
|
|
3045
3043
|
ImpactBadge.displayName = 'ImpactBadge';
|
|
3046
3044
|
|
|
3047
3045
|
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),
|
|
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),
|
|
3050
3048
|
React__default["default"].createElement(TagLabel, null, label),
|
|
3051
3049
|
value,
|
|
3052
3050
|
React__default["default"].createElement(Icon, { className: "TagButton__icon", type: icon })));
|
|
@@ -3419,9 +3417,9 @@ var Stepper = function (_a) {
|
|
|
3419
3417
|
Stepper.displayName = 'Stepper';
|
|
3420
3418
|
|
|
3421
3419
|
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"]);
|
|
3420
|
+
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
3421
|
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),
|
|
3422
|
+
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
3423
|
React__default["default"].createElement("div", { className: "ProgressBar--fill", style: { width: "".concat(Math.min((progress / progressMax) * 100, 100), "%") } })));
|
|
3426
3424
|
});
|
|
3427
3425
|
ProgressBar.displayName = 'ProgressBar';
|
package/package.json
CHANGED