react-science 19.5.1 → 19.6.0

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.
Files changed (59) hide show
  1. package/lib/components/color-picker/color-picker-dropdown/ColorPickerDropdown.d.ts +5 -2
  2. package/lib/components/color-picker/color-picker-dropdown/ColorPickerDropdown.d.ts.map +1 -1
  3. package/lib/components/color-picker/color-picker-dropdown/ColorPickerDropdown.js +2 -2
  4. package/lib/components/color-picker/color-picker-dropdown/ColorPickerDropdown.js.map +1 -1
  5. package/lib/components/form/components/field_groups/fieldset.d.ts +9 -0
  6. package/lib/components/form/components/field_groups/fieldset.d.ts.map +1 -0
  7. package/lib/components/form/components/field_groups/fieldset.js +11 -0
  8. package/lib/components/form/components/field_groups/fieldset.js.map +1 -0
  9. package/lib/components/form/components/field_groups/index.d.ts +7 -0
  10. package/lib/components/form/components/field_groups/index.d.ts.map +1 -0
  11. package/lib/components/form/components/field_groups/index.js +5 -0
  12. package/lib/components/form/components/field_groups/index.js.map +1 -0
  13. package/lib/components/form/components/field_groups/svg_line_style.d.ts +40 -0
  14. package/lib/components/form/components/field_groups/svg_line_style.d.ts.map +1 -0
  15. package/lib/components/form/components/field_groups/svg_line_style.js +42 -0
  16. package/lib/components/form/components/field_groups/svg_line_style.js.map +1 -0
  17. package/lib/components/form/components/field_groups/svg_line_style.schema.d.ts +13 -0
  18. package/lib/components/form/components/field_groups/svg_line_style.schema.d.ts.map +1 -0
  19. package/lib/components/form/components/field_groups/svg_line_style.schema.js +14 -0
  20. package/lib/components/form/components/field_groups/svg_line_style.schema.js.map +1 -0
  21. package/lib/components/form/components/field_groups/svg_text_style.d.ts +41 -0
  22. package/lib/components/form/components/field_groups/svg_text_style.d.ts.map +1 -0
  23. package/lib/components/form/components/field_groups/svg_text_style.js +62 -0
  24. package/lib/components/form/components/field_groups/svg_text_style.js.map +1 -0
  25. package/lib/components/form/components/field_groups/svg_text_style.schema.d.ts +14 -0
  26. package/lib/components/form/components/field_groups/svg_text_style.schema.d.ts.map +1 -0
  27. package/lib/components/form/components/field_groups/svg_text_style.schema.js +8 -0
  28. package/lib/components/form/components/field_groups/svg_text_style.schema.js.map +1 -0
  29. package/lib/components/form/components/input/color_picker.d.ts +2 -1
  30. package/lib/components/form/components/input/color_picker.d.ts.map +1 -1
  31. package/lib/components/form/components/input/color_picker.js +2 -1
  32. package/lib/components/form/components/input/color_picker.js.map +1 -1
  33. package/lib/components/form/components/input_groups/form_group.d.ts +1 -1
  34. package/lib/components/form/components/input_groups/form_group.d.ts.map +1 -1
  35. package/lib/components/form/context/use_ts_form.d.ts +38 -2
  36. package/lib/components/form/context/use_ts_form.d.ts.map +1 -1
  37. package/lib/components/form/context/use_ts_form.js +2 -2
  38. package/lib/components/form/context/use_ts_form.js.map +1 -1
  39. package/lib/components/index.d.ts +1 -0
  40. package/lib/components/index.d.ts.map +1 -1
  41. package/lib/components/index.js +1 -0
  42. package/lib/components/index.js.map +1 -1
  43. package/lib/components/svg/styled/svg_styled_types.d.ts +7 -1
  44. package/lib/components/svg/styled/svg_styled_types.d.ts.map +1 -1
  45. package/lib/components/svg/styled/svg_styled_types.js +6 -1
  46. package/lib/components/svg/styled/svg_styled_types.js.map +1 -1
  47. package/package.json +2 -2
  48. package/src/components/color-picker/color-picker-dropdown/ColorPickerDropdown.tsx +8 -3
  49. package/src/components/form/components/field_groups/fieldset.tsx +12 -0
  50. package/src/components/form/components/field_groups/index.ts +7 -0
  51. package/src/components/form/components/field_groups/svg_line_style.schema.ts +15 -0
  52. package/src/components/form/components/field_groups/svg_line_style.tsx +108 -0
  53. package/src/components/form/components/field_groups/svg_text_style.schema.ts +8 -0
  54. package/src/components/form/components/field_groups/svg_text_style.tsx +160 -0
  55. package/src/components/form/components/input/color_picker.tsx +12 -1
  56. package/src/components/form/components/input_groups/form_group.tsx +1 -1
  57. package/src/components/form/context/use_ts_form.ts +2 -2
  58. package/src/components/index.ts +1 -0
  59. package/src/components/svg/styled/svg_styled_types.ts +8 -4
@@ -1,8 +1,11 @@
1
1
  import type { PopoverProps } from '@blueprintjs/core';
2
2
  import type { ColorPickerProps } from '../react-color/ColorPicker.js';
