@lazhus/kg-ui 0.9.16 → 0.9.18

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": [
@@ -1540,6 +1606,38 @@
1540
1606
  }
1541
1607
  ]
1542
1608
  },
1609
+ {
1610
+ "kind": "method",
1611
+ "name": "_getMaxDepth",
1612
+ "parameters": [
1613
+ {
1614
+ "name": "columns"
1615
+ }
1616
+ ]
1617
+ },
1618
+ {
1619
+ "kind": "method",
1620
+ "name": "_getLeafCount",
1621
+ "parameters": [
1622
+ {
1623
+ "name": "column"
1624
+ }
1625
+ ]
1626
+ },
1627
+ {
1628
+ "kind": "method",
1629
+ "name": "_getLeafColumns",
1630
+ "parameters": [
1631
+ {
1632
+ "name": "columns",
1633
+ "default": "this.columns"
1634
+ }
1635
+ ]
1636
+ },
1637
+ {
1638
+ "kind": "method",
1639
+ "name": "_getHeaderRows"
1640
+ },
1543
1641
  {
1544
1642
  "kind": "method",
1545
1643
  "name": "render"
@@ -2079,6 +2177,20 @@
2079
2177
  "module": "src/mixins/FormAssociated.js"
2080
2178
  }
2081
2179
  },
2180
+ {
2181
+ "kind": "method",
2182
+ "name": "_handleFormKeyDown",
2183
+ "parameters": [
2184
+ {
2185
+ "name": "e"
2186
+ }
2187
+ ],
2188
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
2189
+ "inheritedFrom": {
2190
+ "name": "FormAssociated",
2191
+ "module": "src/mixins/FormAssociated.js"
2192
+ }
2193
+ },
2082
2194
  {
2083
2195
  "kind": "field",
2084
2196
  "name": "form",
@@ -2192,6 +2304,14 @@
2192
2304
  "name": "FormAssociated",
2193
2305
  "module": "src/mixins/FormAssociated.js"
2194
2306
  }
2307
+ },
2308
+ {
2309
+ "kind": "field",
2310
+ "name": "_boundFormKeyDown",
2311
+ "inheritedFrom": {
2312
+ "name": "FormAssociated",
2313
+ "module": "src/mixins/FormAssociated.js"
2314
+ }
2195
2315
  }
2196
2316
  ],
2197
2317
  "events": [
@@ -2624,6 +2744,20 @@
2624
2744
  "module": "src/mixins/FormAssociated.js"
2625
2745
  }
2626
2746
  },
2747
+ {
2748
+ "kind": "method",
2749
+ "name": "_handleFormKeyDown",
2750
+ "parameters": [
2751
+ {
2752
+ "name": "e"
2753
+ }
2754
+ ],
2755
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
2756
+ "inheritedFrom": {
2757
+ "name": "FormAssociated",
2758
+ "module": "src/mixins/FormAssociated.js"
2759
+ }
2760
+ },
2627
2761
  {
2628
2762
  "kind": "field",
2629
2763
  "name": "form",
@@ -2761,6 +2895,14 @@
2761
2895
  "name": "FormAssociated",
2762
2896
  "module": "src/mixins/FormAssociated.js"
2763
2897
  }
2898
+ },
2899
+ {
2900
+ "kind": "field",
2901
+ "name": "_boundFormKeyDown",
2902
+ "inheritedFrom": {
2903
+ "name": "FormAssociated",
2904
+ "module": "src/mixins/FormAssociated.js"
2905
+ }
2764
2906
  }
2765
2907
  ],
2766
2908
  "events": [
@@ -3149,6 +3291,20 @@
3149
3291
  "module": "src/mixins/FormAssociated.js"
3150
3292
  }
3151
3293
  },
3294
+ {
3295
+ "kind": "method",
3296
+ "name": "_handleFormKeyDown",
3297
+ "parameters": [
3298
+ {
3299
+ "name": "e"
3300
+ }
3301
+ ],
3302
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
3303
+ "inheritedFrom": {
3304
+ "name": "FormAssociated",
3305
+ "module": "src/mixins/FormAssociated.js"
3306
+ }
3307
+ },
3152
3308
  {
3153
3309
  "kind": "field",
3154
3310
  "name": "form",
@@ -3294,6 +3450,14 @@
3294
3450
  "name": "FormAssociated",
3295
3451
  "module": "src/mixins/FormAssociated.js"
3296
3452
  }
