"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    SelectField: ()=>SelectField_SelectField
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
const external_lucide_react_namespaceObject = require("lucide-react");
const external_react_namespaceObject = require("react");
const SelectField_SelectField = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(function({ field, value, onChange, error }) {
    const handleChange = (0, external_react_namespaceObject.useCallback)((e)=>{
        const raw = e.target.value;
        const matched = field.options?.find((o)=>String(o.value) === raw);
        onChange(matched ? matched.value : raw);
    }, [
        field.options,
        onChange
    ]);
    const selectId = `field-${field.key}`;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        className: "flex flex-col gap-1",
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("label", {
                htmlFor: selectId,
                className: "text-[13px] text-(--canvas-foreground-de-emp)",
                children: field.label
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                className: "relative",
                children: [
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("select", {
                        id: selectId,
                        className: (0, apollo_wind_namespaceObject.cn)('nodrag w-full px-3 py-2 pr-8 text-[13px] border border-(--canvas-border) rounded bg-(--canvas-background) text-(--canvas-foreground) outline-none transition-colors appearance-none cursor-pointer', 'focus:border-(--canvas-primary)', 'disabled:opacity-50 disabled:cursor-not-allowed', error && 'border-(--canvas-error)'),
                        value: value ?? field.defaultValue ?? '',
                        onChange: handleChange,
                        disabled: field.disabled,
                        children: [
                            field.placeholder && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("option", {
                                value: "",
                                disabled: true,
                                children: field.placeholder
                            }),
                            field.options?.map((option)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("option", {
                                    value: option.value,
                                    children: option.label
                                }, option.value))
                        ]
                    }),
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
                        size: 14,
                        className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-(--canvas-foreground-de-emp)",
                        "aria-hidden": true
                    })
                ]
            }),
            field.helpText && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
                className: "text-[12px] text-(--canvas-foreground-de-emp) block",
                children: field.helpText
            }),
            error && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
                className: "text-[12px] text-(--canvas-error-text) block",
                children: error
            })
        ]
    });
});
exports.SelectField = __webpack_exports__.SelectField;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "SelectField"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
