@peculiar/fortify-webcomponents
Version:
Web-components for creating CSR or Certificate and viewing certificates list using Fortify
26 lines (25 loc) • 1.35 kB
JavaScript
/*!
* © Peculiar Ventures https://peculiarventures.com/ - BSD 3-Clause License
*/
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/
import { h, } from "@stencil/core";
import { Typography } from "@peculiar/certificates-viewer";
import { InputRequiredIcon, ArrowDownIcon } from "../icons";
export const FortifySelect = (props) => {
const { label, options, disabled, name, required, defaultValue, readOnly, } = props;
const renderIconRequired = () => {
if (!required) {
return null;
}
return (h(InputRequiredIcon, { class: "form_field_icon_required" }));
};
const renderIconArrowDown = () => (h(ArrowDownIcon, { class: "form_field_icon_arrow_down" }));
return (h("label", null, h(Typography, { variant: "c2", color: "gray-10", component: "span" }, label), h("div", { class: "form_field_container" }, h("select", { class: "form_field t-b3", name: name, disabled: disabled, required: required, tabIndex: readOnly ? -1 : undefined }, options.map((opt) => (h("option", { key: opt.value, value: opt.value, selected: defaultValue === opt.value }, opt.name)))), renderIconRequired(), renderIconArrowDown())));
};
//# sourceMappingURL=fortify-select.js.map