@lazhus/kg-ui 0.9.16 → 0.9.17

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.
@@ -554,6 +554,20 @@
554
554
  "module": "src/mixins/FormAssociated.js"
555
555
  }
556
556
  },
557
+ {
558
+ "kind": "method",
559
+ "name": "_handleFormKeyDown",
560
+ "parameters": [
561
+ {
562
+ "name": "e"
563
+ }
564
+ ],
565
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
566
+ "inheritedFrom": {
567
+ "name": "FormAssociated",
568
+ "module": "src/mixins/FormAssociated.js"
569
+ }
570
+ },
557
571
  {
558
572
  "kind": "field",
559
573
  "name": "form",
@@ -674,6 +688,14 @@
674
688
  "name": "FormAssociated",
675
689
  "module": "src/mixins/FormAssociated.js"
676
690
  }
691
+ },
692
+ {
693
+ "kind": "field",
694
+ "name": "_boundFormKeyDown",
695
+ "inheritedFrom": {
696
+ "name": "FormAssociated",
697
+ "module": "src/mixins/FormAssociated.js"
698
+ }
677
699
  }
678
700
  ],
679
701
  "mixins": [
@@ -925,6 +947,20 @@
925
947
  "module": "src/mixins/FormAssociated.js"
926
948
  }
927
949
  },
950
+ {
951
+ "kind": "method",
952
+ "name": "_handleFormKeyDown",
953
+ "parameters": [
954
+ {
955
+ "name": "e"
956
+ }
957
+ ],
958
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
959
+ "inheritedFrom": {
960
+ "name": "FormAssociated",
961
+ "module": "src/mixins/FormAssociated.js"
962
+ }
963
+ },
928
964
  {
929
965
  "kind": "field",
930
966
  "name": "form",
@@ -1016,6 +1052,14 @@
1016
1052
  "name": "FormAssociated",
1017
1053
  "module": "src/mixins/FormAssociated.js"
1018
1054
  }
1055
+ },
1056
+ {
1057
+ "kind": "field",
1058
+ "name": "_boundFormKeyDown",
1059
+ "inheritedFrom": {
1060
+ "name": "FormAssociated",
1061
+ "module": "src/mixins/FormAssociated.js"
1062
+ }
1019
1063
  }
1020
1064
  ],
1021
1065
  "events": [
@@ -1166,6 +1210,20 @@
1166
1210
  "module": "src/mixins/FormAssociated.js"
1167
1211
  }
1168
1212
  },
1213
+ {
1214
+ "kind": "method",
1215
+ "name": "_handleFormKeyDown",
1216
+ "parameters": [
1217
+ {
1218
+ "name": "e"
1219
+ }
1220
+ ],
1221
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
1222
+ "inheritedFrom": {
1223
+ "name": "FormAssociated",
1224
+ "module": "src/mixins/FormAssociated.js"
1225
+ }
1226
+ },
1169
1227
  {
1170
1228
  "kind": "field",
1171
1229
  "name": "form",
@@ -1299,6 +1357,14 @@
1299
1357
  "name": "FormAssociated",
1300
1358
  "module": "src/mixins/FormAssociated.js"
1301
1359
  }
1360
+ },
1361
+ {
1362
+ "kind": "field",
1363
+ "name": "_boundFormKeyDown",
1364
+ "inheritedFrom": {
1365
+ "name": "FormAssociated",
1366
+ "module": "src/mixins/FormAssociated.js"
1367
+ }
1302
1368
  }
1303
1369
  ],
1304
1370
  "events": [
@@ -2079,6 +2145,20 @@
2079
2145
  "module": "src/mixins/FormAssociated.js"
2080
2146
  }
2081
2147
  },
2148
+ {
2149
+ "kind": "method",
2150
+ "name": "_handleFormKeyDown",
2151
+ "parameters": [
2152
+ {
2153
+ "name": "e"
2154
+ }
2155
+ ],
2156
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
2157
+ "inheritedFrom": {
2158
+ "name": "FormAssociated",
2159
+ "module": "src/mixins/FormAssociated.js"
2160
+ }
2161
+ },
2082
2162
  {
2083
2163
  "kind": "field",
2084
2164
  "name": "form",
@@ -2192,6 +2272,14 @@
2192
2272
  "name": "FormAssociated",
2193
2273
  "module": "src/mixins/FormAssociated.js"
2194
2274
  }
2275
+ },
2276
+ {
2277
+ "kind": "field",
2278
+ "name": "_boundFormKeyDown",
2279
+ "inheritedFrom": {
2280
+ "name": "FormAssociated",
2281
+ "module": "src/mixins/FormAssociated.js"
2282
+ }
2195
2283
  }
2196
2284
  ],
2197
2285
  "events": [
@@ -2624,6 +2712,20 @@
2624
2712
  "module": "src/mixins/FormAssociated.js"
2625
2713
  }
2626
2714
  },
2715
+ {
2716
+ "kind": "method",
2717
+ "name": "_handleFormKeyDown",
2718
+ "parameters": [
2719
+ {
2720
+ "name": "e"
2721
+ }
2722
+ ],
2723
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
2724
+ "inheritedFrom": {
2725
+ "name": "FormAssociated",
2726
+ "module": "src/mixins/FormAssociated.js"
2727
+ }
2728
+ },
2627
2729
  {
2628
2730
  "kind": "field",
2629
2731
  "name": "form",
@@ -2761,6 +2863,14 @@
2761
2863
  "name": "FormAssociated",
2762
2864
  "module": "src/mixins/FormAssociated.js"
2763
2865
  }
2866
+ },
2867
+ {
2868
+ "kind": "field",
2869
+ "name": "_boundFormKeyDown",
2870
+ "inheritedFrom": {
2871
+ "name": "FormAssociated",
2872
+ "module": "src/mixins/FormAssociated.js"
2873
+ }
2764
2874
  }
2765
2875
  ],
2766
2876
  "events": [
@@ -3149,6 +3259,20 @@
3149
3259
  "module": "src/mixins/FormAssociated.js"
3150
3260
  }
3151
3261
  },
3262
+ {
3263
+ "kind": "method",
3264
+ "name": "_handleFormKeyDown",
3265
+ "parameters": [
3266
+ {
3267
+ "name": "e"
3268
+ }
3269
+ ],
3270
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
3271
+ "inheritedFrom": {
3272
+ "name": "FormAssociated",
3273
+ "module": "src/mixins/FormAssociated.js"
3274
+ }
3275
+ },
3152
3276
  {
3153
3277
  "kind": "field",
3154
3278
  "name": "form",
@@ -3294,6 +3418,14 @@
3294
3418
  "name": "FormAssociated",
3295
3419
  "module": "src/mixins/FormAssociated.js"
3296
3420
  }
3421
+ },
3422
+ {
3423
+ "kind": "field",
3424
+ "name": "_boundFormKeyDown",
3425
+ "inheritedFrom": {
3426
+ "name": "FormAssociated",
3427
+ "module": "src/mixins/FormAssociated.js"
3428
+ }
3297
3429
  }
3298
3430
  ],
3299
3431
  "events": [
@@ -3976,6 +4108,20 @@
3976
4108
  "module": "src/mixins/FormAssociated.js"
3977
4109
  }
3978
4110
  },
4111
+ {
4112
+ "kind": "method",
4113
+ "name": "_handleFormKeyDown",
4114
+ "parameters": [
4115
+ {
4116
+ "name": "e"
4117
+ }
4118
+ ],
4119
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
4120
+ "inheritedFrom": {
4121
+ "name": "FormAssociated",
4122
+ "module": "src/mixins/FormAssociated.js"
4123
+ }
4124
+ },
3979
4125
  {
3980
4126
  "kind": "field",
3981
4127
  "name": "form",
@@ -4096,6 +4242,14 @@
4096
4242
  "name": "FormAssociated",
4097
4243
  "module": "src/mixins/FormAssociated.js"
4098
4244
  }
4245
+ },
4246
+ {
4247
+ "kind": "field",
4248
+ "name": "_boundFormKeyDown",
4249
+ "inheritedFrom": {
4250
+ "name": "FormAssociated",
4251
+ "module": "src/mixins/FormAssociated.js"
4252
+ }
4099
4253
  }
4100
4254
  ],
4101
4255
  "events": [
@@ -4249,6 +4403,20 @@
4249
4403
  "module": "src/mixins/FormAssociated.js"
4250
4404
  }
4251
4405
  },
4406
+ {
4407
+ "kind": "method",
4408
+ "name": "_handleFormKeyDown",
4409
+ "parameters": [
4410
+ {
4411
+ "name": "e"
4412
+ }
4413
+ ],
4414
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
4415
+ "inheritedFrom": {
4416
+ "name": "FormAssociated",
4417
+ "module": "src/mixins/FormAssociated.js"
4418
+ }
4419
+ },
4252
4420
  {
4253
4421
  "kind": "field",
4254
4422
  "name": "form",
@@ -4352,6 +4520,14 @@
4352
4520
  "name": "FormAssociated",
4353
4521
  "module": "src/mixins/FormAssociated.js"
4354
4522
  }
4523
+ },
4524
+ {
4525
+ "kind": "field",
4526
+ "name": "_boundFormKeyDown",
4527
+ "inheritedFrom": {
4528
+ "name": "FormAssociated",
4529
+ "module": "src/mixins/FormAssociated.js"
4530
+ }
4355
4531
  }
4356
4532
  ],
4357
4533
  "events": [
@@ -4668,6 +4844,20 @@
4668
4844
  "module": "src/mixins/FormAssociated.js"
4669
4845
  }
