@luzmo/lucero 1.0.1-alpha.15 → 1.0.1-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/components/accordion/index.cjs +183 -6
  2. package/components/accordion/index.js +136 -88
  3. package/components/action-bar/index.cjs +85 -4
  4. package/components/action-bar/index.js +72 -50
  5. package/components/action-button/index.cjs +205 -3
  6. package/components/action-button/index.js +167 -93
  7. package/components/action-group/index.cjs +7 -1
  8. package/components/action-group/index.js +12 -8
  9. package/components/action-group-DHp8RHDf.js +392 -0
  10. package/components/action-group-MPf19RPV.cjs +391 -0
  11. package/components/action-menu/index.cjs +91 -11
  12. package/components/action-menu/index.js +66 -47
  13. package/components/avatar/index.cjs +63 -3
  14. package/components/avatar/index.js +54 -42
  15. package/components/base-COw9n7UR.cjs +119 -0
  16. package/components/base-DmeVy0cq.js +120 -0
  17. package/components/button/index.cjs +134 -2
  18. package/components/button/index.js +106 -72
  19. package/components/button-base-7Ak55xFd.cjs +206 -0
  20. package/components/button-base-C3kf6BTK.js +207 -0
  21. package/components/button-group/index.cjs +45 -1
  22. package/components/button-group/index.js +37 -25
  23. package/components/calendar/index.cjs +632 -1
  24. package/components/calendar/index.js +637 -7
  25. package/components/checkbox/index.cjs +111 -4
  26. package/components/checkbox/index.js +98 -53
  27. package/components/checkbox-mixin-8cL-vfDy.js +84 -0
  28. package/components/checkbox-mixin-CE7dJj3J.cjs +83 -0
  29. package/components/clear-button-Co6oKSgl.js +59 -0
  30. package/components/clear-button-X_HDY2eH.cjs +58 -0
  31. package/components/close-button-DPBK6Kpu.cjs +59 -0
  32. package/components/close-button-Miw9ZjoJ.js +60 -0
  33. package/components/color-area/index.cjs +440 -13
  34. package/components/color-area/index.js +322 -187
  35. package/components/color-controller-BjDZaxhX.js +491 -0
  36. package/components/color-controller-C3c_vb2P.cjs +490 -0
  37. package/components/color-field/index.cjs +95 -2
  38. package/components/color-field/index.js +77 -41
  39. package/components/color-handle/index.cjs +64 -3
  40. package/components/color-handle/index.js +58 -37
  41. package/components/color-loupe/index.cjs +7 -1
  42. package/components/color-loupe/index.js +12 -8
  43. package/components/color-loupe-BQqNR8YD.cjs +88 -0
  44. package/components/color-loupe-B_DDFv8l.js +89 -0
  45. package/components/color-menu/index.cjs +217 -12
  46. package/components/color-menu/index.js +187 -93
  47. package/components/color-palette/index.cjs +89 -1
  48. package/components/color-palette/index.js +78 -51
  49. package/components/color-palette-group/index.cjs +259 -3
  50. package/components/color-palette-group/index.js +193 -105
  51. package/components/color-picker/index.cjs +114 -6
  52. package/components/color-picker/index.js +92 -72
  53. package/components/color-slider/index.cjs +585 -1
  54. package/components/color-slider/index.js +590 -7
  55. package/components/{directive-oAbCiebi.js → condition-attribute-with-id-Cn815e9W.js} +22 -22
  56. package/components/condition-attribute-with-id-DEc2Yjne.cjs +43 -0
  57. package/components/date-time-picker/index.cjs +1357 -31
  58. package/components/date-time-picker/index.js +951 -637
  59. package/components/dependency-manger-CcIE1uvQ.cjs +63 -0
  60. package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-XHpQjFgK.js} +24 -14
  61. package/components/divider/index.cjs +54 -1
  62. package/components/divider/index.js +49 -30
  63. package/components/divider.module-Cm5LcDRV.cjs +20 -0
  64. package/components/divider.module-DauH6k2_.js +21 -0
  65. package/components/element-resolution-DCsrhGZO.cjs +112 -0
  66. package/components/element-resolution-nMlmW4Jy.js +113 -0
  67. package/components/field-group/index.cjs +7 -1
  68. package/components/field-group/index.js +12 -8
  69. package/components/field-group-DNmY8W9v.cjs +86 -0
  70. package/components/field-group-DVdAWCQF.js +87 -0
  71. package/components/field-label/index.cjs +7 -1
  72. package/components/field-label/index.js +12 -8
  73. package/components/field-label-CKH9EXpR.cjs +156 -0
  74. package/components/field-label-Dpsecoc6.js +157 -0
  75. package/components/focus-group-BqDAk9Is.js +337 -0
  76. package/components/focus-group-DFzOlalL.cjs +336 -0
  77. package/components/focus-visible-B-B8-P9R.cjs +104 -0
  78. package/components/focus-visible-BUPRWlsh.js +105 -0
  79. package/components/focusable-BPrTcZPd.cjs +262 -0
  80. package/components/focusable-ChCLg1k4.js +263 -0
  81. package/components/{directive-C7oCP5Bh.cjs → focusable-selectors-D0t_5P7C.cjs} +16 -5
  82. package/components/{focusable-selectors-B4YgbghQ.js → focusable-selectors-IltOAOd9.js} +7 -4
  83. package/components/icon/index.cjs +90 -1
  84. package/components/icon/index.js +74 -46
  85. package/components/index.cjs +174 -1
  86. package/components/index.js +174 -172
  87. package/components/infield-button/index.cjs +46 -2
  88. package/components/infield-button/index.js +41 -30
  89. package/components/label/index.cjs +37 -1
  90. package/components/label/index.js +36 -24
  91. package/components/{language-resolution-8yZa5r_P.js → language-resolution-BSGJAWiQ.js} +21 -16
  92. package/components/language-resolution-iN9EImbb.cjs +57 -0
  93. package/components/like-anchor-D62faRNG.cjs +79 -0
  94. package/components/like-anchor-v3cJ9RWM.js +80 -0
  95. package/components/manage-help-text-BYx84zZR.cjs +125 -0
  96. package/components/manage-help-text-DOuMTGht.js +126 -0
  97. package/components/menu/index.cjs +1297 -29
  98. package/components/menu/index.js +954 -499
  99. package/components/multi-language-field/index.cjs +132 -2
  100. package/components/multi-language-field/index.js +118 -88
  101. package/components/number-field/index.cjs +613 -10
  102. package/components/number-field/index.js +442 -243
  103. package/components/observe-slot-presence-9AwLGUQ_.cjs +78 -0
  104. package/components/observe-slot-presence-DcMdoumP.js +79 -0
  105. package/components/observe-slot-text-CSofZeeF.cjs +104 -0
  106. package/components/observe-slot-text-CjnkkBPn.js +105 -0
  107. package/components/options/index.cjs +693 -60
  108. package/components/options/index.js +519 -953
  109. package/components/overlay/index.cjs +367 -21
  110. package/components/overlay/index.js +273 -189
  111. package/components/overlay-CN8ISP1F.js +2485 -0
  112. package/components/overlay-LViy9VWM.cjs +2484 -0
  113. package/components/{pending-state-DTX7ggyF.js → pending-state-CXbe-Xul.js} +28 -13
  114. package/components/pending-state-e4RbXe9u.cjs +75 -0
  115. package/components/picker/index.cjs +9 -1
  116. package/components/picker/index.js +15 -11
  117. package/components/picker-DNde3awt.cjs +672 -0
  118. package/components/picker-PfUAF05y.js +673 -0
  119. package/components/picker-button/index.cjs +56 -4
  120. package/components/picker-button/index.js +45 -34
  121. package/components/platform-CxDar3Dn.cjs +68 -0
  122. package/components/platform-Cxn0WbyT.js +69 -0
  123. package/components/popover/index.cjs +7 -1
  124. package/components/popover/index.js +12 -8
  125. package/components/popover-BkbYhl3i.js +74 -0
  126. package/components/popover-BkgUf0kL.cjs +74 -0
  127. package/components/progress-circle/index.cjs +7 -1
  128. package/components/progress-circle/index.js +12 -8
  129. package/components/progress-circle-Hu_ivPHf.js +133 -0
  130. package/components/progress-circle-_Etqsj9f.cjs +132 -0
  131. package/components/radio/index.cjs +244 -2
  132. package/components/radio/index.js +192 -110
  133. package/components/{when-CDK1Tt5Y.js → random-id-BE6HA503.cjs} +7 -10
  134. package/components/{random-id-ByCz1xaq.js → random-id-BEc6QIUL.js} +3 -3
  135. package/components/roving-tabindex-AsmAh2In.cjs +95 -0
  136. package/components/roving-tabindex-DPF9NmrH.js +96 -0
  137. package/components/search/index.cjs +115 -8
  138. package/components/search/index.js +96 -66
  139. package/components/select/index.cjs +720 -51
  140. package/components/select/index.js +563 -347
  141. package/components/sized-mixin-DmkrNdWB.js +80 -0
  142. package/components/sized-mixin-UaTVa-AE.cjs +79 -0
  143. package/components/slider/index.cjs +119 -1
  144. package/components/slider/index.js +100 -1113
  145. package/components/{condition-attribute-with-id-Dv4lSRbe.js → slottable-request-event-CANixJnR.cjs} +15 -13
  146. package/components/{slottable-request-event-DggLA4Rx.js → slottable-request-event-D9WzrdWv.js} +12 -9
  147. package/components/strategies-DlMlaSJR.cjs +317 -0
  148. package/components/strategies-DlPQoTFE.js +318 -0
  149. package/components/streaming-listener-D4sHaMub.cjs +145 -0
  150. package/components/streaming-listener-cAz5zJyk.js +146 -0
  151. package/components/swatch/index.cjs +436 -7
  152. package/components/swatch/index.js +350 -205
  153. package/components/switch/index.cjs +61 -2
  154. package/components/switch/index.js +51 -34
  155. package/components/tabs/index.cjs +693 -26
  156. package/components/tabs/index.js +521 -388
  157. package/components/tags/index.cjs +201 -4
  158. package/components/tags/index.js +152 -87
  159. package/components/text-field/index.cjs +49 -3
  160. package/components/text-field/index.js +44 -30
  161. package/components/text-field-11tcnftU.cjs +338 -0
  162. package/components/text-field-Chi9J2Cz.js +339 -0
  163. package/components/text-field.module-CMBS0jSL.js +21 -0
  164. package/components/text-field.module-DIJdV_sA.cjs +20 -0
  165. package/components/toast/index.cjs +177 -12
  166. package/components/toast/index.js +145 -73
  167. package/components/tooltip/index.cjs +221 -6
  168. package/components/tooltip/index.js +155 -131
  169. package/components/tooltip/tooltip.d.ts +1 -12
  170. package/components/unit-input/index.cjs +232 -8
  171. package/components/unit-input/index.js +201 -108
  172. package/components/utils.cjs +25 -1
  173. package/components/utils.js +22 -22
  174. package/custom-elements.json +1 -1
  175. package/package.json +1 -1
  176. package/components/NumberFormatter-DewVDY5w.cjs +0 -18
  177. package/components/NumberFormatter-DgOUVrge.js +0 -136
  178. package/components/NumberParser-Dik4a0h-.cjs +0 -18
  179. package/components/NumberParser-ci9J5EKv.js +0 -173
  180. package/components/action-group-DBImibFn.js +0 -258
  181. package/components/action-group-DJGMcRHb.cjs +0 -20
  182. package/components/async-directive-BX1T1e1_.cjs +0 -22
  183. package/components/async-directive-BfcqVjDp.js +0 -82
  184. package/components/base-BjTwmyRF.cjs +0 -22
  185. package/components/base-CBCg3yyw.cjs +0 -40
  186. package/components/base-D76d76ww.js +0 -26
  187. package/components/base-WsynuqaS.js +0 -677
  188. package/components/button-base-DbkDzb71.js +0 -144
  189. package/components/button-base-XgPLmwP-.cjs +0 -25
  190. package/components/checkbox-mixin-BDN0dBtS.cjs +0 -27
  191. package/components/checkbox-mixin-Do7EgtpQ.js +0 -70
  192. package/components/class-map-Di1D_rCm.cjs +0 -22
  193. package/components/class-map-NbVXqBU0.js +0 -51
  194. package/components/clear-button-BbVqNU-g.js +0 -53
  195. package/components/clear-button-DYdeFsS8.cjs +0 -18
  196. package/components/close-button-CpfKibqg.cjs +0 -18
  197. package/components/close-button-DzOZZmkY.js +0 -51
  198. package/components/color-controller-B0uX6Zso.js +0 -3230
  199. package/components/color-controller-CoUL5f9K.cjs +0 -18
  200. package/components/color-loupe-CaA_Lfkk.cjs +0 -56
  201. package/components/color-loupe-CmMsXbjT.js +0 -81
  202. package/components/condition-attribute-with-id-DrQYZzFS.cjs +0 -18
  203. package/components/dependency-manger-C5HCkMMB.cjs +0 -18
  204. package/components/directive-helpers-Cm6gitnu.js +0 -62
  205. package/components/directive-helpers-DyIRTWwA.cjs +0 -22
  206. package/components/divider.module-DDvBo9zo.cjs +0 -18
  207. package/components/divider.module-DoQWQEIJ.js +0 -21
  208. package/components/element-resolution-BvRLGqIU.cjs +0 -18
  209. package/components/element-resolution-FCUT-wql.js +0 -91
  210. package/components/field-group-DXfBWrkO.js +0 -66
  211. package/components/field-group-DkGst3r5.cjs +0 -23
  212. package/components/field-label-CZ2zzChK.js +0 -106
  213. package/components/field-label-mO1AkUgR.cjs +0 -25
  214. package/components/flow-D-0MTYCm.js +0 -527
  215. package/components/flow-DM3dNAKs.cjs +0 -30
  216. package/components/focus-group-DHeTq18L.js +0 -218
  217. package/components/focus-group-DnxZUBhQ.cjs +0 -18
  218. package/components/focus-visible-B0P9aY_G.cjs +0 -18
  219. package/components/focus-visible-DBlJGoEW.js +0 -74
  220. package/components/focusable-BxtpnzWp.js +0 -153
  221. package/components/focusable-EbipgXRh.cjs +0 -18
  222. package/components/focusable-selectors-BgFlyFcY.cjs +0 -18
  223. package/components/if-defined-C9YGdo33.cjs +0 -22
  224. package/components/if-defined-DOaE2coe.js +0 -27
  225. package/components/index-BQoI8AD3.cjs +0 -113
  226. package/components/index-BwxgAdzi.cjs +0 -57
  227. package/components/index-Cb9zsiz6.js +0 -1490
  228. package/components/index-HjQa8tew.js +0 -1174
  229. package/components/language-resolution-DJzmyzZq.cjs +0 -18
  230. package/components/like-anchor-Bvn_vLQ8.js +0 -69
  231. package/components/like-anchor-sod1C1fR.cjs +0 -32
  232. package/components/luzmo-icons-D47EGj-3.cjs +0 -29
  233. package/components/luzmo-icons-NEyaMpEM.js +0 -229
  234. package/components/manage-help-text-DhgARkZX.cjs +0 -30
  235. package/components/manage-help-text-syYnjKGL.js +0 -92
  236. package/components/mutation-controller-DH7YOCyj.js +0 -52
  237. package/components/mutation-controller-DkOMCW-c.cjs +0 -22
  238. package/components/observe-slot-presence-CmVi0zTc.js +0 -68
  239. package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
  240. package/components/observe-slot-text-BPfIQQtz.js +0 -87
  241. package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
  242. package/components/overlay-Cig9r6uU.js +0 -2747
  243. package/components/overlay-KSKMzzkh.cjs +0 -47
  244. package/components/pending-state-CaH1si5b.cjs +0 -26
  245. package/components/picker-CAYj4hBD.js +0 -461
  246. package/components/picker-apS0Zrly.cjs +0 -123
  247. package/components/platform-BM-uMWpX.js +0 -69
  248. package/components/platform-BiXhwqk3.cjs +0 -18
  249. package/components/popover-DjX0aAnY.js +0 -67
  250. package/components/popover-KFfO0IYL.cjs +0 -30
  251. package/components/progress-circle-BvRJNuNo.cjs +0 -33
  252. package/components/progress-circle-DXH9z8-6.js +0 -97
  253. package/components/query-BL-TJj7K.cjs +0 -22
  254. package/components/query-D_KR_GUc.js +0 -51
  255. package/components/query-assigned-elements-DjfhL1cl.js +0 -36
  256. package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
  257. package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
  258. package/components/query-assigned-nodes-C76XVPWY.js +0 -36
  259. package/components/random-id-CqvckpWe.cjs +0 -18
  260. package/components/roving-tabindex-By_fCy_e.cjs +0 -18
  261. package/components/roving-tabindex-DOg4z6ZU.js +0 -66
  262. package/components/sized-mixin-CPxE5C96.cjs +0 -18
  263. package/components/sized-mixin-D4ACoVUr.js +0 -63
  264. package/components/slottable-request-event-BfUUt1Mh.cjs +0 -18
  265. package/components/state-D8JEtYqe.cjs +0 -22
  266. package/components/state-Deh-vKYE.js +0 -29
  267. package/components/strategies-9indNIEb.js +0 -195
  268. package/components/strategies-BACP6MhR.cjs +0 -18
  269. package/components/streaming-listener-B00MvALi.cjs +0 -18
  270. package/components/streaming-listener-CP-JE6Fa.js +0 -91
  271. package/components/style-map-CeilmSgs.cjs +0 -22
  272. package/components/style-map-IgqIKvlE.js +0 -53
  273. package/components/text-field-BYF2RHY8.cjs +0 -85
  274. package/components/text-field-PYafEYeO.js +0 -314
  275. package/components/text-field.module-C2KVUJcX.js +0 -21
  276. package/components/text-field.module-DXhFA9G-.cjs +0 -18
  277. package/components/when-CDZyJPvd.cjs +0 -22