3453
+ },
3454
+ {
3455
+ "kind": "field",
3456
+ "name": "_boundFormKeyDown",
3457
+ "inheritedFrom": {
3458
+ "name": "FormAssociated",
3459
+ "module": "src/mixins/FormAssociated.js"
3460
+ }
3297
3461
  }
3298
3462
  ],
3299
3463
  "events": [
@@ -3976,6 +4140,20 @@
3976
4140
  "module": "src/mixins/FormAssociated.js"
3977
4141
  }
3978
4142
  },
4143
+ {
4144
+ "kind": "method",
4145
+ "name": "_handleFormKeyDown",
4146
+ "parameters": [
4147
+ {
4148
+ "name": "e"
4149
+ }
4150
+ ],
4151
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
4152
+ "inheritedFrom": {
4153
+ "name": "FormAssociated",
4154
+ "module": "src/mixins/FormAssociated.js"
4155
+ }
4156
+ },
3979
4157
  {
3980
4158
  "kind": "field",
3981
4159
  "name": "form",
@@ -4096,6 +4274,14 @@
4096
4274
  "name": "FormAssociated",
4097
4275
  "module": "src/mixins/FormAssociated.js"
4098
4276
  }
4277
+ },
4278
+ {
4279
+ "kind": "field",
4280
+ "name": "_boundFormKeyDown",
4281
+ "inheritedFrom": {
4282
+ "name": "FormAssociated",
4283
+ "module": "src/mixins/FormAssociated.js"
4284
+ }
4099
4285
  }
4100
4286
  ],
4101
4287
  "events": [
@@ -4249,6 +4435,20 @@
4249
4435
  "module": "src/mixins/FormAssociated.js"
4250
4436
  }
4251
4437
  },
4438
+ {
4439
+ "kind": "method",
4440
+ "name": "_handleFormKeyDown",
4441
+ "parameters": [
4442
+ {
4443
+ "name": "e"
4444
+ }
4445
+ ],
4446
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
4447
+ "inheritedFrom": {
4448
+ "name": "FormAssociated",
4449
+ "module": "src/mixins/FormAssociated.js"
4450
+ }
4451
+ },
4252
4452
  {
4253
4453
  "kind": "field",
4254
4454
  "name": "form",
@@ -4352,6 +4552,14 @@
4352
4552
  "name": "FormAssociated",
4353
4553
  "module": "src/mixins/FormAssociated.js"
4354
4554
  }
4555
+ },
4556
+ {
4557
+ "kind": "field",
4558
+ "name": "_boundFormKeyDown",
4559
+ "inheritedFrom": {
4560
+ "name": "FormAssociated",
4561
+ "module": "src/mixins/FormAssociated.js"
4562
+ }
4355
4563
  }
4356
4564
  ],
4357
4565
  "events": [
@@ -4668,6 +4876,20 @@
4668
4876
  "module": "src/mixins/FormAssociated.js"
4669
4877
  }
4670
4878
  },
4879
+ {
4880
+ "kind": "method",
4881
+ "name": "_handleFormKeyDown",
4882
+ "parameters": [
4883
+ {
4884
+ "name": "e"
4885
+ }
4886
+ ],
4887
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
4888
+ "inheritedFrom": {
4889
+ "name": "FormAssociated",
4890
+ "module": "src/mixins/FormAssociated.js"
4891
+ }
4892
+ },
4671
4893
  {
4672
4894
  "kind": "field",
4673
4895
  "name": "form",
@@ -4793,6 +5015,14 @@
4793
5015
  "name": "FormAssociated",
4794
5016
  "module": "src/mixins/FormAssociated.js"
4795
5017
  }
5018
+ },
5019
+ {
5020
+ "kind": "field",
5021
+ "name": "_boundFormKeyDown",
5022
+ "inheritedFrom": {
5023
+ "name": "FormAssociated",
5024
+ "module": "src/mixins/FormAssociated.js"
5025
+ }
4796
5026
  }
4797
5027
  ],
4798
5028
  "events": [
@@ -5032,6 +5262,20 @@
5032
5262
  "module": "src/mixins/FormAssociated.js"
5033
5263
  }