4670
4846
  },
4847
+ {
4848
+ "kind": "method",
4849
+ "name": "_handleFormKeyDown",
4850
+ "parameters": [
4851
+ {
4852
+ "name": "e"
4853
+ }
4854
+ ],
4855
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
4856
+ "inheritedFrom": {
4857
+ "name": "FormAssociated",
4858
+ "module": "src/mixins/FormAssociated.js"
4859
+ }
4860
+ },
4671
4861
  {
4672
4862
  "kind": "field",
4673
4863
  "name": "form",
@@ -4793,6 +4983,14 @@
4793
4983
  "name": "FormAssociated",
4794
4984
  "module": "src/mixins/FormAssociated.js"
4795
4985
  }
4986
+ },
4987
+ {
4988
+ "kind": "field",
4989
+ "name": "_boundFormKeyDown",
4990
+ "inheritedFrom": {
4991
+ "name": "FormAssociated",
4992
+ "module": "src/mixins/FormAssociated.js"
4993
+ }
4796
4994
  }
4797
4995
  ],
4798
4996
  "events": [
@@ -5032,6 +5230,20 @@
5032
5230
  "module": "src/mixins/FormAssociated.js"
5033
5231
  }
5034
5232
  },
5233
+ {
5234
+ "kind": "method",
5235
+ "name": "_handleFormKeyDown",
5236
+ "parameters": [
5237
+ {
5238
+ "name": "e"
5239
+ }
5240
+ ],
5241
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
5242
+ "inheritedFrom": {
5243
+ "name": "FormAssociated",
5244
+ "module": "src/mixins/FormAssociated.js"
5245
+ }
5246
+ },
5035
5247
  {
5036
5248
  "kind": "field",
5037
5249
  "name": "form",
@@ -5165,6 +5377,14 @@
5165
5377
  "name": "FormAssociated",
5166
5378
  "module": "src/mixins/FormAssociated.js"
5167
5379
  }
5380
+ },
5381
+ {
5382
+ "kind": "field",
5383
+ "name": "_boundFormKeyDown",
5384
+ "inheritedFrom": {
5385
+ "name": "FormAssociated",
5386
+ "module": "src/mixins/FormAssociated.js"
5387
+ }
5168
5388
  }
5169
5389
  ],
5170
5390
  "events": [
@@ -5539,6 +5759,20 @@
5539
5759
  "module": "src/mixins/FormAssociated.js"
5540
5760
  }
5541
5761
  },
5762
+ {
5763
+ "kind": "method",
5764
+ "name": "_handleFormKeyDown",
5765
+ "parameters": [
5766
+ {
5767
+ "name": "e"
5768
+ }
5769
+ ],
5770
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
5771
+ "inheritedFrom": {
5772
+ "name": "FormAssociated",
5773
+ "module": "src/mixins/FormAssociated.js"
5774
+ }
5775
+ },
5542
5776
  {
5543
5777
  "kind": "field",
5544
5778
  "name": "form",
@@ -5630,6 +5864,14 @@
5630
5864
  "name": "FormAssociated",
5631
5865
  "module": "src/mixins/FormAssociated.js"
5632
5866
  }
5867
+ },
5868
+ {
5869
+ "kind": "field",
5870
+ "name": "_boundFormKeyDown",
5871
+ "inheritedFrom": {
5872
+ "name": "FormAssociated",
5873
+ "module": "src/mixins/FormAssociated.js"
5874
+ }
5633
5875
  }
5634
5876
  ],
5635
5877
  "events": [
@@ -6159,6 +6401,20 @@
6159
6401
  "module": "src/mixins/FormAssociated.js"
6160
6402
  }
6161
6403
  },
6404
+ {
6405
+ "kind": "method",
6406
+ "name": "_handleFormKeyDown",
6407
+ "parameters": [
6408
+ {
6409
+ "name": "e"
6410
+ }
6411
+ ],
6412
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
6413
+ "inheritedFrom": {
6414
+ "name": "FormAssociated",
6415
+ "module": "src/mixins/FormAssociated.js"
6416
+ }
6417
+ },
6162
6418
  {
6163
6419
  "kind": "field",
6164
6420
  "name": "form",
@@ -6304,6 +6560,14 @@
6304
6560
  "name": "FormAssociated",
6305
6561
  "module": "src/mixins/FormAssociated.js"
6306
6562
  }
6563
+ },
6564
+ {
6565
+ "kind": "field",
6566
+ "name": "_boundFormKeyDown",
6567
+ "inheritedFrom": {
6568
+ "name": "FormAssociated",
6569
+ "module": "src/mixins/FormAssociated.js"
6570
+ }
6307
6571
  }
6308
6572
  ],
6309
6573
  "events": [
@@ -6620,6 +6884,16 @@
6620
6884
  "static": true,
6621
6885
  "readonly": true
6622
6886
  },
6887
+ {
6888
+ "kind": "method",
6889
+ "name": "_handleFormKeyDown",
6890
+ "parameters": [
6891
+ {
6892
+ "name": "e"
6893
+ }
6894
+ ],
6895
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it."
6896
+ },
6623
6897
  {
6624
6898
  "kind": "field",
6625
6899
  "name": "form",
@@ -6713,6 +6987,10 @@
6713
6987
  "text": "string"
6714
6988
  },
6715
6989
  "default": "'text'"
6990
+ },
6991
+ {
6992
+ "kind": "field",
6993
+ "name": "_boundFormKeyDown"
6716
6994
  }
6717
6995
  ],
