buefy 0.9.13 → 0.9.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/CHANGELOG.md +1706 -1639
  2. package/README.md +1 -1
  3. package/dist/buefy.css +313 -1
  4. package/dist/buefy.esm.js +4431 -2331
  5. package/dist/buefy.esm.min.js +2 -2
  6. package/dist/buefy.js +4467 -2364
  7. package/dist/buefy.min.css +1 -1
  8. package/dist/buefy.min.js +2 -2
  9. package/dist/cjs/autocomplete.js +5 -5
  10. package/dist/cjs/button.js +3 -3
  11. package/dist/cjs/carousel.js +4 -4
  12. package/dist/cjs/{chunk-34949503.js → chunk-0d6f213f.js} +2 -2
  13. package/dist/cjs/{chunk-2c7de785.js → chunk-0e3108f5.js} +2 -2
  14. package/dist/cjs/{chunk-2911aa4b.js → chunk-1438658c.js} +14 -11
  15. package/dist/cjs/{chunk-114191ae.js → chunk-1f7e4ed3.js} +3 -3
  16. package/dist/cjs/{chunk-a11294f9.js → chunk-334bc809.js} +1 -1
  17. package/dist/cjs/chunk-45739695.js +332 -0
  18. package/dist/cjs/{chunk-c7b2aa4b.js → chunk-4bcfaf1c.js} +0 -0
  19. package/dist/cjs/{chunk-f5106717.js → chunk-5058e659.js} +3 -3
  20. package/dist/cjs/{chunk-61023b09.js → chunk-545e1c7f.js} +102 -16
  21. package/dist/cjs/{chunk-30670fac.js → chunk-54b0042d.js} +19 -3
  22. package/dist/cjs/{chunk-fe2f57ee.js → chunk-5ed8a75a.js} +2 -2
  23. package/dist/cjs/{chunk-d120e215.js → chunk-73f8eef8.js} +8 -2
  24. package/dist/cjs/{chunk-2062216d.js → chunk-7c11fdde.js} +5 -4
  25. package/dist/cjs/{chunk-3cc5d9a6.js → chunk-841c0e0f.js} +1 -1
  26. package/dist/cjs/{chunk-9e4cf4c5.js → chunk-87a116d9.js} +0 -0
  27. package/dist/cjs/{chunk-fefd7b77.js → chunk-a53b7aff.js} +0 -0
  28. package/dist/cjs/{chunk-d0f8ea39.js → chunk-c0a093d7.js} +7 -7
  29. package/dist/cjs/{chunk-7da0c017.js → chunk-c8abb3ed.js} +21 -21
  30. package/dist/cjs/{chunk-c6fbc7b4.js → chunk-d0df905a.js} +15 -2
  31. package/dist/cjs/{chunk-d54e40f6.js → chunk-e86d3eeb.js} +1 -8
  32. package/dist/cjs/{chunk-6cb902f8.js → chunk-e872f5e2.js} +1 -1
  33. package/dist/cjs/{chunk-2ae50815.js → chunk-f5285f14.js} +4 -4
  34. package/dist/cjs/clockpicker.js +8 -8
  35. package/dist/cjs/colorpicker.js +1752 -0
  36. package/dist/cjs/config.js +1 -1
  37. package/dist/cjs/datepicker.js +11 -11
  38. package/dist/cjs/datetimepicker.js +30 -14
  39. package/dist/cjs/dialog.js +5 -5
  40. package/dist/cjs/dropdown.js +3 -3
  41. package/dist/cjs/field.js +2 -2
  42. package/dist/cjs/helpers.js +21 -1
  43. package/dist/cjs/icon.js +2 -2
  44. package/dist/cjs/image.js +2 -2
  45. package/dist/cjs/index.js +27 -22
  46. package/dist/cjs/input.js +4 -4
  47. package/dist/cjs/loading.js +5 -5
  48. package/dist/cjs/menu.js +2 -2
  49. package/dist/cjs/message.js +4 -9
  50. package/dist/cjs/modal.js +5 -5
  51. package/dist/cjs/navbar.js +4 -1
  52. package/dist/cjs/notification.js +7 -7
  53. package/dist/cjs/numberinput.js +30 -21
  54. package/dist/cjs/pagination.js +7 -7
  55. package/dist/cjs/progress.js +3 -3
  56. package/dist/cjs/rate.js +2 -2
  57. package/dist/cjs/select.js +4 -4
  58. package/dist/cjs/sidebar.js +1 -1
  59. package/dist/cjs/slider.js +3 -3
  60. package/dist/cjs/snackbar.js +5 -4
  61. package/dist/cjs/steps.js +5 -5
  62. package/dist/cjs/table.js +157 -146
  63. package/dist/cjs/tabs.js +7 -7
  64. package/dist/cjs/taginput.js +5 -5
  65. package/dist/cjs/timepicker.js +12 -12
  66. package/dist/cjs/toast.js +3 -3
  67. package/dist/cjs/tooltip.js +4 -4
  68. package/dist/cjs/upload.js +23 -9
  69. package/dist/components/autocomplete/index.js +24 -2
  70. package/dist/components/autocomplete/index.min.js +2 -2
  71. package/dist/components/breadcrumb/index.js +1 -1
  72. package/dist/components/breadcrumb/index.min.js +1 -1
  73. package/dist/components/button/index.js +8 -2
  74. package/dist/components/button/index.min.js +2 -2
  75. package/dist/components/carousel/index.js +8 -2
  76. package/dist/components/carousel/index.min.js +2 -2
  77. package/dist/components/checkbox/index.js +1 -1
  78. package/dist/components/checkbox/index.min.js +1 -1
  79. package/dist/components/clockpicker/index.js +41 -22
  80. package/dist/components/clockpicker/index.min.js +2 -2
  81. package/dist/components/collapse/index.js +1 -1
  82. package/dist/components/collapse/index.min.js +1 -1
  83. package/dist/components/colorpicker/index.js +4318 -0
  84. package/dist/components/colorpicker/index.min.js +2 -0
  85. package/dist/components/datepicker/index.js +48 -26
  86. package/dist/components/datepicker/index.min.js +2 -2
  87. package/dist/components/datetimepicker/index.js +66 -28
  88. package/dist/components/datetimepicker/index.min.js +2 -2
  89. package/dist/components/dialog/index.js +8 -2
  90. package/dist/components/dialog/index.min.js +2 -2
  91. package/dist/components/dropdown/index.js +14 -1
  92. package/dist/components/dropdown/index.min.js +2 -2
  93. package/dist/components/field/index.js +21 -21
  94. package/dist/components/field/index.min.js +1 -1
  95. package/dist/components/icon/index.js +8 -2
  96. package/dist/components/icon/index.min.js +2 -2
  97. package/dist/components/image/index.js +1 -1
  98. package/dist/components/image/index.min.js +1 -1
  99. package/dist/components/input/index.js +8 -2
  100. package/dist/components/input/index.min.js +2 -2
  101. package/dist/components/loading/index.js +1 -1
  102. package/dist/components/loading/index.min.js +1 -1
  103. package/dist/components/menu/index.js +8 -2
  104. package/dist/components/menu/index.min.js +2 -2
  105. package/dist/components/message/index.js +11 -9
  106. package/dist/components/message/index.min.js +2 -2
  107. package/dist/components/modal/index.js +1 -1
  108. package/dist/components/modal/index.min.js +1 -1
  109. package/dist/components/navbar/index.js +4 -1
  110. package/dist/components/navbar/index.min.js +2 -2
  111. package/dist/components/notification/index.js +13 -13
  112. package/dist/components/notification/index.min.js +2 -2
  113. package/dist/components/numberinput/index.js +34 -19
  114. package/dist/components/numberinput/index.min.js +2 -2
  115. package/dist/components/pagination/index.js +107 -16
  116. package/dist/components/pagination/index.min.js +2 -2
  117. package/dist/components/progress/index.js +2 -2
  118. package/dist/components/progress/index.min.js +2 -2
  119. package/dist/components/radio/index.js +1 -1
  120. package/dist/components/radio/index.min.js +1 -1
  121. package/dist/components/rate/index.js +8 -2
  122. package/dist/components/rate/index.min.js +2 -2
  123. package/dist/components/select/index.js +8 -2
  124. package/dist/components/select/index.min.js +2 -2
  125. package/dist/components/sidebar/index.js +1 -1
  126. package/dist/components/sidebar/index.min.js +1 -1
  127. package/dist/components/skeleton/index.js +1 -1
  128. package/dist/components/skeleton/index.min.js +1 -1
  129. package/dist/components/slider/index.js +2 -2
  130. package/dist/components/slider/index.min.js +2 -2
  131. package/dist/components/snackbar/index.js +4 -10
  132. package/dist/components/snackbar/index.min.js +2 -2
  133. package/dist/components/steps/index.js +8 -2
  134. package/dist/components/steps/index.min.js +2 -2
  135. package/dist/components/switch/index.js +1 -1
  136. package/dist/components/switch/index.min.js +1 -1
  137. package/dist/components/table/index.js +253 -133
  138. package/dist/components/table/index.min.js +2 -2
  139. package/dist/components/tabs/index.js +10 -4
  140. package/dist/components/tabs/index.min.js +2 -2
  141. package/dist/components/tag/index.js +1 -1
  142. package/dist/components/tag/index.min.js +1 -1
  143. package/dist/components/taginput/index.js +24 -2
  144. package/dist/components/taginput/index.min.js +2 -2
  145. package/dist/components/timepicker/index.js +41 -22
  146. package/dist/components/timepicker/index.min.js +2 -2
  147. package/dist/components/toast/index.js +2 -9
  148. package/dist/components/toast/index.min.js +2 -2
  149. package/dist/components/tooltip/index.js +2 -2
  150. package/dist/components/tooltip/index.min.js +2 -2
  151. package/dist/components/upload/index.js +20 -6
  152. package/dist/components/upload/index.min.js +2 -2
  153. package/dist/esm/autocomplete.js +6 -6
  154. package/dist/esm/button.js +4 -4
  155. package/dist/esm/carousel.js +4 -4
  156. package/dist/esm/{chunk-18e8b067.js → chunk-1a4fde6d.js} +102 -17
  157. package/dist/esm/{chunk-3773c62d.js → chunk-22cf6667.js} +2 -2
  158. package/dist/esm/{chunk-ece062a7.js → chunk-262b3f82.js} +1 -1
  159. package/dist/esm/chunk-455cdeae.js +317 -0
  160. package/dist/esm/{chunk-d7f92d97.js → chunk-5435bd9a.js} +5 -4
  161. package/dist/esm/{chunk-e7c9b2cb.js → chunk-58cdbf2b.js} +2 -2
  162. package/dist/esm/{chunk-29ca0df8.js → chunk-60a03517.js} +1 -1
  163. package/dist/esm/{chunk-21fc0948.js → chunk-66cef090.js} +7 -7
  164. package/dist/esm/{chunk-71a547bc.js → chunk-690d5be4.js} +1 -1
  165. package/dist/esm/{chunk-83eb0d37.js → chunk-6adc5c5d.js} +3 -3
  166. package/dist/esm/{chunk-c9c58d0c.js → chunk-6d0f2352.js} +0 -0
  167. package/dist/esm/{chunk-8d0f95b8.js → chunk-6d96579e.js} +4 -4
  168. package/dist/esm/{chunk-22e9f916.js → chunk-6fb4a069.js} +14 -11
  169. package/dist/esm/{chunk-75a5af93.js → chunk-84c6dfd6.js} +0 -0
  170. package/dist/esm/{chunk-ae8ab23a.js → chunk-a628d44d.js} +3 -3
  171. package/dist/esm/{chunk-b0c0c6b0.js → chunk-c9c18b2f.js} +0 -0
  172. package/dist/esm/{chunk-9f7f7441.js → chunk-d35985c7.js} +0 -0
  173. package/dist/esm/{chunk-799e084d.js → chunk-d9232770.js} +1 -8
  174. package/dist/esm/{chunk-4b67a181.js → chunk-dbd43ef1.js} +15 -2
  175. package/dist/esm/{chunk-d92f0cd9.js → chunk-e044aa02.js} +8 -2
  176. package/dist/esm/{chunk-b07e3182.js → chunk-effa4d25.js} +21 -21
  177. package/dist/esm/{chunk-6019fd7a.js → chunk-f9eaeac4.js} +19 -3
  178. package/dist/esm/clockpicker.js +8 -8
  179. package/dist/esm/colorpicker.js +1748 -0
  180. package/dist/esm/config.js +1 -1
  181. package/dist/esm/datepicker.js +10 -10
  182. package/dist/esm/datetimepicker.js +29 -13
  183. package/dist/esm/dialog.js +4 -4
  184. package/dist/esm/dropdown.js +4 -4
  185. package/dist/esm/field.js +3 -3
  186. package/dist/esm/helpers.js +20 -2
  187. package/dist/esm/icon.js +3 -3
  188. package/dist/esm/image.js +3 -3
  189. package/dist/esm/index.js +94 -91
  190. package/dist/esm/input.js +5 -5
  191. package/dist/esm/loading.js +3 -3
  192. package/dist/esm/menu.js +2 -2
  193. package/dist/esm/message.js +3 -8
  194. package/dist/esm/modal.js +3 -3
  195. package/dist/esm/navbar.js +4 -1
  196. package/dist/esm/notification.js +5 -5
  197. package/dist/esm/numberinput.js +30 -21
  198. package/dist/esm/pagination.js +4 -4
  199. package/dist/esm/progress.js +3 -3
  200. package/dist/esm/rate.js +2 -2
  201. package/dist/esm/select.js +5 -5
  202. package/dist/esm/sidebar.js +1 -1
  203. package/dist/esm/slider.js +2 -2
  204. package/dist/esm/snackbar.js +4 -3
  205. package/dist/esm/steps.js +5 -5
  206. package/dist/esm/table.js +155 -144
  207. package/dist/esm/tabs.js +7 -7
  208. package/dist/esm/taginput.js +5 -5
  209. package/dist/esm/timepicker.js +11 -11
  210. package/dist/esm/toast.js +2 -2
  211. package/dist/esm/tooltip.js +3 -3
  212. package/dist/esm/upload.js +21 -7
  213. package/dist/vetur/attributes.json +96 -0
  214. package/dist/vetur/tags.json +30 -1
  215. package/package.json +1 -1
  216. package/src/components/autocomplete/Autocomplete.vue +10 -0
  217. package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.js.snap +1 -5
  218. package/src/components/carousel/__snapshots__/CarouselList.spec.js.snap +48 -48
  219. package/src/components/colorpicker/Colorpicker.spec.js +10 -0
  220. package/src/components/colorpicker/Colorpicker.vue +354 -0
  221. package/src/components/colorpicker/ColorpickerAlphaSlider.spec.js +14 -0
  222. package/src/components/colorpicker/ColorpickerAlphaSlider.vue +194 -0
  223. package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.spec.js +22 -0
  224. package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.vue +366 -0
  225. package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.spec.js +22 -0
  226. package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +442 -0
  227. package/src/components/colorpicker/__snapshots__/ColorPickerHSLRepresentationSquare.spec.js.snap +12 -0
  228. package/src/components/colorpicker/__snapshots__/Colorpicker.spec.js.snap +32 -0
  229. package/src/components/colorpicker/__snapshots__/ColorpickerAlphaSlider.spec.js.snap +11 -0
  230. package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationTriangle.spec.js.snap +36 -0
  231. package/src/components/colorpicker/index.js +17 -0
  232. package/src/components/datepicker/DatepickerTableRow.spec.js +26 -0
  233. package/src/components/datepicker/DatepickerTableRow.vue +4 -5
  234. package/src/components/datetimepicker/Datetimepicker.vue +17 -1
  235. package/src/components/dropdown/Dropdown.vue +13 -0
  236. package/src/components/field/Field.vue +271 -271
  237. package/src/components/index.js +2 -0
  238. package/src/components/message/Message.vue +0 -5
  239. package/src/components/navbar/NavbarDropdown.vue +4 -0
  240. package/src/components/notification/Notification.vue +1 -1
  241. package/src/components/numberinput/Numberinput.spec.js +62 -0
  242. package/src/components/numberinput/Numberinput.vue +22 -15
  243. package/src/components/pagination/Pagination.vue +141 -51
  244. package/src/components/progress/Progress.vue +1 -1
  245. package/src/components/snackbar/index.js +2 -1
  246. package/src/components/table/Table.spec.js +17 -3
  247. package/src/components/table/Table.vue +1436 -1409
  248. package/src/components/table/TablePagination.vue +10 -2
  249. package/src/components/tabs/Tabs.vue +2 -0
  250. package/src/components/timepicker/__snapshots__/Timepicker.spec.js.snap +18 -47
  251. package/src/components/tooltip/Tooltip.vue +2 -2
  252. package/src/components/upload/Upload.vue +19 -7
  253. package/src/scss/buefy.scss +1 -0
  254. package/src/scss/components/_colorpicker.scss +283 -0
  255. package/src/scss/components/_pagination.scss +38 -0
  256. package/src/utils/MessageMixin.js +2 -1
  257. package/src/utils/NoticeMixin.js +1 -5
  258. package/src/utils/color.js +441 -0
  259. package/src/utils/color.spec.js +52 -0
  260. package/src/utils/helpers.js +16 -0
  261. package/src/utils/icons.js +7 -1
  262. package/types/components.d.ts +7 -2
  263. package/types/helpers.d.ts +2 -1
  264. package/dist/cjs/chunk-92621ff7.js +0 -141
  265. package/dist/esm/chunk-2452e3d3.js +0 -134
