@progress/kendo-react-inputs 5.7.1-dev.202209200738 → 5.8.0-dev.202209280807

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.
@@ -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: 1663658371,
8
+ publishDate: 1664351342,
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
  };
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  import { SignaturePad } from '@progress/kendo-inputs-common';
49
49
  import { Button } from '@progress/kendo-react-buttons';
50
- import { classNames, createPropsContext, dispatchEvent, getTabIndex, kendoThemeMaps, noop, usePropsContext } from '@progress/kendo-react-common';
50
+ import { classNames, createPropsContext, dispatchEvent, getTabIndex, kendoThemeMaps, Keys, noop, usePropsContext } from '@progress/kendo-react-common';
51
51
  import { validatePackage } from '@progress/kendo-react-common';
52
52
  import { Dialog } from '@progress/kendo-react-dialogs';
53
53
  import { useLocalization } from '@progress/kendo-react-intl';
@@ -60,6 +60,8 @@ var DEFAULT_WIDTH = 250;
60
60
  var DEFAULT_HEIGHT = 84;
61
61
  var DEFAULT_POPUP_SCALE = 3;
62
62
  var DEFAULT_EXPORT_SCALE = 2;
63
+ var DEFAULT_COLOR = '#000000';
64
+ var DEFAULT_BACKGROUND_COLOR = '#ffffff';
63
65
  /**
64
66
  * @hidden
65
67
  */