5034
5264
  },
5265
+ {
5266
+ "kind": "method",
5267
+ "name": "_handleFormKeyDown",
5268
+ "parameters": [
5269
+ {
5270
+ "name": "e"
5271
+ }
5272
+ ],
5273
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
5274
+ "inheritedFrom": {
5275
+ "name": "FormAssociated",
5276
+ "module": "src/mixins/FormAssociated.js"
5277
+ }
5278
+ },
5035
5279
  {
5036
5280
  "kind": "field",
5037
5281
  "name": "form",
@@ -5165,6 +5409,14 @@
5165
5409
  "name": "FormAssociated",
5166
5410
  "module": "src/mixins/FormAssociated.js"
5167
5411
  }
5412
+ },
5413
+ {
5414
+ "kind": "field",
5415
+ "name": "_boundFormKeyDown",
5416
+ "inheritedFrom": {
5417
+ "name": "FormAssociated",
5418
+ "module": "src/mixins/FormAssociated.js"
5419
+ }
5168
5420
  }
5169
5421
  ],
5170
5422
  "events": [
@@ -5539,6 +5791,20 @@
5539
5791
  "module": "src/mixins/FormAssociated.js"
5540
5792
  }
5541
5793
  },
5794
+ {
5795
+ "kind": "method",
5796
+ "name": "_handleFormKeyDown",
5797
+ "parameters": [
5798
+ {
5799
+ "name": "e"
5800
+ }
5801
+ ],
5802
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
5803
+ "inheritedFrom": {
5804
+ "name": "FormAssociated",
5805
+ "module": "src/mixins/FormAssociated.js"
5806
+ }
5807
+ },
5542
5808
  {
5543
5809
  "kind": "field",
5544
5810
  "name": "form",
@@ -5630,6 +5896,14 @@
5630
5896
  "name": "FormAssociated",
5631
5897
  "module": "src/mixins/FormAssociated.js"
5632
5898
  }
5899
+ },
5900
+ {
5901
+ "kind": "field",
5902
+ "name": "_boundFormKeyDown",
5903
+ "inheritedFrom": {
5904
+ "name": "FormAssociated",
5905
+ "module": "src/mixins/FormAssociated.js"
5906
+ }
5633
5907
  }
5634
5908
  ],
5635
5909
  "events": [
@@ -6159,6 +6433,20 @@
6159
6433
  "module": "src/mixins/FormAssociated.js"
6160
6434
  }
6161
6435
  },
6436
+ {
6437
+ "kind": "method",
6438
+ "name": "_handleFormKeyDown",
6439
+ "parameters": [
6440
+ {
6441
+ "name": "e"
6442
+ }
6443
+ ],
6444
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it.",
6445
+ "inheritedFrom": {
6446
+ "name": "FormAssociated",
6447
+ "module": "src/mixins/FormAssociated.js"
6448
+ }
6449
+ },
6162
6450
  {
6163
6451
  "kind": "field",
6164
6452
  "name": "form",
@@ -6304,6 +6592,14 @@
6304
6592
  "name": "FormAssociated",
6305
6593
  "module": "src/mixins/FormAssociated.js"
6306
6594
  }
6595
+ },
6596
+ {
6597
+ "kind": "field",
6598
+ "name": "_boundFormKeyDown",
6599
+ "inheritedFrom": {
6600
+ "name": "FormAssociated",
6601
+ "module": "src/mixins/FormAssociated.js"
6602
+ }
6307
6603
  }
6308
6604
  ],
6309
6605
  "events": [
@@ -6620,6 +6916,16 @@
6620
6916
  "static": true,
6621
6917
  "readonly": true
6622
6918
  },
6919
+ {
6920
+ "kind": "method",
6921
+ "name": "_handleFormKeyDown",
6922
+ "parameters": [
6923
+ {
6924
+ "name": "e"
6925
+ }
6926
+ ],
6927
+ "description": "When Enter is pressed inside any form-associated component,\nfind the closest form and submit it."
6928
+ },
6623
6929
  {
6624
6930
  "kind": "field",
6625
6931
  "name": "form",
@@ -6713,6 +7019,10 @@
6713
7019
  "text": "string"
6714
7020
  },
6715
7021
  "default": "'text'"
