@progress/kendo-react-form 7.2.4-develop.3 → 7.3.0-develop.1

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/index.js CHANGED
@@ -1,5 +1,8 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),F=require("prop-types"),h=require("@progress/kendo-react-common");function B(d){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>d[e]})}}return t.default=d,Object.freeze(t)}const n=B(T),g=n.createContext(null),_=d=>{const{name:t,component:e,validator:i,children:o,onChange:r,...l}=d,s=n.useContext(g),a=s?s.id:"";n.useEffect(()=>s?s.registerField(t,i):void 0,[t,a,i]);const m=n.useCallback(u=>{const b=u&&(u.value!==void 0?u.value:u.target?u.target.value:u.target);s.onChange(t,{value:b}),r&&r.call(void 0,u)},[t,a,r]),f=n.useCallback(u=>s.onChange(t,{value:u.target.value}),[t,a]),v=n.useCallback(()=>s.onBlur(t),[t,a]),p=n.useCallback(()=>s.onFocus(t),[t,a]);if(!s)return null;const y=s.valueGetter(t);return typeof e=="string"?n.createElement(e,{onChange:f,onBlur:v,onFocus:p,value:y,children:o,...l}):n.createElement(e,{children:o,...l,onChange:m,onBlur:v,onFocus:p,value:y,validationMessage:s.errors[t],touched:s.touched[t],modified:s.modified[t],visited:s.visited[t],valid:!(s.errors[t]&&s.touched[t]),name:t})};_.displayName="KendoReactField";const S={name:"@progress/kendo-react-form",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},M=0;let C=class extends n.Component{constructor(t){super(t),this._touched={},this._visited={},this._modified={},this._validatorsByField={},this._values={},this._fields={},this._unmounted=!1,this._submitted=!1,this.isValid=()=>this.isFormValid(this.errors),this.accumulatedForceUpdate=()=>{this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout),this._accumulatorTimeout=window.setTimeout(()=>{this._accumulatorTimeout=void 0,this.forceUpdate()},M)},this.resetForm=()=>{this.values=h.clone(this.props.initialValues),this._key=h.guid(),this._touched={},this._visited={},this._modified={},this._validatorsByField={},this._fields={},this._submitted=!1,this.forceUpdate()},this.onReset=()=>this.resetForm(),this.addField=e=>{this._fields[e]=!0},this.onSubmit=e=>{const i={},o=this.fields;e&&(typeof e.preventDefault=="function"&&e.preventDefault(),typeof e.stopPropagation=="function"&&e.stopPropagation()),o.forEach(a=>{i[a]=!0}),this.visited={...i},this.touched={...i};const r=this.values,l=this.isFormValid(this.errors),s=this.isFormModified(this.modified,o);this.props.onSubmitClick&&this.props.onSubmitClick.call(void 0,{values:r,isValid:l,isModified:s,event:e}),l&&(this.props.ignoreModified||s)&&this.props.onSubmit&&(this._submitted=!0,this.props.onSubmit.call(void 0,r,e)),this.forceUpdate()},this.onChange=(e,i)=>{const{value:o}=i;this.addField(e),this.modified[e]||(this.modified={...this.modified,[e]:!0}),this.valueSetter(e,o),this.forceUpdate()},this.onFocus=(e,i)=>{this.visited[e]||(this.visited={...this.visited,[e]:!0},i||this.forceUpdate())},this.onBlur=(e,i)=>{this.touched[e]||(this.onFocus(e,i),this.touched={...this.touched,[e]:!0},i||this.forceUpdate())},this.onFieldRegister=(e,i)=>{this.addField(e);const o=this.validatorsByField[e]||[],r=o.length;return this.validatorsByField={...this.validatorsByField,[e]:[...o,i]},this.accumulatedForceUpdate(),()=>{if(this._unmounted)return;const l=[...this.validatorsByField[e]||[]],s=!!l[r];l[r]=void 0,this.validatorsByField={...this.validatorsByField,[e]:l},s&&this.accumulatedForceUpdate()}},this.isFormValid=e=>!Object.keys(e).some(i=>!!e[i]),this.isFormModified=(e,i)=>i.some(o=>e[o]),this.isFormHasNotTouched=(e,i)=>i.some(o=>!e[o]),this.isFormTouched=(e,i)=>i.some(o=>e[o]),this.isFormVisited=(e,i)=>i.some(o=>e[o]),this.valueGetter=e=>h.getter(e)(this.values),this.valueSetter=(e,i)=>h.setter(e)(this.values,i),this.onArrayAction=e=>{this.addField(e),this.modified[e]||(this.modified={...this.modified,[e]:!0}),this.onBlur(e,!0)},this.onInsert=(e,i)=>{this.onArrayAction(e);const o=[...this.valueGetter(e)||[]];o.splice(i.index,0,i.value),this.valueSetter(e,o),this.forceUpdate()},this.onUnshift=(e,i)=>{this.onInsert(e,{value:i.value,index:0})},this.onPush=(e,i)=>{this.onArrayAction(e);const o=[...this.valueGetter(e)||[],i.value];this.valueSetter(e,o),this.forceUpdate()},this.onPop=e=>{this.onArrayAction(e);const i=[...this.valueGetter(e)||[]],o=i.pop();return this.valueSetter(e,i),this.forceUpdate(),o},this.onRemove=(e,i)=>{this.onArrayAction(e);const o=[...this.valueGetter(e)||[]],r=o.splice(i.index,1);return this.valueSetter(e,o),this.forceUpdate(),r},this.onReplace=(e,i)=>{this.onArrayAction(e);const o=[...this.valueGetter(e)||[]];o.splice(i.index,1,i.value),this.valueSetter(e,o),this.forceUpdate()},this.onMove=(e,i)=>{this.onArrayAction(e);const o=[...this.valueGetter(e)||[]],r=o[i.prevIndex];o.splice(i.prevIndex,1),o.splice(i.nextIndex,0,r),this.valueSetter(e,o),this.forceUpdate()},h.validatePackage(S),this.values=h.clone(t.initialValues)}get touched(){return this._touched}set touched(t){this._touched=t}get visited(){return this._visited}set visited(t){this._visited=t}get modified(){return this._modified}set modified(t){this._modified=t}get validatorsByField(){return this._validatorsByField}set validatorsByField(t){this._validatorsByField=t}get values(){return this._values}set values(t){this._values=t}get fields(){return Object.keys(this._fields)}get formErrors(){if(this.props.validator)return this.props.validator(this.values,this.valueGetter)}get errors(){const t={},e=this.fields,i=this.validatorsByField;return e.forEach(r=>{if(t[r]="",i[r]){const l=[];i[r].forEach(s=>{Array.isArray(s)?l.push(...s):l.push(s)}),l.find(s=>{if(s){const a=s(this.valueGetter(r),this.valueGetter,{name:r});if(a)return t[r]=a,!0}return!1})}}),this.formErrors&&h.cloneObject(this.formErrors,t),t}componentWillUnmount(){this._unmounted=!0,this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout)}render(){const{render:t}=this.props,e=this.touched,i=this.visited,o=this.modified,r=this.fields,l=this.errors,s=this.isFormValid(l),a=this.isFormModified(o,r),m=this.isFormTouched(e,r),f=this.isFormVisited(i,r),p=this.isFormHasNotTouched(e,r)&&!s||s&&(this.props.ignoreModified||a);return n.createElement(g.Provider,{key:this._key||this.props.id,value:{id:this.props.id,valueGetter:this.valueGetter,errors:l,modified:o,touched:e,visited:i,registerField:this.onFieldRegister,onSubmit:this.onSubmit,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onUnshift:this.onUnshift,onPush:this.onPush,onInsert:this.onInsert,onPop:this.onPop,onRemove:this.onRemove,onReplace:this.onReplace,onMove:this.onMove}},t({valid:s,modified:a,touched:m,visited:f,submitted:this._submitted,valueGetter:this.valueGetter,errors:l,allowSubmit:p,onChange:this.onChange,onSubmit:this.onSubmit,onFormReset:this.resetForm}))}};C.displayName="KendoReactForm";C.propTypes={initialValues:F.any,onSubmit:F.func,onSubmitClick:F.func,render:F.func.isRequired,id:F.string};const k=d=>{const{name:t,component:e,validator:i,type:o,children:r,...l}=d,s=n.useContext(g),a=s?s.id:"";n.useEffect(()=>s?s.registerField(t,i):void 0,[t,a,i]);const m=n.useCallback(c=>s.onUnshift(t,c),[t,a]),f=n.useCallback(c=>s.onPush(t,c),[t,a]),v=n.useCallback(c=>s.onInsert(t,c),[t,a]),p=n.useCallback(()=>s.onPop(t),[t,a]),y=n.useCallback(c=>s.onRemove(t,c),[t,a]),u=n.useCallback(c=>s.onReplace(t,c),[t,a]),b=n.useCallback(c=>s.onMove(t,c),[t,a]);if(!s)return null;const E=s.valueGetter(t);return n.createElement(e,{value:E,validationMessage:s.errors[t],touched:s.touched[t],modified:s.modified[t],visited:s.visited[t],valid:!(s.errors[t]&&s.touched[t]),onUnshift:m,onPush:f,onInsert:v,onPop:p,onRemove:y,onReplace:u,onMove:b,children:r,name:t,...l})};k.displayName="KendoReactFieldArray";const R=d=>{const t=h.classNames({"k-form-field":!0,"k-rtl":d.dir==="rtl"},d.className);return n.createElement("div",{className:t,style:d.style},d.children)};R.displayName="KendoReactFieldWrapper";const A=n.forwardRef((d,t)=>{const e={size:"medium",...d},i=n.useRef(null),o=n.useRef(null);n.useImperativeHandle(o,()=>({element:i.current,props:e})),n.useImperativeHandle(t,()=>o.current);const r=n.useContext(g),{className:l,style:s,horizontal:a,size:m,...f}=e,v=h.classNames({"k-form":!0,[`k-form-${h.kendoThemeMaps.sizeMap[m]||m}`]:m,"k-form-horizontal":a===!0},l);return n.createElement("form",{ref:i,...f,id:r?r.id:void 0,style:d.style,className:v,onSubmit:r?r.onSubmit:void 0},d.children)});A.displayName="KendoReactFormElement";const U=h.withIdHOC(C);U.displayName="KendoReactForm";exports.Field=_;exports.FieldArray=k;exports.FieldWrapper=R;exports.Form=U;exports.FormClassComponent=C;exports.FormElement=A;
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Field.js"),e=require("./Form.js"),i=require("./FieldArray.js"),t=require("./FieldWrapper.js"),F=require("./FormElement.js"),l=require("@progress/kendo-react-common"),r=l.withIdHOC(e.Form);r.displayName="KendoReactForm";exports.Field=o.Field;exports.FormClassComponent=e.Form;exports.FieldArray=i.FieldArray;exports.FieldWrapper=t.FieldWrapper;exports.FormElement=F.FormElement;exports.Form=r;
package/index.mjs CHANGED
@@ -1,415 +1,24 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
5
8
  "use client";
