@kroyd/ui-core 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,5 +6,5 @@ export declare class UiButton extends LitElement {
6
6
  variant: "primary" | "error" | "error_outline" | "success";
7
7
  size: "sm" | "md" | "lg";
8
8
  private handleClick;
9
- render(): import('lit').TemplateResult<1>;
9
+ render(): import('lit-html').TemplateResult<1>;
10
10
  }
@@ -1,10 +1,9 @@
1
- import { U as Lt } from "./UiButton-BQ7COqQ4.mjs";
2
1
  /**
3
2
  * @license
4
3
  * Copyright 2019 Google LLC
5
4
  * SPDX-License-Identifier: BSD-3-Clause
6
5
  */
7
- const N = globalThis, I = N.ShadowRoot && (N.ShadyCSS === void 0 || N.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, q = Symbol(), F = /* @__PURE__ */ new WeakMap();
6
+ const N = globalThis, B = N.ShadowRoot && (N.ShadyCSS === void 0 || N.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, q = Symbol(), F = /* @__PURE__ */ new WeakMap();
8
7
  let nt = class {
9
8
  constructor(t, e, s) {
10
9
  if (this._$cssResult$ = !0, s !== q) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
@@ -13,7 +12,7 @@ let nt = class {
13
12
  get styleSheet() {
14
13
  let t = this.o;
15
14
  const e = this.t;
16
- if (I && t === void 0) {
15
+ if (B && t === void 0) {
17
16
  const s = e !== void 0 && e.length === 1;
18
17
  s && (t = F.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && F.set(e, t));
19
18
  }
@@ -31,12 +30,12 @@ const dt = (r) => new nt(typeof r == "string" ? r : r + "", void 0, q), pt = (r,
31
30
  })(i) + r[n + 1], r[0]);
32
31
  return new nt(e, r, q);
33
32
  }, ut = (r, t) => {
34
- if (I) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
33
+ if (B) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
35
34
  else for (const e of t) {
36
35
  const s = document.createElement("style"), i = N.litNonce;
37
36
  i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
38
37
  }
39
- }, G = I ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
38
+ }, G = B ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
40
39
  let e = "";
41
40
  for (const s of t.cssRules) e += s.cssText;
42
41
  return dt(e);
@@ -549,8 +548,8 @@ class P extends v {
549
548
  }
550
549
  var ot;
551
550
  P._$litElement$ = !0, P.finalized = !0, (ot = m.litElementHydrateSupport) == null || ot.call(m, { LitElement: P });
552
- const B = m.litElementPolyfillSupport;
553
- B == null || B({ LitElement: P });
551
+ const I = m.litElementPolyfillSupport;
552
+ I == null || I({ LitElement: P });
554
553
  (m.litElementVersions ?? (m.litElementVersions = [])).push("4.2.1");
555
554
  /**
556
555
  * @license
@@ -720,6 +719,5 @@ K([
720
719
  ], S.prototype, "size");
721
720
  customElements.define("ui-button", S);
722
721
  export {
723
- S as UiButton,
724
- Lt as UirButton
722
+ S as UiButton
725
723
  };
@@ -0,0 +1,118 @@
1
+ (function(E,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(E=typeof globalThis<"u"?globalThis:E||self,$(E.KroydUICore={}))})(this,function(E){"use strict";/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */var dt;const $=globalThis,D=$.ShadowRoot&&($.ShadyCSS===void 0||$.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,L=Symbol(),G=new WeakMap;let Q=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==L)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(D&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=G.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&G.set(e,t))}return t}toString(){return this.cssText}};const pt=r=>new Q(typeof r=="string"?r:r+"",void 0,L),ut=(r,...t)=>{const e=r.length===1?r[0]:t.reduce((s,i,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[n+1],r[0]);return new Q(e,r,L)},$t=(r,t)=>{if(D)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=$.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},X=D?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return pt(e)})(r):r;/**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */const{is:_t,defineProperty:ft,getOwnPropertyDescriptor:gt,getOwnPropertyNames:yt,getOwnPropertySymbols:mt,getPrototypeOf:At}=Object,_=globalThis,Y=_.trustedTypes,vt=Y?Y.emptyScript:"",I=_.reactiveElementPolyfillSupport,C=(r,t)=>r,k={toAttribute(r,t){switch(t){case Boolean:r=r?vt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},B=(r,t)=>!_t(r,t),tt={attribute:!0,type:String,converter:k,reflect:!1,useDefault:!1,hasChanged:B};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);let S=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=tt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&ft(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=gt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){const a=i==null?void 0:i.call(this);n==null||n.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??tt}static _$Ei(){if(this.hasOwnProperty(C("elementProperties")))return;const t=At(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(C("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(C("properties"))){const e=this.properties,s=[...yt(e),...mt(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(X(i))}else t!==void 0&&e.push(X(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $t(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){var n;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(((n=s.converter)==null?void 0:n.toAttribute)!==void 0?s.converter:k).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){var n,o;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const a=s.getPropertyOptions(i),h=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)==null?void 0:n.fromAttribute)!==void 0?a.converter:k;this._$Em=i;const c=h.fromAttribute(e,a.type);this[i]=c??((o=this._$Ej)==null?void 0:o.get(i))??c,this._$Em=null}}requestUpdate(t,e,s){var i;if(t!==void 0){const n=this.constructor,o=this[t];if(s??(s=n.getPropertyOptions(t)),!((s.hasChanged??B)(o,e)||s.useDefault&&s.reflect&&o===((i=this._$Ej)==null?void 0:i.get(t))&&!this.hasAttribute(n._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??e??this[t]),n!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i){const{wrapped:a}=o,h=this[n];a!==!0||this._$AL.has(n)||h===void 0||this.C(n,void 0,o,h)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(i=>{var n;return(n=i.hostUpdate)==null?void 0:n.call(i)}),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[C("elementProperties")]=new Map,S[C("finalized")]=new Map,I==null||I({ReactiveElement:S}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.1.1");/**
10
+ * @license
11
+ * Copyright 2017 Google LLC
12
+ * SPDX-License-Identifier: BSD-3-Clause
13
+ */const P=globalThis,R=P.trustedTypes,et=R?R.createPolicy("lit-html",{createHTML:r=>r}):void 0,st="$lit$",f=`lit$${Math.random().toFixed(9).slice(2)}$`,it="?"+f,bt=`<${it}>`,y=document,U=()=>y.createComment(""),O=r=>r===null||typeof r!="object"&&typeof r!="function",q=Array.isArray,Et=r=>q(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",V=`[
14
+ \f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rt=/-->/g,ot=/>/g,m=RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),nt=/'/g,ht=/"/g,at=/^(?:script|style|textarea|title)$/i,St=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),xt=St(1),x=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),lt=new WeakMap,A=y.createTreeWalker(y,129);function ct(r,t){if(!q(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return et!==void 0?et.createHTML(t):t}const wt=(r,t)=>{const e=r.length-1,s=[];let i,n=t===2?"<svg>":t===3?"<math>":"",o=T;for(let a=0;a<e;a++){const h=r[a];let c,p,l=-1,u=0;for(;u<h.length&&(o.lastIndex=u,p=o.exec(h),p!==null);)u=o.lastIndex,o===T?p[1]==="!--"?o=rt:p[1]!==void 0?o=ot:p[2]!==void 0?(at.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=m):p[3]!==void 0&&(o=m):o===m?p[0]===">"?(o=i??T,l=-1):p[1]===void 0?l=-2:(l=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?m:p[3]==='"'?ht:nt):o===ht||o===nt?o=m:o===rt||o===ot?o=T:(o=m,i=void 0);const g=o===m&&r[a+1].startsWith("/>")?" ":"";n+=o===T?h+bt:l>=0?(s.push(c),h.slice(0,l)+st+h.slice(l)+f+g):h+f+(l===-2?a:g)}return[ct(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class M{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const a=t.length-1,h=this.parts,[c,p]=wt(t,e);if(this.el=M.createElement(c,s),A.currentNode=this.el.content,e===2||e===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=A.nextNode())!==null&&h.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const l of i.getAttributeNames())if(l.endsWith(st)){const u=p[o++],g=i.getAttribute(l).split(f),j=/([.?@])?(.*)/.exec(u);h.push({type:1,index:n,name:j[2],strings:g,ctor:j[1]==="."?Pt:j[1]==="?"?Ut:j[1]==="@"?Ot:z}),i.removeAttribute(l)}else l.startsWith(f)&&(h.push({type:6,index:n}),i.removeAttribute(l));if(at.test(i.tagName)){const l=i.textContent.split(f),u=l.length-1;if(u>0){i.textContent=R?R.emptyScript:"";for(let g=0;g<u;g++)i.append(l[g],U()),A.nextNode(),h.push({type:2,index:++n});i.append(l[u],U())}}}else if(i.nodeType===8)if(i.data===it)h.push({type:2,index:n});else{let l=-1;for(;(l=i.data.indexOf(f,l+1))!==-1;)h.push({type:7,index:n}),l+=f.length-1}n++}}static createElement(t,e){const s=y.createElement("template");return s.innerHTML=t,s}}function w(r,t,e=r,s){var o,a;if(t===x)return t;let i=s!==void 0?(o=e._$Co)==null?void 0:o[s]:e._$Cl;const n=O(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==n&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=i:e._$Cl=i),i!==void 0&&(t=w(r,i._$AS(r,t.values),i,s)),t}class Ct{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((t==null?void 0:t.creationScope)??y).importNode(e,!0);A.currentNode=i;let n=A.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let c;h.type===2?c=new H(n,n.nextSibling,this,t):h.type===1?c=new h.ctor(n,h.name,h.strings,this,t):h.type===6&&(c=new Tt(n,this,t)),this._$AV.push(c),h=s[++a]}o!==(h==null?void 0:h.index)&&(n=A.nextNode(),o++)}return A.currentNode=y,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class H{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=w(this,t,e),O(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==x&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Et(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=M.createElement(ct(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===i)this._$AH.p(e);else{const o=new Ct(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=lt.get(t.strings);return e===void 0&&lt.set(t.strings,e=new M(t)),e}k(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const n of t)i===e.length?e.push(s=new H(this.O(U()),this.O(U()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class z{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(n===void 0)t=w(this,t,e,0),o=!O(t)||t!==this._$AH&&t!==x,o&&(this._$AH=t);else{const a=t;let h,c;for(t=n[0],h=0;h<n.length-1;h++)c=w(this,a[s+h],e,h),c===x&&(c=this._$AH[h]),o||(o=!O(c)||c!==this._$AH[h]),c===d?t=d:t!==d&&(t+=(c??"")+n[h+1]),this._$AH[h]=c}o&&!i&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Pt extends z{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Ut extends z{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Ot extends z{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=w(this,t,e,0)??d)===x)return;const s=this._$AH,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Tt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){w(this,t)}}const W=P.litHtmlPolyfillSupport;W==null||W(M,H),(P.litHtmlVersions??(P.litHtmlVersions=[])).push("3.3.1");const Mt=(r,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const n=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new H(t.insertBefore(U(),n),n,void 0,e??{})}return i._$AI(r),i};/**
16
+ * @license
17
+ * Copyright 2017 Google LLC
18
+ * SPDX-License-Identifier: BSD-3-Clause
19
+ */const v=globalThis;class N extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Mt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return x}}N._$litElement$=!0,N.finalized=!0,(dt=v.litElementHydrateSupport)==null||dt.call(v,{LitElement:N});const K=v.litElementPolyfillSupport;K==null||K({LitElement:N}),(v.litElementVersions??(v.litElementVersions=[])).push("4.2.1");/**
20
+ * @license
21
+ * Copyright 2017 Google LLC
22
+ * SPDX-License-Identifier: BSD-3-Clause
23
+ */const Ht={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:B},Nt=(r=Ht,t,e)=>{const{kind:s,metadata:i}=e;let n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),s==="setter"&&((r=Object.create(r)).wrapped=!0),n.set(e.name,r),s==="accessor"){const{name:o}=e;return{set(a){const h=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,h,r)},init(a){return a!==void 0&&this.C(o,void 0,r,a),a}}}if(s==="setter"){const{name:o}=e;return function(a){const h=this[o];t.call(this,a),this.requestUpdate(o,h,r)}}throw Error("Unsupported decorator location: "+s)};function J(r){return(t,e)=>typeof e=="object"?Nt(r,t,e):((s,i,n)=>{const o=i.hasOwnProperty(n);return i.constructor.createProperty(n,s),o?Object.getOwnPropertyDescriptor(i,n):void 0})(r,t,e)}const kt=ut`
24
+ :host {
25
+ display: inline-block;
26
+ }
27
+
28
+ .button {
29
+ padding: 8px 12px;
30
+ user-select: none;
31
+ cursor: pointer;
32
+ background-color: var(--grey);
33
+ text-align: center;
34
+ color: var(--text-primary);
35
+ border-radius: 10px;
36
+ font-weight: 500;
37
+ font-size: 12px;
38
+ line-height: 16px;
39
+ transition: opacity 200ms;
40
+ box-sizing: border-box;
41
+ border: none;
42
+ }
43
+
44
+ /* ================== variants ================== */
45
+
46
+ .button__primary {
47
+ background-color: var(--main-primary);
48
+ color: var(--cards-white);
49
+ outline: none;
50
+ }
51
+
52
+ .button__error {
53
+ background-color: var(--error);
54
+ border: 1px solid var(--error);
55
+ color: var(--cards-white);
56
+ padding: 7px 12px;
57
+ }
58
+
59
+ .button__error_outline {
60
+ background-color: var(--cards-white);
61
+ border: 1px solid var(--error);
62
+ color: var(--error);
63
+ padding: 7px 12px;
64
+ }
65
+
66
+ .button__success {
67
+ background-color: var(--success);
68
+ border: 1px solid var(--success);
69
+ color: var(--cards-white);
70
+ outline: none;
71
+ }
72
+
73
+ /* ================== sizes ================== */
74
+
75
+ .button__lg {
76
+ padding: 12px 20px;
77
+ line-height: 20px;
78
+ font-size: 16px;
79
+ }
80
+
81
+ .button__md {
82
+ padding: 10px 12px;
83
+ line-height: 20px;
84
+ }
85
+
86
+ .button__sm {
87
+ padding: 8px 12px;
88
+ line-height: 16px;
89
+ font-size: 12px;
90
+ }
91
+
92
+ /* ================== states ================== */
93
+
94
+ .button:hover {
95
+ opacity: 0.85;
96
+ }
97
+
98
+ .button:disabled {
99
+ opacity: 0.4;
100
+ cursor: not-allowed;
101
+ }
102
+
103
+ .button:disabled:hover {
104
+ opacity: 0.4;
105
+ }
106
+ `;var Rt=Object.defineProperty,Z=(r,t,e,s)=>{for(var i=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(i=o(t,e,i)||i);return i&&Rt(t,e,i),i};const F=class F extends N{constructor(){super(...arguments),this.disabled=!1,this.variant="primary",this.size="md"}handleClick(t){this.disabled||this.dispatchEvent(new CustomEvent("ui-click",{detail:{variant:this.variant,size:this.size,disabled:this.disabled,originalEvent:t},bubbles:!0,composed:!0}))}render(){return xt`
107
+ <button
108
+ class="
109
+ button
110
+ button__${this.variant}
111
+ button__${this.size}
112
+ "
113
+ ?disabled=${this.disabled}
114
+ @click=${this.handleClick}
115
+ >
116
+ <slot></slot>
117
+ </button>
118
+ `}};F.styles=kt;let b=F;Z([J({type:Boolean,reflect:!0})],b.prototype,"disabled"),Z([J({reflect:!0})],b.prototype,"variant"),Z([J({reflect:!0})],b.prototype,"size"),customElements.define("ui-button",b),E.UiButton=b,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
@@ -1,2 +1 @@
1
1
  export * from './components/index';
2
- export * from './react/index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kroyd/ui-core",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"
@@ -1,21 +0,0 @@
1
- import o, { useRef as f, useEffect as i } from "react";
2
- const l = ({
3
- onUiClick: e,
4
- children: u,
5
- ...c
6
- }) => {
7
- const r = f(null);
8
- return i(() => {
9
- const t = r.current;
10
- if (!t || !e) return;
11
- const n = (s) => {
12
- e(s);
13
- };
14
- return t.addEventListener("ui-click", n), () => {
15
- t.removeEventListener("ui-click", n);
16
- };
17
- }, [e]), /* @__PURE__ */ o.createElement("ui-button", { ref: r, ...c }, u);
18
- };
19
- export {
20
- l as U
21
- };
@@ -1,14 +0,0 @@
1
- import { default as React } from 'react';
2
-
3
- export type UiButtonClickEvent = CustomEvent<{
4
- variant: string;
5
- size: string;
6
- originalEvent: MouseEvent;
7
- }>;
8
- export interface UiButtonProps extends React.HTMLAttributes<HTMLElement> {
9
- variant?: "primary" | "error" | "error_outline" | "success";
10
- size?: "sm" | "md" | "lg";
11
- disabled?: boolean;
12
- onUiClick?: (e: UiButtonClickEvent) => void;
13
- }
14
- export declare const UirButton: React.FC<UiButtonProps>;
@@ -1 +0,0 @@
1
- export { UirButton } from './UiButton';
package/dist/react/index DELETED
@@ -1,4 +0,0 @@
1
- import { U as t } from "../UiButton-BQ7COqQ4.mjs";
2
- export {
3
- t as UirButton
4
- };
@@ -1 +0,0 @@
1
- export * from './button';
package/dist/react.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './react/index'