@progress/kendo-react-inputs 4.14.0-dev.202201141457 → 5.0.0-dev.202201182040

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.
Files changed (43) hide show
  1. package/dist/cdn/js/kendo-react-inputs.js +1 -1
  2. package/dist/es/checkbox/Checkbox.js +19 -10
  3. package/dist/es/checkbox/interfaces/CheckboxProps.d.ts +25 -1
  4. package/dist/es/colors/ColorInput.js +2 -2
  5. package/dist/es/colors/ColorPicker.js +37 -25
  6. package/dist/es/colors/FlatColorPicker.js +3 -3
  7. package/dist/es/colors/HexInput.js +2 -1
  8. package/dist/es/colors/interfaces/ColorPickerProps.d.ts +37 -0
  9. package/dist/es/input/Input.js +1 -1
  10. package/dist/es/maskedtextbox/MaskedTextBox.d.ts +6 -0
  11. package/dist/es/maskedtextbox/MaskedTextBox.js +21 -9
  12. package/dist/es/maskedtextbox/MaskedTextBoxProps.d.ts +37 -0
  13. package/dist/es/numerictextbox/NumericTextBox.js +27 -30
  14. package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.d.ts +37 -0
  15. package/dist/es/package-metadata.js +1 -1
  16. package/dist/es/radiobutton/RadioButton.js +13 -7
  17. package/dist/es/radiobutton/interfaces/RadioButtonProps.d.ts +13 -1
  18. package/dist/es/switch/Switch.d.ts +44 -0
  19. package/dist/es/switch/Switch.js +27 -19
  20. package/dist/es/textarea/TextArea.js +26 -16
  21. package/dist/es/textarea/interfaces/TextAreaProps.d.ts +37 -0
  22. package/dist/npm/checkbox/Checkbox.js +18 -9
  23. package/dist/npm/checkbox/interfaces/CheckboxProps.d.ts +25 -1
  24. package/dist/npm/colors/ColorInput.js +2 -2
  25. package/dist/npm/colors/ColorPicker.js +36 -24
  26. package/dist/npm/colors/FlatColorPicker.js +3 -3
  27. package/dist/npm/colors/HexInput.js +2 -1
  28. package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +37 -0
  29. package/dist/npm/input/Input.js +1 -1
  30. package/dist/npm/maskedtextbox/MaskedTextBox.d.ts +6 -0
  31. package/dist/npm/maskedtextbox/MaskedTextBox.js +20 -8
  32. package/dist/npm/maskedtextbox/MaskedTextBoxProps.d.ts +37 -0
  33. package/dist/npm/numerictextbox/NumericTextBox.js +26 -29
  34. package/dist/npm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +37 -0
  35. package/dist/npm/package-metadata.js +1 -1
  36. package/dist/npm/radiobutton/RadioButton.js +12 -6
  37. package/dist/npm/radiobutton/interfaces/RadioButtonProps.d.ts +13 -1
  38. package/dist/npm/switch/Switch.d.ts +44 -0
  39. package/dist/npm/switch/Switch.js +26 -18
  40. package/dist/npm/textarea/TextArea.js +25 -15
  41. package/dist/npm/textarea/interfaces/TextAreaProps.d.ts +37 -0
  42. package/dist/systemjs/kendo-react-inputs.js +1 -1
  43. package/package.json +16 -16
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-inputs',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1642170950,
8
+ publishDate: 1642537025,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  };
21
21
  import * as React from 'react';
22
22
  import * as PropTypes from 'prop-types';
