'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { toWords, transformColumnsToSearchParams } from 'payload/shared';
import React from 'react';
import { FieldLabel } from '../../../../fields/FieldLabel/index.js';
import { useField } from '../../../../forms/useField/index.js';
import { Pill } from '../../../Pill/index.js';
import './index.scss';
export const QueryPresetsColumnField = ({ field: { label, required } })=>{
    const { path, value } = useField();
    return /*#__PURE__*/ _jsxDEV("div", {
        className: "field-type query-preset-columns-field",
        children: [
            /*#__PURE__*/ _jsxDEV(FieldLabel, {
                as: "h3",
                label: label,
                path: path,
                required: required
            }, void 0, false, {
                fileName: "src/elements/QueryPresets/fields/ColumnsField/index.tsx",
                lineNumber: 19,
                columnNumber: 7
            }, this),
            /*#__PURE__*/ _jsxDEV("div", {
                className: "value-wrapper",
                children: value ? transformColumnsToSearchParams(value).map((column, i)=>{
                    const isColumnActive = !column.startsWith('-');
                    return /*#__PURE__*/ _jsxDEV(Pill, {
                        pillStyle: isColumnActive ? 'always-white' : 'light-gray',
                        size: "small",
                        children: toWords(column)
                    }, i, false, {
                        fileName: "src/elements/QueryPresets/fields/ColumnsField/index.tsx",
                        lineNumber: 26,
                        columnNumber: 17
                    }, this);
                }) : 'No columns selected'
            }, void 0, false, {
                fileName: "src/elements/QueryPresets/fields/ColumnsField/index.tsx",
                lineNumber: 20,
                columnNumber: 7
            }, this)
        ]
    }, void 0, true, {
        fileName: "src/elements/QueryPresets/fields/ColumnsField/index.tsx",
        lineNumber: 18,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map