@@ -0,0 +1,441 @@
1
+ export const colorChannels = ['red', 'green', 'blue', 'alpha']
2
+
3
+ export const colorsNammed = {
4
+ black: '#000000',
5
+ silver: '#c0c0c0',
6
+ gray: '#808080',
7
+ white: '#ffffff',
8
+ maroon: '#800000',
9
+ red: '#ff0000',
10
+ purple: '#800080',
11
+ fuchsia: '#ff00ff',
12
+ green: '#008000',
13
+ lime: '#00ff00',
14
+ olive: '#808000',
15
+ yellow: '#ffff00',
16
+ navy: '#000080',
17
+ blue: '#0000ff',
18
+ teal: '#008080',
19
+ aqua: '#00ffff',
20
+ orange: '#ffa500',
21
+ aliceblue: '#f0f8ff',
22
+ antiquewhite: '#faebd7',
23
+ aquamarine: '#7fffd4',
24
+ azure: '#f0ffff',
25
+ beige: '#f5f5dc',
26
+ bisque: '#ffe4c4',
27
+ blanchedalmond: '#ffebcd',
28
+ blueviolet: '#8a2be2',
29
+ brown: '#a52a2a',
30
+ burlywood: '#deb887',
31
+ cadetblue: '#5f9ea0',
32
+ chartreuse: '#7fff00',
33
+ chocolate: '#d2691e',
34
+ coral: '#ff7f50',
35
+ cornflowerblue: '#6495ed',
36
+ cornsilk: '#fff8dc',
37
+ crimson: '#dc143c',
38
+ cyan: '#00ffff',
39
+ darkblue: '#00008b',
40
+ darkcyan: '#008b8b',
41
+ darkgoldenrod: '#b8860b',
42
+ darkgray: '#a9a9a9',
43
+ darkgreen: '#006400',
44
+ darkgrey: '#a9a9a9',
45
+ darkkhaki: '#bdb76b',
46
+ darkmagenta: '#8b008b',
47
+ darkolivegreen: '#556b2f',
48
+ darkorange: '#ff8c00',
49
+ darkorchid: '#9932cc',
50
+ darkred: '#8b0000',
51
+ darksalmon: '#e9967a',
52
+ darkseagreen: '#8fbc8f',
53
+ darkslateblue: '#483d8b',
54
+ darkslategray: '#2f4f4f',
55
+ darkslategrey: '#2f4f4f',
56
+ darkturquoise: '#00ced1',
57
+ darkviolet: '#9400d3',
58
+ deeppink: '#ff1493',
59
+ deepskyblue: '#00bfff',
60
+ dimgray: '#696969',
61
+ dimgrey: '#696969',
62
+ dodgerblue: '#1e90ff',
63
+ firebrick: '#b22222',
64
+ floralwhite: '#fffaf0',
65
+ forestgreen: '#228b22',
66
+ gainsboro: '#dcdcdc',
67
+ ghostwhite: '#f8f8ff',
68
+ gold: '#ffd700',
69
+ goldenrod: '#daa520',
70
+ greenyellow: '#adff2f',
71
+ grey: '#808080',
72
+ honeydew: '#f0fff0',
73
+ hotpink: '#ff69b4',
74
+ indianred: '#cd5c5c',
75
+ indigo: '#4b0082',
76
+ ivory: '#fffff0',
77
+ khaki: '#f0e68c',
78
+ lavender: '#e6e6fa',
79
+ lavenderblush: '#fff0f5',
80
+ lawngreen: '#7cfc00',
81
+ lemonchiffon: '#fffacd',
82
+ lightblue: '#add8e6',
83
+ lightcoral: '#f08080',
84
+ lightcyan: '#e0ffff',
85
+ lightgoldenrodyellow: '#fafad2',
86
+ lightgray: '#d3d3d3',
87
+ lightgreen: '#90ee90',
88
+ lightgrey: '#d3d3d3',
89
+ lightpink: '#ffb6c1',
90
+ lightsalmon: '#ffa07a',
91
+ lightseagreen: '#20b2aa',
92
+ lightskyblue: '#87cefa',
93
+ lightslategray: '#778899',
94
+ lightslategrey: '#778899',
95
+ lightsteelblue: '#b0c4de',
96
+ lightyellow: '#ffffe0',
97
+ limegreen: '#32cd32',
98
+ linen: '#faf0e6',
99
+ magenta: '#ff00ff',
100
+ mediumaquamarine: '#66cdaa',
101
+ mediumblue: '#0000cd',
102
+ mediumorchid: '#ba55d3',
103
+ mediumpurple: '#9370db',
104
+ mediumseagreen: '#3cb371',
105
+ mediumslateblue: '#7b68ee',
106
+ mediumspringgreen: '#00fa9a',
107
+ mediumturquoise: '#48d1cc',
108
+ mediumvioletred: '#c71585',
109
+ midnightblue: '#191970',
110
+ mintcream: '#f5fffa',
111
+ mistyrose: '#ffe4e1',
112
+ moccasin: '#ffe4b5',
113
+ navajowhite: '#ffdead',
114
+ oldlace: '#fdf5e6',
115
+ olivedrab: '#6b8e23',
116
+ orangered: '#ff4500',
117
+ orchid: '#da70d6',
118
+ palegoldenrod: '#eee8aa',
119
+ palegreen: '#98fb98',
120
+ paleturquoise: '#afeeee',
121
+ palevioletred: '#db7093',
122
+ papayawhip: '#ffefd5',
123
+ peachpuff: '#ffdab9',
124
+ peru: '#cd853f',
125
+ pink: '#ffc0cb',
126
+ plum: '#dda0dd',
127
+ powderblue: '#b0e0e6',
128
+ rosybrown: '#bc8f8f',
129
+ royalblue: '#4169e1',
130
+ saddlebrown: '#8b4513',
131
+ salmon: '#fa8072',
132
+ sandybrown: '#f4a460',
133
+ seagreen: '#2e8b57',
134
+ seashell: '#fff5ee',
135
+ sienna: '#a0522d',
136
+ skyblue: '#87ceeb',
137
+ slateblue: '#6a5acd',
138
+ slategray: '#708090',
139
+ slategrey: '#708090',
140
+ snow: '#fffafa',
141
+ springgreen: '#00ff7f',
142
+ steelblue: '#4682b4',
143
+ tan: '#d2b48c',
144
+ thistle: '#d8bfd8',
145
+ tomato: '#ff6347',
146
+ turquoise: '#40e0d0',
147
+ violet: '#ee82ee',
148
+ wheat: '#f5deb3',
149
+ whitesmoke: '#f5f5f5',
150
+ yellowgreen: '#9acd32',
151
+ rebeccapurple: '#663399'
152
+ }
153
+
154
+ export class ColorTypeError extends Error {
155
+ constructor() {
156
+ super('ColorTypeError: type must be hex(a), rgb(a) or hsl(a)')
157
+ }
158
+ }
159
+
160
+ class Color {
161
+ constructor(...args) {
162
+ if (args.length > 0) {
163
+ return Color.parse(...args)
164
+ }
165
+
166
+ this.$channels = new Uint8Array(colorChannels.length)
167
+ colorChannels.forEach((channel, index) => {
168
+ Object.defineProperty(
169
+ this,
170
+ channel,
171
+ {
172
+ get: () => this.$channels[index],
173
+ set: (byte) => {
174
+ if (!Number.isNaN(byte / 1)) {
175
+ this.$channels[index] = Math.min(255, Math.max(0, byte))
176
+ }
177
+ },
178
+ enumerable: true,
179
+ configurable: true
180
+ }
181
+ )
182
+ })
183
+ // Required for observability
184
+ ;['hue', 'saturation', 'lightness'].forEach((name) => {
185
+ const capitalizedName = name.replace(/^./, (m) => m.toUpperCase())
186
+ Object.defineProperty(
187
+ this,
188
+ name,
189
+ {
190
+ get: () => this[`get${capitalizedName}`](),
191
+ set: (value) => {
192
+ if (!Number.isNaN(value / 1)) {
193
+ this[`set${capitalizedName}`](value)
194
+ }
195
+ },
196
+ enumerable: true,
197
+ configurable: true
198
+ }
199
+ )
200
+ })
201
+ }
202
+
203
+ getHue() {
204
+ const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255)
205
+ const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)]
206
+ const delta = max - min
207
+ let hue = 0
208
+
209
+ if (delta === 0) {
210
+ return hue
211
+ }
212
+
213
+ if (red === max) {
214
+ hue = ((green - blue) / delta) % 6
215
+ } else if (green === max) {
216
+ hue = (blue - red) / delta + 2
217
+ } else {
218
+ hue = (red - green) / delta + 4
219
+ }
220
+
221
+ hue *= 60
222
+ while (hue !== -Infinity && hue < 0) hue += 360
223
+
224
+ return Math.round(hue % 360)
225
+ }
226
+
227
+ setHue(value) {
228
+ const color = Color.fromHSL(value, this.saturation, this.lightness, this.alpha / 255)
229
+ for (let i = 0; i < this.$channels.length; i++) {
230
+ this.$channels[i] = Number(color.$channels[i])
231
+ }
232
+ }
233
+
234
+ getSaturation() {
235
+ const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255)
236
+ const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)]
237
+ const delta = max - min
238
+
239
+ return delta !== 0
240
+ ? Math.round(delta / (1 - Math.abs(2 * this.lightness - 1)) * 100) / 100
241
+ : 0
242
+ }
243
+
244
+ setSaturation(value) {
245
+ const color = Color.fromHSL(this.hue, value, this.lightness, this.alpha / 255)
246
+ colorChannels.forEach((_, i) => (this.$channels[i] = color.$channels[i]))
247
+ }
248
+
249
+ getLightness() {
250
+ const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255)
251
+ const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)]
252
+
253
+ return Math.round((max + min) / 2 * 100) / 100
254
+ }
255
+
256
+ setLightness(value) {
257
+ const color = Color.fromHSL(this.hue, this.lightness, value, this.alpha / 255)
258
+ colorChannels.forEach((_, i) => (this.$channels[i] = color.$channels[i]))
259
+ }
260
+
261
+ clone() {
262
+ const color = new Color()
263
+ colorChannels.forEach((_, i) => (color.$channels[i] = this.$channels[i]))
264
+
265
+ return color
266
+ }
267
+
268
+ toString(type = 'hex') {
269
+ switch (String(type).toLowerCase()) {
270
+ case 'hex':
271
+ return '#' + colorChannels.slice(0, 3)
272
+ .map((channel) => this[channel].toString(16).padStart(2, '0'))
273
+ .join('')
274
+ case 'hexa':
275
+ return '#' + colorChannels
276
+ .map((channel) => this[channel].toString(16).padStart(2, '0'))
277
+ .join('')
278
+ case 'rgb':
279
+ return `rgb(${this.red}, ${this.green}, ${this.blue})`
280
+ case 'rgba':
281
+ return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round(this.alpha / 2.55) / 100})`
282
+ case 'hsl':
283
+ return `hsl(${Math.round(this.hue)}deg, ${Math.round(this.saturation * 100)}%, ${Math.round(this.lightness * 100)}%)`
284
+ case 'hsla':
285
+ return `hsla(${Math.round(this.hue)}deg, ${Math.round(this.saturation * 100)}%, ${Math.round(this.lightness * 100)}%, ${Math.round(this.alpha / 2.55) / 100})`
286
+ default:
287
+ throw new ColorTypeError()
288
+ }
289
+ }
290
+
291
+ get [Symbol.toString]() {
292
+ return this.toString('hex')
293
+ }
294
+
295
+ static parse(...args) {
296
+ if (typeof args[0] === 'object') {
297
+ return Color.parseObject(args[0])
298
+ } else if (args.every((arg) => !Number.isNaN(arg / 1))) {
299
+ const color = new Color()
300
+ if (args.length > 3) {
301
+ color.red = args[0]
302
+ color.green = args[1]
303
+ color.blue = args[2]
304
+
305
+ if (args[3]) {
306
+ color.alpha = args[3]
307
+ }
308
+ } else if (args.length === 1) {
309
+ const index = Number(args[0])
310
+
311
+ return Color.parseIndex(index, index > 2 ** 24 ? 3 : 4)
312
+ }
313
+ } else if (typeof args[0] === 'string') {
314
+ let match = null
315
+
316
+ if (typeof colorsNammed[args[0].toLowerCase()] === 'string') {
317
+ return Color.parseHex(colorsNammed[args[0].toLowerCase()])
318
+ } else if ((match = args[0].match(/^(#|&h|0x)?(([a-f0-9]{3,4}){1,2})$/i)) !== null) {
319
+ return Color.parseHex(match[2])
320
+ } else if ((match = args[0].match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(\s*,\s*(\d*\.?\d+))?\s*\)$/i)) !== null) {
321
+ const channels = [
322
+ match[1],
323
+ match[2],
324
+ match[3],
325
+ typeof match[5] !== 'undefined'
326
+ ? match[5]
327
+ : 1
328
+ ]
329
+
330
+ return Color.fromRGB(...channels.map((value) => Number(value)))
331
+ } else if ((match = args[0].match(/^(h(sl|wb)a?|lab|color|cmyk)\(/i))) {
332
+ throw new Error('Color expression not implemented yet')
333
+ }
334
+ }
335
+
336
+ return new Color()
337
+ }
338
+
339
+ static parseObject(object) {
340
+ const color = new Color()
341
+
342
+ if (object === null || typeof object !== 'object') {
343
+ return color
344
+ }
345
+ if (Color.isColor(object)) {
346
+ return object.clone()
347
+ }
348
+
349
+ colorChannels.forEach((channel) => {
350
+ if (!Number.isNaN(object[channel])) {
351
+ color[channel] = object[channel]
352
+ }
353
+ })
354
+
355
+ return color
356
+ }
357
+
358
+ static parseHex(hex) {
359
+ if (typeof hex !== 'string') {
360
+ throw new Error('Hex expression must be a string')
361
+ }
362
+
363
+ hex = hex.trim().replace(/^(0x|&h|#)/i, '')
364
+ if (hex.length === 3 || hex.length === 4) {
365
+ hex = hex.split('')
366
+ .map((c) => c.repeat(2))
367
+ .join('')
368
+ }
369
+
370
+ if (!(hex.length === 6 || hex.length === 8)) {
371
+ throw new Error('Incorrect Hex expression length')
372
+ }
373
+
374
+ const chans = hex.split(/(..)/)
375
+ .filter((value) => value)
376
+ .map((value) => Number.parseInt(value, 16))
377
+ if (typeof chans[3] === 'number') {
378
+ chans[3] /= 255
379
+ }
380
+ return Color.fromRGB(...chans)
381
+ }
382
+
383
+ static parseIndex(value, channels = 3) {
384
+ const color = new Color()
385
+
386
+ for (let i = 0; i < 4; i++) {
387
+ color[colorChannels[i]] = (value >> ((channels - i) * 8)) && 0xff
388
+ }
389
+
390
+ return color
391
+ }
392
+
393
+ static fromRGB(red, green, blue, alpha = 1) {
394
+ if ([red, green, blue, alpha].some((arg) => Number.isNaN(arg / 1))) {
395
+ throw new Error('Invalid arguments')
396
+ }
397
+ alpha *= 255
398
+
399
+ const color = new Color()
400
+ ;[red, green, blue, alpha].forEach((value, index) => {
401
+ color[colorChannels[index]] = value
402
+ })
403
+
404
+ return color
405
+ }
406
+
407
+ static fromHSL(hue, saturation, lightness, alpha = 1) {
408
+ if ([hue, saturation, lightness, alpha].some((arg) => Number.isNaN(arg))) {
409
+ throw new Error('Invalid arguments')
410
+ }
411
+ while (hue < 0 && hue !== -Infinity) hue += 360
412
+ hue = hue % 360
413
+ saturation = Math.max(0, Math.min(1, saturation))
414
+ lightness = Math.max(0, Math.min(1, lightness))
415
+ alpha = Math.max(0, Math.min(1, alpha))
416
+
417
+ const c = (1 - Math.abs(2 * lightness - 1)) * saturation
418
+ const x = c * (1 - Math.abs(hue / 60 % 2 - 1))
419
+ const m = lightness - c / 2
420
+
421
+ const [r, g, b] = hue < 60
422
+ ? [c, x, 0]
423
+ : hue < 120
424
+ ? [x, c, 0]
425
+ : hue < 180
426
+ ? [0, c, x]
427
+ : hue < 240
428
+ ? [0, x, c]
429
+ : hue < 300
430
+ ? [x, 0, c]
431
+ : [c, 0, x]
432
+
433
+ return Color.fromRGB((r + m) * 255, (g + m) * 255, (b + m) * 255, alpha)
434
+ }
435
+
436
+ static isColor(arg) {
437
+ return arg instanceof Color
438
+ }
439
+ }
440
+
441
+ export default Color
@@ -0,0 +1,52 @@
1
+ import Color from '@utils/color'
2
+
3
+ describe('Color', () => {
4
+ it('parse hex', () => {
5
+ const red = Color.parse('#ff0000')
6
+ const transparentBlue = Color.parse('#0000ff06')
7
+
8
+ expect(red.$channels).toEqual(new Uint8Array([255, 0, 0, 255]))
9
+ expect(transparentBlue.$channels).toEqual(new Uint8Array([0, 0, 255, 6]))
10
+ })
11
+ it('parse nammed color', () => {
12
+ const lime = Color.parse('lime')
13
+ const transparent = Color.parse('transparent')
14
+
15
+ expect(lime.$channels).toEqual(new Uint8Array([0, 255, 0, 255]))
16
+ expect(transparent.$channels).toEqual(new Uint8Array([0, 0, 0, 0]))
17
+ })
18
+ it('parse rgb', () => {
19
+ const color = Color.parse('rgba(12, 34, 56, 0.16)')
20
+
21
+ expect(color.$channels).toEqual(new Uint8Array([12, 34, 56, 40]))
22
+ })
23
+
24
+ it('RGB getters', () => {
25
+ const color = Color.parse('#1234')
26
+
27
+ expect(color.red).toStrictEqual(0x11)
28
+ expect(color.green).toStrictEqual(0x22)
29
+ expect(color.blue).toStrictEqual(0x33)
30
+ expect(color.alpha).toStrictEqual(0x44)
31
+ })
32
+ it('HSL getters', () => {
33
+ const color = Color.fromRGB(255, 0, 0)
34
+
35
+ expect(color.hue).toStrictEqual(0)
36
+ expect(color.saturation).toStrictEqual(1)
37
+ expect(color.lightness).toStrictEqual(0.5)
38
+ })
39
+
40
+ it('toString', () => {
41
+ const transparentLime = Color.fromRGB(0, 255, 0, 0)
42
+
43
+ expect(transparentLime.toString('hex')).toEqual('#00ff00')
44
+ expect(transparentLime.toString('hexa')).toEqual('#00ff0000')
45
+ expect(transparentLime.toString('rgb')).toEqual('rgb(0, 255, 0)')
46
+ expect(transparentLime.toString('rgba')).toEqual('rgba(0, 255, 0, 0)')
47
+ expect(transparentLime.toString('hsl')).toEqual('hsl(120deg, 100%, 50%)')
48
+ expect(transparentLime.toString('hsla')).toEqual('hsla(120deg, 100%, 50%, 0)')
49
+
50
+ expect(() => transparentLime.toString('throw')).toThrow(/^ColorTypeError:/)
51
+ })
52
+ })
@@ -174,6 +174,15 @@ export function escapeRegExpChars(value) {
174
174
  // eslint-disable-next-line
175
175
  return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
176
176
  }
177
+ /**
178
+ * Remove accents/diacritics in a string in JavaScript
179
+ * https://stackoverflow.com/a/37511463
180
+ */
181
+ export function removeDiacriticsFromString(value) {
182
+ if (!value) return value
183
+
184
+ return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
185
+ }
177
186
 
178
187
  export function multiColumnSort(inputArray, sortingPriority) {
179
188
  // clone it to prevent the any watchers from triggering every sorting iteration
@@ -289,3 +298,10 @@ export function isCustomElement(vm) {
289
298
  }
290
299
 
291
300
  export const isDefined = (d) => d !== undefined
301
+
302
+ /**
303
+ * Checks if a value is null or undefined.
304
+ * Based on
305
+ * https://github.com/lodash/lodash/blob/master/isNil.js
306
+ */
307
+ export const isNil = (value) => value === null || value === undefined
@@ -44,7 +44,13 @@ const getIcons = () => {
44
44
  far: faIcons(),
45
45
  fad: faIcons(),
46
46
  fab: faIcons(),
47
- fal: faIcons()
47
+ fal: faIcons(),
48
+ 'fa-solid': faIcons(),
49
+ 'fa-regular': faIcons(),
50
+ 'fa-light': faIcons(),
51
+ 'fa-thin': faIcons(),
52
+ 'fa-duotone': faIcons(),
53
+ 'fa-brands': faIcons()
48
54
  }
49
55
 
50
56
  if (config && config.customIconPacks) {
@@ -1,5 +1,5 @@
1
1
  import _Vue from "vue";
2
- import {ColorModifiers, GlobalPositions, SizesModifiers} from "./helpers";
2
+ import {ColorModifiers, DaysOfWeek, GlobalPositions, SizesModifiers} from "./helpers";
3
3
 
4
4
  // Component base definition
5
5
  export class BComponent extends _Vue {
@@ -32,7 +32,7 @@ export declare type BuefyConfig = {
32
32
  defaultDateCreator?: Function;
33
33
  defaultDayNames?: string[];
34
34
  defaultMonthNames?: string[];
35
- defaultFirstDayOfWeek?: number;
35
+ defaultFirstDayOfWeek?: DaysOfWeek;
36
36
  defaultUnselectableDaysOfWeek?: number[];
37
37
  defaultTimeFormatter?: Function;
38
38
  defaultTimeParser?: Function;
@@ -303,6 +303,11 @@ declare type BModalConfig = {
303
303
  */
304
304
  ariaModal?: boolean;
305
305
 
306
+ /**
307
+ * Aria label attribute to be passed to the close button for better accessibility.
308
+ */
309
+ closeButtonAriaLabel?: string;
310
+
306
311
  /**
307
312
  * CSS classes to be applied on modal
308
313
  */
@@ -1,4 +1,5 @@
1
- export type ColorModifiers = 'is-white' | 'is-black' | 'is-light' | 'is-dark' | 'is-primary' | 'is-info' | 'is-success' | 'is-warning' | 'is-danger' | string;
1
+ export type ColorModifiers<T = string> = 'is-white' | 'is-black' | 'is-light' | 'is-dark' | 'is-primary' | 'is-info' | 'is-success' | 'is-warning' | 'is-danger' | T;
2
2
  export type GlobalPositions = 'is-top-right' | 'is-top' | 'is-top-left' | 'is-bottom-right' | 'is-bottom' | 'is-bottom-left';
3
3
  export type SizesModifiers = 'is-small' | 'is-medium' | 'is-large';
4
4
  export type IconPacks = 'mdi' | 'fa' | 'fas' | 'far' | 'fab' | 'fad' | 'fal';
5
+ export type DaysOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;