react-science 19.1.0 → 19.2.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 (126) hide show
  1. package/lib/components/form/components/hooks/use_input_id.d.ts +8 -0
  2. package/lib/components/form/components/hooks/use_input_id.d.ts.map +1 -0
  3. package/lib/components/form/components/hooks/use_input_id.js +15 -0
  4. package/lib/components/form/components/hooks/use_input_id.js.map +1 -0
  5. package/lib/components/form/components/input/checkbox.d.ts +5 -0
  6. package/lib/components/form/components/input/checkbox.d.ts.map +1 -0
  7. package/lib/components/form/components/input/checkbox.js +19 -0
  8. package/lib/components/form/components/input/checkbox.js.map +1 -0
  9. package/lib/components/form/components/input/input.d.ts +9 -0
  10. package/lib/components/form/components/input/input.d.ts.map +1 -0
  11. package/lib/components/form/components/input/input.js +16 -0
  12. package/lib/components/form/components/input/input.js.map +1 -0
  13. package/lib/components/form/components/input/numeric_input.d.ts +8 -0
  14. package/lib/components/form/components/input/numeric_input.d.ts.map +1 -0
  15. package/lib/components/form/components/input/numeric_input.js +20 -0
  16. package/lib/components/form/components/input/numeric_input.js.map +1 -0
  17. package/lib/components/form/components/input/reset_button.d.ts +7 -0
  18. package/lib/components/form/components/input/reset_button.d.ts.map +1 -0
  19. package/lib/components/form/components/input/reset_button.js +9 -0
  20. package/lib/components/form/components/input/reset_button.js.map +1 -0
  21. package/lib/components/form/components/input/select.d.ts +12 -0
  22. package/lib/components/form/components/input/select.d.ts.map +1 -0
  23. package/lib/components/form/components/input/select.js +25 -0
  24. package/lib/components/form/components/input/select.js.map +1 -0
  25. package/lib/components/form/components/input/submit_button.d.ts +5 -0
  26. package/lib/components/form/components/input/submit_button.d.ts.map +1 -0
  27. package/lib/components/form/components/input/submit_button.js +11 -0
  28. package/lib/components/form/components/input/submit_button.js.map +1 -0
  29. package/lib/components/form/components/input/switch.d.ts +6 -0
  30. package/lib/components/form/components/input/switch.d.ts.map +1 -0
  31. package/lib/components/form/components/input/switch.js +16 -0
  32. package/lib/components/form/components/input/switch.js.map +1 -0
  33. package/lib/components/form/components/input_groups/input.d.ts +20 -0
  34. package/lib/components/form/components/input_groups/input.d.ts.map +1 -0
  35. package/lib/components/form/components/input_groups/input.js +9 -0
  36. package/lib/components/form/components/input_groups/input.js.map +1 -0
  37. package/lib/components/form/components/input_groups/select.d.ts +59 -0
  38. package/lib/components/form/components/input_groups/select.d.ts.map +1 -0
  39. package/lib/components/form/components/input_groups/select.js +29 -0
  40. package/lib/components/form/components/input_groups/select.js.map +1 -0
  41. package/lib/components/form/components/util/select.d.ts +20 -0
  42. package/lib/components/form/components/util/select.d.ts.map +1 -0
  43. package/lib/components/form/components/util/select.js +20 -0
  44. package/lib/components/form/components/util/select.js.map +1 -0
  45. package/lib/components/form/context/use_ts_form.d.ts +41 -0
  46. package/lib/components/form/context/use_ts_form.d.ts.map +1 -0
  47. package/lib/components/form/context/use_ts_form.js +27 -0
  48. package/lib/components/form/context/use_ts_form.js.map +1 -0
  49. package/lib/components/form/utils/use_field_id.d.ts +2 -0
  50. package/lib/components/form/utils/use_field_id.d.ts.map +1 -0
  51. package/lib/components/form/utils/use_field_id.js +5 -0
  52. package/lib/components/form/utils/use_field_id.js.map +1 -0
  53. package/lib/components/form/utils/use_intent.d.ts +3 -0
  54. package/lib/components/form/utils/use_intent.d.ts.map +1 -0
  55. package/lib/components/form/utils/use_intent.js +4 -0
  56. package/lib/components/form/utils/use_intent.js.map +1 -0
  57. package/lib/components/index.d.ts +2 -1
  58. package/lib/components/index.d.ts.map +1 -1
  59. package/lib/components/index.js +2 -1
  60. package/lib/components/index.js.map +1 -1
  61. package/lib/components/input/index.d.ts.map +1 -0
  62. package/lib/components/input/index.js.map +1 -0
  63. package/lib/components/{forms → input}/radio-button-group/RadioButton.d.ts.map +1 -1
  64. package/lib/components/{forms → input}/radio-button-group/RadioButton.js.map +1 -1
  65. package/lib/components/{forms → input}/radio-button-group/RadioButtonGroup.d.ts.map +1 -1
  66. package/lib/components/{forms → input}/radio-button-group/RadioButtonGroup.js.map +1 -1
  67. package/lib/components/{forms → input}/radio-button-group/index.d.ts.map +1 -1
  68. package/lib/components/input/radio-button-group/index.js.map +1 -0
  69. package/lib/components/input/styles.d.ts.map +1 -0
  70. package/lib/components/{forms → input}/styles.js.map +1 -1
  71. package/lib/components/{forms → input}/utils/SubText.d.ts.map +1 -1
  72. package/lib/components/{forms → input}/utils/SubText.js.map +1 -1
  73. package/lib/components/input/utils/index.d.ts.map +1 -0
  74. package/lib/components/input/utils/index.js.map +1 -0
  75. package/lib/components/{forms → input}/utils/use_input_id.d.ts.map +1 -1
  76. package/lib/components/{forms → input}/utils/use_input_id.js.map +1 -1
  77. package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
  78. package/lib/components/toolbar/Toolbar.js +2 -1
  79. package/lib/components/toolbar/Toolbar.js.map +1 -1
  80. package/package.json +4 -2
  81. package/src/components/form/components/hooks/use_input_id.ts +19 -0
  82. package/src/components/form/components/input/checkbox.tsx +36 -0
  83. package/src/components/form/components/input/input.tsx +37 -0
  84. package/src/components/form/components/input/numeric_input.tsx +49 -0
  85. package/src/components/form/components/input/reset_button.tsx +19 -0
  86. package/src/components/form/components/input/select.tsx +47 -0
  87. package/src/components/form/components/input/submit_button.tsx +23 -0
  88. package/src/components/form/components/input/switch.tsx +33 -0
  89. package/src/components/form/components/input_groups/input.tsx +63 -0
  90. package/src/components/form/components/input_groups/select.tsx +196 -0
  91. package/src/components/form/components/util/select.tsx +67 -0
  92. package/src/components/form/context/use_ts_form.ts +31 -0
  93. package/src/components/form/utils/use_field_id.ts +5 -0
  94. package/src/components/form/utils/use_intent.ts +5 -0
  95. package/src/components/index.ts +2 -1
  96. package/src/components/toolbar/Toolbar.tsx +2 -1
  97. package/lib/components/forms/index.d.ts.map +0 -1
  98. package/lib/components/forms/index.js.map +0 -1
  99. package/lib/components/forms/radio-button-group/index.js.map +0 -1
  100. package/lib/components/forms/styles.d.ts.map +0 -1
  101. package/lib/components/forms/utils/index.d.ts.map +0 -1
  102. package/lib/components/forms/utils/index.js.map +0 -1
  103. /package/lib/components/{forms → input}/index.d.ts +0 -0
  104. /package/lib/components/{forms → input}/index.js +0 -0
  105. /package/lib/components/{forms → input}/radio-button-group/RadioButton.d.ts +0 -0
  106. /package/lib/components/{forms → input}/radio-button-group/RadioButton.js +0 -0
  107. /package/lib/components/{forms → input}/radio-button-group/RadioButtonGroup.d.ts +0 -0
  108. /package/lib/components/{forms → input}/radio-button-group/RadioButtonGroup.js +0 -0
  109. /package/lib/components/{forms → input}/radio-button-group/index.d.ts +0 -0
  110. /package/lib/components/{forms → input}/radio-button-group/index.js +0 -0
  111. /package/lib/components/{forms → input}/styles.d.ts +0 -0
  112. /package/lib/components/{forms → input}/styles.js +0 -0
  113. /package/lib/components/{forms → input}/utils/SubText.d.ts +0 -0
  114. /package/lib/components/{forms → input}/utils/SubText.js +0 -0
  115. /package/lib/components/{forms → input}/utils/index.d.ts +0 -0
  116. /package/lib/components/{forms → input}/utils/index.js +0 -0
  117. /package/lib/components/{forms → input}/utils/use_input_id.d.ts +0 -0
  118. /package/lib/components/{forms → input}/utils/use_input_id.js +0 -0
  119. /package/src/components/{forms → input}/index.ts +0 -0
  120. /package/src/components/{forms → input}/radio-button-group/RadioButton.tsx +0 -0
  121. /package/src/components/{forms → input}/radio-button-group/RadioButtonGroup.tsx +0 -0
  122. /package/src/components/{forms → input}/radio-button-group/index.ts +0 -0
  123. /package/src/components/{forms → input}/styles.ts +0 -0
  124. /package/src/components/{forms → input}/utils/SubText.tsx +0 -0
  125. /package/src/components/{forms → input}/utils/index.ts +0 -0
  126. /package/src/components/{forms → input}/utils/use_input_id.ts +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generate an automatic id if needed, joined with name if truthy
