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,442 @@
1
+ <template>
2
+ <svg :viewBox="viewBox" class="b-colorpicker-triangle">
3
+ <defs>
4
+ <linearGradient
5
+ :id="`cp-triangle-gradient-ligthness-${id}`"
6
+ x1="0"
7
+ y1="0"
8
+ x2="1"
9
+ y2="0"
10
+ >
11
+ <stop offset="0%" stop-color="#fff"/>
12
+ <stop offset="100%" stop-color="#000"/>
13
+ </linearGradient>
14
+ <linearGradient
15
+ :id="`cp-triangle-gradient-saturation-${id}`"
16
+ x1="0"
17
+ y1="0"
18
+ x2="0"
19
+ y2="1"
20
+ >
21
+ <stop
22
+ offset="0%"
23
+ :stop-color="`hsl(${hue}deg, 100%, 50%)`"
24
+ stop-opacity="1"
25
+ />
26
+ <stop
27
+ offset="100%"
28
+ :stop-color="`hsl(${hue}deg, 100%, 50%)`"
29
+ stop-opacity="0"
30
+ />
31
+ </linearGradient>
32
+ <clipPath :id="`cp-triangle-clip-${id}`">
33
+ <path :d="haloPath" />
34
+ </clipPath>
35
+ </defs>
36
+ <g class="colorpicker-triangle-slider-hue">
37
+ <foreignObject
38
+ :x="0"
39
+ :y="0"
40
+ :width="size"
41
+ :height="size"
42
+ :clip-path="`url(#cp-triangle-clip-${id})`"
43
+ >
44
+ <div
45
+ class="colorpicker-triangle-hue"
46
+ @click="clickHue"
47
+ @mousedown.prevent="startMouseCapture"
48
+ @touchstart.prevent="startMouseCapture"
49
+ />
50
+ </foreignObject>
51
+ <g :style="`transform: rotate(${hue}deg)`">
52
+ <foreignObject
53
+ :x="size / 2 - 4"
54
+ :y="0"
55
+ width="8"
56
+ :height="thickness + 4"
57
+ >
58
+ <div
59
+ ref="hueCursor"
60
+ class="hue-range-thumb"
61
+ :style="`background-color: hsl(${hue}deg, 100%, 50%)`"
62
+ role="slider"
63
+ tabindex="0"
64
+ aria-label="Hue"
65
+ aria-valuemin="0"
66
+ :aria-valuenow="hue"
67
+ aria-valuemax="360"
68
+ @click="clickHue"
69
+ @keydown="hueKeyPress"
70
+ @mousedown.prevent="startMouseCapture"
71
+ @touchstart.prevent="startMouseCapture"
72
+ />
73
+ </foreignObject>
74
+ </g>
75
+ </g>
76
+ <g
77
+ class="colorpicker-triangle-slider-sl"
78
+ :style="`transform: rotate(${hue}deg) translate(50%, 50%)`"
79
+ role="graphics-datagroup"
80
+ aria-datascales="lightness, saturation"
81
+ >
82
+ <path
83
+ :d="trianglePath"
84
+ :fill="`url(#cp-triangle-gradient-ligthness-${id})`"
85
+ />
86
+ <path
87
+ :d="trianglePath"
88
+ :fill="`url(#cp-triangle-gradient-saturation-${id})`"
89
+ style="mix-blend-mode: overlay;"
90
+ @click="clickSL"
91
+ @mousedown.prevent="startMouseCapture"
92
+ @touchstart.prevent="startMouseCapture"
93
+ />
94
+ <foreignObject
95
+ :x="((internalRadius - 3) * cos30) * (-lightness + 0.5) * 2 - 6"
96
+ :y="-internalRadius + (1 - saturation) * (internalRadius - 3) * 1.5 - 3"
97
+ width="12"
98
+ height="12"
99
+ >
100
+ <div
101
+ ref="slCursor"
102
+ class="sl-range-thumb"
103
+ :style="{
104
+ backgroundColor: `hsl(${hue}deg, ${saturation * 100}%, ${lightness * 100}%)`
105
+ }"
106
+ tabindex="0"
107
+ :aria-datavalues="`${saturation * 100}%, ${lightness * 100}%`"
108
+ @click="clickSL"
109
+ @keydown="slKeyPress"
110
+ @mousedown.prevent="startMouseCapture"
111
+ @touchstart.prevent="startMouseCapture"
112
+ />
113
+ </foreignObject>
114
+ </g>
115
+ </svg>
116
+ </template>
117
+
118
+ <script>
119
+ import Color from '../../utils/color'
120
+ const cos30 = 0.86602540378
121
+ const sin30 = 0.5
122
+
123
+ let id = 0
124
+
125
+ export default {
126
+ name: 'BColorpickerHSLRepresentationTriangle',
127
+ props: {
128
+ value: {
129
+ type: Object,
130
+ required: true,
131
+ validator(value) {
132
+ return typeof value.hue === 'number' &&
133
+ typeof value.saturation === 'number' &&
134
+ typeof value.lightness === 'number'
135
+ }
136
+ },
137
+ size: {
138
+ type: Number,
139
+ default: 200
140
+ },
141
+ thickness: {
142
+ type: Number,
143
+ default: 20
144
+ }
145
+ },
146
+ data() {
147
+ return {
148
+ id: id++,
149
+ hue: this.value.hue,
150
+ saturation: this.value.saturation,
151
+ lightness: this.value.lightness,
152
+ captureMouse: false,
153
+ captureType: 'hue',
154
+ clientOffset: {
155
+ cx: -1,
156
+ cy: -1,
157
+ width: 0,
158
+ height: 0
159
+ },
160
+ cos30,
161
+ sin30,
162
+ debounce: 0
163
+ }
164
+ },
165
+ computed: {
166
+ viewBox() {
167
+ const { size } = this
168
+ return `0 0 ${size} ${size}`
169
+ },
170
+ internalRadius() {
171
+ return this.size / 2 - this.thickness
172
+ },
173
+ haloPath() {
174
+ const { size, thickness } = this
175
+ const radius = size / 2 - 2 // 2px padding
176
+ const thicknessRadius = radius - thickness
177
+ const center = size / 2
178
+
179
+ return `M${center - radius} ${center}a${radius} ${radius} 0 1 1 ${2 * radius} 0` +
180
+ `h${-thickness}` +
181
+ `a${-thicknessRadius} ${thicknessRadius} 0 1 0 ${-2 * thicknessRadius} 0` +
182
+ `a${thicknessRadius} ${thicknessRadius} 0 1 0 ${2 * thicknessRadius} 0` +
183
+ `h${thickness}` +
184
+ `a${radius} ${radius} 0 1 1 ${-2 * radius} 0z`
185
+ },
186
+ trianglePath() {
187
+ const { size, thickness } = this
188
+ const radius = size - 4
189
+ const thicknessRadius = (radius - 2 * thickness) / 2
190
+
191
+ return `M0 ${-thicknessRadius}` +
192
+ `L${cos30 * thicknessRadius} ${sin30 * thicknessRadius}` +
193
+ `H${-cos30 * thicknessRadius}z`
194
+ }
195
+ },
196
+ watch: {
197
+ captureMouse(newValue, oldValue) {
198
+ if (oldValue === false && newValue !== false) {
199
+ const rect = this.$el.getBoundingClientRect()
200
+ // Caching offset
201
+ this.clientOffset.cx = rect.x + rect.width / 2
202
+ this.clientOffset.cy = rect.y + rect.height / 2
203
+ this.clientOffset.width = rect.width
204
+ this.clientOffset.height = rect.height
205
+ }
206
+ },
207
+ value: {
208
+ deep: true,
209
+ handler(newColor) {
210
+ const { hue, saturation, lightness } = newColor
211
+
212
+ window.clearTimeout(this.debounce)
213
+ this.debounce = window.setTimeout(() => {
214
+ this.hue = hue
215
+ this.saturation = saturation
216
+ this.lightness = lightness
217
+ }, 200)
218
+ }
219
+ }
220
+ },
221
+ methods: {
222
+ increaseHue(value = 1) {
223
+ this.hue = (this.hue + value) % 360
224
+ },
225
+ decreaseHue(value = 1) {
226
+ this.hue = (360 + this.hue - value) % 360
227
+ },
228
+ increaseSaturation(value = 0.01) {
229
+ this.saturation = Math.min(1, Math.max(0, this.saturation + value))
230
+ this.lightness = Math.min(
231
+ 0.5 + (1 - this.saturation) * 0.5,
232
+ Math.max(
233
+ 0.5 - (1 - this.saturation) * 0.5,
234
+ this.lightness
235
+ )
236
+ )
237
+ },
238
+ decreaseSaturation(value = 0.01) {
239
+ this.saturation = Math.min(1, Math.max(0, this.saturation - value))
240
+ this.lightness = Math.min(
241
+ 0.5 + (1 - this.saturation) * 0.5,
242
+ Math.max(
243
+ 0.5 - (1 - this.saturation) * 0.5,
244
+ this.lightness
245
+ )
246
+ )
247
+ },
248
+ increaseLightness(value = 0.01) {
249
+ this.lightness = Math.min(
250
+ 0.5 + (1 - this.saturation) * 0.5,
251
+ Math.max(
252
+ 0.5 - (1 - this.saturation) * 0.5,
253
+ this.lightness + value
254
+ )
255
+ )
256
+ },
257
+ decreaseLightness(value = 0.01) {
258
+ this.lightness = Math.min(
259
+ 0.5 + (1 - this.saturation) * 0.5,
260
+ Math.max(
261
+ 0.5 - (1 - this.saturation) * 0.5,
262
+ this.lightness - value
263
+ )
264
+ )
265
+ },
266
+ hueKeyPress(event) {
267
+ let handled = false
268
+ switch (event.key) {
269
+ case 'ArrowRight':
270
+ case 'ArrowUp':
271
+ this.increaseHue()
272
+ handled = true
273
+ break
274
+ case 'ArrowLeft':
275
+ case 'ArrowDown':
276
+ this.decreaseHue()
277
+ handled = true
278
+ break
279
+ case 'Home':
280
+ this.increaseHue(360 - this.hue)
281
+ handled = true
282
+ break
283
+ case 'End':
284
+ this.decreaseHue(this.hue)
285
+ handled = true
286
+ break
287
+ case 'PageUp':
288
+ this.increaseHue(60 - this.hue % 60)
289
+ handled = true
290
+ break
291
+ case 'PageDown':
292
+ this.decreaseHue(60 + this.hue % 60)
293
+ handled = true
294
+ break
295
+ }
296
+ if (handled) {
297
+ event.preventDefault()
298
+ event.stopPropagation()
299
+ this.emitColor()
300
+ }
301
+ },
302
+ slKeyPress(event) {
303
+ let handled = false
304
+ switch (event.key) {
305
+ case 'ArrowRight':
306
+ this.decreaseLightness()
307
+ handled = true
308
+ break
309
+ case 'ArrowUp':
310
+ this.increaseSaturation()
311
+ handled = true
312
+ break
313
+ case 'ArrowLeft':
314
+ this.increaseLightness()
315
+ handled = true
316
+ break
317
+ case 'ArrowDown':
318
+ this.decreaseSaturation()
319
+ handled = true
320
+ break
321
+ case 'Home':
322
+ this.increaseLightness(1 - this.lightness)
323
+ handled = true
324
+ break
325
+ case 'End':
326
+ this.decreaseLightness(this.lightness)
327
+ handled = true
328
+ break
329
+ case 'PageUp':
330
+ this.increaseSaturation(1 - this.saturation)
331
+ handled = true
332
+ break
333
+ case 'PageDown':
334
+ this.decreaseSaturation(this.saturation)
335
+ handled = true
336
+ break
337
+ }
338
+ if (handled) {
339
+ event.preventDefault()
340
+ event.stopPropagation()
341
+ this.emitColor()
342
+ }
343
+ },
344
+ clickHue(event) {
345
+ this.startMouseCapture(event)
346
+ this.trackMouse(event)
347
+ this.stopMouseCapture(event)
348
+ this.$refs.hueCursor.focus()
349
+ },
350
+ clickSL(event) {
351
+ this.startMouseCapture(event)
352
+ this.trackMouse(event)
353
+ this.stopMouseCapture(event)
354
+ this.$refs.slCursor.focus()
355
+ },
356
+ trackMouse(event) {
357
+ if (this.captureMouse === false) {
358
+ return
359
+ }
360
+ event.preventDefault()
361
+ event.stopPropagation()
362
+
363
+ let [mouseX, mouseY] = [0, 0]
364
+ if (typeof event.touches !== 'undefined' && event.touches.length) {
365
+ [mouseX, mouseY] = [event.touches[0].clientX, event.touches[0].clientY]
366
+ } else {
367
+ [mouseX, mouseY] = [event.clientX, event.clientY]
368
+ }
369
+ const angle = Math.atan2(
370
+ mouseY - this.clientOffset.cy,
371
+ mouseX - this.clientOffset.cx
372
+ )
373
+
374
+ if (this.captureType === 'sl') {
375
+ const d = Math.sqrt(
376
+ Math.pow(mouseX - this.clientOffset.cx, 2) +
377
+ Math.pow(mouseY - this.clientOffset.cy, 2)
378
+ )
379
+ const ratio = this.size / this.clientOffset.width
380
+ const dx = d * Math.cos(angle - this.hue / 180 * Math.PI) * ratio
381
+ const dy = d * Math.sin(angle - this.hue / 180 * Math.PI) * ratio
382
+ const radius = this.internalRadius
383
+ const saturation = 1 - (Math.min(
384
+ radius * sin30,
385
+ Math.max(
386
+ -radius,
387
+ dy
388
+ )
389
+ ) + radius) / (radius + radius * sin30)
390
+ const lightness = (Math.min(
391
+ (radius * cos30) * (1 - saturation),
392
+ Math.max(
393
+ (-radius * cos30) * (1 - saturation),
394
+ dx
395
+ )
396
+ ) + radius * cos30) / (radius * 2 * cos30)
397
+
398
+ this.saturation = Math.round(saturation * 1000) / 1000
399
+ this.lightness = 1 - Math.round(lightness * 1000) / 1000
400
+ } else {
401
+ this.hue = Math.round(angle / Math.PI * 180 + 90) % 360
402
+ }
403
+ this.emitColor()
404
+ },
405
+ startMouseCapture(event) {
406
+ event.stopPropagation()
407
+
408
+ this.captureMouse = true
409
+ if (event.target.closest('.colorpicker-triangle-slider-sl') !== null) {
410
+ this.captureType = 'sl'
411
+ } else {
412
+ this.captureType = 'hue'
413
+ }
414
+ },
415
+ stopMouseCapture(event) {
416
+ if (this.captureMouse !== false) {
417
+ event.preventDefault()
418
+ event.stopPropagation()
419
+ this.$refs[this.captureType === 'sl' ? 'slCursor' : 'hueCursor'].focus()
420
+ }
421
+ this.captureMouse = false
422
+ },
423
+ emitColor() {
424
+ const { hue, saturation, lightness } = this
425
+ this.$emit('input', Color.fromHSL(hue, saturation, lightness))
426
+ window.clearTimeout(this.debounce)
427
+ }
428
+ },
429
+ mounted() {
430
+ window.addEventListener('mousemove', this.trackMouse)
431
+ window.addEventListener('touchmove', this.trackMouse, { passive: false })
432
+ window.addEventListener('mouseup', this.stopMouseCapture)
433
+ window.addEventListener('touchend', this.stopMouseCapture)
434
+ },
435
+ beforeDestroy() {
436
+ window.removeEventListener('mousemove', this.trackMouse)
437
+ window.removeEventListener('touchmove', this.trackMouse)
438
+ window.removeEventListener('mouseup', this.stopMouseCapture)
439
+ window.removeEventListener('touchend', this.stopMouseCapture)
440
+ }
441
+ }
442
+ </script>
@@ -0,0 +1,12 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BColorpickerHSLRepresentationSquare render correctly 1`] = `
4
+ <div class="b-colorpicker-square" style="width: 200px;">
5
+ <div class="colorpicker-square-slider-hue">
6
+ <div role="slider" tabindex="0" aria-label="Hue" aria-valuemin="0" aria-valuemax="359" class="hue-range-thumb" style="left: 36.4px; top: 190px; width: 18px;"></div>
7
+ </div>
8
+ <div aria-datascales="lightness, saturation" class="colorpicker-square-slider-sl" style="margin: 20px;">
9
+ <div role="slider" tabindex="0" aria-datavalues="67%, 20%" class="sl-range-thumb" style="left: 67%; top: 80%;"></div>
10
+ </div>
11
+ </div>
12
+ `;
@@ -0,0 +1,32 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BColorpicker render correctly 1`] = `
4
+ <div class="colorpicker control">
5
+ <b-dropdown-stub maxheight="200" triggers="click" mobilemodal="true" ariarole="dialog" animation="fade" trapfocus="true" closeonclick="true" canclose="true" appendtobodycopyparent="true" aria-modal="true">
6
+ <b-dropdown-item-stub custom="true" focusable="true" ariarole="" class="">
7
+ <div>
8
+ <header class="colorpicker-header">
9
+ <!---->
10
+ </header>
11
+ <div class="colorpicker-content">
12
+ <b-colorpicker-h-s-l-representation-triangle-stub value="#000000" size="200" thickness="20"></b-colorpicker-h-s-l-representation-triangle-stub>
13
+ </div>
14
+ </div>
15
+ <footer class="colorpicker-footer">
16
+ <!---->
17
+ <b-field-stub grouped="true" addons="true" class="colorpicker-fields">
18
+ <b-field-stub label="R" horizontal="true" addons="true">
19
+ <b-input-stub size="is-small" usehtml5validation="true" statusicon="true" value="0" type="number" hascounter="true" customclass="" aria-label="Red"></b-input-stub>
20
+ </b-field-stub>
21
+ <b-field-stub label="G" horizontal="true" addons="true">
22
+ <b-input-stub size="is-small" usehtml5validation="true" statusicon="true" value="0" type="number" hascounter="true" customclass="" aria-label="Green"></b-input-stub>
23
+ </b-field-stub>
24
+ <b-field-stub label="B" horizontal="true" addons="true">
25
+ <b-input-stub size="is-small" usehtml5validation="true" statusicon="true" value="0" type="number" hascounter="true" customclass="" aria-label="Blue"></b-input-stub>
26
+ </b-field-stub>
27
+ </b-field-stub>
28
+ </footer>
29
+ </b-dropdown-item-stub>
30
+ </b-dropdown-stub>
31
+ </div>
32
+ `;
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BColorpickerAlphaSlider render correctly 1`] = `
4
+ <div class="b-colorpicker-alpha-slider" style="background-size: 100% 100%, 1em 1em, 1em 1em;">
5
+ <div role="slider" tabindex="0" aria-label="Tranparency" aria-valuemin="0" aria-valuenow="61" aria-valuemax="100" class="alpha-range-thumb" style="left: 61%;">
6
+ <b-tooltip-stub active="true" type="is-primary" label="61%" position="is-top" triggers="hover" size="is-medium" animated="true" animation="fade" autoclose="true">
7
+ &nbsp;
8
+ </b-tooltip-stub>
9
+ </div>
10
+ </div>
11
+ `;
@@ -0,0 +1,36 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BColorpickerHSLRepresentationTriangle render correctly 1`] = `
4
+ <svg viewBox="0 0 200 200" class="b-colorpicker-triangle">
5
+ <defs>
6
+ <linearGradient id="cp-triangle-gradient-ligthness-0" x1="0" y1="0" x2="1" y2="0">
7
+ <stop offset="0%" stop-color="#fff"></stop>
8
+ <stop offset="100%" stop-color="#000"></stop>
9
+ </linearGradient>
10
+ <linearGradient id="cp-triangle-gradient-saturation-0" x1="0" y1="0" x2="0" y2="1">
11
+ <stop offset="0%" stop-color="hsl(210deg, 100%, 50%)" stop-opacity="1"></stop>
12
+ <stop offset="100%" stop-color="hsl(210deg, 100%, 50%)" stop-opacity="0"></stop>
13
+ </linearGradient>
14
+ <clipPath id="cp-triangle-clip-0">
15
+ <path d="M2 100a98 98 0 1 1 196 0h-20a-78 78 0 1 0 -156 0a78 78 0 1 0 156 0h20a98 98 0 1 1 -196 0z"></path>
16
+ </clipPath>
17
+ </defs>
18
+ <g class="colorpicker-triangle-slider-hue">
19
+ <foreignObject x="0" y="0" width="200" height="200" clip-path="url(#cp-triangle-clip-0)">
20
+ <div class="colorpicker-triangle-hue"></div>
21
+ </foreignObject>
22
+ <g style="transform: rotate(210deg);">
23
+ <foreignObject x="96" y="0" width="8" height="24">
24
+ <div role="slider" tabindex="0" aria-label="Hue" aria-valuemin="0" aria-valuenow="210" aria-valuemax="360" class="hue-range-thumb"></div>
25
+ </foreignObject>
26
+ </g>
27
+ </g>
28
+ <g role="graphics-datagroup" aria-datascales="lightness, saturation" class="colorpicker-triangle-slider-sl" style="transform: rotate(210deg) translate(50%, 50%);">
29
+ <path d="M0 -78L67.54998149484 39H-67.54998149484z" fill="url(#cp-triangle-gradient-ligthness-0)"></path>
30
+ <path d="M0 -78L67.54998149484 39H-67.54998149484z" fill="url(#cp-triangle-gradient-saturation-0)" style="mix-blend-mode: overlay;"></path>
31
+ <foreignObject x="34.010373654636" y="-44.885000000000005" width="12" height="12">
32
+ <div tabindex="0" aria-datavalues="67%, 20%" class="sl-range-thumb"></div>
33
+ </foreignObject>
34
+ </g>
35
+ </svg>
36
+ `;
@@ -0,0 +1,17 @@
1
+ import Colorpicker from './Colorpicker'
2
+
3
+ import { use, registerComponent } from '../../utils/plugins'
4
+
5
+ const Plugin = {
6
+ install(Vue) {
7
+ registerComponent(Vue, Colorpicker)
8
+ }
9
+ }
10
+
11
+ use(Plugin)
12
+
13
+ export default Plugin
14
+
15
+ export {
16
+ Colorpicker as BColorpicker
17
+ }
@@ -150,6 +150,32 @@ describe('BDatepickerTableRow', () => {
150
150
  expect(wrapper.emitted()['select']).toBeTruthy()
151
151
  })
