bitboss-ui 0.2.31 → 0.2.32

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 (326) hide show
  1. package/dist/components/BaseButton/BaseButton.vue.d.ts +6 -6
  2. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +16 -16
  3. package/dist/components/BaseCheckboxGroup/BaseCheckboxGroup.vue.d.ts +36 -36
  4. package/dist/components/BaseDatePicker/BaseDatePicker.vue.d.ts +20 -20
  5. package/dist/components/BaseDatePickerInput/BaseDatePickerInput.vue.d.ts +21 -21
  6. package/dist/components/BaseDialog/BaseDialog.vue.d.ts +8 -8
  7. package/dist/components/BaseInputContainer/BaseInputContainer.vue.d.ts +6 -6
  8. package/dist/components/BaseNumberInput/BaseNumberInput.vue.d.ts +20 -20
  9. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +20 -20
  10. package/dist/components/BaseRadioGroup/BaseRadioGroup.vue.d.ts +36 -36
  11. package/dist/components/BaseRating/BaseRating.vue.d.ts +17 -17
  12. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +23 -23
  13. package/dist/components/BaseSlider/BaseSlider.vue.d.ts +15 -15
  14. package/dist/components/BaseSwitch/BaseSwitch.vue.d.ts +1 -1
  15. package/dist/components/BaseSwitchGroup/BaseSwitchGroup.vue.d.ts +20 -20
  16. package/dist/components/BaseTag/BaseTag.vue.d.ts +20 -20
  17. package/dist/components/BaseTextInput/BaseTextInput.vue.d.ts +19 -19
  18. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +18 -18
  19. package/dist/components/BbAccordion/BbAccordion.vue.d.ts +3 -3
  20. package/dist/components/BbAlert/BbAlert.vue.d.ts +3 -3
  21. package/dist/components/BbAvatar/BbAvatar.vue.d.ts +8 -8
  22. package/dist/components/BbBadge/BbBadge.vue.d.ts +1 -1
  23. package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.d.ts +6 -6
  24. package/dist/components/BbButton/BbButton.vue.d.ts +1 -1
  25. package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +11 -11
  26. package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +27 -27
  27. package/dist/components/BbChip/BbChip.vue.d.ts +2 -2
  28. package/dist/components/BbConfirm/BbConfirm.vue.d.ts +4 -4
  29. package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +16 -24
  30. package/dist/components/BbDialog/BbDialog.vue.d.ts +2 -2
  31. package/dist/components/BbDropdown/BbDropdown.vue.d.ts +11 -11
  32. package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +14 -14
  33. package/dist/components/BbDropzone/BbDropzone.vue.d.ts +4 -4
  34. package/dist/components/BbIntersection/BbIntersection.vue.d.ts +3 -3
  35. package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +10 -10
  36. package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +9 -9
  37. package/dist/components/BbPagination/BbPagination.vue.d.ts +1 -1
  38. package/dist/components/BbPopover/BbPopover.vue.d.ts +8 -8
  39. package/dist/components/BbRadio/BbRadio.vue.d.ts +10 -10
  40. package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +27 -27
  41. package/dist/components/BbRating/BbRating.vue.d.ts +10 -10
  42. package/dist/components/BbSelect/BbSelect.vue.d.ts +19 -19
  43. package/dist/components/BbSlider/BbSlider.vue.d.ts +8 -8
  44. package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +1 -1
  45. package/dist/components/BbSpinner/BbSpinner.vue.d.ts +2 -2
  46. package/dist/components/BbSwitch/BbSwitch.vue.d.ts +2 -2
  47. package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +20 -20
  48. package/dist/components/BbTab/BbTab.vue.d.ts +5 -5
  49. package/dist/components/BbTable/BbTable.vue.d.ts +11 -11
  50. package/dist/components/BbTable/types.d.ts +107 -107
  51. package/dist/components/BbTag/BbTag.vue.d.ts +13 -13
  52. package/dist/components/BbTextInput/BbTextInput.vue.d.ts +11 -11
  53. package/dist/components/BbTextarea/BbTextarea.vue.d.ts +10 -10
  54. package/dist/components/BbToast/BbToast.vue.d.ts +1 -1
  55. package/dist/components/BbToast/BbToastMessage.vue.d.ts +1 -1
  56. package/dist/components/BbTooltip/BbTooltip.vue.d.ts +3 -3
  57. package/dist/components/BbTree/BbTree.vue.d.ts +1 -1
  58. package/dist/composables/useConfirm.d.ts +10 -10
  59. package/dist/composables/useOptions.d.ts +2 -2
  60. package/dist/composables/useRoute.d.ts +2 -2
  61. package/dist/composables/useRouter.d.ts +1 -1
  62. package/dist/composables/useToast.d.ts +5 -5
  63. package/dist/composables/useWizard.d.ts +1 -1
  64. package/dist/index.d.ts +126 -126
  65. package/dist/index101.js +32 -37
  66. package/dist/index101.js.map +1 -1
  67. package/dist/index103.js +19 -19
  68. package/dist/index103.js.map +1 -1
  69. package/dist/index105.js +16 -16
  70. package/dist/index105.js.map +1 -1
  71. package/dist/index107.js +15 -15
  72. package/dist/index107.js.map +1 -1
  73. package/dist/index109.js.map +1 -1
  74. package/dist/index11.js +7 -7
  75. package/dist/index11.js.map +1 -1
  76. package/dist/index111.js +16 -16
  77. package/dist/index111.js.map +1 -1
  78. package/dist/index113.js +3 -3
  79. package/dist/index113.js.map +1 -1
  80. package/dist/index115.js +6 -6
  81. package/dist/index115.js.map +1 -1
  82. package/dist/index116.js +1 -1
  83. package/dist/index116.js.map +1 -1
  84. package/dist/index117.js +1 -1
  85. package/dist/index117.js.map +1 -1
  86. package/dist/index118.js +4 -4
  87. package/dist/index118.js.map +1 -1
  88. package/dist/index119.js +5 -5
  89. package/dist/index119.js.map +1 -1
  90. package/dist/index120.js.map +1 -1
  91. package/dist/index121.js.map +1 -1
  92. package/dist/index122.js.map +1 -1
  93. package/dist/index124.js.map +1 -1
  94. package/dist/index125.js +4 -4
  95. package/dist/index125.js.map +1 -1
  96. package/dist/index126.js +1 -1
  97. package/dist/index126.js.map +1 -1
  98. package/dist/index127.js +1 -1
  99. package/dist/index128.js +4 -1
  100. package/dist/index128.js.map +1 -1
  101. package/dist/index129.js.map +1 -1
  102. package/dist/index13.js +11 -11
  103. package/dist/index13.js.map +1 -1
  104. package/dist/index130.js.map +1 -1
  105. package/dist/index131.js +2 -2
  106. package/dist/index15.js +226 -224
  107. package/dist/index15.js.map +1 -1
  108. package/dist/index17.js +61 -62
  109. package/dist/index17.js.map +1 -1
  110. package/dist/index19.js +22 -22
  111. package/dist/index19.js.map +1 -1
  112. package/dist/index196.js.map +1 -1
  113. package/dist/index197.js +2 -5
  114. package/dist/index197.js.map +1 -1
  115. package/dist/index198.js +4 -16
  116. package/dist/index198.js.map +1 -1
  117. package/dist/index199.js +293 -14
  118. package/dist/index199.js.map +1 -1
  119. package/dist/index2.js +23 -23
  120. package/dist/index2.js.map +1 -1
  121. package/dist/index200.js +15 -18
  122. package/dist/index200.js.map +1 -1
  123. package/dist/index201.js +13 -17
  124. package/dist/index201.js.map +1 -1
  125. package/dist/index202.js +18 -28
  126. package/dist/index202.js.map +1 -1
  127. package/dist/index203.js +20 -8
  128. package/dist/index203.js.map +1 -1
  129. package/dist/index204.js +29 -2
  130. package/dist/index204.js.map +1 -1
  131. package/dist/index205.js +8 -378
  132. package/dist/index205.js.map +1 -1
  133. package/dist/index206.js +2 -134
  134. package/dist/index206.js.map +1 -1
  135. package/dist/index207.js +235 -2
  136. package/dist/index207.js.map +1 -1
  137. package/dist/index208.js +3 -174
  138. package/dist/index208.js.map +1 -1
  139. package/dist/index209.js +35 -23
  140. package/dist/index209.js.map +1 -1
  141. package/dist/index21.js +4 -4
  142. package/dist/index21.js.map +1 -1
  143. package/dist/index210.js +6 -373
  144. package/dist/index210.js.map +1 -1
  145. package/dist/index211.js +10 -2
  146. package/dist/index211.js.map +1 -1
  147. package/dist/index212.js +378 -4
  148. package/dist/index212.js.map +1 -1
  149. package/dist/index213.js +134 -3
  150. package/dist/index213.js.map +1 -1
  151. package/dist/index214.js +2 -3
  152. package/dist/index214.js.map +1 -1
  153. package/dist/index215.js +172 -8
  154. package/dist/index215.js.map +1 -1
  155. package/dist/index216.js +23 -3
  156. package/dist/index216.js.map +1 -1
  157. package/dist/index217.js +369 -31
  158. package/dist/index217.js.map +1 -1
  159. package/dist/index218.js +3 -6
  160. package/dist/index218.js.map +1 -1
  161. package/dist/index219.js +3 -2
  162. package/dist/index219.js.map +1 -1
  163. package/dist/index220.js.map +1 -1
  164. package/dist/index221.js +26 -233
  165. package/dist/index221.js.map +1 -1
  166. package/dist/index222.js +16 -8
  167. package/dist/index222.js.map +1 -1
  168. package/dist/index223.js +2 -121
  169. package/dist/index223.js.map +1 -1
  170. package/dist/index224.js +8 -27
  171. package/dist/index224.js.map +1 -1
  172. package/dist/index225.js +120 -12
  173. package/dist/index225.js.map +1 -1
  174. package/dist/index226.js +1 -1
  175. package/dist/index227.js +4 -295
  176. package/dist/index227.js.map +1 -1
  177. package/dist/index228.js +2 -6
  178. package/dist/index228.js.map +1 -1
  179. package/dist/index229.js +6 -2
  180. package/dist/index229.js.map +1 -1
  181. package/dist/index23.js +14 -16
  182. package/dist/index23.js.map +1 -1
  183. package/dist/index230.js +2 -2
  184. package/dist/index235.js +2 -2
  185. package/dist/index236.js +428 -110
  186. package/dist/index236.js.map +1 -1
  187. package/dist/index237.js +88 -105
  188. package/dist/index237.js.map +1 -1
  189. package/dist/index238.js +199 -3
  190. package/dist/index238.js.map +1 -1
  191. package/dist/index239.js +1 -1
  192. package/dist/index240.js +1 -1
  193. package/dist/index241.js +2 -435
  194. package/dist/index241.js.map +1 -1
  195. package/dist/index242.js +115 -87
  196. package/dist/index242.js.map +1 -1
  197. package/dist/index243.js +104 -198
  198. package/dist/index243.js.map +1 -1
  199. package/dist/index244.js +160 -2
  200. package/dist/index244.js.map +1 -1
  201. package/dist/index245.js +2 -2
  202. package/dist/index245.js.map +1 -1
  203. package/dist/index246.js +9 -9
  204. package/dist/index246.js.map +1 -1
  205. package/dist/index247.js +5 -162
  206. package/dist/index247.js.map +1 -1
  207. package/dist/index248.js +1 -1
  208. package/dist/index249.js +37 -14
  209. package/dist/index249.js.map +1 -1
  210. package/dist/index25.js +4 -4
  211. package/dist/index25.js.map +1 -1
  212. package/dist/index250.js +2 -38
  213. package/dist/index250.js.map +1 -1
  214. package/dist/index251.js +2 -2
  215. package/dist/index251.js.map +1 -1
  216. package/dist/index252.js +15 -2
  217. package/dist/index252.js.map +1 -1
  218. package/dist/index253.js +3 -2
  219. package/dist/index253.js.map +1 -1
  220. package/dist/index255.js +2 -3
  221. package/dist/index255.js.map +1 -1
  222. package/dist/index27.js +7 -7
  223. package/dist/index27.js.map +1 -1
  224. package/dist/index29.js +15 -15
  225. package/dist/index29.js.map +1 -1
  226. package/dist/index3.js +2 -1
  227. package/dist/index3.js.map +1 -1
  228. package/dist/index31.js +28 -28
  229. package/dist/index31.js.map +1 -1
  230. package/dist/index33.js +10 -11
  231. package/dist/index33.js.map +1 -1
  232. package/dist/index35.js +2 -2
  233. package/dist/index35.js.map +1 -1
  234. package/dist/index37.js +12 -12
  235. package/dist/index37.js.map +1 -1
  236. package/dist/index39.js +5 -7
  237. package/dist/index39.js.map +1 -1
  238. package/dist/index4.js.map +1 -1
  239. package/dist/index41.js +5 -5
  240. package/dist/index41.js.map +1 -1
  241. package/dist/index43.js +19 -16
  242. package/dist/index43.js.map +1 -1
  243. package/dist/index45.js +9 -9
  244. package/dist/index45.js.map +1 -1
  245. package/dist/index47.js +4 -4
  246. package/dist/index47.js.map +1 -1
  247. package/dist/index49.js +1 -1
  248. package/dist/index49.js.map +1 -1
  249. package/dist/index5.js +7 -6
  250. package/dist/index5.js.map +1 -1
  251. package/dist/index51.js +6 -6
  252. package/dist/index51.js.map +1 -1
  253. package/dist/index53.js.map +1 -1
  254. package/dist/index55.js +20 -20
  255. package/dist/index55.js.map +1 -1
  256. package/dist/index57.js +35 -35
  257. package/dist/index57.js.map +1 -1
  258. package/dist/index59.js +8 -8
  259. package/dist/index59.js.map +1 -1
  260. package/dist/index6.js +38 -38
  261. package/dist/index6.js.map +1 -1
  262. package/dist/index61.js +27 -27
  263. package/dist/index61.js.map +1 -1
  264. package/dist/index63.js +4 -4
  265. package/dist/index63.js.map +1 -1
  266. package/dist/index65.js +20 -20
  267. package/dist/index65.js.map +1 -1
  268. package/dist/index67.js +26 -26
  269. package/dist/index67.js.map +1 -1
  270. package/dist/index69.js +21 -19
  271. package/dist/index69.js.map +1 -1
  272. package/dist/index7.js.map +1 -1
  273. package/dist/index71.js +2 -2
  274. package/dist/index71.js.map +1 -1
  275. package/dist/index72.js +3 -3
  276. package/dist/index72.js.map +1 -1
  277. package/dist/index73.js +14 -14
  278. package/dist/index73.js.map +1 -1
  279. package/dist/index75.js +18 -18
  280. package/dist/index75.js.map +1 -1
  281. package/dist/index77.js +11 -11
  282. package/dist/index77.js.map +1 -1
  283. package/dist/index79.js +15 -15
  284. package/dist/index79.js.map +1 -1
  285. package/dist/index8.js +10 -7
  286. package/dist/index8.js.map +1 -1
  287. package/dist/index81.js.map +1 -1
  288. package/dist/index83.js +20 -20
  289. package/dist/index83.js.map +1 -1
  290. package/dist/index85.js +34 -34
  291. package/dist/index85.js.map +1 -1
  292. package/dist/index87.js +18 -18
  293. package/dist/index87.js.map +1 -1
  294. package/dist/index89.js.map +1 -1
  295. package/dist/index9.js.map +1 -1
  296. package/dist/index91.js +53 -53
  297. package/dist/index91.js.map +1 -1
  298. package/dist/index93.js +16 -16
  299. package/dist/index93.js.map +1 -1
  300. package/dist/index95.js +21 -21
  301. package/dist/index95.js.map +1 -1
  302. package/dist/index97.js +37 -37
  303. package/dist/index97.js.map +1 -1
  304. package/dist/index99.js +18 -18
  305. package/dist/index99.js.map +1 -1
  306. package/dist/style.css +1 -1
  307. package/dist/types/CommonProps.d.ts +18 -18
  308. package/dist/types/ExtractGenericFromComputedRef.d.ts +1 -1
  309. package/dist/types/ExtractGenericFromRef.d.ts +1 -1
  310. package/dist/types/VoidHtmlElements.d.ts +1 -1
  311. package/dist/utilities/functions/cloneDeep.d.ts +1 -1
  312. package/dist/utilities/functions/debounce.d.ts +1 -1
  313. package/dist/utilities/functions/flow.d.ts +1 -1
  314. package/dist/utilities/functions/get.d.ts +1 -1
  315. package/dist/utilities/functions/isNotNil.d.ts +1 -1
  316. package/dist/utilities/functions/mapValues.d.ts +1 -1
  317. package/dist/utilities/functions/merge.d.ts +1 -1
  318. package/dist/utilities/functions/millisecondsTo.d.ts +1 -1
  319. package/dist/utilities/functions/overEvery.d.ts +1 -1
  320. package/dist/utilities/functions/percentage.d.ts +4 -4
  321. package/dist/utilities/functions/pick.d.ts +1 -1
  322. package/dist/utilities/functions/pickBy.d.ts +1 -1
  323. package/dist/utilities/functions/roundToTheNearest.d.ts +1 -1
  324. package/package.json +93 -77
  325. package/dist/index256.js +0 -5
  326. package/dist/index256.js.map +0 -1
