@deque/cauldron-react 5.2.0 → 5.3.0-canary.076e2338
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 +6 -0
- package/lib/components/RadioGroup/index.d.ts +2 -1
- package/lib/index.js +5 -6
- package/package.json +2 -2
package/lib/cauldron.css
CHANGED
|
@@ -33,6 +33,12 @@
|
|
|
33
33
|
--expandcollapse-panel-color: var(--accent-light);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
@media (prefers-reduced-motion: reduce) {
|
|
37
|
+
.ExpandCollapse__panel {
|
|
38
|
+
animation: none !important;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
a.Button--primary,
|
|
37
43
|
a.Button--secondary {
|
|
38
44
|
text-decoration: none;
|
|
@@ -11,10 +11,11 @@ export interface RadioGroupProps {
|
|
|
11
11
|
radios: RadioItem[];
|
|
12
12
|
defaultValue?: string;
|
|
13
13
|
value?: any;
|
|
14
|
+
inline?: boolean;
|
|
14
15
|
onChange: (radio: RadioItem, input: HTMLElement) => void;
|
|
15
16
|
}
|
|
16
17
|
declare const RadioGroup: {
|
|
17
|
-
({ name, radios, defaultValue, value, onChange, className, ...other }: RadioGroupProps): JSX.Element;
|
|
18
|
+
({ name, radios, defaultValue, value, onChange, className, inline, ...other }: RadioGroupProps): JSX.Element;
|
|
18
19
|
propTypes: {
|
|
19
20
|
name: PropTypes.Requireable<string>;
|
|
20
21
|
radios: PropTypes.Validator<(PropTypes.InferProps<{
|
package/lib/index.js
CHANGED
|
@@ -501,6 +501,7 @@ var AccordionContent = function (_a) {
|
|
|
501
501
|
};
|
|
502
502
|
var Accordion = function (_a) {
|
|
503
503
|
var children = _a.children, open = _a.open, onToggle = _a.onToggle, animationTiming = _a.animationTiming, props = tslib.__rest(_a, ["children", "open", "onToggle", "animationTiming"]);
|
|
504
|
+
var elementId = nextId.useId();
|
|
504
505
|
var childrenArray = React__default.Children.toArray(children);
|
|
505
506
|
var trigger = childrenArray.find(function (child) {
|
|
506
507
|
return typeof child === 'string' ||
|
|
@@ -519,8 +520,6 @@ var Accordion = function (_a) {
|
|
|
519
520
|
});
|
|
520
521
|
return null;
|
|
521
522
|
}
|
|
522
|
-
var _b = trigger.props, triggerClassName = _b.className, triggerProps = tslib.__rest(_b, ["className"]);
|
|
523
|
-
var elementId = nextId.useId();
|
|
524
523
|
return (React__default.createElement("div", tslib.__assign({ className: "Accordion" }, props),
|
|
525
524
|
React__default.createElement(ExpandCollapsePanel, tslib.__assign({ id: panelElement.props.id || "".concat(elementId, "-panel"), open: open, onToggle: onToggle, animationTiming: animationTiming }, panelElement.props),
|
|
526
525
|
React__default.createElement(PanelTrigger$1, tslib.__assign({ iconCollapsed: "triangle-right", iconExpanded: "triangle-down", className: classNames('Accordion__trigger', trigger.props.className), "aria-controls": panelElement.props.id || "".concat(elementId, "-panel"), heading: trigger.props.heading }, trigger.props), trigger),
|
|
@@ -2584,9 +2583,9 @@ var RadioGroup = function (_a) {
|
|
|
2584
2583
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2585
2584
|
_b = _a.onChange,
|
|
2586
2585
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2587
|
-
onChange = _b === void 0 ? function () { } : _b, className = _a.className, other = tslib.__rest(_a, ["name", "radios", "defaultValue", "value", "onChange", "className"]);
|
|
2588
|
-
var
|
|
2589
|
-
var
|
|
2586
|
+
onChange = _b === void 0 ? function () { } : _b, className = _a.className, _c = _a.inline, inline = _c === void 0 ? false : _c, other = tslib.__rest(_a, ["name", "radios", "defaultValue", "value", "onChange", "className", "inline"]);
|
|
2587
|
+
var _d = tslib.__read(React.useState(value || defaultValue || null), 2), currentValue = _d[0], setCurrentValue = _d[1];
|
|
2588
|
+
var _e = tslib.__read(React.useState(null), 2), focusIndex = _e[0], setFocusIndex = _e[1];
|
|
2590
2589
|
var inputs = React.useRef([]);
|
|
2591
2590
|
var handleChange = function (value) { return setCurrentValue(value); };
|
|
2592
2591
|
var onRadioFocus = function (index) { return setFocusIndex(index); };
|
|
@@ -2636,7 +2635,7 @@ var RadioGroup = function (_a) {
|
|
|
2636
2635
|
// refs get clobbered every re-render anyway and this supports "dynamic" radios
|
|
2637
2636
|
// (changing the number of radio buttons for example)
|
|
2638
2637
|
inputs.current = [];
|
|
2639
|
-
return (React__default.createElement("div", tslib.__assign({ className: className, role: "radiogroup" }, other), radioButtons));
|
|
2638
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames(className, { 'Radio--inline': inline }), role: "radiogroup" }, other), radioButtons));
|
|
2640
2639
|
};
|
|
2641
2640
|
RadioGroup.propTypes = {
|
|
2642
2641
|
name: PropTypes.string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0-canary.076e2338",
|
|
4
4
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
5
5
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
6
6
|
"publishConfig": {
|
|
@@ -126,4 +126,4 @@
|
|
|
126
126
|
"\\.svg$": "<rootDir>/__tests__/svgMock.js"
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
}
|
|
129
|
+
}
|