@lazhus/kg-ui 0.4.11 → 0.4.12

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.
Files changed (41) hide show
  1. package/dist/components/kg-accordion-item.js +16 -42
  2. package/dist/components/kg-accordion.js +2 -25
  3. package/dist/components/kg-avatar.js +8 -48
  4. package/dist/components/kg-breadcrumbs.js +15 -51
  5. package/dist/components/kg-button.js +17 -72
  6. package/dist/components/kg-card.js +20 -51
  7. package/dist/components/kg-checkbox.js +17 -61
  8. package/dist/components/kg-colorpicker.js +35 -99
  9. package/dist/components/kg-column.js +2 -25
  10. package/dist/components/kg-datagrid.js +160 -269
  11. package/dist/components/kg-datepicker.js +111 -412
  12. package/dist/components/kg-divider.js +8 -38
  13. package/dist/components/kg-drawer.js +18 -62
  14. package/dist/components/kg-file-upload.js +50 -124
  15. package/dist/components/kg-grid.js +6 -24
  16. package/dist/components/kg-image.js +30 -58
  17. package/dist/components/kg-input.js +43 -118
  18. package/dist/components/kg-link.js +11 -47
  19. package/dist/components/kg-list.js +16 -38
  20. package/dist/components/kg-loader.js +21 -52
  21. package/dist/components/kg-modal.js +19 -59
  22. package/dist/components/kg-progress.js +7 -29
  23. package/dist/components/kg-radio-group.js +9 -47
  24. package/dist/components/kg-radio.js +11 -55
  25. package/dist/components/kg-row.js +2 -20
  26. package/dist/components/kg-select.js +66 -146
  27. package/dist/components/kg-skeleton.js +7 -31
  28. package/dist/components/kg-slider.js +26 -69
  29. package/dist/components/kg-spinner.js +8 -28
  30. package/dist/components/kg-stepper.js +23 -60
  31. package/dist/components/kg-switch.js +13 -51
  32. package/dist/components/kg-tab-panel.js +2 -20
  33. package/dist/components/kg-tabs.js +16 -55
  34. package/dist/components/kg-tag.js +11 -47
  35. package/dist/components/kg-text.js +12 -49
  36. package/dist/components/kg-textarea.js +18 -58
  37. package/dist/components/kg-toast.js +10 -90
  38. package/dist/components/kg-tooltip.js +12 -48
  39. package/dist/components/kg-tree.js +16 -56
  40. package/dist/index.js +1 -85
  41. package/package.json +5 -4
