@progress/kendo-react-inputs 8.2.0-develop.8 → 8.2.0
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/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +74 -70
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +181 -121
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +29 -29
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +168 -152
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +120 -104
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +120 -45
- package/index.d.ts +120 -45
- package/input/Input.js +1 -1
- package/input/Input.mjs +47 -43
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +61 -57
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +89 -86
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +176 -154
- package/range-slider/range-raducer.js +1 -1
- package/range-slider/range-raducer.mjs +35 -1
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +112 -111
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +29 -29
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +96 -92
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +54 -50
package/index.d.ts
CHANGED
|
@@ -169,6 +169,10 @@ export declare interface CheckboxProps extends ToggleBaseProps, FormComponentPro
|
|
|
169
169
|
* Defaults to `0`.
|
|
170
170
|
*/
|
|
171
171
|
tabIndex?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the Checkbox. (Defaults to `false`)
|
|
174
|
+
*/
|
|
175
|
+
autoFocus?: boolean;
|
|
172
176
|
/**
|
|
173
177
|
* The event handler that will be fired when the user edits the value.
|
|
174
178
|
*/
|
|
@@ -233,29 +237,26 @@ export declare interface ColorGradientHandle extends Pick<ColorGradientWithoutCo
|
|
|
233
237
|
*/
|
|
234
238
|
export declare interface ColorGradientProps {
|
|
235
239
|
/**
|
|
236
|
-
*
|
|
237
|
-
|
|
238
|
-
defaultValue?: string;
|
|
239
|
-
/**
|
|
240
|
-
* The value of the ColorGradient.
|
|
240
|
+
* Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
|
|
241
|
+
* For example these elements could contain error or hint message.
|
|
241
242
|
*/
|
|
242
|
-
|
|
243
|
+
ariaDescribedBy?: string;
|
|
243
244
|
/**
|
|
244
|
-
*
|
|
245
|
+
* Represents the label of the `hsv` drag handle component used inside the ColorGradient.
|
|
245
246
|
*/
|
|
246
|
-
|
|
247
|
+
ariaLabelHSV?: string;
|
|
247
248
|
/**
|
|
248
|
-
*
|
|
249
|
+
* Represent the label of the component.
|
|
249
250
|
*/
|
|
250
|
-
|
|
251
|
+
ariaLabel?: string;
|
|
251
252
|
/**
|
|
252
|
-
*
|
|
253
|
+
* Identifies the element(s) which will label the component.
|
|
253
254
|
*/
|
|
254
|
-
|
|
255
|
+
ariaLabelledBy?: string;
|
|
255
256
|
/**
|
|
256
|
-
*
|
|
257
|
+
* Represents the text rendered inside the `hsv` drag handle.
|
|
257
258
|
*/
|
|
258
|
-
|
|
259
|
+
ariaValueText?: string;
|
|
259
260
|
/**
|
|
260
261
|
* Enables the color contrast tool.
|
|
261
262
|
* Sets the background color that will be compared to the selected value.
|
|
@@ -263,6 +264,14 @@ export declare interface ColorGradientProps {
|
|
|
263
264
|
* Currently, only the RGBA format is supported.
|
|
264
265
|
*/
|
|
265
266
|
backgroundColor?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Sets additional classes to the ColorGradient.
|
|
269
|
+
*/
|
|
270
|
+
className?: string;
|
|
271
|
+
/**
|
|
272
|
+
* The default value of the ColorGradient.
|
|
273
|
+
*/
|
|
274
|
+
defaultValue?: string;
|
|
266
275
|
/**
|
|
267
276
|
* Determines whether the ColorGradient is disabled
|
|
268
277
|
* ([more information and example]({% slug disabled_colorgradient %})).
|
|
@@ -281,48 +290,61 @@ export declare interface ColorGradientProps {
|
|
|
281
290
|
*/
|
|
282
291
|
disabled?: boolean;
|
|
283
292
|
/**
|
|
284
|
-
*
|
|
293
|
+
* Sets the default input format in the gradient input editor.
|
|
294
|
+
*
|
|
295
|
+
* @default 'rgb'
|
|
285
296
|
*/
|
|
286
|
-
|
|
297
|
+
format?: 'rgba' | 'rgb' | 'hex';
|
|
287
298
|
/**
|
|
288
|
-
*
|
|
299
|
+
* Determines the step (in pixels) when moving the gradient drag handle using
|
|
300
|
+
* the keyboard arrow keys while holding the shift key.
|
|
301
|
+
*
|
|
302
|
+
* @default 2
|
|
289
303
|
*/
|
|
290
|
-
|
|
304
|
+
gradientSliderSmallStep?: number;
|
|
305
|
+
/**
|
|
306
|
+
* Determines the step (in pixels) when moving the gradient drag handle
|
|
307
|
+
* using the keyboard arrow keys.
|
|
308
|
+
*
|
|
309
|
+
* @default 5
|
|
310
|
+
*/
|
|
311
|
+
gradientSliderStep?: number;
|
|
291
312
|
/**
|
|
292
313
|
* Specifies the id of the component.
|
|
293
314
|
*/
|
|
294
315
|
id?: string;
|
|
295
316
|
/**
|
|
296
|
-
*
|
|
297
|
-
* For example these elements could contain error or hint message.
|
|
317
|
+
* @hidden
|
|
298
318
|
*/
|
|
299
|
-
|
|
319
|
+
isInsidePopup?: boolean;
|
|
300
320
|
/**
|
|
301
|
-
*
|
|
321
|
+
* Determines whether the alpha slider and the alpha input will be displayed. Defaults to `true`.
|
|
302
322
|
*/
|
|
303
|
-
|
|
323
|
+
opacity?: boolean;
|
|
304
324
|
/**
|
|
305
|
-
*
|
|
325
|
+
* @hidden
|
|
306
326
|
*/
|
|
307
|
-
|
|
327
|
+
role?: string;
|
|
308
328
|
/**
|
|
309
|
-
*
|
|
329
|
+
* The styles that are applied to the ColorGradient.
|
|
310
330
|
*/
|
|
311
|
-
|
|
331
|
+
style?: React.CSSProperties;
|
|
312
332
|
/**
|
|
313
|
-
*
|
|
333
|
+
* Sets the `tabIndex` property of the ColorGradient.
|
|
314
334
|
*/
|
|
315
|
-
|
|
335
|
+
tabIndex?: number;
|
|
316
336
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* @default 'rgb'
|
|
337
|
+
* The value of the ColorGradient.
|
|
320
338
|
*/
|
|
321
|
-
|
|
339
|
+
value?: string;
|
|
322
340
|
/**
|
|
323
|
-
*
|
|
341
|
+
* Determines the event handler that will be fired when the user edits the value.
|
|
324
342
|
*/
|
|
325
|
-
|
|
343
|
+
onChange?: (event: ColorGradientChangeEvent) => void;
|
|
344
|
+
/**
|
|
345
|
+
* Represents the focus event.
|
|
346
|
+
*/
|
|
347
|
+
onFocus?: (event: any) => void;
|
|
326
348
|
}
|
|
327
349
|
|
|
328
350
|
/**
|
|
@@ -379,9 +401,15 @@ export declare class ColorGradientWithoutContext extends React_2.Component<Color
|
|
|
379
401
|
/**
|
|
380
402
|
* @hidden
|
|
381
403
|
*/
|
|
382
|
-
|
|
404
|
+
wrapperRef: React_2.RefObject<HTMLDivElement>;
|
|
405
|
+
/**
|
|
406
|
+
* @hidden
|
|
407
|
+
*/
|
|
408
|
+
hsvGradientRef: React_2.RefObject<HTMLDivElement>;
|
|
383
409
|
private gradientWrapper;
|
|
384
410
|
private alphaSlider;
|
|
411
|
+
private navigation?;
|
|
412
|
+
private hsvNavigation?;
|
|
385
413
|
constructor(props: ColorGradientProps);
|
|
386
414
|
/**
|
|
387
415
|
* @hidden
|
|
@@ -404,6 +432,10 @@ export declare class ColorGradientWithoutContext extends React_2.Component<Color
|
|
|
404
432
|
* @hidden
|
|
405
433
|
*/
|
|
406
434
|
componentDidUpdate(_: ColorGradientProps, prevState: ColorGradientState): void;
|
|
435
|
+
/**
|
|
436
|
+
* @hidden
|
|
437
|
+
*/
|
|
438
|
+
focus: () => void;
|
|
407
439
|
/**
|
|
408
440
|
* @hidden
|
|
409
441
|
*/
|
|
@@ -432,6 +464,14 @@ export declare class ColorGradientWithoutContext extends React_2.Component<Color
|
|
|
432
464
|
* @hidden
|
|
433
465
|
*/
|
|
434
466
|
onGradientWrapperClick: (event: React_2.MouseEvent<HTMLDivElement>) => void;
|
|
467
|
+
/**
|
|
468
|
+
* @hidden
|
|
469
|
+
*/
|
|
470
|
+
onHsvGradientKeyDown: (event: React_2.KeyboardEvent<HTMLDivElement>) => void;
|
|
471
|
+
/**
|
|
472
|
+
* @hidden
|
|
473
|
+
*/
|
|
474
|
+
onHsvGradientValueChange: (element: HTMLElement, moveX: number, moveY: number) => void;
|
|
435
475
|
/**
|
|
436
476
|
* @hidden
|
|
437
477
|
*/
|
|
@@ -440,6 +480,10 @@ export declare class ColorGradientWithoutContext extends React_2.Component<Color
|
|
|
440
480
|
* @hidden
|
|
441
481
|
*/
|
|
442
482
|
changePosition: (event: any) => void;
|
|
483
|
+
/**
|
|
484
|
+
* @hidden
|
|
485
|
+
*/
|
|
486
|
+
moveDragHandle(positionX: number, positionY: number): void;
|
|
443
487
|
/**
|
|
444
488
|
* @hidden
|
|
445
489
|
*/
|
|
@@ -473,14 +517,11 @@ export declare class ColorGradientWithoutContext extends React_2.Component<Color
|
|
|
473
517
|
* @hidden
|
|
474
518
|
*/
|
|
475
519
|
getGradientRectMetrics(): ClientRect;
|
|
476
|
-
/**
|
|
477
|
-
* @hidden
|
|
478
|
-
*/
|
|
479
|
-
focus: () => void;
|
|
480
520
|
/**
|
|
481
521
|
* @hidden
|
|
482
522
|
*/
|
|
483
523
|
render(): JSX_2.Element;
|
|
524
|
+
private onKeyDown;
|
|
484
525
|
}
|
|
485
526
|
|
|
486
527
|
/**
|
|
@@ -682,7 +723,7 @@ export declare class ColorPaletteWithoutContext extends React_2.Component<ColorP
|
|
|
682
723
|
/**
|
|
683
724
|
* @hidden
|
|
684
725
|
*/
|
|
685
|
-
|
|
726
|
+
wrapperRef: React_2.RefObject<HTMLDivElement>;
|
|
686
727
|
private paletteService;
|
|
687
728
|
private get guid();
|
|
688
729
|
constructor(props: ColorPaletteProps);
|
|
@@ -1319,6 +1360,10 @@ export declare interface InputProps extends Omit_2<React_2.InputHTMLAttributes<H
|
|
|
1319
1360
|
* Defines a string value that labels an interactive element.
|
|
1320
1361
|
*/
|
|
1321
1362
|
ariaLabel?: string;
|
|
1363
|
+
/**
|
|
1364
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the Input. (Defaults to `false`)
|
|
1365
|
+
*/
|
|
1366
|
+
autoFocus?: boolean;
|
|
1322
1367
|
/**
|
|
1323
1368
|
* Triggered after value change.
|
|
1324
1369
|
*/
|
|
@@ -1463,6 +1508,7 @@ export declare class InputWithoutContext extends React_2.Component<InputProps, I
|
|
|
1463
1508
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
1464
1509
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
1465
1510
|
ariaLabel: PropTypes.Requireable<string>;
|
|
1511
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
1466
1512
|
};
|
|
1467
1513
|
/**
|
|
1468
1514
|
* @hidden
|
|
@@ -1471,6 +1517,7 @@ export declare class InputWithoutContext extends React_2.Component<InputProps, I
|
|
|
1471
1517
|
defaultValue: string;
|
|
1472
1518
|
required: boolean;
|
|
1473
1519
|
validityStyles: boolean;
|
|
1520
|
+
autoFocus: boolean;
|
|
1474
1521
|
};
|
|
1475
1522
|
private _input;
|
|
1476
1523
|
private get _inputId();
|
|
@@ -1796,6 +1843,10 @@ export declare interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
1796
1843
|
* @default `solid`
|
|
1797
1844
|
*/
|
|
1798
1845
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
1846
|
+
/**
|
|
1847
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the MaskedTextBox. (Defaults to `false`)
|
|
1848
|
+
*/
|
|
1849
|
+
autoFocus?: boolean;
|
|
1799
1850
|
}
|
|
1800
1851
|
|
|
1801
1852
|
/**
|
|
@@ -1858,6 +1909,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1858
1909
|
size: PropTypes.Requireable<"small" | "large" | "medium" | null | undefined>;
|
|
1859
1910
|
rounded: PropTypes.Requireable<"small" | "large" | "medium" | "full" | null | undefined>;
|
|
1860
1911
|
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | null | undefined>;
|
|
1912
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
1861
1913
|
};
|
|
1862
1914
|
/**
|
|
1863
1915
|
* @hidden
|
|
@@ -1877,6 +1929,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1877
1929
|
size: "small" | "large" | "medium" | null | undefined;
|
|
1878
1930
|
rounded: "small" | "large" | "medium" | "full" | null | undefined;
|
|
1879
1931
|
fillMode: "flat" | "solid" | "outline" | null | undefined;
|
|
1932
|
+
autoFocus: boolean;
|
|
1880
1933
|
};
|
|
1881
1934
|
/**
|
|
1882
1935
|
* @hidden
|
|
@@ -2229,6 +2282,10 @@ export declare interface NumericTextBoxProps extends FormComponentProps, Omit<(R
|
|
|
2229
2282
|
* Represents the input element `style` HTML attribute.
|
|
2230
2283
|
*/
|
|
2231
2284
|
inputStyle?: React.CSSProperties;
|
|
2285
|
+
/**
|
|
2286
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the NumericTextBox. (Defaults to `false`)
|
|
2287
|
+
*/
|
|
2288
|
+
autoFocus?: boolean;
|
|
2232
2289
|
}
|
|
2233
2290
|
|
|
2234
2291
|
/**
|
|
@@ -2612,7 +2669,9 @@ export declare enum RANGE_ACTION {
|
|
|
2612
2669
|
min = "min",
|
|
2613
2670
|
max = "max",
|
|
2614
2671
|
increase = "increase",
|
|
2615
|
-
decrease = "decrease"
|
|
2672
|
+
decrease = "decrease",
|
|
2673
|
+
increaseLarge = "increaseLarge",
|
|
2674
|
+
decreaseLarge = "decreaseLarge"
|
|
2616
2675
|
}
|
|
2617
2676
|
|
|
2618
2677
|
/**
|
|
@@ -2620,6 +2679,7 @@ export declare enum RANGE_ACTION {
|
|
|
2620
2679
|
*/
|
|
2621
2680
|
declare interface RangeAction extends RangeActionDispatch {
|
|
2622
2681
|
step: number;
|
|
2682
|
+
largeStep: number;
|
|
2623
2683
|
min: number;
|
|
2624
2684
|
max: number;
|
|
2625
2685
|
}
|
|
@@ -2717,9 +2777,13 @@ export declare interface RangeSliderProps extends FormComponentProps {
|
|
|
2717
2777
|
*/
|
|
2718
2778
|
children?: React_2.ReactNode;
|
|
2719
2779
|
/**
|
|
2720
|
-
*
|
|
2780
|
+
* Specifies the step by which the RangeSlider's value will be increased or decreased using the keyboard arrows. Defaults to `1`.
|
|
2721
2781
|
*/
|
|
2722
2782
|
step?: number;
|
|
2783
|
+
/**
|
|
2784
|
+
* Specifies the step by which the RangeSlider's value will be increased or decreased using `pageUp` or `pageDown` keyboard buttons. Defaults to `10`.
|
|
2785
|
+
*/
|
|
2786
|
+
largeStep?: number;
|
|
2723
2787
|
/**
|
|
2724
2788
|
* The minimum possible value of the RangeSlider.
|
|
2725
2789
|
*/
|
|
@@ -3551,9 +3615,13 @@ export declare interface SliderProps extends FormComponentProps {
|
|
|
3551
3615
|
*/
|
|
3552
3616
|
max: number;
|
|
3553
3617
|
/**
|
|
3554
|
-
* Specifies the step
|
|
3618
|
+
* Specifies the step by which the Slider's value will be increased or decreased using its buttons or keyboard arrows.
|
|
3555
3619
|
*/
|
|
3556
3620
|
step?: number;
|
|
3621
|
+
/**
|
|
3622
|
+
* Specifies the step by which the Slider's value will be increased or decreased using `pageUp` or `pageDown` keyboard buttons.
|
|
3623
|
+
*/
|
|
3624
|
+
largeStep?: number;
|
|
3557
3625
|
/**
|
|
3558
3626
|
* Determines the event handler that will be fired when the user edits the value.
|
|
3559
3627
|
*/
|
|
@@ -3996,7 +4064,6 @@ export declare class SwitchWithoutContext extends React_2.Component<SwitchProps,
|
|
|
3996
4064
|
*
|
|
3997
4065
|
*
|
|
3998
4066
|
* Accepts properties of type [TextAreaProps]({% slug api_inputs_textareaprops %}).
|
|
3999
|
-
* Obtaining the `ref` returns an object of type [TextAreaHandle]({% slug api_inputs_textareahandle %}).
|
|
4000
4067
|
*
|
|
4001
4068
|
* @example
|
|
4002
4069
|
* ```jsx
|
|
@@ -4187,6 +4254,10 @@ export declare interface TextAreaProps extends FormComponentProps, Omit_5<React.
|
|
|
4187
4254
|
* ```
|
|
4188
4255
|
*/
|
|
4189
4256
|
resizable?: 'none' | 'vertical' | 'horizontal' | 'both';
|
|
4257
|
+
/**
|
|
4258
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextArea. (Defaults to `false`)
|
|
4259
|
+
*/
|
|
4260
|
+
autoFocus?: boolean;
|
|
4190
4261
|
}
|
|
4191
4262
|
|
|
4192
4263
|
/**
|
|
@@ -4273,6 +4344,10 @@ export declare interface TextBoxProps extends Omit<React_2.InputHTMLAttributes<H
|
|
|
4273
4344
|
* Sets a custom suffix to the TextBox component.
|
|
4274
4345
|
*/
|
|
4275
4346
|
suffix?: CustomComponent<any>;
|
|
4347
|
+
/**
|
|
4348
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextBox. (Defaults to `false`)
|
|
4349
|
+
*/
|
|
4350
|
+
autoFocus?: boolean;
|
|
4276
4351
|
}
|
|
4277
4352
|
|
|
4278
4353
|
/**
|
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),a=require("prop-types"),n=require("@progress/kendo-react-common"),k=require("@progress/kendo-react-labels"),O=require("../package-metadata.js");function P(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const u=P(S),s=class s extends u.Component{constructor(e){super(e),this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.isInvalid=t=>{let i=!1;for(let r in t)t.hasOwnProperty(r)&&(i=i||!!t[r]);return i},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&(this.validity.valid||!this.validityStyles?this._input.classList.remove("k-invalid"):this._input.classList.add("k-invalid"),this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||""))},this.handleChange=t=>{this.setState({value:t.target.value}),this.valueDuringOnChange=t.target.value,this.props.onChange&&this.props.onChange.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:t.target.value,target:this}),this.valueDuringOnChange=void 0},this.handleAutoFill=t=>{if(t.animationName==="autoFillStart"){let i=t.target.parentNode;i&&i.classList.contains("k-empty")&&i.classList.remove("k-empty")}},n.validatePackage(O.packageMetadata),this.state={value:this.props.defaultValue||s.defaultProps.defaultValue}}get _inputId(){return this.props.id}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}get name(){return this.props.name}get validity(){const e={badInput:this._input?this._input.validity.badInput:!1,patternMismatch:this._input?this._input.validity.patternMismatch:!1,rangeOverflow:this._input?this._input.validity.rangeOverflow:!1,rangeUnderflow:this._input?this._input.validity.rangeUnderflow:!1,stepMismatch:this._input?this._input.validity.stepMismatch:!1,tooLong:this._input?this._input.validity.tooLong:!1,typeMismatch:this._input?this._input.validity.typeMismatch:!1,valueMissing:this._input?this._input.validity.valueMissing:!1};return{...e,customError:this.props.validationMessage!==void 0,valid:this.props.valid!==void 0?this.props.valid:this._input?!this.isInvalid(e):!0}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:s.defaultProps.validityStyles}componentDidMount(){this.forceUpdate()}componentDidUpdate(){this.setValidity()}render(){const{className:e,label:t,labelClassName:i,id:r,validationMessage:I,defaultValue:L,valid:D,visited:N,touched:V,modified:w,autoFocus:f,ariaLabelledBy:m,ariaDescribedBy:b,validityStyles:q,style:p,ariaLabel:_,...o}=this.props,h=r||this._inputId,c=!this.validityStyles||this.validity.valid,C=n.classNames(e,"k-input k-input-md k-rounded-md k-input-solid"),v=u.createElement("input",{"aria-labelledby":m,"aria-describedby":b,"aria-disabled":this.props.disabled||void 0,"aria-invalid":!c||void 0,"aria-label":_||void 0,...o,style:t?void 0:p,value:this.value,id:h,autoFocus:f,className:C,onChange:this.handleChange,onAnimationStart:this.handleAutoFill,ref:M=>{this._input=M}});return t?u.createElement(k.FloatingLabel,{label:t,labelClassName:i,editorId:h,editorValue:String(this.value),editorValid:c,editorDisabled:o.disabled,editorPlaceholder:o.placeholder,children:v,style:p,dir:o.dir}):v}};s.displayName="Input",s.propTypes={label:a.string,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},s.defaultProps={defaultValue:"",required:!1,validityStyles:!0,autoFocus:!1};let d=s;const g=n.createPropsContext(),y=n.withIdHOC(n.withPropsContext(g,d));y.displayName="KendoReactInput";exports.Input=y;exports.InputPropsContext=g;exports.InputWithoutContext=d;
|
package/input/Input.mjs
CHANGED
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as r from "react";
|
|
10
|
-
import
|
|
11
|
-
import { validatePackage as
|
|
12
|
-
import { FloatingLabel as
|
|
13
|
-
import { packageMetadata as
|
|
10
|
+
import t from "prop-types";
|
|
11
|
+
import { validatePackage as b, classNames as _, createPropsContext as C, withIdHOC as M, withPropsContext as S } from "@progress/kendo-react-common";
|
|
12
|
+
import { FloatingLabel as L } from "@progress/kendo-react-labels";
|
|
13
|
+
import { packageMetadata as V } from "../package-metadata.mjs";
|
|
14
14
|
const e = class e extends r.Component {
|
|
15
15
|
constructor(s) {
|
|
16
16
|
super(s), this._input = null, this.focus = () => {
|
|
17
17
|
this._input && this._input.focus();
|
|
18
18
|
}, this.isInvalid = (i) => {
|
|
19
|
-
let
|
|
19
|
+
let a = !1;
|
|
20
20
|
for (let l in i)
|
|
21
|
-
i.hasOwnProperty(l) && (
|
|
22
|
-
return
|
|
21
|
+
i.hasOwnProperty(l) && (a = a || !!i[l]);
|
|
22
|
+
return a;
|
|
23
23
|
}, this.setValidity = () => {
|
|
24
24
|
this._input && this._input.setCustomValidity && (this.validity.valid || !this.validityStyles ? this._input.classList.remove("k-invalid") : this._input.classList.add("k-invalid"), this._input.setCustomValidity(
|
|
25
25
|
this.validity.valid ? "" : this.props.validationMessage || ""
|
|
@@ -35,10 +35,10 @@ const e = class e extends r.Component {
|
|
|
35
35
|
}), this.valueDuringOnChange = void 0;
|
|
36
36
|
}, this.handleAutoFill = (i) => {
|
|
37
37
|
if (i.animationName === "autoFillStart") {
|
|
38
|
-
let
|
|
39
|
-
|
|
38
|
+
let a = i.target.parentNode;
|
|
39
|
+
a && a.classList.contains("k-empty") && a.classList.remove("k-empty");
|
|
40
40
|
}
|
|
41
|
-
},
|
|
41
|
+
}, b(V), this.state = {
|
|
42
42
|
value: this.props.defaultValue || e.defaultProps.defaultValue
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -108,46 +108,48 @@ const e = class e extends r.Component {
|
|
|
108
108
|
const {
|
|
109
109
|
className: s,
|
|
110
110
|
label: i,
|
|
111
|
-
labelClassName:
|
|
111
|
+
labelClassName: a,
|
|
112
112
|
id: l,
|
|
113
|
-
validationMessage:
|
|
114
|
-
defaultValue:
|
|
115
|
-
valid:
|
|
113
|
+
validationMessage: P,
|
|
114
|
+
defaultValue: D,
|
|
115
|
+
valid: I,
|
|
116
116
|
// Removed to support direct use in Form Field component
|
|
117
|
-
visited:
|
|
118
|
-
touched:
|
|
119
|
-
modified:
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
visited: O,
|
|
118
|
+
touched: w,
|
|
119
|
+
modified: F,
|
|
120
|
+
autoFocus: v,
|
|
121
|
+
ariaLabelledBy: c,
|
|
122
|
+
ariaDescribedBy: y,
|
|
122
123
|
validityStyles: E,
|
|
123
124
|
style: o,
|
|
124
|
-
ariaLabel:
|
|
125
|
+
ariaLabel: g,
|
|
125
126
|
...n
|
|
126
|
-
} = this.props, p = l || this._inputId, u = !this.validityStyles || this.validity.valid,
|
|
127
|
+
} = this.props, p = l || this._inputId, u = !this.validityStyles || this.validity.valid, m = _(s, "k-input k-input-md k-rounded-md k-input-solid"), h = /* @__PURE__ */ r.createElement(
|
|
127
128
|
"input",
|
|
128
129
|
{
|
|
129
|
-
"aria-labelledby":
|
|
130
|
-
"aria-describedby":
|
|
130
|
+
"aria-labelledby": c,
|
|
131
|
+
"aria-describedby": y,
|
|
131
132
|
"aria-disabled": this.props.disabled || void 0,
|
|
132
133
|
"aria-invalid": !u || void 0,
|
|
133
|
-
"aria-label":
|
|
134
|
+
"aria-label": g || void 0,
|
|
134
135
|
...n,
|
|
135
136
|
style: i ? void 0 : o,
|
|
136
137
|
value: this.value,
|
|
137
138
|
id: p,
|
|
138
|
-
|
|
139
|
+
autoFocus: v,
|
|
140
|
+
className: m,
|
|
139
141
|
onChange: this.handleChange,
|
|
140
142
|
onAnimationStart: this.handleAutoFill,
|
|
141
|
-
ref: (
|
|
142
|
-
this._input =
|
|
143
|
+
ref: (f) => {
|
|
144
|
+
this._input = f;
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
);
|
|
146
148
|
return i ? /* @__PURE__ */ r.createElement(
|
|
147
|
-
|
|
149
|
+
L,
|
|
148
150
|
{
|
|
149
151
|
label: i,
|
|
150
|
-
labelClassName:
|
|
152
|
+
labelClassName: a,
|
|
151
153
|
editorId: p,
|
|
152
154
|
editorValue: String(this.value),
|
|
153
155
|
editorValid: u,
|
|
@@ -161,25 +163,27 @@ const e = class e extends r.Component {
|
|
|
161
163
|
}
|
|
162
164
|
};
|
|
163
165
|
e.displayName = "Input", e.propTypes = {
|
|
164
|
-
label:
|
|
165
|
-
labelClassName:
|
|
166
|
-
validationMessage:
|
|
167
|
-
required:
|
|
168
|
-
validate:
|
|
169
|
-
id:
|
|
170
|
-
ariaLabelledBy:
|
|
171
|
-
ariaDescribedBy:
|
|
172
|
-
ariaLabel:
|
|
166
|
+
label: t.string,
|
|
167
|
+
labelClassName: t.string,
|
|
168
|
+
validationMessage: t.string,
|
|
169
|
+
required: t.bool,
|
|
170
|
+
validate: t.bool,
|
|
171
|
+
id: t.string,
|
|
172
|
+
ariaLabelledBy: t.string,
|
|
173
|
+
ariaDescribedBy: t.string,
|
|
174
|
+
ariaLabel: t.string,
|
|
175
|
+
autoFocus: t.bool
|
|
173
176
|
}, e.defaultProps = {
|
|
174
177
|
defaultValue: "",
|
|
175
178
|
required: !1,
|
|
176
|
-
validityStyles: !0
|
|
179
|
+
validityStyles: !0,
|
|
180
|
+
autoFocus: !1
|
|
177
181
|
};
|
|
178
182
|
let d = e;
|
|
179
|
-
const
|
|
180
|
-
|
|
183
|
+
const k = C(), N = M(S(k, d));
|
|
184
|
+
N.displayName = "KendoReactInput";
|
|
181
185
|
export {
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
N as Input,
|
|
187
|
+
k as InputPropsContext,
|
|
184
188
|
d as InputWithoutContext
|
|
185
189
|
};
|
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),e=require("prop-types"),C=require("./masking.service.js"),c=require("./utils.js"),o=require("@progress/kendo-react-common"),_=require("@progress/kendo-react-labels"),S=require("../package-metadata.js");function O(h){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>h[t]})}}return s.default=h,Object.freeze(s)}const u=O(x),l=class l extends u.Component{constructor(s){super(s),this.state={},this._inputId=`k-${this.props.id}`,this._service=new C.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.pasteHandler=t=>{const{selectionStart:i,selectionEnd:r}=t.target;r!==i&&(this._isPasted=!0,this._selection=[i||0,r||0])},this.onChangeHandler=t=>{const i=t.currentTarget,r=i.value,n=this._selection[0]||0,a=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(r,t);return}const p=this.value;let d;if(this._isPasted){this._isPasted=!1;const v=p.length-a,g=r.length-v;d=this._service.maskInRange(r.slice(n,g),p,n,a)}else d=this._service.maskInput(r,p,i.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||"")},o.validatePackage(S.packageMetadata)}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 s=this.value,t=this._service.validationValue(s),i=this.props.validationMessage!==void 0,r=this.props.valid!==void 0?this.props.valid:(!this.required||!!t)&&(!this.props.maskValidation||!this.props.prompt||s.indexOf(this.props.prompt)===-1);return{customError:i,valid:r,valueMissing:!t}}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:l.defaultProps.required}get name(){return this.props.name}componentDidUpdate(s,t){if(this.element&&this.state.focused&&t.focused){let[i,r]=this._selection;const n=s.selection,a=this.props.selection;(!n&&a||n&&a&&(n.start!==a.start||n.end!==a.end))&&(i=a.start,r=a.end),i!==null&&r!==null&&this.element.setSelectionRange(i,r)}c.maskingChanged(s,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity()}render(){const{size:s=l.defaultProps.size,fillMode:t=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:r=l.defaultProps.autoFocus}=this.props,n=this.props.id||this._inputId,a=!this.validityStyles||this.validity.valid,p=this.props.style||{},{prefix:d=l.defaultProps.prefix,suffix:v=l.defaultProps.suffix}=this.props,[g]=o.useCustomComponent(d),[k]=o.useCustomComponent(v),m=u.createElement("span",{dir:this.props.dir,className:o.classNames("k-maskedtextbox k-input",{[`k-input-${o.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-input-${t}`]:t,[`k-rounded-${o.kendoThemeMaps.roundedMap[i]||i}`]:i,"k-invalid":!a,"k-required":this.required,"k-disabled":this.props.disabled},this.props.className),style:this.props.label?p:{width:this.props.width,...p}},u.createElement(g,null),u.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:r,spellCheck:!1,className:"k-input-inner",value:this.value,id:n,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,name:this.props.name,tabIndex:o.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:P=>this._input=P,onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:c.returnFalse,onDrop:c.returnFalse}),u.createElement(k,null));return this.props.label?u.createElement(_.FloatingLabel,{label:this.props.label,editorId:n,editorValue:this.value,editorValid:a,editorDisabled:this.props.disabled,editorPlaceholder:this.props.placeholder,children:m,style:{width:this.props.width},dir:this.props.dir}):m}triggerOnChange(s,t){if(this.setState({value:s}),this.props.onChange){this._valueDuringOnChange=s;const i={syntheticEvent:t,nativeEvent:t.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(s){const t=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},s);this._service.update(t)}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(s,t,i){const r=s.rules;return r!==void 0&&!Object.entries(r).some(a=>typeof a!="string"||!(r[a]instanceof RegExp))?new Error("Invalid prop `"+t+"` supplied to `"+i+"`. Validation failed."):null},selection:e.shape({start:e.number.isRequired,end:e.number.isRequired}),name:e.string,label:e.string,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},l.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:c.defaultRules,required:!1,validityStyles:!0,prefix:s=>null,suffix:s=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let f=l;const y=o.createPropsContext(),b=o.withIdHOC(o.withPropsContext(y,f));b.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=b;exports.MaskedTextBoxPropsContext=y;exports.MaskedTextBoxWithoutContext=f;
|