react-science 19.8.0 → 19.9.1
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/form/components/field_groups/svg_line_style.d.ts +2 -0
- package/lib/components/form/components/field_groups/svg_line_style.d.ts.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.d.ts +2 -0
- package/lib/components/form/components/field_groups/svg_text_style.d.ts.map +1 -1
- package/lib/components/form/components/input/index.d.ts +1 -0
- package/lib/components/form/components/input/index.d.ts.map +1 -1
- package/lib/components/form/components/input/index.js.map +1 -1
- package/lib/components/form/components/input/radio_group.d.ts +13 -0
- package/lib/components/form/components/input/radio_group.d.ts.map +1 -0
- package/lib/components/form/components/input/radio_group.js +27 -0
- package/lib/components/form/components/input/radio_group.js.map +1 -0
- package/lib/components/form/components/layout/index.d.ts.map +1 -1
- package/lib/components/form/components/layout/index.js.map +1 -1
- package/lib/components/form/context/use_ts_form.d.ts +7 -0
- package/lib/components/form/context/use_ts_form.d.ts.map +1 -1
- package/lib/components/form/context/use_ts_form.js +9 -0
- package/lib/components/form/context/use_ts_form.js.map +1 -1
- package/package.json +28 -28
- package/src/components/form/components/input/{index.tsx → index.ts} +1 -0
- package/src/components/form/components/input/radio_group.tsx +70 -0
- package/src/components/form/context/use_ts_form.ts +9 -0
- /package/src/components/form/components/layout/{index.tsx → index.ts} +0 -0
|
@@ -19,6 +19,7 @@ export declare const FieldGroupSVGLineStyleFields: <TFormData, TFields extends i
|
|
|
19
19
|
readonly Select: typeof import("../input/select.tsx").Select;
|
|
20
20
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
21
21
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
22
|
+
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
22
23
|
}, {
|
|
23
24
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
24
25
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -30,6 +31,7 @@ export declare const FieldGroupSVGLineStyleFields: <TFormData, TFields extends i
|
|
|
30
31
|
readonly Select: typeof import("../input/select.tsx").Select;
|
|
31
32
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
32
33
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
34
|
+
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
33
35
|
}, {
|
|
34
36
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
35
37
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_line_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"svg_line_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAqCvC,CAAC"}
|
|
@@ -20,6 +20,7 @@ export declare const FieldGroupSVGTextStyleFields: <TFormData, TFields extends i
|
|
|
20
20
|
readonly Select: typeof import("../input/select.tsx").Select;
|
|
21
21
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
22
22
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
23
|
+
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
23
24
|
}, {
|
|
24
25
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
25
26
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -31,6 +32,7 @@ export declare const FieldGroupSVGTextStyleFields: <TFormData, TFields extends i
|
|
|
31
32
|
readonly Select: typeof import("../input/select.tsx").Select;
|
|
32
33
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
33
34
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
35
|
+
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
34
36
|
}, {
|
|
35
37
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
36
38
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_text_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"svg_text_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDA4DvC,CAAC"}
|
|
@@ -2,6 +2,7 @@ export { type Checkbox as _Checkbox } from './checkbox.js';
|
|
|
2
2
|
export { type ColorPicker as _ColorPicker } from './color_picker.js';
|
|
3
3
|
export { type Input as _Input } from './input.js';
|
|
4
4
|
export { type NumericInput as _NumericInput } from './numeric_input.js';
|
|
5
|
+
export { type RadioGroup as _RadioGroup } from './radio_group.js';
|
|
5
6
|
export { type ResetButton as _ResetButton } from './reset_button.js';
|
|
6
7
|
export { type Select as _Select } from './select.js';
|
|
7
8
|
export { type SubmitButton as _SubmitButton } from './submit_button.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,KAAK,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,KAAK,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,KAAK,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,KAAK,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,KAAK,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RadioGroupProps as BPRadioGroupProps } from '@blueprintjs/core';
|
|
2
|
+
import type { FormGroupInputProps } from '../input_groups/index.ts';
|
|
3
|
+
interface RadioGroupProps extends Omit<FormGroupInputProps, 'placeholder'>, Omit<BPRadioGroupProps, keyof FormGroupInputProps | 'onChange' | 'id' | 'name' | 'onBlur' | 'selectedValue'> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Default inline to true if the final layout (`layout ?? formLayout`) is 'inline'
|
|
7
|
+
* If you need to override this, set `inline={false}`.
|
|
8
|
+
*
|
|
9
|
+
* @param props
|
|
10
|
+
*/
|
|
11
|
+
export declare function RadioGroup(props: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=radio_group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio_group.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/radio_group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAM9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,UAAU,eACR,SACE,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,EACxC,IAAI,CACF,iBAAiB,EACf,MAAM,mBAAmB,GACzB,UAAU,GACV,IAAI,GACJ,MAAM,GACN,QAAQ,GACR,eAAe,CAClB;CAAG;AAER;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAyChD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { RadioGroup as BPRadioGroup } from '@blueprintjs/core';
|
|
3
|
+
import { useFieldContext } from "../../context/use_ts_form.js";
|
|
4
|
+
import { useFormContext } from "../input_groups/form_context.js";
|
|
5
|
+
import { FormGroup } from "../input_groups/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Default inline to true if the final layout (`layout ?? formLayout`) is 'inline'
|
|
8
|
+
* If you need to override this, set `inline={false}`.
|
|
9
|
+
*
|
|
10
|
+
* @param props
|
|
11
|
+
*/
|
|
12
|
+
export function RadioGroup(props) {
|
|
13
|
+
const { label, required, helpText, layout, fullWidth, ...radioGroupProps } = props;
|
|
14
|
+
const { layout: formLayout } = useFormContext();
|
|
15
|
+
const finalLayout = layout ?? formLayout;
|
|
16
|
+
const overridableRadioGroupProps = finalLayout === 'inline' ? { inline: true } : {};
|
|
17
|
+
const field = useFieldContext();
|
|
18
|
+
const error = field
|
|
19
|
+
.getMeta()
|
|
20
|
+
.errors.map((e) => e.message)
|
|
21
|
+
.at(0);
|
|
22
|
+
function onChange(event) {
|
|
23
|
+
return field.handleChange(event.currentTarget.value);
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(FormGroup, { name: field.name, label: label, intent: error ? 'danger' : 'none', required: required, error: error, helpText: helpText, layout: layout, fullWidth: fullWidth, children: _jsx(BPRadioGroup, { ...overridableRadioGroupProps, ...radioGroupProps, id: field.name, name: field.name, onBlur: field.handleBlur, selectedValue: field.state.value, onChange: onChange }) }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=radio_group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio_group.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/radio_group.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAerD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,GACxE,KAAK,CAAC;IAER,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,MAAM,IAAI,UAAU,CAAC;IACzC,MAAM,0BAA0B,GAC9B,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnD,MAAM,KAAK,GAAG,eAAe,EAAU,CAAC;IACxC,MAAM,KAAK,GAAG,KAAK;SAChB,OAAO,EAAE;SACT,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SAC5B,EAAE,CAAC,CAAC,CAAC,CAAC;IAET,SAAS,QAAQ,CAAC,KAAkC;QAClD,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EACjC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,YAEpB,KAAC,YAAY,OACP,0BAA0B,KAC1B,eAAe,EACnB,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,UAAU,EACxB,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAChC,QAAQ,EAAE,QAAQ,GAClB,GACQ,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/index.ts"],"names":[],"mappings":""}
|
|
@@ -2,6 +2,7 @@ import { Checkbox } from '../components/input/checkbox.js';
|
|
|
2
2
|
import { ColorPicker } from '../components/input/color_picker.tsx';
|
|
3
3
|
import { Input } from '../components/input/input.js';
|
|
4
4
|
import { NumericInput } from '../components/input/numeric_input.js';
|
|
5
|
+
import { RadioGroup } from '../components/input/radio_group.js';
|
|
5
6
|
import { ResetButton } from '../components/input/reset_button.js';
|
|
6
7
|
import { Select } from '../components/input/select.js';
|
|
7
8
|
import { SubmitButton } from '../components/input/submit_button.js';
|
|
@@ -15,6 +16,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
15
16
|
readonly Select: typeof Select;
|
|
16
17
|
readonly Switch: typeof Switch;
|
|
17
18
|
readonly ColorPicker: typeof ColorPicker;
|
|
19
|
+
readonly RadioGroup: typeof RadioGroup;
|
|
18
20
|
}, {
|
|
19
21
|
readonly SubmitButton: typeof SubmitButton;
|
|
20
22
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -27,6 +29,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
27
29
|
readonly Select: typeof Select;
|
|
28
30
|
readonly Switch: typeof Switch;
|
|
29
31
|
readonly ColorPicker: typeof ColorPicker;
|
|
32
|
+
readonly RadioGroup: typeof RadioGroup;
|
|
30
33
|
}, {
|
|
31
34
|
readonly SubmitButton: typeof SubmitButton;
|
|
32
35
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -39,6 +42,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
39
42
|
readonly Select: typeof Select;
|
|
40
43
|
readonly Switch: typeof Switch;
|
|
41
44
|
readonly ColorPicker: typeof ColorPicker;
|
|
45
|
+
readonly RadioGroup: typeof RadioGroup;
|
|
42
46
|
}, {
|
|
43
47
|
readonly SubmitButton: typeof SubmitButton;
|
|
44
48
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -51,6 +55,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
51
55
|
readonly Select: typeof Select;
|
|
52
56
|
readonly Switch: typeof Switch;
|
|
53
57
|
readonly ColorPicker: typeof ColorPicker;
|
|
58
|
+
readonly RadioGroup: typeof RadioGroup;
|
|
54
59
|
}, {
|
|
55
60
|
readonly SubmitButton: typeof SubmitButton;
|
|
56
61
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -62,6 +67,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
62
67
|
readonly Select: typeof Select;
|
|
63
68
|
readonly Switch: typeof Switch;
|
|
64
69
|
readonly ColorPicker: typeof ColorPicker;
|
|
70
|
+
readonly RadioGroup: typeof RadioGroup;
|
|
65
71
|
}, {
|
|
66
72
|
readonly SubmitButton: typeof SubmitButton;
|
|
67
73
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -76,6 +82,7 @@ export declare const useForm: <TFormData, TOnMount extends import("@tanstack/rea
|
|
|
76
82
|
readonly Select: typeof Select;
|
|
77
83
|
readonly Switch: typeof Switch;
|
|
78
84
|
readonly ColorPicker: typeof ColorPicker;
|
|
85
|
+
readonly RadioGroup: typeof RadioGroup;
|
|
79
86
|
}, {
|
|
80
87
|
readonly SubmitButton: typeof SubmitButton;
|
|
81
88
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_ts_form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/context/use_ts_form.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,C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;;EAAa,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -3,12 +3,20 @@ import { Checkbox } from '../components/input/checkbox.js';
|
|
|
3
3
|
import { ColorPicker } from "../components/input/color_picker.js";
|
|
4
4
|
import { Input } from '../components/input/input.js';
|
|
5
5
|
import { NumericInput } from '../components/input/numeric_input.js';
|
|
6
|
+
import { RadioGroup } from '../components/input/radio_group.js';
|
|
6
7
|
import { ResetButton } from '../components/input/reset_button.js';
|
|
7
8
|
import { Select } from '../components/input/select.js';
|
|
8
9
|
import { SubmitButton } from '../components/input/submit_button.js';
|
|
9
10
|
import { Switch } from '../components/input/switch.js';
|
|
10
11
|
import { Section } from '../components/layout/Section.js';
|
|
11
12
|
const { useFormContext, useFieldContext, formContext, fieldContext } = createFormHookContexts();
|
|
13
|
+
/*
|
|
14
|
+
* formComponents and fieldComponents components MUST have their types
|
|
15
|
+
* exported from the `../components/input/index.ts`
|
|
16
|
+
* or `../components/layout/index.ts` file.
|
|
17
|
+
*
|
|
18
|
+
* It is necessary for `withForm` usage.
|
|
19
|
+
*/
|
|
12
20
|
const { useAppForm, withForm, withFieldGroup } = createFormHook({
|
|
13
21
|
fieldContext,
|
|
14
22
|
formContext,
|
|
@@ -24,6 +32,7 @@ const { useAppForm, withForm, withFieldGroup } = createFormHook({
|
|
|
24
32
|
Select,
|
|
25
33
|
Switch,
|
|
26
34
|
ColorPicker,
|
|
35
|
+
RadioGroup,
|
|
27
36
|
},
|
|
28
37
|
});
|
|
29
38
|
export const useForm = useAppForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_ts_form.js","sourceRoot":"","sources":["../../../../src/components/form/context/use_ts_form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D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,+BAA+B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE1D,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,GAClE,sBAAsB,EAAE,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,cAAc,CAAC;IAC9D,YAAY;IACZ,WAAW;IACX,cAAc,EAAE;QACd,YAAY;QACZ,WAAW;QACX,OAAO;KACR;IACD,eAAe,EAAE;QACf,KAAK;QACL,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,MAAM;QACN,WAAW;QACX,UAAU;KACX;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-science",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.9.1",
|
|
4
4
|
"description": "React components to build scientific applications UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -57,80 +57,80 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
|
|
60
|
-
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.
|
|
60
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.5",
|
|
61
61
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
62
62
|
"@emotion/styled": "^11.14.1",
|
|
63
63
|
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
64
|
-
"@tanstack/react-form": "^1.
|
|
64
|
+
"@tanstack/react-form": "^1.28.3",
|
|
65
65
|
"@tanstack/react-table": "^8.21.3",
|
|
66
66
|
"@tanstack/react-virtual": "^3.13.18",
|
|
67
67
|
"@zakodium/pdnd-esm": "^1.0.2",
|
|
68
68
|
"d3-scale-chromatic": "^3.1.0",
|
|
69
69
|
"react-d3-utils": "^3.1.2",
|
|
70
|
-
"react-dropzone": "^
|
|
70
|
+
"react-dropzone": "^15.0.0",
|
|
71
71
|
"react-full-screen": "^1.1.1",
|
|
72
72
|
"react-icons": "^5.5.0",
|
|
73
73
|
"react-inspector": "^9.0.0",
|
|
74
74
|
"tinycolor2": "^1.6.0",
|
|
75
75
|
"ts-pattern": "^5.9.0",
|
|
76
|
-
"zod": "^4.3.
|
|
76
|
+
"zod": "^4.3.6"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@blueprintjs/core": "6.0.0",
|
|
80
80
|
"@blueprintjs/icons": "6.0.0",
|
|
81
81
|
"@blueprintjs/select": "6.0.0",
|
|
82
|
-
"@floating-ui/react": "^0.27.
|
|
83
|
-
"@playwright/experimental-ct-react": "
|
|
84
|
-
"@playwright/test": "
|
|
85
|
-
"@storybook/addon-docs": "^
|
|
86
|
-
"@storybook/react-vite": "^
|
|
87
|
-
"@tanstack/react-query": "^5.90.
|
|
82
|
+
"@floating-ui/react": "^0.27.17",
|
|
83
|
+
"@playwright/experimental-ct-react": "=1.57.0",
|
|
84
|
+
"@playwright/test": "=1.57.0",
|
|
85
|
+
"@storybook/addon-docs": "^10.2.8",
|
|
86
|
+
"@storybook/react-vite": "^10.2.8",
|
|
87
|
+
"@tanstack/react-query": "^5.90.21",
|
|
88
88
|
"@types/babel__core": "^7.20.5",
|
|
89
89
|
"@types/d3-scale-chromatic": "^3.1.0",
|
|
90
90
|
"@types/node": "^24.7.0",
|
|
91
91
|
"@types/react": "^18.3.12",
|
|
92
92
|
"@types/react-dom": "^18.3.1",
|
|
93
93
|
"@types/tinycolor2": "^1.4.6",
|
|
94
|
-
"@vitejs/plugin-react": "^5.1.
|
|
95
|
-
"@vitest/coverage-v8": "^4.0.
|
|
94
|
+
"@vitejs/plugin-react": "^5.1.4",
|
|
95
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
96
96
|
"@zakodium/tsconfig": "^1.0.2",
|
|
97
97
|
"biologic-converter": "^0.6.0",
|
|
98
98
|
"cheminfo-font": "^1.13.1",
|
|
99
|
-
"cheminfo-types": "^1.
|
|
99
|
+
"cheminfo-types": "^1.10.0",
|
|
100
100
|
"cross-env": "^10.1.0",
|
|
101
101
|
"eslint": "^9.39.2",
|
|
102
|
-
"eslint-config-zakodium": "^19.
|
|
103
|
-
"eslint-plugin-storybook": "^
|
|
102
|
+
"eslint-config-zakodium": "^19.1.0",
|
|
103
|
+
"eslint-plugin-storybook": "^10.2.8",
|
|
104
104
|
"fifo-logger": "^2.0.1",
|
|
105
105
|
"filelist-utils": "^1.11.3",
|
|
106
|
-
"immer": "^11.1.
|
|
106
|
+
"immer": "^11.1.4",
|
|
107
107
|
"jcampconverter": "^12.1.0",
|
|
108
108
|
"ml-gsd": "^13.1.1",
|
|
109
109
|
"ml-peak-shape-generator": "^4.2.0",
|
|
110
|
-
"ml-signal-processing": "^2.
|
|
111
|
-
"ml-spectra-processing": "^14.
|
|
110
|
+
"ml-signal-processing": "^2.2.0",
|
|
111
|
+
"ml-spectra-processing": "^14.19.0",
|
|
112
112
|
"ms-spectrum": "^3.9.2",
|
|
113
113
|
"netcdfjs": "^3.0.0",
|
|
114
114
|
"postcss-styled-syntax": "^0.7.1",
|
|
115
|
-
"prettier": "^3.
|
|
115
|
+
"prettier": "^3.8.1",
|
|
116
116
|
"react": "^18.3.1",
|
|
117
117
|
"react-dom": "^18.3.1",
|
|
118
|
-
"react-error-boundary": "^6.
|
|
118
|
+
"react-error-boundary": "^6.1.1",
|
|
119
119
|
"react-kbs": "^3.1.0",
|
|
120
|
-
"react-ocl": "^8.
|
|
120
|
+
"react-ocl": "^8.5.0",
|
|
121
121
|
"react-plot": "^3.1.2",
|
|
122
|
-
"rimraf": "^6.1.
|
|
122
|
+
"rimraf": "^6.1.3",
|
|
123
123
|
"spc-parser": "^1.0.0",
|
|
124
|
-
"storybook": "^
|
|
125
|
-
"stylelint": "^
|
|
126
|
-
"stylelint-config-standard": "^
|
|
124
|
+
"storybook": "^10.2.8",
|
|
125
|
+
"stylelint": "^17.3.0",
|
|
126
|
+
"stylelint-config-standard": "^40.0.0",
|
|
127
127
|
"typescript": "^5.9.3",
|
|
128
128
|
"vite": "^7.3.1",
|
|
129
|
-
"vitest": "^4.0.
|
|
129
|
+
"vitest": "^4.0.18",
|
|
130
130
|
"wdf-parser": "^0.3.0"
|
|
131
131
|
},
|
|
132
132
|
"volta": {
|
|
133
|
-
"node": "24.13.
|
|
133
|
+
"node": "24.13.1"
|
|
134
134
|
},
|
|
135
135
|
"overrides": {
|
|
136
136
|
"storybook": "$storybook"
|
|
@@ -2,6 +2,7 @@ export { type Checkbox as _Checkbox } from './checkbox.js';
|
|
|
2
2
|
export { type ColorPicker as _ColorPicker } from './color_picker.js';
|
|
3
3
|
export { type Input as _Input } from './input.js';
|
|
4
4
|
export { type NumericInput as _NumericInput } from './numeric_input.js';
|
|
5
|
+
export { type RadioGroup as _RadioGroup } from './radio_group.js';
|
|
5
6
|
export { type ResetButton as _ResetButton } from './reset_button.js';
|
|
6
7
|
export { type Select as _Select } from './select.js';
|
|
7
8
|
export { type SubmitButton as _SubmitButton } from './submit_button.js';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { RadioGroupProps as BPRadioGroupProps } from '@blueprintjs/core';
|
|
2
|
+
import { RadioGroup as BPRadioGroup } from '@blueprintjs/core';
|
|
3
|
+
import type { FormEvent } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useFieldContext } from '../../context/use_ts_form.ts';
|
|
6
|
+
import { useFormContext } from '../input_groups/form_context.ts';
|
|
7
|
+
import type { FormGroupInputProps } from '../input_groups/index.ts';
|
|
8
|
+
import { FormGroup } from '../input_groups/index.ts';
|
|
9
|
+
|
|
10
|
+
interface RadioGroupProps
|
|
11
|
+
extends
|
|
12
|
+
Omit<FormGroupInputProps, 'placeholder'>,
|
|
13
|
+
Omit<
|
|
14
|
+
BPRadioGroupProps,
|
|
15
|
+
| keyof FormGroupInputProps
|
|
16
|
+
| 'onChange'
|
|
17
|
+
| 'id'
|
|
18
|
+
| 'name'
|
|
19
|
+
| 'onBlur'
|
|
20
|
+
| 'selectedValue'
|
|
21
|
+
> {}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Default inline to true if the final layout (`layout ?? formLayout`) is 'inline'
|
|
25
|
+
* If you need to override this, set `inline={false}`.
|
|
26
|
+
*
|
|
27
|
+
* @param props
|
|
28
|
+
*/
|
|
29
|
+
export function RadioGroup(props: RadioGroupProps) {
|
|
30
|
+
const { label, required, helpText, layout, fullWidth, ...radioGroupProps } =
|
|
31
|
+
props;
|
|
32
|
+
|
|
33
|
+
const { layout: formLayout } = useFormContext();
|
|
34
|
+
const finalLayout = layout ?? formLayout;
|
|
35
|
+
const overridableRadioGroupProps: Pick<BPRadioGroupProps, 'inline'> =
|
|
36
|
+
finalLayout === 'inline' ? { inline: true } : {};
|
|
37
|
+
|
|
38
|
+
const field = useFieldContext<string>();
|
|
39
|
+
const error = field
|
|
40
|
+
.getMeta()
|
|
41
|
+
.errors.map((e) => e.message)
|
|
42
|
+
.at(0);
|
|
43
|
+
|
|
44
|
+
function onChange(event: FormEvent<HTMLInputElement>) {
|
|
45
|
+
return field.handleChange(event.currentTarget.value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<FormGroup
|
|
50
|
+
name={field.name}
|
|
51
|
+
label={label}
|
|
52
|
+
intent={error ? 'danger' : 'none'}
|
|
53
|
+
required={required}
|
|
54
|
+
error={error}
|
|
55
|
+
helpText={helpText}
|
|
56
|
+
layout={layout}
|
|
57
|
+
fullWidth={fullWidth}
|
|
58
|
+
>
|
|
59
|
+
<BPRadioGroup
|
|
60
|
+
{...overridableRadioGroupProps}
|
|
61
|
+
{...radioGroupProps}
|
|
62
|
+
id={field.name}
|
|
63
|
+
name={field.name}
|
|
64
|
+
onBlur={field.handleBlur}
|
|
65
|
+
selectedValue={field.state.value}
|
|
66
|
+
onChange={onChange}
|
|
67
|
+
/>
|
|
68
|
+
</FormGroup>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -4,6 +4,7 @@ import { Checkbox } from '../components/input/checkbox.js';
|
|
|
4
4
|
import { ColorPicker } from '../components/input/color_picker.tsx';
|
|
5
5
|
import { Input } from '../components/input/input.js';
|
|
6
6
|
import { NumericInput } from '../components/input/numeric_input.js';
|
|
7
|
+
import { RadioGroup } from '../components/input/radio_group.js';
|
|
7
8
|
import { ResetButton } from '../components/input/reset_button.js';
|
|
8
9
|
import { Select } from '../components/input/select.js';
|
|
9
10
|
import { SubmitButton } from '../components/input/submit_button.js';
|
|
@@ -13,6 +14,13 @@ import { Section } from '../components/layout/Section.js';
|
|
|
13
14
|
const { useFormContext, useFieldContext, formContext, fieldContext } =
|
|
14
15
|
createFormHookContexts();
|
|
15
16
|
|
|
17
|
+
/*
|
|
18
|
+
* formComponents and fieldComponents components MUST have their types
|
|
19
|
+
* exported from the `../components/input/index.ts`
|
|
20
|
+
* or `../components/layout/index.ts` file.
|
|
21
|
+
*
|
|
22
|
+
* It is necessary for `withForm` usage.
|
|
23
|
+
*/
|
|
16
24
|
const { useAppForm, withForm, withFieldGroup } = createFormHook({
|
|
17
25
|
fieldContext,
|
|
18
26
|
formContext,
|
|
@@ -28,6 +36,7 @@ const { useAppForm, withForm, withFieldGroup } = createFormHook({
|
|
|
28
36
|
Select,
|
|
29
37
|
Switch,
|
|
30
38
|
ColorPicker,
|
|
39
|
+
RadioGroup,
|
|
31
40
|
},
|
|
32
41
|
});
|
|
33
42
|
|
|
File without changes
|