@@ -1,12 +1,18 @@
1
- import { LitElement as e, css as t, html as o } from "lit";
2
- import "lit/directives/class-map.js";
3
- class r extends e {
4
- static properties = {
5
- title: { type: String },
6
- open: { type: Boolean, reflect: !0 },
7
- disabled: { type: Boolean }
8
- };
9
- static styles = t`
1
+ var e=Object.defineProperty,t=(t,o,r)=>((t,o,r)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r)(t,"symbol"!=typeof o?o+"":o,r);import{LitElement as o,css as r,html as i}from"lit";import"lit/directives/class-map.js";class n extends o{constructor(){super(),this.open=!1,this.disabled=!1}_toggle(){this.disabled||this.dispatchEvent(new CustomEvent("kg-accordion-toggle",{detail:{open:!this.open},bubbles:!0,composed:!0}))}render(){return i`
2
+ <div class="accordion-item ${this.disabled?"disabled":""}">
3
+ <div class="accordion-header" @click="${this._toggle}">
4
+ <span class="title">${this.title}</span>
5
+ <svg class="chevron" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6
+ <polyline points="6 9 12 15 18 9"></polyline>
7
+ </svg>
8
+ </div>
9
+ <div class="content-wrapper">
10
+ <div class="content">
11
+ <slot></slot>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ `}}t(n,"properties",{title:{type:String},open:{type:Boolean,reflect:!0},disabled:{type:Boolean}}),t(n,"styles",r`
10
16
  :host {
11
17
  display: block;
12
18
  border-bottom: 1px solid var(--kg-border);
@@ -82,36 +88,4 @@ class r extends e {
82
88
  cursor: not-allowed !important;
83
89
  pointer-events: none;
84
90
  }
85
- `;
86
- constructor() {
87
- super(), this.open = !1, this.disabled = !1;
88
- }
89
- _toggle() {
90
- this.disabled || this.dispatchEvent(new CustomEvent("kg-accordion-toggle", {
91
- detail: { open: !this.open },
92
- bubbles: !0,
93
- composed: !0
94
- }));
95
- }
96
- render() {
97
- return o`
98
- <div class="accordion-item ${this.disabled ? "disabled" : ""}">
99
- <div class="accordion-header" @click="${this._toggle}">
100
- <span class="title">${this.title}</span>
101
- <svg class="chevron" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
102
- <polyline points="6 9 12 15 18 9"></polyline>
103
- </svg>
104
- </div>
105
- <div class="content-wrapper">
106
- <div class="content">
107
- <slot></slot>
108
- </div>
109
- </div>
110
- </div>
111
- `;
112
- }
113
- }
114
- customElements.define("kg-accordion-item", r);
115
- export {
116
- r as kgaccordionitem
117
- };
91
+ `),customElements.define("kg-accordion-item",n);export{n as kgaccordionitem};
@@ -1,10 +1,4 @@
1
- import { LitElement as s, css as i, html as l } from "lit";
2
- class a extends s {
3
- static properties = {
4
- exclusive: { type: Boolean }
5
- // If true, only one item can be open at a time
6
- };
7
- static styles = i`
1
+ var e=Object.defineProperty,r=(r,o,t)=>((r,o,t)=>o in r?e(r,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[o]=t)(r,"symbol"!=typeof o?o+"":o,t);import{LitElement as o,css as t,html as l}from"lit";class i extends o{constructor(){super(),this.exclusive=!1,this.addEventListener("kg-accordion-toggle",this._handleToggle)}_handleToggle(e){const r=e.target,o=Array.from(this.querySelectorAll("kg-accordion-item"));this.exclusive&&e.detail.open&&o.forEach(e=>{e!==r&&(e.open=!1)}),r.open=e.detail.open}render(){return l`<slot></slot>`}}r(i,"properties",{exclusive:{type:Boolean}}),r(i,"styles",t`
8
2
  :host {
9
3
  display: block;
10
4
  border: 1px solid var(--kg-border);
@@ -12,21 +6,4 @@ class a extends s {
12
6
  overflow: hidden;
13
7
  background: var(--kg-bg);
14
8
  }
15
- `;
16
- constructor() {
17
- super(), this.exclusive = !1, this.addEventListener("kg-accordion-toggle", this._handleToggle);
18
- }
19
- _handleToggle(e) {
20
- const o = e.target, r = Array.from(this.querySelectorAll("kg-accordion-item"));
21
- this.exclusive && e.detail.open && r.forEach((t) => {
22
- t !== o && (t.open = !1);
23
- }), o.open = e.detail.open;
24
- }
25
- render() {
26
- return l`<slot></slot>`;
27
- }
28
- }
29
- customElements.define("kg-accordion", a);
30
- export {
31
- a as kgaccordion
32
- };
9
+ `),customElements.define("kg-accordion",i);export{i as kgaccordion};
@@ -1,21 +1,10 @@
1
- import { LitElement as a, css as n, html as r } from "lit";
2
- class c extends a {
3
- static properties = {
4
- src: { type: String },
5
- alt: { type: String },
6
- name: { type: String },
7
- size: { type: String },
8
- // tiny, small, medium, large, huge, massive
9
- shape: { type: String },
10
- // circle, square, rounded
11
- status: { type: String },
12
- // online, offline, away, busy
13
- badge: { type: String },
14
- // numeric or simple dot
15
- color: { type: String }
16
- // primary, secondary, tertiary, etc. or hex
17
- };
18
- static styles = n`
1
+ var r=Object.defineProperty,t=(t,e,i)=>((t,e,i)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);import{LitElement as e,css as i,html as o}from"lit";class a extends e{constructor(){super(),this.size="medium",this.shape="circle",this.alt="Avatar"}getInitials(){if(!this.name)return"";const r=this.name.split(" ");return r.length>1?(r[0][0]+r[r.length-1][0]).toUpperCase():r[0][0].toUpperCase()}render(){const r=["primary","secondary","tertiary","error","success","warning","info"].includes(this.color),t=this.color&&!r,e=["avatar-wrapper",this.size,this.shape,this.color&&r?this.color:"",t?"custom-color":""].join(" "),i=t?`--avatar-bg: ${this.color};`:"";return o`
2
+ <div class="${e}" style="${i}" title="${this.name||this.alt}">
3
+ ${this.src?o`<img class="avatar-img" src="${this.src}" alt="${this.alt}" @error=${()=>this.src=""} />`:o`<span class="initials">${this.getInitials()}</span>`}
4
+ </div>
5
+ ${this.status?o`<div class="status-badge ${this.status} ${this.shape}"></div>`:""}
6
+ ${this.badge?o`<div class="numeric-badge">${this.badge}</div>`:""}
7
+ `}}t(a,"properties",{src:{type:String},alt:{type:String},name:{type:String},size:{type:String},shape:{type:String},status:{type:String},badge:{type:String},color:{type:String}}),t(a,"styles",i`
19
8
  :host {
20
9
  display: inline-block;
21
10
  vertical-align: middle;
@@ -105,33 +94,4 @@ class c extends a {
105
94
  background-color: var(--avatar-bg);
106
95
  color: white;
107
96
  }
108
- `;
109
- constructor() {
110
- super(), this.size = "medium", this.shape = "circle", this.alt = "Avatar";
111
- }
112
- getInitials() {
113
- if (!this.name) return "";
114
- const t = this.name.split(" ");
115
- return t.length > 1 ? (t[0][0] + t[t.length - 1][0]).toUpperCase() : t[0][0].toUpperCase();
116
- }
117
- render() {
118
- const e = ["primary", "secondary", "tertiary", "error", "success", "warning", "info"].includes(this.color), i = this.color && !e, o = [
119
- "avatar-wrapper",
120
- this.size,
121
- this.shape,
122
- this.color && e ? this.color : "",
123
- i ? "custom-color" : ""
124
- ].join(" "), s = i ? `--avatar-bg: ${this.color};` : "";
125
- return r`
126
- <div class="${o}" style="${s}" title="${this.name || this.alt}">
127
- ${this.src ? r`<img class="avatar-img" src="${this.src}" alt="${this.alt}" @error=${() => this.src = ""} />` : r`<span class="initials">${this.getInitials()}</span>`}
128
- </div>
129
- ${this.status ? r`<div class="status-badge ${this.status} ${this.shape}"></div>` : ""}
130
- ${this.badge ? r`<div class="numeric-badge">${this.badge}</div>` : ""}
131
- `;
132
- }
133
- }
134
- customElements.define("kg-avatar", c);
135
- export {
136
- c as kgavatar
137
- };
97
+ `),customElements.define("kg-avatar",a);export{a as kgavatar};
@@ -1,9 +1,8 @@
1
- import { LitElement as a, css as r, html as e } from "lit";
2
- class n extends a {
3
- static properties = {
4
- separator: { type: String }
5
- };
6
- static styles = r`
1
+ var e=Object.defineProperty,t=(t,r,a)=>((t,r,a)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a)(t,"symbol"!=typeof r?r+"":r,a);import{LitElement as r,css as a,html as s}from"lit";class o extends r{constructor(){super(),this.separator="/"}_handleSlotChange(e){e.target.assignedNodes().filter(e=>e.nodeType===Node.ELEMENT_NODE),this.requestUpdate()}render(){return s`
2
+ <nav aria-label="Breadcrumb">
3
+ <slot @slotchange="${this._handleSlotChange}"></slot>
4
+ </nav>
5
+ `}}t(o,"properties",{separator:{type:String}}),t(o,"styles",a`
7
6
  :host {
8
7
  display: block;
9
8
  }
@@ -46,28 +45,15 @@ class n extends a {
46
45
  font-size: 0.8em;
47
46
  opacity: 0.5;
48
47
  }
49
- `;
50
- constructor() {
51
- super(), this.separator = "/";
52
- }
53
- _handleSlotChange(t) {
54
- t.target.assignedNodes().filter((o) => o.nodeType === Node.ELEMENT_NODE), this.requestUpdate();
55
- }
56
- render() {
57
- return e`
58
- <nav aria-label="Breadcrumb">
59
- <slot @slotchange="${this._handleSlotChange}"></slot>
60
- </nav>
61
- `;
62
- }
63
- }
64
- class i extends a {
65
- static properties = {
66
- href: { type: String },
67
- active: { type: Boolean, reflect: !0 },
68
- separator: { type: String }
69
- };
70
- static styles = r`
48
+ `);class n extends r{constructor(){super(),this.active=!1,this.separator="/"}render(){const e=s`
49
+ <slot name="icon"></slot>
50
+ <slot></slot>
51
+ `;return s`
52
+ ${this.href&&!this.active?s`<a class="item" href="${this.href}">${e}</a>`:s`<span class="item ${this.active?"active":""}">${e}</span>`}
53
+ <span class="separator">
54
+ <slot name="separator">${this.separator}</slot>
55
+ </span>
56
+ `}}t(n,"properties",{href:{type:String},active:{type:Boolean,reflect:!0},separator:{type:String}}),t(n,"styles",a`
71
57
  :host {
72
58
  display: inline-flex;
73
59
  align-items: center;
@@ -105,26 +91,4 @@ class i extends a {
105
91
  :host(:last-child) .separator {
106
92
  display: none;
107
93
  }
108
- `;
109
- constructor() {
110
- super(), this.active = !1, this.separator = "/";
111
- }
112
- render() {
113
- const t = e`
114
- <slot name="icon"></slot>
115
- <slot></slot>
116
- `;
117
- return e`
118
- ${this.href && !this.active ? e`<a class="item" href="${this.href}">${t}</a>` : e`<span class="item ${this.active ? "active" : ""}">${t}</span>`}
119
- <span class="separator">
120
- <slot name="separator">${this.separator}</slot>
121
- </span>
122
- `;
123
- }
124
- }
125
- customElements.define("kg-breadcrumbs", n);
126
- customElements.define("kg-breadcrumb-item", i);
127
- export {
128
- i as kgbreadcrumbitem,
129
- n as kgbreadcrumbs
130
- };
94
+ `),customElements.define("kg-breadcrumbs",o),customElements.define("kg-breadcrumb-item",n);export{n as kgbreadcrumbitem,o as kgbreadcrumbs};
@@ -1,25 +1,19 @@
1
- import { LitElement as n, css as s, html as l } from "lit";
2
- import { classMap as d } from "lit/directives/class-map.js";
3
- class c extends n {
4
- static properties = {
5
- color: { type: String },
6
- // primary, secondary, tertiary, red, green, etc.
7
- size: { type: String },
8
- // mini, tiny, small, medium, large, big, huge, massive
9
- fullwidth: { type: Boolean },
10
- circular: { type: Boolean },
11
- square: { type: Boolean },
12
- loading: { type: Boolean },
13
- disabled: { type: Boolean },
14
- basic: { type: Boolean },
15
- inverted: { type: Boolean },
16
- active: { type: Boolean },
17
- text: { type: Boolean },
18
- hasText: { type: Boolean, state: !0 },
19
- hasLeft: { type: Boolean, state: !0 },
20
- hasRight: { type: Boolean, state: !0 }
21
- };
22
- static styles = s`
1
+ var t=Object.defineProperty,o=(o,r,e)=>((o,r,e)=>r in o?t(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e)(o,"symbol"!=typeof r?r+"":r,e);import{LitElement as r,css as e,html as a}from"lit";import{classMap as i}from"lit/directives/class-map.js";class n extends r{constructor(){super(),this.color="",this.size="medium",this.hasText=!1,this.hasLeft=!1,this.hasRight=!1}_handleSlotChange(t){const o=t.target,r=o.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.textContent.trim().length>0).length>0;o.name?"left"===o.name?this.hasLeft=r:"right"===o.name&&(this.hasRight=r):this.hasText=r}render(){const t=["primary","secondary","tertiary","error"].includes(this.color),o=this.color&&!t,r=!this.hasText&&(this.hasLeft||this.hasRight),e={[this.color]:t,"custom-color":o,[this.size]:!!this.size,fullwidth:this.fullwidth,circular:this.circular,square:this.square,loading:this.loading,basic:this.basic,text:this.text,inverted:this.inverted,disabled:this.disabled,"icon-only":r},n=o?`border: none; --kg-custom-color: ${this.color};`:"";return a`
2
+ <button
3
+ class="${i(e)}"
4
+ style="${n}"
5
+ ?disabled=${this.disabled}
6
+ @click=${this._handleClick}
7
+ >
8
+ <slot name="left" @slotchange=${this._handleSlotChange}></slot>
9
+
10
+ <span style="display: ${this.hasText?"inline-block":"none"}">
11
+ <slot @slotchange=${this._handleSlotChange}></slot>
12
+ </span>
13
+
14
+ <slot name="right" @slotchange=${this._handleSlotChange}></slot>
15
+ </button>
16
+ `}_handleClick(t){(this.loading||this.disabled)&&(t.preventDefault(),t.stopPropagation())}}o(n,"properties",{color:{type:String},size:{type:String},fullwidth:{type:Boolean},circular:{type:Boolean},square:{type:Boolean},loading:{type:Boolean},disabled:{type:Boolean},basic:{type:Boolean},inverted:{type:Boolean},active:{type:Boolean},text:{type:Boolean},hasText:{type:Boolean,state:!0},hasLeft:{type:Boolean,state:!0},hasRight:{type:Boolean,state:!0}}),o(n,"styles",e`
23
17
  :host {
24
18
  display: inline-block;
25
19
  vertical-align: middle;
@@ -189,53 +183,4 @@ class c extends n {
189
183
  box-shadow: none !important;
190
184
  pointer-events: none !important;
191
185
  }
192
- `;
193
- constructor() {
194
- super(), this.color = "", this.size = "medium", this.hasText = !1, this.hasLeft = !1, this.hasRight = !1;
195
- }
196
- _handleSlotChange(o) {
197
- const t = o.target, r = t.assignedNodes({ flatten: !0 }).filter(
198
- (e) => e.nodeType === Node.ELEMENT_NODE || e.nodeType === Node.TEXT_NODE && e.textContent.trim().length > 0
199
- ).length > 0;
200
- t.name ? t.name === "left" ? this.hasLeft = r : t.name === "right" && (this.hasRight = r) : this.hasText = r;
201
- }
202
- render() {
203
- const t = ["primary", "secondary", "tertiary", "error"].includes(this.color), a = this.color && !t, r = !this.hasText && (this.hasLeft || this.hasRight), e = {
204
- [this.color]: t,
205
- "custom-color": a,
206
- [this.size]: !!this.size,
207
- fullwidth: this.fullwidth,
208
- circular: this.circular,
209
- square: this.square,
210
- loading: this.loading,
211
- basic: this.basic,
212
- text: this.text,
213
- inverted: this.inverted,
214
- disabled: this.disabled,
215
- "icon-only": r
216
- }, i = a ? `border: none; --kg-custom-color: ${this.color};` : "";
217
- return l`
218
- <button
219
- class="${d(e)}"
220
- style="${i}"
221
- ?disabled=${this.disabled}
222
- @click=${this._handleClick}
223
- >
224
- <slot name="left" @slotchange=${this._handleSlotChange}></slot>
225
-
226
- <span style="display: ${this.hasText ? "inline-block" : "none"}">
227
- <slot @slotchange=${this._handleSlotChange}></slot>
228
- </span>
229
-
230
- <slot name="right" @slotchange=${this._handleSlotChange}></slot>
231
- </button>
232
- `;
233
- }
234
- _handleClick(o) {
235
- (this.loading || this.disabled) && (o.preventDefault(), o.stopPropagation());
236
- }
237
- }
238
- customElements.define("kg-button", c);
239
- export {
240
- c as kgbutton
241
- };
186
+ `),customElements.define("kg-button",n);export{n as kgbutton};
@@ -1,16 +1,22 @@
1
- import { LitElement as a, css as d, html as r } from "lit";
2
- import { classMap as s } from "lit/directives/class-map.js";
3
- class i extends a {
4
- static properties = {
5
- raised: { type: Boolean },
6
- vertical: { type: Boolean },
7
- inverted: { type: Boolean },
8
- color: { type: String },
9
- // primary, secondary, tertiary
10
- basic: { type: Boolean },
11
- padded: { type: Boolean }
12
- };
13
- static styles = d`
1
+ var r=Object.defineProperty,e=(e,o,t)=>((e,o,t)=>o in e?r(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t)(e,"symbol"!=typeof o?o+"":o,t);import{LitElement as o,css as t,html as a}from"lit";import{classMap as d}from"lit/directives/class-map.js";class s extends o{constructor(){super(),this.raised=!1,this.inverted=!1,this.basic=!1,this.padded=!1}render(){const r={"ui-card":!0,raised:this.raised,inverted:this.inverted,basic:this.basic,padded:this.padded,[this.color]:!!this.color},e=this.querySelector('[slot="header"]'),o=this.querySelector('[slot="footer"]');return a`
2
+ <div class="${d(r)}">
3
+ ${e?a`
4
+ <div class="card-header">
5
+ <slot name="header" @slotchange=${()=>this.requestUpdate()}></slot>
6
+ </div>
7
+ `:a`<slot name="header" @slotchange=${()=>this.requestUpdate()} style="display:none"></slot>`}
8
+
9
+ <div class="card-content">
10
+ <slot></slot>
11
+ </div>
12
+
13
+ ${o?a`
14
+ <div class="card-footer">
15
+ <slot name="footer" @slotchange=${()=>this.requestUpdate()}></slot>
16
+ </div>
17
+ `:a`<slot name="footer" @slotchange=${()=>this.requestUpdate()} style="display:none"></slot>`}
18
+ </div>
19
+ `}}e(s,"properties",{raised:{type:Boolean},vertical:{type:Boolean},inverted:{type:Boolean},color:{type:String},basic:{type:Boolean},padded:{type:Boolean}}),e(s,"styles",t`
14
20
  :host {
15
21
  display: block;
16
22
  margin: 1rem 0;
@@ -89,41 +95,4 @@ class i extends a {
89
95
  .primary { border-top: 4px solid var(--kg-primary); }
90
96
  .secondary { border-top: 4px solid var(--kg-secondary); }
91
97
  .tertiary { border-top: 4px solid var(--kg-tertiary); }
92
- `;
93
- constructor() {
94
- super(), this.raised = !1, this.inverted = !1, this.basic = !1, this.padded = !1;
95
- }
96
- render() {
97
- const e = {
98
- "ui-card": !0,
99
- raised: this.raised,
100
- inverted: this.inverted,
101
- basic: this.basic,
102
- padded: this.padded,
103
- [this.color]: !!this.color
104
- }, o = this.querySelector('[slot="header"]'), t = this.querySelector('[slot="footer"]');
105
- return r`
106
- <div class="${s(e)}">
107
- ${o ? r`
108
- <div class="card-header">
109
- <slot name="header" @slotchange=${() => this.requestUpdate()}></slot>
110
- </div>
111
- ` : r`<slot name="header" @slotchange=${() => this.requestUpdate()} style="display:none"></slot>`}
112
-
113
- <div class="card-content">
114
- <slot></slot>
115
- </div>
116
-
117
- ${t ? r`
118
- <div class="card-footer">
119
- <slot name="footer" @slotchange=${() => this.requestUpdate()}></slot>
120
- </div>
121
- ` : r`<slot name="footer" @slotchange=${() => this.requestUpdate()} style="display:none"></slot>`}
122
- </div>
123
- `;
124
- }
125
- }
126
- customElements.define("kg-card", i);
127
- export {
128
- i as kgcard
129
- };
98
+ `),customElements.define("kg-card",s);export{s as kgcard};
@@ -1,14 +1,19 @@
1
- import { LitElement as i, css as c, html as t } from "lit";
2
- import { classMap as a } from "lit/directives/class-map.js";
3
- class s extends i {
4
- static properties = {
5
- checked: { type: Boolean, reflect: !0 },
6
- label: { type: String },
7
- disabled: { type: Boolean },
8
- color: { type: String },
9
- indeterminate: { type: Boolean }
10
- };
11
- static styles = c`
1
+ var e=Object.defineProperty,r=(r,t,i)=>((r,t,i)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i)(r,"symbol"!=typeof t?t+"":t,i);import{LitElement as t,css as i,html as o}from"lit";import{classMap as c}from"lit/directives/class-map.js";class a extends t{constructor(){super(),this.checked=!1,this.disabled=!1,this.indeterminate=!1}toggle(){this.disabled||(this.checked=!this.checked,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0,composed:!0})))}render(){const e={"kg-checkbox-container":!0,checked:this.checked,disabled:this.disabled,indeterminate:this.indeterminate},r=`--checkbox-active-color: ${t=this.color,t?t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")?t:{primary:"var(--kg-primary)",secondary:"var(--kg-secondary)",tertiary:"var(--kg-tertiary)",error:"#e74c3c",red:"#e74c3c",green:"#2ecc71",blue:"#3498db",orange:"#f39c12",purple:"#9b59b6"}[t]||`var(--kg-${t}, ${t})`:"var(--kg-primary)"};`;var t;return o`
2
+ <div
3
+ class="${c(e)}"
4
+ style="${r}"
5
+ @click="${this.toggle}"
6
+ >
7
+ <div class="checkbox-box">
8
+ ${this.indeterminate?"":o`
9
+ <svg class="checkmark" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round">
10
+ <polyline points="20 6 9 17 4 12"></polyline>
11
+ </svg>
12
+ `}
13
+ </div>
14
+ ${this.label?o`<span class="label-text">${this.label}</span>`:""}
15
+ </div>
16
+ `}}r(a,"properties",{checked:{type:Boolean,reflect:!0},label:{type:String},disabled:{type:Boolean},color:{type:String},indeterminate:{type:Boolean}}),r(a,"styles",i`
12
17
  :host {
13
18
  display: inline-block;
14
19
  cursor: pointer;
@@ -95,53 +100,4 @@ class s extends i {
95
100
  opacity: 0.5;
96
101
  cursor: not-allowed;
97
102
  }
98
- `;
99
- constructor() {
100
- super(), this.checked = !1, this.disabled = !1, this.indeterminate = !1;
101
- }
102
- toggle() {
103
- this.disabled || (this.checked = !this.checked, this.indeterminate = !1, this.dispatchEvent(new CustomEvent("change", {
104
- detail: { checked: this.checked },
105
- bubbles: !0,
106
- composed: !0
107
- })));
108
- }
109
- render() {
110
- const r = {
111
- "kg-checkbox-container": !0,
112
- checked: this.checked,
113
- disabled: this.disabled,
114
- indeterminate: this.indeterminate
115
- }, o = `--checkbox-active-color: ${((e) => e ? e.startsWith("#") || e.startsWith("rgb") || e.startsWith("hsl") ? e : {
116
- primary: "var(--kg-primary)",
117
- secondary: "var(--kg-secondary)",
118
- tertiary: "var(--kg-tertiary)",
119
- error: "#e74c3c",
120
- red: "#e74c3c",
121
- green: "#2ecc71",
122
- blue: "#3498db",
123
- orange: "#f39c12",
124
- purple: "#9b59b6"
125
- }[e] || `var(--kg-${e}, ${e})` : "var(--kg-primary)")(this.color)};`;
126
- return t`
127
- <div
128
- class="${a(r)}"
129
- style="${o}"
130
- @click="${this.toggle}"
131
- >
132
- <div class="checkbox-box">
133
- ${this.indeterminate ? "" : t`
134
- <svg class="checkmark" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round">
135
- <polyline points="20 6 9 17 4 12"></polyline>
136
- </svg>
137
- `}
138
- </div>
139
- ${this.label ? t`<span class="label-text">${this.label}</span>` : ""}
140
- </div>
141
- `;
142
- }
143
- }
144
- customElements.define("kg-checkbox", s);
145
- export {
146
- s as kgcheckbox
147
- };
103
+ `),customElements.define("kg-checkbox",a);export{a as kgcheckbox};
@@ -1,13 +1,37 @@
1
- import { LitElement as t, css as o, html as i } from "lit";
2
- import "lit/directives/class-map.js";
3
- class r extends t {
4
- static properties = {
5
- value: { type: String, reflect: !0 },
6
- label: { type: String },
7
- open: { type: Boolean },
8
- disabled: { type: Boolean }
9
- };
10
- static styles = o`
1
+ var e=Object.defineProperty,i=(i,o,r)=>((i,o,r)=>o in i?e(i,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[o]=r)(i,"symbol"!=typeof o?o+"":o,r);import{LitElement as o,css as r,html as t}from"lit";import"lit/directives/class-map.js";class a extends o{constructor(){super(),this.value="#1367FF",this.open=!1,this.disabled=!1,this._presets=["#1367FF","#FF0000","#00FF00","#FFA500","#800080","#000000","#FFFFFF","#808080","#FFC0CB","#00FFFF","#FFFF00","#A52A2A","#3498db","#2ecc71","#e74c3c","#f1c40f","#9b59b6","#34495e"],this._handleOutsideClick=this._handleOutsideClick.bind(this)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_handleOutsideClick(e){this.open&&!e.composedPath().includes(this)&&(this.open=!1)}_togglePopup(e){e&&e.stopPropagation(),this.open=!this.open}_selectColor(e){this.value=e,this._dispatchChange()}_handleInput(e){this.value=e.target.value,this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return t`
2
+ <div class="kg-color-container ${this.disabled?"disabled":""}" style="position: relative;">
3
+ ${this.label?t`<span class="label-text">${this.label}</span>`:""}
4
+
5
+ <div class="picker-trigger" @click="${this._togglePopup}">
6
+ <div class="color-swatch" style="background-color: ${this.value}"></div>
7
+ <span class="color-value">${this.value}</span>
8
+ </div>
9
+
10
+ <div class="picker-popup ${this.open?"open":""}" @click="${e=>e.stopPropagation()}">
11
+ <div class="swatch-grid">
12
+ ${this._presets.map(e=>t`
13
+ <div
14
+ class="preset-swatch"
15
+ style="background-color: ${e}"
16
+ @click="${()=>this._selectColor(e)}"
17
+ ></div>
18
+ `)}
19
+ </div>
20
+
21
+ <div class="custom-input-container">
22
+ <span style="font-size: 0.75rem; color: var(--kg-text-muted); font-weight: 600;">Özel Renk Seç</span>
23
+ <div class="color-input-wrapper">
24
+ <input
25
+ type="color"
26
+ .value="${this.value}"
27
+ @input="${this._handleInput}"
28
+ />
29
+ <span class="color-hex-label">${this.value.toUpperCase()}</span>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ `}}i(a,"properties",{value:{type:String,reflect:!0},label:{type:String},open:{type:Boolean},disabled:{type:Boolean}}),i(a,"styles",r`
11
35
  :host {
12
36
  display: inline-block;
13
37
  font-family: inherit;
@@ -149,92 +173,4 @@ class r extends t {
149
173
  opacity: 0.5;
150
174
  pointer-events: none;
151
175
  }
152
- `;
153
- constructor() {
154
- super(), this.value = "#1367FF", this.open = !1, this.disabled = !1, this._presets = [
155
- "#1367FF",
156
- "#FF0000",
157
- "#00FF00",
158
- "#FFA500",
159
- "#800080",
160
- "#000000",
161
- "#FFFFFF",
162
- "#808080",
163
- "#FFC0CB",
164
- "#00FFFF",
165
- "#FFFF00",
166
- "#A52A2A",
167
- "#3498db",
168
- "#2ecc71",
169
- "#e74c3c",
170
- "#f1c40f",
171
- "#9b59b6",
172
- "#34495e"
173
- ], this._handleOutsideClick = this._handleOutsideClick.bind(this);
174
- }
175
- connectedCallback() {
176
- super.connectedCallback(), document.addEventListener("click", this._handleOutsideClick);
177
- }
178
- disconnectedCallback() {
179
- super.disconnectedCallback(), document.removeEventListener("click", this._handleOutsideClick);
180
- }
181
- _handleOutsideClick(e) {
182
- this.open && !e.composedPath().includes(this) && (this.open = !1);
183
- }
184
- _togglePopup(e) {
185
- e && e.stopPropagation(), this.open = !this.open;
186
- }
187
- _selectColor(e) {
188
- this.value = e, this._dispatchChange();
189
- }
190
- _handleInput(e) {
191
- this.value = e.target.value, this._dispatchChange();
192
- }
193
- _dispatchChange() {
194
- this.dispatchEvent(new CustomEvent("change", {
195
- detail: { value: this.value },
196
- bubbles: !0,
197
- composed: !0
198
- }));
199
- }
200
- render() {
201
- return i`
202
- <div class="kg-color-container ${this.disabled ? "disabled" : ""}" style="position: relative;">
203
- ${this.label ? i`<span class="label-text">${this.label}</span>` : ""}
204
-
205
- <div class="picker-trigger" @click="${this._togglePopup}">
206
- <div class="color-swatch" style="background-color: ${this.value}"></div>
207
- <span class="color-value">${this.value}</span>
208
- </div>
209
-
210
- <div class="picker-popup ${this.open ? "open" : ""}" @click="${(e) => e.stopPropagation()}">
211
- <div class="swatch-grid">
212
- ${this._presets.map((e) => i`
213
- <div
214
- class="preset-swatch"
215
- style="background-color: ${e}"
216
- @click="${() => this._selectColor(e)}"
217
- ></div>
218
- `)}
219
- </div>
220
-
221
- <div class="custom-input-container">
222
- <span style="font-size: 0.75rem; color: var(--kg-text-muted); font-weight: 600;">Özel Renk Seç</span>
223
- <div class="color-input-wrapper">
224
- <input
225
- type="color"
226
- .value="${this.value}"
227
- @input="${this._handleInput}"
228
- />
229
- <span class="color-hex-label">${this.value.toUpperCase()}</span>
230
- </div>
231
- </div>
232
- </div>
233
- </div>
234
- `;
235
- }
236
- }
237
- customElements.define("kg-colorpicker", r);
238
- export {
239
- r as kgcolorpicker
240
- };
176
+ `),customElements.define("kg-colorpicker",a);export{a as kgcolorpicker};