@@ -15,29 +15,253 @@
15
15
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
16
  * SOFTWARE.
17
17
  * */
18
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../base-CBCg3yyw.cjs"),h=require("../state-D8JEtYqe.cjs"),d=require("../luzmo-icons-D47EGj-3.cjs"),x=require("../style-map-CeilmSgs.cjs"),z="*,*:before,*:after{box-sizing:border-box}:host{display:flex;flex:1 1 auto}svg{height:.75em}.unit-input-container{width:100%;position:relative;display:flex;height:1.875rem;box-sizing:border-box;border-radius:var(--luzmo-border-radius)}.unit-input-container input{box-sizing:border-box;min-width:0;width:100%;line-height:1.6rem;color:var(--luzmo-font-color);padding-left:var(--luzmo-spacing-3);padding-right:var(--luzmo-spacing-5);outline:none;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-radius:var(--luzmo-border-radius);background:transparent;font-weight:400;text-align:right;transition:border .2s ease-in-out}.unit-input-container input:focus{border:var(--luzmo-border-width) solid var(--luzmo-primary);background:var(--luzmo-background-color-hover)}.unit-input-container input:focus~.ticks{border:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container input:focus~.ticks .tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container .unit{position:absolute;box-sizing:border-box;display:flex;align-items:center;justify-content:center;right:1.125rem;color:var(--luzmo-font-color-disabled);padding:0 var(--luzmo-spacing-2);height:100%;cursor:default;-webkit-user-select:none;user-select:none;z-index:2;font-size:80%}.unit-input-container .ticks{position:absolute;display:flex;flex-direction:column;top:0;bottom:0;right:0;width:var(--luzmo-unit-input-tick-width, 1rem);-webkit-user-select:none;user-select:none;z-index:3;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-top-right-radius:var(--luzmo-border-radius);border-bottom-right-radius:var(--luzmo-border-radius);overflow:hidden;background-color:var(--luzmo-background-color-hover)}.unit-input-container .ticks>div{flex:1 1 auto;display:flex;justify-content:center;align-items:center;overflow:hidden;color:var(--luzmo-font-color);transition:all .2s ease-in-out;cursor:pointer;position:relative}.unit-input-container .ticks>div:hover{color:var(--luzmo-font-color-hard);background:var(--background-color-alt-2)}.unit-input-container .ticks>div.disabled,.unit-input-container .ticks>div.disabled:hover{cursor:not-allowed;color:var(--luzmo-font-color-disabled)!important;background-color:var(--luzmo-background-color)}.unit-input-container .ticks>div.tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-border-color)}.unit-input-container.with-unit input{padding-right:2.25rem}.unit-input-container.has-error input{border-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .ticks{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .tick-up,.unit-input-container.has-error .tick-down{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important;color:#fff!important}";var w=Object.defineProperty,s=(m,t,e,i)=>{for(var a=void 0,n=m.length-1,u;n>=0;n--)(u=m[n])&&(a=u(t,e,a)||a);return a&&w(t,e,a),a};const l={min:-99999999999,max:99999999999,step:1,default:0,debounce:250},p=class p extends o.LuzmoElement{constructor(){super(),this.isDecimal=!1,this.disabled=!1,this.readOnly=!1,this.inputWidth="",this.debounce=l.debounce,this.errors=[],this.setValue=t=>{this.waitForUpdate=!0,this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))},this.debounce||0)},this.setCorrectInitialValues()}transformToNumber(t,e){let i=t;return i=this.isDecimal?Number.parseFloat(t+""):Number.parseInt(t+"",10),i=Number.isNaN(i)?Number(e):Number(i),i}onInput(t){let e=new RegExp(/[^0-9+-]/g);this.isDecimal&&(e=new RegExp(/[^0-9.,+-]/g));const i=t.target.value.replace(e,"").replaceAll(",",".");t.target.value=i,this.errors=[];const a=this.isDecimal?Number.parseFloat(i+""):Number.parseInt(i+"",10);Number.isNaN(a)&&this.errors.push("Not a number"),a<this.min&&this.errors.length===0&&this.errors.push("Value is lower than minimum"),a>this.max&&this.errors.length===0&&this.errors.push("Value is higher than maximum"),this.errors.length===0?(this.validValue=a,this.value=this.validValue,this.setValue(this.value),this.setErrorStatus(!1)):this.setErrorStatus(!0)}setErrorStatus(t){var e,i;t?(e=this.renderRoot.querySelector(".unit-input-container"))==null||e.classList.add("has-error"):(this.errors=[],(i=this.renderRoot.querySelector(".unit-input-container"))==null||i.classList.remove("has-error"))}setDisabledUpDownStatus(){this.value===this.min?this.renderRoot.querySelector(".tick-down").classList.add("disabled"):this.renderRoot.querySelector(".tick-down").classList.remove("disabled"),this.value===this.max?this.renderRoot.querySelector(".tick-up").classList.add("disabled"):this.renderRoot.querySelector(".tick-up").classList.remove("disabled")}createAndSetValidValue(t){let e=this.validValue?this.transformToNumber(t,this.validValue):this.transformToNumber(t,this.default);this.max<e&&(e=this.max),this.min>e&&(e=this.min),this.validValue=e,this.value=e}setCorrectInitialValues(){this.min=this.transformToNumber(this.min,l.min),this.max=this.transformToNumber(this.max,l.max),this.step=Math.abs(this.transformToNumber(this.step,l.step)),this.min>this.max&&(this.min=this.max),this.max<this.min+this.step&&(this.max=this.min+this.step),this.default=this.transformToNumber(this.default,l.default),this.createAndSetValidValue(this.value)}onKeydown(t){!this.disabled&&(t.key==="ArrowUp"||t.key==="ArrowDown")&&this.applyStep(t,t.key==="ArrowUp")}applyStep(t,e){var i,a,n,u,b,f;if(!this.disabled){t.preventDefault();const v=((n=(a=(i=this.validValue.toString())==null?void 0:i.split("."))==null?void 0:a[1])==null?void 0:n.length)??0,g=((f=(b=(u=this.step.toString())==null?void 0:u.split("."))==null?void 0:b[1])==null?void 0:f.length)??0,y=Math.max(v,g);let c=this.validValue+(e?this.step:-this.step);c=Number.parseFloat(c.toFixed(y)),this.createAndSetValidValue(c),this.setErrorStatus(!1),this.renderRoot.querySelector("input").value=this.validValue+"",this.setValue(this.validValue),this.setDisabledUpDownStatus()}}setPaddingRightOfInput(){const t=this.renderRoot.querySelector(".unit"),e=this.renderRoot.querySelector(".ticks"),i=this.unit?`calc(${t==null?void 0:t.offsetWidth}px + ${e==null?void 0:e.offsetWidth}px)`:`calc(${e==null?void 0:e.offsetWidth}px + var(--luzmo-spacing-3))`;this.renderRoot.querySelector("input").style.paddingRight=i}updated(t){t.has("value")&&(this.setCorrectInitialValues(),this.waitForUpdate?this.waitForUpdate=!1:this.renderRoot.querySelector("input").value=this.value+"",this.setPaddingRightOfInput())}render(){return o.x`
19
- <div style=${x.o(this.inputWidth?{width:this.inputWidth}:{})}>
18
+ "use strict";
19
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
20
+ const lit = require("lit");
21
+ const decorators_js = require("lit/decorators.js");
22
+ const icons = require("@luzmo/icons");
23
+ const styleMap_js = require("lit/directives/style-map.js");
24
+ const base = require("../base-COw9n7UR.cjs");
25
+ const styles = "*,*:before,*:after{box-sizing:border-box}:host{display:flex;flex:1 1 auto}svg{height:.75em}.unit-input-container{width:100%;position:relative;display:flex;height:1.875rem;box-sizing:border-box;border-radius:var(--luzmo-border-radius)}.unit-input-container input{box-sizing:border-box;min-width:0;width:100%;line-height:1.6rem;color:var(--luzmo-font-color);padding-left:var(--luzmo-spacing-3);padding-right:var(--luzmo-spacing-5);outline:none;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-radius:var(--luzmo-border-radius);background:transparent;font-weight:400;text-align:right;transition:border .2s ease-in-out}.unit-input-container input:focus{border:var(--luzmo-border-width) solid var(--luzmo-primary);background:var(--luzmo-background-color-hover)}.unit-input-container input:focus~.ticks{border:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container input:focus~.ticks .tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container .unit{position:absolute;box-sizing:border-box;display:flex;align-items:center;justify-content:center;right:1.125rem;color:var(--luzmo-font-color-disabled);padding:0 var(--luzmo-spacing-2);height:100%;cursor:default;-webkit-user-select:none;user-select:none;z-index:2;font-size:80%}.unit-input-container .ticks{position:absolute;display:flex;flex-direction:column;top:0;bottom:0;right:0;width:var(--luzmo-unit-input-tick-width, 1rem);-webkit-user-select:none;user-select:none;z-index:3;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-top-right-radius:var(--luzmo-border-radius);border-bottom-right-radius:var(--luzmo-border-radius);overflow:hidden;background-color:var(--luzmo-background-color-hover)}.unit-input-container .ticks>div{flex:1 1 auto;display:flex;justify-content:center;align-items:center;overflow:hidden;color:var(--luzmo-font-color);transition:all .2s ease-in-out;cursor:pointer;position:relative}.unit-input-container .ticks>div:hover{color:var(--luzmo-font-color-hard);background:var(--background-color-alt-2)}.unit-input-container .ticks>div.disabled,.unit-input-container .ticks>div.disabled:hover{cursor:not-allowed;color:var(--luzmo-font-color-disabled)!important;background-color:var(--luzmo-background-color)}.unit-input-container .ticks>div.tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-border-color)}.unit-input-container.with-unit input{padding-right:2.25rem}.unit-input-container.has-error input{border-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .ticks{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .tick-up,.unit-input-container.has-error .tick-down{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important;color:#fff!important}";
26
+ var __defProp = Object.defineProperty;
27
+ var __decorateClass = (decorators, target, key, kind) => {
28
+ var result = void 0;
29
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
30
+ if (decorator = decorators[i])
31
+ result = decorator(target, key, result) || result;
32
+ if (result) __defProp(target, key, result);
33
+ return result;
34
+ };
35
+ const DEFAULTVALUES = {
36
+ min: -99999999999,
37
+ max: 99999999999,
38
+ step: 1,
39
+ default: 0,
40
+ debounce: 250
41
+ };
42
+ const _LuzmoUnitInput = class _LuzmoUnitInput extends base.LuzmoElement {
43
+ constructor() {
44
+ super();
45
+ this.isDecimal = false;
46
+ this.disabled = false;
47
+ this.readOnly = false;
48
+ this.inputWidth = "";
49
+ this.debounce = DEFAULTVALUES.debounce;
50
+ this.errors = [];
51
+ this.setValue = (value) => {
52
+ this.waitForUpdate = true;
53
+ if (this.debounceTimeout) {
54
+ clearTimeout(this.debounceTimeout);
55
+ }
56
+ this.debounceTimeout = setTimeout(() => {
57
+ this.dispatchEvent(
58
+ new CustomEvent("change", {
59
+ detail: value,
60
+ bubbles: true,
61
+ composed: true
62
+ })
63
+ );
64
+ }, this.debounce || 0);
65
+ };
66
+ this.setCorrectInitialValues();
67
+ }
68
+ transformToNumber(value, fallbackValue) {
69
+ let transformedValue = value;
70
+ transformedValue = this.isDecimal ? Number.parseFloat(value + "") : Number.parseInt(value + "", 10);
71
+ transformedValue = Number.isNaN(transformedValue) ? Number(fallbackValue) : Number(transformedValue);
72
+ return transformedValue;
73
+ }
74
+ onInput(event) {
75
+ let regex = new RegExp(/[^0-9+-]/g);
76
+ if (this.isDecimal) {
77
+ regex = new RegExp(/[^0-9.,+-]/g);
78
+ }
79
+ const value = event.target.value.replace(regex, "").replaceAll(",", ".");
80
+ event.target.value = value;
81
+ this.errors = [];
82
+ const checkValue = this.isDecimal ? Number.parseFloat(value + "") : Number.parseInt(value + "", 10);
83
+ if (Number.isNaN(checkValue)) {
84
+ this.errors.push("Not a number");
85
+ }
86
+ if (checkValue < this.min && this.errors.length === 0) {
87
+ this.errors.push("Value is lower than minimum");
88
+ }
89
+ if (checkValue > this.max && this.errors.length === 0) {
90
+ this.errors.push("Value is higher than maximum");
91
+ }
92
+ if (this.errors.length === 0) {
93
+ this.validValue = checkValue;
94
+ this.value = this.validValue;
95
+ this.setValue(this.value);
96
+ this.setErrorStatus(false);
97
+ } else {
98
+ this.setErrorStatus(true);
99
+ }
100
+ }
101
+ setErrorStatus(hasError) {
102
+ var _a, _b;
103
+ if (hasError) {
104
+ (_a = this.renderRoot.querySelector(".unit-input-container")) == null ? void 0 : _a.classList.add("has-error");
105
+ } else {
106
+ this.errors = [];
107
+ (_b = this.renderRoot.querySelector(".unit-input-container")) == null ? void 0 : _b.classList.remove("has-error");
108
+ }
109
+ }
110
+ setDisabledUpDownStatus() {
111
+ if (this.value === this.min) {
112
+ this.renderRoot.querySelector(".tick-down").classList.add("disabled");
113
+ } else {
114
+ this.renderRoot.querySelector(".tick-down").classList.remove("disabled");
115
+ }
116
+ if (this.value === this.max) {
117
+ this.renderRoot.querySelector(".tick-up").classList.add("disabled");
118
+ } else {
119
+ this.renderRoot.querySelector(".tick-up").classList.remove("disabled");
120
+ }
121
+ }
122
+ createAndSetValidValue(value) {
123
+ let newValue = this.validValue ? this.transformToNumber(value, this.validValue) : this.transformToNumber(value, this.default);
124
+ if (this.max < newValue) {
125
+ newValue = this.max;
126
+ }
127
+ if (this.min > newValue) {
128
+ newValue = this.min;
129
+ }
130
+ this.validValue = newValue;
131
+ this.value = newValue;
132
+ }
133
+ setCorrectInitialValues() {
134
+ this.min = this.transformToNumber(this.min, DEFAULTVALUES.min);
135
+ this.max = this.transformToNumber(this.max, DEFAULTVALUES.max);
136
+ this.step = Math.abs(this.transformToNumber(this.step, DEFAULTVALUES.step));
137
+ if (this.min > this.max) {
138
+ this.min = this.max;
139
+ }
140
+ if (this.max < this.min + this.step) {
141
+ this.max = this.min + this.step;
142
+ }
143
+ this.default = this.transformToNumber(this.default, DEFAULTVALUES.default);
144
+ this.createAndSetValidValue(this.value);
145
+ }
146
+ onKeydown(event) {
147
+ if (!this.disabled && (event.key === "ArrowUp" || event.key === "ArrowDown")) {
148
+ this.applyStep(event, event.key === "ArrowUp");
149
+ }
150
+ }
151
+ applyStep(event, isUp) {
152
+ var _a, _b, _c, _d, _e, _f;
153
+ if (!this.disabled) {
154
+ event.preventDefault();
155
+ const precisionValid = ((_c = (_b = (_a = this.validValue.toString()) == null ? void 0 : _a.split(".")) == null ? void 0 : _b[1]) == null ? void 0 : _c.length) ?? 0;
156
+ const precisionStep = ((_f = (_e = (_d = this.step.toString()) == null ? void 0 : _d.split(".")) == null ? void 0 : _e[1]) == null ? void 0 : _f.length) ?? 0;
157
+ const maxPrecision = Math.max(precisionValid, precisionStep);
158
+ let newValue = this.validValue + (isUp ? this.step : -this.step);
159
+ newValue = Number.parseFloat(newValue.toFixed(maxPrecision));
160
+ this.createAndSetValidValue(newValue);
161
+ this.setErrorStatus(false);
162
+ this.renderRoot.querySelector("input").value = this.validValue + "";
163
+ this.setValue(this.validValue);
164
+ this.setDisabledUpDownStatus();
165
+ }
166
+ }
167
+ setPaddingRightOfInput() {
168
+ const unitDiv = this.renderRoot.querySelector(".unit");
169
+ const ticksDiv = this.renderRoot.querySelector(".ticks");
170
+ const paddingRight = this.unit ? `calc(${unitDiv == null ? void 0 : unitDiv.offsetWidth}px + ${ticksDiv == null ? void 0 : ticksDiv.offsetWidth}px)` : `calc(${ticksDiv == null ? void 0 : ticksDiv.offsetWidth}px + var(--luzmo-spacing-3))`;
171
+ this.renderRoot.querySelector("input").style.paddingRight = paddingRight;
172
+ }
173
+ updated(changedProperties) {
174
+ if (changedProperties.has("value")) {
175
+ this.setCorrectInitialValues();
176
+ if (this.waitForUpdate) {
177
+ this.waitForUpdate = false;
178
+ } else {
179
+ this.renderRoot.querySelector("input").value = this.value + "";
180
+ }
181
+ this.setPaddingRightOfInput();
182
+ }
183
+ }
184
+ render() {
185
+ return lit.html`
186
+ <div style=${styleMap_js.styleMap(this.inputWidth ? { width: this.inputWidth } : {})}>
20
187
  <input
21
188
  .min=${String(this.min)}
22
189
  .max=${String(this.max)}
23
190
  @input=${this.onInput}
24
191
  @keydown=${this.onKeydown}
25
192
  />
26
- ${this.unit?o.x`<div class="unit">${this.unit}</div>`:""}
193
+ ${this.unit ? lit.html`<div class="unit">${this.unit}</div>` : ""}
27
194
  <div class="ticks">
28
195
  <div
29
196
  class="tick-up"
30
- @click=${{handleEvent:t=>this.applyStep(t,!0)}}
197
+ @click=${{
198
+ handleEvent: (event) => this.applyStep(event, true)
199
+ }}
31
200
  >
32
- ${d.p3(d.b)}
201
+ ${icons.luzmoIcon(icons.luzmoAngleUp)}
33
202
  </div>
34
203
 
35
204
  <div
36
205
  class="tick-down"
37
- @click=${{handleEvent:t=>this.applyStep(t,!1)}}
206
+ @click=${{
207
+ handleEvent: (event) => this.applyStep(event, false)
208
+ }}
38
209
  >
39
- ${d.p3(d.T)}
210
+ ${icons.luzmoIcon(icons.luzmoAngleDown)}
40
211
  </div>
41
212
  </div>
42
213
  </div>
43
- `}};p.styles=o.r(z);let r=p;s([o.n({type:Number,reflect:!0,attribute:"value"})],r.prototype,"value");s([o.n({type:Number,reflect:!0,attribute:"default"})],r.prototype,"default");s([o.n({type:String,reflect:!0,attribute:"placeholder"})],r.prototype,"placeholder");s([o.n({type:String,reflect:!0,attribute:"unit"})],r.prototype,"unit");s([o.n({type:Number,reflect:!0,attribute:"min"})],r.prototype,"min");s([o.n({type:Number,reflect:!0,attribute:"max"})],r.prototype,"max");s([o.n({type:Number,reflect:!0,attribute:"step"})],r.prototype,"step");s([o.n({type:Boolean,reflect:!0,attribute:"isDecimal"})],r.prototype,"isDecimal");s([o.n({type:Boolean,reflect:!0,attribute:"disabled"})],r.prototype,"disabled");s([o.n({type:Boolean,reflect:!0,attribute:"readOnly"})],r.prototype,"readOnly");s([o.n({type:String,reflect:!0,attribute:"inputWidth"})],r.prototype,"inputWidth");s([o.n({type:Number,reflect:!0,attribute:"debounce"})],r.prototype,"debounce");s([h.r()],r.prototype,"errors");s([h.r()],r.prototype,"validValue");s([h.r()],r.prototype,"waitForUpdate");customElements.get("luzmo-unit-input")||customElements.define("luzmo-unit-input",r);exports.LuzmoUnitInput=r;
214
+ `;
215
+ }
216
+ };
217
+ _LuzmoUnitInput.styles = lit.unsafeCSS(styles);
218
+ let LuzmoUnitInput = _LuzmoUnitInput;
219
+ __decorateClass([
220
+ decorators_js.property({ type: Number, reflect: true, attribute: "value" })
221
+ ], LuzmoUnitInput.prototype, "value");
222
+ __decorateClass([
223
+ decorators_js.property({ type: Number, reflect: true, attribute: "default" })
224
+ ], LuzmoUnitInput.prototype, "default");
225
+ __decorateClass([
226
+ decorators_js.property({ type: String, reflect: true, attribute: "placeholder" })
227
+ ], LuzmoUnitInput.prototype, "placeholder");
228
+ __decorateClass([
229
+ decorators_js.property({ type: String, reflect: true, attribute: "unit" })
230
+ ], LuzmoUnitInput.prototype, "unit");
231
+ __decorateClass([
232
+ decorators_js.property({ type: Number, reflect: true, attribute: "min" })
233
+ ], LuzmoUnitInput.prototype, "min");
234
+ __decorateClass([
235
+ decorators_js.property({ type: Number, reflect: true, attribute: "max" })
236
+ ], LuzmoUnitInput.prototype, "max");
237
+ __decorateClass([
238
+ decorators_js.property({ type: Number, reflect: true, attribute: "step" })
239
+ ], LuzmoUnitInput.prototype, "step");
240
+ __decorateClass([
241
+ decorators_js.property({ type: Boolean, reflect: true, attribute: "isDecimal" })
242
+ ], LuzmoUnitInput.prototype, "isDecimal");
243
+ __decorateClass([
244
+ decorators_js.property({ type: Boolean, reflect: true, attribute: "disabled" })
245
+ ], LuzmoUnitInput.prototype, "disabled");
246
+ __decorateClass([
247
+ decorators_js.property({ type: Boolean, reflect: true, attribute: "readOnly" })
248
+ ], LuzmoUnitInput.prototype, "readOnly");
249
+ __decorateClass([
250
+ decorators_js.property({ type: String, reflect: true, attribute: "inputWidth" })
251
+ ], LuzmoUnitInput.prototype, "inputWidth");
252
+ __decorateClass([
253
+ decorators_js.property({ type: Number, reflect: true, attribute: "debounce" })
254
+ ], LuzmoUnitInput.prototype, "debounce");
255
+ __decorateClass([
256
+ decorators_js.state()
257
+ ], LuzmoUnitInput.prototype, "errors");
258
+ __decorateClass([
259
+ decorators_js.state()
260
+ ], LuzmoUnitInput.prototype, "validValue");
261
+ __decorateClass([
262
+ decorators_js.state()
263
+ ], LuzmoUnitInput.prototype, "waitForUpdate");
264
+ if (!customElements.get("luzmo-unit-input")) {
265
+ customElements.define("luzmo-unit-input", LuzmoUnitInput);
266
+ }
267
+ exports.LuzmoUnitInput = LuzmoUnitInput;