react-science 19.3.1 → 19.4.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 (34) hide show
  1. package/lib/components/color-picker/react-color/ColorPicker.d.ts +1 -2
  2. package/lib/components/color-picker/react-color/ColorPicker.d.ts.map +1 -1
  3. package/lib/components/form/components/input/checkbox.d.ts.map +1 -1
  4. package/lib/components/form/components/input/checkbox.js +2 -2
  5. package/lib/components/form/components/input/checkbox.js.map +1 -1
  6. package/lib/components/form/components/input/color_picker.d.ts +5 -0
  7. package/lib/components/form/components/input/color_picker.d.ts.map +1 -0
  8. package/lib/components/form/components/input/color_picker.js +17 -0
  9. package/lib/components/form/components/input/color_picker.js.map +1 -0
  10. package/lib/components/form/components/input/input.d.ts +2 -1
  11. package/lib/components/form/components/input/input.d.ts.map +1 -1
  12. package/lib/components/form/components/input/input.js +2 -2
  13. package/lib/components/form/components/input/input.js.map +1 -1
  14. package/lib/components/form/components/input/numeric_input.d.ts +2 -1
  15. package/lib/components/form/components/input/numeric_input.d.ts.map +1 -1
  16. package/lib/components/form/components/input/numeric_input.js +2 -2
  17. package/lib/components/form/components/input/numeric_input.js.map +1 -1
  18. package/lib/components/form/components/input_groups/form_group.d.ts.map +1 -1
  19. package/lib/components/form/components/input_groups/form_group.js +14 -7
  20. package/lib/components/form/components/input_groups/form_group.js.map +1 -1
  21. package/lib/components/form/components/layout/Section.js +1 -1
  22. package/lib/components/form/context/use_ts_form.d.ts +4 -0
  23. package/lib/components/form/context/use_ts_form.d.ts.map +1 -1
  24. package/lib/components/form/context/use_ts_form.js +2 -0
  25. package/lib/components/form/context/use_ts_form.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/components/color-picker/react-color/ColorPicker.tsx +1 -1
  28. package/src/components/form/components/input/checkbox.tsx +2 -1
  29. package/src/components/form/components/input/color_picker.tsx +38 -0
  30. package/src/components/form/components/input/input.tsx +5 -13
  31. package/src/components/form/components/input/numeric_input.tsx +4 -1
  32. package/src/components/form/components/input_groups/form_group.tsx +19 -8
  33. package/src/components/form/components/layout/Section.tsx +1 -1
  34. package/src/components/form/context/use_ts_form.ts +2 -0
@@ -17,7 +17,7 @@ export interface HSV {
17
17
  v: number;
18
18
  a: number;
19
19
  }
