@uxf/ui 1.0.0-beta.70 → 1.0.0-beta.71
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/color-radio-group/color-radio-group.d.ts +2 -1
- package/color-radio-group/color-radio-group.js +9 -9
- package/color-radio-group/color-radio-group.stories.js +1 -1
- package/color-radio-group/index.d.ts +1 -1
- package/color-radio-group/index.js +15 -3
- package/package.json +1 -1
- package/radio-group/radio-group.d.ts +2 -2
- package/radio-group/radio-group.js +13 -14
- package/tabs/tabs.d.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties } from "react";
|
|
1
|
+
import React, { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { FormControlProps } from "../types";
|
|
3
3
|
import { HexCodeString } from "../utils/is-light-background";
|
|
4
4
|
export declare type ColorRadioGroupOptionValue = HexCodeString;
|
|
@@ -8,6 +8,7 @@ export interface ColorRadioGroupOption {
|
|
|
8
8
|
}
|
|
9
9
|
export interface ColorRadioGroupProps extends FormControlProps<ColorRadioGroupOptionValue | null> {
|
|
10
10
|
className?: string;
|
|
11
|
+
helperText?: ReactNode;
|
|
11
12
|
hiddenLabel?: boolean;
|
|
12
13
|
id: string;
|
|
13
14
|
label: string;
|
|
@@ -33,15 +33,15 @@ const classes_1 = require("@uxf/core/constants/classes");
|
|
|
33
33
|
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
34
34
|
const color_radio_1 = require("./color-radio");
|
|
35
35
|
exports.ColorRadioGroup = (0, forwardRef_1.forwardRef)("ColorRadioGroup", (props, ref) => {
|
|
36
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
37
|
-
const { className, hiddenLabel, id, isDisabled, label, onChange, options, style, value } = props;
|
|
38
36
|
const innerRef = (0, react_2.useRef)(null);
|
|
39
|
-
(0, use_input_submit_1.useInputSubmit)(innerRef, "radio-group", isDisabled);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
react_2.default.createElement(
|
|
37
|
+
(0, use_input_submit_1.useInputSubmit)(innerRef, "radio-group", props.isDisabled);
|
|
38
|
+
const errorId = props.isInvalid ? `${props.id}--errormessage` : undefined;
|
|
39
|
+
const rootClassName = (0, cx_1.cx)("uxf-color-radio-group-group", props.className);
|
|
40
|
+
return (react_2.default.createElement(react_1.RadioGroup, { className: rootClassName, id: props.id, onChange: props.onChange, style: props.style, value: props.value },
|
|
41
|
+
react_2.default.createElement(react_1.RadioGroup.Label, { as: label_1.Label, className: "uxf-color-radio-group__label", isHidden: props.hiddenLabel, ref: ref }, props.label),
|
|
42
|
+
react_2.default.createElement("div", { className: "uxf-color-radio-group__options-wrapper" }, props.options.map((option) => {
|
|
44
43
|
const optionStyle = { "--option-color": option.value };
|
|
45
|
-
return (react_2.default.createElement(react_1.RadioGroup.Option, { className: (0, cx_1.cx)("uxf-color-radio-group__option", props.isDisabled && classes_1.CLASSES.IS_DISABLED), key: option.value.toString(), value: option.value, style: optionStyle }, (o) => (react_2.default.createElement(color_radio_1.ColorRadio, { isDisabled: isDisabled || o.disabled, colorLabel: option.label, color: option.value, ref: o.checked ? innerRef : undefined, value: o.checked }))));
|
|
46
|
-
}))
|
|
44
|
+
return (react_2.default.createElement(react_1.RadioGroup.Option, { className: (0, cx_1.cx)("uxf-color-radio-group__option", props.isDisabled && classes_1.CLASSES.IS_DISABLED), key: option.value.toString(), value: option.value, style: optionStyle }, (o) => (react_2.default.createElement(color_radio_1.ColorRadio, { isDisabled: props.isDisabled || o.disabled, colorLabel: option.label, color: option.value, ref: o.checked ? innerRef : undefined, value: o.checked }))));
|
|
45
|
+
})),
|
|
46
|
+
props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText))));
|
|
47
47
|
});
|
|
@@ -74,6 +74,6 @@ function Default() {
|
|
|
74
74
|
react_1.default.createElement("div", { className: "light w-1/2 p-20" },
|
|
75
75
|
react_1.default.createElement(index_1.ColorRadioGroup, { id: "radiogroup", label: "Light Color Radio group", onChange: (v) => setValue(v), options: options, value: value })),
|
|
76
76
|
react_1.default.createElement("div", { className: "dark w-1/2 bg-gray-900 p-20" },
|
|
77
|
-
react_1.default.createElement(index_1.ColorRadioGroup, { id: "radiogroup", label: "Dark Color Radio group", onChange: (v) => setValue(v), options: options, value: value }))));
|
|
77
|
+
react_1.default.createElement(index_1.ColorRadioGroup, { id: "radiogroup", label: "Dark Color Radio group with helper text", helperText: "Some helper text", onChange: (v) => setValue(v), options: options, value: value }))));
|
|
78
78
|
}
|
|
79
79
|
exports.Default = Default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./color-radio-group";
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
var color_radio_group_1 = require("./color-radio-group");
|
|
5
|
-
Object.defineProperty(exports, "ColorRadioGroup", { enumerable: true, get: function () { return color_radio_group_1.ColorRadioGroup; } });
|
|
17
|
+
__exportStar(require("./color-radio-group"), exports);
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties } from "react";
|
|
1
|
+
import React, { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { FormControlProps } from "../types";
|
|
3
3
|
export declare type RadioGroupOptionValue = string | number;
|
|
4
4
|
export interface RadioGroupOption {
|
|
@@ -8,7 +8,7 @@ export interface RadioGroupOption {
|
|
|
8
8
|
}
|
|
9
9
|
export interface RadioGroupProps extends FormControlProps<RadioGroupOptionValue | null> {
|
|
10
10
|
className?: string;
|
|
11
|
-
|
|
11
|
+
helperText?: ReactNode;
|
|
12
12
|
forceColumn?: boolean;
|
|
13
13
|
hiddenLabel?: boolean;
|
|
14
14
|
id: string;
|
|
@@ -25,25 +25,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.RadioGroup = void 0;
|
|
27
27
|
const react_1 = require("@headlessui/react");
|
|
28
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
28
31
|
const react_2 = __importStar(require("react"));
|
|
29
|
-
const error_message_1 = require("../error-message");
|
|
30
32
|
const use_input_submit_1 = require("../hooks/use-input-submit");
|
|
31
33
|
const label_1 = require("../label");
|
|
32
34
|
const radio_1 = require("../radio");
|
|
33
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
34
|
-
const classes_1 = require("@uxf/core/constants/classes");
|
|
35
|
-
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
36
35
|
exports.RadioGroup = (0, forwardRef_1.forwardRef)("RadioGroup", (props, ref) => {
|
|
37
|
-
|
|
38
|
-
const { className, error, hiddenLabel, id, isDisabled, isInvalid, label, onChange, options, style, value, variant = "list", } = props;
|
|
36
|
+
var _a;
|
|
39
37
|
const innerRef = (0, react_2.useRef)(null);
|
|
40
|
-
(0, use_input_submit_1.useInputSubmit)(innerRef, "radio-group", isDisabled);
|
|
41
|
-
const errorId = isInvalid ? `${id}--errormessage` : undefined;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
react_2.default.createElement(
|
|
38
|
+
(0, use_input_submit_1.useInputSubmit)(innerRef, "radio-group", props.isDisabled);
|
|
39
|
+
const errorId = props.isInvalid ? `${props.id}--errormessage` : undefined;
|
|
40
|
+
const variant = (_a = props.variant) !== null && _a !== void 0 ? _a : "list";
|
|
41
|
+
const rootClassName = (0, cx_1.cx)("uxf-radio-group", variant === "list" && "uxf-radio-group--list", variant === "radioButton" && "uxf-radio-group--radioButton", props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.className);
|
|
42
|
+
return (react_2.default.createElement(react_1.RadioGroup, { className: rootClassName, disabled: props.isDisabled, id: props.id, onChange: props.onChange, style: props.style, value: props.value },
|
|
43
|
+
react_2.default.createElement(react_1.RadioGroup.Label, { as: label_1.Label, className: "uxf-radio-group__label", isHidden: props.hiddenLabel, ref: ref }, props.label),
|
|
44
|
+
react_2.default.createElement("div", { className: "uxf-radio-group__options-wrapper" }, props.options.map((option) => (react_2.default.createElement(react_1.RadioGroup.Option, { className: (0, cx_1.cx)("uxf-radio-group__option", props.isDisabled && classes_1.CLASSES.IS_DISABLED), disabled: option.disabled, key: option.value.toString(), value: option.value }, (o) => (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-radio-group__option__wrapper", o.checked && classes_1.CLASSES.IS_SELECTED) },
|
|
46
45
|
react_2.default.createElement("span", { className: "uxf-radio-group__option__label" }, option.label),
|
|
47
|
-
react_2.default.createElement(radio_1.Radio, { isDisabled: isDisabled || o.disabled, isInvalid: isInvalid, label: option.label, ref: o.checked ? innerRef : undefined, value: o.checked }))))))),
|
|
48
|
-
|
|
46
|
+
react_2.default.createElement(radio_1.Radio, { isDisabled: props.isDisabled || o.disabled, isInvalid: props.isInvalid, label: option.label, ref: o.checked ? innerRef : undefined, value: o.checked }))))))),
|
|
47
|
+
props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText))));
|
|
49
48
|
});
|