package/dist/index33.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { defineComponent as R, ref as l, onMounted as S, watchEffect as z, computed as y, openBlock as D, createElementBlock as F, mergeProps as h, renderSlot as g, createElementVNode as t, normalizeProps as H, guardReactiveProps as T, normalizeStyle as E, unref as X } from "vue";
2
2
  import { clamp as K } from "./index196.js";
3
- import { isCssColor as w } from "./index211.js";
3
+ import { isCssColor as w } from "./index197.js";
4
4
  import { isNil as O } from "./index120.js";
5
5
  import { transposeValue as L } from "./index121.js";
6
- const Y = { class: "bb-base-slider__slider-container" }, j = ["disabled", "id", "name", "readonly", "value"], q = ["aria-readonly", "aria-valuemax", "aria-valuemin", "aria-valuenow", "tabindex"], W = /* @__PURE__ */ R({
6
+ const Y = { class: "bb-base-slider__slider-container" }, j = ["id", "disabled", "name", "readonly", "value"], q = ["aria-readonly", "aria-valuemax", "aria-valuemin", "aria-valuenow", "tabindex"], W = /* @__PURE__ */ R({
7
7
  __name: "BaseSlider",
8
8
  props: {
9
9
  autofocus: {},
@@ -92,8 +92,8 @@ const Y = { class: "bb-base-slider__slider-container" }, j = ["disabled", "id",
92
92
  g(e.$slots, "prepend"),
93
93
  t("span", Y, [
94
94
  t("input", {
95
- disabled: e.disabled,
96
95
  id: e.id,
96
+ disabled: e.disabled,
97
97
  name: e.name,
98
98
  readonly: e.readonly,
99
99
  tabindex: -1,
@@ -101,9 +101,9 @@ const Y = { class: "bb-base-slider__slider-container" }, j = ["disabled", "id",
101
101
  value: e.modelValue
102
102
  }, null, 8, j),
103
103
  t("span", {
104
- class: "bb-base-slider__track-container",
105
104
  ref_key: "track",
106
- ref: u
105
+ ref: u,
106
+ class: "bb-base-slider__track-container"
107
107
  }, [
108
108
  t("span", H(T(x.value)), null, 16),
109
109
  t("span", {
@@ -111,7 +111,9 @@ const Y = { class: "bb-base-slider__slider-container" }, j = ["disabled", "id",
111
111
  style: E({ width: `${100 - r.value}%` })
112
112
  }, null, 4)
113
113
  ], 512),
114
- t("span", h({
114
+ t("span", h(X(P), {
115
+ ref_key: "thumb",
116
+ ref: c,
115
117
  "aria-label": "thumb-color",
116
118
  "aria-orientation": "horizontal",
117
119
  "aria-readonly": !e.readonly,
@@ -121,12 +123,9 @@ const Y = { class: "bb-base-slider__slider-container" }, j = ["disabled", "id",
121
123
  class: "bb-base-slider__thumb-container",
122
124
  role: "slider",
123
125
  style: { left: `${r.value}%` },
124
- tabindex: e.disabled ? -1 : 0
125
- }, X(P), {
126
- onKeydown: $,
126
+ tabindex: e.disabled ? -1 : 0,
127
127
  onFocus: C,
128
- ref_key: "thumb",
129
- ref: c
128
+ onKeydown: $
130
129
  }), [
131
130
  t("span", {
132
131
  class: "bb-base-slider__thumb",
@@ -1 +1 @@
1
- {"version":3,"file":"index33.js","sources":["../src/components/BaseSlider/BaseSlider.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, normalizeStyle as _normalizeStyle, unref as _unref, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-slider__slider-container\" }\nconst _hoisted_2 = [\"disabled\", \"id\", \"name\", \"readonly\", \"value\"]\nconst _hoisted_3 = [\"aria-readonly\", \"aria-valuemax\", \"aria-valuemin\", \"aria-valuenow\", \"tabindex\"]\n\nimport { clamp } from \"@/utilities/functions/clamp\";\nimport { computed, onMounted, ref, watchEffect } from \"vue\";\nimport { isCssColor } from \"@/utilities/functions/isCssColor\";\nimport { isNil } from \"@/utilities/functions/isNil\";\nimport { transposeValue } from \"@/utilities/functions/percentage\";\nimport type { InputHTMLAttributes, HTMLAttributes } from \"vue\";\n\nexport type BaseSliderProps = {\n /**\n * Sets autofocus on page load.\n */\n autofocus?: InputHTMLAttributes[\"autofocus\"];\n\n /**\n * Define a color for the component.\n *\n * Either a custom color or a coded color in common HEX, RGB, etc... format.\n */\n color?: string;\n\n /**\n * Disables the component\n */\n disabled?: boolean;\n\n /**\n * Define if the component should be in an error state.\n * It usually attaches a CSS class for styling purposes.\n */\n hasErrors?: boolean;\n\n /**\n * The identifier of the component.\n */\n id?: HTMLAttributes[\"id\"];\n\n /**\n * Maximum value cap.\n */\n max?: number;\n\n /**\n * Minimum value cap.\n */\n min?: number;\n\n /**\n * Used by v-model.\n */\n modelValue: number | string | null;\n\n /**\n * Defines the name of the input.\n */\n name?: InputHTMLAttributes[\"name\"];\n\n /**\n * Sets the input in a readonly state.\n */\n readonly?: InputHTMLAttributes[\"readonly\"];\n\n /**\n * The step attribute is a number that specifies the granularity that the value must adhere to.\n */\n step?: number;\n};\n\nexport type BaseSliderEvents = {\n (e: \"click\", event: MouseEvent): void;\n (e: \"end\", value: BaseSliderProps[\"modelValue\"]): void;\n (e: \"focus\", event: FocusEvent): void;\n (e: \"inactive\"): void;\n (e: \"keydown\", event: KeyboardEvent): void;\n (e: \"pointerdown\", event: PointerEvent): void;\n (e: \"pointermove\", event: PointerEvent): void;\n (e: \"pointerup\", event: PointerEvent): void;\n (e: \"start\", value: BaseSliderProps[\"modelValue\"]): void;\n (e: \"update:modelValue\", event: number): void;\n};\n\nexport type BaseSliderSlots = {\n append: (props: {}) => any;\n\n prepend: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSlider',\n props: {\n autofocus: {},\n color: {},\n disabled: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n max: { default: 100 },\n min: { default: 0 },\n modelValue: { default: 0 },\n name: {},\n readonly: {},\n step: { default: 1 }\n },\n emits: [\"click\", \"end\", \"focus\", \"inactive\", \"keydown\", \"pointerdown\", \"pointermove\", \"pointerup\", \"start\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst container = ref<HTMLElement>();\nconst track = ref<HTMLElement>();\nconst thumb = ref<HTMLElement>();\nconst internalValue = ref(0);\n\nconst active = ref(false);\n\nonMounted(() => {\n if (props.autofocus) {\n thumb.value?.focus();\n }\n});\n\nwatchEffect(() => {\n // Useful for ranges from negative to positive\n let value = isNil(props.modelValue) ? props.min : Number(props.modelValue);\n const transposedValue = transposeValue({\n value,\n targetBounds: { min: 0, max: 100 },\n originalBounds: { min: props.min, max: props.max },\n step: 1,\n });\n internalValue.value = transposedValue;\n});\n\nlet thumbPressed = ref(false);\n// Listen on doc to avoid releasing if user leaves thumb while dragging\nconst onPointerdown = (event: PointerEvent) => {\n if (props.disabled || props.readonly) return;\n thumbPressed.value = true;\n document.addEventListener(\"pointermove\", onPointermove);\n document.addEventListener(\"pointerup\", onPointerup);\n\n emit(\"pointerdown\", event);\n emit(\"start\", props.modelValue);\n};\n\nconst onPointermove = (event: PointerEvent | MouseEvent) => {\n if (props.disabled || props.readonly) return;\n if (track.value) {\n const trackPosition = track.value.getBoundingClientRect();\n const clickOffset = event.clientX;\n const trackStart = trackPosition.left;\n const trackLength = trackPosition.width;\n const transposed = transposeValue({\n value: clamp(clickOffset, trackStart, trackStart + trackLength),\n originalBounds: { min: trackStart, max: trackStart + trackLength },\n targetBounds: { min: props.min, max: props.max },\n step: props.step,\n });\n if (event instanceof PointerEvent) {\n emit(\"pointermove\", event);\n } else {\n emit(\"click\", event);\n }\n emit(\"update:modelValue\", transposed);\n }\n};\n\nconst onPointerup = (event: PointerEvent) => {\n thumbPressed.value = false;\n document.removeEventListener(\"pointermove\", onPointermove);\n document.removeEventListener(\"pointerup\", onPointerup);\n emit(\"pointerup\", event);\n emit(\"end\", props.modelValue);\n};\nlet listeners = computed(() => (thumbPressed.value ? {} : { onPointerdown }));\n\nconst onKeydown = (event: KeyboardEvent) => {\n emit(\"keydown\", event);\n if (\n props.disabled ||\n props.readonly ||\n (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\")\n )\n return;\n let value = Number(props.modelValue);\n if (event.key === \"ArrowLeft\") {\n value = Math.max(value - props.step, props.min);\n } else if (event.key === \"ArrowRight\") {\n value = Math.min(value + props.step, props.max);\n }\n emit(\"update:modelValue\", value);\n};\n\nconst onFocus = (event: FocusEvent) => {\n emit(\"focus\", event);\n if (!active.value) {\n active.value = true;\n document.addEventListener(\"focusin\", onDocumentFocus);\n document.addEventListener(\"click\", onDocumentClick);\n }\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n active.value = false;\n emit(\"inactive\");\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n active.value = false;\n emit(\"inactive\");\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nconst containerAttributes = {\n class: {\n \"bb-base-slider\": true,\n \"bb-base-slider--disabled\": props.disabled,\n \"bb-base-slider--errors\": props.hasErrors,\n \"bb-base-slider--readonly\": props.readonly,\n [`bb-base-slider--${props.color}`]: props.color && !isCssColor(props.color),\n },\n onClick: (event: MouseEvent) => {\n onPointermove(event);\n thumb.value?.focus();\n },\n};\n\nconst sliderBackgroundAttributes = computed(() => {\n const classes = \"bb-base-slider__track-background\";\n const style: Record<string, any> = {\n width: `${internalValue.value}%`,\n };\n if (props.color && isCssColor(props.color)) {\n style.backgroundColor = props.color;\n }\n return {\n class: classes,\n style,\n };\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", _mergeProps(containerAttributes, {\n ref_key: \"container\",\n ref: container\n }), [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"span\", _hoisted_1, [\n _createElementVNode(\"input\", {\n disabled: _ctx.disabled,\n id: _ctx.id,\n name: _ctx.name,\n readonly: _ctx.readonly,\n tabindex: -1,\n type: 'hidden',\n value: _ctx.modelValue\n }, null, 8, _hoisted_2),\n _createElementVNode(\"span\", {\n class: \"bb-base-slider__track-container\",\n ref_key: \"track\",\n ref: track\n }, [\n _createElementVNode(\"span\", _normalizeProps(_guardReactiveProps(sliderBackgroundAttributes.value)), null, 16),\n _createElementVNode(\"span\", {\n class: \"bb-base-slider__track-fill\",\n style: _normalizeStyle({ width: `${100 - internalValue.value}%` })\n }, null, 4)\n ], 512),\n _createElementVNode(\"span\", _mergeProps({\n \"aria-label\": 'thumb-color',\n \"aria-orientation\": 'horizontal',\n \"aria-readonly\": !_ctx.readonly,\n \"aria-valuemax\": _ctx.max,\n \"aria-valuemin\": _ctx.min,\n \"aria-valuenow\": _ctx.modelValue ?? undefined,\n class: 'bb-base-slider__thumb-container',\n role: 'slider',\n style: { left: `${internalValue.value}%` },\n tabindex: _ctx.disabled ? -1 : 0\n }, _unref(listeners), {\n onKeydown: onKeydown,\n onFocus: onFocus,\n ref_key: \"thumb\",\n ref: thumb\n }), [\n _createElementVNode(\"span\", {\n class: \"bb-base-slider__thumb\",\n style: _normalizeStyle({\n transform: `translateY(-50%) translateX(-${internalValue.value}%)`,\n left: `${internalValue.value}%`,\n })\n }, null, 4)\n ], 16, _hoisted_3)\n ]),\n _renderSlot(_ctx.$slots, \"append\")\n ], 16))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","container","ref","track","thumb","internalValue","active","onMounted","_a","watchEffect","value","isNil","transposedValue","transposeValue","thumbPressed","onPointerdown","event","onPointermove","onPointerup","trackPosition","clickOffset","trackStart","trackLength","transposed","clamp","listeners","computed","onKeydown","onFocus","onDocumentFocus","onDocumentClick","containerAttributes","isCssColor","sliderBackgroundAttributes","classes","style","_ctx","_cache","_openBlock","_createElementBlock","_mergeProps","_renderSlot","_createElementVNode","_normalizeProps","_guardReactiveProps","_normalizeStyle","_unref"],"mappings":";;;;;AAGA,MAAMA,IAAa,EAAE,OAAO,sCACtBC,IAAa,CAAC,YAAY,MAAM,QAAQ,YAAY,OAAO,GAC3DC,IAAa,CAAC,iBAAiB,iBAAiB,iBAAiB,iBAAiB,UAAU,GAyFtEC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,WAAW,CAAC;AAAA,IACZ,OAAO,CAAC;AAAA,IACR,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC3B,IAAI,CAAC;AAAA,IACL,KAAK,EAAE,SAAS,IAAI;AAAA,IACpB,KAAK,EAAE,SAAS,EAAE;AAAA,IAClB,YAAY,EAAE,SAAS,EAAE;AAAA,IACzB,MAAM,CAAC;AAAA,IACP,UAAU,CAAC;AAAA,IACX,MAAM,EAAE,SAAS,EAAE;AAAA,EACrB;AAAA,EACA,OAAO,CAAC,SAAS,OAAO,SAAS,YAAY,WAAW,eAAe,eAAe,aAAa,SAAS,mBAAmB;AAAA,EAC/H,MAAMC,GAAc,EAAE,MAAMC,KAAU;AAExC,UAAMC,IAAQF,GAERG,IAAOF,GAIPG,IAAYC,KACZC,IAAQD,KACRE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ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, normalizeStyle as _normalizeStyle, unref as _unref, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-slider__slider-container\" }\nconst _hoisted_2 = [\"id\", \"disabled\", \"name\", \"readonly\", \"value\"]\nconst _hoisted_3 = [\"aria-readonly\", \"aria-valuemax\", \"aria-valuemin\", \"aria-valuenow\", \"tabindex\"]\n\nimport { clamp } from '@/utilities/functions/clamp';\nimport { computed, onMounted, ref, watchEffect } from 'vue';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { isNil } from '@/utilities/functions/isNil';\nimport { transposeValue } from '@/utilities/functions/percentage';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\n\nexport type BaseSliderProps = {\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Maximum value cap.\n\t */\n\tmax?: number;\n\n\t/**\n\t * Minimum value cap.\n\t */\n\tmin?: number;\n\n\t/**\n\t * Used by v-model.\n\t */\n\tmodelValue: number | string | null;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * The step attribute is a number that specifies the granularity that the value must adhere to.\n\t */\n\tstep?: number;\n};\n\nexport type BaseSliderEvents = {\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'end', value: BaseSliderProps['modelValue']): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'pointerdown', event: PointerEvent): void;\n\t(e: 'pointermove', event: PointerEvent): void;\n\t(e: 'pointerup', event: PointerEvent): void;\n\t(e: 'start', value: BaseSliderProps['modelValue']): void;\n\t(e: 'update:modelValue', event: number): void;\n};\n\nexport type BaseSliderSlots = {\n\tappend: (props: {}) => any;\n\n\tprepend: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSlider',\n props: {\n autofocus: {},\n color: {},\n disabled: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n max: { default: 100 },\n min: { default: 0 },\n modelValue: { default: 0 },\n name: {},\n readonly: {},\n step: { default: 1 }\n },\n emits: [\"click\", \"end\", \"focus\", \"inactive\", \"keydown\", \"pointerdown\", \"pointermove\", \"pointerup\", \"start\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst container = ref<HTMLElement>();\nconst track = ref<HTMLElement>();\nconst thumb = ref<HTMLElement>();\nconst internalValue = ref(0);\n\nconst active = ref(false);\n\nonMounted(() => {\n\tif (props.autofocus) {\n\t\tthumb.value?.focus();\n\t}\n});\n\nwatchEffect(() => {\n\t// Useful for ranges from negative to positive\n\tlet value = isNil(props.modelValue) ? props.min : Number(props.modelValue);\n\tconst transposedValue = transposeValue({\n\t\tvalue,\n\t\ttargetBounds: { min: 0, max: 100 },\n\t\toriginalBounds: { min: props.min, max: props.max },\n\t\tstep: 1,\n\t});\n\tinternalValue.value = transposedValue;\n});\n\nlet thumbPressed = ref(false);\n// Listen on doc to avoid releasing if user leaves thumb while dragging\nconst onPointerdown = (event: PointerEvent) => {\n\tif (props.disabled || props.readonly) return;\n\tthumbPressed.value = true;\n\tdocument.addEventListener('pointermove', onPointermove);\n\tdocument.addEventListener('pointerup', onPointerup);\n\n\temit('pointerdown', event);\n\temit('start', props.modelValue);\n};\n\nconst onPointermove = (event: PointerEvent | MouseEvent) => {\n\tif (props.disabled || props.readonly) return;\n\tif (track.value) {\n\t\tconst trackPosition = track.value.getBoundingClientRect();\n\t\tconst clickOffset = event.clientX;\n\t\tconst trackStart = trackPosition.left;\n\t\tconst trackLength = trackPosition.width;\n\t\tconst transposed = transposeValue({\n\t\t\tvalue: clamp(clickOffset, trackStart, trackStart + trackLength),\n\t\t\toriginalBounds: { min: trackStart, max: trackStart + trackLength },\n\t\t\ttargetBounds: { min: props.min, max: props.max },\n\t\t\tstep: props.step,\n\t\t});\n\t\tif (event instanceof PointerEvent) {\n\t\t\temit('pointermove', event);\n\t\t} else {\n\t\t\temit('click', event);\n\t\t}\n\t\temit('update:modelValue', transposed);\n\t}\n};\n\nconst onPointerup = (event: PointerEvent) => {\n\tthumbPressed.value = false;\n\tdocument.removeEventListener('pointermove', onPointermove);\n\tdocument.removeEventListener('pointerup', onPointerup);\n\temit('pointerup', event);\n\temit('end', props.modelValue);\n};\nlet listeners = computed(() => (thumbPressed.value ? {} : { onPointerdown }));\n\nconst onKeydown = (event: KeyboardEvent) => {\n\temit('keydown', event);\n\tif (\n\t\tprops.disabled ||\n\t\tprops.readonly ||\n\t\t(event.key !== 'ArrowLeft' && event.key !== 'ArrowRight')\n\t)\n\t\treturn;\n\tlet value = Number(props.modelValue);\n\tif (event.key === 'ArrowLeft') {\n\t\tvalue = Math.max(value - props.step, props.min);\n\t} else if (event.key === 'ArrowRight') {\n\t\tvalue = Math.min(value + props.step, props.max);\n\t}\n\temit('update:modelValue', value);\n};\n\nconst onFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tif (!active.value) {\n\t\tactive.value = true;\n\t\tdocument.addEventListener('focusin', onDocumentFocus);\n\t\tdocument.addEventListener('click', onDocumentClick);\n\t}\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\tactive.value = false;\n\t\t\temit('inactive');\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\tactive.value = false;\n\t\t\temit('inactive');\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst containerAttributes = {\n\tclass: {\n\t\t'bb-base-slider': true,\n\t\t'bb-base-slider--disabled': props.disabled,\n\t\t'bb-base-slider--errors': props.hasErrors,\n\t\t'bb-base-slider--readonly': props.readonly,\n\t\t[`bb-base-slider--${props.color}`]: props.color && !isCssColor(props.color),\n\t},\n\tonClick: (event: MouseEvent) => {\n\t\tonPointermove(event);\n\t\tthumb.value?.focus();\n\t},\n};\n\nconst sliderBackgroundAttributes = computed(() => {\n\tconst classes = 'bb-base-slider__track-background';\n\tconst style: Record<string, any> = {\n\t\twidth: `${internalValue.value}%`,\n\t};\n\tif (props.color && isCssColor(props.color)) {\n\t\tstyle.backgroundColor = props.color;\n\t}\n\treturn {\n\t\tclass: classes,\n\t\tstyle,\n\t};\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", _mergeProps(containerAttributes, {\n ref_key: \"container\",\n ref: container\n }), [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"span\", _hoisted_1, [\n _createElementVNode(\"input\", {\n id: _ctx.id,\n disabled: _ctx.disabled,\n name: _ctx.name,\n readonly: _ctx.readonly,\n tabindex: -1,\n type: 'hidden',\n value: _ctx.modelValue\n }, null, 8, _hoisted_2),\n _createElementVNode(\"span\", {\n ref_key: \"track\",\n ref: track,\n class: \"bb-base-slider__track-container\"\n }, [\n _createElementVNode(\"span\", _normalizeProps(_guardReactiveProps(sliderBackgroundAttributes.value)), null, 16),\n _createElementVNode(\"span\", {\n class: \"bb-base-slider__track-fill\",\n style: _normalizeStyle({ width: `${100 - internalValue.value}%` })\n }, null, 4)\n ], 512),\n _createElementVNode(\"span\", _mergeProps(_unref(listeners), {\n ref_key: \"thumb\",\n ref: thumb,\n \"aria-label\": 'thumb-color',\n \"aria-orientation\": 'horizontal',\n \"aria-readonly\": !_ctx.readonly,\n \"aria-valuemax\": _ctx.max,\n \"aria-valuemin\": _ctx.min,\n \"aria-valuenow\": _ctx.modelValue ?? undefined,\n class: 'bb-base-slider__thumb-container',\n role: 'slider',\n style: { left: `${internalValue.value}%` },\n tabindex: _ctx.disabled ? -1 : 0,\n onFocus: onFocus,\n onKeydown: onKeydown\n }), [\n _createElementVNode(\"span\", {\n class: \"bb-base-slider__thumb\",\n style: _normalizeStyle({\n\t\t\t\t\t\ttransform: `translateY(-50%) translateX(-${internalValue.value}%)`,\n\t\t\t\t\t\tleft: `${internalValue.value}%`,\n\t\t\t\t\t})\n }, null, 4)\n ], 16, _hoisted_3)\n ]),\n _renderSlot(_ctx.$slots, \"append\")\n ], 16))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","container","ref","track","thumb","internalValue","active","onMounted","_a","watchEffect","value","isNil","transposedValue","transposeValue","thumbPressed","onPointerdown","event","onPointermove","onPointerup","trackPosition","clickOffset","trackStart","trackLength","transposed","clamp","listeners","computed","onKeydown","onFocus","onDocumentFocus","onDocumentClick","containerAttributes","isCssColor","sliderBackgroundAttributes","classes","style","_ctx","_cache","_openBlock","_createElementBlock","_mergeProps","_renderSlot","_createElementVNode","_normalizeProps","_guardReactiveProps","_normalizeStyle","_unref"],"mappings":";;;;;AAGA,MAAMA,IAAa,EAAE,OAAO,sCACtBC,IAAa,CAAC,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AAK;AAAA,UACvB,iBAAiBA,EAAK;AAAA,UACtB,iBAAiBA,EAAK;AAAA,UACtB,iBAAiBA,EAAK,cAAc;AAAA,UACpC,OAAO;AAAA,UACP,MAAM;AAAA,UACN,OAAO,EAAE,MAAM,GAAG/B,EAAc,KAAK,IAAI;AAAA,UACzC,UAAU+B,EAAK,WAAW,KAAK;AAAA,UAC/B,SAAAR;AAAA,UACA,WAAAD;AAAA,QAAA,CACD,GAAG;AAAA,UACFe,EAAoB,QAAQ;AAAA,YAC1B,OAAO;AAAA,YACP,OAAOG,EAAgB;AAAA,cAC3B,WAAW,gCAAgCxC,EAAc,KAAK;AAAA,cAC9D,MAAM,GAAGA,EAAc,KAAK;AAAA,YAAA,CAC5B;AAAA,UAAA,GACK,MAAM,CAAC;AAAA,QAAA,GACT,IAAIX,CAAU;AAAA,MAAA,CAClB;AAAA,MACD+C,EAAYL,EAAK,QAAQ,QAAQ;AAAA,OAChC,EAAE;AAAA,EAEP;AAEA,CAAC;"}
package/dist/index35.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as I, ref as b, computed as n, watch as F, openBlock as m, createElementBlock as p, normalizeClass as N, normalizeProps as c, mergeProps as h, createCommentVNode as S, createElementVNode as l, renderSlot as x, guardReactiveProps as f } from "vue";
2
- import { isCssColor as V } from "./index211.js";
3
- import { when as A } from "./index212.js";
2
+ import { isCssColor as V } from "./index197.js";
3
+ import { when as A } from "./index198.js";
4
4
  const J = { class: "bb-base-switch-container" }, M = /* @__PURE__ */ l("span", { class: "bb-base-switch-container__icon-thumb" }, null, -1), O = [
5
5
  M
6
6
  ], H = /* @__PURE__ */ I({
@@ -1 +1 @@
1
- {"version":3,"file":"index35.js","sources":["../src/components/BaseSwitch/BaseSwitch.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, openBlock as _openBlock, createElementBlock as _createElementBlock, mergeProps as _mergeProps, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-switch-container\" }\nconst _hoisted_2 = /*#__PURE__*/_createElementVNode(\"span\", { class: \"bb-base-switch-container__icon-thumb\" }, null, -1)\nconst _hoisted_3 = [\n _hoisted_2\n]\n\nimport { computed, ref, watch } from \"vue\";\nimport { isCssColor } from \"@/utilities/functions/isCssColor\";\nimport { when } from \"@/utilities/functions/when\";\nimport type { BaseCheckboxEvents, BaseCheckboxProps, SlotAttributes } from \"../BaseCheckbox/BaseCheckbox.vue\";\n\nexport type BaseSwitchProps = BaseCheckboxProps;\n\nexport type BaseSwitchEvents = BaseCheckboxEvents;\n\nexport type BaseSwitchSlots = {\n icon?: (props: SlotAttributes) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSwitch',\n props: {\n autofocus: {},\n checked: {},\n color: {},\n disabled: { type: Boolean },\n falseValue: { default: false },\n hasErrors: { type: Boolean },\n id: {},\n indeterminate: {},\n name: {},\n readonly: {},\n submitWhenFalse: { type: Boolean },\n trueValue: { default: true },\n modelValue: {}\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst checkboxInput = ref<HTMLInputElement | null>(null);\n\nconst checked = computed(() => {\n if (props.checked) return true;\n return JSON.stringify(props.trueValue) === JSON.stringify(props.modelValue);\n});\nconst hasFocus = ref(false);\n\nconst classes = computed(() => {\n return {\n \"bb-base-switch\": true,\n \"bb-base-switch--disabled\": props.disabled,\n \"bb-base-switch--errors\": props.hasErrors,\n \"bb-base-switch--indeterminate\": props.indeterminate,\n \"bb-base-switch--readonly\": props.readonly,\n [`bb-base-switch--${props.color}`]: props.color && !isCssColor(props.color),\n };\n});\n\n/**\n * This is used to keep the value compatible to common html expected values.\n * Convert to string everything that's not but do not double encode strings\n */\nconst makeInputValue = when(\n (item: unknown) => typeof item !== \"string\",\n JSON.stringify\n);\n\nconst hiddenInputAttributes = computed(() => {\n const value = makeInputValue(props.falseValue);\n return {\n disabled: props.disabled,\n name: props.name,\n type: \"hidden\",\n value: value,\n };\n});\n\nconst inputAttributes = computed(() => {\n const value = makeInputValue(props.trueValue);\n\n const onBlur = (event: FocusEvent): void => {\n hasFocus.value = false;\n emit(\"blur\", event);\n };\n\n const onChange = (event: Event): void => {\n if (event.target instanceof HTMLInputElement) {\n let value = event.target.checked ? props.trueValue : props.falseValue;\n\n emit(\"change\", event);\n emit(\"update:modelValue\", value);\n }\n };\n\n const onFocus = (event: FocusEvent): void => {\n hasFocus.value = true;\n emit(\"focus\", event);\n };\n\n const eventListeners = {\n onBlur,\n onChange,\n onClick: (event: MouseEvent) => emit(\"click\", event),\n onFocus,\n onInput: (event: Event) => emit(\"input\", event),\n onKeydown: (event: KeyboardEvent) => emit(\"keydown\", event),\n onMousedown: (event: MouseEvent) => emit(\"mousedown\", event),\n onMouseup: (event: MouseEvent) => emit(\"mouseup\", event),\n };\n\n return {\n autofocus: props.autofocus,\n checked: checked.value,\n // There is no such thing as readonly checkbox so we disable and style it with css\n disabled: props.disabled || props.readonly,\n id: props.id,\n indeterminate: props.indeterminate,\n name: props.name,\n tabindex: props.disabled ? -1 : undefined,\n type: \"checkbox\",\n value: value,\n ...eventListeners,\n };\n});\n\nconst slotAttributes = computed(() => ({\n checked: checked.value,\n disabled: props.disabled,\n falseValue: props.falseValue,\n focused: hasFocus.value,\n hasErrors: props.hasErrors,\n id: props.id,\n name: props.name,\n parsedValue: inputAttributes.value.value,\n readonly: props.readonly,\n trueValue: props.trueValue,\n value: checked.value ? props.trueValue : props.falseValue,\n}));\n\nconst iconAttributes = computed(() => {\n let style: { [key: string]: string } = {};\n if (props.color && isCssColor(props.color)) {\n style.color = props.color;\n }\n return {\n class: \"bb-base-switch-container__icon\",\n style,\n };\n});\n\n/**\n * Indeterminate is a very volatile prop that is reset upon clicking,\n * this keeps the state and the prop aligned\n */\nwatch(\n () => [props.modelValue, props.checked, props.indeterminate],\n () => {\n if (checkboxInput.value) {\n checkboxInput.value.indeterminate = !!props.indeterminate;\n }\n }\n);\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass(classes.value)\n }, [\n (!checked.value && _ctx.submitWhenFalse)\n ? (_openBlock(), _createElementBlock(\"input\", _normalizeProps(_mergeProps({ key: 0 }, hiddenInputAttributes.value)), null, 16))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"input\", _mergeProps(inputAttributes.value, {\n ref_key: \"checkboxInput\",\n ref: checkboxInput\n }), null, 16),\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"icon\", _normalizeProps(_guardReactiveProps(slotAttributes.value)), () => [\n _createElementVNode(\"span\", _normalizeProps(_guardReactiveProps(iconAttributes.value)), _hoisted_3, 16)\n ])\n ])\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","checkboxInput","ref","checked","computed","hasFocus","classes","isCssColor","makeInputValue","when","item","hiddenInputAttributes","value","inputAttributes","eventListeners","event","slotAttributes","iconAttributes","style","watch","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_normalizeProps","_mergeProps","_createCommentVNode","_createElementVNode","_renderSlot","_guardReactiveProps"],"mappings":";;;AAGA,MAAMA,IAAa,EAAE,OAAO,8BACtBC,sBAA8C,QAAQ,EAAE,OAAO,0CAA0C,MAAM,EAAE,GACjHC,IAAa;AAAA,EACjBD;AACF,GAgB4BE,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,WAAW,CAAC;AAAA,IACZ,SAAS,CAAC;AAAA,IACV,OAAO,CAAC;AAAA,IACR,UAAU,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
+ {"version":3,"file":"index35.js","sources":["../src/components/BaseSwitch/BaseSwitch.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, openBlock as _openBlock, createElementBlock as _createElementBlock, mergeProps as _mergeProps, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-switch-container\" }\nconst _hoisted_2 = /*#__PURE__*/_createElementVNode(\"span\", { class: \"bb-base-switch-container__icon-thumb\" }, null, -1)\nconst _hoisted_3 = [\n _hoisted_2\n]\n\nimport { computed, ref, watch } from 'vue';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { when } from '@/utilities/functions/when';\nimport type {\n\tBaseCheckboxEvents,\n\tBaseCheckboxProps,\n\tSlotAttributes,\n} from '../BaseCheckbox/BaseCheckbox.vue';\n\nexport type BaseSwitchProps = BaseCheckboxProps;\n\nexport type BaseSwitchEvents = BaseCheckboxEvents;\n\nexport type BaseSwitchSlots = {\n\ticon?: (props: SlotAttributes) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSwitch',\n props: {\n autofocus: {},\n checked: {},\n color: {},\n disabled: { type: Boolean },\n falseValue: { default: false },\n hasErrors: { type: Boolean },\n id: {},\n indeterminate: {},\n name: {},\n readonly: {},\n submitWhenFalse: { type: Boolean },\n trueValue: { default: true },\n modelValue: {}\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst checkboxInput = ref<HTMLInputElement | null>(null);\n\nconst checked = computed(() => {\n\tif (props.checked) return true;\n\treturn JSON.stringify(props.trueValue) === JSON.stringify(props.modelValue);\n});\nconst hasFocus = ref(false);\n\nconst classes = computed(() => {\n\treturn {\n\t\t'bb-base-switch': true,\n\t\t'bb-base-switch--disabled': props.disabled,\n\t\t'bb-base-switch--errors': props.hasErrors,\n\t\t'bb-base-switch--indeterminate': props.indeterminate,\n\t\t'bb-base-switch--readonly': props.readonly,\n\t\t[`bb-base-switch--${props.color}`]: props.color && !isCssColor(props.color),\n\t};\n});\n\n/**\n * This is used to keep the value compatible to common html expected values.\n * Convert to string everything that's not but do not double encode strings\n */\nconst makeInputValue = when(\n\t(item: unknown) => typeof item !== 'string',\n\tJSON.stringify\n);\n\nconst hiddenInputAttributes = computed(() => {\n\tconst value = makeInputValue(props.falseValue);\n\treturn {\n\t\tdisabled: props.disabled,\n\t\tname: props.name,\n\t\ttype: 'hidden',\n\t\tvalue: value,\n\t};\n});\n\nconst inputAttributes = computed(() => {\n\tconst value = makeInputValue(props.trueValue);\n\n\tconst onBlur = (event: FocusEvent): void => {\n\t\thasFocus.value = false;\n\t\temit('blur', event);\n\t};\n\n\tconst onChange = (event: Event): void => {\n\t\tif (event.target instanceof HTMLInputElement) {\n\t\t\tlet value = event.target.checked ? props.trueValue : props.falseValue;\n\n\t\t\temit('change', event);\n\t\t\temit('update:modelValue', value);\n\t\t}\n\t};\n\n\tconst onFocus = (event: FocusEvent): void => {\n\t\thasFocus.value = true;\n\t\temit('focus', event);\n\t};\n\n\tconst eventListeners = {\n\t\tonBlur,\n\t\tonChange,\n\t\tonClick: (event: MouseEvent) => emit('click', event),\n\t\tonFocus,\n\t\tonInput: (event: Event) => emit('input', event),\n\t\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\t\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\t\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n\t};\n\n\treturn {\n\t\tautofocus: props.autofocus,\n\t\tchecked: checked.value,\n\t\t// There is no such thing as readonly checkbox so we disable and style it with css\n\t\tdisabled: props.disabled || props.readonly,\n\t\tid: props.id,\n\t\tindeterminate: props.indeterminate,\n\t\tname: props.name,\n\t\ttabindex: props.disabled ? -1 : undefined,\n\t\ttype: 'checkbox',\n\t\tvalue: value,\n\t\t...eventListeners,\n\t};\n});\n\nconst slotAttributes = computed(() => ({\n\tchecked: checked.value,\n\tdisabled: props.disabled,\n\tfalseValue: props.falseValue,\n\tfocused: hasFocus.value,\n\thasErrors: props.hasErrors,\n\tid: props.id,\n\tname: props.name,\n\tparsedValue: inputAttributes.value.value,\n\treadonly: props.readonly,\n\ttrueValue: props.trueValue,\n\tvalue: checked.value ? props.trueValue : props.falseValue,\n}));\n\nconst iconAttributes = computed(() => {\n\tlet style: { [key: string]: string } = {};\n\tif (props.color && isCssColor(props.color)) {\n\t\tstyle.color = props.color;\n\t}\n\treturn {\n\t\tclass: 'bb-base-switch-container__icon',\n\t\tstyle,\n\t};\n});\n\n/**\n * Indeterminate is a very volatile prop that is reset upon clicking,\n * this keeps the state and the prop aligned\n */\nwatch(\n\t() => [props.modelValue, props.checked, props.indeterminate],\n\t() => {\n\t\tif (checkboxInput.value) {\n\t\t\tcheckboxInput.value.indeterminate = !!props.indeterminate;\n\t\t}\n\t}\n);\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass(classes.value)\n }, [\n (!checked.value && _ctx.submitWhenFalse)\n ? (_openBlock(), _createElementBlock(\"input\", _normalizeProps(_mergeProps({ key: 0 }, hiddenInputAttributes.value)), null, 16))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"input\", _mergeProps(inputAttributes.value, {\n ref_key: \"checkboxInput\",\n ref: checkboxInput\n }), null, 16),\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"icon\", _normalizeProps(_guardReactiveProps(slotAttributes.value)), () => [\n _createElementVNode(\"span\", _normalizeProps(_guardReactiveProps(iconAttributes.value)), _hoisted_3, 16)\n ])\n ])\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","checkboxInput","ref","checked","computed","hasFocus","classes","isCssColor","makeInputValue","when","item","hiddenInputAttributes","value","inputAttributes","eventListeners","event","slotAttributes","iconAttributes","style","watch","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_normalizeProps","_mergeProps","_createCommentVNode","_createElementVNode","_renderSlot","_guardReactiveProps"],"mappings":";;;AAGA,MAAMA,IAAa,EAAE,OAAO,8BACtBC,sBAA8C,QAAQ,EAAE,OAAO,0CAA0C,MAAM,EAAE,GACjHC,IAAa;AAAA,EACjBD;AACF,GAoB4BE,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,WAAW,CAAC;AAAA,IACZ,SAAS,CAAC;AAAA,IACV,OAAO,CAAC;AAAA,IACR,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,YAAY,EAAE,SAAS,GAAM;AAAA,IAC7B,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC3B,IAAI,CAAC;AAAA,IACL,eAAe,CAAC;AAAA,IAChB,MAAM,CAAC;AAAA,IACP,UAAU,CAAC;AAAA,IACX,iBAAiB,EAAE,MAAM,QAAQ;AAAA,IACjC,WAAW,EAAE,SAAS,GAAK;AAAA,IAC3B,YAAY,CAAC;AAAA,EACf;AAAA,EACA,OAAO,CAAC,QAAQ,UAAU,SAAS,SAAS,SAAS,WAAW,aAAa,WAAW,mBAAmB;AAAA,EAC3G,MAAMC,GAAc,EAAE,MAAMC,KAAU;AAExC,UAAMC,IAAQF,GAERG,IAAOF,GAIPG,IAAgBC,EAA6B,IAAI,GAEjDC,IAAUC,EAAS,MACpBL,EAAM,UAAgB,KACnB,KAAK,UAAUA,EAAM,SAAS,MAAM,KAAK,UAAUA,EAAM,UAAU,CAC1E,GACKM,IAAWH,EAAI,EAAK,GAEpBI,IAAUF,EAAS,OACjB;AAAA,MACN,kBAAkB;AAAA,MAClB,4BAA4BL,EAAM;AAAA,MAClC,0BAA0BA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BC,EAAY,EAAE,KAAK,EAAE,GAAGf,EAAsB,KAAK,CAAC,GAAG,MAAM,EAAE,KAC3HgB,EAAoB,IAAI,EAAI;AAAA,MAChCC,EAAoB,SAASF,EAAYb,EAAgB,OAAO;AAAA,QAC9D,SAAS;AAAA,QACT,KAAKZ;AAAA,MAAA,CACN,GAAG,MAAM,EAAE;AAAA,MACZ2B,EAAoB,QAAQpC,GAAY;AAAA,QACtCqC,EAAYT,EAAK,QAAQ,QAAQK,EAAgBK,EAAoBd,EAAe,KAAK,CAAC,GAAG,MAAM;AAAA,UACjGY,EAAoB,QAAQH,EAAgBK,EAAoBb,EAAe,KAAK,CAAC,GAAGvB,GAAY,EAAE;AAAA,QAAA,CACvG;AAAA,MAAA,CACF;AAAA,OACA,CAAC;AAAA,EAEN;AAEA,CAAC;"}
package/dist/index37.js CHANGED
@@ -34,7 +34,7 @@ const O = { class: "bb-base-switch-group__container" }, j = {
34
34
  },
35
35
  emits: ["blur", "change", "click", "focus", "inactive", "input", "keydown", "mousedown", "mouseup", "update:modelValue"],
36
36
  setup(T, { emit: E }) {
37
- const o = T, a = E, u = V(), c = V(!1), { loading: C, options: m } = M({
37
+ const o = T, a = E, u = V(), c = V(!1), { loading: L, options: m } = M({
38
38
  dependencies: l(() => o.dependencies),
39
39
  depsDebounceTime: o.depsDebounceTime,
40
40
  disabled: l(() => o.disabled),
@@ -49,11 +49,11 @@ const O = { class: "bb-base-switch-group__container" }, j = {
49
49
  modelValue: l(() => o.modelValue),
50
50
  modelValueDebounceTime: o.modelValueDebounceTime,
51
51
  multiple: !0
52
- }), L = (e) => {
52
+ }), C = (e) => {
53
53
  let n;
54
54
  e.selected ? n = o.modelValue.slice(0, e.selectedIndex).concat(o.modelValue.slice(e.selectedIndex + 1)) : n = o.modelValue.concat(e.value), a("update:modelValue", n);
55
55
  }, D = (e, n) => {
56
- a("change", e), L(n);
56
+ a("change", e), C(n);
57
57
  }, $ = {
58
58
  onBlur: (e) => a("blur", e),
59
59
  onClick: (e) => a("click", e),
@@ -72,17 +72,17 @@ const O = { class: "bb-base-switch-group__container" }, j = {
72
72
  e.target instanceof HTMLElement && ((n = u.value) != null && n.contains(e.target) || (a("inactive"), c.value = !1, document.removeEventListener("focusin", b), document.removeEventListener("click", p)));
73
73
  };
74
74
  return (e, n) => (i(), r("span", {
75
+ ref_key: "container",
76
+ ref: u,
75
77
  class: h(["bb-base-switch-group", {
76
78
  "bb-base-switch-group--errors": e.hasErrors,
77
79
  "bb-base-switch-group--horizontal": e.direction === "horizontal",
78
80
  "bb-base-switch-group--vertical": e.direction === "vertical"
79
- }]),
80
- ref_key: "container",
81
- ref: u
81
+ }])
82
82
  }, [
83
83
  g("span", O, [
84
84
  s(e.$slots, "prepend"),
85
- !d(m).length && d(C) ? (i(), r("span", j, [
85
+ !d(m).length && d(L) ? (i(), r("span", j, [
86
86
  s(e.$slots, "loading", {}, () => [
87
87
  v(y(e.loadingText), 1)
88
88
  ])
@@ -103,15 +103,15 @@ const O = { class: "bb-base-switch-group__container" }, j = {
103
103
  }])
104
104
  }, [
105
105
  F(H, w({
106
+ id: t.id,
106
107
  autofocus: e.autofocus && !B,
107
108
  checked: t.selected,
108
109
  color: e.color,
109
110
  disabled: t.disabled,
110
111
  "has-errors": e.hasErrors,
111
- id: t.id,
112
112
  name: e.name,
113
+ "on-change": (f) => D(f, t),
113
114
  readonly: e.readonly,
114
- onChange: (f) => D(f, t),
115
115
  "true-value": t.value
116
116
  }, $), N({ _: 2 }, [
117
117
  e.$slots.icon ? {
@@ -124,7 +124,7 @@ const O = { class: "bb-base-switch-group__container" }, j = {
124
124
  ]),
125
125
  key: "0"
126
126
  } : void 0
127
- ]), 1040, ["autofocus", "checked", "color", "disabled", "has-errors", "id", "name", "readonly", "onChange", "true-value"]),
127
+ ]), 1040, ["id", "autofocus", "checked", "color", "disabled", "has-errors", "name", "on-change", "readonly", "true-value"]),
128
128
  g("span", {
129
129
  class: h({
130
130
  "bb-base-switch-group-option__text": !0,
@@ -132,9 +132,9 @@ const O = { class: "bb-base-switch-group__container" }, j = {
132
132
  })
133
133
  }, [
134
134
  s(e.$slots, "label", {
135
- text: t.text,
135
+ checked: t.selected,
136
136
  item: t.original,
137
- checked: t.selected
137
+ text: t.text
138
138
  }, () => [
139
139
  v(y(t.text), 1)
140
140
  ])
@@ -1 +1 @@
1
- {"version":3,"file":"index37.js","sources":["../src/components/BaseSwitchGroup/BaseSwitchGroup.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-switch-group__container\" }\nconst _hoisted_2 = {\n key: 0,\n class: \"bb-base-switch-group__loading-container\"\n}\nconst _hoisted_3 = {\n key: 1,\n class: \"bb-base-select__no-data-container\"\n}\n\nimport { ref, toRef } from \"vue\";\nimport { useOptions } from \"@/composables/useOptions\";\nimport BaseSwitch from \"../BaseSwitch/BaseSwitch.vue\";\nimport type { Option } from \"@/composables/useOptions\";\nimport type { SlotAttributes } from \"../BaseCheckbox/BaseCheckbox.vue\";\nimport type { BaseCheckboxGroupEvents, BaseCheckboxGroupProps } from \"../BaseCheckboxGroup/BaseCheckboxGroup.vue\";\n\nexport type BaseSwitchGroupEvents = BaseCheckboxGroupEvents;\n\nexport type BaseSwitchGroupProps<T> = BaseCheckboxGroupProps<T>;\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSwitchGroup',\n props: {\n autofocus: {},\n color: {},\n dependencies: {},\n depsDebounceTime: { default: 0 },\n direction: { default: \"horizontal\" },\n disabled: { type: Boolean },\n enforceCoherence: { type: Boolean },\n hasErrors: { type: Boolean },\n hideLabel: { type: Boolean },\n id: {},\n items: { type: [Array, Function], default: () => [] },\n itemText: {},\n itemValue: {},\n loadingText: { default: \"Caricamento...\" },\n matchStrategy: { default: \"string\" },\n modelValue: {},\n modelValueDebounceTime: { default: 0 },\n name: {},\n noDataText: { default: \"Nessun elemento da visualizzare\" },\n readonly: {}\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"inactive\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst { loading, options } = useOptions({\n dependencies: toRef(() => props.dependencies),\n depsDebounceTime: props.depsDebounceTime,\n disabled: toRef(() => props.disabled),\n emitter: (value) => emit(\"update:modelValue\", value),\n enforceCoherence: toRef(() => props.enforceCoherence),\n id: props.id,\n immediate: true,\n initialItems: toRef(() => props.items),\n itemText: props.itemText,\n itemValue: props.itemValue,\n matchStrategy: \"string\",\n modelValue: toRef(() => props.modelValue),\n modelValueDebounceTime: props.modelValueDebounceTime,\n multiple: true,\n});\n\n/**\n * When selecting an option split behavior based on single or multiple selection\n */\nconst onOptionSelected = (option: Option) => {\n let valueToEmit;\n if (option.selected) {\n valueToEmit = props.modelValue\n .slice(0, option.selectedIndex)\n .concat(props.modelValue.slice(option.selectedIndex + 1));\n } else {\n valueToEmit = props.modelValue.concat(option.value);\n }\n emit(\"update:modelValue\", valueToEmit);\n};\n\nconst onChange = (event: Event, option: Option) => {\n emit(\"change\", event);\n onOptionSelected(option);\n};\n\nconst onFocus = (event: FocusEvent) => {\n emit(\"focus\", event);\n if (!active.value) {\n document.addEventListener(\"focusin\", onDocumentFocus, { passive: true });\n document.addEventListener(\"click\", onDocumentClick, { passive: true });\n active.value = true;\n }\n};\n\nconst eventListeners = {\n onBlur: (event: FocusEvent) => emit(\"blur\", event),\n onClick: (event: MouseEvent) => emit(\"click\", event),\n onFocus,\n onInput: (event: Event) => emit(\"input\", event),\n onKeydown: (event: KeyboardEvent) => emit(\"keydown\", event),\n onMousedown: (event: MouseEvent) => emit(\"mousedown\", event),\n onMouseup: (event: MouseEvent) => emit(\"mouseup\", event),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n emit(\"inactive\");\n active.value = false;\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n emit(\"inactive\");\n active.value = false;\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass([\"bb-base-switch-group\", {\n 'bb-base-switch-group--errors': _ctx.hasErrors,\n 'bb-base-switch-group--horizontal': _ctx.direction === 'horizontal',\n 'bb-base-switch-group--vertical': _ctx.direction === 'vertical',\n }]),\n ref_key: \"container\",\n ref: container\n }, [\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n (!_unref(options).length && _unref(loading))\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, 'loading', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.loadingText), 1)\n ])\n ]))\n : (!_unref(options).length)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_3, [\n _renderSlot(_ctx.$slots, 'no-data', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.noDataText), 1)\n ])\n ]))\n : _createCommentVNode(\"\", true),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_unref(options), (option, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: option?.id || option.jsonValue\n }, [\n _renderSlot(_ctx.$slots, \"option:prepend\", {\n item: option.original\n }),\n _createElementVNode(\"label\", {\n class: _normalizeClass([\"bb-base-switch-group-option\", {\n 'bb-base-switch-group-option__selected': option.selected,\n }])\n }, [\n _createVNode(BaseSwitch, _mergeProps({\n autofocus: _ctx.autofocus && !index,\n checked: option.selected,\n color: _ctx.color,\n disabled: option.disabled,\n \"has-errors\": _ctx.hasErrors,\n id: option.id,\n name: _ctx.name,\n readonly: _ctx.readonly,\n onChange: (event) => onChange(event, option),\n \"true-value\": option.value\n }, eventListeners), _createSlots({ _: 2 }, [\n (_ctx.$slots.icon)\n ? {\n name: \"icon\",\n fn: _withCtx((data) => [\n _renderSlot(_ctx.$slots, \"icon\", _mergeProps({\n item: option.original,\n text: option.text\n }, data))\n ]),\n key: \"0\"\n }\n : undefined\n ]), 1040, [\"autofocus\", \"checked\", \"color\", \"disabled\", \"has-errors\", \"id\", \"name\", \"readonly\", \"onChange\", \"true-value\"]),\n _createElementVNode(\"span\", {\n class: _normalizeClass({\n 'bb-base-switch-group-option__text': true,\n 'bb-base-switch-group-option__text--hidden': _ctx.hideLabel,\n })\n }, [\n _renderSlot(_ctx.$slots, \"label\", {\n text: option.text,\n item: option.original,\n checked: option.selected\n }, () => [\n _createTextVNode(_toDisplayString(option.text), 1)\n ])\n ], 2)\n ], 2),\n _renderSlot(_ctx.$slots, \"option:append\", {\n item: option.original\n })\n ], 64))\n }), 128)),\n _renderSlot(_ctx.$slots, \"append\")\n ])\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","container","ref","active","loading","options","useOptions","toRef","value","onOptionSelected","option","valueToEmit","onChange","event","eventListeners","onDocumentFocus","onDocumentClick","_a","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_unref","_createTextVNode","_toDisplayString","_createCommentVNode","_Fragment","_renderList","index","_createVNode","BaseSwitch","_mergeProps","_createSlots","_withC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AAAA,cAEP,IAAA;AAAA,YACL,CAAA,GAAG,MAAM,CAAC,aAAa,WAAW,SAAS,YAAY,cAAc,MAAM,QAAQ,YAAY,YAAY,YAAY,CAAC;AAAA,YACzHd,EAAoB,QAAQ;AAAA,cAC1B,OAAOD,EAAgB;AAAA,gBACvB,qCAAqC;AAAA,gBACrC,6CAA6CJ,EAAK;AAAA,cAAA,CACnD;AAAA,YAAA,GACE;AAAA,cACDM,EAAYN,EAAK,QAAQ,SAAS;AAAA,gBAChC,MAAMR,EAAO;AAAA,gBACb,MAAMA,EAAO;AAAA,gBACb,SAASA,EAAO;AAAA,cAAA,GACf,MAAM;AAAA,gBACPgB,EAAiBC,EAAiBjB,EAAO,IAAI,GAAG,CAAC;AAAA,cAAA,CAClD;AAAA,eACA,CAAC;AAAA,aACH,CAAC;AAAA,UACJc,EAAYN,EAAK,QAAQ,iBAAiB;AAAA,YACxC,MAAMR,EAAO;AAAA,UAAA,CACd;AAAA,WACA,EAAE,EACN,GAAG,GAAG;AAAA,QACPc,EAAYN,EAAK,QAAQ,QAAQ;AAAA,MAAA,CAClC;AAAA,OACA,CAAC;AAAA,EAEN;AAEA,CAAC;"}
1
+ {"version":3,"file":"index37.js","sources":["../src/components/BaseSwitchGroup/BaseSwitchGroup.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-switch-group__container\" }\nconst _hoisted_2 = {\n key: 0,\n class: \"bb-base-switch-group__loading-container\"\n}\nconst _hoisted_3 = {\n key: 1,\n class: \"bb-base-select__no-data-container\"\n}\n\nimport { ref, toRef } from 'vue';\nimport { useOptions } from '@/composables/useOptions';\nimport BaseSwitch from '../BaseSwitch/BaseSwitch.vue';\nimport type { Option } from '@/composables/useOptions';\nimport type { SlotAttributes } from '../BaseCheckbox/BaseCheckbox.vue';\nimport type {\n\tBaseCheckboxGroupEvents,\n\tBaseCheckboxGroupProps,\n} from '../BaseCheckboxGroup/BaseCheckboxGroup.vue';\n\nexport type BaseSwitchGroupEvents = BaseCheckboxGroupEvents;\n\nexport type BaseSwitchGroupProps<T> = BaseCheckboxGroupProps<T>;\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSwitchGroup',\n props: {\n autofocus: {},\n color: {},\n dependencies: {},\n depsDebounceTime: { default: 0 },\n direction: { default: 'horizontal' },\n disabled: { type: Boolean },\n enforceCoherence: { type: Boolean },\n hasErrors: { type: Boolean },\n hideLabel: { type: Boolean },\n id: {},\n items: { type: [Array, Function], default: () => [] },\n itemText: {},\n itemValue: {},\n loadingText: { default: 'Caricamento...' },\n matchStrategy: { default: 'string' },\n modelValue: {},\n modelValueDebounceTime: { default: 0 },\n name: {},\n noDataText: { default: 'Nessun elemento da visualizzare' },\n readonly: {}\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"inactive\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst { loading, options } = useOptions({\n\tdependencies: toRef(() => props.dependencies),\n\tdepsDebounceTime: props.depsDebounceTime,\n\tdisabled: toRef(() => props.disabled),\n\temitter: (value) => emit('update:modelValue', value),\n\tenforceCoherence: toRef(() => props.enforceCoherence),\n\tid: props.id,\n\timmediate: true,\n\tinitialItems: toRef(() => props.items),\n\titemText: props.itemText,\n\titemValue: props.itemValue,\n\tmatchStrategy: 'string',\n\tmodelValue: toRef(() => props.modelValue),\n\tmodelValueDebounceTime: props.modelValueDebounceTime,\n\tmultiple: true,\n});\n\n/**\n * When selecting an option split behavior based on single or multiple selection\n */\nconst onOptionSelected = (option: Option) => {\n\tlet valueToEmit;\n\tif (option.selected) {\n\t\tvalueToEmit = props.modelValue\n\t\t\t.slice(0, option.selectedIndex)\n\t\t\t.concat(props.modelValue.slice(option.selectedIndex + 1));\n\t} else {\n\t\tvalueToEmit = props.modelValue.concat(option.value);\n\t}\n\temit('update:modelValue', valueToEmit);\n};\n\nconst onChange = (event: Event, option: Option) => {\n\temit('change', event);\n\tonOptionSelected(option);\n};\n\nconst onFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tif (!active.value) {\n\t\tdocument.addEventListener('focusin', onDocumentFocus, { passive: true });\n\t\tdocument.addEventListener('click', onDocumentClick, { passive: true });\n\t\tactive.value = true;\n\t}\n};\n\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonClick: (event: MouseEvent) => emit('click', event),\n\tonFocus,\n\tonInput: (event: Event) => emit('input', event),\n\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n ref_key: \"container\",\n ref: container,\n class: _normalizeClass([\"bb-base-switch-group\", {\n\t\t\t'bb-base-switch-group--errors': _ctx.hasErrors,\n\t\t\t'bb-base-switch-group--horizontal': _ctx.direction === 'horizontal',\n\t\t\t'bb-base-switch-group--vertical': _ctx.direction === 'vertical',\n\t\t}])\n }, [\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n (!_unref(options).length && _unref(loading))\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, 'loading', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.loadingText), 1)\n ])\n ]))\n : (!_unref(options).length)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_3, [\n _renderSlot(_ctx.$slots, 'no-data', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.noDataText), 1)\n ])\n ]))\n : _createCommentVNode(\"\", true),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_unref(options), (option, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: option?.id || option.jsonValue\n }, [\n _renderSlot(_ctx.$slots, \"option:prepend\", {\n item: option.original\n }),\n _createElementVNode(\"label\", {\n class: _normalizeClass([\"bb-base-switch-group-option\", {\n\t\t\t\t\t\t'bb-base-switch-group-option__selected': option.selected,\n\t\t\t\t\t}])\n }, [\n _createVNode(BaseSwitch, _mergeProps({\n id: option.id,\n autofocus: _ctx.autofocus && !index,\n checked: option.selected,\n color: _ctx.color,\n disabled: option.disabled,\n \"has-errors\": _ctx.hasErrors,\n name: _ctx.name,\n \"on-change\": (event) => onChange(event, option),\n readonly: _ctx.readonly,\n \"true-value\": option.value\n }, eventListeners), _createSlots({ _: 2 }, [\n (_ctx.$slots.icon)\n ? {\n name: \"icon\",\n fn: _withCtx((data) => [\n _renderSlot(_ctx.$slots, \"icon\", _mergeProps({\n item: option.original,\n text: option.text\n }, data))\n ]),\n key: \"0\"\n }\n : undefined\n ]), 1040, [\"id\", \"autofocus\", \"checked\", \"color\", \"disabled\", \"has-errors\", \"name\", \"on-change\", \"readonly\", \"true-value\"]),\n _createElementVNode(\"span\", {\n class: _normalizeClass({\n\t\t\t\t\t\t\t'bb-base-switch-group-option__text': true,\n\t\t\t\t\t\t\t'bb-base-switch-group-option__text--hidden': _ctx.hideLabel,\n\t\t\t\t\t\t})\n }, [\n _renderSlot(_ctx.$slots, \"label\", {\n checked: option.selected,\n item: option.original,\n text: option.text\n }, () => [\n _createTextVNode(_toDisplayString(option.text), 1)\n ])\n ], 2)\n ], 2),\n _renderSlot(_ctx.$slots, \"option:append\", {\n item: option.original\n })\n ], 64))\n }), 128)),\n _renderSlot(_ctx.$slots, \"append\")\n ])\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","container","ref","active","loading","options","useOptions","toRef","value","onOptionSelected","option","valueToEmit","onChange","event","eventListeners","onDocumentFocus","onDocumentClick","_a","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_unref","_createTextVNode","_toDisplayString","_createCommentVNode","_Fragment","_renderList","index","_createVNode","BaseSwitch","_mergeProps","_createSlots","_withCtx","data"],"mappings":";;;;AAGA,MAAMA,IAAa,EAAE,OAAO,qCACtBC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GAiB4BC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,WAAW,CAAC;AAAA,IACZ,OAAO,CAAC;AAAA,IACR,cAAc,CAAC;AAAA,IACf,kBAAkB,EAAE,SAAS,EAAE;AAAA,IAC/B,WAAW,EAAE,SAAS,aAAa;AAAA,IACnC,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,kBAAkB,EAAE,MAAM,QAAQ;AAAA,IAClC,WAAW,E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AAAA,cAAA,CAClD;AAAA,eACA,CAAC;AAAA,aACH,CAAC;AAAA,UACJc,EAAYN,EAAK,QAAQ,iBAAiB;AAAA,YACxC,MAAMR,EAAO;AAAA,UAAA,CACd;AAAA,WACA,EAAE,EACN,GAAG,GAAG;AAAA,QACPc,EAAYN,EAAK,QAAQ,QAAQ;AAAA,MAAA,CAClC;AAAA,OACA,CAAC;AAAA,EAEN;AAEA,CAAC;"}
package/dist/index39.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as h, ref as y, computed as r, onMounted as g, watch as w, nextTick as k, openBlock as x, createElementBlock as V, normalizeClass as B, renderSlot as l, createElementVNode as u, mergeProps as T } from "vue";
2
- const v = { class: "bb-base-textarea__inner-container" }, E = ["autocomplete", "autofocus", "disabled", "id", "name", "placeholder", "readonly", "value"], M = /* @__PURE__ */ h({
2
+ const v = { class: "bb-base-textarea__inner-container" }, E = ["id", "autocomplete", "autofocus", "disabled", "name", "placeholder", "readonly", "value"], M = /* @__PURE__ */ h({
3
3
  __name: "BaseTextarea",
4
4
  props: {
5
5
  autocomplete: {},
@@ -53,26 +53,24 @@ const v = { class: "bb-base-textarea__inner-container" }, E = ["autocomplete", "
53
53
  t.value && (t.value.style.height = "0px", t.value.style.height = `${t.value.scrollHeight}px`);
54
54
  }
55
55
  return (e, s) => (x(), V("span", {
56
- class: B([i.value, "bb-base-textarea__container"])
56
+ class: B(["bb-base-textarea__container", i.value])
57
57
  }, [
58
58
  l(e.$slots, "prepend-outer"),
59
59
  u("span", v, [
60
60
  l(e.$slots, "prepend"),
61
- u("textarea", T({
61
+ u("textarea", T({ id: e.id }, f, {
62
+ ref_key: "textarea",
63
+ ref: t,
62
64
  autocomplete: e.autocomplete,
63
65
  autofocus: e.autofocus,
64
66
  class: "bb-base-textarea__input",
65
67
  disabled: e.disabled,
66
- id: e.id,
67
68
  name: e.name,
68
69
  placeholder: e.placeholder,
69
70
  readonly: e.readonly,
70
71
  value: c.value,
71
72
  onInput: m,
72
73
  onKeydown: b
73
- }, f, {
74
- ref_key: "textarea",
75
- ref: t
76
74
  }), null, 16, E),
77
75
  l(e.$slots, "append")
78
76
  ]),
@@ -1 +1 @@
1
- {"version":3,"file":"index39.js","sources":["../src/components/BaseTextarea/BaseTextarea.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, mergeProps as _mergeProps, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-textarea__inner-container\" }\nconst _hoisted_2 = [\"autocomplete\", \"autofocus\", \"disabled\", \"id\", \"name\", \"placeholder\", \"readonly\", \"value\"]\n\nimport { computed, nextTick, onMounted, ref, watch } from \"vue\";\nimport type { HTMLAttributes, InputHTMLAttributes, Ref } from \"vue\";\n\nexport type BaseTextareaProps = {\n /**\n * Guides to the browser as to the type of information expected in the field.\n */\n autocomplete?: InputHTMLAttributes[\"autocomplete\"];\n\n /**\n * Sets autofocus on page load.\n */\n autofocus?: InputHTMLAttributes[\"autofocus\"];\n\n /**\n * Disables the component\n */\n disabled?: boolean;\n\n /**\n * Define if the component should be in an error state.\n * It usually attaches a CSS class for styling purposes.\n */\n hasErrors?: boolean;\n\n /**\n * The identifier of the component.\n */\n id?: HTMLAttributes[\"id\"];\n\n /**\n * Defines the name of the input.\n */\n name?: InputHTMLAttributes[\"name\"];\n\n /**\n * String displayed when there's no data.\n */\n placeholder?: InputHTMLAttributes[\"placeholder\"];\n\n /**\n * Sets the input in a readonly state.\n */\n readonly?: InputHTMLAttributes[\"readonly\"];\n\n /**\n * Expands the textarea to match its content\n */\n autoGrow?: boolean;\n /**\n * Used by v-model\n */\n modelValue: string | null;\n};\nexport type BaseTextareaEvents = {\n (e: \"blur\", event: FocusEvent): void;\n (e: \"change\", event: Event): void;\n (e: \"click\", event: MouseEvent): void;\n (e: \"focus\", event: FocusEvent): void;\n (e: \"input\", event: Event): void;\n (e: \"keydown\", event: KeyboardEvent): void;\n (e: \"mousedown\", event: MouseEvent): void;\n (e: \"mouseup\", event: MouseEvent): void;\n (e: \"update:modelValue\", value: string | null): void;\n};\nexport type BaseTextareaSlots = {\n \"prepend-outer\"?: (props: {}) => any;\n prepend?: (props: {}) => any;\n append?: (props: {}) => any;\n \"append-outer\"?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseTextarea',\n props: {\n autocomplete: {},\n autofocus: {},\n disabled: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n name: {},\n placeholder: {},\n readonly: {},\n autoGrow: { type: Boolean },\n modelValue: {}\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst textarea: Ref<HTMLTextAreaElement | null> = ref(null);\n\nconst classes = computed(() => ({\n \"bb-base-textarea\": true,\n \"bb-base-textarea--auto-grow\": props.autoGrow,\n \"bb-base-textarea--disabled\": props.disabled,\n \"bb-base-textarea--errors\": props.hasErrors,\n \"bb-base-textarea--readonly\": props.readonly,\n}));\n\n// Allow modelvalue to be reset to null\nconst modelValueWithDefault = computed(() =>\n props.modelValue ? props.modelValue : \"\"\n);\nonMounted(() => {\n if (props.autoGrow) {\n computeTextareaHeight();\n }\n});\nwatch(\n () => props.modelValue,\n () => {\n if (props.autoGrow) {\n nextTick(computeTextareaHeight);\n }\n }\n);\n\nfunction onInput(event: Event): void {\n // Prevemt enter from triggering smt else\n event.stopPropagation();\n if (event.target instanceof HTMLTextAreaElement) {\n let value = event.target.value;\n emit(\"input\", event);\n emit(\"update:modelValue\", value);\n }\n}\nfunction onKeydown(event: KeyboardEvent): void {\n // Prevent enter from triggering smt else\n event.stopPropagation();\n if (event.target instanceof HTMLTextAreaElement) {\n emit(\"keydown\", event);\n }\n}\n\n/**\n * These events are just propagated\n */\nconst eventListeners = {\n onBlur: (event: FocusEvent) => emit(\"blur\", event),\n onChange: (event: Event) => emit(\"change\", event),\n onClick: (event: MouseEvent) => emit(\"click\", event),\n onFocus: (event: FocusEvent) => emit(\"focus\", event),\n onMousedown: (event: MouseEvent) => emit(\"mousedown\", event),\n onMouseup: (event: MouseEvent) => emit(\"mouseup\", event),\n};\n\n/* \nReset height and the apply scroll height otherwise it would not be able to shrink\n*/\nfunction computeTextareaHeight() {\n if (!textarea.value) return;\n textarea.value.style.height = \"0px\";\n\n textarea.value.style.height = `${textarea.value.scrollHeight}px`;\n}\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass([classes.value, \"bb-base-textarea__container\"])\n }, [\n _renderSlot(_ctx.$slots, \"prepend-outer\"),\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"textarea\", _mergeProps({\n autocomplete: _ctx.autocomplete,\n autofocus: _ctx.autofocus,\n class: 'bb-base-textarea__input',\n disabled: _ctx.disabled,\n id: _ctx.id,\n name: _ctx.name,\n placeholder: _ctx.placeholder,\n readonly: _ctx.readonly,\n value: modelValueWithDefault.value,\n onInput: onInput,\n onKeydown: onKeydown\n }, eventListeners, {\n ref_key: \"textarea\",\n ref: textarea\n }), null, 16, _hoisted_2),\n _renderSlot(_ctx.$slots, \"append\")\n ]),\n _renderSlot(_ctx.$slots, \"append-outer\")\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_sfc_main","_defineComponent","__props","__emit","props","emit","textarea","ref","classes","computed","modelValueWithDefault","onMounted","computeTextareaHeight","watch","nextTick","onInput","event","value","onKeydown","eventListeners","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode","_mergeProps"],"mappings":";AAGA,MAAMA,IAAa,EAAE,OAAO,uCACtBC,IAAa,CAAC,gBAAgB,aAAa,YAA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AYL,EAAK,QAAQ,QAAQ;AAAA,MAAA,CAClC;AAAA,MACDK,EAAYL,EAAK,QAAQ,cAAc;AAAA,OACtC,CAAC;AAAA,EAEN;AAEA,CAAC;"}
1
+ {"version":3,"file":"index39.js","sources":["../src/components/BaseTextarea/BaseTextarea.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, mergeProps as _mergeProps, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-textarea__inner-container\" }\nconst _hoisted_2 = [\"id\", \"autocomplete\", \"autofocus\", \"disabled\", \"name\", \"placeholder\", \"readonly\", \"value\"]\n\nimport { computed, nextTick, onMounted, ref, watch } from 'vue';\nimport type { HTMLAttributes, InputHTMLAttributes, Ref } from 'vue';\n\nexport type BaseTextareaProps = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tautocomplete?: InputHTMLAttributes['autocomplete'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there's no data.\n\t */\n\tplaceholder?: InputHTMLAttributes['placeholder'];\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Expands the textarea to match its content\n\t */\n\tautoGrow?: boolean;\n\t/**\n\t * Used by v-model\n\t */\n\tmodelValue: string | null;\n};\nexport type BaseTextareaEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: string | null): void;\n};\nexport type BaseTextareaSlots = {\n\t'prepend-outer'?: (props: {}) => any;\n\tprepend?: (props: {}) => any;\n\tappend?: (props: {}) => any;\n\t'append-outer'?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseTextarea',\n props: {\n autocomplete: {},\n autofocus: {},\n disabled: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n name: {},\n placeholder: {},\n readonly: {},\n autoGrow: { type: Boolean },\n modelValue: {}\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst textarea: Ref<HTMLTextAreaElement | null> = ref(null);\n\nconst classes = computed(() => ({\n\t'bb-base-textarea': true,\n\t'bb-base-textarea--auto-grow': props.autoGrow,\n\t'bb-base-textarea--disabled': props.disabled,\n\t'bb-base-textarea--errors': props.hasErrors,\n\t'bb-base-textarea--readonly': props.readonly,\n}));\n\n// Allow modelvalue to be reset to null\nconst modelValueWithDefault = computed(() =>\n\tprops.modelValue ? props.modelValue : ''\n);\nonMounted(() => {\n\tif (props.autoGrow) {\n\t\tcomputeTextareaHeight();\n\t}\n});\nwatch(\n\t() => props.modelValue,\n\t() => {\n\t\tif (props.autoGrow) {\n\t\t\tnextTick(computeTextareaHeight);\n\t\t}\n\t}\n);\n\nfunction onInput(event: Event): void {\n\t// Prevemt enter from triggering smt else\n\tevent.stopPropagation();\n\tif (event.target instanceof HTMLTextAreaElement) {\n\t\tlet value = event.target.value;\n\t\temit('input', event);\n\t\temit('update:modelValue', value);\n\t}\n}\nfunction onKeydown(event: KeyboardEvent): void {\n\t// Prevent enter from triggering smt else\n\tevent.stopPropagation();\n\tif (event.target instanceof HTMLTextAreaElement) {\n\t\temit('keydown', event);\n\t}\n}\n\n/**\n * These events are just propagated\n */\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonChange: (event: Event) => emit('change', event),\n\tonClick: (event: MouseEvent) => emit('click', event),\n\tonFocus: (event: FocusEvent) => emit('focus', event),\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n};\n\n/* \nReset height and the apply scroll height otherwise it would not be able to shrink\n*/\nfunction computeTextareaHeight() {\n\tif (!textarea.value) return;\n\ttextarea.value.style.height = '0px';\n\n\ttextarea.value.style.height = `${textarea.value.scrollHeight}px`;\n}\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass([\"bb-base-textarea__container\", classes.value])\n }, [\n _renderSlot(_ctx.$slots, \"prepend-outer\"),\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"textarea\", _mergeProps({ id: _ctx.id }, eventListeners, {\n ref_key: \"textarea\",\n ref: textarea,\n autocomplete: _ctx.autocomplete,\n autofocus: _ctx.autofocus,\n class: 'bb-base-textarea__input',\n disabled: _ctx.disabled,\n name: _ctx.name,\n placeholder: _ctx.placeholder,\n readonly: _ctx.readonly,\n value: modelValueWithDefault.value,\n onInput: onInput,\n onKeydown: onKeydown\n }), null, 16, _hoisted_2),\n _renderSlot(_ctx.$slots, \"append\")\n ]),\n _renderSlot(_ctx.$slots, \"append-outer\")\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_sfc_main","_defineComponent","__props","__emit","props","emit","textarea","ref","classes","computed","modelValueWithDefault","onMounted","computeTextareaHeight","watch","nextTick","onInput","event","value","onKeydown","eventListeners","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode","_mergeProps"],"mappings":";AAGA,MAAMA,IAAa,EAAE,OAAO,uCACtBC,IAAa,CAAC,MAAM,gBAAgB,aAAa,YAAY,QAAQ,eAAe,YAAY,OAAO,GA2EjFC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,cAAc,CAAC;AAAA,IACf,WAAW,CAAC;AAAA,IACZ,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC3B,IAAI,CAAC;AAAA,IACL,MAAM,CAAC;AAAA,IACP,aAAa,CAAC;AAAA,IACd,UAAU,CAAC;AAAA,IACX,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,YAAY,CAAC;AAAA,EACf;AAAA,EACA,OAAO,CAAC,QAAQ,UAAU,SAAS,SAAS,SAAS,WAAW,aAAa,WAAW,mBAAmB;AAAA,EAC3G,MAAMC,GAAc,EAAE,MAAMC,KAAU;AAExC,UAAMC,IAAQF,GAERG,IAAOF,GAIPG,IAA4CC,EAAI,IAAI,GAEpDC,IAAUC,EAAS,OAAO;AAAA,MAC/B,oBAAoB;AAAA,MACpB,+BAA+BL,EAAM;AAAA,MACrC,8BAA8BA,EAAM;AAAA,MACpC,4BAA4BA,EAAM;AAAA,MAClC,8BAA8BA,EAAM;AAAA,IACnC,EAAA,GAGIM,IAAwBD;AAAA,MAAS,MACtCL,EAAM,aAAaA,EAAM,aAAa;AAAA,IAAA;AAEvC,IAAAO,EAAU,MAAM;AACf,MAAIP,EAAM,YACaQ;IACvB,CACA,GACDC;AAAA,MACC,MAAMT,EAAM;AAAA,MACZ,MAAM;AACL,QAAIA,EAAM,YACTU,EAASF,CAAqB;AAAA,MAEhC;AAAA,IAAA;AAGD,aAASG,EAAQC,GAAoB;AAGhC,UADJA,EAAM,gBAAgB,GAClBA,E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aA,EAAK;AAAA,UAClB,UAAUA,EAAK;AAAA,UACf,OAAOV,EAAsB;AAAA,UAC7B,SAAAK;AAAA,UACA,WAAAG;AAAA,QAAA,CACD,GAAG,MAAM,IAAInB,CAAU;AAAA,QACxB0B,EAAYL,EAAK,QAAQ,QAAQ;AAAA,MAAA,CAClC;AAAA,MACDK,EAAYL,EAAK,QAAQ,cAAc;AAAA,OACtC,CAAC;AAAA,EAEN;AAEA,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index4.js","sources":["../src/composables/useCountdown.ts"],"sourcesContent":["import { getAsPercentage } from \"@/utilities/functions/percentage\";\nimport { wait } from \"@/utilities/functions/wait\";\nimport { computed, onBeforeUnmount, ref } from \"vue\";\n\ntype CounterParams = {\n /** Longevity of the countdown in milliseconds */\n duration: number;\n /** Function called every time the countdown starts or restarts */\n onStart?: (...args: any[]) => any;\n /** Function called anytime the timer stops or pauses */\n onStop?: (...args: any[]) => any;\n /** Function called on completion */\n onFinish?: (...args: any[]) => any;\n};\nexport const useCountdown = ({\n duration,\n onStart,\n onFinish,\n onStop,\n}: CounterParams) => {\n if (!duration) {\n throw new Error(\"You must define a duration for the coundown\");\n }\n const remaining = ref(duration);\n const elapsed = ref(0);\n const progress = computed(() => getAsPercentage(elapsed.value, duration));\n const tick = 100;\n const running = ref(false);\n const paused = ref(false);\n\n let timeoutID: ReturnType<typeof setInterval>;\n\n const start = () => {\n if (elapsed.value === duration || (running.value && !paused.value)) return;\n if (onStart) onStart();\n paused.value = false;\n running.value = true;\n\n timeoutID = setInterval(() => {\n remaining.value = Math.max(remaining.value - tick, 0);\n elapsed.value = Math.min(elapsed.value + tick, duration);\n\n if (remaining.value === 0) {\n wait(0).then(() => {\n clearInterval(timeoutID);\n running.value = false;\n if (onStop) onStop();\n if (onFinish) onFinish();\n });\n }\n }, tick);\n };\n\n const restart = () => {\n reset();\n start();\n };\n\n const reset = () => {\n if (timeoutID) clearInterval(timeoutID);\n if (!paused.value) {\n if (onStop) onStop();\n }\n remaining.value = duration;\n elapsed.value = 0;\n running.value = false;\n paused.value = false;\n };\n\n const pause = () => {\n if (timeoutID) clearInterval(timeoutID);\n if (!paused.value) {\n if (onStop) onStop();\n }\n paused.value = true;\n };\n\n const remainingFormatted = computed(() => {\n const msInADay = 1000 * 60 * 60 * 24;\n const msInAnHour = 1000 * 60 * 60;\n const msInAMinute = 1000 * 60;\n const msInASecond = 1000;\n\n const days = Math.trunc(remaining.value / msInADay);\n const hours = Math.trunc((remaining.value - days * msInADay) / msInAnHour);\n const minutes = Math.trunc(\n (remaining.value - hours * msInAnHour - days * msInADay) / msInAMinute\n );\n const seconds = Math.trunc(\n (remaining.value -\n minutes * msInAMinute -\n hours * msInAnHour -\n days * msInADay) /\n msInASecond\n );\n return {\n days,\n hours,\n minutes,\n seconds,\n };\n });\n\n onBeforeUnmount(() => clearInterval(timeoutID));\n \n return {\n /** Elapsed milliseconds since starting the timer */\n elapsed: computed(() => elapsed.value),\n /** Remaining milliseconds */\n remaining: computed(() => remaining.value),\n /** Remaining as a formatted object for display */\n remainingFormatted,\n /** Percentage of elapsed time against duration */\n progress,\n /** Starts the timer */\n start,\n /** Reset the timer to intiial state and starts again */\n restart,\n /** Pauses the timer */\n pause,\n /** Reset the timer to initial state, if the timer is running it is stopped */\n reset,\n /** Boolean, is the timer running (paused doesn't change running state) */\n running,\n /** Boolean is the timer paused */\n paused,\n };\n};\n"],"names":["useCountdown","duration","onStart","onFinish","onStop","remaining","ref","elapsed","progress","computed","getAsPercentage","tick","running","paused","timeoutID","start","wait","restart","reset","pause","remainingFormatted","days","hours","minutes","seconds","onBeforeUnmount"],"mappings":";;;AAcO,MAAMA,IAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF,MAAqB;AACnB,MAAI,CAACH;AACG,UAAA,IAAI,MAAM,6CAA6C;AAEzD,QAAAI,IAAYC,EAAIL,CAAQ,GACxBM,IAAUD,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QACTkB,IAAU,MACVD,IAAQ,OACRD,IAAO,SACP;AAAA,IAAA;AAEG,WAAA;AAAA,MACL,MAAAA;AAAA,MACA,OAAAC;AAAA,MACA,SAAAC;AAAA,MACA,SAAAC;AAAA,IAAA;AAAA,EACF,CACD;AAEe,SAAAC,EAAA,MAAM,cAAcX,CAAS,CAAC,GAEvC;AAAA;AAAA,IAEL,SAASL,EAAS,MAAMF,EAAQ,KAAK;AAAA;AAAA,IAErC,WAAWE,EAAS,MAAMJ,EAAU,KAAK;AAAA;AAAA,IAEzC,oBAAAe;AAAA;AAAA,IAEA,UAAAZ;AAAA;AAAA,IAEA,OAAAO;AAAA;AAAA,IAEA,SAAAE;AAAA;AAAA,IAEA,OAAAE;AAAA;AAAA,IAEA,OAAAD;AAAA;AAAA,IAEA,SAAAN;AAAA;AAAA,IAEA,QAAAC;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"index4.js","sources":["../src/composables/useCountdown.ts"],"sourcesContent":["import { getAsPercentage } from '@/utilities/functions/percentage';\nimport { wait } from '@/utilities/functions/wait';\nimport { computed, onBeforeUnmount, ref } from 'vue';\n\ntype CounterParams = {\n\t/** Longevity of the countdown in milliseconds */\n\tduration: number;\n\t/** Function called every time the countdown starts or restarts */\n\tonStart?: (...args: any[]) => any;\n\t/** Function called anytime the timer stops or pauses */\n\tonStop?: (...args: any[]) => any;\n\t/** Function called on completion */\n\tonFinish?: (...args: any[]) => any;\n};\nexport const useCountdown = ({\n\tduration,\n\tonStart,\n\tonFinish,\n\tonStop,\n}: CounterParams) => {\n\tif (!duration) {\n\t\tthrow new Error('You must define a duration for the coundown');\n\t}\n\tconst remaining = ref(duration);\n\tconst elapsed = ref(0);\n\tconst progress = computed(() => getAsPercentage(elapsed.value, duration));\n\tconst tick = 100;\n\tconst running = ref(false);\n\tconst paused = ref(false);\n\n\tlet timeoutID: ReturnType<typeof setInterval>;\n\n\tconst start = () => {\n\t\tif (elapsed.value === duration || (running.value && !paused.value)) return;\n\t\tif (onStart) onStart();\n\t\tpaused.value = false;\n\t\trunning.value = true;\n\n\t\ttimeoutID = setInterval(() => {\n\t\t\tremaining.value = Math.max(remaining.value - tick, 0);\n\t\t\telapsed.value = Math.min(elapsed.value + tick, duration);\n\n\t\t\tif (remaining.value === 0) {\n\t\t\t\twait(0).then(() => {\n\t\t\t\t\tclearInterval(timeoutID);\n\t\t\t\t\trunning.value = false;\n\t\t\t\t\tif (onStop) onStop();\n\t\t\t\t\tif (onFinish) onFinish();\n\t\t\t\t});\n\t\t\t}\n\t\t}, tick);\n\t};\n\n\tconst restart = () => {\n\t\treset();\n\t\tstart();\n\t};\n\n\tconst reset = () => {\n\t\tif (timeoutID) clearInterval(timeoutID);\n\t\tif (!paused.value) {\n\t\t\tif (onStop) onStop();\n\t\t}\n\t\tremaining.value = duration;\n\t\telapsed.value = 0;\n\t\trunning.value = false;\n\t\tpaused.value = false;\n\t};\n\n\tconst pause = () => {\n\t\tif (timeoutID) clearInterval(timeoutID);\n\t\tif (!paused.value) {\n\t\t\tif (onStop) onStop();\n\t\t}\n\t\tpaused.value = true;\n\t};\n\n\tconst remainingFormatted = computed(() => {\n\t\tconst msInADay = 1000 * 60 * 60 * 24;\n\t\tconst msInAnHour = 1000 * 60 * 60;\n\t\tconst msInAMinute = 1000 * 60;\n\t\tconst msInASecond = 1000;\n\n\t\tconst days = Math.trunc(remaining.value / msInADay);\n\t\tconst hours = Math.trunc((remaining.value - days * msInADay) / msInAnHour);\n\t\tconst minutes = Math.trunc(\n\t\t\t(remaining.value - hours * msInAnHour - days * msInADay) / msInAMinute\n\t\t);\n\t\tconst seconds = Math.trunc(\n\t\t\t(remaining.value -\n\t\t\t\tminutes * msInAMinute -\n\t\t\t\thours * msInAnHour -\n\t\t\t\tdays * msInADay) /\n\t\t\t\tmsInASecond\n\t\t);\n\t\treturn {\n\t\t\tdays,\n\t\t\thours,\n\t\t\tminutes,\n\t\t\tseconds,\n\t\t};\n\t});\n\n\tonBeforeUnmount(() => clearInterval(timeoutID));\n\n\treturn {\n\t\t/** Elapsed milliseconds since starting the timer */\n\t\telapsed: computed(() => elapsed.value),\n\t\t/** Remaining milliseconds */\n\t\tremaining: computed(() => remaining.value),\n\t\t/** Remaining as a formatted object for display */\n\t\tremainingFormatted,\n\t\t/** Percentage of elapsed time against duration */\n\t\tprogress,\n\t\t/** Starts the timer */\n\t\tstart,\n\t\t/** Reset the timer to intiial state and starts again */\n\t\trestart,\n\t\t/** Pauses the timer */\n\t\tpause,\n\t\t/** Reset the timer to initial state, if the timer is running it is stopped */\n\t\treset,\n\t\t/** Boolean, is the timer running (paused doesn't change running state) */\n\t\trunning,\n\t\t/** Boolean is the timer paused */\n\t\tpaused,\n\t};\n};\n"],"names":["useCountdown","duration","onStart","onFinish","onStop","remaining","ref","elapsed","progress","computed","getAsPercentage","tick","running","paused","timeoutID","start","wait","restart","reset","pause","remainingFormatted","days","hours","minutes","seconds","onBeforeUnmount"],"mappings":";;;AAcO,MAAMA,IAAe,CAAC;AAAA,EAC5B,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACD,MAAqB;AACpB,MAAI,CAACH;AACE,UAAA,IAAI,MAAM,6CAA6C;AAExD,QAAAI,IAAYC,EAAIL,CAAQ,GACxBM,IAAUD,EAAI,CAAC,GACfE,IAAWC,EAAS,MAAMC,EAAgBH,EAAQ,OAAON,CAAQ,CAAC,GAClEU,IAAO,KACPC,IAAUN,EAAI,EAAK,GACnBO,IAASP,EAAI,EAAK;AAEpB,MAAAQ;AAEJ,QAAMC,IAAQ,MAAM;AACnB,IAAIR,EAAQ,UAAUN,KAAaW,EAAQ,SAAS,CAACC,EAAO,UACxDX,KAAiBA,KACrBW,EAAO,QAAQ,IACfD,EAAQ,QAAQ,IAEhBE,IAAY,YAAY,MAAM;AAC7B,MAAAT,EAAU,QAAQ,KAAK,IAAIA,EAAU,QAAQM,GAAM,CAAC,GACpDJ,EAAQ,QAAQ,KAAK,IAAIA,EAAQ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AA;AAAA,IAEA,OAAAE;AAAA;AAAA,IAEA,OAAAD;AAAA;AAAA,IAEA,SAAAN;AAAA;AAAA,IAEA,QAAAC;AAAA,EAAA;AAEF;"}
package/dist/index41.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as d, computed as r, openBlock as i, createElementBlock as c, normalizeClass as m, renderSlot as t, createElementVNode as a, mergeProps as b } from "vue";
2
- const y = { class: "bb-base-text-input__inner-container" }, f = ["autocomplete", "autofocus", "disabled", "id", "name", "placeholder", "readonly", "type", "value"], g = /* @__PURE__ */ d({
2
+ const y = { class: "bb-base-text-input__inner-container" }, f = ["id", "autocomplete", "autofocus", "disabled", "name", "placeholder", "readonly", "type", "value"], g = /* @__PURE__ */ d({
3
3
  __name: "BaseTextInput",
4
4
  props: {
5
5
  autocomplete: {},
@@ -33,23 +33,23 @@ const y = { class: "bb-base-text-input__inner-container" }, f = ["autocomplete",
33
33
  onMouseup: (e) => o("mouseup", e)
34
34
  };
35
35
  return (e, h) => (i(), c("span", {
36
- class: m([u.value, "bb-base-text-input__container"])
36
+ class: m(["bb-base-text-input__container", u.value])
37
37
  }, [
38
38
  t(e.$slots, "prepend-outer"),
39
39
  a("span", y, [
40
40
  t(e.$slots, "prepend"),
41
- a("input", b({
41
+ a("input", b({ id: e.id }, p, {
42
+ ref: "input",
42
43
  autocomplete: e.autocomplete,
43
44
  autofocus: e.autofocus,
44
45
  class: "bb-base-text-input__input",
45
46
  disabled: e.disabled,
46
- id: e.id,
47
47
  name: e.name,
48
48
  placeholder: e.placeholder,
49
49
  readonly: e.readonly,
50
50
  type: e.type,
51
51
  value: e.modelValue
52
- }, p, { ref: "input" }), null, 16, f),
52
+ }), null, 16, f),
53
53
  t(e.$slots, "append")
54
54
  ]),
55
55
  t(e.$slots, "append-outer")
@@ -1 +1 @@
1
- {"version":3,"file":"index41.js","sources":["../src/components/BaseTextInput/BaseTextInput.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, mergeProps as _mergeProps, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-text-input__inner-container\" }\nconst _hoisted_2 = [\"autocomplete\", \"autofocus\", \"disabled\", \"id\", \"name\", \"placeholder\", \"readonly\", \"type\", \"value\"]\n\nimport { computed } from \"vue\";\nimport type { HTMLAttributes, InputHTMLAttributes } from \"vue\";\n\nexport type BaseTextInputProps = {\n /**\n * Guides to the browser as to the type of information expected in the field.\n */\n autocomplete?: InputHTMLAttributes[\"autocomplete\"];\n\n /**\n * Sets autofocus on page load.\n */\n autofocus?: InputHTMLAttributes[\"autofocus\"];\n\n /**\n * Disables the component\n */\n disabled?: boolean;\n\n /**\n * Define if the component should be in an error state.\n * It usually attaches a CSS class for styling purposes.\n */\n hasErrors?: boolean;\n\n /**\n * The identifier of the component.\n */\n id?: HTMLAttributes[\"id\"];\n\n /**\n * Defines the name of the input.\n */\n name?: InputHTMLAttributes[\"name\"];\n\n /**\n * String displayed when there's no data.\n */\n placeholder?: InputHTMLAttributes[\"placeholder\"];\n\n /**\n * Sets the input in a readonly state.\n */\n readonly?: InputHTMLAttributes[\"readonly\"];\n /**\n * Used my v-model\n */\n modelValue: string | null;\n /**\n * Type of the input. Returns the content type of the object.\n */\n type?: HTMLInputElement[\"type\"];\n};\n\nexport type BaseTextInputEvents = {\n (e: \"blur\", event: FocusEvent): void;\n (e: \"change\", event: Event): void;\n (e: \"click\", event: MouseEvent): void;\n (e: \"focus\", event: FocusEvent): void;\n (e: \"input\", event: Event): void;\n (e: \"keydown\", event: KeyboardEvent): void;\n (e: \"mousedown\", event: MouseEvent): void;\n (e: \"mouseup\", event: MouseEvent): void;\n (e: \"update:modelValue\", value: string | null): void;\n};\nexport type BaseTextInputSlots = {\n \"prepend-outer\"?: (props: {}) => any;\n prepend?: (props: {}) => any;\n append?: (props: {}) => any;\n \"append-outer\"?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseTextInput',\n props: {\n autocomplete: {},\n autofocus: {},\n disabled: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n name: {},\n placeholder: {},\n readonly: {},\n modelValue: {},\n type: { default: \"text\" }\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst classes = computed(() => ({\n \"bb-base-text-input\": true,\n \"bb-base-text-input--errors\": props.hasErrors,\n \"bb-base-text-input--readonly\": props.readonly,\n \"bb-base-text-input--disabled\": props.disabled,\n}));\n\n/**\n * These events are just propagated\n */\nconst eventListeners = {\n onBlur: (event: FocusEvent) => emit(\"blur\", event),\n onChange: (event: Event) => emit(\"change\", event),\n onClick: (event: MouseEvent) => emit(\"click\", event),\n onFocus: (event: FocusEvent) => emit(\"focus\", event),\n onKeydown: (event: KeyboardEvent) => emit(\"keydown\", event),\n onInput: (event: Event) => {\n if (event.target instanceof HTMLInputElement) {\n emit(\"update:modelValue\", event.target.value);\n }\n emit(\"input\", event);\n },\n onMousedown: (event: MouseEvent) => emit(\"mousedown\", event),\n onMouseup: (event: MouseEvent) => emit(\"mouseup\", event),\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass([classes.value, \"bb-base-text-input__container\"])\n }, [\n _renderSlot(_ctx.$slots, \"prepend-outer\"),\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"input\", _mergeProps({\n autocomplete: _ctx.autocomplete,\n autofocus: _ctx.autofocus,\n class: 'bb-base-text-input__input',\n disabled: _ctx.disabled,\n id: _ctx.id,\n name: _ctx.name,\n placeholder: _ctx.placeholder,\n readonly: _ctx.readonly,\n type: _ctx.type,\n value: _ctx.modelValue\n }, eventListeners, { ref: \"input\" }), null, 16, _hoisted_2),\n _renderSlot(_ctx.$slots, \"append\")\n ]),\n _renderSlot(_ctx.$slots, \"append-outer\")\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_sfc_main","_defineComponent","__props","__emit","props","emit","classes","computed","eventListeners","event","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode","_mergeProps"],"mappings":";AAGA,MAAMA,IAAa,EAAE,OAAO,yCACtBC,IAAa,CAAC,gBAAgB,aAAa,YAAY,MAAM,QAAQ,eAAe,YAAY,QAAQ,OAAO,GA2EzFC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,cAAc,CAAC;AAAA,IACf,WAAW,CAAC;AAAA,IACZ,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC3B,IAAI,CAAC;AAAA,IACL,MAAM,CAAC;AAAA,IACP,aAAa,CAAC;AAAA,IACd,UAAU,CAAC;AAAA,IACX,YAAY,CAAC;AAAA,IACb,MAAM,EAAE,SAAS,OAAO;AAAA,EAC1B;AAAA,EACA,OAAO,CAAC,QAAQ,UAAU,SAAS,SAAS,SAAS,WAAW,aAAa,WAAW,mBAAmB;AAAA,EAC3G,MAAMC,GAAc,EAAE,MAAMC,KAAU;AAExC,UAAMC,IAAQF,GAERG,IAAOF,GAIPG,IAAUC,EAAS,OAAO;AAAA,MAC9B,sBAAsB;AAAA,MACtB,8BAA8BH,EAAM;AAAA,MACpC,gCAAgCA,EAAM;AAAA,MACtC,gCAAgCA,EAAM;AAAA,IACtC,EAAA,GAKII,IAAiB;AAAA,MACrB,QAAQ,CAACC,MAAsBJ,EAAK,QAAQI,CAAK;AAAA,MACjD,UAAU,CAACA,MAAiBJ,EAAK,UAAUI,CAAK;AAAA,MAChD,SAAS,CAACA,MAAsBJ,EAAK,SAASI,CAAK;AAAA,MACnD,SAAS,CAACA,MAAsBJ,EAAK,SAASI,CAAK;AAAA,MACnD,WAAW,CAACA,MAAyBJ,EAAK,WAAWI,CAAK;AAAA,MAC1D,SAAS,CAACA,MAAiB;AACrB,QAAAA,EAAM,kBAAkB,oBACrBJ,EAAA,qBAAqBI,EAAM,OAAO,KAAK,GAE9CJ,EAAK,SAASI,CAAK;AAAA,MACrB;AAAA,MACA,aAAa,CAACA,MAAsBJ,EAAK,aAAaI,CAAK;AAAA,MAC3D,WAAW,CAACA,MAAsBJ,EAAK,WAAWI,CAAK;AAAA,IAAA;AAGlD,WAAA,CAACC,GAAUC,OACRC,EAAA,GAAcC,EAAoB,QAAQ;AAAA,MAChD,OAAOC,EAAgB,CAACR,EAAQ,OAAO,+BAA+B,CAAC;AAAA,IAAA,GACtE;AAAA,MACDS,EAAYL,EAAK,QAAQ,eAAe;AAAA,MACxCM,EAAoB,QAAQlB,GAAY;AAAA,QACtCiB,EAAYL,EAAK,QAAQ,SAAS;AAAA,QAClCM,EAAoB,SAASC,EAAY;AAAA,UACvC,cAAcP,EAAK;AAAA,UACnB,WAAWA,EAAK;AAAA,UAChB,OAAO;AAAA,UACP,UAAUA,EAAK;AAAA,UACf,IAAIA,EAAK;AAAA,UACT,MAAMA,EAAK;AAAA,UACX,aAAaA,EAAK;AAAA,UAClB,UAAUA,EAAK;AAAA,UACf,MAAMA,EAAK;AAAA,UACX,OAAOA,EAAK;AAAA,QAAA,GACXF,GAAgB,EAAE,KAAK,QAAS,CAAA,GAAG,MAAM,IAAIT,CAAU;AAAA,QAC1DgB,EAAYL,EAAK,QAAQ,QAAQ;AAAA,MAAA,CAClC;AAAA,MACDK,EAAYL,EAAK,QAAQ,cAAc;AAAA,OACtC,CAAC;AAAA,EAEN;AAEA,CAAC;"}
1
+ {"version":3,"file":"index41.js","sources":["../src/components/BaseTextInput/BaseTextInput.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, mergeProps as _mergeProps, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-text-input__inner-container\" }\nconst _hoisted_2 = [\"id\", \"autocomplete\", \"autofocus\", \"disabled\", \"name\", \"placeholder\", \"readonly\", \"type\", \"value\"]\n\nimport { computed } from 'vue';\nimport type { HTMLAttributes, InputHTMLAttributes } from 'vue';\n\nexport type BaseTextInputProps = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tautocomplete?: InputHTMLAttributes['autocomplete'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there's no data.\n\t */\n\tplaceholder?: InputHTMLAttributes['placeholder'];\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\t/**\n\t * Used my v-model\n\t */\n\tmodelValue: string | null;\n\t/**\n\t * Type of the input. Returns the content type of the object.\n\t */\n\ttype?: HTMLInputElement['type'];\n};\n\nexport type BaseTextInputEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: string | null): void;\n};\nexport type BaseTextInputSlots = {\n\t'prepend-outer'?: (props: {}) => any;\n\tprepend?: (props: {}) => any;\n\tappend?: (props: {}) => any;\n\t'append-outer'?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseTextInput',\n props: {\n autocomplete: {},\n autofocus: {},\n disabled: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n name: {},\n placeholder: {},\n readonly: {},\n modelValue: {},\n type: { default: 'text' }\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst classes = computed(() => ({\n\t'bb-base-text-input': true,\n\t'bb-base-text-input--errors': props.hasErrors,\n\t'bb-base-text-input--readonly': props.readonly,\n\t'bb-base-text-input--disabled': props.disabled,\n}));\n\n/**\n * These events are just propagated\n */\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonChange: (event: Event) => emit('change', event),\n\tonClick: (event: MouseEvent) => emit('click', event),\n\tonFocus: (event: FocusEvent) => emit('focus', event),\n\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\tonInput: (event: Event) => {\n\t\tif (event.target instanceof HTMLInputElement) {\n\t\t\temit('update:modelValue', event.target.value);\n\t\t}\n\t\temit('input', event);\n\t},\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass([\"bb-base-text-input__container\", classes.value])\n }, [\n _renderSlot(_ctx.$slots, \"prepend-outer\"),\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"input\", _mergeProps({ id: _ctx.id }, eventListeners, {\n ref: \"input\",\n autocomplete: _ctx.autocomplete,\n autofocus: _ctx.autofocus,\n class: 'bb-base-text-input__input',\n disabled: _ctx.disabled,\n name: _ctx.name,\n placeholder: _ctx.placeholder,\n readonly: _ctx.readonly,\n type: _ctx.type,\n value: _ctx.modelValue\n }), null, 16, _hoisted_2),\n _renderSlot(_ctx.$slots, \"append\")\n ]),\n _renderSlot(_ctx.$slots, \"append-outer\")\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_sfc_main","_defineComponent","__props","__emit","props","emit","classes","computed","eventListeners","event","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode","_mergeProps"],"mappings":";AAGA,MAAMA,IAAa,EAAE,OAAO,yCACtBC,IAAa,CAAC,MAAM,gBAAgB,aAAa,YAAY,QAAQ,eAAe,YAAY,QAAQ,OAAO,GA2EzFC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,cAAc,CAAC;AAAA,IACf,WAAW,CAAC;AAAA,IACZ,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC3B,IAAI,CAAC;AAAA,IACL,MAAM,CAAC;AAAA,IACP,aAAa,CAAC;AAAA,IACd,UAAU,CAAC;AAAA,IACX,YAAY,CAAC;AAAA,IACb,MAAM,EAAE,SAAS,OAAO;AAAA,EAC1B;AAAA,EACA,OAAO,CAAC,QAAQ,UAAU,SAAS,SAAS,SAAS,WAAW,aAAa,WAAW,mBAAmB;AAAA,EAC3G,MAAMC,GAAc,EAAE,MAAMC,KAAU;AAExC,UAAMC,IAAQF,GAERG,IAAOF,GAIPG,IAAUC,EAAS,OAAO;AAAA,MAC/B,sBAAsB;AAAA,MACtB,8BAA8BH,EAAM;AAAA,MACpC,gCAAgCA,EAAM;AAAA,MACtC,gCAAgCA,EAAM;AAAA,IACrC,EAAA,GAKII,IAAiB;AAAA,MACtB,QAAQ,CAACC,MAAsBJ,EAAK,QAAQI,CAAK;AAAA,M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