@@ -130,14 +132,30 @@ export var Signature = React.forwardRef(function (directProps, target) {
130
132
  onMinimizeClick(event);
131
133
  focusElement();
132
134
  };
133
- var getOptions = function () { return ({
134
- scale: props.maximized ? props.popupScale : 1,
135
- color: props.color,
136
- backgroundColor: props.backgroundColor,
137
- strokeWidth: props.strokeWidth,
138
- smooth: props.smooth,
139
- readonly: props.readOnly
140
- }); };
135
+ var colorGetter = React.useCallback(function () {
136
+ var defaultColor = DEFAULT_COLOR;
137
+ if (!props.color && typeof document !== 'undefined' && elementRef.current) {
138
+ defaultColor = getComputedStyle(elementRef.current).color;
139
+ }
140
+ return props.color || defaultColor;
141
+ }, [props.color]);
142
+ var backgroundColorGetter = React.useCallback(function () {
143
+ var defaultBackgroundColor = DEFAULT_BACKGROUND_COLOR;
144
+ if (!props.backgroundColor && typeof document !== 'undefined' && elementRef.current) {
145
+ defaultBackgroundColor = getComputedStyle(elementRef.current).backgroundColor;
146
+ }
147
+ return props.backgroundColor || defaultBackgroundColor;
148
+ }, [props.backgroundColor]);
149
+ var getOptions = function () {
150
+ return {
151
+ scale: props.maximized ? props.popupScale : 1,
152
+ color: colorGetter(),
153
+ backgroundColor: backgroundColorGetter(),
154
+ strokeWidth: props.strokeWidth,
155
+ smooth: props.smooth,
156
+ readonly: props.readOnly
157
+ };
158
+ };
141
159
  var exportImage = function (exportSize) { return __awaiter(void 0, void 0, void 0, function () {
142
160
  var width, height;
143
161
  return __generator(this, function (_a) {
@@ -184,9 +202,19 @@ export var Signature = React.forwardRef(function (directProps, target) {
184
202
  }
185
203
  var onOverlayClick = function () { return setOpen(false); };
186
204
  overlay.addEventListener('click', onOverlayClick);
187
- return function () {
188
- return overlay.removeEventListener('click', onOverlayClick);
205
+ return function () { return overlay.removeEventListener('click', onOverlayClick); };
206
+ }, [open]);
207
+ React.useEffect(function () {
208
+ if (!open || typeof document === 'undefined') {
209
+ return;
210
+ }
211
+ var onDocumentKeydown = function (e) {
212
+ if (e.keyCode === Keys.esc) {
213
+ setOpen(false);
214
+ }
189
215
  };
216
+ document.addEventListener('keypress', onDocumentKeydown);
217
+ return function () { return document.removeEventListener('keypress', onDocumentKeydown); };
190
218
  }, [open]);
191
219
  var focusElement = React.useCallback(function () { var _a; return (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, []);
192
220
  var valueGetter = React.useCallback(function () { return props.value; }, [props.value]);
@@ -222,8 +250,10 @@ export var Signature = React.forwardRef(function (directProps, target) {
222
250
  Object.defineProperty(options, 'validityStyles', { get: validityStylesGetter });
223
251
  Object.defineProperty(options, 'required', { get: requiredGetter });
224
252
  Object.defineProperty(options, 'props', { get: propsGetter });
253
+ Object.defineProperty(options, 'color', { get: colorGetter });
254
+ Object.defineProperty(options, 'backgroundColor', { get: backgroundColorGetter });
225
255
  return options;
226
- }, [nameGetter, valueGetter, validityGetter, validityStylesGetter, requiredGetter, focusElement, propsGetter]);
256
+ }, [nameGetter, valueGetter, validityGetter, validityStylesGetter, requiredGetter, focusElement, propsGetter, colorGetter, backgroundColorGetter]);
227
257
  React.useImperativeHandle(target, getImperativeHandle);
228
258
  var onFocus = React.useCallback(function (event) {
229
259
  if (focused || props.maximized) {
@@ -294,7 +324,7 @@ export var Signature = React.forwardRef(function (directProps, target) {
294
324
  _a), props.className), onFocus: onFocus, onBlur: onBlur },
295
325
  React.createElement("div", { className: 'k-signature-actions k-signature-actions-top' },
296
326
  showMaximize && (React.createElement(Button, { className: 'k-signature-action k-signature-maximize', icon: 'hyperlink-open', shape: null, fillMode: 'flat', size: props.size, onClick: onMaximizeClick, "aria-label": maximizeTitle, title: maximizeTitle })),
297
- showMinimize && (React.createElement(Button, { className: 'k-signature-action k-signature-minimize', icon: 'window-minimize', shape: null, fillMode: 'flat', size: props.size, onClick: onMinimizeClick, "aria-label": minimizeTitle, title: minimizeTitle }))),
327
+ showMinimize && (React.createElement(Button, { className: 'k-signature-action k-signature-minimize k-rotate-180', icon: 'hyperlink-open', shape: null, fillMode: 'flat', size: props.size, onClick: onMinimizeClick, "aria-label": minimizeTitle, title: minimizeTitle }))),
298
328
  React.createElement("div", { className: 'k-signature-canvas', ref: canvasRef, tabIndex: getTabIndex(props.tabIndex, props.disabled), role: "img", id: props.id, "aria-label": props.ariaLabel, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, "aria-disabled": props.disabled ? 'true' : undefined }),
299
329
  !props.hideLine && (React.createElement("div", { className: 'k-signature-line', style: { zIndex: 2, pointerEvents: 'none' } })),
300
330
  React.createElement("div", { className: 'k-signature-actions k-signature-actions-bottom' }, showClear && (React.createElement(Button, { className: 'k-signature-action k-signature-clear', icon: 'close', shape: null, fillMode: 'flat', size: props.size, onClick: onClear, "aria-label": clearTitle, title: clearTitle }))),
@@ -320,13 +350,11 @@ Signature.propTypes = {
320
350
  onOpen: PropTypes.func,
321
351
  onClose: PropTypes.func,
322
352
  size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
323
- rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
353
+ rounded: PropTypes.oneOf([null, 'small', 'medium', 'large']),
324
354
  fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
325
355
  };
326
356
  Signature.displayName = 'KendoSignature';
327
357
  Signature.defaultProps = {
328
- color: '#000000',
329
- backgroundColor: '#ffffff',
330
358
  strokeWidth: 1,
331
359
  smooth: false,
332
360
  popupScale: DEFAULT_POPUP_SCALE,
@@ -31,4 +31,12 @@ export interface SignatureHandle {
31
31
  * @hidden
32
32
  */
33
33
  required: boolean;
34
+ /**
35
+ * @hidden
36
+ */
37
+ color: string;
38
+ /**
39
+ * @hidden
40
+ */
41
+ backgroundColor: string;
34
42
  }
@@ -83,12 +83,11 @@ export interface SignatureProps extends FormComponentProps {
83
83
  * - small
84
84
  * - medium
85
85
  * - large
86
- * - full
87
86
  * - null—Does not set a rounded `className`.
88
87
  *
89
88
  * @default `medium`
90
89
  */
91
- rounded?: null | 'small' | 'medium' | 'large' | 'full';
90
+ rounded?: null | 'small' | 'medium' | 'large';
92
91
  /**
93
92
  * Configures the `fillMode` of the Signature.
94
93
  *
@@ -106,7 +105,7 @@ export interface SignatureProps extends FormComponentProps {
106
105
  *
107
106
  * Accepts CSS color names and hex values.
108
107
  *
109
- * @default '#000000'
108
+ * The default value is determined by the theme `$kendo-input-text` variable.
110
109
  */
111
110
  color?: string;
112
111
  /**
@@ -114,7 +113,7 @@ export interface SignatureProps extends FormComponentProps {
114
113
  *
115
114
  * Accepts CSS color names and hex values.
116
115
  *
117
- * @default '#ffffff'
116
+ * The default value is determined by the theme `$kendo-input-bg` variable.
118
117
  */
119
118
  backgroundColor?: string;
120
119
  /**
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-inputs',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1663658371,
11
+ publishDate: 1664351342,
12
12
  version: '',
13
13
  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'
14
14
  };
@@ -63,6 +63,8 @@ var DEFAULT_WIDTH = 250;
63
63
  var DEFAULT_HEIGHT = 84;
64
64
  var DEFAULT_POPUP_SCALE = 3;
65
65
  var DEFAULT_EXPORT_SCALE = 2;
66
+ var DEFAULT_COLOR = '#000000';
67
+ var DEFAULT_BACKGROUND_COLOR = '#ffffff';
66
68
  /**
67
69
  * @hidden
68
70
  */
@@ -133,14 +135,30 @@ exports.Signature = React.forwardRef(function (directProps, target) {
133
135
  onMinimizeClick(event);
134
136
  focusElement();
135
137
  };
136
- var getOptions = function () { return ({
137
- scale: props.maximized ? props.popupScale : 1,
138
- color: props.color,
139
- backgroundColor: props.backgroundColor,
140
- strokeWidth: props.strokeWidth,
141
- smooth: props.smooth,
142
- readonly: props.readOnly
143
- }); };
138
+ var colorGetter = React.useCallback(function () {
139
+ var defaultColor = DEFAULT_COLOR;
140
+ if (!props.color && typeof document !== 'undefined' && elementRef.current) {
141
+ defaultColor = getComputedStyle(elementRef.current).color;
142
+ }
143
+ return props.color || defaultColor;
144
+ }, [props.color]);
145
+ var backgroundColorGetter = React.useCallback(function () {
146
+ var defaultBackgroundColor = DEFAULT_BACKGROUND_COLOR;
147
+ if (!props.backgroundColor && typeof document !== 'undefined' && elementRef.current) {
148
+ defaultBackgroundColor = getComputedStyle(elementRef.current).backgroundColor;
149
+ }
150
+ return props.backgroundColor || defaultBackgroundColor;
151
+ }, [props.backgroundColor]);
152
+ var getOptions = function () {
153
+ return {
154
+ scale: props.maximized ? props.popupScale : 1,
155
+ color: colorGetter(),
156
+ backgroundColor: backgroundColorGetter(),
157
+ strokeWidth: props.strokeWidth,
158
+ smooth: props.smooth,
159
+ readonly: props.readOnly
160
+ };
161
+ };
144
162
  var exportImage = function (exportSize) { return __awaiter(void 0, void 0, void 0, function () {
145
163
  var width, height;
146
164
  return __generator(this, function (_a) {
@@ -187,9 +205,19 @@ exports.Signature = React.forwardRef(function (directProps, target) {
187
205
  }
188
206
  var onOverlayClick = function () { return setOpen(false); };
189
207
  overlay.addEventListener('click', onOverlayClick);
190
- return function () {
191
- return overlay.removeEventListener('click', onOverlayClick);
208
+ return function () { return overlay.removeEventListener('click', onOverlayClick); };
209
+ }, [open]);
210
+ React.useEffect(function () {
211
+ if (!open || typeof document === 'undefined') {
212
+ return;
213
+ }
214
+ var onDocumentKeydown = function (e) {
215
+ if (e.keyCode === kendo_react_common_1.Keys.esc) {
216
+ setOpen(false);
217
+ }
192
218
  };
219
+ document.addEventListener('keypress', onDocumentKeydown);
220
+ return function () { return document.removeEventListener('keypress', onDocumentKeydown); };
193
221
  }, [open]);
194
222
  var focusElement = React.useCallback(function () { var _a; return (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, []);
195
223
  var valueGetter = React.useCallback(function () { return props.value; }, [props.value]);
@@ -225,8 +253,10 @@ exports.Signature = React.forwardRef(function (directProps, target) {
225
253
  Object.defineProperty(options, 'validityStyles', { get: validityStylesGetter });
226
254
  Object.defineProperty(options, 'required', { get: requiredGetter });
227
255
  Object.defineProperty(options, 'props', { get: propsGetter });
256
+ Object.defineProperty(options, 'color', { get: colorGetter });
257
+ Object.defineProperty(options, 'backgroundColor', { get: backgroundColorGetter });
228
258
  return options;
229
- }, [nameGetter, valueGetter, validityGetter, validityStylesGetter, requiredGetter, focusElement, propsGetter]);
259
+ }, [nameGetter, valueGetter, validityGetter, validityStylesGetter, requiredGetter, focusElement, propsGetter, colorGetter, backgroundColorGetter]);
230
260
  React.useImperativeHandle(target, getImperativeHandle);
231
261
  var onFocus = React.useCallback(function (event) {
232
262
  if (focused || props.maximized) {
@@ -297,7 +327,7 @@ exports.Signature = React.forwardRef(function (directProps, target) {
297
327
  _a), props.className), onFocus: onFocus, onBlur: onBlur },
298
328
  React.createElement("div", { className: 'k-signature-actions k-signature-actions-top' },
299
329
  showMaximize && (React.createElement(kendo_react_buttons_1.Button, { className: 'k-signature-action k-signature-maximize', icon: 'hyperlink-open', shape: null, fillMode: 'flat', size: props.size, onClick: onMaximizeClick, "aria-label": maximizeTitle, title: maximizeTitle })),
300
- showMinimize && (React.createElement(kendo_react_buttons_1.Button, { className: 'k-signature-action k-signature-minimize', icon: 'window-minimize', shape: null, fillMode: 'flat', size: props.size, onClick: onMinimizeClick, "aria-label": minimizeTitle, title: minimizeTitle }))),
330
+ showMinimize && (React.createElement(kendo_react_buttons_1.Button, { className: 'k-signature-action k-signature-minimize k-rotate-180', icon: 'hyperlink-open', shape: null, fillMode: 'flat', size: props.size, onClick: onMinimizeClick, "aria-label": minimizeTitle, title: minimizeTitle }))),
301
331
  React.createElement("div", { className: 'k-signature-canvas', ref: canvasRef, tabIndex: (0, kendo_react_common_1.getTabIndex)(props.tabIndex, props.disabled), role: "img", id: props.id, "aria-label": props.ariaLabel, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, "aria-disabled": props.disabled ? 'true' : undefined }),
302
332
  !props.hideLine && (React.createElement("div", { className: 'k-signature-line', style: { zIndex: 2, pointerEvents: 'none' } })),
303
333
  React.createElement("div", { className: 'k-signature-actions k-signature-actions-bottom' }, showClear && (React.createElement(kendo_react_buttons_1.Button, { className: 'k-signature-action k-signature-clear', icon: 'close', shape: null, fillMode: 'flat', size: props.size, onClick: onClear, "aria-label": clearTitle, title: clearTitle }))),
@@ -323,13 +353,11 @@ exports.Signature.propTypes = {
323
353
  onOpen: PropTypes.func,
324
354
  onClose: PropTypes.func,
325
355
  size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
326
- rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
356
+ rounded: PropTypes.oneOf([null, 'small', 'medium', 'large']),
327
357
  fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
328
358
  };
329
359
  exports.Signature.displayName = 'KendoSignature';
330
360
  exports.Signature.defaultProps = {
331
- color: '#000000',
332
- backgroundColor: '#ffffff',
333
361
  strokeWidth: 1,
334
362
  smooth: false,
335
363
  popupScale: DEFAULT_POPUP_SCALE,
@@ -31,4 +31,12 @@ export interface SignatureHandle {
31
31
  * @hidden
32
32
  */
33
33
  required: boolean;
34
+ /**
35
+ * @hidden
36
+ */
37
+ color: string;
38
+ /**
39
+ * @hidden
40
+ */
41
+ backgroundColor: string;
34
42
  }
@@ -83,12 +83,11 @@ export interface SignatureProps extends FormComponentProps {
83
83
  * - small
84
84
  * - medium
85
85
  * - large
86
- * - full
87
86
  * - null—Does not set a rounded `className`.
88
87
  *
89
88
  * @default `medium`
90
89
  */
91
- rounded?: null | 'small' | 'medium' | 'large' | 'full';
90
+ rounded?: null | 'small' | 'medium' | 'large';
92
91
  /**
93
92
  * Configures the `fillMode` of the Signature.
94
93
  *
@@ -106,7 +105,7 @@ export interface SignatureProps extends FormComponentProps {
106
105
  *
107
106
  * Accepts CSS color names and hex values.
108
107
  *
109
- * @default '#000000'
108
+ * The default value is determined by the theme `$kendo-input-text` variable.
110
109
  */
111
110
  color?: string;
112
111
  /**
@@ -114,7 +113,7 @@ export interface SignatureProps extends FormComponentProps {
114
113
  *
115
114
  * Accepts CSS color names and hex values.
116
115
  *
117
- * @default '#ffffff'
116
+ * The default value is determined by the theme `$kendo-input-bg` variable.
118
117
  */
119
118
  backgroundColor?: string;
120
119
  /**