3
- interface ColorPickerDropdownProps extends Pick<ColorPickerProps, 'color' | 'presetColors' | 'disableAlpha' | 'onChange' | 'onChangeComplete'> {
3
+ export interface ColorPickerDropdownProps extends Pick<ColorPickerProps, 'color' | 'presetColors' | 'disableAlpha' | 'onChange' | 'onChangeComplete'> {
4
4
  popoverProps?: Omit<PopoverProps, 'content'>;
5
+ /**
6
+ * To link with label
7
+ */
8
+ id?: string;
5
9
  }
6
10
  export declare function ColorPickerDropdown(props: ColorPickerDropdownProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
8
11
  //# sourceMappingURL=ColorPickerDropdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/color-picker-dropdown/ColorPickerDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAItE,UAAU,wBAAyB,SAAQ,IAAI,CAC7C,gBAAgB,EAChB,OAAO,GAAG,cAAc,GAAG,cAAc,GAAG,UAAU,GAAG,kBAAkB,CAC5E;IACC,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;CAC9C;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAmBlE"}
1
+ {"version":3,"file":"ColorPickerDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/color-picker-dropdown/ColorPickerDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAItE,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,gBAAgB,EAChB,OAAO,GAAG,cAAc,GAAG,cAAc,GAAG,UAAU,GAAG,kBAAkB,CAC5E;IACC,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAE7C;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAmBlE"}
@@ -18,8 +18,8 @@ const ColorPickerPreview = styled.div `
18
18
  border-radius: 0.125rem;
19
19
  `;
20
20
  export function ColorPickerDropdown(props) {
21
- const { color, popoverProps, ...otherProps } = props;
21
+ const { color, popoverProps, id, ...otherProps } = props;
22
22
  const { hex } = colorHelper.toState(color || 'white');
23
- return (_jsx(Popover, { targetProps: { style: { width: '100%' } }, content: _jsx(ColorPicker, { color: color, ...otherProps }), minimal: true, ...popoverProps, children: _jsx(ColorPickerRoot, { type: "button", children: _jsx(ColorPickerPreview, { children: _jsx(FixedColorPreview, { color: hex }) }) }) }));
23
+ return (_jsx(Popover, { targetProps: { style: { width: '100%' } }, content: _jsx(ColorPicker, { color: color, ...otherProps }), minimal: true, ...popoverProps, children: _jsx(ColorPickerRoot, { type: "button", id: id, children: _jsx(ColorPickerPreview, { children: _jsx(FixedColorPreview, { color: hex }) }) }) }));
24
24
  }
25
25
  //# sourceMappingURL=ColorPickerDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerDropdown.js","sourceRoot":"","sources":["../../../../src/components/color-picker/color-picker-dropdown/ColorPickerDropdown.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAS/D,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;CAOpC,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIpC,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAErD,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC;IAEtD,OAAO,CACL,KAAC,OAAO,IACN,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EACzC,OAAO,EAAE,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,KAAM,UAAU,GAAI,EACtD,OAAO,WACH,YAAY,YAEhB,KAAC,eAAe,IAAC,IAAI,EAAC,QAAQ,YAC5B,KAAC,kBAAkB,cACjB,KAAC,iBAAiB,IAAC,KAAK,EAAE,GAAG,GAAI,GACd,GACL,GACV,CACX,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"ColorPickerDropdown.js","sourceRoot":"","sources":["../../../../src/components/color-picker/color-picker-dropdown/ColorPickerDropdown.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAc/D,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;CAOpC,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIpC,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAEzD,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC;IAEtD,OAAO,CACL,KAAC,OAAO,IACN,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EACzC,OAAO,EAAE,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,KAAM,UAAU,GAAI,EACtD,OAAO,WACH,YAAY,YAEhB,KAAC,eAAe,IAAC,IAAI,EAAC,QAAQ,EAAC,EAAE,EAAE,EAAE,YACnC,KAAC,kBAAkB,cACjB,KAAC,iBAAiB,IAAC,KAAK,EAAE,GAAG,GAAI,GACd,GACL,GACV,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const Fieldset: import("@emotion/styled").StyledComponent<{
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
4
+ }, import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, {}>;
5
+ export declare const Legend: import("@emotion/styled").StyledComponent<{
6
+ theme?: import("@emotion/react").Theme;
7
+ as?: React.ElementType;
8
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, {}>;
9
+ //# sourceMappingURL=fieldset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldset.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/fieldset.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;2HAIpB,CAAC;AAEF,eAAO,MAAM,MAAM;;;+GAGlB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import styled from '@emotion/styled';
2
+ export const Fieldset = styled.fieldset `
3
+ display: block;
4
+ border-top: 1px lightgrey groove;
5
+ min-inline-size: min-content;
6
+ `;
7
+ export const Legend = styled.legend `
8
+ display: block;
9
+ padding-inline-end: 5px;
10
+ `;
11
+ //# sourceMappingURL=fieldset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldset.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/fieldset.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;;;;CAItC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;;;CAGlC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { FieldGroupSVGTextStyleFields } from './svg_text_style.js';
2
+ export type { SVGTextStyleFieldsProps } from './svg_text_style.js';
3
+ export { svgTextStyleFieldsSchema } from './svg_text_style.schema.js';
4
+ export { FieldGroupSVGLineStyleFields } from './svg_line_style.js';
5
+ export type { SVGLineStyleFieldsProps } from './svg_line_style.js';
6
+ export { svgLineStyleFieldsSchema } from './svg_line_style.schema.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { FieldGroupSVGTextStyleFields } from './svg_text_style.js';
2
+ export { svgTextStyleFieldsSchema } from './svg_text_style.schema.js';
3
+ export { FieldGroupSVGLineStyleFields } from './svg_line_style.js';
4
+ export { svgLineStyleFieldsSchema } from './svg_line_style.schema.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,40 @@
1
+ export interface SVGLineStyleFieldsProps {
2
+ label: string;
3
+ }
4
+ export declare const FieldGroupSVGLineStyleFields: <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, {
5
+ stroke: string;
6
+ strokeOpacity: string;
7
+ strokeWidth: string;
8
+ strokeDasharray: "solid" | "dashed" | "dotted" | "dashed-dot";
9
+ } | null | undefined> | {
10
+ stroke: import("@tanstack/form-core").DeepKeysOfType<TFormData, string>;
11
+ strokeOpacity: import("@tanstack/form-core").DeepKeysOfType<TFormData, string>;
12
+ strokeWidth: import("@tanstack/form-core").DeepKeysOfType<TFormData, string>;
13
+ strokeDasharray: import("@tanstack/form-core").DeepKeysOfType<TFormData, "solid" | "dashed" | "dotted" | "dashed-dot">;
14
+ }, TOnMount extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<SVGLineStyleFieldsProps> & {
15
+ form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TFormSubmitMeta, {
16
+ readonly Input: typeof import("../input/input.tsx").Input;
17
+ readonly NumericInput: typeof import("../input/numeric_input.tsx").NumericInput;
18
+ readonly Checkbox: typeof import("../input/checkbox.tsx").Checkbox;
19
+ readonly Select: typeof import("../input/select.tsx").Select;
20
+ readonly Switch: typeof import("../input/switch.tsx").Switch;
21
+ readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
22
+ }, {
23
+ readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
24
+ readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
25
+ readonly Section: typeof import("../layout/Section.tsx").Section;
26
+ }> | import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/form-core").FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, TFormSubmitMeta, {
27
+ readonly Input: typeof import("../input/input.tsx").Input;
28
+ readonly NumericInput: typeof import("../input/numeric_input.tsx").NumericInput;
29
+ readonly Checkbox: typeof import("../input/checkbox.tsx").Checkbox;
30
+ readonly Select: typeof import("../input/select.tsx").Select;
31
+ readonly Switch: typeof import("../input/switch.tsx").Switch;
32
+ readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
33
+ }, {
34
+ readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
35
+ readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
36
+ readonly Section: typeof import("../layout/Section.tsx").Section;
37
+ }>;
38
+ fields: TFields;
39
+ }>) => ReturnType<import("react").FunctionComponent>;
40
+ //# sourceMappingURL=svg_line_style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_line_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":"AA4BA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAqCvC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from '@emotion/styled';
3
+ import { memo } from 'react';
4
+ import { SVGStyledLine } from '../../../svg/index.js';
5
+ import { withFieldGroup } from '../../context/use_ts_form.js';
6
+ import { FormGroup } from '../input_groups/form_group.js';
7
+ import { Fieldset, Legend } from './fieldset.js';
8
+ import { svgLineStyleFieldsSchema } from './svg_line_style.schema.js';
9
+ // https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
10
+ // Default values are not used at runtime (same for props).
11
+ const defaultValues = {
12
+ stroke: '#000000',
13
+ strokeOpacity: '1',
14
+ strokeWidth: '1',
15
+ strokeDasharray: 'solid',
16
+ };
17
+ const inferSVGLineStyleFieldsProps = {
18
+ label: '',
19
+ };
20
+ const patternsOptions = [
21
+ { label: 'Solid', value: 'solid' },
22
+ { label: 'Dotted', value: 'dotted' },
23
+ { label: 'Dashed', value: 'dashed' },
24
+ { label: 'Dashed Dot', value: 'dashed-dot' },
25
+ ];
26
+ export const FieldGroupSVGLineStyleFields = withFieldGroup({
27
+ defaultValues,
28
+ props: inferSVGLineStyleFieldsProps,
29
+ render({ group, label }) {
30
+ return (_jsxs(Fieldset, { children: [_jsx(Legend, { children: label }), _jsx(group.AppField, { name: "stroke", children: (field) => _jsx(field.ColorPicker, { label: "Color", disableAlpha: true }) }), _jsx(group.AppField, { name: "strokeOpacity", children: (field) => (_jsx(field.NumericInput, { label: "Opacity", min: 0, max: 1, minorStepSize: 0.01, step: 0.05, majorStepSize: 0.1 })) }), _jsx(group.AppField, { name: "strokeWidth", children: (field) => _jsx(field.NumericInput, { label: "Width" }) }), _jsx(group.AppField, { name: "strokeDasharray", children: (field) => _jsx(field.Select, { label: "Style", items: patternsOptions }) }), _jsx(FormGroup, { label: "Preview", children: _jsx(group.Subscribe, { selector: (state) => state.values, children: (values) => _jsx(LineStyleFieldPreview, { ...values }) }) })] }));
31
+ },
32
+ });
33
+ const LineStyleFieldPreviewContainer = styled.div `
34
+ display: flex;
35
+ align-items: center;
36
+ min-height: 30px;
37
+ `;
38
+ const LineStyleFieldPreview = memo(function TextStyleFieldPreview(props) {
39
+ const parsedValues = svgLineStyleFieldsSchema.parse(props);
40
+ return (_jsx(LineStyleFieldPreviewContainer, { children: _jsx("svg", { viewBox: "0 0 180 30", children: _jsx(SVGStyledLine, { x1: 0, x2: 180, y1: 15, y2: 15, ...parsedValues, opacity: 1 }) }) }));
41
+ });
42
+ //# sourceMappingURL=svg_line_style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_line_style.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,C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AAK,EAAE,EAAE,CAAC,KAAC,KAAK,CAAC,YAAY,IAAC,KAAK,EAAC,OAAO,GAAG,GACjC,EACjB,KAAC,KAAK,CAAC,QAAQ,IAAC,IAAI,EAAC,iBAAiB,YACnC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,KAAK,CAAC,MAAM,IAAC,KAAK,EAAC,OAAO,EAAC,KAAK,EAAE,eAAe,GAAI,GACnD,EAEjB,KAAC,SAAS,IAAC,KAAK,EAAC,SAAS,YACxB,KAAC,KAAK,CAAC,SAAS,IAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,YAC/C,CAAC,MAAM,EAAE,EAAE,CAAC,KAAC,qBAAqB,OAAK,MAAM,GAAI,GAClC,GACR,IACH,CACZ,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIhD,CAAC;AAEF,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,qBAAqB,CAC/D,KAAyB;IAEzB,MAAM,YAAY,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE3D,OAAO,CACL,KAAC,8BAA8B,cAC7B,cAAK,OAAO,EAAC,YAAY,YACvB,KAAC,aAAa,IACZ,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,GAAG,EACP,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,KACF,YAAY,EAChB,OAAO,EAAE,CAAC,GACV,GACE,GACyB,CAClC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export declare const svgLineStyleFieldsSchema: z.ZodObject<{
3
+ stroke: z.ZodString;
4
+ strokeOpacity: z.ZodCoercedNumber<string>;
5
+ strokeWidth: z.ZodCoercedNumber<string>;
6
+ strokeDasharray: z.ZodEnum<{
7
+ readonly solid: "solid";
8
+ readonly dashed: "dashed";
9
+ readonly dotted: "dotted";
10
+ readonly 'dashed-dot': "dashed-dot";
11
+ }>;
12
+ }, z.core.$strip>;
13
+ //# sourceMappingURL=svg_line_style.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_line_style.schema.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAUnC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { SVGStyledLineStrokePattern } from '../../../svg/index.js';
3
+ export const svgLineStyleFieldsSchema = z.object({
4
+ stroke: z
5
+ .string()
6
+ .trim()
7
+ .regex(/^#[0-9a-fA-F]{6}$/, {
8
+ message: 'Color must be hexadecimal and should not contain alpha',
9
+ }),
10
+ strokeOpacity: z.coerce.number().min(0).max(1),
11
+ strokeWidth: z.coerce.number(),
12
+ strokeDasharray: z.enum(SVGStyledLineStrokePattern),
13
+ });
14
+ //# sourceMappingURL=svg_line_style.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_line_style.schema.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,IAAI,EAAE;SACN,KAAK,CAAC,mBAAmB,EAAE;QAC1B,OAAO,EAAE,wDAAwD;KAClE,CAAC;IACJ,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAU;IACtC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC;CACpD,CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ export interface SVGTextStyleFieldsProps {
2
+ label: string;
3
+ previewText?: string;
4
+ }
5
+ export declare const FieldGroupSVGTextStyleFields: <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, {
6
+ fill: string;
7
+ fontSize: string;
8
+ fontStyle: "italic" | "normal";
9
+ fontWeight: "bold" | "normal";
10
+ } | null | undefined> | {
11
+ fill: import("@tanstack/form-core").DeepKeysOfType<TFormData, string>;
12
+ fontSize: import("@tanstack/form-core").DeepKeysOfType<TFormData, string>;
13
+ fontStyle: import("@tanstack/form-core").DeepKeysOfType<TFormData, "italic" | "normal">;
14
+ fontWeight: import("@tanstack/form-core").DeepKeysOfType<TFormData, "bold" | "normal">;
15
+ }, TOnMount extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData> | undefined, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<SVGTextStyleFieldsProps> & {
16
+ form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TFormSubmitMeta, {
17
+ readonly Input: typeof import("../input/input.tsx").Input;
18
+ readonly NumericInput: typeof import("../input/numeric_input.tsx").NumericInput;
19
+ readonly Checkbox: typeof import("../input/checkbox.tsx").Checkbox;
20
+ readonly Select: typeof import("../input/select.tsx").Select;
21
+ readonly Switch: typeof import("../input/switch.tsx").Switch;
22
+ readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
23
+ }, {
24
+ readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
25
+ readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
26
+ readonly Section: typeof import("../layout/Section.tsx").Section;
27
+ }> | import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/form-core").FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, TFormSubmitMeta, {
28
+ readonly Input: typeof import("../input/input.tsx").Input;
29
+ readonly NumericInput: typeof import("../input/numeric_input.tsx").NumericInput;
30
+ readonly Checkbox: typeof import("../input/checkbox.tsx").Checkbox;
31
+ readonly Select: typeof import("../input/select.tsx").Select;
32
+ readonly Switch: typeof import("../input/switch.tsx").Switch;
33
+ readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
34
+ }, {
35
+ readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
36
+ readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
37
+ readonly Section: typeof import("../layout/Section.tsx").Section;
38
+ }>;
39
+ fields: TFields;
40
+ }>) => ReturnType<import("react").FunctionComponent>;
41
+ //# sourceMappingURL=svg_text_style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_text_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":"AA8BA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDA4DvC,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Checkbox } from '@blueprintjs/core';
3
+ import styled from '@emotion/styled';
4
+ import { memo } from 'react';
5
+ import { SVGStyledText } from '../../../svg/index.js';
6
+ import { withFieldGroup } from '../../context/use_ts_form.js';
7
+ import { FormGroup } from '../input_groups/form_group.js';
8
+ import { Fieldset, Legend } from './fieldset.js';
9
+ import { svgTextStyleFieldsSchema } from './svg_text_style.schema.js';
10
+ const TextStyleSwitchContainer = styled.div `
11
+ display: flex;
12
+ flex-direction: row;
13
+ gap: 1rem;
14
+ `;
15
+ // https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
16
+ // Default values are not used at runtime (same for props).
17
+ const defaultValues = {
18
+ fill: '#000000',
19
+ fontSize: '16',
20
+ fontStyle: 'normal',
21
+ fontWeight: 'normal',
22
+ };
23
+ const inferSVGTextStyleFieldsProps = {
24
+ label: '',
25
+ };
26
+ export const FieldGroupSVGTextStyleFields = withFieldGroup({
27
+ defaultValues,
28
+ props: inferSVGTextStyleFieldsProps,
29
+ render: function SVGTextStyleFields({ group, label, previewText = 'Placeholder', }) {
30
+ return (_jsxs(Fieldset, { children: [_jsx(Legend, { children: label }), _jsx(group.AppField, { name: "fill", children: (field) => _jsx(field.ColorPicker, { label: "Color" }) }), _jsx(group.AppField, { name: "fontSize", children: (field) => _jsx(field.NumericInput, { label: "Font size" }) }), _jsx(FormGroup, { label: "Font style", children: _jsxs(TextStyleSwitchContainer, { children: [_jsx(group.Field, { name: "fontWeight", children: (field) => (_jsx(Checkbox, { labelElement: _jsx(BoldLabel, { children: "Bold" }), name: field.name, checked: fontWeightToBoolean(field.state.value), onChange: (e) => field.handleChange(booleanToFontWeight(e.target.checked)), onBlur: field.handleBlur })) }), _jsx(group.Field, { name: "fontStyle", children: (field) => (_jsx(Checkbox, { labelElement: _jsx(ItalicLabel, { children: "Italic" }), name: field.name, checked: fontStyleToBoolean(field.state.value), onChange: (e) => field.handleChange(booleanToFontStyle(e.target.checked)), onBlur: field.handleBlur })) })] }) }), _jsx(FormGroup, { label: "Preview", children: _jsx(group.Subscribe, { selector: (state) => state.values, children: (values) => (_jsx(TextStyleFieldPreview, { ...values, children: previewText })) }) })] }));
31
+ },
32
+ });
33
+ const TextStyleFieldPreviewContainer = styled.div `
34
+ display: flex;
35
+ align-items: center;
36
+ min-height: 30px;
37
+ `;
38
+ const TextStyleFieldPreview = memo(function TextStyleFieldPreview(props) {
39
+ const parsedValues = svgTextStyleFieldsSchema.parse(props);
40
+ const svgHeight = Math.round(parsedValues.fontSize * 1.5);
41
+ const textY = Math.round(svgHeight / 4);
42
+ return (_jsx(TextStyleFieldPreviewContainer, { children: _jsx("svg", { height: svgHeight, width: "auto", children: _jsx(SVGStyledText, { dominantBaseline: "hanging", x: 0, y: textY, ...parsedValues, children: props.children }) }) }));
43
+ });
44
+ const BoldLabel = styled.span `
45
+ font-weight: bold;
46
+ `;
47
+ const ItalicLabel = styled.span `
48
+ font-style: italic;
49
+ `;
50
+ function fontWeightToBoolean(weight) {
51
+ return weight === 'bold';
52
+ }
53
+ function booleanToFontWeight(weight) {
54
+ return weight ? 'bold' : 'normal';
55
+ }
56
+ function fontStyleToBoolean(weight) {
57
+ return weight === 'italic';
58
+ }
59
+ function booleanToFontStyle(weight) {
60
+ return weight ? 'italic' : 'normal';
61
+ }
62
+ //# sourceMappingURL=svg_text_style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_text_style.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C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odString;
4
+ fontSize: z.ZodCoercedNumber<string>;
5
+ fontStyle: z.ZodEnum<{
6
+ italic: "italic";
7
+ normal: "normal";
8
+ }>;
9
+ fontWeight: z.ZodEnum<{
10
+ bold: "bold";
11
+ normal: "normal";
12
+ }>;
13
+ }, z.core.$strip>;
14
+ //# sourceMappingURL=svg_text_style.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_text_style.schema.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB;;;;;;;;;;;iBAKnC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export const svgTextStyleFieldsSchema = z.object({
3
+ fill: z.string(),
4
+ fontSize: z.coerce.number(),
5
+ fontStyle: z.enum(['normal', 'italic']),
6
+ fontWeight: z.enum(['normal', 'bold']),
7
+ });
8
+ //# sourceMappingURL=svg_text_style.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg_text_style.schema.js","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAU;IACnC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
+ import type { ColorPickerDropdownProps } from '../../../color-picker/index.js';
1
2
  import type { FormGroupInputProps } from '../input_groups/form_group.js';
