'use strict'; import { h, render, useState, useEffect, useRef, html, Router } from './bundle.js'; // Helper function that returns a promise that resolves after delay const Delay = (ms, val) => new Promise(resolve => setTimeout(resolve, ms, val)); export const Icons = { heart: props => html``, downArrowBox: props => html` `, upArrowBox: props => html` `, cog: props => html` `, settingsH: props => html` `, settingsV: props => html` `, scan: props => html` `, desktop: props => html` `, alert: props => html` `, bell: props => html` `, refresh: props => html` `, bars4: props => html` `, bars3: props => html` `, logout: props => html` `, save: props => html` `, email: props => html` `, expand: props => html` `, shrink: props => html` `, ok: props => html``, fail: props => html` `, upload: props => html` `, download: props => html` `, bolt: props => html` `, home: props => html` `, link: props => html` `, shield: props => html` `, barsdown: props => html` `, arrowdown: props => html` `, arrowup: props => html` `, warn: props => html` `, info: props => html` `, exclamationTriangle: props => html` `, thumbUp: props => html` `, backward: props => html` `, chip: props => html` `, camera: props => html` `, arrows: props => html` `, }; export const tipColors = { green: 'bg-green-100 text-green-900 ring-green-300', yellow: 'bg-yellow-100 text-yellow-900 ring-yellow-300', red: 'bg-red-100 text-red-900 ring-red-300', }; export function Button({title, onclick, disabled, cls, icon, ref, colors, hovercolor, disabledcolor}) { const [spin, setSpin] = useState(false); const cb = function(ev) { const res = onclick ? onclick() : null; if (res && typeof (res.catch) === 'function') { setSpin(true); res.catch(() => false).then(() => setSpin(false)); } }; if (!colors) colors = 'bg-blue-600 hover:bg-blue-500 disabled:bg-blue-400'; return html`