require("./ColorSlider.css");
var $5b07976eb9e358fe$exports = require("./ColorHandle.cjs");
var $a0b996a550bb0891$exports = require("./Field.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $hkRua$reactjsxruntime = require("react/jsx-runtime");
var $hkRua$reactariacomponents = require("react-aria-components");
var $hkRua$react = require("react");
var $hkRua$reactspectrumutils = require("@react-spectrum/utils");


function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "ColorSliderContext", () => $fdd6f3d03620d438$export$717b2c0a523a0b53);
$parcel$export(module.exports, "ColorSlider", () => $fdd6f3d03620d438$export$44fd664bcca5b6fb);
/*
 * Copyright 2024 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 






const $fdd6f3d03620d438$export$717b2c0a523a0b53 = /*#__PURE__*/ (0, $hkRua$react.createContext)(null);
const $fdd6f3d03620d438$export$44fd664bcca5b6fb = /*#__PURE__*/ (0, $hkRua$react.forwardRef)(function ColorSlider(props, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $fdd6f3d03620d438$export$717b2c0a523a0b53);
    let { UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, styles: styles } = props;
    let containerRef = (0, $hkRua$reactspectrumutils.useDOMRef)(ref);
    let trackRef = (0, $hkRua$react.useRef)(null);
    let { direction: direction, locale: locale } = (0, $hkRua$reactariacomponents.useLocale)();
    return /*#__PURE__*/ (0, $hkRua$reactjsxruntime.jsx)((0, $hkRua$reactariacomponents.ColorSlider), {
        ...props,
        ref: containerRef,
        style: UNSAFE_style,
        // The visual label is hidden when vertical, so make it an aria-label instead.
        "aria-label": props['aria-label'] || (props.orientation === 'vertical' ? props.label : undefined),
        className: (renderProps)=>UNSAFE_className + function anonymous(props, overrides) {
                let rules = " ";
                let width = false;
                let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
                for (let p of matches){
                    if (p[1] === "Z") width = true;
                    rules += p[0];
                }
                if (props.orientation === "horizontal") {
                    if (!width) rules += ' Zr1';
                }
                if (props.orientation === "vertical") rules += ' Fs1';
                if (props.orientation === "vertical") rules += ' sb1';
                else if (props.orientation === "horizontal") rules += ' se1';
                rules += ' Dxumf9b1';
                rules += ' CmAQJSd1';
                rules += ' Ub1';
                return rules;
            }(renderProps, styles),
        children: ({ isDisabled: isDisabled, orientation: orientation, state: state })=>/*#__PURE__*/ (0, $hkRua$reactjsxruntime.jsxs)((0, $hkRua$reactjsxruntime.Fragment), {
                children: [
                    orientation === 'horizontal' && (props.label || props.label === undefined && !props['aria-label'] && !props['aria-labelledby']) && // If no external label, aria-label or aria-labelledby is provided,
                    // default to displaying the localized channel value.
                    // Specifically check if label is undefined. If label is `null` then display no visible label.
                    // A default aria-label is provided by useColorSlider in that case.
                    /*#__PURE__*/ (0, $hkRua$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldLabel), {
                        isDisabled: isDisabled,
                        contextualHelp: props.contextualHelp,
                        children: props.label || state.value.getChannelName(props.channel, locale)
                    }),
                    orientation === 'horizontal' && /*#__PURE__*/ (0, $hkRua$reactjsxruntime.jsx)((0, $hkRua$reactariacomponents.SliderOutput), {
                        className: function anonymous(props) {
                            let rules = " ";
                            rules += ' zChk6v1';
                            rules += ' yChk6v1';
                            rules += ' BChk6v1';
                            rules += ' AChk6v1';
                            if (props.size === "XL") {
                                rules += ' uk1';
                                rules += ' ucJ9TBTb1';
                                rules += ' ud3Euai1';
                                rules += ' uea1';
                                rules += ' ugb1';
                                rules += ' uhd1';
                                rules += ' uje1';
                                rules += ' u2NhKxcl1';
                                rules += ' uic1';
                            } else if (props.size === "L") {
                                rules += ' uk1';
                                rules += ' ucJ9TBTb1';
                                rules += ' ud3Euai1';
                                rules += ' uea1';
                                rules += ' ugb1';
                                rules += ' uhd1';
                                rules += ' uje1';
                                rules += ' u2NhKxcl1';
                                rules += ' uic1';
                            } else if (props.size === "S") {
                                rules += ' uk1';
                                rules += ' ucJ9TBTb1';
                                rules += ' ud3Euai1';
                                rules += ' uea1';
                                rules += ' ugb1';
                                rules += ' uhd1';
                                rules += ' uje1';
                                rules += ' u2NhKxcl1';
                                rules += ' uic1';
                            } else if (props.size === "XS") {
                                rules += ' uk1';
                                rules += ' ucJ9TBTb1';
                                rules += ' ud3Euai1';
                                rules += ' uea1';
                                rules += ' ugb1';
                                rules += ' uhd1';
                                rules += ' uje1';
                                rules += ' u2NhKxcl1';
                                rules += ' uic1';
                            } else {
                                rules += ' uk1';
                                rules += ' ucJ9TBTb1';
                                rules += ' ud3Euai1';
                                rules += ' uea1';
                                rules += ' ugb1';
                                rules += ' uhd1';
                                rules += ' uje1';
                                rules += ' u2NhKxcl1';
                                rules += ' uic1';
                            }
                            if (props.size === "XL") {
                                rules += ' -_6BNtrc-e1';
                                rules += ' vx1';
                            } else if (props.size === "L") {
                                rules += ' -_6BNtrc-d1';
                                rules += ' vx1';
                            } else if (props.size === "S") {
                                rules += ' -_6BNtrc-b1';
                                rules += ' vx1';
                            } else if (props.size === "XS") {
                                rules += ' -_6BNtrc-a1';
                                rules += ' vx1';
                            } else {
                                rules += ' -_6BNtrc-c1';
                                rules += ' vx1';
                            }
                            if (props.size === "XL") {
                                rules += ' xb1';
                                rules += ' _xa1';
                            } else if (props.size === "L") {
                                rules += ' xb1';
                                rules += ' _xa1';
                            } else if (props.size === "S") {
                                rules += ' xb1';
                                rules += ' _xa1';
                            } else if (props.size === "XS") {
                                rules += ' xb1';
                                rules += ' _xa1';
                            } else {
                                rules += ' xb1';
                                rules += ' _xa1';
                            }
                            if (props.size === "XL") {
                                rules += ' _Fd1';
                                rules += ' _FnuYUweb1';
                            } else if (props.size === "L") {
                                rules += ' _Fd1';
                                rules += ' _FnuYUweb1';
                            } else if (props.size === "S") {
                                rules += ' _Fd1';
                                rules += ' _FnuYUweb1';
                            } else if (props.size === "XS") {
                                rules += ' _Fd1';
                                rules += ' _FnuYUweb1';
                            } else {
                                rules += ' _Fd1';
                                rules += ' _FnuYUweb1';
                            }
                            if (props.isDisabled) rules += ' pp1';
                            else rules += ' pv1';
                            rules += ' ri1';
                            return rules;
                        }
                    }),
                    /*#__PURE__*/ (0, $hkRua$reactjsxruntime.jsx)((0, $hkRua$reactariacomponents.SliderTrack), {
                        ref: trackRef,
                        style: ({ defaultStyle: defaultStyle, isDisabled: isDisabled })=>({
                                background: isDisabled ? undefined : `${defaultStyle.background}, repeating-conic-gradient(#E1E1E1 0% 25%, white 0% 50%) 50% / 16px 16px`
                            }),
                        className: function anonymous(props) {
                            let rules = " ";
                            rules += ' zCPUPs1';
                            rules += ' yCPUPs1';
                            rules += ' BCPUPs1';
                            rules += ' ACPUPs1';
                            if (props.orientation === "vertical") rules += ' Zo1';
                            else if (props.orientation === "horizontal") rules += ' Za1';
                            if (props.orientation === "vertical") rules += ' Fb1';
                            else if (props.orientation === "horizontal") rules += ' Fp1';
                            rules += ' ob1';
                            rules += ' nb1';
                            rules += ' kb1';
                            rules += ' jb1';
                            rules += ' Oi1';
                            rules += ' Ola1';
                            rules += ' _Mb1';
                            rules += ' _Ka1';
                            if (props.isDisabled) rules += ' _Le1';
                            else rules += ' _Lf1';
                            if (props.isDisabled) rules += ' gH1';
                            return rules;
                        },
                        children: /*#__PURE__*/ (0, $hkRua$reactjsxruntime.jsx)((0, $5b07976eb9e358fe$exports.ColorHandle), {
                            containerRef: trackRef,
                            getPosition: ()=>{
                                let thumbLeft = direction === 'ltr' ? state.getThumbPercent(0) : 1 - state.getThumbPercent(0);
                                let x = state.orientation === 'horizontal' ? thumbLeft : 0.5;
                                let y = state.orientation === 'horizontal' ? 0.5 : 1 - state.getThumbPercent(0);
                                return {
                                    x: x,
                                    y: y
                                };
                            }
                        })
                    })
                ]
            })
    });
});


//# sourceMappingURL=ColorSlider.cjs.map