2
- type ColorPickerProps = Omit<FormGroupInputProps, 'placeholder'>;
3
+ type ColorPickerProps = Omit<FormGroupInputProps, 'placeholder'> & Pick<ColorPickerDropdownProps, 'presetColors' | 'disableAlpha' | 'popoverProps'>;
3
4
  export declare function ColorPicker(props: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
4
5
  export {};
5
6
  //# sourceMappingURL=color_picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"color_picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/color_picker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,KAAK,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;AAEjE,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA6BlD"}
1
+ {"version":3,"file":"color_picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/color_picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAI/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,KAAK,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,GAC9D,IAAI,CACF,wBAAwB,EACxB,cAAc,GAAG,cAAc,GAAG,cAAc,CACjD,CAAC;AAEJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAmClD"}
@@ -4,6 +4,7 @@ import { useFieldContext } from '../../context/use_ts_form.js';
4
4
  import { FormGroup } from '../input_groups/form_group.js';
5
5
  export function ColorPicker(props) {
6
6
  const { label, helpText, layout, fullWidth, required } = props;
7
+ const { presetColors, disableAlpha, popoverProps } = props;
7
8
  const field = useFieldContext();
8
9
  const error = field
9
10
  .getMeta()
@@ -12,6 +13,6 @@ export function ColorPicker(props) {
12
13
  function onChange(color) {
13
14
  field.setValue(color.hex);
14
15
  }
15
- return (_jsx(FormGroup, { name: field.name, label: label, helpText: helpText, error: error, layout: layout, fullWidth: fullWidth, required: required, intent: error ? 'danger' : 'none', children: _jsx(ColorPickerDropdown, { color: { hex: field.state.value }, onChange: onChange }) }));
16
+ return (_jsx(FormGroup, { name: field.name, label: label, helpText: helpText, error: error, layout: layout, fullWidth: fullWidth, required: required, intent: error ? 'danger' : 'none', children: _jsx(ColorPickerDropdown, { id: field.name, color: { hex: field.state.value }, onChange: onChange, presetColors: presetColors, disableAlpha: disableAlpha, popoverProps: popoverProps }) }));
16
17
  }
17
18
  //# sourceMappingURL=color_picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color_picker.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/color_picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI1D,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC/D,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,KAAmC;QACnD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,YAEjC,KAAC,mBAAmB,IAClB,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,EACjC,QAAQ,EAAE,QAAQ,GAClB,GACQ,CACb,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"color_picker.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/color_picker.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAQ1D,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE3D,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,KAAmC;QACnD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,YAEjC,KAAC,mBAAmB,IAClB,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,EACjC,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,GAC1B,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -12,7 +12,7 @@ export interface FormGroupInputProps {
12
12
  interface FormGroupProps {
13
13
  label?: string;
14
14
  intent?: Intent;
15
- name: string;
15
+ name?: string;
16
16
  required?: boolean;
17
17
  helpText?: string;
18
18
  children?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"form_group.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/form_group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA+DhD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkD9C"}
1
+ {"version":3,"file":"form_group.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/form_group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA+DhD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkD9C"}
@@ -32,7 +32,43 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
32
32
  readonly ResetButton: typeof ResetButton;
33
33
  readonly Section: typeof Section;
34
34
  }>;
35
- }>>;
35
+ }>>, withFieldGroup: <TFieldGroupData, TSubmitMeta, TRenderProps extends object = {}>({ render, props, defaultValues, }: import("@tanstack/react-form").WithFieldGroupProps<TFieldGroupData, {
36
+ readonly Input: typeof Input;
37
+ readonly NumericInput: typeof NumericInput;
38
+ readonly Checkbox: typeof Checkbox;
39
+ readonly Select: typeof Select;
40
+ readonly Switch: typeof Switch;
41
+ readonly ColorPicker: typeof ColorPicker;
42
+ }, {
43
+ readonly SubmitButton: typeof SubmitButton;
44
+ readonly ResetButton: typeof ResetButton;
45
+ readonly Section: typeof Section;
46
+ }, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/react-form").DeepKeysOfType<TFormData, TFieldGroupData | null | undefined> | import("@tanstack/react-form").FieldsMap<TFormData, TFieldGroupData>, TOnMount extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<TRenderProps> & {
47
+ form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, {
48
+ readonly Input: typeof Input;
49
+ readonly NumericInput: typeof NumericInput;
50
+ readonly Checkbox: typeof Checkbox;
51
+ readonly Select: typeof Select;
52
+ readonly Switch: typeof Switch;
53
+ readonly ColorPicker: typeof ColorPicker;
54
+ }, {
55
+ readonly SubmitButton: typeof SubmitButton;
56
+ readonly ResetButton: typeof ResetButton;
57
+ readonly Section: typeof Section;
58
+ }> | import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/react-form").FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, {
59
+ readonly Input: typeof Input;
60
+ readonly NumericInput: typeof NumericInput;
61
+ readonly Checkbox: typeof Checkbox;
62
+ readonly Select: typeof Select;
63
+ readonly Switch: typeof Switch;
64
+ readonly ColorPicker: typeof ColorPicker;
65
+ }, {
66
+ readonly SubmitButton: typeof SubmitButton;
67
+ readonly ResetButton: typeof ResetButton;
68
+ readonly Section: typeof Section;
69
+ }>;
70
+ fields: TFields;
71
+ }>) => ReturnType<import("react").FunctionComponent>;
36
72
  export declare const useForm: <TFormData, TOnMount extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta>(props: import("@tanstack/react-form").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
37
73
  readonly Input: typeof Input;
38
74
  readonly NumericInput: typeof NumericInput;
@@ -45,5 +81,5 @@ export declare const useForm: <TFormData, TOnMount extends import("@tanstack/rea
45
81
  readonly ResetButton: typeof ResetButton;
46
82
  readonly Section: typeof Section;
47
83
  }>;
48
- export { useFieldContext, useFormContext, withForm };
84
+ export { useFieldContext, useFormContext, withFieldGroup, withForm };
49
85
  //# sourceMappingURL=use_ts_form.d.ts.map
@@ -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,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,+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,QAAA,MAAQ,cAAc,2IAAE,eAAe,8KACb,CAAC;AAE3B,QAAA,MAAoB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;GAgB1B,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;EAAa,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
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,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,+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,QAAA,MAAQ,cAAc,2IAAE,eAAe,8KACb,CAAC;AAE3B,QAAA,MAAoB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;KAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAgB1C,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;EAAa,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
@@ -9,7 +9,7 @@ import { SubmitButton } from '../components/input/submit_button.js';
9
9
  import { Switch } from '../components/input/switch.js';
10
10
  import { Section } from '../components/layout/Section.js';
11
11
  const { useFormContext, useFieldContext, formContext, fieldContext } = createFormHookContexts();
12
- const { useAppForm, withForm } = createFormHook({
12
+ const { useAppForm, withForm, withFieldGroup } = createFormHook({
13
13
  fieldContext,
14
14
  formContext,
15
15
  formComponents: {
@@ -27,5 +27,5 @@ const { useAppForm, withForm } = createFormHook({
27
27
  },
28
28
  });
29
29
  export const useForm = useAppForm;
30
- export { useFieldContext, useFormContext, withForm };
30
+ export { useFieldContext, useFormContext, withFieldGroup, withForm };
31
31
  //# sourceMappingURL=use_ts_form.js.map
@@ -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,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAsC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,+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,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;IAC9C,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,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AAC"}
@@ -15,6 +15,7 @@ export * from './split_pane/index.js';
15
15
  export * from './table/index.js';
16
16
  export * from './toolbar/index.js';
17
17
  export * from './form/context/use_ts_form.js';
18
+ export * from './form/components/field_groups/index.js';
18
19
  export * from './activity_bar/index.js';
19
20
  export * from './activity_panel/index.js';
20
21
  export * from './utils/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
@@ -15,6 +15,7 @@ export * from './split_pane/index.js';
15
15
  export * from './table/index.js';
16
16
  export * from './toolbar/index.js';
17
17
  export * from './form/context/use_ts_form.js';
18
+ export * from './form/components/field_groups/index.js';
18
19
  export * from './activity_bar/index.js';
19
20
  export * from './activity_panel/index.js';
20
21
  export * from './utils/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
@@ -1,4 +1,10 @@
1
- export type SVGStyledLineStrokePattern = 'solid' | 'dashed' | 'dotted' | 'dashed-dot';
1
+ export declare const SVGStyledLineStrokePattern: {
2
+ readonly solid: "solid";
3
+ readonly dashed: "dashed";
4
+ readonly dotted: "dotted";
5
+ readonly 'dashed-dot': "dashed-dot";
6
+ };
7
+ export type SVGStyledLineStrokePattern = (typeof SVGStyledLineStrokePattern)[keyof typeof SVGStyledLineStrokePattern];
2
8
  /**
3
9
  * SVG line styles that can be controlled by the user.
4
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"svg_styled_types.d.ts","sourceRoot":"","sources":["../../../../src/components/svg/styled/svg_styled_types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAClC,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,eAAe,CAAC,EAAE,0BAA0B,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAE/B;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACjC"}
1
+ {"version":3,"file":"svg_styled_types.d.ts","sourceRoot":"","sources":["../../../../src/components/svg/styled/svg_styled_types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B;;;;;CAK7B,CAAC;AAEX,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,eAAe,CAAC,EAAE,0BAA0B,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAE/B;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACjC"}
@@ -1,2 +1,7 @@
1
- export {};
1
+ export const SVGStyledLineStrokePattern = {
2
+ solid: 'solid',
3
+ dashed: 'dashed',
4
+ dotted: 'dotted',
5
+ 'dashed-dot': 'dashed-dot',
6
+ };
2
7
  //# sourceMappingURL=svg_styled_types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"svg_styled_types.js","sourceRoot":"","sources":["../../../../src/components/svg/styled/svg_styled_types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"svg_styled_types.js","sourceRoot":"","sources":["../../../../src/components/svg/styled/svg_styled_types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,YAAY;CAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-science",
3
- "version": "19.5.1",
3
+ "version": "19.6.0",
4
4
  "description": "React components to build scientific applications UI",
5
5
  "type": "module",
6
6
  "exports": {
@@ -130,7 +130,7 @@
130
130
  "wdf-parser": "^0.3.0"
131
131
  },
132
132
  "volta": {
133
- "node": "24.12.0"
133
+ "node": "24.13.0"
134
134
  },
135
135
  "overrides": {
136
136
  "storybook": "$storybook"
@@ -7,11 +7,16 @@ import type { ColorPickerProps } from '../react-color/ColorPicker.js';
7
7
  import { ColorPicker } from '../react-color/ColorPicker.js';
8
8
  import * as colorHelper from '../react-color/helpers/color.js';
9
9
 
10
- interface ColorPickerDropdownProps extends Pick<
10
+ export interface ColorPickerDropdownProps extends Pick<
11
11
  ColorPickerProps,
12
12
  'color' | 'presetColors' | 'disableAlpha' | 'onChange' | 'onChangeComplete'
13
13
  > {
14
14
  popoverProps?: Omit<PopoverProps, 'content'>;
15
+
16
+ /**
17
+ * To link with label
18
+ */
19
+ id?: string;
15
20
  }
16
21
 
17
22
  const ColorPickerRoot = styled.button`
@@ -30,7 +35,7 @@ const ColorPickerPreview = styled.div`
30
35
  `;
31
36
 
32
37
  export function ColorPickerDropdown(props: ColorPickerDropdownProps) {
33
- const { color, popoverProps, ...otherProps } = props;
38
+ const { color, popoverProps, id, ...otherProps } = props;
34
39
 
35
40
  const { hex } = colorHelper.toState(color || 'white');
36
41
 
@@ -41,7 +46,7 @@ export function ColorPickerDropdown(props: ColorPickerDropdownProps) {
41
46
  minimal
42
47
  {...popoverProps}
43
48
  >
44
- <ColorPickerRoot type="button">
49
+ <ColorPickerRoot type="button" id={id}>
45
50
  <ColorPickerPreview>
46
51
  <FixedColorPreview color={hex} />
47
52
  </ColorPickerPreview>
@@ -0,0 +1,12 @@
1
+ import styled from '@emotion/styled';
2
+
3
+ export const Fieldset = styled.fieldset`
4
+ display: block;
5
+ border-top: 1px lightgrey groove;
6
+ min-inline-size: min-content;
7
+ `;
8
+
9
+ export const Legend = styled.legend`
10
+ display: block;
11
+ padding-inline-end: 5px;
12
+ `;
@@ -0,0 +1,7 @@
1
+ export { FieldGroupSVGTextStyleFields } from './svg_text_style.js';
2
+ export type { SVGTextStyleFieldsProps } from './svg_text_style.js';
3
+ export { svgTextStyleFieldsSchema } from './svg_text_style.schema.js';
4
+
5
+ export { FieldGroupSVGLineStyleFields } from './svg_line_style.js';
6
+ export type { SVGLineStyleFieldsProps } from './svg_line_style.js';
7
+ export { svgLineStyleFieldsSchema } from './svg_line_style.schema.js';
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+
3
+ import { SVGStyledLineStrokePattern } from '../../../svg/index.js';
4
+
5
+ export const svgLineStyleFieldsSchema = z.object({
6
+ stroke: z
7
+ .string()
8
+ .trim()
9
+ .regex(/^#[0-9a-fA-F]{6}$/, {
10
+ message: 'Color must be hexadecimal and should not contain alpha',
11
+ }),
12
+ strokeOpacity: z.coerce.number<string>().min(0).max(1),
13
+ strokeWidth: z.coerce.number<string>(),
14
+ strokeDasharray: z.enum(SVGStyledLineStrokePattern),
15
+ });
@@ -0,0 +1,108 @@
1
+ import styled from '@emotion/styled';
2
+ import { memo } from 'react';
3
+ import type { z } from 'zod';
4
+
5
+ import type { SVGStyledLineStrokePattern } from '../../../svg/index.js';
6
+ import { SVGStyledLine } from '../../../svg/index.js';
7
+ import { withFieldGroup } from '../../context/use_ts_form.js';
8
+ import { FormGroup } from '../input_groups/form_group.js';
9
+
10
+ import { Fieldset, Legend } from './fieldset.js';
11
+ import { svgLineStyleFieldsSchema } from './svg_line_style.schema.js';
12
+
13
+ type SvgLineStyleFields = z.input<typeof svgLineStyleFieldsSchema>;
14
+
15
+ // https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
16
+ // Default values are not used at runtime (same for props).
17
+ const defaultValues: SvgLineStyleFields = {
18
+ stroke: '#000000',
19
+ strokeOpacity: '1',
20
+ strokeWidth: '1',
21
+ strokeDasharray: 'solid',
22
+ };
23
+
24
+ interface PatternsOptionType {
25
+ label: string;
26
+ value: SVGStyledLineStrokePattern;
27
+ }
28
+
29
+ export interface SVGLineStyleFieldsProps {
30
+ label: string;
31
+ }
32
+
33
+ const inferSVGLineStyleFieldsProps: SVGLineStyleFieldsProps = {
34
+ label: '',
35
+ };
36
+
37
+ const patternsOptions: PatternsOptionType[] = [
38
+ { label: 'Solid', value: 'solid' },
39
+ { label: 'Dotted', value: 'dotted' },
40
+ { label: 'Dashed', value: 'dashed' },
41
+ { label: 'Dashed Dot', value: 'dashed-dot' },
42
+ ];
43
+
44
+ export const FieldGroupSVGLineStyleFields = withFieldGroup({
45
+ defaultValues,
46
+ props: inferSVGLineStyleFieldsProps,
47
+ render({ group, label }) {
48
+ return (
49
+ <Fieldset>
50
+ <Legend>{label}</Legend>
51
+ <group.AppField name="stroke">
52
+ {(field) => <field.ColorPicker label="Color" disableAlpha />}
53
+ </group.AppField>
54
+ <group.AppField name="strokeOpacity">
55
+ {(field) => (
56
+ <field.NumericInput
57
+ label="Opacity"
58
+ min={0}
59
+ max={1}
60
+ minorStepSize={0.01}
61
+ step={0.05}
62
+ majorStepSize={0.1}
63
+ />
64
+ )}
65
+ </group.AppField>
66
+ <group.AppField name="strokeWidth">
67
+ {(field) => <field.NumericInput label="Width" />}
68
+ </group.AppField>
69
+ <group.AppField name="strokeDasharray">
70
+ {(field) => <field.Select label="Style" items={patternsOptions} />}
71
+ </group.AppField>
72
+
73
+ <FormGroup label="Preview">
74
+ <group.Subscribe selector={(state) => state.values}>
75
+ {(values) => <LineStyleFieldPreview {...values} />}
76
+ </group.Subscribe>
77
+ </FormGroup>
78
+ </Fieldset>
79
+ );
80
+ },
81
+ });
82
+
83
+ const LineStyleFieldPreviewContainer = styled.div`
84
+ display: flex;
85
+ align-items: center;
86
+ min-height: 30px;
87
+ `;
88
+
89
+ const LineStyleFieldPreview = memo(function TextStyleFieldPreview(
90
+ props: SvgLineStyleFields,
91
+ ) {
92
+ const parsedValues = svgLineStyleFieldsSchema.parse(props);
93
+
94
+ return (
95
+ <LineStyleFieldPreviewContainer>
96
+ <svg viewBox="0 0 180 30">
97
+ <SVGStyledLine
98
+ x1={0}
99
+ x2={180}
100
+ y1={15}
101
+ y2={15}
102
+ {...parsedValues}
103
+ opacity={1}
104
+ />
105
+ </svg>
106
+ </LineStyleFieldPreviewContainer>
107
+ );
108
+ });
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+
3
+ export const svgTextStyleFieldsSchema = z.object({
4
+ fill: z.string(),
5
+ fontSize: z.coerce.number<string>(),
6
+ fontStyle: z.enum(['normal', 'italic']),
7
+ fontWeight: z.enum(['normal', 'bold']),
8
+ });
@@ -0,0 +1,160 @@
1
+ import { Checkbox } from '@blueprintjs/core';
2
+ import styled from '@emotion/styled';
3
+ import type { ReactNode } from 'react';
4
+ import { memo } from 'react';
5
+ import type { z } from 'zod';
6
+
7
+ import { SVGStyledText } from '../../../svg/index.js';
8
+ import { withFieldGroup } from '../../context/use_ts_form.js';
9
+ import { FormGroup } from '../input_groups/form_group.js';
10
+
11
+ import { Fieldset, Legend } from './fieldset.js';
12
+ import { svgTextStyleFieldsSchema } from './svg_text_style.schema.js';
13
+
14
+ const TextStyleSwitchContainer = styled.div`
15
+ display: flex;
16
+ flex-direction: row;
17
+ gap: 1rem;
18
+ `;
19
+
20
+ type SvgTextStyleFields = z.input<typeof svgTextStyleFieldsSchema>;
21
+
22
+ // https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms
23
+ // Default values are not used at runtime (same for props).
24
+ const defaultValues: SvgTextStyleFields = {
25
+ fill: '#000000',
26
+ fontSize: '16',
27
+ fontStyle: 'normal',
28
+ fontWeight: 'normal',
29
+ };
30
+
31
+ export interface SVGTextStyleFieldsProps {
32
+ label: string;
33
+ previewText?: string;
34
+ }
35
+
36
+ const inferSVGTextStyleFieldsProps: SVGTextStyleFieldsProps = {
37
+ label: '',
38
+ };
39
+
40
+ export const FieldGroupSVGTextStyleFields = withFieldGroup({
41
+ defaultValues,
42
+ props: inferSVGTextStyleFieldsProps,
43
+ render: function SVGTextStyleFields({
44
+ group,
45
+ label,
46
+ previewText = 'Placeholder',
47
+ }) {
48
+ return (
49
+ <Fieldset>
50
+ <Legend>{label}</Legend>
51
+ <group.AppField name="fill">
52
+ {(field) => <field.ColorPicker label="Color" />}
53
+ </group.AppField>
54
+ <group.AppField name="fontSize">
55
+ {(field) => <field.NumericInput label="Font size" />}
56
+ </group.AppField>
57
+ <FormGroup label="Font style">
58
+ <TextStyleSwitchContainer>
59
+ <group.Field name="fontWeight">
60
+ {(field) => (
61
+ <Checkbox
62
+ labelElement={<BoldLabel>Bold</BoldLabel>}
63
+ name={field.name}
64
+ checked={fontWeightToBoolean(field.state.value)}
65
+ onChange={(e) =>
66
+ field.handleChange(booleanToFontWeight(e.target.checked))
67
+ }
68
+ onBlur={field.handleBlur}
69
+ />
70
+ )}
71
+ </group.Field>
72
+ <group.Field name="fontStyle">
73
+ {(field) => (
74
+ <Checkbox
75
+ labelElement={<ItalicLabel>Italic</ItalicLabel>}
76
+ name={field.name}
77
+ checked={fontStyleToBoolean(field.state.value)}
78
+ onChange={(e) =>
79
+ field.handleChange(booleanToFontStyle(e.target.checked))
80
+ }
81
+ onBlur={field.handleBlur}
82
+ />
83
+ )}
84
+ </group.Field>
85
+ </TextStyleSwitchContainer>
86
+ </FormGroup>
87
+
88
+ <FormGroup label="Preview">
89
+ <group.Subscribe selector={(state) => state.values}>
90
+ {(values) => (
91
+ <TextStyleFieldPreview {...values}>
92
+ {previewText}
93
+ </TextStyleFieldPreview>
94
+ )}
95
+ </group.Subscribe>
96
+ </FormGroup>
97
+ </Fieldset>
98
+ );
99
+ },
100
+ });
101
+
102
+ const TextStyleFieldPreviewContainer = styled.div`
103
+ display: flex;
104
+ align-items: center;
105
+ min-height: 30px;
106
+ `;
107
+
108
+ interface TextStyleFieldPreviewProps extends SvgTextStyleFields {
109
+ children?: ReactNode;
110
+ }
111
+
112
+ const TextStyleFieldPreview = memo(function TextStyleFieldPreview(
113
+ props: TextStyleFieldPreviewProps,
114
+ ) {
115
+ const parsedValues = svgTextStyleFieldsSchema.parse(props);
116
+ const svgHeight = Math.round(parsedValues.fontSize * 1.5);
117
+ const textY = Math.round(svgHeight / 4);
118
+
119
+ return (
120
+ <TextStyleFieldPreviewContainer>
121
+ <svg height={svgHeight} width="auto">
122
+ <SVGStyledText
123
+ dominantBaseline="hanging"
124
+ x={0}
125
+ y={textY}
126
+ {...parsedValues}
127
+ >
128
+ {props.children}
129
+ </SVGStyledText>
130
+ </svg>
131
+ </TextStyleFieldPreviewContainer>
132
+ );
133
+ });
134
+
135
+ const BoldLabel = styled.span`
136
+ font-weight: bold;
137
+ `;
138
+ const ItalicLabel = styled.span`
139
+ font-style: italic;
140
+ `;
141
+
142
+ function fontWeightToBoolean(
143
+ weight: SvgTextStyleFields['fontWeight'],
144
+ ): boolean {
145
+ return weight === 'bold';
146
+ }
147
+
148
+ function booleanToFontWeight(
149
+ weight: boolean,
150
+ ): SvgTextStyleFields['fontWeight'] {
151
+ return weight ? 'bold' : 'normal';
152
+ }
153
+
154
+ function fontStyleToBoolean(weight: SvgTextStyleFields['fontStyle']): boolean {
155
+ return weight === 'italic';
156
+ }
157
+
158
+ function booleanToFontStyle(weight: boolean): SvgTextStyleFields['fontStyle'] {
159
+ return weight ? 'italic' : 'normal';
160
+ }
@@ -1,13 +1,20 @@
1
+ import type { ColorPickerDropdownProps } from '../../../color-picker/index.js';
1
2
  import { ColorPickerDropdown } from '../../../color-picker/index.js';
2
3
  import type { ChangeCallbackProps as ChangeCallbackComponentProps } from '../../../color-picker/react-color/ColorPicker.js';
3
4
  import { useFieldContext } from '../../context/use_ts_form.js';
4
5
  import type { FormGroupInputProps } from '../input_groups/form_group.js';
5
6
  import { FormGroup } from '../input_groups/form_group.js';
6
7
 
7
- type ColorPickerProps = Omit<FormGroupInputProps, 'placeholder'>;
8
+ type ColorPickerProps = Omit<FormGroupInputProps, 'placeholder'> &
9
+ Pick<
10
+ ColorPickerDropdownProps,
11
+ 'presetColors' | 'disableAlpha' | 'popoverProps'
12
+ >;
8
13
 
9
14
  export function ColorPicker(props: ColorPickerProps) {
10
15
  const { label, helpText, layout, fullWidth, required } = props;
16
+ const { presetColors, disableAlpha, popoverProps } = props;
17
+
11
18
  const field = useFieldContext<string>();
12
19
  const error = field
13
20
  .getMeta()
@@ -30,8 +37,12 @@ export function ColorPicker(props: ColorPickerProps) {
30
37
  intent={error ? 'danger' : 'none'}
31
38
  >
32
39
  <ColorPickerDropdown
40
+ id={field.name}
33
41
  color={{ hex: field.state.value }}
34
42
  onChange={onChange}
43
+ presetColors={presetColors}
44
+ disableAlpha={disableAlpha}
45
+ popoverProps={popoverProps}
35
46
  />
36
47
  </FormGroup>
37
48
  );
@@ -78,7 +78,7 @@ export interface FormGroupInputProps {
78
78
  interface FormGroupProps {
79
79
  label?: string;
80
80
  intent?: Intent;
81
- name: string;
81
+ name?: string;
82
82
  required?: boolean;
83
83
  helpText?: string;
84
84
  children?: ReactNode;
@@ -13,7 +13,7 @@ import { Section } from '../components/layout/Section.js';
13
13
  const { useFormContext, useFieldContext, formContext, fieldContext } =
14
14
  createFormHookContexts();
15
15
 
16
- const { useAppForm, withForm } = createFormHook({
16
+ const { useAppForm, withForm, withFieldGroup } = createFormHook({
17
17
  fieldContext,
18
18
  formContext,
19
19
  formComponents: {
@@ -32,4 +32,4 @@ const { useAppForm, withForm } = createFormHook({
32
32
  });
33
33
 
34
34
  export const useForm = useAppForm;
35
- export { useFieldContext, useFormContext, withForm };
35
+ export { useFieldContext, useFormContext, withFieldGroup, withForm };
@@ -15,6 +15,7 @@ export * from './split_pane/index.js';
15
15
  export * from './table/index.js';
16
16
  export * from './toolbar/index.js';
17
17
  export * from './form/context/use_ts_form.js';
18
+ export * from './form/components/field_groups/index.js';
18
19
  export * from './activity_bar/index.js';
19
20
  export * from './activity_panel/index.js';
20
21
  export * from './utils/index.js';
@@ -1,8 +1,12 @@
1
+ export const SVGStyledLineStrokePattern = {
2
+ solid: 'solid',
3
+ dashed: 'dashed',
4
+ dotted: 'dotted',
5
+ 'dashed-dot': 'dashed-dot',
6
+ } as const;
7
+
1
8
  export type SVGStyledLineStrokePattern =
2
- | 'solid'
3
- | 'dashed'
4
- | 'dotted'
5
- | 'dashed-dot';
9
+ (typeof SVGStyledLineStrokePattern)[keyof typeof SVGStyledLineStrokePattern];
6
10
 
7
11
  /**
8
12
  * SVG line styles that can be controlled by the user.