@strictly/react-form 0.0.12 → 0.0.13

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.
@@ -7,12 +7,12 @@ $ tsup
7
7
  CLI Target: es6
8
8
  CJS Build start
9
9
  ESM Build start
10
- CJS dist/index.cjs 59.07 KB
11
- CJS ⚡️ Build success in 158ms
12
- ESM dist/index.js 55.30 KB
13
- ESM ⚡️ Build success in 159ms
10
+ ESM dist/index.js 55.38 KB
11
+ ESM ⚡️ Build success in 141ms
12
+ CJS dist/index.cjs 59.16 KB
13
+ CJS ⚡️ Build success in 145ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 9941ms
15
+ DTS ⚡️ Build success in 9581ms
16
16
  DTS dist/index.d.cts 36.50 KB
17
17
  DTS dist/index.d.ts 36.50 KB
18
- Done in 11.06s.
18
+ Done in 10.72s.
@@ -1,3 +1,3 @@
1
1
  yarn run v1.22.22
2
2
  $ tsc
3
- Done in 7.59s.
3
+ Done in 7.39s.
package/dist/index.cjs CHANGED
@@ -1369,14 +1369,15 @@ function createCheckbox(valuePath, Checkbox) {
1369
1369
  }
1370
1370
 
1371
1371
  // mantine/create_fields_view.tsx
1372
+ var import_define7 = require("@strictly/define");
1372
1373
  var import_mobx_react2 = require("mobx-react");
1373
1374
  var import_jsx_runtime3 = require("react/jsx-runtime");
1374
1375
  function createFieldsView(valuePath, FieldsView, observableProps) {
1375
1376
  function toKey(subKey) {
1376
- return subKey.replace("$", valuePath);
1377
+ return (0, import_define7.jsonPathPrefix)(valuePath, subKey);
1377
1378
  }
1378
1379
  function toSubKey(key) {
1379
- return key.replace(valuePath, "$");
1380
+ return (0, import_define7.jsonPathUnprefix)(valuePath, key);
1380
1381
  }
1381
1382
  function onFieldValueChange(subKey, value) {
1382
1383
  observableProps.onFieldValueChange(toKey(subKey), value);
@@ -1831,7 +1832,7 @@ __decorateElement(_init2, 4, "fields", _fields_dec2, MantineFormImpl, _fields);
1831
1832
  __decoratorMetadata(_init2, MantineFormImpl);
1832
1833
 
1833
1834
  // types/merge_validators.ts
1834
- var import_define7 = require("@strictly/define");
1835
+ var import_define8 = require("@strictly/define");
1835
1836
  function mergeValidators(validators1, validators2) {
1836
1837
  const validators = __spreadValues(__spreadValues({}, validators1), validators2);
1837
1838
  const keys1 = new Set(Object.keys(validators1));
@@ -1843,16 +1844,16 @@ function mergeValidators(validators1, validators2) {
1843
1844
  validators3[key] = {
1844
1845
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1845
1846
  validate: function(value, valuePath, context) {
1846
- const error = (0, import_define7.validate)(validator1, value, valuePath, context);
1847
+ const error = (0, import_define8.validate)(validator1, value, valuePath, context);
1847
1848
  if (error != null) {
1848
1849
  return error;
1849
1850
  }
1850
- return (0, import_define7.validate)(validator2, value, valuePath, context);
1851
+ return (0, import_define8.validate)(validator2, value, valuePath, context);
1851
1852
  },
1852
1853
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1853
1854
  annotations: function(valuePath, context) {
1854
- const annotations1 = (0, import_define7.annotations)(validator1, valuePath, context);
1855
- const annotations22 = (0, import_define7.annotations)(validator2, valuePath, context);
1855
+ const annotations1 = (0, import_define8.annotations)(validator1, valuePath, context);
1856
+ const annotations22 = (0, import_define8.annotations)(validator2, valuePath, context);
1856
1857
  return {
1857
1858
  readonly: annotations1.readonly || annotations22.readonly,
1858
1859
  required: annotations1.required || annotations22.required
package/dist/index.js CHANGED
@@ -1372,14 +1372,18 @@ function createCheckbox(valuePath, Checkbox) {
1372
1372
  }
1373
1373
 
1374
1374
  // mantine/create_fields_view.tsx
1375
+ import {
1376
+ jsonPathPrefix,
1377
+ jsonPathUnprefix
1378
+ } from "@strictly/define";
1375
1379
  import { observer as observer2 } from "mobx-react";
1376
1380
  import { jsx as jsx3 } from "react/jsx-runtime";
1377
1381
  function createFieldsView(valuePath, FieldsView, observableProps) {
1378
1382
  function toKey(subKey) {
1379
- return subKey.replace("$", valuePath);
1383
+ return jsonPathPrefix(valuePath, subKey);
1380
1384
  }
1381
1385
  function toSubKey(key) {
1382
- return key.replace(valuePath, "$");
1386
+ return jsonPathUnprefix(valuePath, key);
1383
1387
  }
1384
1388
  function onFieldValueChange(subKey, value) {
1385
1389
  observableProps.onFieldValueChange(toKey(subKey), value);
@@ -1,4 +1,8 @@
1
1
  import { type StringConcatOf } from '@strictly/base'
2
+ import {
3
+ jsonPathPrefix,
4
+ jsonPathUnprefix,
5
+ } from '@strictly/define'
2
6
  import type { FieldsViewProps } from 'core/props'
3
7
  import { observer } from 'mobx-react'
4
8
  import type {
@@ -42,12 +46,12 @@ export function createFieldsView<
42
46
  ): FieldsView<K, MantineFieldComponent<FieldsViewProps<P['fields']>, P, never>> {
43
47
  function toKey(subKey: string | number | symbol): string {
44
48
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
45
- return (subKey as string).replace('$', valuePath as string)
49
+ return jsonPathPrefix(valuePath, subKey as string)
46
50
  }
47
51
 
48
52
  function toSubKey(key: string | number | symbol): string {
49
53
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
50
- return (key as string).replace(valuePath as string, '$')
54
+ return jsonPathUnprefix(valuePath, key as string)
51
55
  }
52
56
 
53
57
  function onFieldValueChange<SubK extends keyof P['fields']>(
package/package.json CHANGED
@@ -70,7 +70,7 @@
70
70
  "test:watch": "vitest"
71
71
  },
72
72
  "type": "module",
73
- "version": "0.0.12",
73
+ "version": "0.0.13",
74
74
  "exports": {
75
75
  ".": {
76
76
  "import": {