20
- interface ChangeCallbackProps {
20
+ export interface ChangeCallbackProps {
21
21
  hex: string;
22
22
  hsl: HSL;
23
23
  hsv: HSV;
@@ -39,5 +39,4 @@ export interface ColorPickerProps {
39
39
  style?: CSSProperties;
40
40
  }
41
41
  export declare function ColorPicker(props: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
42
- export {};
43
42
  //# sourceMappingURL=ColorPicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/react-color/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAW3C,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AACD,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AACD,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,UAAU,mBAAmB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EACF;QACE,GAAG,EAAE,MAAM,CAAC;KACb,GACD,GAAG,GACH,GAAG,GACH,GAAG,CAAC;IACR,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC/D,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACvE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACpE,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAsFD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAiGlD"}
1
+ {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/react-color/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAW3C,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AACD,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AACD,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EACF;QACE,GAAG,EAAE,MAAM,CAAC;KACb,GACD,GAAG,GACH,GAAG,GACH,GAAG,CAAC;IACR,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC/D,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACvE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACpE,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAsFD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAiGlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAS1E,KAAK,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,gBAAgB,GAAG,MAAM,CAAC,GAAG;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAQF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAiC5C"}
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAS1E,KAAK,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,gBAAgB,GAAG,MAAM,CAAC,GAAG;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAQF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAkC5C"}
@@ -10,7 +10,7 @@ const StyledCheckbox = styled(BPCheckbox) `
10
10
  width: fit-content;
11
11
  `;
12
12
  export function Checkbox(props) {
13
- const { helpText, label } = props;
13
+ const { helpText, label, ...otherProps } = props;
14
14
  const field = useFieldContext();
15
15
  const error = field
16
16
  .getMeta()
@@ -21,6 +21,6 @@ export function Checkbox(props) {
21
21
  const checked = event.target.checked;
22
22
  return field.handleChange(checked);
23
23
  }
24
- return (_jsx(FormGroup, { name: field.name, intent: intent, error: error, fullWidth: true, helpText: helpText, children: _jsx(StyledCheckbox, { label: label, name: field.name, value: String(field.state.value), onChange: onChange, onBlur: field.handleBlur, defaultChecked: field.state.value }) }));
24
+ return (_jsx(FormGroup, { name: field.name, intent: intent, error: error, fullWidth: true, helpText: helpText, children: _jsx(StyledCheckbox, { ...otherProps, label: label, name: field.name, value: String(field.state.value), onChange: onChange, onBlur: field.handleBlur, defaultChecked: field.state.value }) }));
25
25
  }
26
26
  //# sourceMappingURL=checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/checkbox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,mBA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KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAChC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,CAAC,UAAU,EACxB,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,GACjC,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { FormGroupInputProps } from '../input_groups/form_group.js';
2
+ type ColorPickerProps = Omit<FormGroupInputProps, 'placeholder'>;
3
+ export declare function ColorPicker(props: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=color_picker.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ColorPickerDropdown } from '../../../color-picker/index.js';
3
+ import { useFieldContext } from '../../context/use_ts_form.js';
4
+ import { FormGroup } from '../input_groups/form_group.js';
5
+ export function ColorPicker(props) {
6
+ const { label, helpText, layout, fullWidth, required } = props;
7
+ const field = useFieldContext();
8
+ const error = field
9
+ .getMeta()
10
+ .errors.map((e) => e.message)
11
+ .at(0);
12
+ function onChange(color) {
13
+ field.setValue(color.hex);
14
+ }
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
+ }
17
+ //# sourceMappingURL=color_picker.js.map
@@ -0,0 +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,5 +1,6 @@
1
+ import type { InputGroupProps } from '@blueprintjs/core';
1
2
  import type { FormGroupInputProps } from '../input_groups/form_group.js';
2
- interface InputProps extends FormGroupInputProps {
3
+ interface InputProps extends FormGroupInputProps, InputGroupProps {
3
4
  type?: string;
4
5
  }
5
6
  export declare function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/input.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,UAAU,UAAW,SAAQ,mBAAmB;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CA6CtC"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,UAAU,UAAW,SAAQ,mBAAmB,EAAE,eAAe;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAoCtC"}
@@ -3,7 +3,7 @@ import { InputGroup } from '@blueprintjs/core';
3
3
  import { useFieldContext } from '../../context/use_ts_form.js';
4
4
  import { FormGroup } from '../input_groups/form_group.js';
5
5
  export function Input(props) {
6
- const { label, required, placeholder, type = 'text', helpText, layout, fullWidth, } = props;
6
+ const { label, required, helpText, layout, fullWidth, ...otherProps } = props;
7
7
  const field = useFieldContext();
8
8
  const error = field
9
9
  .getMeta()
@@ -12,6 +12,6 @@ export function Input(props) {
12
12
  function onChange(event) {
13
13
  return field.handleChange(event.target.value);
14
14
  }
15
- return (_jsx(FormGroup, { name: field.name, label: label, intent: error ? 'danger' : 'none', required: required, error: error, helpText: helpText, layout: layout, fullWidth: fullWidth, children: _jsx(InputGroup, { id: field.name, name: field.name, required: required, type: type, onChange: onChange, onBlur: field.handleBlur, intent: error ? 'danger' : 'none', value: field.state.value, placeholder: placeholder }) }));
15
+ return (_jsx(FormGroup, { name: field.name, label: label, intent: error ? 'danger' : 'none', required: required, error: error, helpText: helpText, layout: layout, fullWidth: fullWidth, children: _jsx(InputGroup, { ...otherProps, id: field.name, name: field.name, onChange: onChange, onBlur: field.handleBlur, intent: error ? 'danger' : 'none', value: field.state.value, required: required }) }));
16
16
  }
17
17
  //# sourceMappingURL=input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAM1D,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,WAAW,EACX,IAAI,GAAG,MAAM,EACb,QAAQ,EACR,MAAM,EACN,SAAS,GACV,GAAG,KAAK,CAAC;IAEV,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,KAAoC;QACpD,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChD,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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,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,UAAU,OACL,UAAU,EACd,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,CAAC,UAAU,EACxB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EACjC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EACxB,QAAQ,EAAE,QAAQ,GAClB,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
+ import type { NumericInputProps as BPNumericInputProps } from '@blueprintjs/core';
1
2
  import type { FormGroupInputProps } from '../input_groups/form_group.js';
2
- interface NumericInputProps extends FormGroupInputProps {
3
+ interface NumericInputProps extends FormGroupInputProps, BPNumericInputProps {
3
4
  step?: number;
4
5
  min?: number;
5
6
  max?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"numeric_input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/numeric_input.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,UAAU,iBAAkB,SAAQ,mBAAmB;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAkDpD"}
1
+ {"version":3,"file":"numeric_input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/numeric_input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAKlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,UAAU,iBAAkB,SAAQ,mBAAmB,EAAE,mBAAmB;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAoDpD"}
@@ -4,7 +4,7 @@ import { useFieldContext } from '../../context/use_ts_form.js';
4
4
  import { getIntent } from '../../utils/use_intent.js';
5
5
  import { FormGroup } from '../input_groups/form_group.js';
6
6
  export function NumericInput(props) {
7
- const { label, required, helpText, placeholder, step, min, max, layout, fullWidth, } = props;
7
+ const { label, required, helpText, placeholder, step, min, max, layout, fullWidth, ...otherProps } = props;
8
8
  const field = useFieldContext();
9
9
  const error = field
10
10
  .getMeta()
@@ -14,6 +14,6 @@ export function NumericInput(props) {
14
14
  function onChange(_, valueAsString) {
15
15
  return field.handleChange(valueAsString);
16
16
  }
17
- return (_jsx(FormGroup, { name: field.name, label: label, intent: intent, required: required, helpText: helpText, layout: layout, error: error, fullWidth: fullWidth, children: _jsx(BPNumericInput, { id: field.name, name: field.name, stepSize: step, min: min, max: max, value: field.state.value ?? '', onValueChange: onChange, intent: intent, placeholder: placeholder, required: required }) }));
17
+ return (_jsx(FormGroup, { name: field.name, label: label, intent: intent, required: required, helpText: helpText, layout: layout, error: error, fullWidth: fullWidth, children: _jsx(BPNumericInput, { ...otherProps, id: field.name, name: field.name, stepSize: step, min: min, max: max, value: field.state.value ?? '', onValueChange: onChange, intent: intent, placeholder: placeholder, required: required }) }));
18
18
  }
19
19
  //# sourceMappingURL=numeric_input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"numeric_input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,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAC9B,aAAa,EAAE,QAAQ,EACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,GACQ,CACb,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"numeric_input.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/numeric_input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAQ1D,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,GAAG,EACH,GAAG,EACH,MAAM,EACN,SAAS,EACT,GAAG,UAAU,EACd,GAAG,KAAK,CAAC;IAEV,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,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEhC,SAAS,QAAQ,CAAC,CAAS,EAAE,aAAqB;QAChD,OAAO,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,YAEpB,KAAC,cAAc,OACT,UAAU,EACd,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,QAAQ,EAAE,IAAI,EACd,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAC9B,aAAa,EAAE,QAAQ,EACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -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;AAsDhD,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,2CAgD9C"}
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,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Classes } from '@blueprintjs/core';
2
+ import { Classes, Colors } from '@blueprintjs/core';
3
3
  import styled from '@emotion/styled';
4
4
  import { useFormContext } from './form_context.js';
5
5
  const INPUT_HEIGHT = 30;
@@ -23,25 +23,32 @@ const ContainerElement = styled.div `
23
23
  : '1 / -1'};
24
24
  height: ${(props) => props.height === 'auto' ? props.height : `${props.height}px`};
25
25
  width: fit-content;
26
+ min-width: 180px;
26
27
  `;
28
+ // Keep 26 px for inline layout to align with input height
27
29
  const Label = styled.label `
28
- padding-top: calc(${INPUT_HEIGHT}px - 26px);
30
+ padding-top: calc(
31
+ ${INPUT_HEIGHT}px - ${(props) => (props.layout === 'inline' ? 26 : 20)}px
32
+ );
29
33
  grid-column: ${(props) => (props.layout === 'inline' ? 'label' : '1 / -1')};
30
34
  height: 30px;
31
-
32
- @media (width < 48rem) {
33
- padding: 0;
34
- }
35
35
  `;
36
36
  const ErrorAndHelpText = styled.div `
37
37
  display: flex;
38
38
  flex-direction: column;
39
39
  `;
40
+ const InfoText = styled.span `
41
+ margin-bottom: 5px;
42
+ `;
43
+ // Enforce that the help text will be only gray
44
+ const HelpText = styled(InfoText) `
45
+ color: ${Colors.GRAY1} !important;
46
+ `;
40
47
  export function FormGroup(props) {
41
48
  const { label, intent = 'none', name, required, children, helpText, error, layout, fullWidth = false, } = props;
42
49
  const { layout: formLayout } = useFormContext();
43
50
  // If intent is undefined or none intentClass will return undefined
44
51
  const intentClass = Classes.intentClass(intent) ?? '';
45
- return (_jsxs(FormContainer, { layout: layout || formLayout, className: `${Classes.FORM_GROUP} ${intentClass}`, children: [label && (_jsxs(Label, { layout: layout || formLayout, className: Classes.LABEL, htmlFor: name, children: [label, ' ', required && (_jsx(RequiredSpan, { className: Classes.TEXT_MUTED, children: "*" }))] })), _jsxs(ContainerElement, { fullWidth: fullWidth, layout: layout || formLayout, children: [children, _jsxs(ErrorAndHelpText, { children: [helpText && (_jsx("span", { className: Classes.FORM_HELPER_TEXT, children: helpText })), error && _jsx("span", { className: Classes.FORM_HELPER_TEXT, children: error })] })] })] }));
52
+ return (_jsxs(FormContainer, { layout: layout || formLayout, className: `${Classes.FORM_GROUP} ${intentClass}`, children: [label && (_jsxs(Label, { layout: layout || formLayout, className: Classes.LABEL, htmlFor: name, children: [label, ' ', required && (_jsx(RequiredSpan, { className: Classes.TEXT_MUTED, children: "*" }))] })), _jsxs(ContainerElement, { fullWidth: fullWidth, layout: layout || formLayout, children: [children, _jsxs(ErrorAndHelpText, { children: [helpText && (_jsx(HelpText, { className: Classes.FORM_HELPER_TEXT, children: helpText })), error && (_jsx(InfoText, { className: Classes.FORM_HELPER_TEXT, children: error }))] })] })] }));
46
53
  }
47
54
  //# sourceMappingURL=form_group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form_group.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/form_group.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAE9B;gBACc,YAAY;;;;2BAID,CAAC,KAAK,EAAE,EAAE,CACjC,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK;wBACzC,CAAC,KAAK,EAAE,EAAE,CAC9B,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;CACnD,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAA;;CAE/B,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAIjC;;iBAEe,CAAC,KAAK,EAAE,EAAE,CACvB,KAAK,CAAC,SAAS;IACb,CAAC,CAAC,QAAQ;IACV,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ;QACzB,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,QAAQ;YACN,CAAC,KAAK,EAAE,EAAE,CA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AU,aACjE,QAAQ,EAET,MAAC,gBAAgB,eACd,QAAQ,IAAI,CACX,eAAM,SAAS,EAAE,OAAO,CAAC,gBAAgB,YAAG,QAAQ,GAAQ,CAC7D,EAEA,KAAK,IAAI,eAAM,SAAS,EAAE,OAAO,CAAC,gBAAgB,YAAG,KAAK,GAAQ,IAClD,IACF,IACL,CACjB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"form_group.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/form_group.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAE9B;gBACc,YAAY;;;;2BAID,CAAC,KAAK,EAAE,EAAE,CACjC,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK;wBACzC,CAAC,KAAK,EAAE,EAAE,CAC9B,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;CACnD,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAA;;CAE/B,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAIjC;;iBAEe,CAAC,KAAK,EAAE,EAAE,CACvB,KAAK,CAAC,SAAS;IACb,CAAC,CAAC,QAAQ;IACV,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ;QACzB,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,QAAQ;YACN,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAA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O,CAAC,KAAK,EACxB,OAAO,EAAE,IAAI,aAEZ,KAAK,EAAE,GAAG,EACV,QAAQ,IAAI,CACX,KAAC,YAAY,IAAC,SAAS,EAAE,OAAO,CAAC,UAAU,kBAAkB,CAC9D,IACK,CACT,EACD,MAAC,gBAAgB,IAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,IAAI,UAAU,aACjE,QAAQ,EAET,MAAC,gBAAgB,eACd,QAAQ,IAAI,CACX,KAAC,QAAQ,IAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,YAAG,QAAQ,GAAY,CACrE,EAEA,KAAK,IAAI,CACR,KAAC,QAAQ,IAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,YAAG,KAAK,GAAY,CAClE,IACgB,IACF,IACL,CACjB,CAAC;AACJ,CAAC"}
@@ -29,7 +29,7 @@ const ContainerContent = styled.div `
29
29
  flex-direction: column;
30
30
  gap: 2px;
31
31
  border-radius: 0.75rem;
32
- padding: 7px 10px 2px;
32
+ padding: 7px 10px 10px;
33
33
  `;
34
34
  export function Section(props) {
35
35
  const { title, description, children } = props;
@@ -1,4 +1,5 @@
1
1
  import { Checkbox } from '../components/input/checkbox.js';
2
+ import { ColorPicker } from '../components/input/color_picker.tsx';
2
3
  import { Input } from '../components/input/input.js';
3
4
  import { NumericInput } from '../components/input/numeric_input.js';
4
5
  import { ResetButton } from '../components/input/reset_button.js';
@@ -13,6 +14,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
13
14
  readonly Checkbox: typeof Checkbox;
14
15
  readonly Select: typeof Select;
15
16
  readonly Switch: typeof Switch;
17
+ readonly ColorPicker: typeof ColorPicker;
16
18
  }, {
17
19
  readonly SubmitButton: typeof SubmitButton;
18
20
  readonly ResetButton: typeof ResetButton;
@@ -24,6 +26,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
24
26
  readonly Checkbox: typeof Checkbox;
25
27
  readonly Select: typeof Select;
26
28
  readonly Switch: typeof Switch;
29
+ readonly ColorPicker: typeof ColorPicker;
27
30
  }, {
28
31
  readonly SubmitButton: typeof SubmitButton;
29
32
  readonly ResetButton: typeof ResetButton;
@@ -36,6 +39,7 @@ export declare const useForm: <TFormData, TOnMount extends import("@tanstack/rea
36
39
  readonly Checkbox: typeof Checkbox;
37
40
  readonly Select: typeof Select;
38
41
  readonly Switch: typeof Switch;
42
+ readonly ColorPicker: typeof ColorPicker;
39
43
  }, {
40
44
  readonly SubmitButton: typeof SubmitButton;
41
45
  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,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;;;;;;;;;;;;;;;;;;;;;;kCAe1B,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;;;;;;;;;;;;;;;;;;;;;;;;kCAgB1B,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;EAAa,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { createFormHook, createFormHookContexts } from '@tanstack/react-form';
2
2
  import { Checkbox } from '../components/input/checkbox.js';
3
+ import { ColorPicker } from "../components/input/color_picker.js";
3
4
  import { Input } from '../components/input/input.js';
4
5
  import { NumericInput } from '../components/input/numeric_input.js';
5
6
  import { ResetButton } from '../components/input/reset_button.js';
@@ -22,6 +23,7 @@ const { useAppForm, withForm } = createFormHook({
22
23
  Checkbox,
23
24
  Select,
24
25
  Switch,
26
+ ColorPicker,
25
27
  },
26
28
  });
27
29
  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,OAAO,EAAE,KAAK,EAAE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AAO,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,MAAM;QACN,WAAW;KACZ;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,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.1",
3
+ "version": "19.4.0",
4
4
  "description": "React components to build scientific applications UI",
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,7 +28,7 @@ export interface HSV {
28
28
  a: number;
29
29
  }
30
30
 
31
- interface ChangeCallbackProps {
31
+ export interface ChangeCallbackProps {
32
32
  hex: string;
33
33
  hsl: HSL;
34
34
  hsv: HSV;
@@ -18,7 +18,7 @@ const StyledCheckbox = styled(BPCheckbox)<CheckboxProps>`
18
18
  `;
19
19
 
20
20
  export function Checkbox(props: CheckboxProps) {
21
- const { helpText, label } = props;
21
+ const { helpText, label, ...otherProps } = props;
22
22
  const field = useFieldContext<boolean>();
23
23
  const error = field
24
24
  .getMeta()
@@ -41,6 +41,7 @@ export function Checkbox(props: CheckboxProps) {
41
41
  helpText={helpText}
42
42
  >
43
43
  <StyledCheckbox
44
+ {...otherProps}
44
45
  label={label}
45
46
  name={field.name}
46
47
  value={String(field.state.value)}
@@ -0,0 +1,38 @@
1
+ import { ColorPickerDropdown } from '../../../color-picker/index.js';
2
+ import type { ChangeCallbackProps as ChangeCallbackComponentProps } from '../../../color-picker/react-color/ColorPicker.js';
3
+ import { useFieldContext } from '../../context/use_ts_form.js';
4
+ import type { FormGroupInputProps } from '../input_groups/form_group.js';
5
+ import { FormGroup } from '../input_groups/form_group.js';
6
+
7
+ type ColorPickerProps = Omit<FormGroupInputProps, 'placeholder'>;
8
+
9
+ export function ColorPicker(props: ColorPickerProps) {
10
+ const { label, helpText, layout, fullWidth, required } = props;
11
+ const field = useFieldContext<string>();
12
+ const error = field
13
+ .getMeta()
14
+ .errors.map((e) => e.message)
15
+ .at(0);
16
+
17
+ function onChange(color: ChangeCallbackComponentProps) {
18
+ field.setValue(color.hex);
19
+ }
20
+
21
+ return (
22
+ <FormGroup
23
+ name={field.name}
24
+ label={label}
25
+ helpText={helpText}
26
+ error={error}
27
+ layout={layout}
28
+ fullWidth={fullWidth}
29
+ required={required}
30
+ intent={error ? 'danger' : 'none'}
31
+ >
32
+ <ColorPickerDropdown
33
+ color={{ hex: field.state.value }}
34
+ onChange={onChange}
35
+ />
36
+ </FormGroup>
37
+ );
38
+ }
@@ -1,3 +1,4 @@
1
+ import type { InputGroupProps } from '@blueprintjs/core';
1
2
  import { InputGroup } from '@blueprintjs/core';
2
3
  import type { ChangeEvent } from 'react';
3
4
 
@@ -5,20 +6,12 @@ import { useFieldContext } from '../../context/use_ts_form.js';
5
6
  import type { FormGroupInputProps } from '../input_groups/form_group.js';
6
7
  import { FormGroup } from '../input_groups/form_group.js';
7
8
 
8
- interface InputProps extends FormGroupInputProps {
9
+ interface InputProps extends FormGroupInputProps, InputGroupProps {
9
10
  type?: string;
10
11
  }
11
12
 
12
13
  export function Input(props: InputProps) {
13
- const {
14
- label,
15
- required,
16
- placeholder,
17
- type = 'text',
18
- helpText,
19
- layout,
20
- fullWidth,
21
- } = props;
14
+ const { label, required, helpText, layout, fullWidth, ...otherProps } = props;
22
15
 
23
16
  const field = useFieldContext<string>();
24
17
  const error = field
@@ -42,15 +35,14 @@ export function Input(props: InputProps) {
42
35
  fullWidth={fullWidth}
43
36
  >
44
37
  <InputGroup
38
+ {...otherProps}
45
39
  id={field.name}
46
40
  name={field.name}
47
- required={required}
48
- type={type}
49
41
  onChange={onChange}
50
42
  onBlur={field.handleBlur}
51
43
  intent={error ? 'danger' : 'none'}
52
44
  value={field.state.value}
53
- placeholder={placeholder}
45
+ required={required}
54
46
  />
55
47
  </FormGroup>
56
48
  );
@@ -1,3 +1,4 @@
1
+ import type { NumericInputProps as BPNumericInputProps } from '@blueprintjs/core';
1
2
  import { NumericInput as BPNumericInput } from '@blueprintjs/core';
2
3
 
3
4
  import { useFieldContext } from '../../context/use_ts_form.js';
@@ -5,7 +6,7 @@ import { getIntent } from '../../utils/use_intent.js';
5
6
  import type { FormGroupInputProps } from '../input_groups/form_group.js';
6
7
  import { FormGroup } from '../input_groups/form_group.js';
7
8
 
8
- interface NumericInputProps extends FormGroupInputProps {
9
+ interface NumericInputProps extends FormGroupInputProps, BPNumericInputProps {
9
10
  step?: number;
10
11
  min?: number;
11
12
  max?: number;
@@ -22,6 +23,7 @@ export function NumericInput(props: NumericInputProps) {
22
23
  max,
23
24
  layout,
24
25
  fullWidth,
26
+ ...otherProps
25
27
  } = props;
26
28
 
27
29
  const field = useFieldContext<string>();
@@ -48,6 +50,7 @@ export function NumericInput(props: NumericInputProps) {
48
50
  fullWidth={fullWidth}
49
51
  >
50
52
  <BPNumericInput
53
+ {...otherProps}
51
54
  id={field.name}
52
55
  name={field.name}
53
56
  stepSize={step}
@@ -1,5 +1,5 @@
1
1
  import type { Intent } from '@blueprintjs/core';
2
- import { Classes } from '@blueprintjs/core';
2
+ import { Classes, Colors } from '@blueprintjs/core';
3
3
  import styled from '@emotion/styled';
4
4
  import type { ReactNode } from 'react';
5
5
 
@@ -40,16 +40,16 @@ const ContainerElement = styled.div<{
40
40
  height: ${(props) =>
41
41
  props.height === 'auto' ? props.height : `${props.height}px`};
42
42
  width: fit-content;
43
+ min-width: 180px;
43
44
  `;
44
45
 
46
+ // Keep 26 px for inline layout to align with input height
45
47
  const Label = styled.label<{ layout: Layout }>`
46
- padding-top: calc(${INPUT_HEIGHT}px - 26px);
48
+ padding-top: calc(
49
+ ${INPUT_HEIGHT}px - ${(props) => (props.layout === 'inline' ? 26 : 20)}px
50
+ );
47
51
  grid-column: ${(props) => (props.layout === 'inline' ? 'label' : '1 / -1')};
48
52
  height: 30px;
49
-
50
- @media (width < 48rem) {
51
- padding: 0;
52
- }
53
53
  `;
54
54
 
55
55
  const ErrorAndHelpText = styled.div`
@@ -57,6 +57,15 @@ const ErrorAndHelpText = styled.div`
57
57
  flex-direction: column;
58
58
  `;
59
59
 
60
+ const InfoText = styled.span`
61
+ margin-bottom: 5px;
62
+ `;
63
+
64
+ // Enforce that the help text will be only gray
65
+ const HelpText = styled(InfoText)`
66
+ color: ${Colors.GRAY1} !important;
67
+ `;
68
+
60
69
  export interface FormGroupInputProps {
61
70
  label?: string;
62
71
  required?: boolean;
@@ -118,10 +127,12 @@ export function FormGroup(props: FormGroupProps) {
118
127
 
119
128
  <ErrorAndHelpText>
120
129
  {helpText && (
121
- <span className={Classes.FORM_HELPER_TEXT}>{helpText}</span>
130
+ <HelpText className={Classes.FORM_HELPER_TEXT}>{helpText}</HelpText>
122
131
  )}
123
132
 
124
- {error && <span className={Classes.FORM_HELPER_TEXT}>{error}</span>}
133
+ {error && (
134
+ <InfoText className={Classes.FORM_HELPER_TEXT}>{error}</InfoText>
135
+ )}
125
136
  </ErrorAndHelpText>
126
137
  </ContainerElement>
127
138
  </FormContainer>
@@ -32,7 +32,7 @@ const ContainerContent = styled.div`
32
32
  flex-direction: column;
33
33
  gap: 2px;
34
34
  border-radius: 0.75rem;
35
- padding: 7px 10px 2px;
35
+ padding: 7px 10px 10px;
36
36
  `;
37
37
 
38
38
  interface SectionProps {
@@ -1,6 +1,7 @@
1
1
  import { createFormHook, createFormHookContexts } from '@tanstack/react-form';
2
2
 
3
3
  import { Checkbox } from '../components/input/checkbox.js';
4
+ import { ColorPicker } from '../components/input/color_picker.tsx';
4
5
  import { Input } from '../components/input/input.js';
5
6
  import { NumericInput } from '../components/input/numeric_input.js';
6
7
  import { ResetButton } from '../components/input/reset_button.js';
@@ -26,6 +27,7 @@ const { useAppForm, withForm } = createFormHook({
26
27
  Checkbox,
27
28
  Select,
28
29
  Switch,
30
+ ColorPicker,
29
31
  },
30
32
  });
31
33