import {fontRelative as $9dc1adef87d51366$export$ba024f4caf693d15} from "./spectrum-theme.mjs";

/*
 * 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.
 */ 
function $b7cb2c43fa2e01f7$export$dc7aad089b8f5c30(minHeight = 'self(minHeight)') {
    return `[calc((${minHeight} - self(borderTopWidth, 0px) - self(borderBottomWidth, 0px) - 1lh) / 2)]`;
}
function $b7cb2c43fa2e01f7$var$fontRelative(base, baseFontSize = 14) {
    return `[${(0, $9dc1adef87d51366$export$ba024f4caf693d15)(base, baseFontSize)}]`;
}
const $b7cb2c43fa2e01f7$export$e0f35d825088c098 = ()=>({
        display: 'grid',
        gridColumnStart: {
            isInForm: 1
        },
        gridColumnEnd: {
            isInForm: {
                labelPosition: {
                    side: 'span 2'
                }
            }
        },
        gridTemplateColumns: {
            default: {
                labelPosition: {
                    top: [
                        '1fr'
                    ],
                    side: [
                        'auto',
                        '1fr'
                    ]
                }
            },
            isInForm: 'subgrid'
        },
        gridTemplateRows: {
            labelPosition: {
                top: [
                    'auto',
                    '1fr',
                    'auto'
                ],
                side: [
                    'auto',
                    '1fr'
                ]
            }
        },
        gridTemplateAreas: {
            labelPosition: {
                top: [
                    'label',
                    'input',
                    'helptext'
                ],
                side: [
                    'label input',
                    'label helptext'
                ]
            }
        },
        fontSize: $b7cb2c43fa2e01f7$export$78327973879c938a(),
        alignItems: 'baseline',
        lineHeight: 'ui',
        '--field-height': {
            type: 'height',
            value: $b7cb2c43fa2e01f7$export$28c38c60b8df41e1()
        },
        // Spectrum defines the field label/help text with a (minimum) height, with text centered inside.
        // Calculate what the gap should be based on the height and line height.
        // Use a variable here rather than rowGap since it is applied to the children as padding.
        // This allows the gap to collapse when the label/help text is not present.
        // Eventually this may be possible to do in pure CSS: https://github.com/w3c/csswg-drafts/issues/5813
        '--field-gap': {
            type: 'rowGap',
            value: $b7cb2c43fa2e01f7$export$dc7aad089b8f5c30('var(--field-height)')
        },
        columnGap: 12,
        disableTapHighlight: true
    });
const $b7cb2c43fa2e01f7$export$48db87e3f4768880 = ()=>({
        font: $b7cb2c43fa2e01f7$export$78327973879c938a(),
        cursor: 'default',
        color: {
            default: 'neutral-subdued',
            isDisabled: 'disabled',
            isStaticColor: 'transparent-overlay-1000',
            forcedColors: 'ButtonText'
        }
    });
const $b7cb2c43fa2e01f7$export$62d8db6a307a015a = ()=>({
        gridArea: 'input',
        minWidth: $b7cb2c43fa2e01f7$export$28c38c60b8df41e1(),
        contain: {
            // Only apply size containment if contain-intrinsic-width is supported.
            // In older browsers, this will fall back to the default browser intrinsic width.
            '@supports (contain-intrinsic-width: 1px)': 'inline-size',
            isQuiet: 'none'
        },
        '--defaultWidth': {
            type: 'width',
            value: {
                default: 208,
                size: {
                    S: 192,
                    L: 224,
                    XL: 240
                }
            }
        },
        // contain-intrinsic-width only includes the width of children, not the padding or borders.
        containIntrinsicWidth: 'calc(var(--defaultWidth) - self(paddingStart, 0px) - self(paddingEnd, 0px) - self(borderStartWidth, 0px) - self(borderEndWidth, 0px))'
    });
const $b7cb2c43fa2e01f7$export$f2d00fe8ce80fd84 = ()=>({
        '--s2-color-scheme': {
            type: 'colorScheme',
            value: {
                colorScheme: {
                    'light dark': 'light dark',
                    light: 'light',
                    dark: 'dark'
                }
            }
        },
        colorScheme: '--s2-color-scheme'
    });
function $b7cb2c43fa2e01f7$export$1750a8f222a9157d() {
    return {
        '--s2-container-bg': {
            type: 'backgroundColor',
            value: {
                staticColor: {
                    black: 'white',
                    white: 'black'
                }
            }
        }
    };
}
const $b7cb2c43fa2e01f7$export$78327973879c938a = ()=>({
        default: 'ui',
        size: {
            XS: 'ui-xs',
            S: 'ui-sm',
            L: 'ui-lg',
            XL: 'ui-xl'
        }
    });
