@progress/kendo-react-inputs 11.0.0-develop.2 → 11.0.0-develop.21
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/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +125 -124
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +70 -70
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +10 -9
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +35 -5
- package/index.d.ts +35 -5
- package/input/Input.js +1 -1
- package/input/Input.mjs +1 -1
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -11
- package/rating/Rating.js +3 -3
- package/rating/Rating.mjs +34 -34
package/index.d.mts
CHANGED
|
@@ -1202,12 +1202,36 @@ export declare interface ColorPickerProps {
|
|
|
1202
1202
|
className?: string;
|
|
1203
1203
|
/**
|
|
1204
1204
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
1205
|
+
*
|
|
1206
|
+
* @default `false`
|
|
1207
|
+
*
|
|
1208
|
+
* @example
|
|
1209
|
+
* ```jsx
|
|
1210
|
+
* <ColorPicker adaptive={true} />
|
|
1211
|
+
* ```
|
|
1205
1212
|
*/
|
|
1206
1213
|
adaptive?: boolean;
|
|
1207
1214
|
/**
|
|
1208
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
1215
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
1216
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1217
|
+
* If not provided, the title will be the same as the label.
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
* ```jsx
|
|
1221
|
+
* <ColorPicker adaptiveTitle="Adaptive Popup Title" />
|
|
1222
|
+
* ```
|
|
1209
1223
|
*/
|
|
1210
1224
|
adaptiveTitle?: string;
|
|
1225
|
+
/**
|
|
1226
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
1227
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1228
|
+
*
|
|
1229
|
+
* @example
|
|
1230
|
+
* ```jsx
|
|
1231
|
+
* <ColorPicker adaptiveSubtitle="Adaptive Popup Subtitle" />
|
|
1232
|
+
* ```
|
|
1233
|
+
*/
|
|
1234
|
+
adaptiveSubtitle?: string;
|
|
1211
1235
|
}
|
|
1212
1236
|
|
|
1213
1237
|
/**
|
|
@@ -1520,7 +1544,7 @@ export declare interface InputProps extends Omit_2<React_2.InputHTMLAttributes<H
|
|
|
1520
1544
|
/**
|
|
1521
1545
|
* Renders a floating label for the Input component.
|
|
1522
1546
|
*/
|
|
1523
|
-
label?:
|
|
1547
|
+
label?: React_2.ReactNode;
|
|
1524
1548
|
/**
|
|
1525
1549
|
* Sets a `className` for the floating label.
|
|
1526
1550
|
*/
|
|
@@ -1889,7 +1913,7 @@ export declare interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
1889
1913
|
/**
|
|
1890
1914
|
* Renders a floating label for the MaskedTextBox.
|
|
1891
1915
|
*/
|
|
1892
|
-
label?:
|
|
1916
|
+
label?: React.ReactNode;
|
|
1893
1917
|
/**
|
|
1894
1918
|
* Sets the `id` of the `input` DOM element.
|
|
1895
1919
|
*/
|
|
@@ -2073,7 +2097,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
2073
2097
|
end: default_2.Validator<number>;
|
|
2074
2098
|
}>>;
|
|
2075
2099
|
name: default_2.Requireable<string>;
|
|
2076
|
-
label: default_2.Requireable<
|
|
2100
|
+
label: default_2.Requireable<default_2.ReactNodeLike>;
|
|
2077
2101
|
validationMessage: default_2.Requireable<string>;
|
|
2078
2102
|
required: default_2.Requireable<boolean>;
|
|
2079
2103
|
valid: default_2.Requireable<boolean>;
|
|
@@ -2967,6 +2991,9 @@ export declare const rangeReducer: (state: any, action: RangeAction) => any;
|
|
|
2967
2991
|
*
|
|
2968
2992
|
* Accepts properties of type [RangeSliderProps]({% slug api_inputs_rangesliderprops %}).
|
|
2969
2993
|
* Obtaining the `ref` returns an object of type [RangeSliderHandle]({% slug api_inputs_rangesliderhandle %}).
|
|
2994
|
+
*
|
|
2995
|
+
* @remarks
|
|
2996
|
+
* Supported children components are: {@link SliderLabel}.
|
|
2970
2997
|
*/
|
|
2971
2998
|
export declare const RangeSlider: React_2.ForwardRefExoticComponent<RangeSliderProps & React_2.RefAttributes<RangeSliderHandle | null>>;
|
|
2972
2999
|
|
|
@@ -3479,7 +3506,7 @@ export declare interface RatingProps extends FormComponentProps {
|
|
|
3479
3506
|
* <Rating label="Rating Label" />
|
|
3480
3507
|
* ```
|
|
3481
3508
|
*/
|
|
3482
|
-
label?:
|
|
3509
|
+
label?: React_2.ReactNode;
|
|
3483
3510
|
/**
|
|
3484
3511
|
* Sets the `readonly` mode of the Rating.
|
|
3485
3512
|
*
|
|
@@ -4070,6 +4097,9 @@ export declare interface SliderChangeEvent extends BaseEvent<Slider> {
|
|
|
4070
4097
|
|
|
4071
4098
|
/**
|
|
4072
4099
|
* Represent the `ref` of the Slider component.
|
|
4100
|
+
*
|
|
4101
|
+
* @remarks
|
|
4102
|
+
* Supported children components are: {@link SliderLabel}.
|
|
4073
4103
|
*/
|
|
4074
4104
|
export declare interface SliderHandle extends Pick<SliderWithoutContext, keyof SliderWithoutContext> {
|
|
4075
4105
|
}
|
package/index.d.ts
CHANGED
|
@@ -1202,12 +1202,36 @@ export declare interface ColorPickerProps {
|
|
|
1202
1202
|
className?: string;
|
|
1203
1203
|
/**
|
|
1204
1204
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
1205
|
+
*
|
|
1206
|
+
* @default `false`
|
|
1207
|
+
*
|
|
1208
|
+
* @example
|
|
1209
|
+
* ```jsx
|
|
1210
|
+
* <ColorPicker adaptive={true} />
|
|
1211
|
+
* ```
|
|
1205
1212
|
*/
|
|
1206
1213
|
adaptive?: boolean;
|
|
1207
1214
|
/**
|
|
1208
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
1215
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
1216
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1217
|
+
* If not provided, the title will be the same as the label.
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
* ```jsx
|
|
1221
|
+
* <ColorPicker adaptiveTitle="Adaptive Popup Title" />
|
|
1222
|
+
* ```
|
|
1209
1223
|
*/
|
|
1210
1224
|
adaptiveTitle?: string;
|
|
1225
|
+
/**
|
|
1226
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
1227
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1228
|
+
*
|
|
1229
|
+
* @example
|
|
1230
|
+
* ```jsx
|
|
1231
|
+
* <ColorPicker adaptiveSubtitle="Adaptive Popup Subtitle" />
|
|
1232
|
+
* ```
|
|
1233
|
+
*/
|
|
1234
|
+
adaptiveSubtitle?: string;
|
|
1211
1235
|
}
|
|
1212
1236
|
|
|
1213
1237
|
/**
|
|
@@ -1520,7 +1544,7 @@ export declare interface InputProps extends Omit_2<React_2.InputHTMLAttributes<H
|
|
|
1520
1544
|
/**
|
|
1521
1545
|
* Renders a floating label for the Input component.
|
|
1522
1546
|
*/
|
|
1523
|
-
label?:
|
|
1547
|
+
label?: React_2.ReactNode;
|
|
1524
1548
|
/**
|
|
1525
1549
|
* Sets a `className` for the floating label.
|
|
1526
1550
|
*/
|
|
@@ -1889,7 +1913,7 @@ export declare interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
1889
1913
|
/**
|
|
1890
1914
|
* Renders a floating label for the MaskedTextBox.
|
|
1891
1915
|
*/
|
|
1892
|
-
label?:
|
|
1916
|
+
label?: React.ReactNode;
|
|
1893
1917
|
/**
|
|
1894
1918
|
* Sets the `id` of the `input` DOM element.
|
|
1895
1919
|
*/
|
|
@@ -2073,7 +2097,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
2073
2097
|
end: default_2.Validator<number>;
|
|
2074
2098
|
}>>;
|
|
2075
2099
|
name: default_2.Requireable<string>;
|
|
2076
|
-
label: default_2.Requireable<
|
|
2100
|
+
label: default_2.Requireable<default_2.ReactNodeLike>;
|
|
2077
2101
|
validationMessage: default_2.Requireable<string>;
|
|
2078
2102
|
required: default_2.Requireable<boolean>;
|
|
2079
2103
|
valid: default_2.Requireable<boolean>;
|
|
@@ -2967,6 +2991,9 @@ export declare const rangeReducer: (state: any, action: RangeAction) => any;
|
|
|
2967
2991
|
*
|
|
2968
2992
|
* Accepts properties of type [RangeSliderProps]({% slug api_inputs_rangesliderprops %}).
|
|
2969
2993
|
* Obtaining the `ref` returns an object of type [RangeSliderHandle]({% slug api_inputs_rangesliderhandle %}).
|
|
2994
|
+
*
|
|
2995
|
+
* @remarks
|
|
2996
|
+
* Supported children components are: {@link SliderLabel}.
|
|
2970
2997
|
*/
|
|
2971
2998
|
export declare const RangeSlider: React_2.ForwardRefExoticComponent<RangeSliderProps & React_2.RefAttributes<RangeSliderHandle | null>>;
|
|
2972
2999
|
|
|
@@ -3479,7 +3506,7 @@ export declare interface RatingProps extends FormComponentProps {
|
|
|
3479
3506
|
* <Rating label="Rating Label" />
|
|
3480
3507
|
* ```
|
|
3481
3508
|
*/
|
|
3482
|
-
label?:
|
|
3509
|
+
label?: React_2.ReactNode;
|
|
3483
3510
|
/**
|
|
3484
3511
|
* Sets the `readonly` mode of the Rating.
|
|
3485
3512
|
*
|
|
@@ -4070,6 +4097,9 @@ export declare interface SliderChangeEvent extends BaseEvent<Slider> {
|
|
|
4070
4097
|
|
|
4071
4098
|
/**
|
|
4072
4099
|
* Represent the `ref` of the Slider component.
|
|
4100
|
+
*
|
|
4101
|
+
* @remarks
|
|
4102
|
+
* Supported children components are: {@link SliderLabel}.
|
|
4073
4103
|
*/
|
|
4074
4104
|
export declare interface SliderHandle extends Pick<SliderWithoutContext, keyof SliderWithoutContext> {
|
|
4075
4105
|
}
|
package/input/Input.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),a=require("prop-types"),l=require("@progress/kendo-react-common"),X=require("@progress/kendo-react-labels");function Y(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const u in s)if(u!=="default"){const c=Object.getOwnPropertyDescriptor(s,u);Object.defineProperty(o,u,c.get?c:{enumerable:!0,get:()=>s[u]})}}return o.default=s,Object.freeze(o)}const r=Y(W),m=r.forwardRef((s,o)=>{const c=r.useContext(R).call(void 0,s),[,N]=r.useReducer(t=>t,!0),n=l.applyDefaultProps(c,Z),{className:k,label:p,labelClassName:x,id:E,validationMessage:h,defaultValue:S,valid:C,unstyled:V,visited:$,touched:ee,modified:te,autoFocus:w,ariaLabelledBy:D,ariaDescribedBy:q,validityStyles:I,style:P,ariaLabel:F,...U}=n,j=l.useUnstyled(),f=V||j,B=f&&f.uInput,T=l.useId(),[_,A]=r.useState({value:S}),L=E||T,e=r.useRef(null),d=r.useRef(void 0),y=r.useRef(null),G=()=>{e.current&&e.current.focus()},
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),a=require("prop-types"),l=require("@progress/kendo-react-common"),X=require("@progress/kendo-react-labels");function Y(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const u in s)if(u!=="default"){const c=Object.getOwnPropertyDescriptor(s,u);Object.defineProperty(o,u,c.get?c:{enumerable:!0,get:()=>s[u]})}}return o.default=s,Object.freeze(o)}const r=Y(W),m=r.forwardRef((s,o)=>{const c=r.useContext(R).call(void 0,s),[,N]=r.useReducer(t=>t,!0),n=l.applyDefaultProps(c,Z),{className:k,label:p,labelClassName:x,id:E,validationMessage:h,defaultValue:S,valid:C,unstyled:V,visited:$,touched:ee,modified:te,autoFocus:w,ariaLabelledBy:D,ariaDescribedBy:q,validityStyles:I,style:P,ariaLabel:F,...U}=n,j=l.useUnstyled(),f=V||j,B=f&&f.uInput,T=l.useId(),[_,A]=r.useState({value:S}),L=E||T,e=r.useRef(null),d=r.useRef(void 0),y=r.useRef(null),G=()=>{e.current&&e.current.focus()},b=()=>d.current!==void 0?d.current:n.value!==void 0?n.value:_.value,v=()=>{const t={badInput:e.current?e.current.validity.badInput:!1,patternMismatch:e.current?e.current.validity.patternMismatch:!1,rangeOverflow:e.current?e.current.validity.rangeOverflow:!1,rangeUnderflow:e.current?e.current.validity.rangeUnderflow:!1,stepMismatch:e.current?e.current.validity.stepMismatch:!1,tooLong:e.current?e.current.validity.tooLong:!1,typeMismatch:e.current?e.current.validity.typeMismatch:!1,valueMissing:e.current?e.current.validity.valueMissing:!1};return{...t,customError:h!==void 0,valid:C!==void 0?C:e.current?!H(t):!0}};r.useImperativeHandle(y,()=>({element:e.current,props:n,get value(){return b()},name:n.name,get validity(){return v()},focus:G})),r.useImperativeHandle(o,()=>y.current);const H=t=>{let i=!1;for(const O in t)t.hasOwnProperty(O)&&(i=i||!!t[O]);return i},g=!I||v().valid,z=l.classNames(k,l.uInput.input({c:B,invalid:!g,disabled:n.disabled})),K=()=>{e.current&&e.current.setCustomValidity&&(v().valid||!I?e.current.classList.remove("k-invalid"):e.current.classList.add("k-invalid"),e.current.setCustomValidity(v().valid?"":h||""))},J=t=>{A({value:t.target.value}),d.current=t.target.value,n.onChange&&n.onChange.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:t.target.value,target:y.current}),d.current=void 0},Q=t=>{if(t.animationName==="autoFillStart"){const i=t.target.parentNode;i&&i.classList.contains("k-empty")&&i.classList.remove("k-empty")}};r.useEffect(()=>{N()},[]),r.useEffect(()=>{K()});const M=r.createElement("input",{"aria-labelledby":D,"aria-describedby":q,"aria-disabled":n.disabled||void 0,"aria-invalid":!g||void 0,"aria-label":F||void 0,...U,style:p?void 0:P,value:b(),id:L,autoFocus:w,className:z,onChange:J,onAnimationStart:Q,ref:e});return p?r.createElement(X.FloatingLabel,{label:p,labelClassName:x,editorId:L,editorValue:String(b()),editorValid:g,editorDisabled:n.disabled,editorPlaceholder:n.placeholder,children:M,style:P,dir:n.dir,unstyled:f}):M}),R=l.createPropsContext(),Z={defaultValue:"",required:!1,validityStyles:!0,autoFocus:!1};m.displayName="KendoReactInput";m.propTypes={label:a.node,labelClassName:a.string,validationMessage:a.string,required:a.bool,validate:a.bool,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,ariaLabel:a.string,autoFocus:a.bool,value:a.oneOfType([a.string,a.number,a.array])};exports.Input=m;exports.InputPropsContext=R;
|
package/input/Input.mjs
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),e=require("prop-types"),E=require("./masking.service.js"),c=require("./utils.js"),n=require("@progress/kendo-react-common"),M=require("@progress/kendo-react-labels");function V(p){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const s in p)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(p,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>p[s]})}}return t.default=p,Object.freeze(t)}const u=V(O),l=class l extends u.Component{constructor(){super(...arguments),this.state={},this._inputId=`k_${this.props.id}`,this._service=new E.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.pasteHandler=t=>{const{selectionStart:s,selectionEnd:i}=t.target;i!==s&&(this._isPasted=!0,this._selection=[s||0,i||0])},this.onChangeHandler=t=>{const s=t.currentTarget,i=s.value,a=this._selection[0]||0,o=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(i,t);return}const r=this.value;let d;if(this._isPasted){this._isPasted=!1;const h=r.length-o,v=i.length-h;d=this._service.maskInRange(i.slice(a,v),r,a,o)}else d=this._service.maskInput(i,r,s.selectionStart||0);this._selection=[d.selection,d.selection],this.triggerOnChange(d.value,t)},this.focusHandler=t=>{this.state.focused||(this.setState({focused:!0}),this.props.onFocus&&this.props.onFocus.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.blurHandler=t=>{this.state.focused&&(this.setState({focused:!1}),this.props.onBlur&&this.props.onBlur.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.setValidity=()=>{this.element&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||"")}}get element(){return this._input}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get rawValue(){return this._service.rawValue(this.value)}get validity(){const t=this.value,s=this._service.validationValue(t),i=this.props.validationMessage!==void 0,a=this.props.valid!==void 0?this.props.valid:(!this.required||!!s)&&(!this.props.maskValidation||!this.props.prompt||t.indexOf(this.props.prompt)===-1);return{customError:i,valid:a,valueMissing:!s}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get name(){return this.props.name}componentDidUpdate(t,s){if(this.element&&this.state.focused&&s.focused){let[i,a]=this._selection;const o=t.selection,r=this.props.selection;(!o&&r||o&&r&&(o.start!==r.start||o.end!==r.end))&&(i=r.start,a=r.end),i!==null&&a!==null&&this.element.setSelectionRange(i,a)}c.maskingChanged(t,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity()}render(){const{size:t=l.defaultProps.size,fillMode:s=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:a=l.defaultProps.autoFocus,prefix:o=l.defaultProps.prefix,suffix:r=l.defaultProps.suffix,inputAttributes:d,unstyled:h,className:v}=this.props,g=this.props.id||this._inputId,m=!this.validityStyles||this.validity.valid,b=this.props.style||{},y=h&&h.uMaskedTextBox,[P]=n.useCustomComponent(o),[S]=n.useCustomComponent(r),x=u.createElement("span",{dir:this.props.dir,className:n.classNames(n.uMaskedTextBox.wrapper({c:y,invalid:!m,disabled:this.props.disabled,size:t,fillMode:s,rounded:i}),v),style:this.props.label?b:{width:this.props.width,...b}},u.createElement(P,null),u.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:a,spellCheck:!1,className:n.classNames(n.uMaskedTextBox.inputInner({c:y})),value:this.value,id:g,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,"aria-required":this.props.required,name:this.props.name,tabIndex:n.getTabIndex(this.props.tabIndex,this.props.disabled,!0),accessKey:this.props.accessKey,title:this.props.title,disabled:this.props.disabled||void 0,readOnly:this.props.readonly||void 0,placeholder:this.props.placeholder,ref:k=>{this._input=k},onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:c.returnFalse,onDrop:c.returnFalse,...d}),u.createElement(S,null));return this.props.label?u.createElement(M.FloatingLabel,{label:this.props.label,editorId:g,editorValue:this.value,editorValid:m,editorDisabled:this.props.disabled,editorPlaceholder:this.props.placeholder,children:x,style:{width:this.props.width},dir:this.props.dir}):x}triggerOnChange(t,s){if(this.setState({value:t}),this.props.onChange){this._valueDuringOnChange=t;const i={syntheticEvent:s,nativeEvent:s.nativeEvent,selectionStart:this._selection[0],selectionEnd:this._selection[1],target:this,value:this.value};this.props.onChange.call(void 0,i),this._valueDuringOnChange=void 0}}updateService(t){const s=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},t);this._service.update(s)}get rules(){return Object.assign({},c.defaultRules,this.props.rules)}};l.displayName="MaskedTextBox",l.propTypes={value:e.string,defaultValue:e.string,placeholder:e.string,title:e.string,dir:e.string,id:e.string,style:e.object,className:e.string,prefix:e.any,suffix:e.any,ariaLabelledBy:e.string,ariaDescribedBy:e.string,width:e.oneOfType([e.string,e.number]),tabIndex:e.number,accessKey:e.string,disabled:e.bool,readonly:e.bool,prompt:e.string,promptPlaceholder:e.string,includeLiterals:e.bool,maskValidation:e.bool,mask:e.string,rules:function(t,s,i){const a=t.rules;return a!==void 0&&!Object.entries(a).some(r=>typeof r!="string"||!(a[r]instanceof RegExp))?new Error("Invalid prop `"+s+"` supplied to `"+i+"`. Validation failed."):null},selection:e.shape({start:e.number.isRequired,end:e.number.isRequired}),name:e.string,label:e.
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),e=require("prop-types"),E=require("./masking.service.js"),c=require("./utils.js"),n=require("@progress/kendo-react-common"),M=require("@progress/kendo-react-labels");function V(p){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const s in p)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(p,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>p[s]})}}return t.default=p,Object.freeze(t)}const u=V(O),l=class l extends u.Component{constructor(){super(...arguments),this.state={},this._inputId=`k_${this.props.id}`,this._service=new E.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.pasteHandler=t=>{const{selectionStart:s,selectionEnd:i}=t.target;i!==s&&(this._isPasted=!0,this._selection=[s||0,i||0])},this.onChangeHandler=t=>{const s=t.currentTarget,i=s.value,a=this._selection[0]||0,o=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(i,t);return}const r=this.value;let d;if(this._isPasted){this._isPasted=!1;const h=r.length-o,v=i.length-h;d=this._service.maskInRange(i.slice(a,v),r,a,o)}else d=this._service.maskInput(i,r,s.selectionStart||0);this._selection=[d.selection,d.selection],this.triggerOnChange(d.value,t)},this.focusHandler=t=>{this.state.focused||(this.setState({focused:!0}),this.props.onFocus&&this.props.onFocus.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.blurHandler=t=>{this.state.focused&&(this.setState({focused:!1}),this.props.onBlur&&this.props.onBlur.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.setValidity=()=>{this.element&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||"")}}get element(){return this._input}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get rawValue(){return this._service.rawValue(this.value)}get validity(){const t=this.value,s=this._service.validationValue(t),i=this.props.validationMessage!==void 0,a=this.props.valid!==void 0?this.props.valid:(!this.required||!!s)&&(!this.props.maskValidation||!this.props.prompt||t.indexOf(this.props.prompt)===-1);return{customError:i,valid:a,valueMissing:!s}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get name(){return this.props.name}componentDidUpdate(t,s){if(this.element&&this.state.focused&&s.focused){let[i,a]=this._selection;const o=t.selection,r=this.props.selection;(!o&&r||o&&r&&(o.start!==r.start||o.end!==r.end))&&(i=r.start,a=r.end),i!==null&&a!==null&&this.element.setSelectionRange(i,a)}c.maskingChanged(t,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity()}render(){const{size:t=l.defaultProps.size,fillMode:s=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:a=l.defaultProps.autoFocus,prefix:o=l.defaultProps.prefix,suffix:r=l.defaultProps.suffix,inputAttributes:d,unstyled:h,className:v}=this.props,g=this.props.id||this._inputId,m=!this.validityStyles||this.validity.valid,b=this.props.style||{},y=h&&h.uMaskedTextBox,[P]=n.useCustomComponent(o),[S]=n.useCustomComponent(r),x=u.createElement("span",{dir:this.props.dir,className:n.classNames(n.uMaskedTextBox.wrapper({c:y,invalid:!m,disabled:this.props.disabled,size:t,fillMode:s,rounded:i}),v),style:this.props.label?b:{width:this.props.width,...b}},u.createElement(P,null),u.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:a,spellCheck:!1,className:n.classNames(n.uMaskedTextBox.inputInner({c:y})),value:this.value,id:g,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,"aria-required":this.props.required,name:this.props.name,tabIndex:n.getTabIndex(this.props.tabIndex,this.props.disabled,!0),accessKey:this.props.accessKey,title:this.props.title,disabled:this.props.disabled||void 0,readOnly:this.props.readonly||void 0,placeholder:this.props.placeholder,ref:k=>{this._input=k},onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:c.returnFalse,onDrop:c.returnFalse,...d}),u.createElement(S,null));return this.props.label?u.createElement(M.FloatingLabel,{label:this.props.label,editorId:g,editorValue:this.value,editorValid:m,editorDisabled:this.props.disabled,editorPlaceholder:this.props.placeholder,children:x,style:{width:this.props.width},dir:this.props.dir}):x}triggerOnChange(t,s){if(this.setState({value:t}),this.props.onChange){this._valueDuringOnChange=t;const i={syntheticEvent:s,nativeEvent:s.nativeEvent,selectionStart:this._selection[0],selectionEnd:this._selection[1],target:this,value:this.value};this.props.onChange.call(void 0,i),this._valueDuringOnChange=void 0}}updateService(t){const s=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},t);this._service.update(s)}get rules(){return Object.assign({},c.defaultRules,this.props.rules)}};l.displayName="MaskedTextBox",l.propTypes={value:e.string,defaultValue:e.string,placeholder:e.string,title:e.string,dir:e.string,id:e.string,style:e.object,className:e.string,prefix:e.any,suffix:e.any,ariaLabelledBy:e.string,ariaDescribedBy:e.string,width:e.oneOfType([e.string,e.number]),tabIndex:e.number,accessKey:e.string,disabled:e.bool,readonly:e.bool,prompt:e.string,promptPlaceholder:e.string,includeLiterals:e.bool,maskValidation:e.bool,mask:e.string,rules:function(t,s,i){const a=t.rules;return a!==void 0&&!Object.entries(a).some(r=>typeof r!="string"||!(a[r]instanceof RegExp))?new Error("Invalid prop `"+s+"` supplied to `"+i+"`. Validation failed."):null},selection:e.shape({start:e.number.isRequired,end:e.number.isRequired}),name:e.string,label:e.node,validationMessage:e.string,required:e.bool,valid:e.bool,validityStyles:e.bool,onChange:e.func,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},l.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:c.defaultRules,validityStyles:!0,prefix:t=>null,suffix:t=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let f=l;const C=n.createPropsContext(),_=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(f)));_.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=_;exports.MaskedTextBoxPropsContext=C;exports.MaskedTextBoxWithoutContext=f;
|
package/package-metadata.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-inputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-inputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1747664189,version:"11.0.0-develop.21",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "11.0.0-develop.
|
|
13
|
+
publishDate: 1747664189,
|
|
14
|
+
version: "11.0.0-develop.21",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-inputs",
|
|
3
|
-
"version": "11.0.0-develop.
|
|
3
|
+
"version": "11.0.0-develop.21",
|
|
4
4
|
"description": "React Inputs offer a customizable interface for users to enter and pick different information. KendoReact Input package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-drawing": "^1.21.2",
|
|
29
29
|
"@progress/kendo-inputs-common": "^3.1.0",
|
|
30
|
-
"@progress/kendo-licensing": "^1.
|
|
31
|
-
"@progress/kendo-react-animation": "11.0.0-develop.
|
|
32
|
-
"@progress/kendo-react-buttons": "11.0.0-develop.
|
|
33
|
-
"@progress/kendo-react-common": "11.0.0-develop.
|
|
34
|
-
"@progress/kendo-react-dialogs": "11.0.0-develop.
|
|
35
|
-
"@progress/kendo-react-layout": "11.0.0-develop.
|
|
36
|
-
"@progress/kendo-react-intl": "11.0.0-develop.
|
|
37
|
-
"@progress/kendo-react-labels": "11.0.0-develop.
|
|
38
|
-
"@progress/kendo-react-popup": "11.0.0-develop.
|
|
30
|
+
"@progress/kendo-licensing": "^1.6.0",
|
|
31
|
+
"@progress/kendo-react-animation": "11.0.0-develop.21",
|
|
32
|
+
"@progress/kendo-react-buttons": "11.0.0-develop.21",
|
|
33
|
+
"@progress/kendo-react-common": "11.0.0-develop.21",
|
|
34
|
+
"@progress/kendo-react-dialogs": "11.0.0-develop.21",
|
|
35
|
+
"@progress/kendo-react-layout": "11.0.0-develop.21",
|
|
36
|
+
"@progress/kendo-react-intl": "11.0.0-develop.21",
|
|
37
|
+
"@progress/kendo-react-labels": "11.0.0-develop.21",
|
|
38
|
+
"@progress/kendo-react-popup": "11.0.0-develop.21",
|
|
39
39
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
40
40
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
41
41
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"package": {
|
|
83
83
|
"productName": "KendoReact",
|
|
84
84
|
"productCode": "KENDOUIREACT",
|
|
85
|
-
"publishDate":
|
|
85
|
+
"publishDate": 1747664189,
|
|
86
86
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
87
87
|
}
|
|
88
88
|
},
|
package/rating/Rating.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),u=require("prop-types"),l=require("@progress/kendo-react-common"),M=require("@progress/kendo-svg-icons"),Q=require("./RatingItem.js"),c=require("./rating-reducer.js"),d=require("./utils/index.js"),V=require("../messages/index.js"),U=require("@progress/kendo-react-intl");function Y(a){const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),u=require("prop-types"),l=require("@progress/kendo-react-common"),M=require("@progress/kendo-svg-icons"),Q=require("./RatingItem.js"),c=require("./rating-reducer.js"),d=require("./utils/index.js"),V=require("../messages/index.js"),U=require("@progress/kendo-react-intl");function Y(a){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const m in a)if(m!=="default"){const e=Object.getOwnPropertyDescriptor(a,m);Object.defineProperty(p,m,e.get?e:{enumerable:!0,get:()=>a[m]})}}return p.default=a,Object.freeze(p)}const n=Y(J),z=(a,p,m)=>{const[e,D]=n.useState(a);return[e,h=>{const i=c.ratingReducer(p.state||e,{...h,...p});m&&m(i,h.event),D(i)}]},F=l.createPropsContext(),S=n.forwardRef((a,p)=>{const m=l.usePropsContext(F,a),e={dir:s.dir,min:s.min,max:s.max,step:s.step,item:s.item,defaultValue:s.defaultValue,readonly:s.readonly,disabled:s.disabled,selection:s.selection,precision:s.precision,...m},D=U.useLocalization(),I=n.useRef(null),h=n.useRef(null),i=l.useDir(h,e.dir);n.useImperativeHandle(I,()=>({element:h.current,props:e})),n.useImperativeHandle(p,()=>I.current);const H=n.useCallback((t,o)=>{e.onChange&&I.current&&e.onChange.call(void 0,{value:t,target:I.current,syntheticEvent:o})},[e.onChange]),N=n.useMemo(()=>e.min!==void 0?e.min:s.min,[e.min]),R=n.useMemo(()=>e.max!==void 0?e.max:s.max,[e.max]),v=n.useMemo(()=>e.precision||s.precision,[e.precision]),r=n.useMemo(()=>e.step!==void 0?e.step:s.step,[e.step]),A=n.useMemo(()=>e.readonly||s.readonly,[e.readonly]),C=n.useMemo(()=>e.disabled||s.disabled,[e.disabled]),K=n.useMemo(()=>e.item||s.item,[e.item]),[G,f]=z(e.defaultValue!==void 0?e.defaultValue:s.defaultValue,{state:e.value,min:N,max:R,step:v==="half"?r/2:r},H),[w,E]=z(null,{state:e.value,min:N,max:R,step:v==="half"?r/2:r,precision:v}),g=n.useMemo(()=>e.value!==void 0?e.value:G,[e.value,G]),T=n.useMemo(()=>w,[w]),_=n.useMemo(()=>e.selection||s.selection,[e.selection]),k=n.useMemo(()=>r/(v==="half"?2:1),[r,v]),q=n.useCallback(t=>{if(!(!t.target||!t.target.element||A||C)){if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=d.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?d.toRound(t.target.value-r/2,k):t.target.value;f({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else f({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent});if(e.onClick){const o={value:g,target:I.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,f,g]),B=n.useCallback(t=>{if(!(A||C)){switch(t.keyCode){case l.Keys.right:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.decrease:c.RATING_ACTION.increase,event:t});break;case l.Keys.left:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.increase:c.RATING_ACTION.decrease,event:t});break;case l.Keys.home:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.min:c.RATING_ACTION.max,event:t});break;case l.Keys.end:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.max:c.RATING_ACTION.min,event:t});break;case l.Keys.esc:t.preventDefault(),f({type:c.RATING_ACTION.deselect,event:t});break}e.onKeyDown&&e.onKeyDown.call(void 0,{value:g,target:I.current,syntheticEvent:t})}},[e.onKeyDown,f,g]),$=n.useCallback(t=>{if(e.onFocus){const o={target:I.current,syntheticEvent:t};e.onFocus.call(void 0,o)}},[e.onFocus]),W=n.useCallback(t=>{if(e.onBlur){const o={target:I.current,syntheticEvent:t};e.onBlur.call(void 0,o)}},[e.onBlur]),L=n.useCallback(t=>{if(!(!t.target||!t.target.element))if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=d.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?t.target.value-r/2:t.target.value;E({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else E({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent})},[v,r,i]),j=n.useCallback(t=>{E({type:c.RATING_ACTION.reset,event:t.syntheticEvent})},[]),P=[],X=d.getRemainder(d.toRound(R-N,k),r);for(let t=N;t<=R;t=d.toRound(t+r,k)){const o=d.toRound(t+X,k),y=v==="half"?d.isHalf(o,T!==null?T:g!==null?g:0,r):!1,x=d.isSelected(o,g,r,_),O=d.isSelected(o,T!==null?T:g,r,_),b=d.isSelected(o,T,r,_);P.push(n.createElement(K,{key:o,value:o,dir:i,title:String(y?d.toRound(o-r/2,k):o),icon:e.icon,svgIcon:e.svgIcon,half:y,selected:x||O,hovered:b,onClick:q,onMouseMove:L,onMouseLeave:j},y&&n.createElement("span",{className:"k-rating-precision-complement"},!(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:"star-outline",icon:M.starOutlineIcon,style:{clipPath:`${i==="rtl"?"inset(0 50% 0 0)":"inset(0 0 0 50%)"}`},size:"xlarge"}),(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})),y&&n.createElement("span",{className:"k-rating-precision-part"},!(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,style:{clipPath:`${i==="rtl"?"inset(0 0 0 50%)":"inset(0 50% 0 0)"}`},size:"xlarge"}),(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:e.icon?l.toIconName(e.icon):void 0,icon:e.svgIcon,size:"xlarge"})),y&&n.createElement("span",{style:{width:"24px",height:"24px",display:"block"}}),!y&&!(e.icon||e.svgIcon)&&(b||O&&!b)&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,size:"xlarge"})||!(e.icon||e.svgIcon)&&!b&&!O&&n.createElement(l.IconWrap,{name:"star-outline",icon:M.starOutlineIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&(b||O&&!b)&&n.createElement(l.IconWrap,{name:e.icon,icon:e.svgIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&!b&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})))}return n.createElement("span",{id:e.id,style:e.style,ref:h,role:"slider",dir:i,tabIndex:l.getTabIndex(e.tabIndex,e.disabled,void 0),className:l.classNames("k-rating",{"k-rtl":i==="rtl","k-readonly":A,"k-disabled":C},e.className),onKeyDown:B,onFocus:$,onBlur:W,"aria-valuemin":N,"aria-valuemax":R,"aria-valuenow":g!==null?g:void 0,"aria-disabled":C?"true":void 0,"aria-label":D.toLanguageString(V.ratingAriaLabel,V.messages[V.ratingAriaLabel]),"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy},n.createElement("input",{id:"rating",className:"k-hidden",readOnly:A,disabled:C}),n.createElement("span",{className:"k-rating-container"},P),e.label&&n.createElement("span",{className:"k-rating-label"},e.label))}),Z={id:u.string,dir:u.oneOf(["ltr","rtl"]),selection:u.oneOf(["continues","single"]),precision:u.oneOf(["item","half"]),value:(a,p,m)=>a.value&&a.min&&a.max&&a.step&&!(a.precision==="half"?d.isCorrectValue(a.min,a.max,a.step/2,a.value):d.isCorrectValue(a.min,a.max,a.step,a.value))&&a.precision==="half"?new Error(`Invalid prop + ${p} supplied to ${m}.
|
|
9
9
|
The value of the { value } property is not correct, please check your values.
|
|
10
|
-
`):null,defaultValue:u.number,min:u.number,max:u.number,step:(a,
|
|
10
|
+
`):null,defaultValue:u.number,min:u.number,max:u.number,step:(a,p,m)=>a.step!==void 0&&a.step<=0?new Error(`Invalid prop + ${p} supplied to ${m}.
|
|
11
11
|
The value of the { step } property is cannot be equal or less than "0", please check your values.
|
|
12
|
-
`):null,hovered:u.number,label:u.
|
|
12
|
+
`):null,hovered:u.number,label:u.node,readonly:u.bool,disabled:u.bool,half:u.bool,icon:u.string,svgIcon:l.svgIconPropType,svgIconOutline:l.svgIconPropType,ariaDescribedBy:u.string},s={dir:"ltr",min:1,max:5,step:1,item:Q.RatingItem,defaultValue:null,readonly:!1,disabled:!1,selection:"continues",precision:"item"};S.displayName="KendoReactRating";S.propTypes=Z;exports.Rating=S;exports.RatingPropsContext=F;
|
package/rating/Rating.mjs
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
9
|
import r from "prop-types";
|
|
10
|
-
import { createPropsContext as te, usePropsContext as ae, useDir as ne, Keys as R, IconWrap as y, toIconName as B, getTabIndex as le, classNames as
|
|
10
|
+
import { createPropsContext as te, usePropsContext as ae, useDir as ne, Keys as R, IconWrap as y, toIconName as B, getTabIndex as le, classNames as oe, svgIconPropType as S } from "@progress/kendo-react-common";
|
|
11
11
|
import { starOutlineIcon as $, starIcon as K } from "@progress/kendo-svg-icons";
|
|
12
|
-
import { RatingItem as
|
|
12
|
+
import { RatingItem as se } from "./RatingItem.mjs";
|
|
13
13
|
import { RATING_ACTION as c, ratingReducer as ie } from "./rating-reducer.mjs";
|
|
14
14
|
import { calcIsFirstHalf as L, toRound as D, getRemainder as re, isHalf as ce, isSelected as F, isCorrectValue as A } from "./utils/index.mjs";
|
|
15
15
|
import { ratingAriaLabel as X, messages as ue } from "../messages/index.mjs";
|
|
@@ -17,23 +17,23 @@ import { useLocalization as me } from "@progress/kendo-react-intl";
|
|
|
17
17
|
const q = (n, g, v) => {
|
|
18
18
|
const [e, N] = a.useState(n);
|
|
19
19
|
return [e, (h) => {
|
|
20
|
-
const
|
|
21
|
-
v && v(
|
|
20
|
+
const s = ie(g.state || e, { ...h, ...g });
|
|
21
|
+
v && v(s, h.event), N(s);
|
|
22
22
|
}];
|
|
23
23
|
}, de = te(), G = a.forwardRef((n, g) => {
|
|
24
24
|
const v = ae(de, n), e = {
|
|
25
|
-
dir:
|
|
26
|
-
min:
|
|
27
|
-
max:
|
|
28
|
-
step:
|
|
29
|
-
item:
|
|
30
|
-
defaultValue:
|
|
31
|
-
readonly:
|
|
32
|
-
disabled:
|
|
33
|
-
selection:
|
|
34
|
-
precision:
|
|
25
|
+
dir: o.dir,
|
|
26
|
+
min: o.min,
|
|
27
|
+
max: o.max,
|
|
28
|
+
step: o.step,
|
|
29
|
+
item: o.item,
|
|
30
|
+
defaultValue: o.defaultValue,
|
|
31
|
+
readonly: o.readonly,
|
|
32
|
+
disabled: o.disabled,
|
|
33
|
+
selection: o.selection,
|
|
34
|
+
precision: o.precision,
|
|
35
35
|
...v
|
|
36
|
-
}, N = me(), m = a.useRef(null), h = a.useRef(null),
|
|
36
|
+
}, N = me(), m = a.useRef(null), h = a.useRef(null), s = ne(h, e.dir);
|
|
37
37
|
a.useImperativeHandle(m, () => ({
|
|
38
38
|
element: h.current,
|
|
39
39
|
props: e
|
|
@@ -47,8 +47,8 @@ const q = (n, g, v) => {
|
|
|
47
47
|
});
|
|
48
48
|
},
|
|
49
49
|
[e.onChange]
|
|
50
|
-
), I = a.useMemo(() => e.min !== void 0 ? e.min :
|
|
51
|
-
e.defaultValue !== void 0 ? e.defaultValue :
|
|
50
|
+
), I = a.useMemo(() => e.min !== void 0 ? e.min : o.min, [e.min]), x = a.useMemo(() => e.max !== void 0 ? e.max : o.max, [e.max]), d = a.useMemo(() => e.precision || o.precision, [e.precision]), i = a.useMemo(() => e.step !== void 0 ? e.step : o.step, [e.step]), V = a.useMemo(() => e.readonly || o.readonly, [e.readonly]), k = a.useMemo(() => e.disabled || o.disabled, [e.disabled]), _ = a.useMemo(() => e.item || o.item, [e.item]), [H, p] = q(
|
|
51
|
+
e.defaultValue !== void 0 ? e.defaultValue : o.defaultValue,
|
|
52
52
|
{
|
|
53
53
|
state: e.value,
|
|
54
54
|
min: I,
|
|
@@ -66,13 +66,13 @@ const q = (n, g, v) => {
|
|
|
66
66
|
() => e.value !== void 0 ? e.value : H,
|
|
67
67
|
[e.value, H]
|
|
68
68
|
), C = a.useMemo(() => T, [T]), z = a.useMemo(
|
|
69
|
-
() => e.selection ||
|
|
69
|
+
() => e.selection || o.selection,
|
|
70
70
|
[e.selection]
|
|
71
71
|
), E = a.useMemo(() => i / (d === "half" ? 2 : 1), [i, d]), j = a.useCallback(
|
|
72
72
|
(t) => {
|
|
73
73
|
if (!(!t.target || !t.target.element || V || k)) {
|
|
74
74
|
if (d === "half") {
|
|
75
|
-
const l = t.target.element.getBoundingClientRect(), M = L(
|
|
75
|
+
const l = t.target.element.getBoundingClientRect(), M = L(s || "ltr", l, t.syntheticEvent.clientX) ? D(t.target.value - i / 2, E) : t.target.value;
|
|
76
76
|
p({ type: c.select, payload: M, event: t.syntheticEvent });
|
|
77
77
|
} else
|
|
78
78
|
p({
|
|
@@ -97,25 +97,25 @@ const q = (n, g, v) => {
|
|
|
97
97
|
switch (t.keyCode) {
|
|
98
98
|
case R.right:
|
|
99
99
|
t.preventDefault(), p({
|
|
100
|
-
type:
|
|
100
|
+
type: s === "rtl" ? c.decrease : c.increase,
|
|
101
101
|
event: t
|
|
102
102
|
});
|
|
103
103
|
break;
|
|
104
104
|
case R.left:
|
|
105
105
|
t.preventDefault(), p({
|
|
106
|
-
type:
|
|
106
|
+
type: s === "rtl" ? c.increase : c.decrease,
|
|
107
107
|
event: t
|
|
108
108
|
});
|
|
109
109
|
break;
|
|
110
110
|
case R.home:
|
|
111
111
|
t.preventDefault(), p({
|
|
112
|
-
type:
|
|
112
|
+
type: s === "rtl" ? c.min : c.max,
|
|
113
113
|
event: t
|
|
114
114
|
});
|
|
115
115
|
break;
|
|
116
116
|
case R.end:
|
|
117
117
|
t.preventDefault(), p({
|
|
118
|
-
type:
|
|
118
|
+
type: s === "rtl" ? c.max : c.min,
|
|
119
119
|
event: t
|
|
120
120
|
});
|
|
121
121
|
break;
|
|
@@ -160,7 +160,7 @@ const q = (n, g, v) => {
|
|
|
160
160
|
(t) => {
|
|
161
161
|
if (!(!t.target || !t.target.element))
|
|
162
162
|
if (d === "half") {
|
|
163
|
-
const l = t.target.element.getBoundingClientRect(), M = L(
|
|
163
|
+
const l = t.target.element.getBoundingClientRect(), M = L(s || "ltr", l, t.syntheticEvent.clientX) ? t.target.value - i / 2 : t.target.value;
|
|
164
164
|
O({ type: c.select, payload: M, event: t.syntheticEvent });
|
|
165
165
|
} else
|
|
166
166
|
O({
|
|
@@ -169,7 +169,7 @@ const q = (n, g, v) => {
|
|
|
169
169
|
event: t.syntheticEvent
|
|
170
170
|
});
|
|
171
171
|
},
|
|
172
|
-
[d, i,
|
|
172
|
+
[d, i, s]
|
|
173
173
|
), Z = a.useCallback((t) => {
|
|
174
174
|
O({ type: c.reset, event: t.syntheticEvent });
|
|
175
175
|
}, []), P = [], ee = re(D(x - I, E), i);
|
|
@@ -181,7 +181,7 @@ const q = (n, g, v) => {
|
|
|
181
181
|
{
|
|
182
182
|
key: l,
|
|
183
183
|
value: l,
|
|
184
|
-
dir:
|
|
184
|
+
dir: s,
|
|
185
185
|
title: String(f ? D(l - i / 2, E) : l),
|
|
186
186
|
icon: e.icon,
|
|
187
187
|
svgIcon: e.svgIcon,
|
|
@@ -197,7 +197,7 @@ const q = (n, g, v) => {
|
|
|
197
197
|
{
|
|
198
198
|
name: "star-outline",
|
|
199
199
|
icon: $,
|
|
200
|
-
style: { clipPath: `${
|
|
200
|
+
style: { clipPath: `${s === "rtl" ? "inset(0 50% 0 0)" : "inset(0 0 0 50%)"}` },
|
|
201
201
|
size: "xlarge"
|
|
202
202
|
}
|
|
203
203
|
), (e.icon || e.svgIconOutline) && /* @__PURE__ */ a.createElement(
|
|
@@ -213,7 +213,7 @@ const q = (n, g, v) => {
|
|
|
213
213
|
{
|
|
214
214
|
name: "star",
|
|
215
215
|
icon: K,
|
|
216
|
-
style: { clipPath: `${
|
|
216
|
+
style: { clipPath: `${s === "rtl" ? "inset(0 0 0 50%)" : "inset(0 50% 0 0)"}` },
|
|
217
217
|
size: "xlarge"
|
|
218
218
|
}
|
|
219
219
|
), (e.icon || e.svgIcon) && /* @__PURE__ */ a.createElement(
|
|
@@ -243,12 +243,12 @@ const q = (n, g, v) => {
|
|
|
243
243
|
style: e.style,
|
|
244
244
|
ref: h,
|
|
245
245
|
role: "slider",
|
|
246
|
-
dir:
|
|
246
|
+
dir: s,
|
|
247
247
|
tabIndex: le(e.tabIndex, e.disabled, void 0),
|
|
248
|
-
className:
|
|
248
|
+
className: oe(
|
|
249
249
|
"k-rating",
|
|
250
250
|
{
|
|
251
|
-
"k-rtl":
|
|
251
|
+
"k-rtl": s === "rtl",
|
|
252
252
|
"k-readonly": V,
|
|
253
253
|
"k-disabled": k
|
|
254
254
|
},
|
|
@@ -288,7 +288,7 @@ const q = (n, g, v) => {
|
|
|
288
288
|
`
|
|
289
289
|
) : null,
|
|
290
290
|
hovered: r.number,
|
|
291
|
-
label: r.
|
|
291
|
+
label: r.node,
|
|
292
292
|
readonly: r.bool,
|
|
293
293
|
disabled: r.bool,
|
|
294
294
|
half: r.bool,
|
|
@@ -296,12 +296,12 @@ const q = (n, g, v) => {
|
|
|
296
296
|
svgIcon: S,
|
|
297
297
|
svgIconOutline: S,
|
|
298
298
|
ariaDescribedBy: r.string
|
|
299
|
-
},
|
|
299
|
+
}, o = {
|
|
300
300
|
dir: "ltr",
|
|
301
301
|
min: 1,
|
|
302
302
|
max: 5,
|
|
303
303
|
step: 1,
|
|
304
|
-
item:
|
|
304
|
+
item: se,
|
|
305
305
|
defaultValue: null,
|
|
306
306
|
readonly: !1,
|
|
307
307
|
disabled: !1,
|