6718
6996
  "parameters": [
@@ -0,0 +1 @@
1
+ import{isServer as t}from"lit";const e=e=>class extends e{static get properties(){return{name:{type:String},value:{type:String},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},type:{type:String},errorText:{type:String,attribute:"error-text"}}}static get formAssociated(){return!0}constructor(){super(),this.name="",this.value="",this.disabled=!1,this.required=!1,this.type="text",!t&&this.attachInternals&&(this.internals=this.attachInternals()),this._boundFormKeyDown=this._handleFormKeyDown.bind(this)}connectedCallback(){super.connectedCallback(),"KG-TEXTAREA"!==this.tagName&&this.addEventListener("keydown",this._boundFormKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._boundFormKeyDown)}_handleFormKeyDown(t){if("Enter"===t.key){const e=this.internals&&this.internals.form||this.closest("form");e&&(t.preventDefault(),e.requestSubmit())}}get form(){return this.internals?this.internals.form:null}updated(t){super.updated(t),(t.has("value")||t.has("disabled"))&&this._updateFormValue()}_updateFormValue(){!t&&this.internals&&this.internals.setFormValue(this.value)}formResetCallback(){this.value=this.getAttribute("value")||""}formStateRestoreCallback(t){this.value=t}setValidity(e,i,s){!t&&this.internals&&this.internals.setValidity(e,i,s)}checkValidity(){return!this.internals||this.internals.checkValidity()}reportValidity(){return!this.internals||this.internals.reportValidity()}};export{e as F};
@@ -1,4 +1,4 @@
1
- var t=Object.defineProperty,e=(e,o,r)=>((e,o,r)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r)(e,"symbol"!=typeof o?o+"":o,r);import{LitElement as o,css as r,html as i}from"lit";import{classMap as a}from"lit/directives/class-map.js";import{F as n}from"../chunks/FormAssociated-Cx5D8YQA.js";class s extends(n(o)){constructor(){super(),e(this,"_handleGlobalEnter",t=>{if("Enter"===t.key&&!this.disabled&&!this.loading){if("TEXTAREA"===document.activeElement.tagName)return;const e=this.getBoundingClientRect();if(e.width>0&&e.height>0){const e=document.activeElement.tagName;if("BUTTON"===e||"A"===e)return;this._handleClick(t);const o=this.shadowRoot.querySelector("button");o&&o.click()}}}),this.color="",this.size="medium",this.hasText=!1,this.hasLeft=!1,this.hasRight=!1,this.type="button",this.isDefault=!1}updated(t){t.has("isDefault")&&(this.isDefault?window.addEventListener("keydown",this._handleGlobalEnter):window.removeEventListener("keydown",this._handleGlobalEnter)),super.updated(t)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this._handleGlobalEnter)}_handleSlotChange(t){const e=t.target,o=e.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.textContent.trim().length>0).length>0;e.name?"left"===e.name?this.hasLeft=o:"right"===e.name&&(this.hasRight=o):this.hasText=o}render(){const t=["primary","secondary","tertiary","error"].includes(this.color),e=this.color&&!t,o=!this.hasText&&(this.hasLeft||this.hasRight),r={[this.color]:t,"custom-color":e,[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":o},n=e?`border: none; --kg-custom-color: ${this.color};`:"";return i`
1
+ var t=Object.defineProperty,e=(e,o,r)=>((e,o,r)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r)(e,"symbol"!=typeof o?o+"":o,r);import{LitElement as o,css as r,html as i}from"lit";import{classMap as a}from"lit/directives/class-map.js";import{F as n}from"../chunks/FormAssociated-jTk7w1I7.js";class s extends(n(o)){constructor(){super(),e(this,"_handleGlobalEnter",t=>{if("Enter"===t.key&&!this.disabled&&!this.loading){if("TEXTAREA"===document.activeElement.tagName)return;const e=this.getBoundingClientRect();if(e.width>0&&e.height>0){const e=document.activeElement.tagName;if("BUTTON"===e||"A"===e)return;this._handleClick(t);const o=this.shadowRoot.querySelector("button");o&&o.click()}}}),this.color="",this.size="medium",this.hasText=!1,this.hasLeft=!1,this.hasRight=!1,this.type="button",this.isDefault=!1}updated(t){t.has("isDefault")&&(this.isDefault?window.addEventListener("keydown",this._handleGlobalEnter):window.removeEventListener("keydown",this._handleGlobalEnter)),super.updated(t)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this._handleGlobalEnter)}_handleSlotChange(t){const e=t.target,o=e.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.textContent.trim().length>0).length>0;e.name?"left"===e.name?this.hasLeft=o:"right"===e.name&&(this.hasRight=o):this.hasText=o}render(){const t=["primary","secondary","tertiary","error"].includes(this.color),e=this.color&&!t,o=!this.hasText&&(this.hasLeft||this.hasRight),r={[this.color]:t,"custom-color":e,[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":o},n=e?`border: none; --kg-custom-color: ${this.color};`:"";return i`
2
2
  <button
3
3
  class="${a(r)}"
4
4
  style="${n}"
@@ -1,4 +1,4 @@
1
- var e=Object.defineProperty,t=(t,r,o)=>((t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o)(t,"symbol"!=typeof r?r+"":r,o);import{LitElement as r,css as o,html as i}from"lit";import{classMap as c}from"lit/directives/class-map.js";import{F as a}from"../chunks/FormAssociated-Cx5D8YQA.js";class s extends(a(r)){static get properties(){return{...super.properties,checked:{type:Boolean,reflect:!0},label:{type:String},indeterminate:{type:Boolean},color:{type:String}}}constructor(){super(),this.checked=!1,this.indeterminate=!1,this.value="on"}formResetCallback(){this.checked=this.hasAttribute("checked"),this._updateFormValue()}formStateRestoreCallback(e){"checked"===e?this.checked=!0:"unchecked"===e&&(this.checked=!1),this._updateFormValue()}updated(e){e.has("checked")&&this._updateFormValue(),super.updated(e)}_updateFormValue(){const e=this.checked?this.value||"on":null;this.internals.setFormValue(e,this.checked?"checked":"unchecked"),this.required&&!this.checked?this.internals.setValidity({valueMissing:!0},"Please check this box.",this.shadowRoot.querySelector(".checkbox-box")):this.internals.setValidity({})}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=`--checkbox-active-color: ${r=this.color,r?r.startsWith("#")||r.startsWith("rgb")||r.startsWith("hsl")?r:{primary:"var(--kg-primary)",secondary:"var(--kg-secondary)",tertiary:"var(--kg-tertiary)",error:"#e74c3c",red:"#e74c3c",green:"#2ecc71",blue:"#3498db",orange:"#f39c12",purple:"#9b59b6"}[r]||`var(--kg-${r}, ${r})`:"var(--kg-primary)"};`,t={"kg-checkbox-container":!0,checked:this.checked,disabled:this.disabled,error:!!this.errorText,indeterminate:this.indeterminate};var r;return i`
1
+ var e=Object.defineProperty,t=(t,r,o)=>((t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o)(t,"symbol"!=typeof r?r+"":r,o);import{LitElement as r,css as o,html as i}from"lit";import{classMap as c}from"lit/directives/class-map.js";import{F as a}from"../chunks/FormAssociated-jTk7w1I7.js";class s extends(a(r)){static get properties(){return{...super.properties,checked:{type:Boolean,reflect:!0},label:{type:String},indeterminate:{type:Boolean},color:{type:String}}}constructor(){super(),this.checked=!1,this.indeterminate=!1,this.value="on"}formResetCallback(){this.checked=this.hasAttribute("checked"),this._updateFormValue()}formStateRestoreCallback(e){"checked"===e?this.checked=!0:"unchecked"===e&&(this.checked=!1),this._updateFormValue()}updated(e){e.has("checked")&&this._updateFormValue(),super.updated(e)}_updateFormValue(){const e=this.checked?this.value||"on":null;this.internals.setFormValue(e,this.checked?"checked":"unchecked"),this.required&&!this.checked?this.internals.setValidity({valueMissing:!0},"Please check this box.",this.shadowRoot.querySelector(".checkbox-box")):this.internals.setValidity({})}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=`--checkbox-active-color: ${r=this.color,r?r.startsWith("#")||r.startsWith("rgb")||r.startsWith("hsl")?r:{primary:"var(--kg-primary)",secondary:"var(--kg-secondary)",tertiary:"var(--kg-tertiary)",error:"#e74c3c",red:"#e74c3c",green:"#2ecc71",blue:"#3498db",orange:"#f39c12",purple:"#9b59b6"}[r]||`var(--kg-${r}, ${r})`:"var(--kg-primary)"};`,t={"kg-checkbox-container":!0,checked:this.checked,disabled:this.disabled,error:!!this.errorText,indeterminate:this.indeterminate};var r;return i`
2
2
  <div class="kg-checkbox-wrapper">
3
3
  <div
4
4
  class="${c(t)}"
@@ -1,4 +1,4 @@
1
- var e,r=Object.defineProperty;import{LitElement as o,css as t,html as i}from"lit";import{F as a}from"../chunks/FormAssociated-Cx5D8YQA.js";class s extends(a(o)){static get properties(){return{...super.properties,label:{type:String},open:{type:Boolean}}}constructor(){super(),this.value="#1367FF",this.open=!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 i`
1
+ var e,r=Object.defineProperty;import{LitElement as o,css as t,html as i}from"lit";import{F as a}from"../chunks/FormAssociated-jTk7w1I7.js";class s extends(a(o)){static get properties(){return{...super.properties,label:{type:String},open:{type:Boolean}}}constructor(){super(),this.value="#1367FF",this.open=!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 i`
2
2
  <div class="kg-color-container ${this.disabled?"disabled":""}" style="position: relative;">
3
3
  ${this.label?i`<span class="label-text">${this.label}</span>`:""}
4
4
 
@@ -1,4 +1,4 @@
1
- var e,t=Object.defineProperty;import{LitElement as a,css as i,html as s}from"lit";import{classMap as r}from"lit/directives/class-map.js";import{F as n}from"../chunks/FormAssociated-Cx5D8YQA.js";class o extends(n(a)){static get properties(){return{...super.properties,open:{type:Boolean,reflect:!0},placeholder:{type:String},label:{type:String},showTime:{type:Boolean},fullwidth:{type:Boolean,reflect:!0},mode:{type:String},locale:{type:String},min:{type:String},max:{type:String},_viewDate:{type:Object},_selectedDate:{type:Object},_inputValue:{state:!0},value:{type:Object,converter:{fromAttribute:e=>{if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?e:t},toAttribute:e=>e instanceof Date?e.toISOString():e}}}}constructor(){super(),this.open=!1,this.disabled=!1,this.mode="date",this.locale="tr-TR",this.placeholder="Tarih seçiniz...",this.min="",this.max="",this._viewDate=/* @__PURE__ */new Date,this.value=null,this._inputValue="",this._handleOutsideClick=this._handleOutsideClick.bind(this)}willUpdate(e){if(e.has("value"))if(this.value instanceof Date&&!isNaN(this.value.getTime()))this._selectedDate=this.value,this._viewDate=new Date(this.value),this._inputValue=this._formatValue(this.value);else if(this.value){if("string"==typeof this.value){const e=this._parseDateStr(this.value);e&&!isNaN(e.getTime())?(this._selectedDate=e,this._viewDate=new Date(e),this._inputValue=this._formatValue(e)):this._inputValue=this.value}}else this._selectedDate=null,this._inputValue=""}_updateFormValue(){if(this.internals){let e=this.value;e instanceof Date&&(e=e.toISOString()),this.internals.setFormValue(e||"")}}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.disabled||(this.open=!this.open)}_handleInputKeydown(e){["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","Home","End"].includes(e.key)||(e.ctrlKey||e.metaKey)&&["a","c","v","x"].includes(e.key.toLowerCase())||/^\d$/.test(e.key)||e.preventDefault()}_getDateFormat(){const e=new Date(2023,11,31),t=new Intl.DateTimeFormat(this.locale).formatToParts(e),a=t.filter(e=>"literal"!==e.type).map(e=>e.type),i=t.find(e=>"literal"===e.type);let s=i?i.value:".";return s=s.includes(".")?".":s.includes("/")?"/":s.includes("-")?"-":".",{parts:a,separator:s}}_handleManualInput(e){let t=e.detail.value;t=t.replace(/\D/g,"");const{parts:a,separator:i}=this._getDateFormat(),s="year"===a[0];let r="";if(t.length>0&&(s?t.length<=4?r=t:t.length<=6?r=`${t.slice(0,4)}${i}${t.slice(4)}`:t.length<=8&&(r=`${t.slice(0,4)}${i}${t.slice(4,6)}${i}${t.slice(6)}`):t.length<=2?r=t:t.length<=4?r=`${t.slice(0,2)}${i}${t.slice(2)}`:t.length<=8&&(r=`${t.slice(0,2)}${i}${t.slice(2,4)}${i}${t.slice(4)}`),this.showTime&&t.length>8)){const e=r,a=t.slice(8);r=a.length<=2?`${e} ${a}`:`${e} ${a.slice(0,2)}:${a.slice(2,4)}`}if(t.length>=8){let e,n,o;if(s)o=parseInt(t.slice(0,4)),n=parseInt(t.slice(4,6)),e=parseInt(t.slice(6,8));else{const i=parseInt(t.slice(0,2)),s=parseInt(t.slice(2,4)),r=parseInt(t.slice(4,8));"day"===a[0]?(e=i,n=s,o=r):(n=i,e=s,o=r)}e>31&&(e=31),0===e&&(e=1),n>12&&(n=12),0===n&&(n=1),o>2100&&(o=2100);const l=String(e).padStart(2,"0"),c=String(n).padStart(2,"0"),d=String(o);if(r=s?`${d}${i}${c}${i}${l}`:"day"===a[0]?`${l}${i}${c}${i}${d}`:`${c}${i}${l}${i}${d}`,this.showTime&&t.length>8){r.split(" ")[1];let e=parseInt(t.slice(8,10)||"0"),a=parseInt(t.slice(10,12)||"0");e>23&&(e=23),a>59&&(a=59);const i=String(e).padStart(2,"0"),s=String(a).padStart(2,"0");t.length<=10?r+=` ${i}`:r+=` ${i}:${s}`}}if(this._inputValue=r||t,this._inputValue.length>=8){const e=this._inputValue.split(" ")[0].split(i),t=this._inputValue.split(" ")[1]?.split(":")||[];if(3===e.length){let i,r,n;s?(n=parseInt(e[0]),r=parseInt(e[1]),i=parseInt(e[2])):"day"===a[0]?(i=parseInt(e[0]),r=parseInt(e[1]),n=parseInt(e[2])):(r=parseInt(e[0]),i=parseInt(e[1]),n=parseInt(e[2]));let o=0,l=0;if(t.length>=2&&(o=parseInt(t[0]),l=parseInt(t[1])),n>999){let e=new Date(n,r-1,i,o,l);if(!isNaN(e.getTime())){if(this.min){const t=this._parseDateStr(this.min);t&&new Date(e.getFullYear(),e.getMonth(),e.getDate())<new Date(t.getFullYear(),t.getMonth(),t.getDate())&&(e=new Date(t))}if(this.max){const t=this._parseDateStr(this.max);t&&new Date(e.getFullYear(),e.getMonth(),e.getDate())>new Date(t.getFullYear(),t.getMonth(),t.getDate())&&(e=new Date(t))}this._viewDate=e,this._selectedDate=e,this.value=e,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}}}}else""===this._inputValue&&(this.value=null,this.dispatchEvent(new CustomEvent("change",{detail:{value:null,date:null},bubbles:!0,composed:!0})));this.requestUpdate()}_changeMonth(e){const t=new Date(this._viewDate);t.setMonth(t.getMonth()+e),this._viewDate=t}_setViewMonth(e){const t=new Date(this._viewDate);t.setMonth(parseInt(e)),this._viewDate=t}_setViewYear(e){const t=new Date(this._viewDate);t.setFullYear(parseInt(e)),this._viewDate=t}_setTime(e,t){const a=new Date(this._viewDate);if("hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._viewDate=a,this._selectedDate){const a=new Date(this._selectedDate);"hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._selectedDate=a,this.value=a,this._inputValue=this._formatValue(a)}}_formatValue(e){if(!e)return"";const{separator:t,parts:a}=this._getDateFormat(),i=String(e.getDate()).padStart(2,"0"),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear());let n="";return n="year"===a[0]?`${r}${t}${s}${t}${i}`:"day"===a[0]?`${i}${t}${s}${t}${r}`:`${s}${t}${i}${t}${r}`,"year"===this.mode?String(r):"month"===this.mode?`${s}${t}${r}`:(this.showTime&&(n+=` ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`),n)}_handleToday(e){e&&e.stopPropagation();const t=/* @__PURE__ */new Date;this._viewDate=t,this._selectDate(t.getDate(),!0)}_handleDone(e){e&&e.stopPropagation(),this.open=!1}_handleKeydown(e){if(!this.open)return void("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.open=!0));if("Escape"===e.key)return void(this.open=!1);const t=new Date(this._viewDate);let a=!0;switch(e.key){case"ArrowLeft":t.setDate(t.getDate()-1);break;case"ArrowRight":t.setDate(t.getDate()+1);break;case"ArrowUp":t.setDate(t.getDate()-7);break;case"ArrowDown":t.setDate(t.getDate()+7);break;case"Enter":const e=new Date(this._viewDate);this._isDisabled(e)||this._selectDate(this._viewDate.getDate(),!0);break;default:a=!1}a&&(e.preventDefault(),this._viewDate=t)}_parseDateStr(e){if(!e)return null;if(e instanceof Date)return e;if("number"==typeof e)return new Date(e);const t=String(e);return t.match(/^\d{4}-\d{2}-\d{2}$/),new Date(t)}_isDisabled(e){if(!e)return!1;const t=this._parseDateStr(this.min),a=this._parseDateStr(this.max),i=new Date(e.getFullYear(),e.getMonth(),e.getDate());return!!(t&&i<new Date(t.getFullYear(),t.getMonth(),t.getDate()))||!!(a&&i>new Date(a.getFullYear(),a.getMonth(),a.getDate()))}_selectDate(e,t){if(!t)return;const a=new Date(this._viewDate);"date"===this.mode&&a.setDate(e),this._isDisabled(a)||(this._selectedDate=a,this.value=a,this._inputValue=this._formatValue(a),this.showTime&&"date"===this.mode||(this.open=!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0})))}_selectMonth(e){const t=new Date(this._viewDate);t.setMonth(e),this._viewDate=t,this._selectedDate=t,this.value=t,this._inputValue=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_selectYear(e){const t=new Date(this._viewDate);t.setFullYear(e),this._viewDate=t,this._selectedDate=t,this.value=t,this._inputValue=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_renderCalendar(){const e=this._viewDate.getFullYear(),t=this._viewDate.getMonth(),a=this._viewDate.getDate(),i=Array.from({length:12},(e,t)=>{const a=new Date(2e3,t,1);return new Intl.DateTimeFormat(this.locale,{month:"long"}).format(a)});new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7)),new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7));let n=1;(this.locale.startsWith("en-US")||this.locale.startsWith("ja")||this.locale.startsWith("zh"))&&(n=0);const o=[];for(let s=0;s<7;s++){const e=new Date(2024,0,7+s+n);o.push(new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(e))}let l=(new Date(e,t,1).getDay()-n+7)%7;const c=new Date(e,t+1,0).getDate(),d=new Date(e,t,0).getDate(),h=[];for(let s=l-1;s>=0;s--)h.push({day:d-s,current:!1});for(let s=1;s<=c;s++)h.push({day:s,current:!0});const p=42-h.length;for(let s=1;s<=p;s++)h.push({day:s,current:!1});const u=/* @__PURE__ */(new Date).getFullYear(),g=[];for(let s=u-50;s<=u+50;s++)g.push(s);const m=/* @__PURE__ */new Date,v=a=>a===m.getDate()&&t===m.getMonth()&&e===m.getFullYear(),w=a=>!!this._selectedDate&&a===this._selectedDate.getDate()&&t===this._selectedDate.getMonth()&&e===this._selectedDate.getFullYear();return s`
1
+ var e,t=Object.defineProperty;import{LitElement as a,css as i,html as s}from"lit";import{classMap as r}from"lit/directives/class-map.js";import{F as n}from"../chunks/FormAssociated-jTk7w1I7.js";class o extends(n(a)){static get properties(){return{...super.properties,open:{type:Boolean,reflect:!0},placeholder:{type:String},label:{type:String},showTime:{type:Boolean},fullwidth:{type:Boolean,reflect:!0},mode:{type:String},locale:{type:String},min:{type:String},max:{type:String},_viewDate:{type:Object},_selectedDate:{type:Object},_inputValue:{state:!0},value:{type:Object,converter:{fromAttribute:e=>{if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?e:t},toAttribute:e=>e instanceof Date?e.toISOString():e}}}}constructor(){super(),this.open=!1,this.disabled=!1,this.mode="date",this.locale="tr-TR",this.placeholder="Tarih seçiniz...",this.min="",this.max="",this._viewDate=/* @__PURE__ */new Date,this.value=null,this._inputValue="",this._handleOutsideClick=this._handleOutsideClick.bind(this)}willUpdate(e){if(e.has("value"))if(this.value instanceof Date&&!isNaN(this.value.getTime()))this._selectedDate=this.value,this._viewDate=new Date(this.value),this._inputValue=this._formatValue(this.value);else if(this.value){if("string"==typeof this.value){const e=this._parseDateStr(this.value);e&&!isNaN(e.getTime())?(this._selectedDate=e,this._viewDate=new Date(e),this._inputValue=this._formatValue(e)):this._inputValue=this.value}}else this._selectedDate=null,this._inputValue=""}_updateFormValue(){if(this.internals){let e=this.value;e instanceof Date&&(e=e.toISOString()),this.internals.setFormValue(e||"")}}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.disabled||(this.open=!this.open)}_handleInputKeydown(e){["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","Home","End"].includes(e.key)||(e.ctrlKey||e.metaKey)&&["a","c","v","x"].includes(e.key.toLowerCase())||/^\d$/.test(e.key)||e.preventDefault()}_getDateFormat(){const e=new Date(2023,11,31),t=new Intl.DateTimeFormat(this.locale).formatToParts(e),a=t.filter(e=>"literal"!==e.type).map(e=>e.type),i=t.find(e=>"literal"===e.type);let s=i?i.value:".";return s=s.includes(".")?".":s.includes("/")?"/":s.includes("-")?"-":".",{parts:a,separator:s}}_handleManualInput(e){let t=e.detail.value;t=t.replace(/\D/g,"");const{parts:a,separator:i}=this._getDateFormat(),s="year"===a[0];let r="";if(t.length>0&&(s?t.length<=4?r=t:t.length<=6?r=`${t.slice(0,4)}${i}${t.slice(4)}`:t.length<=8&&(r=`${t.slice(0,4)}${i}${t.slice(4,6)}${i}${t.slice(6)}`):t.length<=2?r=t:t.length<=4?r=`${t.slice(0,2)}${i}${t.slice(2)}`:t.length<=8&&(r=`${t.slice(0,2)}${i}${t.slice(2,4)}${i}${t.slice(4)}`),this.showTime&&t.length>8)){const e=r,a=t.slice(8);r=a.length<=2?`${e} ${a}`:`${e} ${a.slice(0,2)}:${a.slice(2,4)}`}if(t.length>=8){let e,n,o;if(s)o=parseInt(t.slice(0,4)),n=parseInt(t.slice(4,6)),e=parseInt(t.slice(6,8));else{const i=parseInt(t.slice(0,2)),s=parseInt(t.slice(2,4)),r=parseInt(t.slice(4,8));"day"===a[0]?(e=i,n=s,o=r):(n=i,e=s,o=r)}e>31&&(e=31),0===e&&(e=1),n>12&&(n=12),0===n&&(n=1),o>2100&&(o=2100);const l=String(e).padStart(2,"0"),c=String(n).padStart(2,"0"),d=String(o);if(r=s?`${d}${i}${c}${i}${l}`:"day"===a[0]?`${l}${i}${c}${i}${d}`:`${c}${i}${l}${i}${d}`,this.showTime&&t.length>8){r.split(" ")[1];let e=parseInt(t.slice(8,10)||"0"),a=parseInt(t.slice(10,12)||"0");e>23&&(e=23),a>59&&(a=59);const i=String(e).padStart(2,"0"),s=String(a).padStart(2,"0");t.length<=10?r+=` ${i}`:r+=` ${i}:${s}`}}if(this._inputValue=r||t,this._inputValue.length>=8){const e=this._inputValue.split(" ")[0].split(i),t=this._inputValue.split(" ")[1]?.split(":")||[];if(3===e.length){let i,r,n;s?(n=parseInt(e[0]),r=parseInt(e[1]),i=parseInt(e[2])):"day"===a[0]?(i=parseInt(e[0]),r=parseInt(e[1]),n=parseInt(e[2])):(r=parseInt(e[0]),i=parseInt(e[1]),n=parseInt(e[2]));let o=0,l=0;if(t.length>=2&&(o=parseInt(t[0]),l=parseInt(t[1])),n>999){let e=new Date(n,r-1,i,o,l);if(!isNaN(e.getTime())){if(this.min){const t=this._parseDateStr(this.min);t&&new Date(e.getFullYear(),e.getMonth(),e.getDate())<new Date(t.getFullYear(),t.getMonth(),t.getDate())&&(e=new Date(t))}if(this.max){const t=this._parseDateStr(this.max);t&&new Date(e.getFullYear(),e.getMonth(),e.getDate())>new Date(t.getFullYear(),t.getMonth(),t.getDate())&&(e=new Date(t))}this._viewDate=e,this._selectedDate=e,this.value=e,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}}}}else""===this._inputValue&&(this.value=null,this.dispatchEvent(new CustomEvent("change",{detail:{value:null,date:null},bubbles:!0,composed:!0})));this.requestUpdate()}_changeMonth(e){const t=new Date(this._viewDate);t.setMonth(t.getMonth()+e),this._viewDate=t}_setViewMonth(e){const t=new Date(this._viewDate);t.setMonth(parseInt(e)),this._viewDate=t}_setViewYear(e){const t=new Date(this._viewDate);t.setFullYear(parseInt(e)),this._viewDate=t}_setTime(e,t){const a=new Date(this._viewDate);if("hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._viewDate=a,this._selectedDate){const a=new Date(this._selectedDate);"hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._selectedDate=a,this.value=a,this._inputValue=this._formatValue(a)}}_formatValue(e){if(!e)return"";const{separator:t,parts:a}=this._getDateFormat(),i=String(e.getDate()).padStart(2,"0"),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear());let n="";return n="year"===a[0]?`${r}${t}${s}${t}${i}`:"day"===a[0]?`${i}${t}${s}${t}${r}`:`${s}${t}${i}${t}${r}`,"year"===this.mode?String(r):"month"===this.mode?`${s}${t}${r}`:(this.showTime&&(n+=` ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`),n)}_handleToday(e){e&&e.stopPropagation();const t=/* @__PURE__ */new Date;this._viewDate=t,this._selectDate(t.getDate(),!0)}_handleDone(e){e&&e.stopPropagation(),this.open=!1}_handleKeydown(e){if(!this.open)return void("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.open=!0));if("Escape"===e.key)return void(this.open=!1);const t=new Date(this._viewDate);let a=!0;switch(e.key){case"ArrowLeft":t.setDate(t.getDate()-1);break;case"ArrowRight":t.setDate(t.getDate()+1);break;case"ArrowUp":t.setDate(t.getDate()-7);break;case"ArrowDown":t.setDate(t.getDate()+7);break;case"Enter":const e=new Date(this._viewDate);this._isDisabled(e)||this._selectDate(this._viewDate.getDate(),!0);break;default:a=!1}a&&(e.preventDefault(),this._viewDate=t)}_parseDateStr(e){if(!e)return null;if(e instanceof Date)return e;if("number"==typeof e)return new Date(e);const t=String(e);return t.match(/^\d{4}-\d{2}-\d{2}$/),new Date(t)}_isDisabled(e){if(!e)return!1;const t=this._parseDateStr(this.min),a=this._parseDateStr(this.max),i=new Date(e.getFullYear(),e.getMonth(),e.getDate());return!!(t&&i<new Date(t.getFullYear(),t.getMonth(),t.getDate()))||!!(a&&i>new Date(a.getFullYear(),a.getMonth(),a.getDate()))}_selectDate(e,t){if(!t)return;const a=new Date(this._viewDate);"date"===this.mode&&a.setDate(e),this._isDisabled(a)||(this._selectedDate=a,this.value=a,this._inputValue=this._formatValue(a),this.showTime&&"date"===this.mode||(this.open=!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0})))}_selectMonth(e){const t=new Date(this._viewDate);t.setMonth(e),this._viewDate=t,this._selectedDate=t,this.value=t,this._inputValue=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_selectYear(e){const t=new Date(this._viewDate);t.setFullYear(e),this._viewDate=t,this._selectedDate=t,this.value=t,this._inputValue=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_renderCalendar(){const e=this._viewDate.getFullYear(),t=this._viewDate.getMonth(),a=this._viewDate.getDate(),i=Array.from({length:12},(e,t)=>{const a=new Date(2e3,t,1);return new Intl.DateTimeFormat(this.locale,{month:"long"}).format(a)});new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7)),new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7));let n=1;(this.locale.startsWith("en-US")||this.locale.startsWith("ja")||this.locale.startsWith("zh"))&&(n=0);const o=[];for(let s=0;s<7;s++){const e=new Date(2024,0,7+s+n);o.push(new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(e))}let l=(new Date(e,t,1).getDay()-n+7)%7;const c=new Date(e,t+1,0).getDate(),d=new Date(e,t,0).getDate(),h=[];for(let s=l-1;s>=0;s--)h.push({day:d-s,current:!1});for(let s=1;s<=c;s++)h.push({day:s,current:!0});const p=42-h.length;for(let s=1;s<=p;s++)h.push({day:s,current:!1});const u=/* @__PURE__ */(new Date).getFullYear(),g=[];for(let s=u-50;s<=u+50;s++)g.push(s);const m=/* @__PURE__ */new Date,v=a=>a===m.getDate()&&t===m.getMonth()&&e===m.getFullYear(),w=a=>!!this._selectedDate&&a===this._selectedDate.getDate()&&t===this._selectedDate.getMonth()&&e===this._selectedDate.getFullYear();return s`
2
2
  <div class="calendar-header">
3
3
  <button class="nav-btn" @click="${e=>{e.stopPropagation(),this._changeMonth(-1)}}">←</button>
4
4
  <div class="month-year">
@@ -1,4 +1,4 @@
1
- var e,i=Object.defineProperty;import{LitElement as r,css as t,html as s}from"lit";import{F as a}from"../chunks/FormAssociated-Cx5D8YQA.js";class l extends(a(r)){static get properties(){return{...super.properties,label:{type:String},placeholder:{type:String},accept:{type:String},multiple:{type:Boolean},hideChips:{type:Boolean,attribute:"hide-chips"},files:{type:Array,state:!0},_previews:{state:!0}}}constructor(){super(),this.placeholder="Dosya seçin...",this.accept="*",this.multiple=!1,this.hideChips=!1,this.files=[],this._previews=/* @__PURE__ */new Map}disconnectedCallback(){super.disconnectedCallback(),this._revokePreviews()}_updateFormValue(){if(this.files.length>0){const e=new FormData;this.files.forEach(i=>e.append(this.name,i)),this.internals.setFormValue(e)}else this.internals.setFormValue(null)}willUpdate(e){e.has("files")&&(this._updatePreviews(),this._updateFormValue())}_revokePreviews(){this._previews.forEach(e=>URL.revokeObjectURL(e)),this._previews.clear()}_updatePreviews(){this._revokePreviews();const e=/* @__PURE__ */new Map;this.files.forEach(i=>{i&&i.type&&i.type.startsWith("image/")&&e.set(i,URL.createObjectURL(i))}),this._previews=e}_handleFileChange(e){const i=Array.from(e.target.files);this._addFiles(i),e.target.value=""}_addFiles(e){this.disabled||0===e.length||(this.files=this.multiple?e:[e[0]],this._emitChange())}_removeFile(e){this.files=this.files.filter((i,r)=>r!==e),this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent("change",{detail:{files:this.files},bubbles:!0,composed:!0}))}_triggerUpload(){this.disabled||this.shadowRoot.querySelector("input").click()}_onDragOver(e){e.preventDefault(),this.disabled||this.shadowRoot.querySelector(".upload-wrapper").classList.add("active")}_onDragLeave(){this.shadowRoot.querySelector(".upload-wrapper").classList.remove("active")}_onDrop(e){if(e.preventDefault(),this._onDragLeave(),this.disabled)return;const i=Array.from(e.dataTransfer.files);this._addFiles(i)}render(){const e=this.files.length>0,i=e?this.multiple?`${this.files.length} Dosya Seçildi`:this.files[0].name:this.placeholder;return s`
1
+ var e,i=Object.defineProperty;import{LitElement as r,css as t,html as s}from"lit";import{F as a}from"../chunks/FormAssociated-jTk7w1I7.js";class l extends(a(r)){static get properties(){return{...super.properties,label:{type:String},placeholder:{type:String},accept:{type:String},multiple:{type:Boolean},hideChips:{type:Boolean,attribute:"hide-chips"},files:{type:Array,state:!0},_previews:{state:!0}}}constructor(){super(),this.placeholder="Dosya seçin...",this.accept="*",this.multiple=!1,this.hideChips=!1,this.files=[],this._previews=/* @__PURE__ */new Map}disconnectedCallback(){super.disconnectedCallback(),this._revokePreviews()}_updateFormValue(){if(this.files.length>0){const e=new FormData;this.files.forEach(i=>e.append(this.name,i)),this.internals.setFormValue(e)}else this.internals.setFormValue(null)}willUpdate(e){e.has("files")&&(this._updatePreviews(),this._updateFormValue())}_revokePreviews(){this._previews.forEach(e=>URL.revokeObjectURL(e)),this._previews.clear()}_updatePreviews(){this._revokePreviews();const e=/* @__PURE__ */new Map;this.files.forEach(i=>{i&&i.type&&i.type.startsWith("image/")&&e.set(i,URL.createObjectURL(i))}),this._previews=e}_handleFileChange(e){const i=Array.from(e.target.files);this._addFiles(i),e.target.value=""}_addFiles(e){this.disabled||0===e.length||(this.files=this.multiple?e:[e[0]],this._emitChange())}_removeFile(e){this.files=this.files.filter((i,r)=>r!==e),this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent("change",{detail:{files:this.files},bubbles:!0,composed:!0}))}_triggerUpload(){this.disabled||this.shadowRoot.querySelector("input").click()}_onDragOver(e){e.preventDefault(),this.disabled||this.shadowRoot.querySelector(".upload-wrapper").classList.add("active")}_onDragLeave(){this.shadowRoot.querySelector(".upload-wrapper").classList.remove("active")}_onDrop(e){if(e.preventDefault(),this._onDragLeave(),this.disabled)return;const i=Array.from(e.dataTransfer.files);this._addFiles(i)}render(){const e=this.files.length>0,i=e?this.multiple?`${this.files.length} Dosya Seçildi`:this.files[0].name:this.placeholder;return s`
2
2
  <div class="container">
3
3
  ${this.label?s`<label class="label">${this.label}</label>`:""}
4
4
 
@@ -1,4 +1,4 @@
1
- var e,t=Object.defineProperty;import{LitElement as i,css as r,html as o}from"lit";import{classMap as n}from"lit/directives/class-map.js";import{F as a}from"../chunks/FormAssociated-Cx5D8YQA.js";class s extends(a(i)){static get properties(){return{...super.properties,label:{type:String},placeholder:{type:String},loading:{type:Boolean},error:{type:Boolean},fullwidth:{type:Boolean,reflect:!0},inverted:{type:Boolean,reflect:!0},hasLeft:{type:Boolean,state:!0},hasRight:{type:Boolean,state:!0},_showPassword:{type:Boolean,state:!0},positive:{type:Boolean,reflect:!0},integer:{type:Boolean,reflect:!0}}}constructor(){super(),this.placeholder="",this.hasLeft=!1,this.hasRight=!1,this._showPassword=!1}_handleKeyDown(e){if("Enter"===e.key){const t=this.internals.form;if(t){const i=t.querySelector('kg-button[type="submit"], kg-button[is-default], button[type="submit"]');if(i)return i.tagName,i.click(),void e.preventDefault();t.requestSubmit()}}"number"===this.type&&("e"!==e.key&&"E"!==e.key&&(!this.positive||"-"!==e.key&&"_"!==e.key)&&(!this.integer||"."!==e.key&&","!==e.key)||e.preventDefault())}_handleInput(e){let t=e.target.value;"number"===this.type&&(this.integer?this.positive?t=t.replace(/\D/g,""):(t=t.replace(/[^\d-]/g,""),t.indexOf("-")>0&&(t=t.slice(0,t.indexOf("-"))+t.slice(t.indexOf("-")+1))):this.positive&&(t=t.replace(/-/g,"")),e.target.value!==t&&(e.target.value=t)),this.value=t,this.dispatchEvent(new CustomEvent("kg-input",{detail:{value:this.value},bubbles:!0,composed:!0}))}_handleSlotChange(e){const t=e.target;if(!t)return;const i=t.assignedNodes({flatten:!0}).some(e=>e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&e.textContent.trim().length>0);"left"===t.name&&(this.hasLeft=i),"right"===t.name&&(this.hasRight=i)}_togglePassword(){this._showPassword=!this._showPassword}render(){const e={"ui-input":!0,[this.size]:!!this.size,disabled:this.disabled,loading:this.loading,error:this.error||!!this.errorText,fullwidth:this.fullwidth,inverted:this.inverted},t="number"===this.type,i="password"===this.type?this._showPassword?"text":"password":t?"text":this.type,r="password"===this.type?this.hasRight?"5rem":"3rem":this.hasRight?"3rem":"1rem",a=t?this.integer?"numeric":"decimal":"";return o`
1
+ var e,t=Object.defineProperty;import{LitElement as i,css as r,html as o}from"lit";import{classMap as n}from"lit/directives/class-map.js";import{F as a}from"../chunks/FormAssociated-jTk7w1I7.js";class s extends(a(i)){static get properties(){return{...super.properties,label:{type:String},placeholder:{type:String},loading:{type:Boolean},error:{type:Boolean},fullwidth:{type:Boolean,reflect:!0},inverted:{type:Boolean,reflect:!0},hasLeft:{type:Boolean,state:!0},hasRight:{type:Boolean,state:!0},_showPassword:{type:Boolean,state:!0},positive:{type:Boolean,reflect:!0},integer:{type:Boolean,reflect:!0}}}constructor(){super(),this.placeholder="",this.hasLeft=!1,this.hasRight=!1,this._showPassword=!1}_handleKeyDown(e){"number"===this.type&&("e"!==e.key&&"E"!==e.key&&(!this.positive||"-"!==e.key&&"_"!==e.key)&&(!this.integer||"."!==e.key&&","!==e.key)||e.preventDefault())}_handleInput(e){let t=e.target.value;"number"===this.type&&(this.integer?this.positive?t=t.replace(/\D/g,""):(t=t.replace(/[^\d-]/g,""),t.indexOf("-")>0&&(t=t.slice(0,t.indexOf("-"))+t.slice(t.indexOf("-")+1))):this.positive&&(t=t.replace(/-/g,"")),e.target.value!==t&&(e.target.value=t)),this.value=t,this.dispatchEvent(new CustomEvent("kg-input",{detail:{value:this.value},bubbles:!0,composed:!0}))}_handleSlotChange(e){const t=e.target;if(!t)return;const i=t.assignedNodes({flatten:!0}).some(e=>e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&e.textContent.trim().length>0);"left"===t.name&&(this.hasLeft=i),"right"===t.name&&(this.hasRight=i)}_togglePassword(){this._showPassword=!this._showPassword}render(){const e={"ui-input":!0,[this.size]:!!this.size,disabled:this.disabled,loading:this.loading,error:this.error||!!this.errorText,fullwidth:this.fullwidth,inverted:this.inverted},t="number"===this.type,i="password"===this.type?this._showPassword?"text":"password":t?"text":this.type,r="password"===this.type?this.hasRight?"5rem":"3rem":this.hasRight?"3rem":"1rem",a=t?this.integer?"numeric":"decimal":"";return o`
2
2
  <div class="kg-input-container" style="--loading-offset: ${r}">
3
3
  ${this.label?o`<label class="input-label">${this.label}</label>`:""}
4
4
  <div class="${n(e)}">
@@ -1,4 +1,4 @@
1
- var e,t=Object.defineProperty;import{LitElement as r,css as o,html as i}from"lit";import{F as a}from"../chunks/FormAssociated-Cx5D8YQA.js";class l extends(a(r)){static get properties(){return{...super.properties,direction:{type:String},label:{type:String}}}constructor(){super(),this.direction="vertical",this.value="",this.addEventListener("kg-radio-select",this._handleRadioSelect)}_handleRadioSelect(e){const t=e.detail.value;this.value=t,this._updateChildren(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_updateChildren(){this.querySelectorAll("kg-radio").forEach(e=>{e.checked=e.value===this.value})}firstUpdated(){this._updateChildren()}updated(e){e.has("value")&&this._updateChildren()}_handleKeyDown(e){const t=Array.from(this.querySelectorAll("kg-radio:not([disabled])"));if(0===t.length)return;let r=t.findIndex(e=>e.checked);-1===r&&(r=0);let o=-1;"ArrowDown"===e.key||"ArrowRight"===e.key?o=(r+1)%t.length:"ArrowUp"!==e.key&&"ArrowLeft"!==e.key||(o=(r-1+t.length)%t.length),-1!==o&&(e.preventDefault(),t[o].focus(),setTimeout(()=>{t[o]._handleClick()},0))}render(){return i`
1
+ var e,t=Object.defineProperty;import{LitElement as r,css as o,html as i}from"lit";import{F as a}from"../chunks/FormAssociated-jTk7w1I7.js";class l extends(a(r)){static get properties(){return{...super.properties,direction:{type:String},label:{type:String}}}constructor(){super(),this.direction="vertical",this.value="",this.addEventListener("kg-radio-select",this._handleRadioSelect)}_handleRadioSelect(e){const t=e.detail.value;this.value=t,this._updateChildren(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_updateChildren(){this.querySelectorAll("kg-radio").forEach(e=>{e.checked=e.value===this.value})}firstUpdated(){this._updateChildren()}updated(e){e.has("value")&&this._updateChildren()}_handleKeyDown(e){const t=Array.from(this.querySelectorAll("kg-radio:not([disabled])"));if(0===t.length)return;let r=t.findIndex(e=>e.checked);-1===r&&(r=0);let o=-1;"ArrowDown"===e.key||"ArrowRight"===e.key?o=(r+1)%t.length:"ArrowUp"!==e.key&&"ArrowLeft"!==e.key||(o=(r-1+t.length)%t.length),-1!==o&&(e.preventDefault(),t[o].focus(),setTimeout(()=>{t[o]._handleClick()},0))}render(){return i`
2
2
  <div class="kg-radio-group">
3
3
  ${this.label?i`<span class="group-label">${this.label}</span>`:""}
4
4
  <div
@@ -1,4 +1,4 @@
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 a}from"lit";import{classMap as c}from"lit/directives/class-map.js";import{F as o}from"../chunks/FormAssociated-Cx5D8YQA.js";const s=class e extends(o(t)){constructor(){super(),this.checked=!1}_handleClick(){this.disabled||this.checked||(this.checked=!0,this._uncheckOthers(),this.dispatchEvent(new CustomEvent("kg-radio-select",{detail:{value:this.value},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{checked:!0},bubbles:!0,composed:!0})))}_uncheckOthers(){const r=this.name;r&&(this.internals.form||this.getRootNode()).querySelectorAll(`kg-radio[name="${r}"]`).forEach(r=>{r!==this&&r instanceof e&&(r.checked=!1)})}_updateFormValue(){const e=this.checked?this.value:null;this.internals.setFormValue(e,this.checked?"checked":"unchecked")}updated(e){e.has("checked")&&this._updateFormValue(),super.updated(e)}formResetCallback(){this.checked=this.hasAttribute("checked"),this._updateFormValue()}formStateRestoreCallback(e){"checked"===e?this.checked=!0:"unchecked"===e&&(this.checked=!1),this._updateFormValue()}render(){const e={"kg-radio-container":!0,checked:this.checked,disabled:this.disabled},r=this.color?`--radio-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 a`
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 a}from"lit";import{classMap as c}from"lit/directives/class-map.js";import{F as o}from"../chunks/FormAssociated-jTk7w1I7.js";const s=class e extends(o(t)){constructor(){super(),this.checked=!1}_handleClick(){this.disabled||this.checked||(this.checked=!0,this._uncheckOthers(),this.dispatchEvent(new CustomEvent("kg-radio-select",{detail:{value:this.value},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{checked:!0},bubbles:!0,composed:!0})))}_uncheckOthers(){const r=this.name;r&&(this.internals.form||this.getRootNode()).querySelectorAll(`kg-radio[name="${r}"]`).forEach(r=>{r!==this&&r instanceof e&&(r.checked=!1)})}_updateFormValue(){const e=this.checked?this.value:null;this.internals.setFormValue(e,this.checked?"checked":"unchecked")}updated(e){e.has("checked")&&this._updateFormValue(),super.updated(e)}formResetCallback(){this.checked=this.hasAttribute("checked"),this._updateFormValue()}formStateRestoreCallback(e){"checked"===e?this.checked=!0:"unchecked"===e&&(this.checked=!1),this._updateFormValue()}render(){const e={"kg-radio-container":!0,checked:this.checked,disabled:this.disabled},r=this.color?`--radio-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 a`
2
2
  <div
3
3
  class="${c(e)}"
4
4
  style="${r}"
@@ -1,4 +1,4 @@
1
- var e,t=Object.defineProperty;import{LitElement as r,css as i,html as s}from"lit";import"lit/directives/class-map.js";import{F as o}from"../chunks/FormAssociated-Cx5D8YQA.js";class a extends(o(r)){static get properties(){return{...super.properties,options:{type:Array},value:{type:Object},placeholder:{type:String},label:{type:String},multiple:{type:Boolean},searchable:{type:Boolean},clearable:{type:Boolean},_open:{type:Boolean,state:!0},_searchQuery:{type:String,state:!0}}}constructor(){super(),this.options=[],this.value=null,this.placeholder="Seçiniz...",this.multiple=!1,this.searchable=!1,this.clearable=!1,this._open=!1,this._searchQuery="",this._handleOutsideClick=this._handleOutsideClick.bind(this)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_updateFormValue(){if(this.multiple&&Array.isArray(this.value)){const e=new FormData;this.value.forEach(t=>e.append(this.name,t)),this.internals.setFormValue(e)}else this.internals.setFormValue(this.value)}_handleOutsideClick(e){this._open&&(e.composedPath().includes(this)||this._closeDropdown())}_toggleDropdown(e){this.disabled||(this._open=!this._open,this._open&&(this._searchQuery="",this._positionDropdown(),setTimeout(()=>{const e=this.shadowRoot.querySelector(".search-input");e&&e.focus()},100)))}_positionDropdown(){requestAnimationFrame(()=>{const e=this.shadowRoot.querySelector(".select-trigger"),t=this.shadowRoot.querySelector(".select-dropdown");if(!e||!t)return;const r=e.getBoundingClientRect();t.style.top="0px",t.style.left="0px";const i=t.getBoundingClientRect(),s=i.left,o=i.top;t.style.top=r.bottom+5-o+"px",t.style.left=r.left-s+"px",t.style.width=`${r.width}px`})}_closeDropdown(){this._open=!1}_selectOption(e,t){if(t.stopPropagation(),this.multiple){let t=Array.isArray(this.value)?[...this.value]:[];const r=t.indexOf(e.value);r>-1?t.splice(r,1):t.push(e.value),this.value=t}else this.value=e.value,this._closeDropdown();this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_clearValue(e){e.stopPropagation(),this.value=this.multiple?[]:null,this._dispatchChange(),this._open&&this._closeDropdown()}_handleSearch(e){this._searchQuery=e.target.value.toLowerCase()}_removeTag(e,t){t.stopPropagation();let r=[...this.value];const i=r.indexOf(e);i>-1&&(r.splice(i,1),this.value=r,this._dispatchChange())}render(){const e=e=>this.multiple&&Array.isArray(this.value)?this.value.includes(e):this.value===e,t=(()=>{if(!this.value)return null;if(this.multiple&&Array.isArray(this.value))return this.options.filter(e=>this.value.includes(e.value));const e=this.options.find(e=>e.value===this.value);return e?e.label:null})(),r=(this.options||[]).filter(e=>e.label.toLowerCase().includes(this._searchQuery||""));return s`
1
+ var e,t=Object.defineProperty;import{LitElement as r,css as i,html as s}from"lit";import"lit/directives/class-map.js";import{F as o}from"../chunks/FormAssociated-jTk7w1I7.js";class a extends(o(r)){static get properties(){return{...super.properties,options:{type:Array},value:{type:Object},placeholder:{type:String},label:{type:String},multiple:{type:Boolean},searchable:{type:Boolean},clearable:{type:Boolean},_open:{type:Boolean,state:!0},_searchQuery:{type:String,state:!0}}}constructor(){super(),this.options=[],this.value=null,this.placeholder="Seçiniz...",this.multiple=!1,this.searchable=!1,this.clearable=!1,this._open=!1,this._searchQuery="",this._handleOutsideClick=this._handleOutsideClick.bind(this)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_updateFormValue(){if(this.multiple&&Array.isArray(this.value)){const e=new FormData;this.value.forEach(t=>e.append(this.name,t)),this.internals.setFormValue(e)}else this.internals.setFormValue(this.value)}_handleOutsideClick(e){this._open&&(e.composedPath().includes(this)||this._closeDropdown())}_toggleDropdown(e){this.disabled||(this._open=!this._open,this._open&&(this._searchQuery="",this._positionDropdown(),setTimeout(()=>{const e=this.shadowRoot.querySelector(".search-input");e&&e.focus()},100)))}_positionDropdown(){requestAnimationFrame(()=>{const e=this.shadowRoot.querySelector(".select-trigger"),t=this.shadowRoot.querySelector(".select-dropdown");if(!e||!t)return;const r=e.getBoundingClientRect();t.style.top="0px",t.style.left="0px";const i=t.getBoundingClientRect(),s=i.left,o=i.top;t.style.top=r.bottom+5-o+"px",t.style.left=r.left-s+"px",t.style.width=`${r.width}px`})}_closeDropdown(){this._open=!1}_selectOption(e,t){if(t.stopPropagation(),this.multiple){let t=Array.isArray(this.value)?[...this.value]:[];const r=t.indexOf(e.value);r>-1?t.splice(r,1):t.push(e.value),this.value=t}else this.value=e.value,this._closeDropdown();this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_clearValue(e){e.stopPropagation(),this.value=this.multiple?[]:null,this._dispatchChange(),this._open&&this._closeDropdown()}_handleSearch(e){this._searchQuery=e.target.value.toLowerCase()}_removeTag(e,t){t.stopPropagation();let r=[...this.value];const i=r.indexOf(e);i>-1&&(r.splice(i,1),this.value=r,this._dispatchChange())}render(){const e=e=>this.multiple&&Array.isArray(this.value)?this.value.includes(e):this.value===e,t=(()=>{if(!this.value)return null;if(this.multiple&&Array.isArray(this.value))return this.options.filter(e=>this.value.includes(e.value));const e=this.options.find(e=>e.value===this.value);return e?e.label:null})(),r=(this.options||[]).filter(e=>e.label.toLowerCase().includes(this._searchQuery||""));return s`
2
2
  <div class="kg-select-container">
3
3
  ${this.label?s`<label class="select-label">${this.label}</label>`:""}
4
4
 
@@ -1,4 +1,4 @@
1
- var e,r=Object.defineProperty;import{LitElement as t,css as i,html as a}from"lit";import{F as s}from"../chunks/FormAssociated-Cx5D8YQA.js";class n extends(s(t)){static get properties(){return{...super.properties,min:{type:Number},max:{type:Number},step:{type:Number},label:{type:String},color:{type:String},hideValue:{type:Boolean,reflect:!0,attribute:"hide-value"},showPins:{type:Boolean,attribute:"show-pins"}}}constructor(){super(),this.min=0,this.max=100,this.step=1,this.value=50,this.hideValue=!1,this.showPins=!1}_handleInput(e){this.value=Number(e.target.value),this.dispatchEvent(new CustomEvent("kg-input",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e=(this.value-this.min)/(this.max-this.min)*100,r=`--slider-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 a`
1
+ var e,r=Object.defineProperty;import{LitElement as t,css as i,html as a}from"lit";import{F as s}from"../chunks/FormAssociated-jTk7w1I7.js";class n extends(s(t)){static get properties(){return{...super.properties,min:{type:Number},max:{type:Number},step:{type:Number},label:{type:String},color:{type:String},hideValue:{type:Boolean,reflect:!0,attribute:"hide-value"},showPins:{type:Boolean,attribute:"show-pins"}}}constructor(){super(),this.min=0,this.max=100,this.step=1,this.value=50,this.hideValue=!1,this.showPins=!1}_handleInput(e){this.value=Number(e.target.value),this.dispatchEvent(new CustomEvent("kg-input",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e=(this.value-this.min)/(this.max-this.min)*100,r=`--slider-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 a`
2
2
  <div class="kg-slider-container ${this.disabled?"disabled":""} ${this.errorText?"error":""}" style="${r}">
3
3
  <div class="slider-header">
4
4
  ${this.label?a`<label class="slider-label">${this.label}</label>`:""}
@@ -1,4 +1,4 @@
1
- var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);import{LitElement as s,css as r,html as i}from"lit";import"lit/directives/class-map.js";import{F as a}from"../chunks/FormAssociated-Cx5D8YQA.js";class o extends(a(s)){static get properties(){return{...super.properties,checked:{type:Boolean,reflect:!0},label:{type:String},leftLabel:{type:String},rightLabel:{type:String},color:{type:String}}}constructor(){super(),this.checked=!1,this.color="primary",this.label="",this.leftLabel="",this.rightLabel="",this.value="on"}formResetCallback(){this.checked=this.hasAttribute("checked"),this._updateFormValue()}formStateRestoreCallback(e){"checked"===e?this.checked=!0:"unchecked"===e&&(this.checked=!1),this._updateFormValue()}updated(e){e.has("checked")&&this._updateFormValue(),super.updated(e)}_updateFormValue(){const e=this.checked?this.value||"on":null;this.internals.setFormValue(e,this.checked?"checked":"unchecked")}_toggle(){this.disabled||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0,composed:!0})))}render(){const e=(s=this.color)&&"primary"!==s?s.startsWith("#")||s.startsWith("rgb")||s.startsWith("hsl")?s:{secondary:"var(--kg-secondary)",tertiary:"var(--kg-tertiary)",error:"#e74c3c",red:"#e74c3c",green:"#2ecc71",blue:"#3498db",orange:"#f39c12",purple:"#9b59b6"}[s]||`var(--kg-${s}, ${s})`:"var(--kg-primary)",t=this.checked?`--switch-active-color: ${e};`:"";var s;return i`
1
+ var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);import{LitElement as s,css as r,html as i}from"lit";import"lit/directives/class-map.js";import{F as a}from"../chunks/FormAssociated-jTk7w1I7.js";class o extends(a(s)){static get properties(){return{...super.properties,checked:{type:Boolean,reflect:!0},label:{type:String},leftLabel:{type:String},rightLabel:{type:String},color:{type:String}}}constructor(){super(),this.checked=!1,this.color="primary",this.label="",this.leftLabel="",this.rightLabel="",this.value="on"}formResetCallback(){this.checked=this.hasAttribute("checked"),this._updateFormValue()}formStateRestoreCallback(e){"checked"===e?this.checked=!0:"unchecked"===e&&(this.checked=!1),this._updateFormValue()}updated(e){e.has("checked")&&this._updateFormValue(),super.updated(e)}_updateFormValue(){const e=this.checked?this.value||"on":null;this.internals.setFormValue(e,this.checked?"checked":"unchecked")}_toggle(){this.disabled||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0,composed:!0})))}render(){const e=(s=this.color)&&"primary"!==s?s.startsWith("#")||s.startsWith("rgb")||s.startsWith("hsl")?s:{secondary:"var(--kg-secondary)",tertiary:"var(--kg-tertiary)",error:"#e74c3c",red:"#e74c3c",green:"#2ecc71",blue:"#3498db",orange:"#f39c12",purple:"#9b59b6"}[s]||`var(--kg-${s}, ${s})`:"var(--kg-primary)",t=this.checked?`--switch-active-color: ${e};`:"";var s;return i`
2
2
  <div style="position: relative; display: inline-block;">
3
3
  <div
4
4
  class="kg-switch-wrapper ${this.errorText?"error":""}"
@@ -1,4 +1,4 @@
1
- var e,t=Object.defineProperty;import{LitElement as r,css as a,html as i}from"lit";import{classMap as o}from"lit/directives/class-map.js";import{F as l}from"../chunks/FormAssociated-Cx5D8YQA.js";class s extends(l(r)){static get properties(){return{...super.properties,label:{type:String},placeholder:{type:String},rows:{type:Number},error:{type:Boolean,reflect:!0},fullwidth:{type:Boolean,reflect:!0},inverted:{type:Boolean,reflect:!0},resize:{type:String,reflect:!0}}}constructor(){super(),this.placeholder="",this.rows=3,this.error=!1,this.fullwidth=!1,this.inverted=!1,this.resize="vertical"}_handleInput(e){this.value=e.target.value,this.dispatchEvent(new CustomEvent("kg-input",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e={"ui-textarea":!0,disabled:this.disabled,error:this.error||!!this.errorText,fullwidth:this.fullwidth,inverted:this.inverted};return i`
1
+ var e,t=Object.defineProperty;import{LitElement as r,css as a,html as i}from"lit";import{classMap as o}from"lit/directives/class-map.js";import{F as l}from"../chunks/FormAssociated-jTk7w1I7.js";class s extends(l(r)){static get properties(){return{...super.properties,label:{type:String},placeholder:{type:String},rows:{type:Number},error:{type:Boolean,reflect:!0},fullwidth:{type:Boolean,reflect:!0},inverted:{type:Boolean,reflect:!0},resize:{type:String,reflect:!0}}}constructor(){super(),this.placeholder="",this.rows=3,this.error=!1,this.fullwidth=!1,this.inverted=!1,this.resize="vertical"}_handleInput(e){this.value=e.target.value,this.dispatchEvent(new CustomEvent("kg-input",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){const e={"ui-textarea":!0,disabled:this.disabled,error:this.error||!!this.errorText,fullwidth:this.fullwidth,inverted:this.inverted};return i`
2
2
  <div class="kg-textarea-container">
3
3
  ${this.label?i`<label class="textarea-label">${this.label}</label>`:""}
4
4
  <div class="${o(e)}">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazhus/kg-ui",
3
- "version": "0.9.16",
3
+ "version": "0.9.17",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1 +0,0 @@
1
- import{isServer as t}from"lit";const e=e=>class extends e{static get properties(){return{name:{type:String},value:{type:String},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},type:{type:String},errorText:{type:String,attribute:"error-text"}}}static get formAssociated(){return!0}constructor(){super(),this.name="",this.value="",this.disabled=!1,this.required=!1,this.type="text",!t&&this.attachInternals&&(this.internals=this.attachInternals())}get form(){return this.internals?this.internals.form:null}updated(t){super.updated(t),(t.has("value")||t.has("disabled"))&&this._updateFormValue()}_updateFormValue(){!t&&this.internals&&this.internals.setFormValue(this.value)}formResetCallback(){this.value=this.getAttribute("value")||""}formStateRestoreCallback(t){this.value=t}setValidity(e,i,r){!t&&this.internals&&this.internals.setValidity(e,i,r)}checkValidity(){return!this.internals||this.internals.checkValidity()}reportValidity(){return!this.internals||this.internals.reportValidity()}};export{e as F};