23
- import { guid, classNames, dispatchEvent, getTabIndex, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
23
+ import { guid, classNames, dispatchEvent, getTabIndex, createPropsContext, usePropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
24
24
  import { validatePackage } from '@progress/kendo-react-common';
25
25
  import { packageMetadata } from '../package-metadata';
26
26
  /**
@@ -37,9 +37,10 @@ export var RadioButtonPropsContext = createPropsContext();
37
37
  * Obtaining the `ref` returns an object of type [RadioButtonHandle]({% slug api_inputs_radiobuttonhandle %}).
38
38
  */
39
39
  export var RadioButton = React.forwardRef(function (directProps, target) {
40
+ var _a;
40
41
  validatePackage(packageMetadata);
41
42
  var props = usePropsContext(RadioButtonPropsContext, directProps);
42
- var ariaDescribedBy = props.ariaDescribedBy, checked = props.checked, children = props.children, className = props.className, disabled = props.disabled, id = props.id, label = props.label, labelPlacement = props.labelPlacement, name = props.name, style = props.style, tabIndex = props.tabIndex, value = props.value, valid = props.valid, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, others = __rest(props, ["ariaDescribedBy", "checked", "children", "className", "disabled", "id", "label", "labelPlacement", "name", "style", "tabIndex", "value", "valid", "onChange", "onFocus", "onBlur"]);
43
+ var ariaDescribedBy = props.ariaDescribedBy, checked = props.checked, children = props.children, className = props.className, disabled = props.disabled, id = props.id, size = props.size, label = props.label, labelPlacement = props.labelPlacement, name = props.name, style = props.style, tabIndex = props.tabIndex, value = props.value, valid = props.valid, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, others = __rest(props, ["ariaDescribedBy", "checked", "children", "className", "disabled", "id", "size", "label", "labelPlacement", "name", "style", "tabIndex", "value", "valid", "onChange", "onFocus", "onBlur"]);
43
44
  var elementRef = React.useRef(null);
44
45
  var focusElement = React.useCallback(function () {
45
46
  if (elementRef.current) {
@@ -65,11 +66,11 @@ export var RadioButton = React.forwardRef(function (directProps, target) {
65
66
  dispatchEvent(onBlur, event, getImperativeHandle(), undefined);
66
67
  }
67
68
  }, [onBlur, disabled]);
68
- var inputProps = __assign({ type: 'radio', id: id || calculatedId, name: name, className: classNames({
69
- 'k-radio': true,
70
- 'k-state-invalid': valid === false,
71
- 'k-invalid': valid === false
72
- }, className), ref: elementRef, disabled: disabled, tabIndex: getTabIndex(tabIndex, disabled), checked: checked, style: style, 'aria-describedby': ariaDescribedBy, value: value, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }, others);
69
+ var inputProps = __assign({ type: 'radio', id: id || calculatedId, name: name, className: classNames('k-radio', (_a = {},
70
+ _a["k-radio-" + (kendoThemeMaps.sizeMap[size] || size)] = size,
71
+ _a['k-state-invalid'] = valid === false,
72
+ _a['k-invalid'] = valid === false,
73
+ _a), className), ref: elementRef, disabled: disabled, tabIndex: getTabIndex(tabIndex, disabled), checked: checked, style: style, 'aria-describedby': ariaDescribedBy, value: value, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }, others);
73
74
  var radioButtonLabel = (React.createElement(React.Fragment, null, label !== undefined ? (React.createElement("label", { className: 'k-radio-label', htmlFor: id || calculatedId, style: { userSelect: 'none' }, "aria-label": label }, label)) : null));
74
75
  var radio = React.createElement("input", __assign({}, inputProps));
75
76
  return (labelPlacement === 'before'
@@ -87,6 +88,7 @@ RadioButton.propTypes = {
87
88
  className: PropTypes.string,
88
89
  disabled: PropTypes.bool,
89
90
  id: PropTypes.string,
91
+ size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
90
92
  label: PropTypes.string,
91
93
  labelPlacement: PropTypes.string,
92
94
  name: PropTypes.string,
@@ -98,4 +100,8 @@ RadioButton.propTypes = {
98
100
  onFocus: PropTypes.func,
99
101
  onBlur: PropTypes.func
100
102
  };
103
+ var defaultProps = {
104
+ size: 'medium'
105
+ };
101
106
  RadioButton.displayName = 'KendoRadioButton';
107
+ RadioButton.defaultProps = defaultProps;
@@ -10,7 +10,7 @@ declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
10
10
  * Represents the props of the [KendoReact RadioButton component]({% slug overview_radiobutton %}).
11
11
  * Extends the [native input props](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement).
12
12
  */
13
- export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur'> {
13
+ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'onFocus' | 'onBlur'> {
14
14
  /**
15
15
  * 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).
16
16
  * For example these elements could contain error or hint message.
@@ -37,6 +37,18 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
37
37
  * Sets the `id` of the Radio button.
38
38
  */
39
39
  id?: string;
40
+ /**
41
+ * Configures the `size` of the RadioButton.
42
+ *
43
+ * The available options are:
44
+ * - small
45
+ * - medium
46
+ * - large
47
+ * - null&mdash;Does not set a size `className`.
48
+ *
49
+ * @default `medium`
50
+ */
51
+ size?: null | 'small' | 'medium' | 'large';
40
52
  /**
41
53
  * Sets the label of the Radio button ([see example]({% slug labels_radiobutton %})).
42
54
  */
@@ -48,6 +48,44 @@ export interface SwitchProps extends ToggleBaseProps, FormComponentProps {
48
48
  * Sets the `id` of the Switch.
49
49
  */
50
50
  id?: string;
51
+ /**
52
+ * Configures the `size` of the Switch.
53
+ *
54
+ * The available options are:
55
+ * - small
56
+ * - medium
57
+ * - large
58
+ * - null&mdash;Does not set a size `className`.
59
+ *
60
+ * @default `medium`
61
+ */
62
+ size?: null | 'small' | 'medium' | 'large';
63
+ /**
64
+ * Configures the `trackRounded` of the Switch.
65
+ *
66
+ * The available options are:
67
+ * - small
68
+ * - medium
69
+ * - large
70
+ * - full
71
+ * - null&mdash;Does not set a trackRounded `className`.
72
+ *
73
+ * @default `full`
74
+ */
75
+ trackRounded?: null | 'small' | 'medium' | 'large' | 'full';
76
+ /**
77
+ * Configures the `thumbRounded` of the Switch.
78
+ *
79
+ * The available options are:
80
+ * - small
81
+ * - medium
82
+ * - large
83
+ * - full
84
+ * - null&mdash;Does not set a thumbRounded `className`.
85
+ *
86
+ * @default `full`
87
+ */
88
+ thumbRounded?: null | 'small' | 'medium' | 'large' | 'full';
51
89
  /**
52
90
  * 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).
53
91
  * For example these elements could contain error or hint message.
@@ -136,6 +174,9 @@ export declare class SwitchWithoutContext extends React.Component<SwitchProps, S
136
174
  className: PropTypes.Requireable<string>;
137
175
  disabled: PropTypes.Requireable<boolean>;
138
176
  defaultChecked: PropTypes.Requireable<boolean>;
177
+ size: PropTypes.Requireable<"small" | "medium" | "large">;
178
+ trackRounded: PropTypes.Requireable<"small" | "medium" | "large" | "full">;
179
+ thumbRounded: PropTypes.Requireable<"small" | "medium" | "large" | "full">;
139
180
  dir: PropTypes.Requireable<string>;
140
181
  id: PropTypes.Requireable<string>;
141
182
  ariaLabelledBy: PropTypes.Requireable<string>;
@@ -157,6 +198,9 @@ export declare class SwitchWithoutContext extends React.Component<SwitchProps, S
157
198
  static defaultProps: {
158
199
  disabled: boolean;
159
200
  defaultChecked: boolean;
201
+ size: "small" | "medium" | "large";
202
+ trackRounded: "small" | "medium" | "large" | "full";
203
+ thumbRounded: "small" | "medium" | "large" | "full";
160
204
  offLabel: string;
161
205
  onBlur: () => void;
162
206
  onFocus: () => void;
@@ -24,15 +24,11 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  import * as React from 'react';
26
26
  import * as PropTypes from 'prop-types';
27
- import { classNames, guid, noop, Keys, dispatchEvent, getTabIndex, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
27
+ import { classNames, guid, noop, Keys, dispatchEvent, getTabIndex, createPropsContext, withPropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
28
28
  import { provideLocalizationService } from '@progress/kendo-react-intl';
29
29
  import { messages, switchValidation } from './../messages';
30
30
  import { validatePackage } from '@progress/kendo-react-common';
31
31
  import { packageMetadata } from '../package-metadata';
32
- var SWITCH_CONTAINER = 'k-switch-container';
33
- var SWITCH_HANDLE = 'k-switch-handle';
34
- var SWITCH_LABEL_ON = 'k-switch-label-on';
35
- var SWITCH_LABEL_OFF = 'k-switch-label-off';
36
32
  /** @hidden */
37
33
  var SwitchWithoutContext = /** @class */ (function (_super) {
38
34
  __extends(SwitchWithoutContext, _super);
@@ -234,19 +230,20 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
234
230
  */
235
231
  SwitchWithoutContext.prototype.render = function () {
236
232
  var _this = this;
233
+ var _a, _b, _c;
237
234
  var focused = this.state.focused;
238
- var _a = this.props, dir = _a.dir, disabled = _a.disabled, id = _a.id, offLabel = _a.offLabel, onLabel = _a.onLabel, tabIndex = _a.tabIndex;
235
+ var _d = this.props, dir = _d.dir, disabled = _d.disabled, trackRounded = _d.trackRounded, thumbRounded = _d.thumbRounded, size = _d.size, id = _d.id, offLabel = _d.offLabel, onLabel = _d.onLabel, tabIndex = _d.tabIndex;
239
236
  this.dir = dir || (this._wrapper && getComputedStyle(this._wrapper).direction) || undefined;
240
237
  var isValid = !this.validityStyles || this.validity.valid;
241
- var switchClassName = classNames({
242
- 'k-widget': true,
243
- 'k-switch': true,
244
- 'k-switch-on': this.value,
245
- 'k-switch-off': !this.value,
246
- 'k-state-focused': focused,
247
- 'k-state-disabled': disabled,
248
- 'k-state-invalid': !isValid
249
- }, this.props.className);
238
+ var switchClassName = classNames('k-switch', (_a = {},
239
+ _a["k-switch-" + (kendoThemeMaps.sizeMap[size] || size)] = size,
240
+ _a["k-rounded-" + (kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
241
+ _a['k-switch-on'] = this.value,
242
+ _a['k-switch-off'] = !this.value,
243
+ _a['k-state-focused'] = focused,
244
+ _a['k-state-disabled'] = disabled,
245
+ _a['k-state-invalid'] = !isValid,
246
+ _a), this.props.className);
250
247
  var ariaAttributes = {
251
248
  'aria-checked': this.value,
252
249
  'aria-disabled': disabled || undefined
@@ -254,13 +251,18 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
254
251
  return (React.createElement("span", { ref: function (span) {
255
252
  _this._wrapper = span;
256
253
  }, className: switchClassName, dir: this.dir, onKeyDown: this.handleKeyDown, onClick: this.handleClick, onBlur: this.handleWrapperBlur, onFocus: this.handleWrapperFocus },
257
- React.createElement("span", __assign({ className: SWITCH_CONTAINER, id: id || this._id, role: 'switch' }, ariaAttributes, { "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, ref: function (span) {
254
+ React.createElement("span", __assign({ className: classNames('k-switch-track', (_b = {},
255
+ _b["k-rounded-" + (kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
256
+ _b)), id: id || this._id, role: 'switch' }, ariaAttributes, { "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, ref: function (span) {
258
257
  _this._element = span;
259
258
  }, tabIndex: getTabIndex(tabIndex, disabled, undefined), accessKey: this.props.accessKey }),
260
259
  this.dummyInput(this.value),
261
- React.createElement("span", { className: SWITCH_LABEL_ON }, onLabel),
262
- React.createElement("span", { className: SWITCH_LABEL_OFF }, offLabel),
263
- React.createElement("span", { className: SWITCH_HANDLE }))));
260
+ React.createElement("span", { className: 'k-switch-label-on' }, onLabel),
261
+ React.createElement("span", { className: 'k-switch-label-off' }, offLabel),
262
+ React.createElement("span", { className: 'k-switch-thumb-wrap' },
263
+ React.createElement("span", { className: classNames('k-switch-thumb', (_c = {},
264
+ _c["k-rounded-" + thumbRounded] = thumbRounded,
265
+ _c)) })))));
264
266
  };
265
267
  SwitchWithoutContext.displayName = 'Switch';
266
268
  /**
@@ -272,6 +274,9 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
272
274
  className: PropTypes.string,
273
275
  disabled: PropTypes.bool,
274
276
  defaultChecked: PropTypes.bool,
277
+ size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
278
+ trackRounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
279
+ thumbRounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
275
280
  dir: PropTypes.string,
276
281
  id: PropTypes.string,
277
282
  ariaLabelledBy: PropTypes.string,
@@ -293,6 +298,9 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
293
298
  SwitchWithoutContext.defaultProps = {
294
299
  disabled: false,
295
300
  defaultChecked: false,
301
+ size: 'medium',
302
+ trackRounded: 'full',
303
+ thumbRounded: 'full',
296
304
  offLabel: 'OFF',
297
305
  onBlur: noop,
298
306
  onFocus: noop,
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  };
21
21
  import * as React from 'react';
22
22
  import * as PropTypes from 'prop-types';
23
- import { guid, classNames, getTabIndex, dispatchEvent, useDir, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
23
+ import { guid, classNames, getTabIndex, dispatchEvent, useDir, createPropsContext, usePropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
24
24
  /**
25
25
  * Represents the PropsContext of the `TextArea` component.
26
26
  * Used for global configuration of all `TextArea` instances.
@@ -46,10 +46,11 @@ export var TextAreaPropsContext = createPropsContext();
46
46
  * ```
47
47
  */
48
48
  export var TextArea = React.forwardRef(function (directProps, target) {
49
+ var _a;
49
50
  var props = usePropsContext(TextAreaPropsContext, directProps);
50
- var _a = props, ariaDescribedBy = _a.ariaDescribedBy, ariaLabelledBy = _a.ariaLabelledBy, autoSize = _a.autoSize, className = _a.className, defaultValue = _a.defaultValue, disabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, rows = _a.rows, id = _a.id, name = _a.name, placeholder = _a.placeholder, style = _a.style, tabIndex = _a.tabIndex, value = _a.value, valid = _a.valid, validationMessage = _a.validationMessage, validityStyles = _a.validityStyles, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur,
51
+ var _b = props, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode, ariaDescribedBy = _b.ariaDescribedBy, ariaLabelledBy = _b.ariaLabelledBy, autoSize = _b.autoSize, className = _b.className, defaultValue = _b.defaultValue, disabled = _b.disabled, readOnly = _b.readOnly, required = _b.required, rows = _b.rows, id = _b.id, name = _b.name, placeholder = _b.placeholder, style = _b.style, tabIndex = _b.tabIndex, value = _b.value, valid = _b.valid, validationMessage = _b.validationMessage, validityStyles = _b.validityStyles, onChange = _b.onChange, onFocus = _b.onFocus, onBlur = _b.onBlur,
51
52
  // Removed to support direct use in Form Field component
52
- visited = _a.visited, touched = _a.touched, modified = _a.modified, others = __rest(_a, ["ariaDescribedBy", "ariaLabelledBy", "autoSize", "className", "defaultValue", "disabled", "readOnly", "required", "rows", "id", "name", "placeholder", "style", "tabIndex", "value", "valid", "validationMessage", "validityStyles", "onChange", "onFocus", "onBlur", "visited", "touched", "modified"]);
53
+ visited = _b.visited, touched = _b.touched, modified = _b.modified, others = __rest(_b, ["size", "rounded", "fillMode", "ariaDescribedBy", "ariaLabelledBy", "autoSize", "className", "defaultValue", "disabled", "readOnly", "required", "rows", "id", "name", "placeholder", "style", "tabIndex", "value", "valid", "validationMessage", "validityStyles", "onChange", "onFocus", "onBlur", "visited", "touched", "modified"]);
53
54
  var elementRef = React.useRef(null);
54
55
  var focusElement = React.useCallback(function () {
55
56
  if (elementRef.current) {
@@ -64,8 +65,8 @@ export var TextArea = React.forwardRef(function (directProps, target) {
64
65
  });
65
66
  }, [focusElement]);
66
67
  React.useImperativeHandle(target, getImperativeHandle);
67
- var _b = React.useState(defaultValue), stateValue = _b[0], setStateValue = _b[1];
68
- var _c = React.useState('auto'), textAreaHeight = _c[0], setTextAreaHeight = _c[1];
68
+ var _c = React.useState(defaultValue), stateValue = _c[0], setStateValue = _c[1];
69
+ var _d = React.useState('auto'), textAreaHeight = _d[0], setTextAreaHeight = _d[1];
69
70
  var calculatedId = React.useMemo(function () { return guid(); }, []);
70
71
  var dir = useDir(elementRef, props.dir);
71
72
  var isControlled = value !== undefined;
@@ -107,16 +108,16 @@ export var TextArea = React.forwardRef(function (directProps, target) {
107
108
  dispatchEvent(onBlur, event, getImperativeHandle(), undefined);
108
109
  }
109
110
  }, [onBlur, disabled]);
110
- var spanProps = {
111
- className: classNames('k-textarea', {
112
- 'k-state-invalid': !(isValid || validityStyles !== undefined || validityStyles === true),
113
- 'k-state-disabled': disabled
114
- }, className),
115
- style: style,
116
- dir: dir
117
- };
118
- var textAreaProps = __assign({ id: id || calculatedId, name: name, className: 'k-input', ref: elementRef, disabled: disabled, rows: rows, placeholder: placeholder, readOnly: readOnly, required: required, tabIndex: getTabIndex(tabIndex, disabled), style: autoSize ? { resize: 'none', overflow: 'hidden', height: textAreaHeight } : {}, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-multiline': true, 'aria-disabled': disabled || undefined, value: isControlled ? value : stateValue }, others, { onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur });
119
- return (React.createElement("span", __assign({}, spanProps),
111
+ var textAreaProps = __assign({ id: id || calculatedId, name: name, className: 'k-input-inner', ref: elementRef, disabled: disabled, rows: rows, placeholder: placeholder, readOnly: readOnly, required: required, tabIndex: getTabIndex(tabIndex, disabled), style: autoSize ? { resize: 'none', overflow: 'hidden', height: textAreaHeight } : {}, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-multiline': true, 'aria-disabled': disabled || undefined, value: isControlled ? value : stateValue }, others, { onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur });
112
+ return (React.createElement("span", { className: classNames('k-input', 'k-textarea', (_a = {},
113
+ _a["k-input-" + (kendoThemeMaps.sizeMap[size] || size)] = size,
114
+ _a["k-input-" + fillMode] = fillMode,
115
+ _a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
116
+ _a['k-valid'] = (isValid || validityStyles !== undefined || validityStyles === true),
117
+ _a['k-invalid'] = !(isValid || validityStyles !== undefined || validityStyles === true),
118
+ _a['k-required'] = required,
119
+ _a['k-disabled'] = disabled,
120
+ _a), className), style: style, dir: dir },
120
121
  React.createElement("textarea", __assign({}, textAreaProps))));
121
122
  });
122
123
  TextArea.propTypes = {
@@ -141,6 +142,15 @@ TextArea.propTypes = {
141
142
  ]),
142
143
  onChange: PropTypes.func,
143
144
  onFocus: PropTypes.func,
144
- onBlur: PropTypes.func
145
+ onBlur: PropTypes.func,
146
+ size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
147
+ rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
148
+ fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
149
+ };
150
+ var defaultProps = {
151
+ size: 'medium',
152
+ rounded: 'medium',
153
+ fillMode: 'solid'
145
154
  };
146
155
  TextArea.displayName = 'KendoTextArea';
156
+ TextArea.defaultProps = defaultProps;
@@ -88,5 +88,42 @@ export interface TextAreaProps extends FormComponentProps, Omit<React.TextareaHT
88
88
  * The event handler that will be fired when TextArea is blurred.
89
89
  */
90
90
  onBlur?: (event: TextAreaBlurEvent) => void;
91
+ /**
92
+ * Configures the `size` of the TextArea.
93
+ *
94
+ * The available options are:
95
+ * - small
96
+ * - medium
97
+ * - large
98
+ * - null&mdash;Does not set a size `className`.
99
+ *
100
+ * @default `medium`
101
+ */
102
+ size?: null | 'small' | 'medium' | 'large';
103
+ /**
104
+ * Configures the `roundness` of the TextArea.
105
+ *
106
+ * The available options are:
107
+ * - small
108
+ * - medium
109
+ * - large
110
+ * - full
111
+ * - null&mdash;Does not set a rounded `className`.
112
+ *
113
+ * @default `medium`
114
+ */
115
+ rounded?: null | 'small' | 'medium' | 'large' | 'full';
116
+ /**
117
+ * Configures the `fillMode` of the TextArea.
118
+ *
119
+ * The available options are:
120
+ * - solid
121
+ * - outline
122
+ * - flat
123
+ * - null&mdash;Does not set a fillMode `className`.
124
+ *
125
+ * @default `solid`
126
+ */
127
+ fillMode?: null | 'solid' | 'flat' | 'outline';
91
128
  }
92
129
  export {};
@@ -48,11 +48,12 @@ exports.CheckboxPropsContext = kendo_react_common_1.createPropsContext();
48
48
  * ```
49
49
  */
50
50
  exports.Checkbox = React.forwardRef(function (directProps, target) {
51
+ var _a;
51
52
  kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
52
53
  var props = kendo_react_common_1.usePropsContext(exports.CheckboxPropsContext, directProps);
53
- var _a = props, ariaDescribedBy = _a.ariaDescribedBy, ariaLabelledBy = _a.ariaLabelledBy, checked = _a.checked, className = _a.className, children = _a.children, defaultChecked = _a.defaultChecked, disabled = _a.disabled, defaultValue = _a.defaultValue, id = _a.id, label = _a.label, labelPlacement = _a.labelPlacement, name = _a.name, labelOptional = _a.labelOptional, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, tabIndex = _a.tabIndex, value = _a.value, required = _a.required, valid = _a.valid, validationMessage = _a.validationMessage, validityStyles = _a.validityStyles,
54
+ var _b = props, ariaDescribedBy = _b.ariaDescribedBy, ariaLabelledBy = _b.ariaLabelledBy, checked = _b.checked, className = _b.className, children = _b.children, defaultChecked = _b.defaultChecked, disabled = _b.disabled, defaultValue = _b.defaultValue, id = _b.id, size = _b.size, rounded = _b.rounded, label = _b.label, labelPlacement = _b.labelPlacement, name = _b.name, labelOptional = _b.labelOptional, onChange = _b.onChange, onFocus = _b.onFocus, onBlur = _b.onBlur, tabIndex = _b.tabIndex, value = _b.value, required = _b.required, valid = _b.valid, validationMessage = _b.validationMessage, validityStyles = _b.validityStyles,
54
55
  // Removed to support direct use in Form Field component
55
- visited = _a.visited, touched = _a.touched, modified = _a.modified, others = __rest(_a, ["ariaDescribedBy", "ariaLabelledBy", "checked", "className", "children", "defaultChecked", "disabled", "defaultValue", "id", "label", "labelPlacement", "name", "labelOptional", "onChange", "onFocus", "onBlur", "tabIndex", "value", "required", "valid", "validationMessage", "validityStyles", "visited", "touched", "modified"]);
56
+ visited = _b.visited, touched = _b.touched, modified = _b.modified, others = __rest(_b, ["ariaDescribedBy", "ariaLabelledBy", "checked", "className", "children", "defaultChecked", "disabled", "defaultValue", "id", "size", "rounded", "label", "labelPlacement", "name", "labelOptional", "onChange", "onFocus", "onBlur", "tabIndex", "value", "required", "valid", "validationMessage", "validityStyles", "visited", "touched", "modified"]);
56
57
  var elementRef = React.useRef(null);
57
58
  var focusElement = React.useCallback(function () {
58
59
  if (elementRef.current) {
@@ -65,8 +66,8 @@ exports.Checkbox = React.forwardRef(function (directProps, target) {
65
66
  get name() { return elementRef.current && elementRef.current.name; }
66
67
  }); }, [focusElement]);
67
68
  React.useImperativeHandle(target, getImperativeHandle);
68
- var _b = React.useState(defaultChecked), stateChecked = _b[0], setStateChecked = _b[1];
69
- var _c = React.useState(defaultValue), stateValue = _c[0], setStateValue = _c[1];
69
+ var _c = React.useState(defaultChecked), stateChecked = _c[0], setStateChecked = _c[1];
70
+ var _d = React.useState(defaultValue), stateValue = _d[0], setStateValue = _d[1];
70
71
  var valueIsBoolean = (typeof value === 'boolean' || value === null);
71
72
  var isCheckedControlled = checked !== undefined;
72
73
  var isValueControlled = valueIsBoolean;
@@ -143,11 +144,12 @@ exports.Checkbox = React.forwardRef(function (directProps, target) {
143
144
  }, [onBlur, disabled, getImperativeHandle]);
144
145
  var dir = kendo_react_common_1.useDir(elementRef, props.dir);
145
146
  var checkboxClasses = kendo_react_common_1.classNames({ 'k-state-disabled': disabled }, className);
146
- var inputProps = __assign({ type: 'checkbox', className: kendo_react_common_1.classNames({
147
- 'k-checkbox': true,
148
- 'k-state-indeterminate': indeterminateProp,
149
- 'k-state-invalid k-invalid': !(isValid || validityStyles !== undefined || validityStyles === true)
150
- }), ref: elementRef, name: name, id: id || calculatedId, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, checked: Boolean(checkedProp), disabled: disabled, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), role: 'checkbox', required: required !== undefined ? required : false, 'aria-checked': currentChecked || checkedProp ?
147
+ var inputProps = __assign({ type: 'checkbox', className: kendo_react_common_1.classNames('k-checkbox', (_a = {},
148
+ _a["k-checkbox-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
149
+ _a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
150
+ _a['k-state-indeterminate'] = indeterminateProp,
151
+ _a['k-state-invalid k-invalid'] = !(isValid || validityStyles !== undefined || validityStyles === true),
152
+ _a)), ref: elementRef, name: name, id: id || calculatedId, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, checked: Boolean(checkedProp), disabled: disabled, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), role: 'checkbox', required: required !== undefined ? required : false, 'aria-checked': currentChecked || checkedProp ?
151
153
  true :
152
154
  indeterminateProp ?
153
155
  'mixed' :
@@ -175,6 +177,8 @@ exports.Checkbox.propTypes = {
175
177
  dir: PropTypes.string,
176
178
  disabled: PropTypes.bool,
177
179
  id: PropTypes.string,
180
+ size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
181
+ rounded: PropTypes.oneOf([null, 'small', 'medium', 'large']),
178
182
  ariaLabelledBy: PropTypes.string,
179
183
  ariaDescribedBy: PropTypes.string,
180
184
  label: PropTypes.any,
@@ -191,4 +195,9 @@ exports.Checkbox.propTypes = {
191
195
  onFocus: PropTypes.func,
192
196
  onBlur: PropTypes.func
193
197
  };
198
+ var defaultProps = {
199
+ size: 'medium',
200
+ rounded: 'medium'
201
+ };
202
+ exports.Checkbox.defaultProps = defaultProps;
194
203
  exports.Checkbox.displayName = 'KendoCheckbox';
@@ -12,7 +12,7 @@ declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
12
12
  * Represents the props of the [KendoReact Checkbox component]({% slug overview_checkbox %}).
13
13
  * Extends the [native input props](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement).
14
14
  */
15
- export interface CheckboxProps extends ToggleBaseProps, FormComponentProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'checked' | 'value' | 'onChange' | 'onFocus' | 'onBlur'> {
15
+ export interface CheckboxProps extends ToggleBaseProps, FormComponentProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'checked' | 'value' | 'size' | 'onChange' | 'onFocus' | 'onBlur'> {
16
16
  /**
17
17
  * Sets the checked state of the Checkbox.
18
18
  * Set to null to enable the indeterminate state of the Checkbox ([see example]({% slug overview_checkbox %})).
@@ -53,6 +53,30 @@ export interface CheckboxProps extends ToggleBaseProps, FormComponentProps, Omit
53
53
  * Sets the `id` of the Checkbox.
54
54
  */
55
55
  id?: string;
56
+ /**
57
+ * Configures the `size` of the Checkbox.
58
+ *
59
+ * The available options are:
60
+ * - small
61
+ * - medium
62
+ * - large
63
+ * - null&mdash;Does not set a size `className`.
64
+ *
65
+ * @default `medium`
66
+ */
67
+ size?: null | 'small' | 'medium' | 'large';
68
+ /**
69
+ * Configures the `rounded` style of the Checkbox.
70
+ *
71
+ * The available options are:
72
+ * - small
73
+ * - medium
74
+ * - large
75
+ * - null&mdash;Does not set a rounded `className`.
76
+ *
77
+ * @default `medium`
78
+ */
79
+ rounded?: null | 'small' | 'medium' | 'large';
56
80
  /**
57
81
  * 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).
58
82
  * For example these elements could contain error or hint message.
@@ -68,10 +68,10 @@ var ColorInput = /** @class */ (function (_super) {
68
68
  var aMessage = localizationService.toLanguageString(messages_1.colorGradientR, messages_1.messages[messages_1.colorGradientA]);
69
69
  return (React.createElement("div", { className: "k-colorgradient-inputs k-hstack" },
70
70
  React.createElement("div", { className: "k-vstack" },
71
- React.createElement(kendo_react_buttons_1.Button, { look: 'flat', icon: 'arrows-kpi', className: "k-colorgradient-toggle-mode k-icon-button", onClick: this.onToggleModeChange.bind(this) })),
71
+ React.createElement(kendo_react_buttons_1.Button, { fillMode: 'flat', icon: 'arrows-kpi', className: "k-colorgradient-toggle-mode k-icon-button", onClick: this.onToggleModeChange.bind(this) })),
72
72
  this.state.inputMode === 'hex' &&
73
73
  React.createElement("div", { className: "k-vstack k-flex-1" },
74
- React.createElement("span", { className: "k-hex-value k-textbox" },
74
+ React.createElement("span", { className: "k-hex-value k-textbox k-input" },
75
75
  React.createElement(HexInput_1.default, { hex: this.props.hex, onHexChange: this.props.onHexChange, disabled: this.props.disabled })),
76
76
  React.createElement(kendo_react_labels_1.Label, { className: "k-colorgradient-input-label" }, hexMessage)),
77
77
  (this.state.inputMode === 'rgb' || this.state.inputMode === 'rgba') &&
@@ -19,6 +19,7 @@ var package_metadata_1 = require("../package-metadata");
19
19
  var Picker_1 = require("./Picker");
20
20
  var ColorGradient_1 = require("./ColorGradient");
21
21
  var ColorPalette_1 = require("./ColorPalette");
22
+ var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
22
23
  /**
23
24
  * @hidden
24
25
  */
@@ -59,9 +60,10 @@ exports.ColorPickerPropsContext = kendo_react_common_1.createPropsContext();
59
60
  * ```
60
61
  */
61
62
  exports.ColorPicker = React.forwardRef(function (directProps, target) {
63
+ var _a, _b;
62
64
  kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
63
65
  var props = kendo_react_common_1.usePropsContext(exports.ColorPickerPropsContext, directProps);
64
- var popupSettings = props.popupSettings, gradientSettings = props.gradientSettings, paletteSettings = props.paletteSettings, valid = props.valid, disabled = props.disabled, tabIndex = props.tabIndex, view = props.view, icon = props.icon, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onActiveColorClick = props.onActiveColorClick;
66
+ var _c = props.size, size = _c === void 0 ? defaultProps.size : _c, _d = props.rounded, rounded = _d === void 0 ? defaultProps.rounded : _d, _e = props.fillMode, fillMode = _e === void 0 ? defaultProps.fillMode : _e, popupSettings = props.popupSettings, gradientSettings = props.gradientSettings, paletteSettings = props.paletteSettings, valid = props.valid, disabled = props.disabled, tabIndex = props.tabIndex, view = props.view, icon = props.icon, iconClassName = props.iconClassName, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onActiveColorClick = props.onActiveColorClick;
65
67
  var focusableElementRef = React.useRef(null);
66
68
  var gradientRef = React.useRef(null);
67
69
  var paletteRef = React.useRef(null);
@@ -78,9 +80,9 @@ exports.ColorPicker = React.forwardRef(function (directProps, target) {
78
80
  actionElement: buttonRef.current,
79
81
  focus: focusElement
80
82
  }); });
81
- var _a = React.useState(false), focused = _a[0], setFocused = _a[1];
82
- var _b = React.useState(props.defaultValue), stateValue = _b[0], setStateValue = _b[1];
83
- var _c = React.useState(false), stateOpen = _c[0], setStateOpen = _c[1];
83
+ var _f = React.useState(false), focused = _f[0], setFocused = _f[1];
84
+ var _g = React.useState(props.defaultValue), stateValue = _g[0], setStateValue = _g[1];
85
+ var _h = React.useState(false), stateOpen = _h[0], setStateOpen = _h[1];
84
86
  var isValueControlled = isControlled(props.value);
85
87
  var isOpenControlled = isControlled(props.open);
86
88
  var value = isValueControlled ? props.value : stateValue;
@@ -192,24 +194,27 @@ exports.ColorPicker = React.forwardRef(function (directProps, target) {
192
194
  }, [isValueControlled, onChange]);
193
195
  var onPaletteChangeHandler = React.useCallback(function (event) { return onChangeHandler(event, true); }, [isControlled, onChangeHandler]);
194
196
  var dir = kendo_react_common_1.useDir(focusableElementRef, props.dir);
195
- var iconClassName = props.iconClassName || (icon && "k-icon k-i-" + icon);
196
- var wrapperClassName = kendo_react_common_1.classNames({
197
- 'k-widget': true,
198
- 'k-colorpicker': true,
199
- 'k-state-invalid': valid === false
200
- });
201
- var className = React.useMemo(function () { return kendo_react_common_1.classNames({
202
- 'k-picker-wrap': true,
203
- 'k-state-disabled': disabled,
204
- 'k-state-focused': focused
205
- }); }, [focused, disabled]);
206
- return (React.createElement("span", { className: wrapperClassName, dir: dir },
207
- React.createElement("span", { id: props.id, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, className: className, ref: focusableElementRef, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), title: props.title, onKeyDown: onKeyDownHandler, onFocus: onFocusHandler, onBlur: onBlurHandler },
208
- React.createElement(Picker_1.Picker, { dir: dir, open: open, onOpen: onOpenHandler, popupAnchor: focusableElementRef.current || undefined, popupSettings: __assign({}, popupSettings), input: (!iconClassName ? (React.createElement("span", { onClick: onActiveColorClickHandler, className: 'k-selected-color', style: { backgroundColor: value } }, !value && React.createElement("span", { className: 'k-icon k-i-line' }))) : (React.createElement("span", { onClick: onActiveColorClickHandler, className: kendo_react_common_1.classNames('k-tool-icon', iconClassName) },
209
- React.createElement("span", { className: 'k-selected-color', style: { backgroundColor: value } })))), button: (React.createElement("span", { onClick: onClickHandler, className: 'k-select', ref: buttonRef },
210
- React.createElement("span", { className: 'k-icon k-i-arrow-s' }))), content: (React.createElement(React.Fragment, null,
211
- (view === 'combo' || view === 'gradient') && (React.createElement(ColorGradient_1.ColorGradient, __assign({}, gradientSettings, { tabIndex: 0, ref: gradientRef, value: value, onChange: onChangeHandler }))),
212
- (view === 'combo' || view === 'palette') && (React.createElement(ColorPalette_1.ColorPalette, __assign({}, paletteSettings, { ref: paletteRef, value: value, onChange: onPaletteChangeHandler }))))) }))));
197
+ var isValid = valid !== false;
198
+ return (React.createElement("span", { id: props.id, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, className: kendo_react_common_1.classNames('k-colorpicker', 'k-picker', 'k-icon-picker', (_a = {},
199
+ _a["k-picker-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
200
+ _a["k-picker-" + fillMode] = fillMode,
201
+ _a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
202
+ _a['k-valid'] = isValid,
203
+ _a['k-invalid'] = !isValid,
204
+ _a['k-disabled'] = disabled,
205
+ _a['k-focus'] = focused,
206
+ _a)), ref: focusableElementRef, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), title: props.title, onKeyDown: onKeyDownHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, dir: dir },
207
+ React.createElement(Picker_1.Picker, { dir: dir, open: open, onOpen: onOpenHandler, popupAnchor: focusableElementRef.current || undefined, popupSettings: __assign({}, popupSettings), input: (React.createElement("span", { onClick: onActiveColorClickHandler, className: 'k-input-inner' },
208
+ React.createElement("span", { className: kendo_react_common_1.classNames('k-value-icon', 'k-color-preview', {
209
+ 'k-no-color': !value,
210
+ 'k-icon-color-preview': (icon || iconClassName)
211
+ }) },
212
+ (iconClassName || icon) && React.createElement("span", { className: kendo_react_common_1.classNames('k-color-preview-icon', iconClassName, (_b = {},
213
+ _b["k-icon k-i-" + icon] = (icon && !iconClassName),
214
+ _b)) }),
215
+ React.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: value } })))), button: (React.createElement(kendo_react_buttons_1.Button, { type: "button", onClick: onClickHandler, className: "k-input-button", icon: 'arrow-s' })), content: (React.createElement(React.Fragment, null,
216
+ (view === 'combo' || view === 'gradient') && (React.createElement(ColorGradient_1.ColorGradient, __assign({}, gradientSettings, { tabIndex: 0, ref: gradientRef, value: value, onChange: onChangeHandler }))),
217
+ (view === 'combo' || view === 'palette') && (React.createElement(ColorPalette_1.ColorPalette, __assign({}, paletteSettings, { ref: paletteRef, value: value, onChange: onPaletteChangeHandler }))))) })));
213
218
  });
214
219
  exports.ColorPicker.propTypes = {
215
220
  value: PropTypes.string,
@@ -219,11 +224,18 @@ exports.ColorPicker.propTypes = {
219
224
  dir: PropTypes.string,
220
225
  id: PropTypes.string,
221
226
  ariaLabelledBy: PropTypes.string,
222
- ariaDescribedBy: PropTypes.string
227
+ ariaDescribedBy: PropTypes.string,
228
+ size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
229
+ rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
230
+ fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
223
231
  };
224
- exports.ColorPicker.defaultProps = {
232
+ var defaultProps = {
233
+ size: 'medium',
234
+ rounded: 'medium',
235
+ fillMode: 'solid',
225
236
  view: 'palette',
226
237
  gradientSettings: DEFAULT_GRADIENT_SETTINGS,
227
238
  paletteSettings: DEFAULT_PALETTE_SETTINGS
228
239
  };
240
+ exports.ColorPicker.defaultProps = defaultProps;
229
241
  exports.ColorPicker.displayName = 'KendoColorPicker';