@wordpress/components
Version:
UI components for WordPress.
57 lines (56 loc) • 1.36 kB
JavaScript
import { __ } from "@wordpress/i18n";
import { InputWithSlider } from "./input-with-slider.mjs";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
// packages/components/src/color-picker/hsl-input.tsx
const HslInput = ({ hsla, onChange, enableAlpha }) => {
const updateHSLAValue = (partialNewValue) => {
onChange({
...hsla,
...partialNewValue
});
};
return /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx(InputWithSlider, {
min: 0,
max: 359,
label: __("Hue (HSL H value)"),
abbreviation: "H",
value: hsla.h,
onChange: (nextH) => {
updateHSLAValue({ h: nextH });
}
}),
/* @__PURE__ */ jsx(InputWithSlider, {
min: 0,
max: 100,
label: __("Saturation"),
abbreviation: "S",
value: hsla.s,
onChange: (nextS) => {
updateHSLAValue({ s: nextS });
}
}),
/* @__PURE__ */ jsx(InputWithSlider, {
min: 0,
max: 100,
label: __("Lightness"),
abbreviation: "L",
value: hsla.l,
onChange: (nextL) => {
updateHSLAValue({ l: nextL });
}
}),
enableAlpha && /* @__PURE__ */ jsx(InputWithSlider, {
min: 0,
max: 100,
label: __("Alpha (HSL A value)"),
abbreviation: "A",
value: Math.trunc(100 * hsla.a),
onChange: (nextA) => {
updateHSLAValue({ a: nextA / 100 });
}
})
] });
};
export { HslInput };
//# sourceMappingURL=hsl-input.mjs.map