@kit-data-manager/pid-component
Version:
The PID-Component is a web component that can be used to evaluate and display FAIR Digital Objects, PIDs, ORCiDs, and possibly other identifiers in a user-friendly way. It is easily extensible to support other identifier types.
19 lines • 2.95 kB
JavaScript
/*!
*
* Copyright 2024-2026 Karlsruhe Institute of Technology.
*
* Licensed 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
*
* https://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 CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import{p as e,H as r,h as t,t as s}from"./p-Bw7bVt6t.js";const a=e(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.actions=[];this.darkMode="system"}render(){if(this.actions.length===0){return null}const e=this.darkMode==="dark"||this.darkMode==="system"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;const r=this.actionsId||`actions-${Math.random().toString(36).substring(2,11)}`;return t("div",{id:r,class:`actions-container sticky right-0 bottom-0 left-0 z-20 w-full ${e?"bg-gray-800":"bg-white"}`,role:"toolbar","aria-label":"Available actions"},t("span",{id:`${r}-desc`,class:"sr-only"},"The following links open related resources in new tabs"),t("div",{class:"flex flex-wrap justify-between gap-1","aria-describedby":`${r}-desc`},this.actions.map(((r,s)=>{const a="p-1 font-semibold text-sm rounded-sm border transition-colors duration-200";const o="focus:outline-hidden focus:ring-2 focus:ring-offset-1 focus:ring-blue-500";let n;if(e){switch(r.style){case"primary":n="bg-blue-700 text-white hover:bg-blue-600 border-blue-600";break;case"secondary":n="bg-slate-700 text-blue-300 hover:bg-slate-600 border-slate-600";break;case"danger":n="bg-red-700 text-white hover:bg-red-600 border-red-600";break;default:n="bg-gray-700 text-gray-200 hover:bg-gray-600 border-gray-600"}}else{switch(r.style){case"primary":n="bg-blue-500 text-white hover:bg-blue-600 border-blue-400";break;case"secondary":n="bg-slate-200 text-blue-500 hover:bg-slate-300 border-slate-300";break;case"danger":n="bg-red-500 text-white hover:bg-red-600 border-red-400";break;default:n="bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300"}}return t("a",{key:`action-${r.title}-${s}`,href:r.link,class:`${a} ${n} ${o}`,rel:"noopener noreferrer",target:"_blank","aria-label":`${r.title} (opens in new tab)`,title:`${r.title} - Opens in a new tab`},t("span",null,r.title),t("span",{class:"sr-only"},"(opens in new tab)"))}))))}},[0,"pid-actions",{actions:[16],actionsId:[1,"actions-id"],darkMode:[1,"dark-mode"]}]);function o(){if(typeof customElements==="undefined"){return}const e=["pid-actions"];e.forEach((e=>{switch(e){case"pid-actions":if(!customElements.get(s(e))){customElements.define(s(e),a)}break}}))}export{a as P,o as d};
//# sourceMappingURL=p-BeD5v0lO.js.map