152
152
 
153
+ it('emit clicked week and year', async () => {
154
+ const wrapper = shallowMount(BDatepickerTableRow, {
155
+ propsData: {
156
+ ...Object.assign(propsData, {
157
+ showWeekNumber: true,
158
+ rulesForFirstWeek: 1,
159
+ weekNumberClickable: true
160
+ })
161
+ },
162
+ provide: {
163
+ $datepicker: {
164
+ $emit(event) {
165
+ wrapper.vm.$emit(event, arguments[1], arguments[2])
166
+ }
167
+ }
168
+ }
169
+ })
170
+ const weekDate = propsData.week[6]
171
+ const $weekButton = wrapper.find('.is-week-number')
172
+ $weekButton.trigger('click')
173
+ await wrapper.vm.$nextTick()
174
+
175
+ expect(wrapper.emitted()['week-number-click']).toBeTruthy()
176
+ expect(wrapper.emitted()['week-number-click'][0].sort()).toEqual([weekDate.getDate(), weekDate.getFullYear()].sort())
177
+ })
178
+
153
179
  it('emit focused date', async () => {
154
180
  const [y, m, d] = [2019, 4, 4]
155
181
  let day = newDate(y, m, d)
@@ -5,7 +5,7 @@
5
5
  :class="{'is-clickable': weekNumberClickable }"
6
6
  v-if="showWeekNumber"
7
7
  @click.prevent="clickWeekNumber(getWeekNumber(week[6]))">
8
- <span>{{ getWeekNumber(week[6]) }}</span>
8
+ <span>{{ getWeekNumber(week[6]).week }}</span>
9
9
  </a>
10
10
  <template v-for="(weekDay, index) in week">
11
11
  <a
@@ -141,12 +141,11 @@ export default {
141
141
  resYear = mom.getFullYear()
142
142
  resWeek = week
143
143
  }
144
-
145
- return resWeek
144
+ return {week: resWeek, year: resYear}
146
145
  },
147
- clickWeekNumber(week) {
146
+ clickWeekNumber(weekData) {
148
147
  if (this.weekNumberClickable) {
149
- this.$datepicker.$emit('week-number-click', week)
148
+ this.$datepicker.$emit('week-number-click', weekData.week, weekData.year)
150
149
  }
151
150
  },
152
151
  /*
@@ -12,6 +12,8 @@
12
12
  :editable="editable"
13
13
  :expanded="expanded"
14
14
  :close-on-click="false"
15
+ :first-day-of-week="firstDayOfWeek"
16
+ :rules-for-first-week="rulesForFirstWeek"
15
17
  :date-formatter="defaultDatetimeFormatter"
16
18
  :date-parser="defaultDatetimeParser"
17
19
  :min-date="minDate"
@@ -116,6 +118,20 @@ export default {
116
118
  placeholder: String,
117
119
  horizontalTimePicker: Boolean,
118
120
  disabled: Boolean,
121
+ firstDayOfWeek: {
122
+ type: Number,
123
+ default: () => {
124
+ if (typeof config.defaultFirstDayOfWeek === 'number') {
125
+ return config.defaultFirstDayOfWeek
126
+ } else {
127
+ return 0
128
+ }
129
+ }
130
+ },
131
+ rulesForFirstWeek: {
132
+ type: Number,
133
+ default: () => 4
134
+ },
119
135
  icon: String,
120
136
  iconRight: String,
121
137
  iconRightClickable: Boolean,
@@ -348,7 +364,7 @@ export default {
348
364
  datetimeGroups.hour < 24 &&
349
365
  datetimeGroups.minute &&
350
366
  datetimeGroups.minute >= 0 &&
351
- datetimeGroups.minute < 59
367
+ datetimeGroups.minute <= 59
352
368
  ) {
353
369
  const d = new Date(
354
370
  datetimeGroups.year,
@@ -179,6 +179,7 @@ export default {
179
179
  */
180
180
  isActive(value) {
181
181
  this.$emit('active-change', value)
182
+ this.handleScroll()
182
183
  if (this.appendToBody) {
183
184
  this.$nextTick(() => {
184
185
  this.updateAppendToBody()
@@ -187,6 +188,18 @@ export default {
187
188
  }
188
189
  },
189
190
  methods: {
191
+ handleScroll() {
192
+ if (typeof window === 'undefined') return
193
+
194
+ if (this.isMobileModal) {
195
+ if (this.isActive) {
196
+ document.documentElement.classList.add('is-clipped-touch')
197
+ } else {
198
+ document.documentElement.classList.remove('is-clipped-touch')
199
+ }
200
+ }
201
+ },
202
+
190
203
  /**
191
204
  * Click listener from DropdownItem.
192
205
  * 1. Set new selected item.