7022
+ },
7023
+ {
7024
+ "kind": "field",
7025
+ "name": "_boundFormKeyDown"
6716
7026
  }
6717
7027
  ],
6718
7028
  "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,35 +1,39 @@
1
- var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s)(t,"symbol"!=typeof i?i+"":i,s);import{LitElement as i,css as s,html as a}from"lit";import"lit/directives/class-map.js";import"./kg-checkbox.js";import"./kg-radio.js";import{unsafeHTML as r}from"lit/directives/unsafe-html.js";import"./kg-button.js";import"./kg-skeleton.js";class o extends i{constructor(){super(),this.columns=[],this.data=[],this.loading=!1,this.striped=!1,this.bordered=!1,this.hover=!0,this.selectable=!1,this.selectionMode="multiple",this.selectedRows=[],this.sortable=!1,this.pagination=!1,this.pageSize=10,this.pageSizeOptions=[10,20,50,100],this.total=0,this.serverSide=!1,this.currentPage=1,this._sortColumn=null,this._sortDirection=null}_handleSelectAll(e){if(!this.selectable||"single"===this.selectionMode)return;const t=e.detail.checked;this.selectedRows=t?[...this.data]:[],this._emitSelectionChange()}_handleRowSelect(e,t){if(this.selectable)if(t.stopPropagation(),"single"===this.selectionMode)this._isSelected(e)||(this.selectedRows=[e],this._emitSelectionChange());else{let i;i="change"===t.type&&void 0!==t.detail&&void 0!==t.detail.checked?t.detail.checked:!this._isSelected(e),this.selectedRows=i?[...this.selectedRows,e]:this.selectedRows.filter(t=>t!==e),this._emitSelectionChange()}}_isSelected(e){return this.selectedRows.includes(e)}_emitSelectionChange(){this.dispatchEvent(new CustomEvent("selection-change",{detail:{selectedRows:this.selectedRows},bubbles:!0,composed:!0}))}_handleSort(e){(e.sortable||this.sortable)&&(this._sortColumn===e.field?this._sortDirection="asc"===this._sortDirection?"desc":"asc":(this._sortColumn=e.field,this._sortDirection="asc"),this.dispatchEvent(new CustomEvent("sort",{detail:{column:this._sortColumn,direction:this._sortDirection},bubbles:!0,composed:!0})))}_getProcessedData(){if(this.serverSide)return{data:this.data,total:this.total||this.data.length};let e=[...this.data];if(this._sortColumn&&e.sort((e,t)=>{const i=e[this._sortColumn],s=t[this._sortColumn];return i<s?"asc"===this._sortDirection?-1:1:i>s?"asc"===this._sortDirection?1:-1:0}),this.pagination){const t=(this.currentPage-1)*this.pageSize,i=t+this.pageSize;return{data:e.slice(t,i),total:e.length}}return{data:e,total:e.length}}_changePage(e){if(e<1)return;const t=this.serverSide&&this.total||this.data.length;e>Math.ceil(t/this.pageSize)||(this.currentPage=e,this.dispatchEvent(new CustomEvent("page-change",{detail:{page:this.currentPage,pageSize:this.pageSize},bubbles:!0,composed:!0})))}_handlePageSizeChange(e){const t=parseInt(e.target.value);this.pageSize=t,this.currentPage=1,this.dispatchEvent(new CustomEvent("page-size-change",{detail:{pageSize:t,page:1},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("page-change",{detail:{page:1,pageSize:t},bubbles:!0,composed:!0}))}_renderCellContent(e,t){if(!e.render)return t[e.field];const i=e.render(t);return"string"==typeof i?r(i):i}_renderHeaderContent(e){if(e.headerRender){const t=e.headerRender(e);return"string"==typeof t?r(t):t}return e.label}render(){const{data:e,total:t}=this._getProcessedData(),i=this.pagination?Math.ceil(t/this.pageSize):1,s=this.data.length>0&&this.selectedRows.length===this.data.length,r="single"===this.selectionMode,o=(()=>{const e=[],t=this.currentPage-2,s=this.currentPage+2+1;for(let a=1;a<=i;a++)(1===a||a===i||a>=t&&a<s)&&e.push(a);return e})();return a`
1
+ var e=Object.defineProperty,t=(t,i,r)=>((t,i,r)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r)(t,"symbol"!=typeof i?i+"":i,r);import{LitElement as i,css as r,html as a}from"lit";import"lit/directives/class-map.js";import"./kg-checkbox.js";import"./kg-radio.js";import{unsafeHTML as s}from"lit/directives/unsafe-html.js";import"./kg-button.js";import"./kg-skeleton.js";class o extends i{constructor(){super(),this.columns=[],this.data=[],this.loading=!1,this.striped=!1,this.bordered=!1,this.hover=!0,this.selectable=!1,this.selectionMode="multiple",this.selectedRows=[],this.sortable=!1,this.pagination=!1,this.pageSize=10,this.pageSizeOptions=[10,20,50,100],this.total=0,this.serverSide=!1,this.currentPage=1,this._sortColumn=null,this._sortDirection=null}_handleSelectAll(e){if(!this.selectable||"single"===this.selectionMode)return;const t=e.detail.checked;this.selectedRows=t?[...this.data]:[],this._emitSelectionChange()}_handleRowSelect(e,t){if(this.selectable)if(t.stopPropagation(),"single"===this.selectionMode)this._isSelected(e)||(this.selectedRows=[e],this._emitSelectionChange());else{let i;i="change"===t.type&&void 0!==t.detail&&void 0!==t.detail.checked?t.detail.checked:!this._isSelected(e),this.selectedRows=i?[...this.selectedRows,e]:this.selectedRows.filter(t=>t!==e),this._emitSelectionChange()}}_isSelected(e){return this.selectedRows.includes(e)}_emitSelectionChange(){this.dispatchEvent(new CustomEvent("selection-change",{detail:{selectedRows:this.selectedRows},bubbles:!0,composed:!0}))}_handleSort(e){(e.sortable||this.sortable)&&(this._sortColumn===e.field?this._sortDirection="asc"===this._sortDirection?"desc":"asc":(this._sortColumn=e.field,this._sortDirection="asc"),this.dispatchEvent(new CustomEvent("sort",{detail:{column:this._sortColumn,direction:this._sortDirection},bubbles:!0,composed:!0})))}_getProcessedData(){if(this.serverSide)return{data:this.data,total:this.total||this.data.length};let e=[...this.data];if(this._sortColumn&&e.sort((e,t)=>{const i=e[this._sortColumn],r=t[this._sortColumn];return i<r?"asc"===this._sortDirection?-1:1:i>r?"asc"===this._sortDirection?1:-1:0}),this.pagination){const t=(this.currentPage-1)*this.pageSize,i=t+this.pageSize;return{data:e.slice(t,i),total:e.length}}return{data:e,total:e.length}}_changePage(e){if(e<1)return;const t=this.serverSide&&this.total||this.data.length;e>Math.ceil(t/this.pageSize)||(this.currentPage=e,this.dispatchEvent(new CustomEvent("page-change",{detail:{page:this.currentPage,pageSize:this.pageSize},bubbles:!0,composed:!0})))}_handlePageSizeChange(e){const t=parseInt(e.target.value);this.pageSize=t,this.currentPage=1,this.dispatchEvent(new CustomEvent("page-size-change",{detail:{pageSize:t,page:1},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("page-change",{detail:{page:1,pageSize:t},bubbles:!0,composed:!0}))}_renderCellContent(e,t){if(!e.render)return t[e.field];const i=e.render(t);return"string"==typeof i?s(i):i}_renderHeaderContent(e){if(e.headerRender){const t=e.headerRender(e);return"string"==typeof t?s(t):t}return e.label}_getMaxDepth(e){if(!e||0===e.length)return 1;let t=0;const i=(e,r)=>{t=Math.max(t,r),e.forEach(e=>{e.children&&e.children.length>0&&i(e.children,r+1)})};return i(e,1),t}_getLeafCount(e){return e.children&&0!==e.children.length?e.children.reduce((e,t)=>e+this._getLeafCount(t),0):1}_getLeafColumns(e=this.columns){if(!e)return[];const t=[],i=e=>{e.forEach(e=>{e.children&&e.children.length>0?i(e.children):t.push(e)})};return i(e),t}_getHeaderRows(){const e=this._getMaxDepth(this.columns),t=Array.from({length:e},()=>[]),i=(r,a)=>{r.forEach(r=>{const s=!r.children||0===r.children.length,o=this._getLeafCount(r),n=s?e-a:1;t[a].push({...r,colspan:o,rowspan:n}),r.children&&i(r.children,a+1)})};return i(this.columns,0),t}render(){const{data:e,total:t}=this._getProcessedData(),i=this.pagination?Math.ceil(t/this.pageSize):1,r=this.data.length>0&&this.selectedRows.length===this.data.length,s="single"===this.selectionMode,o=this._getHeaderRows(),n=o.length,l=this._getLeafColumns(),d=(()=>{const e=[],t=this.currentPage-2,r=this.currentPage+2+1;for(let a=1;a<=i;a++)(1===a||a===i||a>=t&&a<r)&&e.push(a);return e})();return a`
2
2
  <div class="wrapper">
3
3
  <div class="table-container">
4
4
  <table>
5
5
  <thead>
6
- <tr>
7
- ${this.selectable?a`
8
- <th class="checkbox-cell">
9
- ${r?"":a`
10
- <kg-checkbox
11
- .checked="${s}"
12
- @change="${this._handleSelectAll}"
13
- ></kg-checkbox>
14
- `}
15
- </th>
16
- `:""}
17
-
18
- ${this.columns.map(e=>a`
19
- <th
20
- class="${e.sortable||this.sortable?"sortable":""} ${e.align?`align-${e.align}`:""} ${this._sortColumn===e.field?"active-sort":""}"
21
- style="${e.width?`width: ${e.width}; min-width: ${e.width}; max-width: ${e.width};`:""}"
22
- @click="${()=>this._handleSort(e)}"
23
- >
24
- ${this._renderHeaderContent(e)}
25
- ${e.sortable||this.sortable?a`
26
- <span class="sort-icon">
27
- ${this._sortColumn===e.field?"asc"===this._sortDirection?"▲":"▼":"⇅"}
28
- </span>
29
- `:""}
30
- </th>
31
- `)}
32
- </tr>
6
+ ${o.map((e,t)=>a`
7
+ <tr>
8
+ ${0===t&&this.selectable?a`
9
+ <th class="checkbox-cell" rowspan="${n}">
10
+ ${s?"":a`
11
+ <kg-checkbox
12
+ .checked="${r}"
13
+ @change="${this._handleSelectAll}"
14
+ ></kg-checkbox>
15
+ `}
16
+ </th>
17
+ `:""}
18
+
19
+ ${e.map(e=>a`
20
+ <th
21
+ colspan="${e.colspan}"
22
+ rowspan="${e.rowspan}"
23
+ class="${e.sortable||this.sortable?"sortable":""} ${e.align?`align-${e.align}`:""} ${this._sortColumn===e.field?"active-sort":""}"
24
+ style="${e.width?`width: ${e.width}; min-width: ${e.width}; max-width: ${e.width};`:""}"
25
+ @click="${()=>e.children?null:this._handleSort(e)}"
26
+ >
27
+ ${this._renderHeaderContent(e)}
28
+ ${!e.sortable&&!this.sortable||e.children?"":a`
29
+ <span class="sort-icon">
30
+ ${this._sortColumn===e.field?"asc"===this._sortDirection?"▲":"▼":"⇅"}
31
+ </span>
32
+ `}
33
+ </th>
34
+ `)}
35
+ </tr>
36
+ `)}
33
37
  </thead>
34
38
  <tbody>
35
39
  ${this.loading?a`
@@ -40,7 +44,7 @@ var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,con
40
44
  <kg-skeleton variant="rect" width="16px" height="16px" style="border-radius: 4px; display: inline-block;"></kg-skeleton>
41
45
  </td>
42
46
  `:""}
43
- ${this.columns.map(()=>a`
47
+ ${l.map(()=>a`
44
48
  <td>
45
49
  <kg-skeleton variant="text" width="${Math.floor(50*Math.random()+40)}%" height="1rem"></kg-skeleton>
46
50
  </td>
@@ -49,7 +53,7 @@ var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,con
49
53
  `)}
50
54
  `:0===e.length?a`
51
55
  <tr>
52
- <td colspan="${this.columns.length+(this.selectable?1:0)}" class="empty-state">
56
+ <td colspan="${l.length+(this.selectable?1:0)}" class="empty-state">
53
57
  Veri bulunamadı.
54
58
  </td>
55
59
  </tr>
@@ -60,7 +64,7 @@ var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,con
60
64
  >
61
65
  ${this.selectable?a`
62
66
  <td class="checkbox-cell">
63
- ${r?a`
67
+ ${s?a`
64
68
  <kg-radio
65
69
  .checked="${this._isSelected(e)}"
66
70
  style="pointer-events: none;"
@@ -75,7 +79,7 @@ var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,con
75
79
  </td>
76
80
  `:""}
77
81
 
78
- ${this.columns.map(t=>a`
82
+ ${l.map(t=>a`
79
83
  <td class="${t.align?`align-${t.align}`:""}">
80
84
  ${this._renderCellContent(t,e)}
81
85
  </td>
@@ -129,8 +133,8 @@ var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,con
129
133
  </kg-button>
130
134
 
131
135
  <!-- Page Numbers -->
132
- ${o.map((e,t)=>a`
133
- ${t>0&&e-o[t-1]>1?a`<span class="pagination-info">...</span>`:""}
136
+ ${d.map((e,t)=>a`
137
+ ${t>0&&e-d[t-1]>1?a`<span class="pagination-info">...</span>`:""}
134
138
  <kg-button
135
139
  @click="${()=>this._changePage(e)}"
136
140
  color="${this.currentPage===e?"primary":"secondary"}"
@@ -169,7 +173,7 @@ var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,con
169
173
  </div>
170
174
  `:""}
171
175
  </div>
172
- `}}t(o,"properties",{columns:{type:Array},data:{type:Array},loading:{type:Boolean},striped:{type:Boolean,reflect:!0},bordered:{type:Boolean,reflect:!0},hover:{type:Boolean,reflect:!0},selectable:{type:Boolean},selectionMode:{type:String,attribute:"selection-mode"},selectedRows:{type:Array,state:!0},sortable:{type:Boolean},_sortColumn:{type:String,state:!0},_sortDirection:{type:String,state:!0},pagination:{type:Boolean},pageSize:{type:Number,attribute:"page-size"},pageSizeOptions:{type:Array,attribute:"page-size-options"},total:{type:Number},serverSide:{type:Boolean,attribute:"server-side"},currentPage:{type:Number,attribute:"current-page"}}),t(o,"styles",s`
176
+ `}}t(o,"properties",{columns:{type:Array},data:{type:Array},loading:{type:Boolean},striped:{type:Boolean,reflect:!0},bordered:{type:Boolean,reflect:!0},hover:{type:Boolean,reflect:!0},selectable:{type:Boolean},selectionMode:{type:String,attribute:"selection-mode"},selectedRows:{type:Array,state:!0},sortable:{type:Boolean},_sortColumn:{type:String,state:!0},_sortDirection:{type:String,state:!0},pagination:{type:Boolean},pageSize:{type:Number,attribute:"page-size"},pageSizeOptions:{type:Array,attribute:"page-size-options"},total:{type:Number},serverSide:{type:Boolean,attribute:"server-side"},currentPage:{type:Number,attribute:"current-page"}}),t(o,"styles",r`
173
177
  :host {
174
178
  display: block;
175
179
  width: 100%;
@@ -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)}">
@@ -1 +1 @@
1
- import e,{useState as t,useRef as r,useMemo as n,useEffect as a}from"react";import{createPortal as o}from"react-dom";import{o as c}from"../chunks/create-component-jQ1kjF1Z.js";import{kgdatagrid as s}from"../components/kg-datagrid.js";"undefined"==typeof customElements||customElements.get("kg-datagrid")||customElements.define("kg-datagrid",s);const l=c({tagName:"kg-datagrid",elementClass:s,react:e,events:{onSelectionChange:"selection-change",onPageChange:"page-change",onPageSizeChange:"page-size-change",onSort:"sort"}}),d=({columns:c,...s})=>{const[d,i]=t(/* @__PURE__ */new Map),m=r(null),u=r(/* @__PURE__ */new WeakMap),g=r(/* @__PURE__ */new WeakMap),p=n(()=>c?c.map(t=>{const r={...t};return t.render&&(r.render=r=>{const n=t.render(r);if(!e.isValidElement(n))return n;let a=u.current.get(r);a||(a=/* @__PURE__ */new Map,u.current.set(r,a));let o=a.get(t.field);return o||(o=document.createElement("div"),o.className="kg-react-cell-portal",o.style.display="contents",o.dataset.reactCellId=Math.random().toString(36).substr(2,9),a.set(t.field,o)),o._reactContent=n,o}),t.headerRender&&(r.headerRender=r=>{const n=t.headerRender(r);if(!e.isValidElement(n))return n;let a=g.current.get(t);return a||(a=document.createElement("div"),a.className="kg-react-cell-portal",a.style.display="contents",a.dataset.reactCellId="h-"+Math.random().toString(36).substr(2,9),g.current.set(t,a)),a._reactContent=n,a}),r}):[],[c]);return a(()=>{const e=m.current;if(!e)return;const t=e.shadowRoot||e,r=()=>{const e=t.querySelectorAll(".kg-react-cell-portal"),r=/* @__PURE__ */new Map;e.forEach(e=>{e._reactContent&&r.set(e,e._reactContent)}),i(e=>{if(e.size!==r.size)return r;for(const[t,n]of r)if(e.get(t)!==n)return r;return e})},n=new MutationObserver(()=>{r()});return n.observe(t,{childList:!0,subtree:!0,attributes:!1,characterData:!1}),r(),()=>n.disconnect()},[p,s.data]),e.createElement(e.Fragment,null,e.createElement(l,{ref:m,columns:p,...s}),Array.from(d.entries()).map(([e,t])=>o(t,e,e.dataset.reactCellId)))};export{d as KgDataGrid};
1
+ import e,{useState as t,useRef as r,useMemo as n,useEffect as a}from"react";import{createPortal as c}from"react-dom";import{o}from"../chunks/create-component-jQ1kjF1Z.js";import{kgdatagrid as s}from"../components/kg-datagrid.js";"undefined"==typeof customElements||customElements.get("kg-datagrid")||customElements.define("kg-datagrid",s);const l=o({tagName:"kg-datagrid",elementClass:s,react:e,events:{onSelectionChange:"selection-change",onPageChange:"page-change",onPageSizeChange:"page-size-change",onSort:"sort"}}),d=({columns:o,...s})=>{const[d,i]=t(/* @__PURE__ */new Map),m=r(null),u=r(/* @__PURE__ */new WeakMap),g=r(/* @__PURE__ */new WeakMap),h=n(()=>{if(!o)return[];const t=r=>r.map(r=>{const n={...r};return r.render&&(n.render=t=>{const n=r.render(t);if(!e.isValidElement(n))return n;let a=u.current.get(t);a||(a=/* @__PURE__ */new Map,u.current.set(t,a));let c=a.get(r.field);return c||(c=document.createElement("div"),c.className="kg-react-cell-portal",c.style.display="contents",c.dataset.reactCellId=Math.random().toString(36).substr(2,9),a.set(r.field,c)),c._reactContent=n,c}),r.headerRender&&(n.headerRender=t=>{const n=r.headerRender(t);if(!e.isValidElement(n))return n;let a=g.current.get(r);return a||(a=document.createElement("div"),a.className="kg-react-cell-portal",a.style.display="contents",a.dataset.reactCellId="h-"+Math.random().toString(36).substr(2,9),g.current.set(r,a)),a._reactContent=n,a}),r.children&&r.children.length>0&&(n.children=t(r.children)),n});return t(o)},[o]);return a(()=>{const e=m.current;if(!e)return;const t=e.shadowRoot||e,r=()=>{const e=t.querySelectorAll(".kg-react-cell-portal"),r=/* @__PURE__ */new Map;e.forEach(e=>{e._reactContent&&r.set(e,e._reactContent)}),i(e=>{if(e.size!==r.size)return r;for(const[t,n]of r)if(e.get(t)!==n)return r;return e})},n=new MutationObserver(()=>{r()});return n.observe(t,{childList:!0,subtree:!0,attributes:!1,characterData:!1}),r(),()=>n.disconnect()},[h,s.data]),e.createElement(e.Fragment,null,e.createElement(l,{ref:m,columns:h,...s}),Array.from(d.entries()).map(([e,t])=>c(t,e,e.dataset.reactCellId)))};export{d as KgDataGrid};
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.18",
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};