UNPKG

@wordpress/components

Version:
62 lines (61 loc) • 1.83 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let _wordpress_i18n = require("@wordpress/i18n"); let __input_with_slider_tsx = require("./input-with-slider.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/components/src/color-picker/hsl-input.tsx const HslInput = ({ hsla, onChange, enableAlpha }) => { const updateHSLAValue = (partialNewValue) => { onChange({ ...hsla, ...partialNewValue }); }; return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__input_with_slider_tsx.InputWithSlider, { min: 0, max: 359, label: (0, _wordpress_i18n.__)("Hue (HSL H value)"), abbreviation: "H", value: hsla.h, onChange: (nextH) => { updateHSLAValue({ h: nextH }); } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__input_with_slider_tsx.InputWithSlider, { min: 0, max: 100, label: (0, _wordpress_i18n.__)("Saturation"), abbreviation: "S", value: hsla.s, onChange: (nextS) => { updateHSLAValue({ s: nextS }); } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__input_with_slider_tsx.InputWithSlider, { min: 0, max: 100, label: (0, _wordpress_i18n.__)("Lightness"), abbreviation: "L", value: hsla.l, onChange: (nextL) => { updateHSLAValue({ l: nextL }); } }), enableAlpha && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__input_with_slider_tsx.InputWithSlider, { min: 0, max: 100, label: (0, _wordpress_i18n.__)("Alpha (HSL A value)"), abbreviation: "A", value: Math.trunc(100 * hsla.a), onChange: (nextA) => { updateHSLAValue({ a: nextA / 100 }); } }) ] }); }; exports.HslInput = HslInput; //# sourceMappingURL=hsl-input.cjs.map