const $b7cb2c43fa2e01f7$export$28c38c60b8df41e1 = (size = 'md')=>size === 'sm' ? $b7cb2c43fa2e01f7$var$controlSizeS : $b7cb2c43fa2e01f7$var$controlSizeM;
const $b7cb2c43fa2e01f7$var$controlSizeM = {
    default: 32,
    size: {
        XS: 20,
        S: 24,
        L: 40,
        XL: 48
    }
};
const $b7cb2c43fa2e01f7$var$controlSizeS = {
    default: 16,
    size: {
        S: 14,
        L: 18,
        XL: 20
    }
};
const $b7cb2c43fa2e01f7$export$6565fa6b916ade8 = (size = 'default')=>({
        '--size': {
            type: 'order',
            value: {
                default: 1,
                size: {
                    XS: Math.pow(1.125, -2),
                    S: Math.pow(1.125, -1),
                    L: Math.pow(1.125, 1),
                    XL: Math.pow(1.125, 2)
                }
            }
        },
        '--radius': {
            type: 'borderTopStartRadius',
            value: size
        },
        borderRadius: 'round(var(--radius) * var(--size), 1px)'
    });
const $b7cb2c43fa2e01f7$var$iconOnly = ':has([slot=icon]):not(:has([data-rsp-slot=text]))';
function $b7cb2c43fa2e01f7$export$b5cde1de278b4330(options) {
    let paddingX = options.shape === 'pill' ? 'pill' : 'edge-to-text';
    let result = {
        font: $b7cb2c43fa2e01f7$export$78327973879c938a(),
        display: 'flex',
        alignItems: 'center',
        boxSizing: 'border-box',
        paddingX: paddingX,
        minWidth: $b7cb2c43fa2e01f7$export$28c38c60b8df41e1()
    };
    if (options.shape === 'pill') result.borderRadius = 'pill';
    else Object.assign(result, $b7cb2c43fa2e01f7$export$6565fa6b916ade8());
    if (options.icon) {
        result.columnGap = 'text-to-visual';
        result.paddingX = {
            default: paddingX,
            [$b7cb2c43fa2e01f7$var$iconOnly]: 0
        };
        result['--iconMargin'] = {
            type: 'marginStart',
            value: {
                default: $b7cb2c43fa2e01f7$var$fontRelative(-2),
                [$b7cb2c43fa2e01f7$var$iconOnly]: 0
            }
        };
    }
    if (options.wrap) {
        result.minHeight = $b7cb2c43fa2e01f7$export$28c38c60b8df41e1();
        if (options.icon) {
            result.paddingY = 0;
            result['--labelPadding'] = {
                type: 'paddingTop',
                value: $b7cb2c43fa2e01f7$export$dc7aad089b8f5c30()
            };
            result.alignItems = {
                default: 'baseline',
                [$b7cb2c43fa2e01f7$var$iconOnly]: 'center'
            };
        } else result.paddingY = $b7cb2c43fa2e01f7$export$dc7aad089b8f5c30();
    } else result.height = $b7cb2c43fa2e01f7$export$28c38c60b8df41e1();
    return result;
}
const $b7cb2c43fa2e01f7$var$allowedOverrides = [
    'margin',
    'marginStart',
    'marginEnd',
    'marginTop',
    'marginBottom',
    'marginX',
    'marginY',
    'flexGrow',
    'flexShrink',
    'flexBasis',
    'justifySelf',
    'alignSelf',
    'order',
    'gridArea',
    'gridRowStart',
    'gridRowEnd',
    'gridColumnStart',
    'gridColumnEnd',
    'position',
    'zIndex',
    'top',
    'bottom',
    'inset',
    'insetX',
    'insetY',
    'insetStart',
    'insetEnd',
    'visibility'
];
const $b7cb2c43fa2e01f7$export$c79e0499b545f2e4 = [
    'width',
    'minWidth',
    'maxWidth'
];
const $b7cb2c43fa2e01f7$export$dc00e1c899b7e80d = [
    'size',
    'height',
    'minHeight',
    'maxHeight'
];
function $b7cb2c43fa2e01f7$export$6c84136e3de2766e({ width: width = true, height: height = false } = {}) {
    return $b7cb2c43fa2e01f7$var$allowedOverrides.concat(width ? $b7cb2c43fa2e01f7$export$c79e0499b545f2e4 : []).concat(height ? $b7cb2c43fa2e01f7$export$dc00e1c899b7e80d : []);
}


export {$b7cb2c43fa2e01f7$export$dc7aad089b8f5c30 as centerPadding, $b7cb2c43fa2e01f7$export$e0f35d825088c098 as field, $b7cb2c43fa2e01f7$export$78327973879c938a as controlFont, $b7cb2c43fa2e01f7$export$28c38c60b8df41e1 as controlSize, $b7cb2c43fa2e01f7$export$48db87e3f4768880 as fieldLabel, $b7cb2c43fa2e01f7$export$62d8db6a307a015a as fieldInput, $b7cb2c43fa2e01f7$export$f2d00fe8ce80fd84 as setColorScheme, $b7cb2c43fa2e01f7$export$1750a8f222a9157d as staticColor, $b7cb2c43fa2e01f7$export$6565fa6b916ade8 as controlBorderRadius, $b7cb2c43fa2e01f7$export$b5cde1de278b4330 as control, $b7cb2c43fa2e01f7$export$c79e0499b545f2e4 as widthProperties, $b7cb2c43fa2e01f7$export$dc00e1c899b7e80d as heightProperties, $b7cb2c43fa2e01f7$export$6c84136e3de2766e as getAllowedOverrides};
//# sourceMappingURL=style-utils.mjs.map