3
+ *
4
+ * @param id
5
+ * @param name
6
+ */
7
+ export declare function useInputId(id: string | null | undefined, name: string | null | undefined): string;
8
+ //# sourceMappingURL=use_input_id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_input_id.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/hooks/use_input_id.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,UAQhC"}
@@ -0,0 +1,15 @@
1
+ import { useId } from 'react';
2
+ /**
3
+ * Generate an automatic id if needed, joined with name if truthy
4
+ *
5
+ * @param id
6
+ * @param name
7
+ */
8
+ export function useInputId(id, name) {
9
+ const reactId = useId();
10
+ // If id is defined, keep id as finalId for predictable behavior.
11
+ // If name is defined, join name with reactId to simplify debug in devtools.
12
+ // Else use reactId.
13
+ return id ?? (name ? `${name}_${reactId}` : reactId);
14
+ }
15
+ //# sourceMappingURL=use_input_id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_input_id.js","sourceRoot":"","sources":["../../../../../src/components/form/components/hooks/use_input_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,EAA6B,EAC7B,IAA+B;IAE/B,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IAExB,iEAAiE;IACjE,4EAA4E;IAC5E,oBAAoB;IACpB,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { CheckboxProps as BPCheckboxProps } from '@blueprintjs/core';
2
+ type CheckboxProps = Omit<BPCheckboxProps, 'defaultChecked' | 'name'>;
3
+ export declare function Checkbox(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +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;AAO1E,KAAK,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,gBAAgB,GAAG,MAAM,CAAC,CAAC;AAEtE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CA0B5C"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Checkbox as BPCheckbox, FormGroup } from '@blueprintjs/core';
3
+ import { useFieldContext } from '../../context/use_ts_form.js';
4
+ import { getIntent } from '../../utils/use_intent.js';
5
+ export function Checkbox(props) {
6
+ const { ...rest } = props;
7
+ const field = useFieldContext();
8
+ const error = field
9
+ .getMeta()
10
+ .errors.map((e) => e.message)
11
+ .at(0);
12
+ const intent = getIntent(error);
13
+ function onChange(event) {
14
+ const checked = event.target.checked;
15
+ return field.handleChange(checked);
16
+ }
17
+ return (_jsx(FormGroup, { intent: intent, helperText: error, children: _jsx(BPCheckbox, { ...rest, name: field.name, value: String(field.state.value), onChange: onChange, onBlur: field.handleBlur }) }));
18
+ }
19
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +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,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAItD,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC1B,MAAM,KAAK,GAAG,eAAe,EAAW,CAAC;IACzC,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,KAAoC;QACpD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QACrC,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,YAC1C,KAAC,UAAU,OACL,IAAI,EACR,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAChC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,CAAC,UAAU,GACxB,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ interface InputProps {
2
+ label?: string;
3
+ inline?: boolean;
4
+ required?: boolean;
5
+ placeholder?: string;
6
+ }
7
+ export declare function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/input.tsx"],"names":[],"mappings":"AAKA,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAwBtC"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFieldContext } from '../../context/use_ts_form.js';
3
+ import { Input as FormGroupInput } from '../input_groups/input.js';
4
+ export function Input(props) {
5
+ const { label, required, inline, placeholder } = props;
6
+ const field = useFieldContext();
7
+ const error = field
8
+ .getMeta()
9
+ .errors.map((e) => e.message)
10
+ .at(0);
11
+ function onChange(event) {
12
+ return field.handleChange(event.target.value);
13
+ }
14
+ return (_jsx(FormGroupInput, { required: required, error: error, formGroupProps: { label, inline }, value: field.state.value, onChange: onChange, name: field.name, placeholder: placeholder, onBlur: field.handleBlur }));
15
+ }
16
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/input.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AASnE,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACvD,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,cAAc,IACb,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EACjC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,KAAK,CAAC,UAAU,GACxB,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { NumericInputProps as BPNumericInputProps } from '@blueprintjs/core';
2
+ interface NumericInputProps extends Omit<BPNumericInputProps, 'defaultValue' | 'name'> {
3
+ label?: string;
4
+ required?: boolean;
5
+ }
6
+ export declare function NumericInput(props: NumericInputProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=numeric_input.d.ts.map
@@ -0,0 +1 @@
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;AAOlF,UAAU,iBACR,SAAQ,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,MAAM,CAAC;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAmCpD"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FormGroup, NumericInput as BPNumericInput } from '@blueprintjs/core';
3
+ import { useFieldContext } from '../../context/use_ts_form.js';
4
+ import { useFieldId } from '../../utils/use_field_id.js';
5
+ import { getIntent } from '../../utils/use_intent.js';
6
+ export function NumericInput(props) {
7
+ const { label, required, ...rest } = props;
8
+ const field = useFieldContext();
9
+ const id = useFieldId(field.name);
10
+ const error = field
11
+ .getMeta()
12
+ .errors.map((e) => e.message)
13
+ .at(0);
14
+ const intent = getIntent(error);
15
+ function onChange(_, valueAsString) {
16
+ return field.handleChange(valueAsString);
17
+ }
18
+ return (_jsx(FormGroup, { helperText: error, label: label, labelFor: id, intent: intent, labelInfo: label && required && _jsx("span", { style: { color: 'red' }, children: "*" }), children: _jsx(BPNumericInput, { ...rest, name: field.name, value: field.state.value ?? '', onValueChange: onChange, intent: intent, required: required, id: id, onBlur: field.handleBlur }) }));
19
+ }
20
+ //# sourceMappingURL=numeric_input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numeric_input.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/numeric_input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAQtD,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,KAAK,GAAG,eAAe,EAAU,CAAC;IACxC,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,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,UAAU,EAAE,KAAK,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,EAAE,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,KAAK,IAAI,QAAQ,IAAI,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAU,YAEvE,KAAC,cAAc,OACT,IAAI,EACR,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAC9B,aAAa,EAAE,QAAQ,EACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,KAAK,CAAC,UAAU,GACxB,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ interface ResetButtonProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare function ResetButton(props: ResetButtonProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=reset_button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/reset_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CASlD"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '../../../button/index.js';
3
+ import { useFormContext } from '../../context/use_ts_form.js';
4
+ export function ResetButton(props) {
5
+ const { children } = props;
6
+ const form = useFormContext();
7
+ return (_jsx(Button, { intent: "danger", type: "reset", onClick: () => form.reset(), children: children }));
8
+ }
9
+ //# sourceMappingURL=reset_button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset_button.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/reset_button.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAM9D,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAE9B,OAAO,CACL,KAAC,MAAM,IAAC,MAAM,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,YAC7D,QAAQ,GACF,CACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ interface SelectOptionType {
2
+ label: string;
3
+ value: string;
4
+ }
5
+ interface SelectProps {
6
+ label?: string;
7
+ items: SelectOptionType[];
8
+ required?: boolean;
9
+ }
10
+ export declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/select.tsx"],"names":[],"mappings":"AAKA,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CA8BxC"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFieldContext } from '../../context/use_ts_form.js';
3
+ import { getIntent } from '../../utils/use_intent.js';
4
+ import { Select as FormGroupSelect } from '../input_groups/select.js';
5
+ export function Select(props) {
6
+ const { label, items, required } = props;
7
+ const field = useFieldContext();
8
+ const error = field
9
+ .getMeta()
10
+ .errors.map((e) => e.message)
11
+ .at(0);
12
+ const intent = getIntent(error);
13
+ function onItemSelect(selected) {
14
+ if (!selected)
15
+ return;
16
+ return field.handleChange(selected);
17
+ }
18
+ return (_jsx(FormGroupSelect, { formGroupProps: {
19
+ required,
20
+ label,
21
+ intent,
22
+ helperText: error ?? undefined,
23
+ }, items: items, onChange: onItemSelect, selected: field.state.value, onBlur: field.handleBlur }));
24
+ }
25
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AActE,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEzC,MAAM,KAAK,GAAG,eAAe,EAAY,CAAC;IAC1C,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,YAAY,CAAC,QAA8B;QAClD,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,OAAO,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,CACL,KAAC,eAAe,IACd,cAAc,EAAE;YACd,QAAQ;YACR,KAAK;YACL,MAAM;YACN,UAAU,EAAE,KAAK,IAAI,SAAS;SAC/B,EACD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAC3B,MAAM,EAAE,KAAK,CAAC,UAAU,GACxB,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ButtonProps } from '../../../button/index.js';
2
+ type SubmitButtonProps = ButtonProps;
3
+ export declare function SubmitButton(props: SubmitButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=submit_button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/submit_button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,KAAK,iBAAiB,GAAG,WAAW,CAAC;AAErC,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAcpD"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useStore } from '@tanstack/react-form';
3
+ import { Button } from '../../../button/index.js';
4
+ import { useFormContext } from '../../context/use_ts_form.js';
5
+ export function SubmitButton(props) {
6
+ const { intent, ...otherProps } = props;
7
+ const form = useFormContext();
8
+ const isSubmitting = useStore(form.store, (state) => state.isSubmitting);
9
+ return (_jsx(Button, { ...otherProps, intent: intent ?? 'primary', type: "submit", disabled: isSubmitting }));
10
+ }
11
+ //# sourceMappingURL=submit_button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit_button.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/submit_button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI9D,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEzE,OAAO,CACL,KAAC,MAAM,OACD,UAAU,EACd,MAAM,EAAE,MAAM,IAAI,SAAS,EAC3B,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,YAAY,GACtB,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ interface SwitchProps {
2
+ label?: string;
3
+ }
4
+ export declare function Switch(props: SwitchProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/switch.tsx"],"names":[],"mappings":"AAKA,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuBxC"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FormGroup, Switch as BPSwitch } from '@blueprintjs/core';
3
+ import { useFieldContext } from '../../context/use_ts_form.js';
4
+ export function Switch(props) {
5
+ const { label } = props;
6
+ const field = useFieldContext();
7
+ const error = field
8
+ .getMeta()
9
+ .errors.map((e) => e.message)
10
+ .at(0);
11
+ function onChange(event) {
12
+ return field.handleChange(event.target.checked);
13
+ }
14
+ return (_jsx(FormGroup, { helperText: error ?? undefined, intent: "danger", children: _jsx(BPSwitch, { checked: field.state.value, onChange: onChange, onBlur: field.handleBlur, labelElement: label }) }));
15
+ }
16
+ //# sourceMappingURL=switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAM/D,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAExB,MAAM,KAAK,GAAG,eAAe,EAAW,CAAC;IACzC,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,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IAAC,UAAU,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,EAAC,QAAQ,YACxD,KAAC,QAAQ,IACP,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAC1B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,CAAC,UAAU,EACxB,YAAY,EAAE,KAAK,GACnB,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ChangeEvent } from 'react';
2
+ interface InputProps {
3
+ error?: string;
4
+ required?: boolean;
5
+ id?: string;
6
+ name: string;
7
+ type?: string;
8
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
9
+ onBlur: () => void;
10
+ value: string;
11
+ placeholder?: string;
12
+ formGroupProps: {
13
+ label?: string;
14
+ className?: string;
15
+ inline?: boolean;
16
+ };
17
+ }
18
+ export declare function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIzC,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAwCtC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FormGroup, InputGroup } from '@blueprintjs/core';
3
+ import { useInputId } from '../hooks/use_input_id.js';
4
+ export function Input(props) {
5
+ const { id, required = false, error, formGroupProps: { className, inline = false, label }, name, onBlur, onChange, type = 'text', value, placeholder, } = props;
6
+ const finalId = useInputId(id, name);
7
+ return (_jsx(FormGroup, { helperText: error ?? undefined, label: label, labelFor: finalId, intent: "danger", style: { margin: 0, position: 'relative' }, className: className, inline: inline, labelInfo: required && _jsx("span", { style: { color: 'red' }, children: "*" }), children: _jsx(InputGroup, { id: finalId, name: name, required: required, type: type, onChange: onChange, onBlur: onBlur, intent: error ? 'danger' : 'none', value: value, placeholder: placeholder }) }));
8
+ }
9
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAmBtD,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,MAAM,EACJ,EAAE,EACF,QAAQ,GAAG,KAAK,EAChB,KAAK,EACL,cAAc,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,KAAK,EAAE,EACpD,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,IAAI,GAAG,MAAM,EACb,KAAK,EACL,WAAW,GACZ,GAAG,KAAK,CAAC;IAEV,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,KAAC,SAAS,IACR,UAAU,EAAE,KAAK,IAAI,SAAS,EAC9B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAC,QAAQ,EACf,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAC1C,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,QAAQ,IAAI,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAU,YAE9D,KAAC,UAAU,IACT,EAAE,EAAE,OAAO,EACX,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EACjC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,GACxB,GACQ,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { FormGroupProps } from '@blueprintjs/core';
2
+ import { FormGroup } from '@blueprintjs/core';
3
+ import type { SelectProps as BPSelectProps } from '@blueprintjs/select';
4
+ import type { ComponentProps, ReactElement, ReactNode } from 'react';
5
+ import type { GetOptionLabel, GetOptionValue, SelectId, SelectOption, SelectOptionLabel } from '../util/select.js';
6
+ type FieldGroupProps = Pick<FormGroupProps, 'label' | 'inline'>;
7
+ export interface SelectPropsRenderButtonState<OptionType> {
8
+ error: string | undefined;
9
+ selectedOption: OptionType | undefined;
10
+ }
11
+ interface SelectCustomProps<OptionType, ID extends SelectId> {
12
+ renderButton?: (state: SelectPropsRenderButtonState<OptionType>) => ReactNode;
13
+ onChange?: (selected: ID | undefined, option: OptionType | undefined) => void;
14
+ id?: string;
15
+ selected?: ID;
16
+ required?: boolean;
17
+ }
18
+ type SelectGetValue<OptionType, ID extends SelectId> = {
19
+ /**
20
+ * Optional if OptionType extends SelectOption<ID>
21
+ * @default getSelectValue
22
+ */
23
+ getValue: GetOptionValue<OptionType, ID>;
24
+ };
25
+ type SelectGetValueProps<OptionType, ID extends SelectId> = OptionType extends SelectOption<ID> ? Partial<SelectGetValue<OptionType, ID>> : SelectGetValue<OptionType, ID>;
26
+ type SelectGetLabel<OptionType> = {
27
+ /**
28
+ * Optional if OptionType extends SelectOptionLabel
29
+ * @default getSelectLabel
30
+ */
31
+ getLabel: GetOptionLabel<OptionType>;
32
+ };
33
+ type SelectGetLabelProps<OptionType> = OptionType extends SelectOptionLabel ? Partial<SelectGetLabel<OptionType>> : SelectGetLabel<OptionType>;
34
+ export type SelectProps<OptionType, ID extends SelectId> = FieldGroupProps & Pick<BPSelectProps<OptionType>, 'placeholder' | 'items' | 'className' | 'disabled' | 'popoverProps' | 'filterable' | 'itemDisabled' | 'itemListPredicate' | 'resetOnClose'> & Pick<ComponentProps<typeof FormGroup>, 'helperText' | 'intent'> & SelectCustomProps<OptionType, ID> & SelectGetValueProps<OptionType, ID> & SelectGetLabelProps<OptionType>;
35
+ /**
36
+ * A wrapper for the BlueprintJS Select component that integrates with react-hook-form.
37
+ * Store in form the selected value.
38
+ * Find selected option getValue.
39
+ * Display options with getLabel.
40
+ *
41
+ * @param props
42
+ * @constructor
43
+ */
44
+ interface RealSelectProps<OptionType, ID extends SelectId> extends Pick<BPSelectProps<OptionType>, 'filterable' | 'items'> {
45
+ onBlur: () => void;
46
+ id?: string;
47
+ renderButton?: (state: SelectPropsRenderButtonState<OptionType>, onBlur: () => void) => ReactNode;
48
+ disabled?: boolean;
49
+ selected?: ID;
50
+ onChange?: (selected: ID | undefined, option: OptionType | undefined) => void;
51
+ getLabel?: GetOptionLabel<OptionType>;
52
+ getValue?: GetOptionValue<OptionType, ID>;
53
+ formGroupProps: Pick<ComponentProps<typeof FormGroup>, 'helperText' | 'intent' | 'label' | 'className' | 'inline'> & {
54
+ required?: boolean;
55
+ };
56
+ }
57
+ export declare function Select<OptionType extends SelectOption<ID>, ID extends SelectId>(props: RealSelectProps<OptionType, ID>): ReactElement;
58
+ export {};
59
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKrE,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAO3B,KAAK,eAAe,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;AAEhE,MAAM,WAAW,4BAA4B,CAAC,UAAU;IACtD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,cAAc,EAAE,UAAU,GAAG,SAAS,CAAC;CACxC;AAED,UAAU,i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/jsx-runtime";
2
+ import { FormGroup } from '@blueprintjs/core';
3
+ import { Select as BPSelect } from '@blueprintjs/select';
4
+ import { useCallback, useMemo } from 'react';
5
+ import { Button } from '../../../button/index.js';
6
+ import { useInputId } from '../hooks/use_input_id.js';
7
+ import { getItemRenderer, getSelectLabel, getSelectValue, } from '../util/select.js';
8
+ export function Select(props) {
9
+ const { renderButton, id, disabled, selected, getLabel: _getLabel, getValue: _getValue, formGroupProps: { className, helperText, inline, intent, label, required },
10
+ // Weirdly, setting the filterable prop on BP's Select component activates the filter input
11
+ filterable = false, items, onChange, onBlur, } = props;
12
+ const getValue = _getValue ?? getSelectValue;
13
+ const getLabel = _getLabel ?? getSelectLabel;
14
+ const selectedOption = useMemo(() => items.find((item) => getValue(item) === selected), [getValue, items, selected]);
15
+ const itemRenderer = useMemo(() => {
16
+ return getItemRenderer({
17
+ selected,
18
+ getValue,
19
+ getLabel,
20
+ });
21
+ }, [getLabel, getValue, selected]);
22
+ const onItemSelect = useCallback((option) => {
23
+ const value = getValue(option);
24
+ onChange?.(value, option);
25
+ }, [getValue, onChange]);
26
+ const inputId = useInputId(id, null);
27
+ return (_jsx(FormGroup, { label: label, labelFor: inputId, helperText: helperText, intent: intent, style: { margin: 0, position: 'relative' }, className: className, inline: inline, disabled: disabled, labelInfo: required && _jsx("span", { style: { color: 'red' }, children: "*" }), children: _jsx(BPSelect, { filterable: filterable, items: items, onItemSelect: onItemSelect, itemRenderer: itemRenderer, disabled: disabled, children: renderButton ? (renderButton({ selectedOption, error: undefined }, onBlur)) : (_jsx(Button, { id: inputId, text: getLabel(selectedOption) || 'Select ...', endIcon: "double-caret-vertical", variant: "outlined", intent: intent, disabled: disabled, style: { minWidth: 180 }, onBlur: onBlur })) }) }));
28
+ }
29
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/select.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAA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+1,20 @@
1
+ import type { ItemRenderer } from '@blueprintjs/select';
2
+ import type { ReactNode } from 'react';
3
+ export type SelectId = string | number | null;
4
+ export type GetOptionValue<OptionType, ID extends SelectId> = (option: OptionType | undefined) => ID | undefined;
5
+ export type GetOptionLabel<OptionType> = (option: OptionType | undefined) => ReactNode;
6
+ export interface GetItemRendererOptions<OptionType, ID extends SelectId> {
7
+ selected: ID | undefined;
8
+ getValue: GetOptionValue<OptionType, ID>;
9
+ getLabel: GetOptionLabel<OptionType>;
10
+ }
11
+ export declare function getItemRenderer<OptionType, ID extends SelectId>(options: GetItemRendererOptions<OptionType, ID>): ItemRenderer<OptionType>;
12
+ export interface SelectOptionLabel {
13
+ label: string;
14
+ }
15
+ export declare function getSelectLabel(option: SelectOptionLabel | undefined): string | undefined;
16
+ export interface SelectOption<ID> extends SelectOptionLabel {
17
+ value: ID;
18
+ }
19
+ export declare function getSelectValue<Option extends SelectOption<unknown>>(option: Option | undefined): Option['value'] | undefined;
20
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/util/select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE9C,MAAM,MAAM,cAAc,CAAC,UAAU,EAAE,EAAE,SAAS,QAAQ,IAAI,CAC5D,MAAM,EAAE,UAAU,GAAG,SAAS,KAC3B,EAAE,GAAG,SAAS,CAAC;AACpB,MAAM,MAAM,cAAc,CAAC,UAAU,IAAI,CACvC,MAAM,EAAE,UAAU,GAAG,SAAS,KAC3B,SAAS,CAAC;AAEf,MAAM,WAAW,sBAAsB,CAAC,UAAU,EAAE,EAAE,SAAS,QAAQ;IACrE,QAAQ,EAAE,EAAE,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACzC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CACtC;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,EAAE,SAAS,QAAQ,EAC7D,OAAO,EAAE,sBAAsB,CAAC,UAAU,EAAE,EAAE,CAAC,4BA0BhD;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACpC,MAAM,GAAG,SAAS,CAEpB;AAED,MAAM,WAAW,YAAY,CAAC,EAAE,CAAE,SAAQ,iBAAiB;IACzD,KAAK,EAAE,EAAE,CAAC;CACX;AAED,wBAAgB,cAAc,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,EACjE,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,CAAC,OAAO,CAAC,GAAG,SAAS,CAE7B"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MenuItem } from '@blueprintjs/core';
3
+ export function getItemRenderer(options) {
4
+ const { selected, getValue, getLabel } = options;
5
+ const render = (item, { handleClick, handleFocus, modifiers, index }) => {
6
+ const label = getLabel(item);
7
+ const { active, disabled, matchesPredicate } = modifiers;
8
+ if (!matchesPredicate)
9
+ return null;
10
+ return (_jsx(MenuItem, { active: active, disabled: disabled, selected: selected === getValue(item), onClick: handleClick, onFocus: handleFocus, roleStructure: "listoption", text: label }, index));
11
+ };
12
+ return render;
13
+ }
14
+ export function getSelectLabel(option) {
15
+ return option?.label;
16
+ }
17
+ export function getSelectValue(option) {
18
+ return option?.value;
19
+ }
20
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../../src/components/form/components/util/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAmB7C,MAAM,UAAU,eAAe,CAC7B,OAA+C;IAE/C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEjD,MAAM,MAAM,GAA6B,CACvC,IAAI,EACJ,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,EAC9C,EAAE;QACF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAAC;QACzD,IAAI,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,CACL,KAAC,QAAQ,IACP,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KAAK,QAAQ,CAAC,IAAI,CAAC,EAErC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,aAAa,EAAC,YAAY,EAC1B,IAAI,EAAE,KAAK,IAJN,KAAK,CAKV,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAMD,MAAM,UAAU,cAAc,CAC5B,MAAqC;IAErC,OAAO,MAAM,EAAE,KAAK,CAAC;AACvB,CAAC;AAMD,MAAM,UAAU,cAAc,CAC5B,MAA0B;IAE1B,OAAO,MAAM,EAAE,KAAK,CAAC;AACvB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Checkbox } from '../components/input/checkbox.js';
2
+ import { Input } from '../components/input/input.js';
3
+ import { NumericInput } from '../components/input/numeric_input.js';
4
+ import { ResetButton } from '../components/input/reset_button.js';
5
+ import { Select } from '../components/input/select.js';
6
+ import { SubmitButton } from '../components/input/submit_button.js';
7
+ import { Switch } from '../components/input/switch.js';
8
+ declare const useFormContext: () => import("@tanstack/react-form").ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>, useFieldContext: <TData>() => import("@tanstack/react-form").FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
9
+ declare const withForm: <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, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
10
+ readonly Input: typeof Input;
11
+ readonly NumericInput: typeof NumericInput;
12
+ readonly Checkbox: typeof Checkbox;
13
+ readonly Select: typeof Select;
14
+ readonly Switch: typeof Switch;
15
+ }, {
16
+ readonly SubmitButton: typeof SubmitButton;
17
+ readonly ResetButton: typeof ResetButton;
18
+ }, TRenderProps>) => (props: import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
19
+ form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
20
+ readonly Input: typeof Input;
21
+ readonly NumericInput: typeof NumericInput;
22
+ readonly Checkbox: typeof Checkbox;
23
+ readonly Select: typeof Select;
24
+ readonly Switch: typeof Switch;
25
+ }, {
26
+ readonly SubmitButton: typeof SubmitButton;
27
+ readonly ResetButton: typeof ResetButton;
28
+ }>;
29
+ }>) => import("react").JSX.Element;
30
+ 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, {
31
+ readonly Input: typeof Input;
32
+ readonly NumericInput: typeof NumericInput;
33
+ readonly Checkbox: typeof Checkbox;
34
+ readonly Select: typeof Select;
35
+ readonly Switch: typeof Switch;
36
+ }, {
37
+ readonly SubmitButton: typeof SubmitButton;
38
+ readonly ResetButton: typeof ResetButton;
39
+ }>;
40
+ export { useFieldContext, useFormContext, withForm };
41
+ //# sourceMappingURL=use_ts_form.d.ts.map
@@ -0,0 +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;AAEvD,QAAA,MAAQ,cAAc,2IAAE,eAAe,8KACb,CAAC;AAE3B,QAAA,MAAoB,QAAQ;;;;;;;;;;;;;;;;;;;;kCAc1B,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;EAAa,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { createFormHook, createFormHookContexts } from '@tanstack/react-form';
2
+ import { Checkbox } from '../components/input/checkbox.js';
3
+ import { Input } from '../components/input/input.js';
4
+ import { NumericInput } from '../components/input/numeric_input.js';
5
+ import { ResetButton } from '../components/input/reset_button.js';
6
+ import { Select } from '../components/input/select.js';
7
+ import { SubmitButton } from '../components/input/submit_button.js';
8
+ import { Switch } from '../components/input/switch.js';
9
+ const { useFormContext, useFieldContext, formContext, fieldContext } = createFormHookContexts();
10
+ const { useAppForm, withForm } = createFormHook({
11
+ fieldContext,
12
+ formContext,
13
+ formComponents: {
14
+ SubmitButton,
15
+ ResetButton,
16
+ },
17
+ fieldComponents: {
18
+ Input,
19
+ NumericInput,
20
+ Checkbox,
21
+ Select,
22
+ Switch,
23
+ },
24
+ });
25
+ export const useForm = useAppForm;
26
+ export { useFieldContext, useFormContext, withForm };
27
+ //# sourceMappingURL=use_ts_form.js.map
@@ -0,0 +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,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;AAEvD,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;KACZ;IACD,eAAe,EAAE;QACf,KAAK;QACL,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,MAAM;KACP;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function useFieldId(fieldName: string): string;
2
+ //# sourceMappingURL=use_field_id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_field_id.d.ts","sourceRoot":"","sources":["../../../../src/components/form/utils/use_field_id.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,UAE3C"}
@@ -0,0 +1,5 @@
1
+ import { useId } from 'react';
2
+ export function useFieldId(fieldName) {
3
+ return `input-${fieldName}-${useId()}`;
4
+ }
5
+ //# sourceMappingURL=use_field_id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_field_id.js","sourceRoot":"","sources":["../../../../src/components/form/utils/use_field_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,SAAS,SAAS,IAAI,KAAK,EAAE,EAAE,CAAC;AACzC,CAAC"}