@progress/kendo-react-inputs
Version:
React Inputs offer a customizable interface for users to enter and pick different information. KendoReact Input package
42 lines (41 loc) • 1.46 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as i from "react";
import { parseColor as o } from "./utils/color-parser.mjs";
import { isPresent as a } from "./utils/misc.mjs";
import { TextBox as h } from "../textbox/Textbox.mjs";
class u extends i.Component {
constructor(e) {
super(e), this.onChange = (t) => {
const s = t.target.value, r = o(s, "rgba");
this.setState({ hex: s }), a(r) && this.props.onHexChange(s, r, t);
}, this.onBlur = () => {
a(o(this.state.hex, "rgba")) || this.setState({ hex: this.state.originalHex });
}, this.state = { hex: this.props.hex, originalHex: this.props.hex };
}
render() {
return /* @__PURE__ */ i.createElement(
h,
{
value: this.state.hex,
onChange: this.onChange,
onBlur: this.onBlur,
disabled: this.props.disabled,
className: "k-hex-value",
size: this.props.size,
fillMode: this.props.fillMode
}
);
}
static getDerivedStateFromProps(e, t) {
return e.hex !== t.originalHex ? { hex: e.hex, originalHex: e.hex } : null;
}
}
export {
u as default
};