@progress/kendo-react-labels 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/Error.js ADDED
@@ -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 s=require("react"),r=require("prop-types"),c=require("@progress/kendo-react-common"),i=require("./package-metadata.js");function l(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const d=l(s),n=t=>{const e={direction:"start",...t};c.validatePackage(i.packageMetadata);const a=c.classNames({"k-form-error":!0,"k-text-start":e.direction==="start","k-text-end":e.direction==="end"},e.className);return d.createElement("div",{id:e.id,role:"alert",style:e.style,className:a},e.children)};n.propTypes={id:r.string,direction:r.oneOf(["start","end"]),children:r.oneOfType([r.element,r.node]),style:r.object,className:r.string};n.displayName="KendoReactError";exports.Error=n;
package/Error.mjs ADDED
@@ -0,0 +1,51 @@
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
+ import * as s from "react";
10
+ import e from "prop-types";
11
+ import { validatePackage as i, classNames as n } from "@progress/kendo-react-common";
12
+ import { packageMetadata as c } from "./package-metadata.mjs";
13
+ const t = (o) => {
14
+ const r = {
15
+ direction: "start",
16
+ ...o
17
+ };
18
+ i(c);
19
+ const a = n(
20
+ {
21
+ "k-form-error": !0,
22
+ "k-text-start": r.direction === "start",
23
+ "k-text-end": r.direction === "end"
24
+ },
25
+ r.className
26
+ );
27
+ return /* @__PURE__ */ s.createElement(
28
+ "div",
29
+ {
30
+ id: r.id,
31
+ role: "alert",
32
+ style: r.style,
33
+ className: a
34
+ },
35
+ r.children
36
+ );
37
+ };
38
+ t.propTypes = {
39
+ id: e.string,
40
+ direction: e.oneOf(["start", "end"]),
41
+ children: e.oneOfType([
42
+ e.element,
43
+ e.node
44
+ ]),
45
+ style: e.object,
46
+ className: e.string
47
+ };
48
+ t.displayName = "KendoReactError";
49
+ export {
50
+ t as Error
51
+ };
@@ -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 j=require("react"),e=require("prop-types"),i=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-intl"),n=require("./messages/index.js"),q=require("./package-metadata.js");function v(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}return t.default=a,Object.freeze(t)}const l=v(j),c=class c extends l.Component{constructor(t){super(t),this.state={focused:!1},this.handleFocus=s=>{this.setState({focused:!0})},this.handleBlur=s=>{this.setState({focused:!1})},i.validatePackage(q.packageMetadata)}render(){const{label:t,editorId:s,className:o,labelClassName:f,editorValue:d,editorPlaceholder:k,editorValid:N,editorDisabled:u,style:y,id:p,optional:O}=this.props,S=g.provideLocalizationService(this),m=O?S.toLanguageString(n.labelsOptional,n.messages[n.labelsOptional]):"",b=m&&l.createElement("span",{className:"k-label-optional"},m),P=i.classNames({"k-floating-label-container":!0,"k-focus":this.state.focused,"k-empty":!k&&!d&&d!==0,"k-text-disabled":u,"k-rtl":this.props.dir==="rtl"},o),h=i.classNames({"k-label":!0,"k-text-error":N===!1,"k-text-disabled":u},f);return l.createElement("span",{id:this.props.id,className:P,onFocus:this.handleFocus,onBlur:this.handleBlur,style:y,dir:this.props.dir},this.props.children,t?s?l.createElement("label",{id:p,htmlFor:s,className:h},t,b):l.createElement("span",{id:p,className:h},t,b):null)}};c.propTypes={label:e.string,editorId:e.string,editorValue:e.oneOfType([e.string,e.bool,e.number]),editorPlaceholder:e.string,editorValid:e.bool,editorDisabled:e.bool,id:e.string,style:e.object,className:e.string,labelClassName:e.string,optional:e.bool};let r=c;g.registerForLocalization(r);exports.FloatingLabel=r;
@@ -0,0 +1,78 @@
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
+ import * as s from "react";
10
+ import e from "prop-types";
11
+ import { validatePackage as C, classNames as m } from "@progress/kendo-react-common";
12
+ import { provideLocalizationService as E, registerForLocalization as S } from "@progress/kendo-react-intl";
13
+ import { labelsOptional as h, messages as v } from "./messages/index.mjs";
14
+ import { packageMetadata as z } from "./package-metadata.mjs";
15
+ const l = class l extends s.Component {
16
+ constructor(t) {
17
+ super(t), this.state = {
18
+ focused: !1
19
+ }, this.handleFocus = (a) => {
20
+ this.setState({ focused: !0 });
21
+ }, this.handleBlur = (a) => {
22
+ this.setState({ focused: !1 });
23
+ }, C(z);
24
+ }
25
+ /**
26
+ * @hidden
27
+ */
28
+ render() {
29
+ const { label: t, editorId: a, className: u, labelClassName: b, editorValue: r, editorPlaceholder: f, editorValid: g, editorDisabled: i, style: k, id: n, optional: N } = this.props, y = E(this), c = N ? y.toLanguageString(h, v[h]) : "", d = c && /* @__PURE__ */ s.createElement("span", { className: "k-label-optional" }, c), x = m(
30
+ {
31
+ "k-floating-label-container": !0,
32
+ "k-focus": this.state.focused,
33
+ "k-empty": !f && !r && r !== 0,
34
+ "k-text-disabled": i,
35
+ "k-rtl": this.props.dir === "rtl"
36
+ },
37
+ u
38
+ ), p = m(
39
+ {
40
+ "k-label": !0,
41
+ "k-text-error": g === !1,
42
+ "k-text-disabled": i
43
+ },
44
+ b
45
+ );
46
+ return /* @__PURE__ */ s.createElement(
47
+ "span",
48
+ {
49
+ id: this.props.id,
50
+ className: x,
51
+ onFocus: this.handleFocus,
52
+ onBlur: this.handleBlur,
53
+ style: k,
54
+ dir: this.props.dir
55
+ },
56
+ this.props.children,
57
+ t ? a ? /* @__PURE__ */ s.createElement("label", { id: n, htmlFor: a, className: p }, t, d) : /* @__PURE__ */ s.createElement("span", { id: n, className: p }, t, d) : null
58
+ );
59
+ }
60
+ };
61
+ l.propTypes = {
62
+ label: e.string,
63
+ editorId: e.string,
64
+ editorValue: e.oneOfType([e.string, e.bool, e.number]),
65
+ editorPlaceholder: e.string,
66
+ editorValid: e.bool,
67
+ editorDisabled: e.bool,
68
+ id: e.string,
69
+ style: e.object,
70
+ className: e.string,
71
+ labelClassName: e.string,
72
+ optional: e.bool
73
+ };
74
+ let o = l;
75
+ S(o);
76
+ export {
77
+ o as FloatingLabel
78
+ };
package/Hint.js ADDED
@@ -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 s=require("react"),t=require("prop-types"),o=require("@progress/kendo-react-common"),c=require("./package-metadata.js");function d(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>n[a]})}}return e.default=n,Object.freeze(e)}const l=d(s),r=n=>{const e={direction:"start",...n};o.validatePackage(c.packageMetadata);const a=o.classNames({"k-form-hint":!0,"k-text-start":e.direction==="start","k-text-end":e.direction==="end","k-text-disabled":e.editorDisabled===!0},e.className);return l.createElement("div",{id:e.id,style:e.style,className:a},e.children)};r.propTypes={id:t.string,direction:t.oneOf(["start","end"]),children:t.oneOfType([t.element,t.node]),style:t.object,className:t.string,editorDisabled:t.bool};r.displayName="KendoReactHint";exports.Hint=r;
package/Hint.mjs ADDED
@@ -0,0 +1,52 @@
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
+ import * as s from "react";
10
+ import e from "prop-types";
11
+ import { validatePackage as o, classNames as n } from "@progress/kendo-react-common";
12
+ import { packageMetadata as d } from "./package-metadata.mjs";
13
+ const i = (a) => {
14
+ const t = {
15
+ direction: "start",
16
+ ...a
17
+ };
18
+ o(d);
19
+ const r = n(
20
+ {
21
+ "k-form-hint": !0,
22
+ "k-text-start": t.direction === "start",
23
+ "k-text-end": t.direction === "end",
24
+ "k-text-disabled": t.editorDisabled === !0
25
+ },
26
+ t.className
27
+ );
28
+ return /* @__PURE__ */ s.createElement(
29
+ "div",
30
+ {
31
+ id: t.id,
32
+ style: t.style,
33
+ className: r
34
+ },
35
+ t.children
36
+ );
37
+ };
38
+ i.propTypes = {
39
+ id: e.string,
40
+ direction: e.oneOf(["start", "end"]),
41
+ children: e.oneOfType([
42
+ e.element,
43
+ e.node
44
+ ]),
45
+ style: e.object,
46
+ className: e.string,
47
+ editorDisabled: e.bool
48
+ };
49
+ i.displayName = "KendoReactHint";
50
+ export {
51
+ i as Hint
52
+ };
package/Label.js ADDED
@@ -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 j=require("react"),e=require("prop-types"),b=require("@progress/kendo-react-common"),n=require("./messages/index.js"),q=require("@progress/kendo-react-intl"),v=require("./package-metadata.js");function D(a){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const t=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(l,o,t.get?t:{enumerable:!0,get:()=>a[o]})}}return l.default=a,Object.freeze(l)}const r=D(j),c=a=>{b.validatePackage(v.packageMetadata);const{id:l,editorId:o,editorRef:t,editorDisabled:i,children:s,editorValid:f,style:m,className:g,optional:k}=a,y=q.useLocalization(),d=k?y.toLanguageString(n.labelsOptional,n.messages[n.labelsOptional]):"",O=d&&r.createElement("span",{className:"k-label-optional"},d),N=r.useCallback(u=>{if(t&&t.current&&!i){t.current.focus&&(u.preventDefault(),t.current.focus());const p=t.current.actionElement;p&&(u.preventDefault(),p.click())}},[t]),R=b.classNames({"k-label":!0,"k-label-empty":!s,"k-text-error":f===!1,"k-text-disabled":i===!0},g);return r.createElement("label",{id:l,htmlFor:o,onClick:N,style:m,className:R},s,O)};c.propTypes={id:e.string,editorId:e.string,editorRef:e.oneOfType([e.func,e.shape({current:e.any})]),editorValid:e.bool,editorDisabled:e.bool,style:e.object,className:e.string,optional:e.bool};c.displayName="KendoReactLabel";exports.Label=c;
package/Label.mjs ADDED
@@ -0,0 +1,64 @@
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
+ import * as a from "react";
10
+ import e from "prop-types";
11
+ import { validatePackage as L, classNames as v } from "@progress/kendo-react-common";
12
+ import { labelsOptional as s, messages as C } from "./messages/index.mjs";
13
+ import { useLocalization as D } from "@progress/kendo-react-intl";
14
+ import { packageMetadata as R } from "./package-metadata.mjs";
15
+ const c = (m) => {
16
+ L(R);
17
+ const { id: p, editorId: d, editorRef: t, editorDisabled: o, children: l, editorValid: f, style: b, className: u, optional: k } = m, g = D(), r = k ? g.toLanguageString(s, C[s]) : "", y = r && /* @__PURE__ */ a.createElement("span", { className: "k-label-optional" }, r), N = a.useCallback(
18
+ (i) => {
19
+ if (t && t.current && !o) {
20
+ t.current.focus && (i.preventDefault(), t.current.focus());
21
+ const n = t.current.actionElement;
22
+ n && (i.preventDefault(), n.click());
23
+ }
24
+ },
25
+ [t]
26
+ ), E = v(
27
+ {
28
+ "k-label": !0,
29
+ "k-label-empty": !l,
30
+ "k-text-error": f === !1,
31
+ "k-text-disabled": o === !0
32
+ },
33
+ u
34
+ );
35
+ return /* @__PURE__ */ a.createElement(
36
+ "label",
37
+ {
38
+ id: p,
39
+ htmlFor: d,
40
+ onClick: N,
41
+ style: b,
42
+ className: E
43
+ },
44
+ l,
45
+ y
46
+ );
47
+ };
48
+ c.propTypes = {
49
+ id: e.string,
50
+ editorId: e.string,
51
+ editorRef: e.oneOfType([
52
+ e.func,
53
+ e.shape({ current: e.any })
54
+ ]),
55
+ editorValid: e.bool,
56
+ editorDisabled: e.bool,
57
+ style: e.object,
58
+ className: e.string,
59
+ optional: e.bool
60
+ };
61
+ c.displayName = "KendoReactLabel";
62
+ export {
63
+ c as Label
64
+ };
@@ -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
- (function(l,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-intl"],o):(l=typeof globalThis!="undefined"?globalThis:l||self,o(l.KendoReactLabels={},l.React,l.PropTypes,l.KendoReactCommon,l.KendoReactIntl))})(this,function(l,o,e,r,O){"use strict";"use client";function F(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const a in i)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(i,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:()=>i[a]})}}return t.default=i,Object.freeze(t)}const n=F(o),c="labels.optional",z={[c]:"(Optional)"},m={name:"@progress/kendo-react-labels",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},v=i=>{r.validatePackage(m);const{id:t,editorId:a,editorRef:s,editorDisabled:b,children:d,editorValid:j,style:x,className:f,optional:K}=i,g=O.useLocalization(),h=K?g.toLanguageString(c,z[c]):"",p=h&&n.createElement("span",{className:"k-label-optional"},h),N=n.useCallback(E=>{if(s&&s.current&&!b){s.current.focus&&(E.preventDefault(),s.current.focus());const u=s.current.actionElement;u&&(E.preventDefault(),u.click())}},[s]),k=r.classNames({"k-label":!0,"k-label-empty":!d,"k-text-error":j===!1,"k-text-disabled":b===!0},f);return n.createElement("label",{id:t,htmlFor:a,onClick:N,style:x,className:k},d,p)};v.propTypes={id:e.string,editorId:e.string,editorRef:e.oneOfType([e.func,e.shape({current:e.any})]),editorValid:e.bool,editorDisabled:e.bool,style:e.object,className:e.string,optional:e.bool},v.displayName="KendoReactLabel";const D=i=>{const t={direction:"start",...i};r.validatePackage(m);const a=r.classNames({"k-form-error":!0,"k-text-start":t.direction==="start","k-text-end":t.direction==="end"},t.className);return n.createElement("div",{id:t.id,role:"alert",style:t.style,className:a},t.children)};D.propTypes={id:e.string,direction:e.oneOf(["start","end"]),children:e.oneOfType([e.element,e.node]),style:e.object,className:e.string},D.displayName="KendoReactError";const L=i=>{const t={direction:"start",...i};r.validatePackage(m);const a=r.classNames({"k-form-hint":!0,"k-text-start":t.direction==="start","k-text-end":t.direction==="end","k-text-disabled":t.editorDisabled===!0},t.className);return n.createElement("div",{id:t.id,style:t.style,className:a},t.children)};L.propTypes={id:e.string,direction:e.oneOf(["start","end"]),children:e.oneOfType([e.element,e.node]),style:e.object,className:e.string,editorDisabled:e.bool},L.displayName="KendoReactHint";class S extends n.Component{constructor(t){super(t),this.state={focused:!1},this.handleFocus=a=>{this.setState({focused:!0})},this.handleBlur=a=>{this.setState({focused:!1})},r.validatePackage(m)}render(){const{label:t,editorId:a,className:s,labelClassName:b,editorValue:d,editorPlaceholder:j,editorValid:x,editorDisabled:f,style:K,id:g,optional:h}=this.props,p=O.provideLocalizationService(this),N=h?p.toLanguageString(c,z[c]):"",k=N&&n.createElement("span",{className:"k-label-optional"},N),E=r.classNames({"k-floating-label-container":!0,"k-focus":this.state.focused,"k-empty":!j&&!d&&d!==0,"k-text-disabled":f,"k-rtl":this.props.dir==="rtl"},s),u=r.classNames({"k-label":!0,"k-text-error":x===!1,"k-text-disabled":f},b);return n.createElement("span",{id:this.props.id,className:E,onFocus:this.handleFocus,onBlur:this.handleBlur,style:K,dir:this.props.dir},this.props.children,t?a?n.createElement("label",{id:g,htmlFor:a,className:u},t,k):n.createElement("span",{id:g,className:u},t,k):null)}}S.propTypes={label:e.string,editorId:e.string,editorValue:e.oneOfType([e.string,e.bool,e.number]),editorPlaceholder:e.string,editorValid:e.bool,editorDisabled:e.bool,id:e.string,style:e.object,className:e.string,labelClassName:e.string,optional:e.bool},O.registerForLocalization(S),l.Error=D,l.FloatingLabel=S,l.Hint=L,l.Label=v,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
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
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-intl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactLabels={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoReactIntl)}(this,(function(e,t,s,r,a){"use strict";function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var l=o(t);const i="labels.optional",n={[i]:"(Optional)"},c={name:"@progress/kendo-react-labels",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},d=e=>{r.validatePackage(c);const{id:t,editorId:s,editorRef:o,editorDisabled:d,children:p,editorValid:m,style:u,className:b,optional:f}=e,g=a.useLocalization(),y=f?g.toLanguageString(i,n[i]):"",h=y&&l.createElement("span",{className:"k-label-optional"},y),k=l.useCallback((e=>{if(o&&o.current&&!d){o.current.focus&&(e.preventDefault(),o.current.focus());const t=o.current.actionElement;t&&(e.preventDefault(),t.click())}}),[o]),N=r.classNames({"k-label":!0,"k-label-empty":!p,"k-text-error":!1===m,"k-text-disabled":!0===d},b);return l.createElement("label",{id:t,htmlFor:s,onClick:k,style:u,className:N},p,h)};d.propTypes={id:s.string,editorId:s.string,editorRef:s.oneOfType([s.func,s.shape({current:s.any})]),editorValid:s.bool,editorDisabled:s.bool,style:s.object,className:s.string,optional:s.bool},d.displayName="KendoReactLabel";const p=e=>{const t={direction:"start",...e};r.validatePackage(c);const s=r.classNames({"k-form-error":!0,"k-text-start":"start"===t.direction,"k-text-end":"end"===t.direction},t.className);return l.createElement("div",{id:t.id,role:"alert",style:t.style,className:s},t.children)};p.propTypes={id:s.string,direction:s.oneOf(["start","end"]),children:s.oneOfType([s.element,s.node]),style:s.object,className:s.string},p.displayName="KendoReactError";const m=e=>{const t={direction:"start",...e};r.validatePackage(c);const s=r.classNames({"k-form-hint":!0,"k-text-start":"start"===t.direction,"k-text-end":"end"===t.direction,"k-text-disabled":!0===t.editorDisabled},t.className);return l.createElement("div",{id:t.id,style:t.style,className:s},t.children)};m.propTypes={id:s.string,direction:s.oneOf(["start","end"]),children:s.oneOfType([s.element,s.node]),style:s.object,className:s.string,editorDisabled:s.bool},m.displayName="KendoReactHint";const u=class extends l.Component{constructor(e){super(e),this.state={focused:!1},this.handleFocus=e=>{this.setState({focused:!0})},this.handleBlur=e=>{this.setState({focused:!1})},r.validatePackage(c)}render(){const{label:e,editorId:t,className:s,labelClassName:o,editorValue:c,editorPlaceholder:d,editorValid:p,editorDisabled:m,style:u,id:b,optional:f}=this.props,g=a.provideLocalizationService(this),y=f?g.toLanguageString(i,n[i]):"",h=y&&l.createElement("span",{className:"k-label-optional"},y),k=r.classNames({"k-floating-label-container":!0,"k-focus":this.state.focused,"k-empty":!d&&!c&&0!==c,"k-text-disabled":m,"k-rtl":"rtl"===this.props.dir},s),N=r.classNames({"k-label":!0,"k-text-error":!1===p,"k-text-disabled":m},o);return l.createElement("span",{id:this.props.id,className:k,onFocus:this.handleFocus,onBlur:this.handleBlur,style:u,dir:this.props.dir},this.props.children,e?t?l.createElement("label",{id:b,htmlFor:t,className:N},e,h):l.createElement("span",{id:b,className:N},e,h):null)}};u.propTypes={label:s.string,editorId:s.string,editorValue:s.oneOfType([s.string,s.bool,s.number]),editorPlaceholder:s.string,editorValid:s.bool,editorDisabled:s.bool,id:s.string,style:s.object,className:s.string,labelClassName:s.string,optional:s.bool};let b=u;a.registerForLocalization(b),e.Error=p,e.FloatingLabel=b,e.Hint=m,e.Label=d}));
package/index.d.mts CHANGED
@@ -1,5 +1,331 @@
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
- export * from './index';
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
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
9
+ import { KendoReactComponentBaseProps } from '@progress/kendo-react-common';
10
+ import PropTypes from 'prop-types';
11
+ import * as React_2 from 'react';
12
+
13
+ /**
14
+ * Represents the KendoReact Error component.
15
+ * Render the error text that will be shown underneath the form editor after a validation.
16
+ */
17
+ declare const Error_2: {
18
+ (props: ErrorProps): JSX_2.Element;
19
+ propTypes: {
20
+ id: PropTypes.Requireable<string>;
21
+ direction: PropTypes.Requireable<string>;
22
+ children: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
23
+ style: PropTypes.Requireable<object>;
24
+ className: PropTypes.Requireable<string>;
25
+ };
26
+ displayName: string;
27
+ };
28
+ export { Error_2 as Error }
29
+
30
+ /**
31
+ * Represents the props of the KendoReact Error component.
32
+ */
33
+ export declare interface ErrorProps {
34
+ /**
35
+ * Represents the id of the Error element.
36
+ * The value should be also set to the editor's `ariaDescribedBy` property.
37
+ */
38
+ id?: string;
39
+ /**
40
+ * Specifies the alignment of the Error text.
41
+ *
42
+ * The possible values are:
43
+ * * (Default) `start`
44
+ * * `end`
45
+ */
46
+ direction?: 'start' | 'end';
47
+ /**
48
+ * Determines the children nodes.
49
+ */
50
+ children: any;
51
+ /**
52
+ * The styles that are applied to the Error.
53
+ */
54
+ style?: React_2.CSSProperties;
55
+ /**
56
+ * Sets a class of the Error DOM element.
57
+ */
58
+ className?: string;
59
+ }
60
+
61
+ /**
62
+ * Represents the KendoReact FloatingLabel component.
63
+ *
64
+ * @example
65
+ * ```jsx
66
+ * const sizes = ["X-Small", "Small", "Medium", "Large", "X-Large", "2X-Large"];
67
+ * const App = () => {
68
+ * const [ddlState, setDdlState] = React.useState();
69
+ * const editorId = 'ddl-sizes';
70
+ * return (
71
+ * <FloatingLabel label={'Shirt Size:'} editorId={editorId} editorValue={ddlState}>
72
+ * <DropDownList
73
+ * id={editorId}
74
+ * value={ddlState}
75
+ * data={sizes}
76
+ * onChange={(e) => setDdlState(e.target.value)}
77
+ * />
78
+ * </FloatingLabel>
79
+ * );
80
+ * };
81
+ *
82
+ * ReactDOM.render(<App />, document.querySelector('my-app'));
83
+ * ```
84
+ */
85
+ export declare class FloatingLabel extends React_2.Component<FloatingLabelProps, FloatingLabelState> {
86
+ /**
87
+ * @hidden
88
+ */
89
+ static propTypes: {
90
+ label: PropTypes.Requireable<string>;
91
+ editorId: PropTypes.Requireable<string>;
92
+ editorValue: PropTypes.Requireable<NonNullable<string | number | boolean | null | undefined>>;
93
+ editorPlaceholder: PropTypes.Requireable<string>;
94
+ editorValid: PropTypes.Requireable<boolean>;
95
+ editorDisabled: PropTypes.Requireable<boolean>;
96
+ id: PropTypes.Requireable<string>;
97
+ style: PropTypes.Requireable<object>;
98
+ className: PropTypes.Requireable<string>;
99
+ labelClassName: PropTypes.Requireable<string>;
100
+ optional: PropTypes.Requireable<boolean>;
101
+ };
102
+ /**
103
+ * @hidden
104
+ */
105
+ readonly state: FloatingLabelState;
106
+ constructor(props: FloatingLabelProps);
107
+ /**
108
+ * @hidden
109
+ */
110
+ handleFocus: (_: React_2.SyntheticEvent<HTMLSpanElement>) => void;
111
+ /**
112
+ * @hidden
113
+ */
114
+ handleBlur: (_: React_2.SyntheticEvent<HTMLSpanElement>) => void;
115
+ /**
116
+ * @hidden
117
+ */
118
+ render(): JSX_2.Element;
119
+ }
120
+
121
+ /**
122
+ * Represents the props of the KendoReact FloatingLabel component.
123
+ */
124
+ export declare interface FloatingLabelProps extends KendoReactComponentBaseProps {
125
+ /**
126
+ * Represent the [`htmlFor`](https://reactjs.org/docs/dom-elements.html#htmlfor) property, which will be set to the `label` element.
127
+ */
128
+ editorId?: string;
129
+ /**
130
+ * Specifies the value of the editor. Used to define if the editor is empty.
131
+ */
132
+ editorValue?: any;
133
+ /**
134
+ * Specifies the placeholder of the editor. Used to define if the editor is empty.
135
+ */
136
+ editorPlaceholder?: string;
137
+ /**
138
+ * Specifies if the validity of the editor. Used to define the editor is invalid.
139
+ */
140
+ editorValid?: boolean;
141
+ /**
142
+ * Specifies if the editor is disabled.
143
+ */
144
+ editorDisabled?: boolean;
145
+ /**
146
+ * Adds a floating label that describes the editor.
147
+ */
148
+ label?: string;
149
+ /**
150
+ * The styles that are applied to the FloatingLabel.
151
+ */
152
+ style?: React_2.CSSProperties;
153
+ /**
154
+ * Sets a class of the FloatingLabel DOM element.
155
+ */
156
+ className?: string;
157
+ /**
158
+ * Sets the `className` of the label DOM element.
159
+ */
160
+ labelClassName?: string;
161
+ /**
162
+ * Specifies the direction of the label.
163
+ */
164
+ dir?: string;
165
+ /**
166
+ * Represents the id of the label element.
167
+ * The value should be also set to the editor's `ariaLabelledBy` property.
168
+ * Can be used when the editor is not containing native form element.
169
+ */
170
+ id?: string;
171
+ /**
172
+ * If enabled, marks the label as optional.
173
+ */
174
+ optional?: boolean;
175
+ }
176
+
177
+ /**
178
+ * @hidden
179
+ */
180
+ declare interface FloatingLabelState {
181
+ focused?: boolean;
182
+ }
183
+
184
+ /**
185
+ * Represents the KendoReact Hint component.
186
+ * Render the hint text that will be shown underneath the form editor.
187
+ */
188
+ export declare const Hint: {
189
+ (props: HintProps): JSX_2.Element;
190
+ propTypes: {
191
+ id: PropTypes.Requireable<string>;
192
+ direction: PropTypes.Requireable<string>;
193
+ children: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
194
+ style: PropTypes.Requireable<object>;
195
+ className: PropTypes.Requireable<string>;
196
+ editorDisabled: PropTypes.Requireable<boolean>;
197
+ };
198
+ displayName: string;
199
+ };
200
+
201
+ /**
202
+ * Represents the props of the KendoReact Hint component.
203
+ */
204
+ export declare interface HintProps {
205
+ /**
206
+ * Represents the id of the Hint element.
207
+ * The value should be set to the editor `ariaDescribedBy` property.
208
+ */
209
+ id?: string;
210
+ /**
211
+ * Spcifies the alignment of the Hint text.
212
+ *
213
+ * The possible values are:
214
+ * *(Default) `start`
215
+ * * `end`
216
+ */
217
+ direction?: 'start' | 'end';
218
+ /**
219
+ * @hidden
220
+ */
221
+ children: any;
222
+ /**
223
+ * The styles that are applied to the Hint.
224
+ */
225
+ style?: React_2.CSSProperties;
226
+ /**
227
+ * Sets a class of the Hint DOM element.
228
+ */
229
+ className?: string;
230
+ /**
231
+ * Specifies if the editor is disabled.
232
+ */
233
+ editorDisabled?: boolean;
234
+ }
235
+
236
+ /**
237
+ * Represents the KendoReact Label component.
238
+ *
239
+ * @example
240
+ * ```jsx
241
+ * const sizes = ["X-Small", "Small", "Medium", "Large", "X-Large", "2X-Large"];
242
+ * const App = () => {
243
+ * const ddlRef = React.useRef(null);
244
+ * const labelId = 'ddl-sizes-label';
245
+ * const editorId = 'ddl-sizes';
246
+ *
247
+ * return (
248
+ * <div>
249
+ * <Label id={labelId} editorId={editorId} editorRef={ddlRef}>
250
+ * Shirt Size:
251
+ * </Label>
252
+ * <DropDownList
253
+ * ref={ddlRef}
254
+ * id={editorId}
255
+ * ariaLabelledBy={labelId}
256
+ * data={sizes}
257
+ * />
258
+ * <br />
259
+ * </div>
260
+ * );
261
+ * };
262
+ *
263
+ * ReactDOM.render(<App />, document.querySelector('my-app'));
264
+ * ```
265
+ */
266
+ export declare const Label: {
267
+ (props: LabelProps): JSX_2.Element;
268
+ propTypes: {
269
+ id: PropTypes.Requireable<string>;
270
+ editorId: PropTypes.Requireable<string>;
271
+ editorRef: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.InferProps<{
272
+ current: PropTypes.Requireable<any>;
273
+ }> | null | undefined>>;
274
+ editorValid: PropTypes.Requireable<boolean>;
275
+ editorDisabled: PropTypes.Requireable<boolean>;
276
+ style: PropTypes.Requireable<object>;
277
+ className: PropTypes.Requireable<string>;
278
+ optional: PropTypes.Requireable<boolean>;
279
+ };
280
+ displayName: string;
281
+ };
282
+
283
+ /**
284
+ * Represents the props of the KendoReact Label component.
285
+ */
286
+ export declare interface LabelProps {
287
+ /**
288
+ * Represents the id of the label element.
289
+ * The value should be set to the editor `ariaLabelledBy` property.
290
+ * Can be used when the editor is not containing native form element.
291
+ */
292
+ id?: string;
293
+ /**
294
+ * The id of the editor.
295
+ * Represent the [`htmlFor`](https://reactjs.org/docs/dom-elements.html#htmlfor) property, which will be set to the `label` element.
296
+ */
297
+ editorId?: string;
298
+ /**
299
+ * An optional React ref to the editor.
300
+ * Used to redirect the click event to the editor when it does not contain native form element.
301
+ * To be able to work, the editor should have `focus` method or `actionElement` prop on it's ref.
302
+ */
303
+ editorRef?: any;
304
+ /**
305
+ * The text that will be rendered inside the label element.
306
+ * Can be omitted for editors without label to keep form layout.
307
+ */
308
+ children?: any;
309
+ /**
310
+ * Specifies the validity of the editor. Used to define the editor is invalid.
311
+ */
312
+ editorValid?: boolean;
313
+ /**
314
+ * Specifies if the editor is disabled.
315
+ */
316
+ editorDisabled?: boolean;
317
+ /**
318
+ * If enabled marks the label as optional.
319
+ */
320
+ optional?: boolean;
321
+ /**
322
+ * The styles that are applied to the Label.
323
+ */
324
+ style?: React_2.CSSProperties;
325
+ /**
326
+ * Sets a class of the Label DOM element.
327
+ */
328
+ className?: string;
329
+ }
330
+
331
+ export { }