@strictly/react-form 0.0.18 → 0.0.20
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/.out/core/mobx/form_model.d.ts +12 -9
- package/.out/core/mobx/form_model.js +103 -137
- package/.out/core/mobx/hooks.js +3 -4
- package/.out/core/mobx/merge_field_adapters_with_two_way_converter.d.ts +1 -1
- package/.out/core/mobx/merge_field_adapters_with_validators.js +5 -1
- package/.out/core/mobx/specs/form_model.tests.js +28 -23
- package/.out/mantine/create_fields_view.d.ts +2 -1
- package/.out/mantine/hooks.d.ts +6 -5
- package/.out/mantine/specs/checkbox_hooks.stories.d.ts +5 -2
- package/.out/mantine/specs/checkbox_hooks.stories.js +3 -2
- package/.out/mantine/specs/text_input_hooks.stories.d.ts +3 -2
- package/.out/mantine/specs/text_input_hooks.stories.js +3 -2
- package/.out/mantine/types.d.ts +3 -3
- package/.out/tsconfig.tsbuildinfo +1 -1
- package/.out/util/partial.d.ts +5 -2
- package/.out/util/specs/partial.tests.d.ts +1 -0
- package/.out/util/specs/partial.tests.js +8 -0
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-check-types.log +2 -2
- package/.turbo/turbo-release$colon$exports.log +1 -1
- package/core/mobx/form_model.ts +95 -157
- package/core/mobx/hooks.tsx +6 -5
- package/core/mobx/merge_field_adapters_with_two_way_converter.ts +2 -1
- package/core/mobx/merge_field_adapters_with_validators.ts +1 -1
- package/core/mobx/specs/form_model.tests.ts +39 -27
- package/dist/index.cjs +93 -139
- package/dist/index.d.cts +28 -21
- package/dist/index.d.ts +28 -21
- package/dist/index.js +92 -139
- package/mantine/create_fields_view.tsx +8 -4
- package/mantine/hooks.tsx +23 -15
- package/mantine/specs/checkbox_hooks.stories.tsx +7 -1
- package/mantine/specs/text_input_hooks.stories.tsx +8 -1
- package/mantine/types.ts +12 -4
- package/package.json +12 -12
- package/util/partial.tsx +8 -1
- package/util/specs/partial.tests.tsx +21 -0
package/package.json
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Chris <chris.glover@gmail.com> (@madmaw)",
|
|
3
|
-
"dependencies": {
|
|
4
|
-
"@mantine/core": "^7.13.4",
|
|
5
|
-
"@mantine/hooks": "^7.13.4",
|
|
6
|
-
"@strictly/base": "*",
|
|
7
|
-
"@strictly/define": "*",
|
|
8
|
-
"mobx": "^6.13.5",
|
|
9
|
-
"mobx-react": "^9.1.1",
|
|
10
|
-
"react": "^19.0.0 || ^18.3.1",
|
|
11
|
-
"react-dom": "^19.0.0 || ^18.3.1"
|
|
12
|
-
},
|
|
13
3
|
"description": "Types and utilities for creating React forms",
|
|
14
4
|
"devDependencies": {
|
|
15
5
|
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
@@ -46,6 +36,16 @@
|
|
|
46
36
|
],
|
|
47
37
|
"license": "MIT",
|
|
48
38
|
"name": "@strictly/react-form",
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@mantine/core": "^7.13.4",
|
|
41
|
+
"@mantine/hooks": "^7.13.4",
|
|
42
|
+
"@strictly/base": "*",
|
|
43
|
+
"@strictly/define": "*",
|
|
44
|
+
"mobx": "^6.13.5",
|
|
45
|
+
"mobx-react": "^9.1.1",
|
|
46
|
+
"react": "^19.0.0 || ^18.3.1",
|
|
47
|
+
"react-dom": "^19.0.0 || ^18.3.1"
|
|
48
|
+
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsup",
|
|
59
|
-
"check-types": "tsc",
|
|
59
|
+
"check-types": "tsc -b",
|
|
60
60
|
"clean": "del-cli dist .out .turbo",
|
|
61
61
|
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --max-warnings=0",
|
|
62
62
|
"lint:fix": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --fix",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"test:watch": "vitest"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
|
-
"version": "0.0.
|
|
73
|
+
"version": "0.0.20",
|
|
74
74
|
"exports": {
|
|
75
75
|
".": {
|
|
76
76
|
"import": {
|
package/util/partial.tsx
CHANGED
|
@@ -8,9 +8,13 @@ import {
|
|
|
8
8
|
forwardRef,
|
|
9
9
|
type ForwardRefExoticComponent,
|
|
10
10
|
type PropsWithoutRef,
|
|
11
|
+
type Ref,
|
|
12
|
+
type RefAttributes,
|
|
11
13
|
useMemo,
|
|
12
14
|
} from 'react'
|
|
13
15
|
|
|
16
|
+
export type RefOfProps<P, Fallback = unknown> = P extends RefAttributes<infer R> ? R : Fallback
|
|
17
|
+
|
|
14
18
|
export type PartialComponent<
|
|
15
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
20
|
Component extends ComponentType<any>,
|
|
@@ -27,8 +31,11 @@ export type UnsafePartialComponent<
|
|
|
27
31
|
Component extends ComponentType<any>,
|
|
28
32
|
CurriedProps,
|
|
29
33
|
AdditionalProps = {},
|
|
34
|
+
R = RefOfProps<ComponentProps<Component>>,
|
|
30
35
|
> = ForwardRefExoticComponent<
|
|
31
|
-
PropsWithoutRef<RemainingComponentProps<Component, CurriedProps> & AdditionalProps>
|
|
36
|
+
PropsWithoutRef<RemainingComponentProps<Component, CurriedProps> & AdditionalProps> & {
|
|
37
|
+
ref?: Ref<R>,
|
|
38
|
+
}
|
|
32
39
|
>
|
|
33
40
|
|
|
34
41
|
export function createSimplePartialComponent<
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type InputProps,
|
|
3
|
+
} from '@mantine/core'
|
|
4
|
+
import {
|
|
5
|
+
type ComponentProps,
|
|
6
|
+
type ComponentType,
|
|
7
|
+
type Ref,
|
|
8
|
+
} from 'react'
|
|
9
|
+
import {
|
|
10
|
+
type UnsafePartialComponent,
|
|
11
|
+
} from 'util/partial'
|
|
12
|
+
|
|
13
|
+
describe('partial', () => {
|
|
14
|
+
describe('UnsafePartialComponent', () => {
|
|
15
|
+
it('allows a ref of a specific type to be passed', () => {
|
|
16
|
+
type T = UnsafePartialComponent<ComponentType<InputProps>, {}, {}, HTMLInputElement>
|
|
17
|
+
|
|
18
|
+
expectTypeOf<ComponentProps<T>['ref']>().toEqualTypeOf<Ref<HTMLInputElement> | undefined>()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
})
|