6
- import * as n from "react";
7
- import p from "prop-types";
8
- import { clone as _, guid as R, getter as A, setter as U, validatePackage as B, cloneObject as E, classNames as b, kendoThemeMaps as T, withIdHOC as S } from "@progress/kendo-react-common";
9
- const y = n.createContext(null), M = (l) => {
10
- const { name: e, component: t, validator: i, children: o, onChange: r, ...d } = l, s = n.useContext(y), a = s ? s.id : "";
11
- n.useEffect(
12
- () => s ? s.registerField(e, i) : void 0,
13
- [e, a, i]
14
- );
15
- const c = n.useCallback(
16
- (u) => {
17
- const g = u && (u.value !== void 0 ? u.value : u.target ? u.target.value : u.target);
18
- s.onChange(e, { value: g }), r && r.call(void 0, u);
19
- },
20
- [e, a, r]
21
- ), m = n.useCallback(
22
- (u) => s.onChange(e, { value: u.target.value }),
23
- [e, a]
24
- ), f = n.useCallback(
25
- () => s.onBlur(e),
26
- [e, a]
27
- ), v = n.useCallback(
28
- () => s.onFocus(e),
29
- [e, a]
30
- );
31
- if (!s)
32
- return null;
33
- const F = s.valueGetter(e);
34
- return typeof t == "string" ? n.createElement(t, {
35
- onChange: m,
36
- onBlur: f,
37
- onFocus: v,
38
- value: F,
39
- children: o,
40
- ...d
41
- }) : n.createElement(
42
- t,
43
- {
44
- children: o,
45
- ...d,
46
- // input
47
- onChange: c,
48
- onBlur: f,
49
- onFocus: v,
50
- value: F,
51
- // meta
52
- validationMessage: s.errors[e],
53
- touched: s.touched[e],
54
- modified: s.modified[e],
55
- visited: s.visited[e],
56
- // Our `valid` implementation requires double submit to show html5 validation errors,
57
- // however it's NOT recommended to show html5 validation errors at all as:
58
- // - There is no standard way to change validation look and feel with CSS.
59
- // - Look different in each browser / OS
60
- // - You can have a page in one language but an error message displayed in another language (not localizable)
61
- valid: !(s.errors[e] && s.touched[e]),
62
- name: e
63
- }
64
- );
65
- };
66
- M.displayName = "KendoReactField";
67
- const I = {
68
- name: "@progress/kendo-react-form",
69
- productName: "KendoReact",
70
- productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
71
- publishDate: 1709631883,
72
- version: "",
73
- licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
74
- }, P = 0;
75
- let C = class extends n.Component {
76
- /**
77
- * @hidden
78
- */
79
- constructor(e) {
80
- super(e), this._touched = {}, this._visited = {}, this._modified = {}, this._validatorsByField = {}, this._values = {}, this._fields = {}, this._unmounted = !1, this._submitted = !1, this.isValid = () => this.isFormValid(this.errors), this.accumulatedForceUpdate = () => {
81
- this._accumulatorTimeout && clearTimeout(this._accumulatorTimeout), this._accumulatorTimeout = window.setTimeout(
82
- () => {
83
- this._accumulatorTimeout = void 0, this.forceUpdate();
84
- },
85
- P
86
- );
87
- }, this.resetForm = () => {
88
- this.values = _(this.props.initialValues), this._key = R(), this._touched = {}, this._visited = {}, this._modified = {}, this._validatorsByField = {}, this._fields = {}, this._submitted = !1, this.forceUpdate();
89
- }, this.onReset = () => this.resetForm(), this.addField = (t) => {
90
- this._fields[t] = !0;
91
- }, this.onSubmit = (t) => {
92
- const i = {}, o = this.fields;
93
- t && (typeof t.preventDefault == "function" && t.preventDefault(), typeof t.stopPropagation == "function" && t.stopPropagation()), o.forEach((a) => {
94
- i[a] = !0;
95
- }), this.visited = { ...i }, this.touched = { ...i };
96
- const r = this.values, d = this.isFormValid(this.errors), s = this.isFormModified(this.modified, o);
97
- this.props.onSubmitClick && this.props.onSubmitClick.call(void 0, {
98
- values: r,
99
- isValid: d,
100
- isModified: s,
101
- event: t
102
- }), d && (this.props.ignoreModified || s) && this.props.onSubmit && (this._submitted = !0, this.props.onSubmit.call(void 0, r, t)), this.forceUpdate();
103
- }, this.onChange = (t, i) => {
104
- const { value: o } = i;
105
- this.addField(t), this.modified[t] || (this.modified = { ...this.modified, [t]: !0 }), this.valueSetter(t, o), this.forceUpdate();
106
- }, this.onFocus = (t, i) => {
107
- this.visited[t] || (this.visited = { ...this.visited, [t]: !0 }, i || this.forceUpdate());
108
- }, this.onBlur = (t, i) => {
109
- this.touched[t] || (this.onFocus(t, i), this.touched = { ...this.touched, [t]: !0 }, i || this.forceUpdate());
110
- }, this.onFieldRegister = (t, i) => {
111
- this.addField(t);
112
- const o = this.validatorsByField[t] || [], r = o.length;
113
- return this.validatorsByField = { ...this.validatorsByField, [t]: [...o, i] }, this.accumulatedForceUpdate(), () => {
114
- if (this._unmounted)
115
- return;
116
- const d = [...this.validatorsByField[t] || []], s = !!d[r];
117
- d[r] = void 0, this.validatorsByField = { ...this.validatorsByField, [t]: d }, s && this.accumulatedForceUpdate();
118
- };
119
- }, this.isFormValid = (t) => !Object.keys(t).some((i) => !!t[i]), this.isFormModified = (t, i) => i.some((o) => t[o]), this.isFormHasNotTouched = (t, i) => i.some((o) => !t[o]), this.isFormTouched = (t, i) => i.some((o) => t[o]), this.isFormVisited = (t, i) => i.some((o) => t[o]), this.valueGetter = (t) => A(t)(this.values), this.valueSetter = (t, i) => U(t)(this.values, i), this.onArrayAction = (t) => {
120
- this.addField(t), this.modified[t] || (this.modified = { ...this.modified, [t]: !0 }), this.onBlur(t, !0);
121
- }, this.onInsert = (t, i) => {
122
- this.onArrayAction(t);
123
- const o = [...this.valueGetter(t) || []];
124
- o.splice(i.index, 0, i.value), this.valueSetter(t, o), this.forceUpdate();
125
- }, this.onUnshift = (t, i) => {
126
- this.onInsert(t, {
127
- value: i.value,
128
- index: 0
129
- });
130
- }, this.onPush = (t, i) => {
131
- this.onArrayAction(t);
132
- const o = [...this.valueGetter(t) || [], i.value];
133
- this.valueSetter(t, o), this.forceUpdate();
134
- }, this.onPop = (t) => {
135
- this.onArrayAction(t);
136
- const i = [...this.valueGetter(t) || []], o = i.pop();
137
- return this.valueSetter(t, i), this.forceUpdate(), o;
138
- }, this.onRemove = (t, i) => {
139
- this.onArrayAction(t);
140
- const o = [...this.valueGetter(t) || []], r = o.splice(i.index, 1);
141
- return this.valueSetter(t, o), this.forceUpdate(), r;
142
- }, this.onReplace = (t, i) => {
143
- this.onArrayAction(t);
144
- const o = [...this.valueGetter(t) || []];
145
- o.splice(i.index, 1, i.value), this.valueSetter(t, o), this.forceUpdate();
146
- }, this.onMove = (t, i) => {
147
- this.onArrayAction(t);
148
- const o = [...this.valueGetter(t) || []], r = o[i.prevIndex];
149
- o.splice(i.prevIndex, 1), o.splice(i.nextIndex, 0, r), this.valueSetter(t, o), this.forceUpdate();
150
- }, B(I), this.values = _(e.initialValues);
151
- }
152
- /**
153
- * @hidden
154
- */
155
- get touched() {
156
- return this._touched;
157
- }
158
- /**
159
- * @hidden
160
- */
161
- set touched(e) {
162
- this._touched = e;
163
- }
164
- /**
165
- * @hidden
166
- */
167
- get visited() {
168
- return this._visited;
169
- }
170
- /**
171
- * @hidden
172
- */
173
- set visited(e) {
174
- this._visited = e;
175
- }
176
- /**
177
- * @hidden
178
- */
179
- get modified() {
180
- return this._modified;
181
- }
182
- /**
183
- * @hidden
184
- */
185
- set modified(e) {
186
- this._modified = e;
187
- }
188
- /**
189
- * @hidden
190
- */
191
- get validatorsByField() {
192
- return this._validatorsByField;
193
- }
194
- /**
195
- * @hidden
196
- */
197
- set validatorsByField(e) {
198
- this._validatorsByField = e;
199
- }
200
- /**
201
- * @hidden
202
- */
203
- get values() {
204
- return this._values;
205
- }
206
- /**
207
- * @hidden
208
- */
209
- set values(e) {
210
- this._values = e;
211
- }
212
- /**
213
- * @hidden
214
- */
215
- get fields() {
216
- return Object.keys(this._fields);
217
- }
218
- /**
219
- * @hidden
220
- */
221
- get formErrors() {
222
- if (this.props.validator)
223
- return this.props.validator(this.values, this.valueGetter);
224
- }
225
- /**
226
- * @hidden
227
- */
228
- get errors() {
229
- const e = {}, t = this.fields, i = this.validatorsByField;
230
- return t.forEach((r) => {
231
- if (e[r] = "", i[r]) {
232
- const d = [];
233
- i[r].forEach((s) => {
234
- Array.isArray(s) ? d.push(...s) : d.push(s);
235
- }), d.find((s) => {
236
- if (s) {
237
- const a = s(this.valueGetter(r), this.valueGetter, { name: r });
238
- if (a)
239
- return e[r] = a, !0;
240
- }
241
- return !1;
242
- });
243
- }
244
- }), this.formErrors && E(this.formErrors, e), e;
245
- }
246
- /**
247
- * @hidden
248
- */
249
- componentWillUnmount() {
250
- this._unmounted = !0, this._accumulatorTimeout && clearTimeout(this._accumulatorTimeout);
251
- }
252
- /**
253
- * @hidden
254
- */
255
- render() {
256
- const { render: e } = this.props, t = this.touched, i = this.visited, o = this.modified, r = this.fields, d = this.errors, s = this.isFormValid(d), a = this.isFormModified(o, r), c = this.isFormTouched(t, r), m = this.isFormVisited(i, r), v = this.isFormHasNotTouched(t, r) && !s || s && (this.props.ignoreModified || a);
257
- return /* @__PURE__ */ n.createElement(
258
- y.Provider,
259
- {
260
- key: this._key || this.props.id,
261
- value: {
262
- id: this.props.id,
263
- valueGetter: this.valueGetter,
264
- errors: d,
265
- modified: o,
266
- touched: t,
267
- visited: i,
268
- registerField: this.onFieldRegister,
269
- onSubmit: this.onSubmit,
270
- onChange: this.onChange,
271
- onFocus: this.onFocus,
272
- onBlur: this.onBlur,
273
- onUnshift: this.onUnshift,
274
- onPush: this.onPush,
275
- onInsert: this.onInsert,
276
- onPop: this.onPop,
277
- onRemove: this.onRemove,
278
- onReplace: this.onReplace,
279
- onMove: this.onMove
280
- }
281
- },
282
- e({
283
- valid: s,
284
- modified: a,
285
- touched: c,
286
- visited: m,
287
- submitted: this._submitted,
288
- valueGetter: this.valueGetter,
289
- errors: d,
290
- allowSubmit: v,
291
- onChange: this.onChange,
292
- onSubmit: this.onSubmit,
293
- onFormReset: this.resetForm
294
- })
295
- );
296
- }
297
- };
298
- C.displayName = "KendoReactForm";
299
- C.propTypes = {
300
- initialValues: p.any,
301
- onSubmit: p.func,
302
- onSubmitClick: p.func,
303
- render: p.func.isRequired,
304
- id: p.string
305
- };
306
- const x = (l) => {
307
- const { name: e, component: t, validator: i, type: o, children: r, ...d } = l, s = n.useContext(y), a = s ? s.id : "";
308
- n.useEffect(
309
- () => s ? s.registerField(e, i) : void 0,
310
- [e, a, i]
311
- );
312
- const c = n.useCallback(
313
- (h) => s.onUnshift(e, h),
314
- [e, a]
315
- ), m = n.useCallback(
316
- (h) => s.onPush(e, h),
317
- [e, a]
318
- ), f = n.useCallback(
319
- (h) => s.onInsert(e, h),
320
- [e, a]
321
- ), v = n.useCallback(
322
- () => s.onPop(e),
323
- [e, a]
324
- ), F = n.useCallback(
325
- (h) => s.onRemove(e, h),
326
- [e, a]
327
- ), u = n.useCallback(
328
- (h) => s.onReplace(e, h),
329
- [e, a]
330
- ), g = n.useCallback(
331
- (h) => s.onMove(e, h),
332
- [e, a]
333
- );
334
- if (!s)
335
- return null;
336
- const k = s.valueGetter(e);
337
- return n.createElement(
338
- t,
339
- {
340
- // input
341
- value: k,
342
- // meta
343
- validationMessage: s.errors[e],
344
- touched: s.touched[e],
345
- modified: s.modified[e],
346
- visited: s.visited[e],
347
- // Our `valid` implementation requires double submit to show html5 validation errors,
348
- // however it's NOT recommended to show html5 validation errors at all as:
349
- // - There is no standard way to change validation look and feel with CSS.
350
- // - Look different in each browser / OS
351
- // - You can have a page in one language but an error message displayed in another language (not localizable)
352
- valid: !(s.errors[e] && s.touched[e]),
353
- onUnshift: c,
354
- onPush: m,
355
- onInsert: f,
356
- onPop: v,
357
- onRemove: F,
358
- onReplace: u,
359
- onMove: g,
360
- children: r,
361
- name: e,
362
- ...d
363
- }
364
- );
365
- };
366
- x.displayName = "KendoReactFieldArray";
367
- const V = (l) => {
368
- const e = b(
369
- {
370
- "k-form-field": !0,
371
- "k-rtl": l.dir === "rtl"
372
- },
373
- l.className
374
- );
375
- return /* @__PURE__ */ n.createElement("div", { className: e, style: l.style }, l.children);
376
- };
377
- V.displayName = "KendoReactFieldWrapper";
378
- const w = n.forwardRef((l, e) => {
379
- const t = {
380
- size: "medium",
381
- ...l
382
- }, i = n.useRef(null), o = n.useRef(null);
383
- n.useImperativeHandle(o, () => ({ element: i.current, props: t })), n.useImperativeHandle(e, () => o.current);
384
- const r = n.useContext(y), { className: d, style: s, horizontal: a, size: c, ...m } = t, f = b(
385
- {
386
- "k-form": !0,
387
- [`k-form-${T.sizeMap[c] || c}`]: c,
388
- "k-form-horizontal": a === !0
389
- },
390
- d
391
- );
392
- return /* @__PURE__ */ n.createElement(
393
- "form",
394
- {
395
- ref: i,
396
- ...m,
397
- id: r ? r.id : void 0,
398
- style: l.style,
399
- className: f,
400
- onSubmit: r ? r.onSubmit : void 0
401
- },
402
- l.children
403
- );
404
- });
405
- w.displayName = "KendoReactFormElement";
406
- const G = S(C);
407
- G.displayName = "KendoReactForm";
9
+ import { Field as a } from "./Field.mjs";
10
+ import { Form as o } from "./Form.mjs";
11
+ import { FieldArray as l } from "./FieldArray.mjs";
12
+ import { FieldWrapper as d } from "./FieldWrapper.mjs";
13
+ import { FormElement as n } from "./FormElement.mjs";
14
+ import { withIdHOC as r } from "@progress/kendo-react-common";
15
+ const e = r(o);
16
+ e.displayName = "KendoReactForm";
408
17
  export {
409
- M as Field,
410
- x as FieldArray,
411
- V as FieldWrapper,
412
- G as Form,
413
- C as FormClassComponent,
414
- w as FormElement
18
+ a as Field,
19
+ l as FieldArray,
20
+ d as FieldWrapper,
21
+ e as Form,
22
+ o as FormClassComponent,
23
+ n as FormElement
415
24
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-form",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ const e = {
10
+ name: "@progress/kendo-react-form",
11
+ productName: "KendoReact",
12
+ productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
13
+ publishDate: 1709715317,
14
+ version: "",
15
+ licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
+ };
17
+ export {
18
+ e as packageMetadata
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-form",
3
- "version": "7.2.4-develop.3",
3
+ "version": "7.3.0-develop.1",
4
4
  "description": "React Form is a small and fast package for form state management with zero dependencies. KendoReact Form package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -23,7 +23,7 @@
23
23
  "sideEffects": false,
24
24
  "peerDependencies": {
25
25
  "@progress/kendo-licensing": "^1.3.4",
26
- "@progress/kendo-react-common": "7.2.4-develop.3",
26
+ "@progress/kendo-react-common": "7.3.0-develop.1",
27
27
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0",
28
28
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
29
29
  },
package/Field.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- import { FieldProps } from './interfaces/FieldProps';
7
- /**
8
- * Represents the Field component that is used inside the KendoReact Form component.
9
- * It uses `name` property to access field value and meta information from Form state.
10
- */
11
- export declare const Field: {
12
- (props: FieldProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
13
- displayName: string;
14
- };
package/FieldArray.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- import { FieldArrayProps } from './interfaces/FieldArrayProps';
7
- /**
8
- * Represents the FieldArray component that is used inside the KendoReact Form component.
9
- * It provides methods via render props for common array manipulations.
10
- */
11
- export declare const FieldArray: React.FunctionComponent<FieldArrayProps>;
package/FieldWrapper.d.ts DELETED
@@ -1,32 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- /**
7
- * Represents the props of the KendoReact FieldWrapper component.
8
- */
9
- export interface FieldWrapperProps {
10
- /**
11
- * @hidden
12
- */
13
- children: any;
14
- /**
15
- * The styles that are applied to the FieldWrapper.
16
- */
17
- style?: React.CSSProperties;
18
- /**
19
- * Sets a class of the FieldWrapper DOM element.
20
- */
21
- className?: string;
22
- /**
23
- * Specifies the direction of the content.
24
- */
25
- dir?: string;
26
- }
27
- /**
28
- * Represents the KendoReact FieldWrapper component.
29
- * It's designed to wrap the field editor, Label, Hint and Error components.
30
- * The FieldWrapper supports only single editor inside it.
31
- */
32
- export declare const FieldWrapper: React.FunctionComponent<FieldWrapperProps>;