@progress/kendo-react-inputs 13.3.0 → 13.4.0-develop.2
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.d.ts +49 -0
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +35 -36
- package/checkbox/interfaces/CheckboxBlurEvent.d.ts +14 -0
- package/checkbox/interfaces/CheckboxChangeEvent.d.ts +18 -0
- package/checkbox/interfaces/CheckboxFocusEvent.d.ts +14 -0
- package/checkbox/interfaces/CheckboxProps.d.ts +148 -0
- package/colors/ColorContrastLabels.d.ts +22 -0
- package/colors/ColorContrastSvg.d.ts +25 -0
- package/colors/ColorGradient.d.ts +215 -0
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +20 -19
- package/colors/ColorInput.d.ts +40 -0
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +20 -16
- package/colors/ColorPalette.d.ts +129 -0
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +7 -7
- package/colors/ColorPicker.d.ts +34 -0
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +96 -94
- package/colors/FlatColorPicker.d.ts +189 -0
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +41 -40
- package/colors/HexInput.d.ts +39 -0
- package/colors/HexInput.js +1 -1
- package/colors/HexInput.mjs +2 -1
- package/colors/Picker.d.ts +13 -0
- package/colors/interfaces/ColorGradientChangeEvent.d.ts +18 -0
- package/colors/interfaces/ColorGradientProps.d.ts +160 -0
- package/colors/interfaces/ColorPaletteChangeEvent.d.ts +22 -0
- package/colors/interfaces/ColorPaletteProps.d.ts +116 -0
- package/colors/interfaces/ColorPickerActiveColorClick.d.ts +29 -0
- package/colors/interfaces/ColorPickerBlurEvent.d.ts +20 -0
- package/colors/interfaces/ColorPickerChangeEvent.d.ts +29 -0
- package/colors/interfaces/ColorPickerFocusEvent.d.ts +20 -0
- package/colors/interfaces/ColorPickerGradientSettings.d.ts +29 -0
- package/colors/interfaces/ColorPickerPaletteSettings.d.ts +39 -0
- package/colors/interfaces/ColorPickerPopupSettings.d.ts +21 -0
- package/colors/interfaces/ColorPickerProps.d.ts +242 -0
- package/colors/interfaces/ColorPickerView.d.ts +17 -0
- package/colors/interfaces/PickerPopupSettings.d.ts +29 -0
- package/colors/interfaces/PickerProps.d.ts +57 -0
- package/colors/models/hsva.d.ts +16 -0
- package/colors/models/output-format.d.ts +11 -0
- package/colors/models/palette-presets.d.ts +60 -0
- package/colors/models/rgb.d.ts +15 -0
- package/colors/models/rgba.d.ts +16 -0
- package/colors/models/table-cell.d.ts +14 -0
- package/colors/models/tile-size.d.ts +18 -0
- package/colors/utils/color-cache.d.ts +37 -0
- package/colors/utils/color-palette.service.d.ts +19 -0
- package/colors/utils/color-parser.d.ts +72 -0
- package/colors/utils/color-parser.js +1 -1
- package/colors/utils/color-parser.mjs +1 -1
- package/colors/utils/misc.d.ts +23 -0
- package/colors/utils/svg-calc.d.ts +69 -0
- package/common/AdaptiveMode.d.ts +21 -0
- package/common/SliderTooltip.d.ts +25 -0
- package/common/SwitchController.d.ts +38 -0
- package/common/SwitchModel.d.ts +14 -0
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +72 -5128
- package/index.d.ts +72 -5128
- package/input/Input.d.ts +119 -0
- package/input/Input.js +1 -1
- package/input/Input.mjs +45 -43
- package/input/InputClearValue.d.ts +28 -0
- package/input/InputPrefix.d.ts +30 -0
- package/input/InputSeparator.d.ts +30 -0
- package/input/InputSuffix.d.ts +32 -0
- package/input/InputValidationIcon.d.ts +21 -0
- package/input/interfaces/InputChangeEvent.d.ts +18 -0
- package/interfaces/Direction.d.ts +8 -0
- package/interfaces/ToggleBaseProps.d.ts +24 -0
- package/maskedtextbox/MaskedTextBox.d.ts +224 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +80 -79
- package/maskedtextbox/MaskedTextBoxProps.d.ts +273 -0
- package/maskedtextbox/masking.service.d.ts +48 -0
- package/maskedtextbox/masking.service.mjs +9 -9
- package/maskedtextbox/parsing/combinators.d.ts +16 -0
- package/maskedtextbox/parsing/parsers.d.ts +54 -0
- package/maskedtextbox/parsing/result.d.ts +30 -0
- package/maskedtextbox/parsing/stream.d.ts +29 -0
- package/maskedtextbox/utils.d.ts +23 -0
- package/messages/index.d.ts +177 -0
- package/numerictextbox/NumericTextBox.d.ts +21 -0
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +161 -161
- package/numerictextbox/interfaces/NumericTextBoxBlurEvent.d.ts +14 -0
- package/numerictextbox/interfaces/NumericTextBoxChangeEvent.d.ts +18 -0
- package/numerictextbox/interfaces/NumericTextBoxFocusEvent.d.ts +14 -0
- package/numerictextbox/interfaces/NumericTextBoxHandle.d.ts +46 -0
- package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +212 -0
- package/numerictextbox/interfaces/NumericTextBoxState.d.ts +22 -0
- package/numerictextbox/utils/index.d.ts +126 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +10 -10
- package/radiobutton/RadioButton.d.ts +36 -0
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +8 -8
- package/radiobutton/RadioGroup.d.ts +36 -0
- package/radiobutton/interfaces/RadioButtonBlurEvent.d.ts +14 -0
- package/radiobutton/interfaces/RadioButtonChangeEvent.d.ts +18 -0
- package/radiobutton/interfaces/RadioButtonFocusEvent.d.ts +14 -0
- package/radiobutton/interfaces/RadioButtonProps.d.ts +107 -0
- package/radiobutton/interfaces/RadioGroupChangeEvent.d.ts +18 -0
- package/radiobutton/interfaces/RadioGroupFocusEvent.d.ts +14 -0
- package/radiobutton/interfaces/RadioGroupProps.d.ts +178 -0
- package/range-slider/RangeSlider.d.ts +152 -0
- package/range-slider/range-raducer.d.ts +46 -0
- package/rating/Rating.d.ts +302 -0
- package/rating/Rating.mjs +3 -3
- package/rating/RatingItem.d.ts +111 -0
- package/rating/models/index.d.ts +91 -0
- package/rating/rating-reducer.d.ts +39 -0
- package/rating/utils/index.d.ts +31 -0
- package/signature/Signature.d.ts +21 -0
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +26 -23
- package/signature/interfaces/SignatureBlurEvent.d.ts +14 -0
- package/signature/interfaces/SignatureChangeEvent.d.ts +18 -0
- package/signature/interfaces/SignatureCloseEvent.d.ts +14 -0
- package/signature/interfaces/SignatureFocusEvent.d.ts +14 -0
- package/signature/interfaces/SignatureHandle.d.ts +49 -0
- package/signature/interfaces/SignatureOpenEvent.d.ts +14 -0
- package/signature/interfaces/SignatureProps.d.ts +324 -0
- package/signature/interfaces/index.d.ts +14 -0
- package/signature/utils/index.d.ts +11 -0
- package/slider/Slider.d.ts +288 -0
- package/slider/Slider.mjs +9 -9
- package/slider/SliderLabel.d.ts +51 -0
- package/switch/Switch.d.ts +397 -0
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +29 -22
- package/textarea/TextArea.d.ts +40 -0
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +41 -41
- package/textarea/interfaces/TextAreaBlurEvent.d.ts +14 -0
- package/textarea/interfaces/TextAreaChangeEvent.d.ts +18 -0
- package/textarea/interfaces/TextAreaFocusEvent.d.ts +14 -0
- package/textarea/interfaces/TextAreaProps.d.ts +199 -0
- package/textbox/Textbox.d.ts +99 -0
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +70 -66
- package/utils.d.ts +11 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { ColorPaletteProps } from './interfaces/ColorPaletteProps.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_TILE_SIZE = 24;
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_COLUMNS_COUNT = 10;
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_PRESET = "office";
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
export interface ColorPaletteState {
|
|
27
|
+
selectedColor?: string;
|
|
28
|
+
focusedColor?: string;
|
|
29
|
+
isFirstRender: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** @hidden */
|
|
32
|
+
export declare class ColorPaletteWithoutContext extends React.Component<ColorPaletteProps, ColorPaletteState> {
|
|
33
|
+
static displayName: string;
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
static propTypes: {
|
|
38
|
+
palette: PropTypes.Requireable<NonNullable<string | string[] | null | undefined>>;
|
|
39
|
+
columns: PropTypes.Requireable<number>;
|
|
40
|
+
tileSize: PropTypes.Requireable<any>;
|
|
41
|
+
defaultValue: PropTypes.Requireable<string>;
|
|
42
|
+
value: PropTypes.Requireable<string>;
|
|
43
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
44
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
45
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
id: PropTypes.Requireable<string>;
|
|
48
|
+
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
49
|
+
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
50
|
+
className: PropTypes.Requireable<string>;
|
|
51
|
+
size: PropTypes.Requireable<string | null>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* @hidden
|
|
55
|
+
*/
|
|
56
|
+
static defaultProps: {
|
|
57
|
+
palette: string;
|
|
58
|
+
tileSize: number;
|
|
59
|
+
size: undefined;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @hidden
|
|
63
|
+
*/
|
|
64
|
+
wrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
65
|
+
private paletteService;
|
|
66
|
+
private get guid();
|
|
67
|
+
constructor(props: ColorPaletteProps);
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
focus: () => void;
|
|
72
|
+
/**
|
|
73
|
+
* @hidden
|
|
74
|
+
*/
|
|
75
|
+
render(): "" | React.JSX.Element;
|
|
76
|
+
/**
|
|
77
|
+
* @hidden
|
|
78
|
+
*/
|
|
79
|
+
static getDerivedStateFromProps(props: ColorPaletteProps, state: ColorPaletteState): {
|
|
80
|
+
selectedColor: undefined;
|
|
81
|
+
isFirstRender?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
selectedColor: string;
|
|
84
|
+
isFirstRender?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
isFirstRender: boolean;
|
|
87
|
+
selectedColor?: undefined;
|
|
88
|
+
} | null;
|
|
89
|
+
private onKeyDown;
|
|
90
|
+
private onColorClick;
|
|
91
|
+
private onFocus;
|
|
92
|
+
private onBlur;
|
|
93
|
+
private handleCellNavigation;
|
|
94
|
+
private handleEnter;
|
|
95
|
+
private dispatchChangeEvent;
|
|
96
|
+
private get focusedColorCooridanates();
|
|
97
|
+
private get isUncontrolled();
|
|
98
|
+
private getPaletteInfo;
|
|
99
|
+
private renderRows;
|
|
100
|
+
private renderColumns;
|
|
101
|
+
private createCellId;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Represents the PropsContext of the `ColorPalette` component.
|
|
105
|
+
* Used for global configuration of all `ColorPalette` instances.
|
|
106
|
+
*
|
|
107
|
+
* For more information, refer to the [Inputs Props Context](https://www.telerik.com/kendo-react-ui/components/inputs/props-context) article.
|
|
108
|
+
*/
|
|
109
|
+
export declare const ColorPalettePropsContext: React.Context<(p: ColorPaletteProps) => ColorPaletteProps>;
|
|
110
|
+
/**
|
|
111
|
+
* Represent the `ref` of the ColorPalette component.
|
|
112
|
+
*/
|
|
113
|
+
export interface ColorPaletteHandle extends Pick<ColorPaletteWithoutContext, keyof ColorPaletteWithoutContext> {
|
|
114
|
+
}
|
|
115
|
+
/** @hidden */
|
|
116
|
+
export type ColorPalette = ColorPaletteHandle;
|
|
117
|
+
/**
|
|
118
|
+
* Represents the [KendoReact ColorPalette component](https://www.telerik.com/kendo-react-ui/components/inputs/colorpalette).
|
|
119
|
+
*
|
|
120
|
+
* Accepts properties of type [ColorPaletteProps](https://www.telerik.com/kendo-react-ui/components/inputs/api/colorpaletteprops).
|
|
121
|
+
* Obtaining the `ref` returns an object of type [ColorPaletteHandle](https://www.telerik.com/kendo-react-ui/components/inputs/api/colorpalettehandle).
|
|
122
|
+
*
|
|
123
|
+
* ```jsx
|
|
124
|
+
* const App = () => {
|
|
125
|
+
* return <ColorPalette palette='basic' />;
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const ColorPalette: React.ForwardRefExoticComponent<ColorPaletteProps & React.RefAttributes<any>>;
|
package/colors/ColorPalette.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),s=require("prop-types"),k=require("./utils/color-palette.service.js"),r=require("@progress/kendo-react-common"),T=require("./models/palette-presets.js"),F=require("./utils/misc.js"),N=require("./utils/color-parser.js");function D(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const l=D(R),g=24,u=10,
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),s=require("prop-types"),k=require("./utils/color-palette.service.js"),r=require("@progress/kendo-react-common"),T=require("./models/palette-presets.js"),F=require("./utils/misc.js"),N=require("./utils/color-parser.js");function D(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const l=D(R),g=24,u=10,v="office",n=class n extends l.Component{constructor(t){super(t),this.wrapperRef=l.createRef(),this.paletteService=null,this.focus=()=>{this.wrapperRef&&this.wrapperRef.current&&this.wrapperRef.current.focus()},this.onKeyDown=e=>{switch(e.key){case r.KEYS.down:this.handleCellNavigation(0,1);break;case r.KEYS.up:this.handleCellNavigation(0,-1);break;case r.KEYS.right:this.handleCellNavigation(1,0);break;case r.KEYS.left:this.handleCellNavigation(-1,0);break;case r.KEYS.enter:this.handleEnter(e);break;default:return}e.preventDefault()},this.onColorClick=(e,o)=>{this.isUncontrolled?this.setState({selectedColor:e,focusedColor:e}):this.setState({focusedColor:e}),this.dispatchChangeEvent(e,o)},this.onFocus=e=>{this.paletteService&&(this.setState({focusedColor:this.state.selectedColor||this.paletteService.colorRows[0][0]}),this.props.onFocus&&this.props.onFocus.call(void 0,e))},this.onBlur=()=>{this.setState({focusedColor:void 0})},this.state={selectedColor:this.props.value!==void 0?this.props.value:this.props.defaultValue?this.props.defaultValue:void 0,isFirstRender:!0}}get guid(){return this.props.id}render(){const t=this.getPaletteInfo(),e=this.paletteService=new k.ColorPaletteService;e.setColorMatrix(t.colors,t.columns);const o=e.getCellCoordsFor(this.state.selectedColor),i=e.getCellCoordsFor(this.state.focusedColor);return t.colors.length?l.createElement("div",{id:this.props.id,role:"grid",className:r.classNames("k-colorpalette",{[`k-colorpalette-${r.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size,"k-disabled":this.props.disabled},this.props.className),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,"aria-disabled":this.props.ariaDisabled||(this.props.disabled?"true":void 0),"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:r.getTabIndex(this.props.tabIndex,this.props.disabled),ref:this.wrapperRef},l.createElement("table",{className:"k-colorpalette-table",role:"presentation"},l.createElement("tbody",{role:"rowgroup"},this.renderRows(e.colorRows,o,i)))):""}static getDerivedStateFromProps(t,e){if(!e.isFirstRender&&t.value!==void 0){if(t.value===""&&e.selectedColor!==void 0)return{selectedColor:void 0};if(t.value!==""&&t.value!==e.selectedColor)return{selectedColor:t.value}}else if(e.isFirstRender)return{isFirstRender:!1};return null}handleCellNavigation(t,e){if(this.paletteService)if(this.focusedColorCooridanates){const o=this.paletteService.getNextCell(this.focusedColorCooridanates,t,e);this.setState({focusedColor:this.paletteService.getColorAt(o)})}else this.setState({focusedColor:this.paletteService.colorRows[0][0]})}handleEnter(t){this.isUncontrolled&&this.setState({selectedColor:this.state.focusedColor}),this.dispatchChangeEvent(this.state.focusedColor,t)}dispatchChangeEvent(t,e){r.dispatchEvent(this.props.onChange,e,this,{value:t,rgbaValue:N.parseColor(t,"rgba")})}get focusedColorCooridanates(){return this.state.focusedColor&&this.paletteService?this.paletteService.getCellCoordsFor(this.state.focusedColor):void 0}get isUncontrolled(){return this.props.value===void 0}getPaletteInfo(){if(typeof this.props.palette=="string"){const t=T.PALETTEPRESETS[this.props.palette];return F.isPresent(t)?{colors:t.colors,columns:this.props.columns||t.columns||u}:{colors:[],columns:0}}return{colors:this.props.palette||[],columns:this.props.columns||u}}renderRows(t,e,o){return t.map((i,c)=>l.createElement("tr",{role:"row",key:c},this.renderColumns(i,c,e,o)))}renderColumns(t,e,o,i){const c=o!==void 0&&o.row===e,m=o&&o.col,E=i!==void 0&&i.row===e,w=i&&i.col;return t.map((h,d)=>{const f=c&&m===d,y=r.classNames("k-colorpalette-tile",{"k-selected":f,"k-focus":E&&w===d});let C={width:this.props.tileSize,height:this.props.tileSize};return typeof this.props.tileSize=="object"&&(C={width:this.props.tileSize.width,height:this.props.tileSize.height}),l.createElement("td",{role:"gridcell",className:y,"aria-label":h,"aria-selected":f?!0:this.props.disabled?void 0:!1,style:{backgroundColor:h,...C},onClick:P=>this.onColorClick(h,P),id:this.createCellId({row:e,col:d}),key:d})})}createCellId(t){return`${this.guid}_${t.row}_${t.col}`}};n.displayName="ColorPalette",n.propTypes={palette:s.oneOfType([s.arrayOf(s.string.isRequired),s.string]),columns:s.number,tileSize:s.any,defaultValue:s.string,value:s.string,disabled:s.bool,tabIndex:s.number,onChange:s.func,onFocus:s.func,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,className:s.string,size:s.oneOf(["small","medium","large",null])},n.defaultProps={palette:v,tileSize:g,size:void 0};let p=n;const S=r.createPropsContext(),b=r.withIdHOC(r.withPropsContext(S,p));b.displayName="KendoReactColorPalette";exports.ColorPalette=b;exports.ColorPalettePropsContext=S;exports.ColorPaletteWithoutContext=p;exports.DEFAULT_COLUMNS_COUNT=u;exports.DEFAULT_PRESET=v;exports.DEFAULT_TILE_SIZE=g;
|
package/colors/ColorPalette.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as i from "react";
|
|
9
9
|
import s from "prop-types";
|
|
10
10
|
import { ColorPaletteService as w } from "./utils/color-palette.service.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { withIdHOC as y, createPropsContext as E, withPropsContext as k, KEYS as l, getTabIndex as R, classNames as f, kendoThemeMaps as F, dispatchEvent as N } from "@progress/kendo-react-common";
|
|
12
12
|
import { PALETTEPRESETS as z } from "./models/palette-presets.mjs";
|
|
13
13
|
import { isPresent as T } from "./utils/misc.mjs";
|
|
14
14
|
import { parseColor as P } from "./utils/color-parser.mjs";
|
|
@@ -66,7 +66,7 @@ const I = 24, C = 10, D = "office", a = class a extends i.Component {
|
|
|
66
66
|
className: f(
|
|
67
67
|
"k-colorpalette",
|
|
68
68
|
{
|
|
69
|
-
[`k-colorpalette-${
|
|
69
|
+
[`k-colorpalette-${F.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
|
|
70
70
|
"k-disabled": this.props.disabled
|
|
71
71
|
},
|
|
72
72
|
this.props.className
|
|
@@ -77,7 +77,7 @@ const I = 24, C = 10, D = "office", a = class a extends i.Component {
|
|
|
77
77
|
"aria-disabled": this.props.ariaDisabled || (this.props.disabled ? "true" : void 0),
|
|
78
78
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
79
79
|
"aria-describedby": this.props.ariaDescribedBy,
|
|
80
|
-
tabIndex:
|
|
80
|
+
tabIndex: R(this.props.tabIndex, this.props.disabled),
|
|
81
81
|
ref: this.wrapperRef
|
|
82
82
|
},
|
|
83
83
|
/* @__PURE__ */ i.createElement("table", { className: "k-colorpalette-table", role: "presentation" }, /* @__PURE__ */ i.createElement("tbody", { role: "rowgroup" }, this.renderRows(e.colorRows, o, r)))
|
|
@@ -112,7 +112,7 @@ const I = 24, C = 10, D = "office", a = class a extends i.Component {
|
|
|
112
112
|
this.isUncontrolled && this.setState({ selectedColor: this.state.focusedColor }), this.dispatchChangeEvent(this.state.focusedColor, t);
|
|
113
113
|
}
|
|
114
114
|
dispatchChangeEvent(t, e) {
|
|
115
|
-
|
|
115
|
+
N(this.props.onChange, e, this, { value: t, rgbaValue: P(t, "rgba") });
|
|
116
116
|
}
|
|
117
117
|
get focusedColorCooridanates() {
|
|
118
118
|
return this.state.focusedColor && this.paletteService ? this.paletteService.getCellCoordsFor(this.state.focusedColor) : void 0;
|
|
@@ -184,11 +184,11 @@ a.displayName = "ColorPalette", a.propTypes = {
|
|
|
184
184
|
}, a.defaultProps = {
|
|
185
185
|
palette: D,
|
|
186
186
|
tileSize: I,
|
|
187
|
-
size:
|
|
187
|
+
size: void 0
|
|
188
188
|
};
|
|
189
189
|
let d = a;
|
|
190
|
-
const L =
|
|
191
|
-
|
|
190
|
+
const L = E(), U = y(
|
|
191
|
+
k(
|
|
192
192
|
L,
|
|
193
193
|
d
|
|
194
194
|
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { ColorPickerProps } from './interfaces/ColorPickerProps.js';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export interface ColorPickerHandle {
|
|
14
|
+
element: HTMLSpanElement | null;
|
|
15
|
+
value?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents the PropsContext of the `ColorPicker` component.
|
|
19
|
+
* Used for global configuration of all `ColorPicker` instances.
|
|
20
|
+
*
|
|
21
|
+
* For more information, refer to the [Inputs Props Context](https://www.telerik.com/kendo-react-ui/components/inputs/props-context) article.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ColorPickerPropsContext: React.Context<(p: ColorPickerProps) => ColorPickerProps>;
|
|
24
|
+
/**
|
|
25
|
+
* Represents the [KendoReact ColorPicker component](https://www.telerik.com/kendo-react-ui/components/inputs/colorpicker).
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```jsx
|
|
29
|
+
* const App = () => {
|
|
30
|
+
* return <ColorPicker />;
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<ColorPickerHandle | null>>;
|
package/colors/ColorPicker.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xe=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xe=require("react"),r=require("prop-types"),n=require("@progress/kendo-react-common"),ke=require("../package-metadata.js"),qe=require("./Picker.js"),Ve=require("./ColorGradient.js"),Q=require("./ColorPalette.js"),N=require("./FlatColorPicker.js"),Me=require("@progress/kendo-react-buttons"),He=require("@progress/kendo-svg-icons"),d=require("../messages/index.js"),We=require("@progress/kendo-react-intl"),Ue=require("../common/AdaptiveMode.js"),je=require("@progress/kendo-react-layout");function Ge(g){const T=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const P in g)if(P!=="default"){const F=Object.getOwnPropertyDescriptor(g,P);Object.defineProperty(T,P,F.get?F:{enumerable:!0,get:()=>g[P]})}}return T.default=g,Object.freeze(T)}const t=Ge(xe),Ke={opacity:!0},$e={palette:Q.DEFAULT_PRESET,tileSize:Q.DEFAULT_TILE_SIZE},J=g=>g!==void 0,me=n.createPropsContext(),X=t.forwardRef((g,T)=>{var ue,de;const P=!n.validatePackage(ke.packageMetadata,{component:"ColorPicker"}),F=n.getLicenseMessage(ke.packageMetadata),l=n.usePropsContext(me,g),_=We.useLocalization(),Y=n.useAdaptiveModeContext(),{size:p=w.size,rounded:C=w.rounded,fillMode:x=w.fillMode,gradientSettings:y=w.gradientSettings,paletteSettings:h=w.paletteSettings,flatColorPickerSettings:R,view:f=l.views?void 0:w.view,views:s=f?void 0:w.views,activeView:ee,popupSettings:b,valid:Ce,disabled:q,tabIndex:be,icon:V,svgIcon:M,iconClassName:B,onChange:H,onFocus:W,onBlur:U,onActiveColorClick:j,className:Ee,adaptive:we,adaptiveTitle:te=_.toLanguageString(d.colorPickerAdaptiveTitle,d.messages[d.colorPickerAdaptiveTitle]),adaptiveSubtitle:ne}=l,u=t.useRef(null),A=t.useRef(null),O=t.useRef(null),m=t.useRef(null),S=t.useRef(void 0),Pe=t.useRef(null),[ye,ae]=t.useState(!1),[Se,Te]=t.useState(l.defaultValue||void 0),[_e,he]=t.useState(!1),[D,Re]=t.useState(),G=J(l.value),E=J(l.open),i=G?l.value:Se,v=E?l.open:_e,oe=t.useRef(i),re=t.useCallback(()=>{u.current&&u.current.focus()},[]);t.useImperativeHandle(T,()=>({element:u.current,actionElement:Pe.current,value:i,focus:re}),[i,re]);const K=!!(D&&Y&&D<=Y.medium&&we);t.useEffect(()=>{const e=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ze.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const o=t.useCallback((e,c)=>{E||(!e&&!c&&u&&u.current&&u.current.focus(),he(e))},[E]),le=t.useMemo(()=>new n.Navigation({root:u,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,c,a)=>{o(!1)},Enter:(e,c,a)=>{!E&&e===u.current&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowDown:(e,c,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowUp:(e,c,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!1))},Tab:(e,c,a)=>{var I,pe,ge;if(n.getActiveElement(document)!==u.current){const fe=(I=O.current)==null?void 0:I.wrapperRef.current,z=(pe=A.current)==null?void 0:pe.wrapperRef.current,ve=(ge=m.current)==null?void 0:ge.element;f==="palette"&&fe?n.keepFocusInContainer(a,fe):f==="gradient"&&z?n.keepFocusInContainer(a,z):f==="combo"&&z?n.keepFocusInContainer(a,z.parentElement):s&&ve&&n.keepFocusInContainer(a,ve)}}}}}),[o,E]),Ae=t.useCallback(le.triggerKeyboardEvent.bind(le),[]),Ie=t.useCallback(()=>{E||(A.current&&A.current.wrapperRef.current?n.focusFirstFocusableChild(A.current.wrapperRef.current):O.current?O.current.focus():m.current&&m.current.element&&n.focusFirstFocusableChild(m.current.element))},[E]),L=e=>oe.current=e,ie=t.useCallback(e=>{const c={value:oe.current,nativeEvent:e.nativeEvent,syntheticEvent:e};k(c),o(!v,!0)},[v]),$=t.useCallback(()=>{o(!1,!0)},[o]),Fe=t.useCallback(e=>{j&&j.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:i,target:{element:u.current,value:i}})},[j,i]),Be=t.useCallback(e=>{S.current?(clearTimeout(S.current),S.current=void 0):(ae(!0),K&&!v&&o(!0)),W&&W.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[K,W,v,o]),Oe=t.useCallback(()=>{o(!1,!0),ae(!1),S.current=void 0},[]),De=t.useCallback(e=>{clearTimeout(S.current),S.current=window.setTimeout(Oe),U&&U.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[U]),k=t.useCallback((e,c)=>{var I;const a=c?e.rgbaValue||"":(I=e.value)!=null?I:"";G||Te(a),H&&H.call(void 0,{value:a,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:u.current,value:a}}),o(!1)},[G,H]),ce=t.useCallback(e=>k(e,!0),[J,k]),Z=t.useCallback(e=>t.createElement(t.Fragment,null,(f==="combo"||f==="gradient")&&t.createElement(Ve.ColorGradient,{...y,_adaptive:e,ref:A,isInsidePopup:!0,size:e?"large":p,value:i,onChange:k}),(f==="combo"||f==="palette")&&t.createElement(Q.ColorPalette,{...h,ref:O,size:e?"large":p,value:i,onChange:ce}),s&&s[0]==="gradient"&&s[1]==="palette"&&t.createElement(N.FlatColorPicker,{...R,_paletteSettings:h,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["gradient","palette"],activeView:ee,setOpen:o,showButtons:!e,value:i,onChange:k,setAdaptiveModeValue:L}),s&&s[0]==="palette"&&s[1]==="gradient"&&t.createElement(N.FlatColorPicker,{...R,_paletteSettings:h,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["palette","gradient"],setOpen:o,showButtons:!e,value:i,onChange:k,setAdaptiveModeValue:L}),s&&s.includes("gradient")&&!s.includes("palette")&&t.createElement(N.FlatColorPicker,{...R,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["gradient"],showButtons:!e,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:L}),s&&s.includes("palette")&&!s.includes("gradient")&&t.createElement(N.FlatColorPicker,{...R,_paletteSettings:h,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["palette"],showButtons:!e,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:L}),P&&t.createElement(n.WatermarkOverlay,{message:F})),[ee,x,R,y,k,ce,h,o,p,i,f,s]),Le=t.useCallback(()=>{var c;const e={animation:!!((c=b==null?void 0:b.animate)==null||c),title:te,subTitle:ne,expand:v,onClose:$,windowWidth:D,footer:{cancelText:_.toLanguageString(d.flatColorPickerCancelBtn,d.messages[d.flatColorPickerCancelBtn]),onCancel:$,applyText:_.toLanguageString(d.flatColorPickerApplyBtn,d.messages[d.flatColorPickerApplyBtn]),onApply:ie}};return t.createElement(Ue.AdaptiveMode,{...e},t.createElement(je.ActionSheetContent,null,Z(!0)))},[b==null?void 0:b.animate,te,ne,v,$,D,_,ie,Z]),ze=t.useCallback(e=>{for(const c of e)Re(c.target.clientWidth)},[]),se=n.useDir(u,l.dir),Ne=Ce!==!1;return t.createElement("span",{id:l.id,role:"combobox","aria-label":l.ariaLabel,"aria-labelledby":l.ariaLabelledBy,"aria-describedby":l.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":v,"aria-controls":`k-colorpicker-popup-${(ue=l.id)!=null?ue:0}`,"aria-disabled":q?"true":void 0,className:n.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${n.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${x}`]:x,[`k-rounded-${n.kendoThemeMaps.roundedMap[C]||C}`]:C,"k-invalid":!Ne,"k-disabled":q,"k-focus":ye,className:Ee}),ref:u,tabIndex:n.getTabIndex(be,q),title:l.title,onKeyDown:Ae,onFocus:Be,onBlur:De,dir:se},t.createElement(qe.Picker,{dir:se,open:v,onOpen:Ie,popupAnchor:u.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(de=l.id)!=null?de:0}`,...b},input:t.createElement("span",{onClick:Fe,className:"k-input-inner"},t.createElement("span",{className:n.classNames("k-value-icon","k-color-preview",{"k-no-color":!i,"k-icon-color-preview":V||M||B})},B&&t.createElement("span",{className:n.classNames("k-color-preview-icon",B)}),!B&&(V||M)&&t.createElement(n.IconWrap,{name:V,icon:M}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:i}}))),button:t.createElement(Me.Button,{tabIndex:-1,type:"button",onClick:()=>o(!v),className:"k-input-button",icon:"caret-alt-down",svgIcon:He.caretAltDownIcon,"aria-label":_.toLanguageString(d.colorPickerDropdownButtonAriaLabel,d.messages[d.colorPickerDropdownButtonAriaLabel])}),content:Z(!1),_mobileMode:K,_actionSheet:Le()}))});X.propTypes={value:r.string,defaultValue:r.string,disabled:r.bool,view:r.oneOf(["gradient","palette","combo"]),views:r.arrayOf(r.oneOf(["gradient","palette"])),dir:r.string,id:r.string,icon:r.string,svgIcon:n.svgIconPropType,ariaLabelledBy:r.string,ariaDescribedBy:r.string,size:r.oneOf(["small","medium","large"]),rounded:r.oneOf(["small","medium","large","full"]),fillMode:r.oneOf(["solid","flat","outline"]),className:r.string,adaptive:r.bool,adaptiveTitle:r.string,adaptiveSubtitle:r.string};const w={size:void 0,rounded:void 0,fillMode:void 0,view:"palette",views:["gradient","palette"],gradientSettings:Ke,paletteSettings:$e};X.displayName="KendoColorPicker";exports.ColorPicker=X;exports.ColorPickerPropsContext=me;
|