react-science 20.4.0 → 20.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.
- package/lib/components/accordion/accordion_context_provider.d.ts.map +1 -1
- package/lib/components/accordion/accordion_context_provider.js +1 -1
- package/lib/components/accordion/accordion_context_provider.js.map +1 -1
- package/lib/components/button/Button.d.ts.map +1 -1
- package/lib/components/color-picker/gradient_select/gradient_select.utils.d.ts.map +1 -1
- package/lib/components/color-picker/gradient_select/gradient_select.utils.js.map +1 -1
- package/lib/components/color-picker/index.d.ts +2 -0
- package/lib/components/color-picker/index.d.ts.map +1 -1
- package/lib/components/color-picker/index.js +1 -0
- package/lib/components/color-picker/index.js.map +1 -1
- package/lib/components/color-picker/preview/ColorPreview.d.ts +1 -8
- package/lib/components/color-picker/preview/ColorPreview.d.ts.map +1 -1
- package/lib/components/color-picker/preview/ColorPreview.js +1 -1
- package/lib/components/color-picker/preview/ColorPreview.js.map +1 -1
- package/lib/components/color-picker/preview/color_config.d.ts +14 -0
- package/lib/components/color-picker/preview/color_config.d.ts.map +1 -0
- package/lib/components/color-picker/preview/color_config.js +11 -0
- package/lib/components/color-picker/preview/color_config.js.map +1 -0
- package/lib/components/draggable/draggable.d.ts +18 -0
- package/lib/components/draggable/draggable.d.ts.map +1 -0
- package/lib/components/draggable/draggable.js +70 -0
- package/lib/components/draggable/draggable.js.map +1 -0
- package/lib/components/form/components/field_groups/svg_line_style.d.ts +2 -0
- package/lib/components/form/components/field_groups/svg_line_style.d.ts.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.d.ts +2 -0
- package/lib/components/form/components/field_groups/svg_text_style.d.ts.map +1 -1
- package/lib/components/form/components/input/draggable_numeric_input.d.ts +10 -0
- package/lib/components/form/components/input/draggable_numeric_input.d.ts.map +1 -0
- package/lib/components/form/components/input/draggable_numeric_input.js +29 -0
- package/lib/components/form/components/input/draggable_numeric_input.js.map +1 -0
- package/lib/components/form/components/input/index.d.ts +1 -0
- package/lib/components/form/components/input/index.d.ts.map +1 -1
- package/lib/components/form/components/input/numeric_input.d.ts +1 -2
- package/lib/components/form/components/input/numeric_input.d.ts.map +1 -1
- package/lib/components/form/components/input/numeric_input.js.map +1 -1
- package/lib/components/form/components/input_groups/form_group.d.ts +1 -0
- package/lib/components/form/components/input_groups/form_group.d.ts.map +1 -1
- package/lib/components/form/components/input_groups/form_group.js +4 -4
- package/lib/components/form/components/input_groups/form_group.js.map +1 -1
- package/lib/components/form/components/layout/form.d.ts +11 -0
- package/lib/components/form/components/layout/form.d.ts.map +1 -1
- package/lib/components/form/components/layout/form.js +3 -1
- package/lib/components/form/components/layout/form.js.map +1 -1
- package/lib/components/form/context/use_ts_form.d.ts +7 -0
- package/lib/components/form/context/use_ts_form.d.ts.map +1 -1
- package/lib/components/form/context/use_ts_form.js +2 -0
- package/lib/components/form/context/use_ts_form.js.map +1 -1
- package/lib/components/hooks/useSelect.d.ts.map +1 -1
- package/lib/components/hooks/useSelect.js.map +1 -1
- package/lib/components/table/reorder_rows/draggable_row_tr.js +1 -1
- package/lib/components/table/reorder_rows/draggable_row_tr.js.map +1 -1
- package/lib/components/table/reorder_rows/use_drop_monitor.d.ts.map +1 -1
- package/lib/components/table/reorder_rows/use_drop_monitor.js +1 -1
- package/lib/components/table/reorder_rows/use_drop_monitor.js.map +1 -1
- package/lib/components/table/table_root.d.ts.map +1 -1
- package/lib/components/table/table_root.js.map +1 -1
- package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/toolbar/Toolbar.js.map +1 -1
- package/lib/components/utils/assert.d.ts +13 -0
- package/lib/components/utils/assert.d.ts.map +1 -1
- package/lib/components/utils/assert.js +13 -0
- package/lib/components/utils/assert.js.map +1 -1
- package/lib/components/utils/svg.js +1 -1
- package/lib/components/utils/svg.js.map +1 -1
- package/package.json +26 -25
- package/src/components/accordion/accordion_context_provider.tsx +1 -2
- package/src/components/button/Button.tsx +3 -3
- package/src/components/color-picker/gradient_select/gradient_select.utils.ts +1 -5
- package/src/components/color-picker/index.ts +5 -0
- package/src/components/color-picker/preview/ColorPreview.tsx +2 -6
- package/src/components/color-picker/preview/color_config.ts +29 -0
- package/src/components/draggable/draggable.tsx +127 -0
- package/src/components/form/components/input/draggable_numeric_input.tsx +107 -0
- package/src/components/form/components/input/index.ts +1 -0
- package/src/components/form/components/input/numeric_input.tsx +2 -1
- package/src/components/form/components/input_groups/form_group.tsx +10 -3
- package/src/components/form/components/layout/form.tsx +20 -2
- package/src/components/form/context/use_ts_form.ts +2 -0
- package/src/components/hooks/useSelect.tsx +1 -2
- package/src/components/table/reorder_rows/draggable_row_tr.tsx +1 -1
- package/src/components/table/reorder_rows/use_drop_monitor.ts +1 -1
- package/src/components/table/table_root.tsx +1 -2
- package/src/components/toolbar/Toolbar.tsx +1 -4
- package/src/components/utils/assert.ts +13 -0
- package/src/components/utils/svg.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion_context_provider.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context_provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accordion_context_provider.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context_provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BA+D9D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { assert } from '@zakodium/utils';
|
|
2
3
|
import { useMemo, useRef } from 'react';
|
|
3
|
-
import { assert } from '../utils/index.js';
|
|
4
4
|
import { accordionContext } from './accordion_context.js';
|
|
5
5
|
import { getAccordionRegister } from './accordion_context_utils.js';
|
|
6
6
|
export function AccordionProvider(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion_context_provider.js","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context_provider.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"accordion_context_provider.js","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context_provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAOpE,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,eAAe,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACpD,MAAM,WAAW,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAEnD,MAAM,KAAK,GAAG,OAAO,CAA2B,GAAG,EAAE;QACnD,OAAO;YACL,MAAM,EAAE,CAAC,EAAU,EAAE,MAAe,EAAE,EAAE;gBACtC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC5B,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACzC,IAAI,IAAI,EAAE,CAAC;oBACT,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;YACD,cAAc,EAAE,CAAC,EAAU,EAAE,EAAE;gBAC7B,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC5B,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;oBACxD,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;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AAe,EAAE,KAAK,CAAC,CAAC,CAAC;IAE7B,OAAO,CACL,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,QAAQ,GACiB,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,0BAA0B,EAC/C,WAAW,IAAI,oBAAoB,EACnC,QAAQ,EACR,YAAY,EACb,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,cAAc,GAAG;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,0BAA0B,EAC/C,WAAW,IAAI,oBAAoB,EACnC,QAAQ,EACR,YAAY,EACb,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,cAAc,GAAG;KAElB,GAAG,IAAI,MAAM,oBAAoB,GAAG,MAAM,0BAA0B,CACrE,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,GAAG,0BAA0B,CAAC,GAAG,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IACvE,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;CACvC,CAAC;AAmDF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAmCxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient_select.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/gradient_select/gradient_select.utils.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"gradient_select.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/gradient_select/gradient_select.utils.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAC3B,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,iBAAiB,EACjB,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAOtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient_select.utils.js","sourceRoot":"","sources":["../../../../src/components/color-picker/gradient_select/gradient_select.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"gradient_select.utils.js","sourceRoot":"","sources":["../../../../src/components/color-picker/gradient_select/gradient_select.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,oBAAoB,CAAC;AAKrD,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,KAAK,EAAE,cAAc,CAAC,gBAAgB;IACtC,OAAO,EAAE,cAAc,CAAC,kBAAkB;IAC1C,OAAO,EAAE,cAAc,CAAC,kBAAkB;IAC1C,KAAK,EAAE,cAAc,CAAC,gBAAgB;IACtC,MAAM,EAAE,cAAc,CAAC,iBAAiB;CACzC,CAAC"}
|
|
@@ -3,4 +3,6 @@ export * from './gradient_select/index.js';
|
|
|
3
3
|
export * from './preview/ColorPreview.js';
|
|
4
4
|
export * from './react-color/ColorPicker.js';
|
|
5
5
|
export * from './palette.js';
|
|
6
|
+
export { assertColorFixed, assertColorGradient, } from './preview/color_config.ts';
|
|
7
|
+
export type { ColorConfig } from './preview/color_config.ts';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/color-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/color-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -3,4 +3,5 @@ export * from './gradient_select/index.js';
|
|
|
3
3
|
export * from './preview/ColorPreview.js';
|
|
4
4
|
export * from './react-color/ColorPicker.js';
|
|
5
5
|
export * from './palette.js';
|
|
6
|
+
export { assertColorFixed, assertColorGradient, } from "./preview/color_config.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/color-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/color-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type ColorConfig = {
|
|
3
|
-
kind: 'fixed';
|
|
4
|
-
color: string;
|
|
5
|
-
} | {
|
|
6
|
-
kind: 'fixedGradient';
|
|
7
|
-
gradient: GradientScaleName;
|
|
8
|
-
};
|
|
1
|
+
import type { ColorConfig } from './color_config.ts';
|
|
9
2
|
export interface ColorPreviewProps {
|
|
10
3
|
color: ColorConfig;
|
|
11
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPreview.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/preview/ColorPreview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColorPreview.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/preview/ColorPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAYpD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { assertUnreachable } from '
|
|
2
|
+
import { assertUnreachable } from '@zakodium/utils';
|
|
3
3
|
import FixedColorPreview from './FixedColorPreview.js';
|
|
4
4
|
import FixedGradientPreview from './FixedGradientPreview.js';
|
|
5
5
|
export function ColorPreview(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPreview.js","sourceRoot":"","sources":["../../../../src/components/color-picker/preview/ColorPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ColorPreview.js","sourceRoot":"","sources":["../../../../src/components/color-picker/preview/ColorPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAO7D,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CAAC;QACnD,CAAC;QACD,KAAK,eAAe,CAAC,CAAC,CAAC;YACrB,OAAO,KAAC,oBAAoB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;QAC5D,CAAC;QACD;YACE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GradientScaleName } from '../gradient_select/index.ts';
|
|
2
|
+
interface ColorConfigFixed {
|
|
3
|
+
kind: 'fixed';
|
|
4
|
+
color: string;
|
|
5
|
+
}
|
|
6
|
+
interface ColorConfigGradient {
|
|
7
|
+
kind: 'fixedGradient';
|
|
8
|
+
gradient: GradientScaleName;
|
|
9
|
+
}
|
|
10
|
+
export type ColorConfig = ColorConfigFixed | ColorConfigGradient;
|
|
11
|
+
export declare function assertColorFixed(color: ColorConfig): asserts color is ColorConfigFixed;
|
|
12
|
+
export declare function assertColorGradient(color: ColorConfig): asserts color is ColorConfigGradient;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=color_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color_config.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/preview/color_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,UAAU,gBAAgB;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAEjE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,KAAK,IAAI,gBAAgB,CAInC;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,KAAK,IAAI,mBAAmB,CAItC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function assertColorFixed(color) {
|
|
2
|
+
if (color.kind !== 'fixed') {
|
|
3
|
+
throw new Error('Only fixed colors are supported');
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export function assertColorGradient(color) {
|
|
7
|
+
if (color.kind !== 'fixedGradient') {
|
|
8
|
+
throw new Error('Only fixed colors are supported');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=color_config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color_config.js","sourceRoot":"","sources":["../../../../src/components/color-picker/preview/color_config.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,gBAAgB,CAC9B,KAAkB;IAElB,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,KAAkB;IAElB,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Intent } from '@blueprintjs/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
interface DraggableProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
value: number;
|
|
6
|
+
onChange: (_: number, value: string) => void;
|
|
7
|
+
onBlur: () => void;
|
|
8
|
+
step?: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
intent: Intent;
|
|
12
|
+
majorStepSize?: number | null;
|
|
13
|
+
minorStepSize?: number | null;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function Draggable(props: DraggableProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=draggable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable.d.ts","sourceRoot":"","sources":["../../../src/components/draggable/draggable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,KAAK,EAAiC,SAAS,EAAE,MAAM,OAAO,CAAC;AAItE,UAAU,cAAc;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BA+E9C"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Classes, Utils } from '@blueprintjs/core';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { clamp } from '@zakodium/utils';
|
|
5
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
6
|
+
import { match } from 'ts-pattern';
|
|
7
|
+
const DraggableContainer = styled.div `
|
|
8
|
+
width: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
user-select: none;
|
|
13
|
+
cursor: ew-resize;
|
|
14
|
+
height: 100%;
|
|
15
|
+
min-height: 30px;
|
|
16
|
+
`;
|
|
17
|
+
const DraggableLabel = styled.span `
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
text-overflow: ellipsis;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
padding-left: 5px;
|
|
23
|
+
padding-right: 5px;
|
|
24
|
+
`;
|
|
25
|
+
export function Draggable(props) {
|
|
26
|
+
const { children, value, onChange, onBlur, step: stepSize = 1, min, max, intent, majorStepSize, minorStepSize, className, } = props;
|
|
27
|
+
const draggedValueRef = useRef(value);
|
|
28
|
+
const onChangeRef = useRef(onChange);
|
|
29
|
+
const previousPositionRef = useRef(0);
|
|
30
|
+
const isDraggingRef = useRef(false);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
function handleMouseMove(event) {
|
|
33
|
+
if (!isDraggingRef.current)
|
|
34
|
+
return;
|
|
35
|
+
const diff = event.clientX - previousPositionRef.current;
|
|
36
|
+
previousPositionRef.current = event.clientX;
|
|
37
|
+
if (event.buttons === 1) {
|
|
38
|
+
const step = match(event)
|
|
39
|
+
.with({ shiftKey: true }, () => majorStepSize ?? stepSize)
|
|
40
|
+
.with({ altKey: true }, () => minorStepSize ?? stepSize)
|
|
41
|
+
.otherwise(() => stepSize);
|
|
42
|
+
const precision = Math.max(Utils.countDecimalPlaces(draggedValueRef.current), Utils.countDecimalPlaces(minorStepSize ?? stepSize));
|
|
43
|
+
const nextValue = toMaxPrecision(draggedValueRef.current + diff * step, precision);
|
|
44
|
+
draggedValueRef.current = clamp(nextValue, min, max);
|
|
45
|
+
onChangeRef.current(0, String(draggedValueRef.current));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function handleMouseUp() {
|
|
49
|
+
isDraggingRef.current = false;
|
|
50
|
+
onBlur();
|
|
51
|
+
}
|
|
52
|
+
window.addEventListener('mousemove', handleMouseMove);
|
|
53
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
54
|
+
return () => {
|
|
55
|
+
window.removeEventListener('mousemove', handleMouseMove);
|
|
56
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
57
|
+
};
|
|
58
|
+
}, [majorStepSize, max, min, minorStepSize, onBlur, stepSize]);
|
|
59
|
+
const handleMouseDown = useCallback((event) => {
|
|
60
|
+
isDraggingRef.current = true;
|
|
61
|
+
previousPositionRef.current = event.clientX;
|
|
62
|
+
draggedValueRef.current = value;
|
|
63
|
+
}, [value]);
|
|
64
|
+
return (_jsx(DraggableContainer, { onMouseDown: handleMouseDown, className: `${className} ${Classes.TAG} ${Classes.MINIMAL} ${Classes.intentClass(intent)}`, children: _jsx(DraggableLabel, { children: children }) }));
|
|
65
|
+
}
|
|
66
|
+
function toMaxPrecision(value, maxPrecision) {
|
|
67
|
+
const scaleFactor = 10 ** maxPrecision;
|
|
68
|
+
return Math.round(value * scaleFactor) / scaleFactor;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=draggable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable.js","sourceRoot":"","sources":["../../../src/components/draggable/draggable.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CA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,IAAI,CAAC;QAC7B,mBAAmB,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5C,eAAe,CAAC,OAAO,GAAG,KAAK,CAAC;IAClC,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,OAAO,CACL,KAAC,kBAAkB,IACjB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,YAE1F,KAAC,cAAc,cAAE,QAAQ,GAAkB,GACxB,CACtB,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAE,YAAoB;IACzD,MAAM,WAAW,GAAG,EAAE,IAAI,YAAY,CAAC;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,WAAW,CAAC;AACvD,CAAC"}
|
|
@@ -20,6 +20,7 @@ export declare const FieldGroupSVGLineStyleFields: <TFormData, TFields extends i
|
|
|
20
20
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
21
21
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
22
22
|
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
23
|
+
readonly DraggableNumericInput: typeof import("../input/draggable_numeric_input.tsx").DraggableNumericInput;
|
|
23
24
|
}, {
|
|
24
25
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
25
26
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -32,6 +33,7 @@ export declare const FieldGroupSVGLineStyleFields: <TFormData, TFields extends i
|
|
|
32
33
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
33
34
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
34
35
|
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
36
|
+
readonly DraggableNumericInput: typeof import("../input/draggable_numeric_input.tsx").DraggableNumericInput;
|
|
35
37
|
}, {
|
|
36
38
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
37
39
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_line_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"svg_line_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_line_style.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAqCvC,CAAC"}
|
|
@@ -21,6 +21,7 @@ export declare const FieldGroupSVGTextStyleFields: <TFormData, TFields extends i
|
|
|
21
21
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
22
22
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
23
23
|
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
24
|
+
readonly DraggableNumericInput: typeof import("../input/draggable_numeric_input.tsx").DraggableNumericInput;
|
|
24
25
|
}, {
|
|
25
26
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
26
27
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -33,6 +34,7 @@ export declare const FieldGroupSVGTextStyleFields: <TFormData, TFields extends i
|
|
|
33
34
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
34
35
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
35
36
|
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
37
|
+
readonly DraggableNumericInput: typeof import("../input/draggable_numeric_input.tsx").DraggableNumericInput;
|
|
36
38
|
}, {
|
|
37
39
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
38
40
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg_text_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"svg_text_style.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/field_groups/svg_text_style.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDA4DvC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Intent } from '@blueprintjs/core';
|
|
2
|
+
import type { NumericInputProps } from './numeric_input.tsx';
|
|
3
|
+
interface DraggableNumericInputProps extends NumericInputProps {
|
|
4
|
+
draggableLabel: string;
|
|
5
|
+
draggableIntent?: Intent;
|
|
6
|
+
hideInput?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function DraggableNumericInput(props: DraggableNumericInputProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=draggable_numeric_input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable_numeric_input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/draggable_numeric_input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAShD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,UAAU,0BAA2B,SAAQ,iBAAiB;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAYD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,+BA+EtE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { NumericInput as BPNumericInput } from '@blueprintjs/core';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { Draggable as InputDraggable } from "../../../draggable/draggable.js";
|
|
5
|
+
import { useFieldContext } from "../../context/use_ts_form.js";
|
|
6
|
+
import { getIntent } from "../../utils/use_intent.js";
|
|
7
|
+
import { FormGroup } from "../input_groups/index.js";
|
|
8
|
+
const DraggableNumericInputContainer = styled.div `
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
gap: 5px;
|
|
12
|
+
`;
|
|
13
|
+
const Draggable = styled(InputDraggable) `
|
|
14
|
+
flex: 1;
|
|
15
|
+
`;
|
|
16
|
+
export function DraggableNumericInput(props) {
|
|
17
|
+
const { label, required, helpText, placeholder, step, min, max, layout, fullWidth, draggableLabel, draggableIntent = 'success', hideInput = false, majorStepSize, minorStepSize, ...otherProps } = props;
|
|
18
|
+
const field = useFieldContext();
|
|
19
|
+
const error = field
|
|
20
|
+
.getMeta()
|
|
21
|
+
.errors.map((e) => e.message)
|
|
22
|
+
.at(0);
|
|
23
|
+
const intent = getIntent(error);
|
|
24
|
+
function onChange(_, valueAsString) {
|
|
25
|
+
return field.handleChange(valueAsString);
|
|
26
|
+
}
|
|
27
|
+
return (_jsx(FormGroup, { name: field.name, label: label, intent: intent, required: required, helpText: helpText, layout: layout, error: undefined, fullWidth: fullWidth, contentFullWidth: true, children: _jsxs(DraggableNumericInputContainer, { children: [!hideInput && (_jsx(BPNumericInput, { ...otherProps, id: field.name, name: field.name, stepSize: step, min: min, max: max, majorStepSize: majorStepSize, minorStepSize: minorStepSize, value: field.state.value ?? '', onValueChange: onChange, onBlur: field.handleBlur, intent: intent, placeholder: placeholder, required: required })), _jsx(Draggable, { value: Number(field.state.value), onBlur: field.handleBlur, onChange: onChange, step: step, min: min, max: max, majorStepSize: majorStepSize, minorStepSize: minorStepSize, intent: draggableIntent, children: draggableLabel })] }) }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=draggable_numeric_input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable_numeric_input.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input/draggable_numeric_input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,iCAAkC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAUrD,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIhD,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;;CAEvC,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,GAAG,EACH,GAAG,EACH,MAAM,EACN,SAAS,EACT,cAAc,EACd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EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAChC,MAAM,EAAE,KAAK,CAAC,UAAU,EACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,eAAe,YAEtB,cAAc,GACL,IACmB,GACvB,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -7,4 +7,5 @@ export type { ResetButton as _ResetButton } from './reset_button.js';
|
|
|
7
7
|
export type { Select as _Select, SelectOptionType, SelectProps, } from './select.js';
|
|
8
8
|
export type { SubmitButton as _SubmitButton } from './submit_button.js';
|
|
9
9
|
export type { Switch as _Switch } from './switch.js';
|
|
10
|
+
export type { DraggableNumericInput as _DraggableNumericInput } from './draggable_numeric_input.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,YAAY,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAClD,YAAY,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EACV,MAAM,IAAI,OAAO,EACjB,gBAAgB,EAChB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,YAAY,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAClD,YAAY,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EACV,MAAM,IAAI,OAAO,EACjB,gBAAgB,EAChB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,qBAAqB,IAAI,sBAAsB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { NumericInputProps as BPNumericInputProps } from '@blueprintjs/core';
|
|
2
2
|
import type { FormGroupInputProps } from '../input_groups/form_group.js';
|
|
3
|
-
interface NumericInputProps extends FormGroupInputProps, BPNumericInputProps {
|
|
3
|
+
export interface NumericInputProps extends FormGroupInputProps, BPNumericInputProps {
|
|
4
4
|
step?: number;
|
|
5
5
|
min?: number;
|
|
6
6
|
max?: number;
|
|
7
7
|
autoFocus?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare function NumericInput(props: NumericInputProps): import("react").JSX.Element;
|
|
10
|
-
export {};
|
|
11
10
|
//# sourceMappingURL=numeric_input.d.ts.map
|
|
@@ -1 +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;AAKlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,
|
|
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,MAAM,WAAW,iBACf,SAAQ,mBAAmB,EAAE,mBAAmB;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAqDpD"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,mBAA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AM,EAAE,KAAK,CAAC,UAAU,EACxB,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;
|
|
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;AAgEhD,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;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAuD9C"}
|
|
@@ -8,7 +8,7 @@ const FormContainer = styled.div `
|
|
|
8
8
|
width: 100%;
|
|
9
9
|
display: grid;
|
|
10
10
|
margin: 0;
|
|
11
|
-
grid-template-columns: ${(props) => props.layout === 'inline' ? '[label]
|
|
11
|
+
grid-template-columns: ${(props) => props.layout === 'inline' ? '[label] 3fr [input] 7fr' : '1fr'};
|
|
12
12
|
gap: 5px 20px;
|
|
13
13
|
grid-template-rows: ${(props) => props.layout === 'inline' ? 'auto auto' : 'auto'};
|
|
14
14
|
`;
|
|
@@ -23,7 +23,7 @@ const ContainerElement = styled.div `
|
|
|
23
23
|
? 'input'
|
|
24
24
|
: '1 / -1'};
|
|
25
25
|
height: ${(props) => props.height === 'auto' ? props.height : `${props.height}px`};
|
|
26
|
-
width: fit-content;
|
|
26
|
+
width: ${(props) => (props.contentFullWidth ? '100%' : 'fit-content')};
|
|
27
27
|
min-width: 180px;
|
|
28
28
|
`;
|
|
29
29
|
// Keep 26 px for inline layout to align with input height
|
|
@@ -45,10 +45,10 @@ const HelpText = styled(InfoText) `
|
|
|
45
45
|
color: ${Colors.GRAY1} !important;
|
|
46
46
|
`;
|
|
47
47
|
export function FormGroup(props) {
|
|
48
|
-
const { label, intent = 'none', name, required, children, helpText, error, layout, fullWidth = false, } = props;
|
|
48
|
+
const { label, intent = 'none', name, required, children, helpText, error, layout, fullWidth = false, contentFullWidth = false, } = props;
|
|
49
49
|
const { layout: formLayout } = useFormContext();
|
|
50
50
|
// If intent is undefined or none intentClass will return undefined
|
|
51
51
|
const intentClass = Classes.intentClass(intent) ?? '';
|
|
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 }))] })] })] }));
|
|
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, contentFullWidth: contentFullWidth, 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 }))] })] })] }));
|
|
53
53
|
}
|
|
54
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,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;;wBAEzC,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,
|
|
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;;wBAEzC,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,CAKjC;;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,CAAC,CAAC,GAAG,KAA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AC,UAAU,IAAI,WAAW,EAAE,aAEhD,KAAK,IAAI,CACR,MAAC,KAAK,IACJ,MAAM,EAAE,MAAM,IAAI,UAAU,EAC5B,SAAS,EAAE,OAAO,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,IACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,IAAI,UAAU,EAC5B,gBAAgB,EAAE,gBAAgB,aAEjC,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"}
|
|
@@ -4,8 +4,18 @@ export interface AppFormProps extends Omit<DomFormProps, 'noValidate'> {
|
|
|
4
4
|
domValidate?: boolean;
|
|
5
5
|
/**
|
|
6
6
|
* should return meta to pass to `form.handleSubmit`
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* onSubmitMeta={(event) => event.nativeEvent.submitter?.dataset.action}
|
|
11
|
+
* ```
|
|
7
12
|
*/
|
|
8
13
|
onSubmitMeta?: (event: SyntheticEvent<HTMLFormElement, SubmitEvent>) => any;
|
|
14
|
+
/**
|
|
15
|
+
* onSubmit form will call `event.stopPropagation()`.
|
|
16
|
+
* It can be useful for nested form.
|
|
17
|
+
*/
|
|
18
|
+
onSubmitStopPropagation?: boolean;
|
|
9
19
|
}
|
|
10
20
|
/**
|
|
11
21
|
* Mount `form.AppForm` and `Form` with default onSubmit.
|
|
@@ -20,6 +30,7 @@ export declare const AppForm: MinimalFunctionComponent<MinimalProps<import("reac
|
|
|
20
30
|
readonly Switch: typeof import("../input/switch.tsx").Switch;
|
|
21
31
|
readonly ColorPicker: typeof import("../input/color_picker.tsx").ColorPicker;
|
|
22
32
|
readonly RadioGroup: typeof import("../input/radio_group.tsx").RadioGroup;
|
|
33
|
+
readonly DraggableNumericInput: typeof import("../input/draggable_numeric_input.tsx").DraggableNumericInput;
|
|
23
34
|
}, {
|
|
24
35
|
readonly SubmitButton: typeof import("../input/submit_button.tsx").SubmitButton;
|
|
25
36
|
readonly ResetButton: typeof import("../input/reset_button.tsx").ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,KAAK,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGzE,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,KAAK,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGzE,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IAGH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC,KAAK,GAAG,CAAC;IAE5E;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAWD;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;IAuCnB,CAAC;AAEF,KAAK,YAAY,CAAC,KAAK,SAAS;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG;IACzE;;OAEG;IACH,IAAI,EAAE,IAAI,CACR,KAAK,CAAC,MAAM,CAAC,EAKb,gBAAgB,GAAG,kBAAkB,GAAG,mBAAmB,CAC5D,CAAC;CACH,CAAC;AACF,KAAK,wBAAwB,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC"}
|
|
@@ -16,10 +16,12 @@ export const AppForm = minimalForm(withForm({
|
|
|
16
16
|
defaultValues,
|
|
17
17
|
props,
|
|
18
18
|
render: function FormRender(props) {
|
|
19
|
-
const { form, children, domValidate, onSubmitMeta, ...domProps } = props;
|
|
19
|
+
const { form, children, domValidate, onSubmitMeta, onSubmitStopPropagation, ...domProps } = props;
|
|
20
20
|
const { AppForm } = form;
|
|
21
21
|
return (_jsx(AppForm, { children: _jsx(DomForm, { onSubmit: (event) => {
|
|
22
22
|
event.preventDefault();
|
|
23
|
+
if (onSubmitStopPropagation)
|
|
24
|
+
event.stopPropagation();
|
|
23
25
|
const meta = onSubmitMeta?.(
|
|
24
26
|
// onSubmit event is not typed properly.
|
|
25
27
|
// It uses Event instead of SubmitEvent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/form.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../../../src/components/form/components/layout/form.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAuB1D,MAAM,KAAK,GAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAE/C,+CAA+C;AAC/C,+CAA+C;AAC/C,+BAA+B;AAC/B,0GAA0G;AAC1G,8DAA8D;AAC9D,MAAM,aAAa,GAAQ,SAAS,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAChC,QAAQ,CAAC;IACP,aAAa;IACb,KAAK;IACL,MAAM,EAAE,SAAS,UAAU,CAAC,KAAK;QAC/B,MAAM,EACJ,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,GAAG,QAAQ,EACZ,GAAG,KAAK,CAAC;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,OAAO,CACL,KAAC,OAAO,cAEN,KAAC,OAAO,IACN,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,KAAK,CAAC,cAAc,EAAE,CAAC;oBACvB,IAAI,uBAAuB;wBAAE,KAAK,CAAC,eAAe,EAAE,CAAC;oBAErD,MAAM,IAAI,GAAG,YAAY,EAAE;oBACzB,wCAAwC;oBACxC,wCAAwC;oBACxC,KAAqD,CACtD,CAAC;oBACF,KAAK,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC,KACG,QAAQ,EACZ,UAAU,EAAE,CAAC,WAAW,YAEvB,QAAQ,GACD,GACF,CACX,CAAC;IACJ,CAAC;CACF,CAAC,CACH,CAAC;AAiBF,SAAS,WAAW,CAClB,SAA0C;IAE1C,OAAO,SAA0D,CAAC;AACpE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Checkbox } from '../components/input/checkbox.js';
|
|
2
2
|
import { ColorPicker } from '../components/input/color_picker.tsx';
|
|
3
|
+
import { DraggableNumericInput } from '../components/input/draggable_numeric_input.js';
|
|
3
4
|
import { Input } from '../components/input/input.js';
|
|
4
5
|
import { NumericInput } from '../components/input/numeric_input.js';
|
|
5
6
|
import { RadioGroup } from '../components/input/radio_group.js';
|
|
@@ -17,6 +18,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
17
18
|
readonly Switch: typeof Switch;
|
|
18
19
|
readonly ColorPicker: typeof ColorPicker;
|
|
19
20
|
readonly RadioGroup: typeof RadioGroup;
|
|
21
|
+
readonly DraggableNumericInput: typeof DraggableNumericInput;
|
|
20
22
|
}, {
|
|
21
23
|
readonly SubmitButton: typeof SubmitButton;
|
|
22
24
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -30,6 +32,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
30
32
|
readonly Switch: typeof Switch;
|
|
31
33
|
readonly ColorPicker: typeof ColorPicker;
|
|
32
34
|
readonly RadioGroup: typeof RadioGroup;
|
|
35
|
+
readonly DraggableNumericInput: typeof DraggableNumericInput;
|
|
33
36
|
}, {
|
|
34
37
|
readonly SubmitButton: typeof SubmitButton;
|
|
35
38
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -43,6 +46,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
43
46
|
readonly Switch: typeof Switch;
|
|
44
47
|
readonly ColorPicker: typeof ColorPicker;
|
|
45
48
|
readonly RadioGroup: typeof RadioGroup;
|
|
49
|
+
readonly DraggableNumericInput: typeof DraggableNumericInput;
|
|
46
50
|
}, {
|
|
47
51
|
readonly SubmitButton: typeof SubmitButton;
|
|
48
52
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -56,6 +60,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
56
60
|
readonly Switch: typeof Switch;
|
|
57
61
|
readonly ColorPicker: typeof ColorPicker;
|
|
58
62
|
readonly RadioGroup: typeof RadioGroup;
|
|
63
|
+
readonly DraggableNumericInput: typeof DraggableNumericInput;
|
|
59
64
|
}, {
|
|
60
65
|
readonly SubmitButton: typeof SubmitButton;
|
|
61
66
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -68,6 +73,7 @@ declare const withForm: <TFormData, TOnMount extends import("@tanstack/react-for
|
|
|
68
73
|
readonly Switch: typeof Switch;
|
|
69
74
|
readonly ColorPicker: typeof ColorPicker;
|
|
70
75
|
readonly RadioGroup: typeof RadioGroup;
|
|
76
|
+
readonly DraggableNumericInput: typeof DraggableNumericInput;
|
|
71
77
|
}, {
|
|
72
78
|
readonly SubmitButton: typeof SubmitButton;
|
|
73
79
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -83,6 +89,7 @@ export declare const useForm: <TFormData, TOnMount extends import("@tanstack/rea
|
|
|
83
89
|
readonly Switch: typeof Switch;
|
|
84
90
|
readonly ColorPicker: typeof ColorPicker;
|
|
85
91
|
readonly RadioGroup: typeof RadioGroup;
|
|
92
|
+
readonly DraggableNumericInput: typeof DraggableNumericInput;
|
|
86
93
|
}, {
|
|
87
94
|
readonly SubmitButton: typeof SubmitButton;
|
|
88
95
|
readonly ResetButton: typeof ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_ts_form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/context/use_ts_form.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,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;AAS3B,QAAA,MAAoB,QAAQ
|
|
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,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,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;AAS3B,QAAA,MAAoB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAkB1C,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;EAAa,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createFormHook, createFormHookContexts } from '@tanstack/react-form';
|
|
2
2
|
import { Checkbox } from '../components/input/checkbox.js';
|
|
3
3
|
import { ColorPicker } from "../components/input/color_picker.js";
|
|
4
|
+
import { DraggableNumericInput } from '../components/input/draggable_numeric_input.js';
|
|
4
5
|
import { Input } from '../components/input/input.js';
|
|
5
6
|
import { NumericInput } from '../components/input/numeric_input.js';
|
|
6
7
|
import { RadioGroup } from '../components/input/radio_group.js';
|
|
@@ -33,6 +34,7 @@ const { useAppForm, withForm, withFieldGroup } = createFormHook({
|
|
|
33
34
|
Switch,
|
|
34
35
|
ColorPicker,
|
|
35
36
|
RadioGroup,
|
|
37
|
+
DraggableNumericInput,
|
|
36
38
|
},
|
|
37
39
|
});
|
|
38
40
|
export const useForm = useAppForm;
|