@worknice/whiteboard 0.16.10 → 0.16.12
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.
|
@@ -13,10 +13,11 @@ type Props<Value, Option extends Value> = {
|
|
|
13
13
|
options: Array<Option>;
|
|
14
14
|
optionToId: (option: Option) => string;
|
|
15
15
|
optionToLabel: (option: Option) => ReactNode;
|
|
16
|
+
optionToDisabled?: (option: Option) => boolean;
|
|
16
17
|
required?: boolean;
|
|
17
18
|
value: Value;
|
|
18
19
|
valueToId: (option: Value) => string | undefined;
|
|
19
20
|
orientation?: "rows" | "columns";
|
|
20
21
|
};
|
|
21
|
-
declare const RadioSetField: <Value, Option extends Value>({ autoFocus, description, disabled, errors, id, includeValueInTracking, label, labelFont, onChange, options, optionToId, optionToLabel, required, value, valueToId, orientation, }: Props<Value, Option>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare const RadioSetField: <Value, Option extends Value>({ autoFocus, description, disabled, errors, id, includeValueInTracking, label, labelFont, onChange, options, optionToId, optionToLabel, optionToDisabled, required, value, valueToId, orientation, }: Props<Value, Option>) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export default RadioSetField;
|
|
@@ -6,7 +6,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__forms_ToggleField_js_961683e7__ from "../
|
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__inputs_RadioInput_js_49cc9f35__ from "../inputs/RadioInput.js";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__utils_TrackingContext_js_139012da__ from "../utils/TrackingContext.js";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__RadioSetField_module_js_3470e0f7__ from "./RadioSetField.module.js";
|
|
9
|
-
const RadioSetField = ({ autoFocus = false, description, disabled = false, errors, id, includeValueInTracking, label, labelFont = "label", onChange, options, optionToId, optionToLabel, required = false, value, valueToId, orientation = "rows" })=>{
|
|
9
|
+
const RadioSetField = ({ autoFocus = false, description, disabled = false, errors, id, includeValueInTracking, label, labelFont = "label", onChange, options, optionToId, optionToLabel, optionToDisabled, required = false, value, valueToId, orientation = "rows" })=>{
|
|
10
10
|
const trackingContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__utils_TrackingContext_js_139012da__["default"]);
|
|
11
11
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__["default"], {
|
|
12
12
|
description: description,
|
|
@@ -20,13 +20,14 @@ const RadioSetField = ({ autoFocus = false, description, disabled = false, error
|
|
|
20
20
|
]),
|
|
21
21
|
children: options.map((option, index)=>{
|
|
22
22
|
const optionId = optionToId(option);
|
|
23
|
+
const optionDisabled = disabled || (optionToDisabled ? optionToDisabled(option) : false);
|
|
23
24
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_ToggleField_js_961683e7__["default"], {
|
|
24
|
-
disabled:
|
|
25
|
+
disabled: optionDisabled,
|
|
25
26
|
inputId: `${id}-${optionId}`,
|
|
26
27
|
label: optionToLabel(option),
|
|
27
28
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_RadioInput_js_49cc9f35__["default"], {
|
|
28
29
|
autoFocus: autoFocus && 0 === index,
|
|
29
|
-
disabled:
|
|
30
|
+
disabled: optionDisabled,
|
|
30
31
|
id: `${id}-${optionId}`,
|
|
31
32
|
value: optionId === valueToId(value),
|
|
32
33
|
onChange: ()=>{
|
|
@@ -3,6 +3,7 @@ import RadioSetField from "./RadioSetField";
|
|
|
3
3
|
type Props<Option extends {
|
|
4
4
|
id: string;
|
|
5
5
|
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
}> = Omit<ComponentProps<typeof RadioSetField>, "onChange" | "options" | "optionToId" | "optionToLabel" | "value" | "valueToId"> & {
|
|
7
8
|
onChange: Dispatch<Option["id"]>;
|
|
8
9
|
options: Array<Option>;
|
|
@@ -11,5 +12,6 @@ type Props<Option extends {
|
|
|
11
12
|
declare const SimpleRadioSetField: <Option extends {
|
|
12
13
|
id: string;
|
|
13
14
|
label: string;
|
|
15
|
+
disabled?: boolean;
|
|
14
16
|
}>({ onChange, options, value, ...props }: Props<Option>) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export default SimpleRadioSetField;
|
|
@@ -5,6 +5,7 @@ const SimpleRadioSetField = ({ onChange, options, value, ...props })=>/*#__PURE_
|
|
|
5
5
|
options: options,
|
|
6
6
|
optionToId: (option)=>option.id,
|
|
7
7
|
optionToLabel: (option)=>option.label,
|
|
8
|
+
optionToDisabled: (option)=>option.disabled ?? false,
|
|
8
9
|
value: options.find((option)=>option.id === value) ?? null,
|
|
9
10
|
valueToId: (option)=>option?.id,
|
|
10
11
|
...props
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worknice/whiteboard",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.12",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"files": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-markdown": "^10.1.0",
|
|
39
39
|
"utf8": "^3.0.0",
|
|
40
40
|
"zod": "^3.22.3",
|
|
41
|
-
"@worknice/utils": "^0.6.
|
|
41
|
+
"@worknice/utils": "^0.6.53"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@anolilab/semantic-release-pnpm": "^1.1.10",
|