aloha-vue 2.85.0 → 2.86.0

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 (244) hide show
  1. package/CHANGELOG.md +1208 -1200
  2. package/README.md +117 -117
  3. package/dist/aloha-vue.css +13806 -13601
  4. package/dist/aloha-vue.css.map +1 -1
  5. package/dist/aloha-vue.es.js +60168 -57401
  6. package/dist/aloha-vue.umd.js +319 -319
  7. package/package.json +1 -1
  8. package/scss/components/AButton.scss +6 -6
  9. package/scss/components/ADivider.scss +9 -9
  10. package/scss/components/AElement.scss +6 -6
  11. package/scss/components/AGroupButtonDropdown.scss +4 -4
  12. package/scss/components/AIcon.scss +17 -17
  13. package/scss/components/ALoading.scss +18 -18
  14. package/scss/components/AMenu.scss +634 -634
  15. package/scss/components/AProgressCirle.scss +43 -43
  16. package/scss/components/AShowMore.scss +9 -9
  17. package/scss/components/ATableForm.scss +7 -7
  18. package/scss/components/ATabs.scss +186 -186
  19. package/scss/components/ui/AColorPicker.scss +223 -0
  20. package/scss/components/ui/AJson.scss +11 -11
  21. package/scss/components/ui/ui.scss +1 -0
  22. package/scss/text/text_line_height.scss +17 -17
  23. package/scss/text/text_size.scss +88 -88
  24. package/scss/utils/acordion.scss +173 -173
  25. package/scss/utils/alert.scss +81 -81
  26. package/scss/utils/aloha_prefix.scss +1 -1
  27. package/scss/utils/backdrop.scss +24 -24
  28. package/scss/utils/border.scss +65 -65
  29. package/scss/utils/breakpoint.scss +48 -48
  30. package/scss/utils/button_close.scss +22 -22
  31. package/scss/utils/button_group.scss +69 -69
  32. package/scss/utils/color_utils.scss +234 -234
  33. package/scss/utils/display.scss +67 -67
  34. package/scss/utils/flex.scss +141 -141
  35. package/scss/utils/float.scss +10 -10
  36. package/scss/utils/global.scss +44 -44
  37. package/scss/utils/global_variables.scss +26 -26
  38. package/scss/utils/grid.scss +95 -95
  39. package/scss/utils/list_columns.scss +31 -31
  40. package/scss/utils/list_group.scss +127 -127
  41. package/scss/utils/notification.scss +36 -36
  42. package/scss/utils/overflow.scss +40 -40
  43. package/scss/utils/pagination.scss +94 -94
  44. package/scss/utils/position.scss +90 -90
  45. package/scss/utils/progress.scss +70 -70
  46. package/scss/utils/screenreader.scss +16 -16
  47. package/scss/utils/spinner.scss +35 -35
  48. package/scss/utils/utils.scss +19 -19
  49. package/scss/utils/vars_global.scss +12 -12
  50. package/src/AAlert/i18n/AAlertI18n.js +4 -0
  51. package/src/AAlert/i18n/nl.json +3 -0
  52. package/src/AAlert/i18n/pl.json +3 -0
  53. package/src/ACarousel/i18n/ACarouselI18n.js +4 -0
  54. package/src/ACarousel/i18n/nl.json +9 -0
  55. package/src/ACarousel/i18n/pl.json +9 -0
  56. package/src/ACloak/i18n/ACloakI18n.js +4 -0
  57. package/src/ACloak/i18n/nl.json +3 -0
  58. package/src/ACloak/i18n/pl.json +3 -0
  59. package/src/ADisclosure/i18n/ADisclosureI18n.js +4 -0
  60. package/src/ADisclosure/i18n/nl.json +4 -0
  61. package/src/ADisclosure/i18n/pl.json +4 -0
  62. package/src/AFilters/i18n/AFiltersI18n.js +4 -0
  63. package/src/AFilters/i18n/nl.json +30 -0
  64. package/src/AFilters/i18n/pl.json +30 -0
  65. package/src/AGroupButtonDropdown/AGroupButtonDropdown.js +119 -119
  66. package/src/ALinkCopy/i18n/ALinkCopyI18n.js +4 -0
  67. package/src/ALinkCopy/i18n/nl.json +4 -0
  68. package/src/ALinkCopy/i18n/pl.json +4 -0
  69. package/src/ALoading/i18n/ALoadingI18n.js +4 -0
  70. package/src/ALoading/i18n/nl.json +3 -0
  71. package/src/ALoading/i18n/pl.json +3 -0
  72. package/src/AMenu/i18n/AMenu2I18n.js +4 -0
  73. package/src/AMenu/i18n/nl.json +14 -0
  74. package/src/AMenu/i18n/pl.json +14 -0
  75. package/src/AModal/compositionAPI/ZIndexAPI.js +48 -48
  76. package/src/AModal/i18n/AModalI18n.js +4 -0
  77. package/src/AModal/i18n/nl.json +7 -0
  78. package/src/AModal/i18n/pl.json +7 -0
  79. package/src/APagination/i18n/APaginationI18n.js +4 -0
  80. package/src/APagination/i18n/nl.json +12 -0
  81. package/src/APagination/i18n/pl.json +12 -0
  82. package/src/AProgress/AProgress.js +141 -141
  83. package/src/AProgressCircle/AProgressCircle.js +160 -160
  84. package/src/AShowMore/i18n/AShowMoreI18n.js +4 -0
  85. package/src/AShowMore/i18n/nl.json +6 -0
  86. package/src/AShowMore/i18n/pl.json +6 -0
  87. package/src/ASpinner/i18n/ASpinnerI18n.js +4 -0
  88. package/src/ASpinner/i18n/nl.json +3 -0
  89. package/src/ASpinner/i18n/pl.json +3 -0
  90. package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +188 -188
  91. package/src/ATable/i18n/ATableI18n.js +4 -0
  92. package/src/ATable/i18n/nl.json +54 -0
  93. package/src/ATable/i18n/pl.json +54 -0
  94. package/src/ATableForm/i18n/ATableFormI18n.js +4 -0
  95. package/src/ATableForm/i18n/nl.json +18 -0
  96. package/src/ATableForm/i18n/pl.json +18 -0
  97. package/src/ATranslation/compositionAPI/UtilsAPI.js +6 -1
  98. package/src/ATranslation/compositionAPI/__tests__/UtilsAPI.getTranslatedText.test.js +38 -0
  99. package/src/AVerticalScroll/i18n/AVerticalScrollI18n.js +4 -0
  100. package/src/AVerticalScroll/i18n/nl.json +4 -0
  101. package/src/AVerticalScroll/i18n/pl.json +4 -0
  102. package/src/AWizard/i18n/AWizardI18n.js +4 -0
  103. package/src/AWizard/i18n/nl.json +16 -0
  104. package/src/AWizard/i18n/pl.json +16 -0
  105. package/src/PVP/new.txt +39 -39
  106. package/src/PuxDatepicker/PuxDatepicker.js +670 -670
  107. package/src/PuxDatepicker/PuxDatepicker.pug +131 -131
  108. package/src/PuxDatepicker/PuxDatepicker.vue +2 -2
  109. package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.pug +136 -136
  110. package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.vue +2 -2
  111. package/src/PuxDatepicker/PuxDatepickerIcon/PuxDatepickerIcon.js +30 -30
  112. package/src/PuxDatepicker/PuxDatepickerIcon/PuxDatepickerIcon.pug +6 -6
  113. package/src/PuxDatepicker/PuxDatepickerIcon/PuxDatepickerIcon.vue +2 -2
  114. package/src/PuxDatepicker/locale/languages.js +174 -174
  115. package/src/PuxDatepicker/mixins/PanelMixin.js +76 -76
  116. package/src/PuxDatepicker/panel/PanelDate/PanelDate.pug +41 -41
  117. package/src/PuxDatepicker/panel/PanelDate/PanelDate.vue +2 -2
  118. package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.pug +16 -16
  119. package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.vue +2 -2
  120. package/src/PuxDatepicker/panel/PanelTime/PanelTime.pug +20 -20
  121. package/src/PuxDatepicker/panel/PanelTime/PanelTime.vue +2 -2
  122. package/src/PuxDatepicker/panel/PanelYear/PanelYear.pug +16 -16
  123. package/src/PuxDatepicker/panel/PanelYear/PanelYear.vue +2 -2
  124. package/src/PuxDatepicker/panel/PanelYearItem/PanelYearItem.js +55 -55
  125. package/src/PuxDatepicker/panel/PanelYearItem/PanelYearItem.pug +9 -9
  126. package/src/PuxDatepicker/panel/PanelYearItem/PanelYearItem.vue +2 -2
  127. package/src/PuxDatepicker/utils/keysCode.js +9 -9
  128. package/src/PuxDatepicker/utils/scroll-into-view.js +23 -23
  129. package/src/PuxDatepicker/utils/transform.js +23 -23
  130. package/src/filters/i18n/Filters18n.js +4 -0
  131. package/src/filters/i18n/nl.json +11 -0
  132. package/src/filters/i18n/pl.json +11 -0
  133. package/src/i18n/allLanguages.js +96 -0
  134. package/src/i18n/nl.json +4 -0
  135. package/src/i18n/pl.json +4 -0
  136. package/src/index.js +4 -0
  137. package/src/ui/ACheckbox/ACheckbox.js +5 -0
  138. package/src/ui/ACheckbox/i18n/ACheckboxI18n.js +4 -0
  139. package/src/ui/ACheckbox/i18n/nl.json +5 -0
  140. package/src/ui/ACheckbox/i18n/pl.json +5 -0
  141. package/src/ui/AColorPicker/AColorPicker.js +697 -0
  142. package/src/ui/AColorPicker/AColorPickerSaturation/AColorPickerSaturation.js +102 -0
  143. package/src/ui/AColorPicker/AColorPickerSaturation/compositionAPI/SaturationAPI.js +77 -0
  144. package/src/ui/AColorPicker/AColorPickerSlider/AColorPickerSlider.js +125 -0
  145. package/src/ui/AColorPicker/AColorPickerSlider/compositionAPI/SliderAPI.js +73 -0
  146. package/src/ui/AColorPicker/__tests__/AColorPicker.test.js +139 -0
  147. package/src/ui/AColorPicker/__tests__/colorUtils.test.js +92 -0
  148. package/src/ui/AColorPicker/compositionAPI/ColorStateAPI.js +108 -0
  149. package/src/ui/AColorPicker/compositionAPI/ConfirmAPI.js +36 -0
  150. package/src/ui/AColorPicker/compositionAPI/InputAPI.js +63 -0
  151. package/src/ui/AColorPicker/compositionAPI/KeyboardStepAPI.js +42 -0
  152. package/src/ui/AColorPicker/compositionAPI/PointerDragAPI.js +70 -0
  153. package/src/ui/AColorPicker/compositionAPI/PopoverAPI.js +179 -0
  154. package/src/ui/AColorPicker/compositionAPI/PredefineAPI.js +42 -0
  155. package/src/ui/AColorPicker/compositionAPI/ToggleClassAPI.js +24 -0
  156. package/src/ui/AColorPicker/i18n/AColorPickerI18n.js +25 -0
  157. package/src/ui/AColorPicker/i18n/ar.json +13 -0
  158. package/src/ui/AColorPicker/i18n/de.json +13 -0
  159. package/src/ui/AColorPicker/i18n/en.json +13 -0
  160. package/src/ui/AColorPicker/i18n/es.json +13 -0
  161. package/src/ui/AColorPicker/i18n/fr.json +13 -0
  162. package/src/ui/AColorPicker/i18n/hr.json +13 -0
  163. package/src/ui/AColorPicker/i18n/it.json +13 -0
  164. package/src/ui/AColorPicker/i18n/nl.json +13 -0
  165. package/src/ui/AColorPicker/i18n/pl.json +13 -0
  166. package/src/ui/AColorPicker/i18n/ru.json +13 -0
  167. package/src/ui/AColorPicker/i18n/uk.json +13 -0
  168. package/src/ui/AColorPicker/utils/colorUtils.js +281 -0
  169. package/src/ui/ADatepicker/ADatepickerCalendarPanel/ADatepickerCalendarPanel.js +68 -68
  170. package/src/ui/ADatepicker/i18n/ADatepickerI18n.js +4 -0
  171. package/src/ui/ADatepicker/i18n/nl.json +58 -0
  172. package/src/ui/ADatepicker/i18n/pl.json +58 -0
  173. package/src/ui/ADatepicker/panel/APanelTime/APanelTime.js +147 -147
  174. package/src/ui/ADatepicker/panel/APanelYear/APanelYear.js +123 -123
  175. package/src/ui/ADatepickerAlt/ADatepickerCalendarPanel/ADatepickerCalendarPanel.js +804 -804
  176. package/src/ui/ADatepickerAlt/panel/APanelDate/APanelDate.js +353 -353
  177. package/src/ui/ADatepickerAlt/panel/APanelMonth/APanelMonth.js +187 -187
  178. package/src/ui/ADatepickerAlt/panel/APanelTime/APanelTime.js +303 -303
  179. package/src/ui/ADatepickerAlt/panel/APanelYear/APanelYear.js +162 -162
  180. package/src/ui/ADatepickerRange/i18n/ADatepickerRangeI18n.js +4 -0
  181. package/src/ui/ADatepickerRange/i18n/nl.json +4 -0
  182. package/src/ui/ADatepickerRange/i18n/pl.json +4 -0
  183. package/src/ui/AErrors/i18n/AErrorsI18n.js +4 -0
  184. package/src/ui/AErrors/i18n/nl.json +3 -0
  185. package/src/ui/AErrors/i18n/pl.json +3 -0
  186. package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +1 -0
  187. package/src/ui/AFieldset/i18n/AFieldsetI18n.js +4 -0
  188. package/src/ui/AFieldset/i18n/nl.json +4 -0
  189. package/src/ui/AFieldset/i18n/pl.json +4 -0
  190. package/src/ui/AFormElementBtnClear/i18n/AFormElementBtnClearI18n.js +4 -0
  191. package/src/ui/AFormElementBtnClear/i18n/nl.json +3 -0
  192. package/src/ui/AFormElementBtnClear/i18n/pl.json +3 -0
  193. package/src/ui/AInput/i18n/AInputI18n.js +4 -0
  194. package/src/ui/AInput/i18n/nl.json +4 -0
  195. package/src/ui/AInput/i18n/pl.json +4 -0
  196. package/src/ui/AInputCurrency/i18n/AInputCurrencyI18n.js +4 -0
  197. package/src/ui/AInputCurrency/i18n/nl.json +4 -0
  198. package/src/ui/AInputCurrency/i18n/pl.json +4 -0
  199. package/src/ui/AInputNumber/i18n/AInputNumberI18n.js +4 -0
  200. package/src/ui/AInputNumber/i18n/nl.json +4 -0
  201. package/src/ui/AInputNumber/i18n/pl.json +4 -0
  202. package/src/ui/AInputNumberRange/i18n/AInputNumberRangeI18n.js +4 -0
  203. package/src/ui/AInputNumberRange/i18n/nl.json +4 -0
  204. package/src/ui/AInputNumberRange/i18n/pl.json +4 -0
  205. package/src/ui/AJson/i18n/AJsonI18n.js +4 -0
  206. package/src/ui/AJson/i18n/nl.json +8 -0
  207. package/src/ui/AJson/i18n/pl.json +8 -0
  208. package/src/ui/AMultiselectOrdered/i18n/AMultiselectOrderedI18n.js +4 -0
  209. package/src/ui/AMultiselectOrdered/i18n/nl.json +12 -0
  210. package/src/ui/AMultiselectOrdered/i18n/pl.json +12 -0
  211. package/src/ui/ARadio/i18n/ARadioI18n.js +4 -0
  212. package/src/ui/ARadio/i18n/nl.json +5 -0
  213. package/src/ui/ARadio/i18n/pl.json +5 -0
  214. package/src/ui/ARequired/i18n/ARequiredI18n.js +4 -0
  215. package/src/ui/ARequired/i18n/nl.json +3 -0
  216. package/src/ui/ARequired/i18n/pl.json +3 -0
  217. package/src/ui/ARouterLinkConfig/i18n/ARouterLinkConfigI18n.js +4 -0
  218. package/src/ui/ARouterLinkConfig/i18n/nl.json +14 -0
  219. package/src/ui/ARouterLinkConfig/i18n/pl.json +14 -0
  220. package/src/ui/ASelect/i18n/ASelectI18n.js +4 -0
  221. package/src/ui/ASelect/i18n/ar.json +5 -5
  222. package/src/ui/ASelect/i18n/de.json +4 -4
  223. package/src/ui/ASelect/i18n/en.json +5 -5
  224. package/src/ui/ASelect/i18n/es.json +5 -5
  225. package/src/ui/ASelect/i18n/fr.json +5 -5
  226. package/src/ui/ASelect/i18n/hr.json +5 -5
  227. package/src/ui/ASelect/i18n/it.json +5 -5
  228. package/src/ui/ASelect/i18n/nl.json +11 -0
  229. package/src/ui/ASelect/i18n/pl.json +11 -0
  230. package/src/ui/ASelect/i18n/ru.json +5 -5
  231. package/src/ui/ASelectStyle/i18n/ASelectStyleI18n.js +4 -0
  232. package/src/ui/ASelectStyle/i18n/nl.json +292 -0
  233. package/src/ui/ASelectStyle/i18n/pl.json +292 -0
  234. package/src/ui/ASlider/i18n/ASliderI18n.js +4 -0
  235. package/src/ui/ASlider/i18n/nl.json +5 -0
  236. package/src/ui/ASlider/i18n/pl.json +5 -0
  237. package/src/ui/ASwitch/i18n/ASwitchI18n.js +4 -0
  238. package/src/ui/ASwitch/i18n/nl.json +5 -0
  239. package/src/ui/ASwitch/i18n/pl.json +5 -0
  240. package/src/ui/AUiComponents.js +2 -0
  241. package/src/ui/AValidatedJson/i18n/AValidatedJsonI18n.js +4 -0
  242. package/src/ui/AValidatedJson/i18n/nl.json +25 -0
  243. package/src/ui/AValidatedJson/i18n/pl.json +25 -0
  244. package/src/ui/compositionApi/__tests__/UiStyleHideAPI.test.js +9 -4
@@ -0,0 +1,108 @@
1
+ import {
2
+ computed,
3
+ ref,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ import {
8
+ formatColor,
9
+ getContrastTextColor,
10
+ hsvToRgb,
11
+ parseColor,
12
+ rgbToHsv,
13
+ toCssColor,
14
+ } from "../utils/colorUtils";
15
+
16
+ const COLOR_FALLBACK = { r: 255, g: 0, b: 0, a: 1 };
17
+
18
+ /**
19
+ * State of the panel (hsva) and the colors derived from it and from the model.
20
+ */
21
+ export default function ColorStateAPI(props) {
22
+ const colorFormat = toRef(props, "colorFormat");
23
+ const modelValue = toRef(props, "modelValue");
24
+ const panelDefaultColor = toRef(props, "panelDefaultColor");
25
+ const showAlpha = toRef(props, "showAlpha");
26
+
27
+ const hsva = ref({ h: 0, s: 100, v: 100, a: 1 });
28
+
29
+ const modelColor = computed(() => parseColor(modelValue.value));
30
+
31
+ const modelCssColor = computed(() => {
32
+ return modelColor.value ? toCssColor(modelColor.value) : undefined;
33
+ });
34
+
35
+ const modelTextColor = computed(() => {
36
+ return modelColor.value ? getContrastTextColor(modelColor.value) : undefined;
37
+ });
38
+
39
+ const rgbaLocal = computed(() => {
40
+ return {
41
+ ...hsvToRgb(hsva.value),
42
+ a: showAlpha.value ? hsva.value.a : 1,
43
+ };
44
+ });
45
+
46
+ const valueLocal = computed(() => {
47
+ return formatColor(rgbaLocal.value, colorFormat.value, showAlpha.value);
48
+ });
49
+
50
+ const cssColorLocal = computed(() => toCssColor(rgbaLocal.value));
51
+
52
+ const cssColorOpaqueLocal = computed(() => toCssColor({ ...rgbaLocal.value, a: 1 }));
53
+
54
+ const hueCssColor = computed(() => `hsl(${ hsva.value.h }, 100%, 50%)`);
55
+
56
+ const alphaBackground = computed(() => {
57
+ return `linear-gradient(to right, transparent, ${ cssColorOpaqueLocal.value })`;
58
+ });
59
+
60
+ const alphaPercent = computed(() => Math.round(hsva.value.a * 100));
61
+
62
+ const setColor = ({ r, g, b, a = 1 }) => {
63
+ const HSV = rgbToHsv({ r, g, b });
64
+ // gray, black and white have no hue: keep the current one
65
+ const IS_HUE_KEPT = HSV.s === 0 || HSV.v === 0;
66
+ hsva.value = {
67
+ h: IS_HUE_KEPT ? hsva.value.h : Math.round(HSV.h),
68
+ s: Math.round(HSV.s),
69
+ v: Math.round(HSV.v),
70
+ a: showAlpha.value ? a : 1,
71
+ };
72
+ };
73
+
74
+ const setColorFromModel = () => {
75
+ setColor(modelColor.value || parseColor(panelDefaultColor.value) || COLOR_FALLBACK);
76
+ };
77
+
78
+ const setHue = h => {
79
+ hsva.value = { ...hsva.value, h };
80
+ };
81
+
82
+ const setSaturationBrightness = ({ saturation, brightness }) => {
83
+ hsva.value = { ...hsva.value, s: saturation, v: brightness };
84
+ };
85
+
86
+ const setAlphaPercent = percent => {
87
+ hsva.value = { ...hsva.value, a: percent / 100 };
88
+ };
89
+
90
+ return {
91
+ alphaBackground,
92
+ alphaPercent,
93
+ cssColorLocal,
94
+ cssColorOpaqueLocal,
95
+ hsva,
96
+ hueCssColor,
97
+ modelColor,
98
+ modelCssColor,
99
+ modelTextColor,
100
+ rgbaLocal,
101
+ setAlphaPercent,
102
+ setColor,
103
+ setColorFromModel,
104
+ setHue,
105
+ setSaturationBrightness,
106
+ valueLocal,
107
+ };
108
+ }
@@ -0,0 +1,36 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function ConfirmAPI(props, {
7
+ applyInput = () => true,
8
+ changeModel = () => {},
9
+ closePopover = () => {},
10
+ valueLocal = computed(() => ""),
11
+ }) {
12
+ const modelUndefined = toRef(props, "modelUndefined");
13
+
14
+ const confirmColor = () => {
15
+ if (!applyInput()) {
16
+ return;
17
+ }
18
+ changeModel({
19
+ model: valueLocal.value,
20
+ });
21
+ closePopover({ isFocusToggle: true });
22
+ };
23
+
24
+ const clearColor = () => {
25
+ changeModel({
26
+ model: modelUndefined.value,
27
+ triggerDetails: "clear",
28
+ });
29
+ closePopover({ isFocusToggle: true });
30
+ };
31
+
32
+ return {
33
+ clearColor,
34
+ confirmColor,
35
+ };
36
+ }
@@ -0,0 +1,63 @@
1
+ import {
2
+ computed,
3
+ ref,
4
+ watch,
5
+ } from "vue";
6
+
7
+ import {
8
+ parseColor,
9
+ } from "../utils/colorUtils";
10
+
11
+ /**
12
+ * Text field in the panel: any supported format can be typed in.
13
+ * The value is applied with Enter or when the field loses focus.
14
+ */
15
+ export default function InputAPI({
16
+ setColor = () => {},
17
+ valueLocal = computed(() => ""),
18
+ }) {
19
+ const inputErrors = ref(undefined);
20
+ const inputText = ref("");
21
+
22
+ watch(valueLocal, value => {
23
+ inputText.value = value;
24
+ inputErrors.value = undefined;
25
+ }, {
26
+ immediate: true,
27
+ });
28
+
29
+ const onInputChange = ({ model }) => {
30
+ inputText.value = model;
31
+ };
32
+
33
+ const applyInput = () => {
34
+ if (inputText.value === valueLocal.value) {
35
+ inputErrors.value = undefined;
36
+ return true;
37
+ }
38
+ const COLOR = parseColor(inputText.value);
39
+ if (!COLOR) {
40
+ inputErrors.value = "_A_COLOR_PICKER_INVALID_";
41
+ return false;
42
+ }
43
+ setColor(COLOR);
44
+ inputText.value = valueLocal.value;
45
+ inputErrors.value = undefined;
46
+ return true;
47
+ };
48
+
49
+ const onInputKeydown = $event => {
50
+ if ($event.key === "Enter") {
51
+ $event.preventDefault();
52
+ applyInput();
53
+ }
54
+ };
55
+
56
+ return {
57
+ applyInput,
58
+ inputErrors,
59
+ inputText,
60
+ onInputChange,
61
+ onInputKeydown,
62
+ };
63
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ clamp,
3
+ } from "../utils/colorUtils";
4
+
5
+ /**
6
+ * New value of a slider for a key (WAI-ARIA slider pattern).
7
+ * Returns undefined if the key is not handled.
8
+ * Arrows: step (with Shift: largeStep), Page Up / Page Down: largeStep, Home / End: min / max.
9
+ */
10
+ export function getValueForKey({ key, shiftKey, value, min, max, step = 1, largeStep = 10, isVertical = false }) {
11
+ const STEP = shiftKey ? largeStep : step;
12
+ let next;
13
+ switch (key) {
14
+ case "ArrowRight":
15
+ next = isVertical ? undefined : value + STEP;
16
+ break;
17
+ case "ArrowLeft":
18
+ next = isVertical ? undefined : value - STEP;
19
+ break;
20
+ case "ArrowUp":
21
+ next = value + STEP;
22
+ break;
23
+ case "ArrowDown":
24
+ next = value - STEP;
25
+ break;
26
+ case "PageUp":
27
+ next = value + largeStep;
28
+ break;
29
+ case "PageDown":
30
+ next = value - largeStep;
31
+ break;
32
+ case "Home":
33
+ next = min;
34
+ break;
35
+ case "End":
36
+ next = max;
37
+ break;
38
+ default:
39
+ next = undefined;
40
+ }
41
+ return next === undefined ? undefined : clamp(next, min, max);
42
+ }
@@ -0,0 +1,70 @@
1
+ import {
2
+ onBeforeUnmount,
3
+ ref,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ import {
8
+ clamp,
9
+ } from "../utils/colorUtils";
10
+
11
+ /**
12
+ * Drag with mouse, pen and touch (pointer events).
13
+ * onMove gets the position inside the element as { x, y } from 0 to 1.
14
+ */
15
+ export default function PointerDragAPI(props, {
16
+ elementRef = ref(undefined),
17
+ onMove = () => {},
18
+ onStart = () => {},
19
+ }) {
20
+ const disabled = toRef(props, "disabled");
21
+
22
+ const isDragging = ref(false);
23
+
24
+ const getPosition = $event => {
25
+ const RECT = elementRef.value.getBoundingClientRect();
26
+ return {
27
+ x: RECT.width ? clamp(($event.clientX - RECT.left) / RECT.width, 0, 1) : 0,
28
+ y: RECT.height ? clamp(($event.clientY - RECT.top) / RECT.height, 0, 1) : 0,
29
+ };
30
+ };
31
+
32
+ const onPointerMove = $event => {
33
+ if (!isDragging.value) {
34
+ return;
35
+ }
36
+ $event.preventDefault();
37
+ onMove(getPosition($event));
38
+ };
39
+
40
+ const removeEvents = () => {
41
+ window.removeEventListener("pointermove", onPointerMove);
42
+ window.removeEventListener("pointerup", onPointerUp);
43
+ window.removeEventListener("pointercancel", onPointerUp);
44
+ };
45
+
46
+ function onPointerUp() {
47
+ isDragging.value = false;
48
+ removeEvents();
49
+ }
50
+
51
+ const onPointerDown = $event => {
52
+ if (disabled.value || $event.button > 0 || !elementRef.value) {
53
+ return;
54
+ }
55
+ $event.preventDefault();
56
+ isDragging.value = true;
57
+ onStart();
58
+ onMove(getPosition($event));
59
+ window.addEventListener("pointermove", onPointerMove);
60
+ window.addEventListener("pointerup", onPointerUp);
61
+ window.addEventListener("pointercancel", onPointerUp);
62
+ };
63
+
64
+ onBeforeUnmount(removeEvents);
65
+
66
+ return {
67
+ isDragging,
68
+ onPointerDown,
69
+ };
70
+ }
@@ -0,0 +1,179 @@
1
+ import {
2
+ computed,
3
+ nextTick,
4
+ onBeforeUnmount,
5
+ ref,
6
+ toRef,
7
+ } from "vue";
8
+
9
+ import {
10
+ autoUpdate,
11
+ computePosition,
12
+ flip,
13
+ limitShift,
14
+ offset,
15
+ shift,
16
+ } from "@floating-ui/vue";
17
+
18
+ import AEventOutsideAPI from "../../../compositionAPI/AEventOutsideAPI";
19
+ import {
20
+ closePopup,
21
+ openPopup,
22
+ } from "../../../compositionAPI/APopupAPI";
23
+
24
+ const FOCUSABLE = "button:not([disabled]), input:not([disabled]), [tabindex='0']";
25
+
26
+ export default function PopoverAPI(props, { emit }, {
27
+ htmlIdLocal = computed(() => ""),
28
+ setColorFromModel = () => {},
29
+ }) {
30
+ const disabled = toRef(props, "disabled");
31
+ const placement = toRef(props, "placement");
32
+
33
+ const cleanupPopper = ref(undefined);
34
+ const isOpen = ref(false);
35
+ const popupRef = ref(undefined);
36
+ const toggleRef = ref(undefined);
37
+
38
+ const popupId = computed(() => `${ htmlIdLocal.value }_popup`);
39
+
40
+ const elementsForClickOutside = computed(() => [toggleRef.value, popupRef.value]);
41
+
42
+ const startPosition = () => {
43
+ if (cleanupPopper.value || !toggleRef.value || !popupRef.value) {
44
+ return;
45
+ }
46
+ cleanupPopper.value = autoUpdate(toggleRef.value, popupRef.value, () => {
47
+ if (!toggleRef.value || !popupRef.value) {
48
+ return;
49
+ }
50
+ computePosition(toggleRef.value, popupRef.value, {
51
+ placement: placement.value,
52
+ middleware: [
53
+ offset(4),
54
+ flip(),
55
+ shift({ limiter: limitShift(), padding: 8 }),
56
+ ],
57
+ }).then(({ x, y }) => {
58
+ if (!popupRef.value) {
59
+ return;
60
+ }
61
+ Object.assign(popupRef.value.style, {
62
+ left: `${ x }px`,
63
+ top: `${ y }px`,
64
+ });
65
+ });
66
+ });
67
+ };
68
+
69
+ const stopPosition = () => {
70
+ if (cleanupPopper.value) {
71
+ cleanupPopper.value();
72
+ cleanupPopper.value = undefined;
73
+ }
74
+ };
75
+
76
+ const focusToggle = () => {
77
+ toggleRef.value?.focus();
78
+ };
79
+
80
+ const getFocusableElements = () => {
81
+ return popupRef.value ? [...popupRef.value.querySelectorAll(FOCUSABLE)] : [];
82
+ };
83
+
84
+ const {
85
+ destroyEventClickOutside,
86
+ setEventClickOutside,
87
+ } = AEventOutsideAPI({
88
+ $elements: elementsForClickOutside,
89
+ clickOutsideCallback: () => closePopover(),
90
+ });
91
+
92
+ function closePopover({ isFocusToggle = false } = {}) {
93
+ if (!isOpen.value) {
94
+ return;
95
+ }
96
+ isOpen.value = false;
97
+ stopPosition();
98
+ destroyEventClickOutside();
99
+ closePopup({ id: popupId.value });
100
+ emit("close");
101
+ if (isFocusToggle) {
102
+ focusToggle();
103
+ }
104
+ }
105
+
106
+ const openPopover = () => {
107
+ if (disabled.value || isOpen.value) {
108
+ return;
109
+ }
110
+ setColorFromModel();
111
+ isOpen.value = true;
112
+ openPopup({ id: popupId.value });
113
+ emit("open");
114
+ nextTick(() => {
115
+ startPosition();
116
+ getFocusableElements()[0]?.focus();
117
+ setTimeout(setEventClickOutside, 100);
118
+ });
119
+ };
120
+
121
+ const togglePopover = () => {
122
+ if (isOpen.value) {
123
+ closePopover({ isFocusToggle: true });
124
+ } else {
125
+ openPopover();
126
+ }
127
+ };
128
+
129
+ const onToggleKeydown = $event => {
130
+ if (!isOpen.value && ($event.key === "ArrowDown" || $event.key === "ArrowUp")) {
131
+ $event.preventDefault();
132
+ openPopover();
133
+ }
134
+ };
135
+
136
+ // The popup is a dialog: Escape closes it, Tab stays inside.
137
+ const onPopupKeydown = $event => {
138
+ if ($event.key === "Escape") {
139
+ $event.preventDefault();
140
+ $event.stopPropagation();
141
+ closePopover({ isFocusToggle: true });
142
+ return;
143
+ }
144
+ if ($event.key !== "Tab") {
145
+ return;
146
+ }
147
+ const ELEMENTS = getFocusableElements();
148
+ if (!ELEMENTS.length) {
149
+ return;
150
+ }
151
+ const FIRST = ELEMENTS[0];
152
+ const LAST = ELEMENTS[ELEMENTS.length - 1];
153
+ if ($event.shiftKey && document.activeElement === FIRST) {
154
+ $event.preventDefault();
155
+ LAST.focus();
156
+ } else if (!$event.shiftKey && document.activeElement === LAST) {
157
+ $event.preventDefault();
158
+ FIRST.focus();
159
+ }
160
+ };
161
+
162
+ onBeforeUnmount(() => {
163
+ stopPosition();
164
+ if (isOpen.value) {
165
+ closePopup({ id: popupId.value });
166
+ }
167
+ });
168
+
169
+ return {
170
+ closePopover,
171
+ isOpen,
172
+ onPopupKeydown,
173
+ onToggleKeydown,
174
+ popupId,
175
+ popupRef,
176
+ toggleRef,
177
+ togglePopover,
178
+ };
179
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ import {
7
+ isSameColor,
8
+ parseColor,
9
+ toCssColor,
10
+ } from "../utils/colorUtils";
11
+
12
+ export default function PredefineAPI(props, {
13
+ rgbaLocal = computed(() => ({})),
14
+ setColor = () => {},
15
+ }) {
16
+ const predefine = toRef(props, "predefine");
17
+
18
+ const predefineLocal = computed(() => {
19
+ const ITEMS = [];
20
+ (predefine.value || []).forEach(value => {
21
+ const COLOR = parseColor(value);
22
+ if (COLOR) {
23
+ ITEMS.push({
24
+ value,
25
+ color: COLOR,
26
+ cssColor: toCssColor(COLOR),
27
+ isSelected: isSameColor(COLOR, rgbaLocal.value),
28
+ });
29
+ }
30
+ });
31
+ return ITEMS;
32
+ });
33
+
34
+ const selectPredefine = item => {
35
+ setColor(item.color);
36
+ };
37
+
38
+ return {
39
+ predefineLocal,
40
+ selectPredefine,
41
+ };
42
+ }
@@ -0,0 +1,24 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function ToggleClassAPI(props, {
7
+ isClearButtonLocal = computed(() => false),
8
+ isErrors = computed(() => false),
9
+ }) {
10
+ const errorIcon = toRef(props, "errorIcon");
11
+
12
+ const hasErrorIcon = computed(() => {
13
+ return !!(isErrors.value && errorIcon.value);
14
+ });
15
+
16
+ const toggleClassBtns = computed(() => {
17
+ return isClearButtonLocal.value ? "a_form_element_with_one_btn" : undefined;
18
+ });
19
+
20
+ return {
21
+ hasErrorIcon,
22
+ toggleClassBtns,
23
+ };
24
+ }
@@ -0,0 +1,25 @@
1
+ import ar from "./ar.json";
2
+ import de from "./de.json";
3
+ import en from "./en.json";
4
+ import es from "./es.json";
5
+ import fr from "./fr.json";
6
+ import hr from "./hr.json";
7
+ import it from "./it.json";
8
+ import nl from "./nl.json";
9
+ import pl from "./pl.json";
10
+ import ru from "./ru.json";
11
+ import uk from "./uk.json";
12
+
13
+ export default {
14
+ ar,
15
+ de,
16
+ en,
17
+ es,
18
+ fr,
19
+ hr,
20
+ it,
21
+ nl,
22
+ pl,
23
+ ru,
24
+ uk,
25
+ };
@@ -0,0 +1,13 @@
1
+ {
2
+ "_A_COLOR_PICKER_ALPHA_": "العتامة",
3
+ "_A_COLOR_PICKER_CLEAR_": "مسح",
4
+ "_A_COLOR_PICKER_CONFIRM_": "موافق",
5
+ "_A_COLOR_PICKER_DIALOG_": "اختيار اللون",
6
+ "_A_COLOR_PICKER_EMPTY_": "لم يتم اختيار لون",
7
+ "_A_COLOR_PICKER_HUE_": "درجة اللون",
8
+ "_A_COLOR_PICKER_INPUT_": "قيمة اللون",
9
+ "_A_COLOR_PICKER_INVALID_": "قيمة لون غير صالحة. المسموح: #rrggbb و rgb() و hsl() و hsv().",
10
+ "_A_COLOR_PICKER_PREDEFINE_": "ألوان محددة مسبقًا",
11
+ "_A_COLOR_PICKER_SATURATION_": "التشبع والسطوع",
12
+ "_A_COLOR_PICKER_SATURATION_VALUE_{{saturation}}_{{brightness}}_": "التشبع {{saturation}} %، السطوع {{brightness}} %"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "_A_COLOR_PICKER_ALPHA_": "Deckkraft",
3
+ "_A_COLOR_PICKER_CLEAR_": "Leeren",
4
+ "_A_COLOR_PICKER_CONFIRM_": "OK",
5
+ "_A_COLOR_PICKER_DIALOG_": "Farbe wählen",
6
+ "_A_COLOR_PICKER_EMPTY_": "Keine Farbe ausgewählt",
7
+ "_A_COLOR_PICKER_HUE_": "Farbton",
8
+ "_A_COLOR_PICKER_INPUT_": "Farbwert",
9
+ "_A_COLOR_PICKER_INVALID_": "Ungültiger Farbwert. Erlaubt: #rrggbb, rgb(), hsl(), hsv().",
10
+ "_A_COLOR_PICKER_PREDEFINE_": "Vordefinierte Farben",
11
+ "_A_COLOR_PICKER_SATURATION_": "Sättigung und Helligkeit",
12
+ "_A_COLOR_PICKER_SATURATION_VALUE_{{saturation}}_{{brightness}}_": "Sättigung {{saturation}} %, Helligkeit {{brightness}} %"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "_A_COLOR_PICKER_ALPHA_": "Opacity",
3
+ "_A_COLOR_PICKER_CLEAR_": "Clear",
4
+ "_A_COLOR_PICKER_CONFIRM_": "OK",
5
+ "_A_COLOR_PICKER_DIALOG_": "Choose color",
6
+ "_A_COLOR_PICKER_EMPTY_": "No color selected",
7
+ "_A_COLOR_PICKER_HUE_": "Hue",
8
+ "_A_COLOR_PICKER_INPUT_": "Color value",
9
+ "_A_COLOR_PICKER_INVALID_": "Invalid color value. Allowed: #rrggbb, rgb(), hsl(), hsv().",
10
+ "_A_COLOR_PICKER_PREDEFINE_": "Predefined colors",
11
+ "_A_COLOR_PICKER_SATURATION_": "Saturation and brightness",
12
+ "_A_COLOR_PICKER_SATURATION_VALUE_{{saturation}}_{{brightness}}_": "Saturation {{saturation}} %, brightness {{brightness}} %"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "_A_COLOR_PICKER_ALPHA_": "Opacidad",
3
+ "_A_COLOR_PICKER_CLEAR_": "Borrar",
4
+ "_A_COLOR_PICKER_CONFIRM_": "Aceptar",
5
+ "_A_COLOR_PICKER_DIALOG_": "Elegir color",
6
+ "_A_COLOR_PICKER_EMPTY_": "Ningún color seleccionado",
7
+ "_A_COLOR_PICKER_HUE_": "Tono",
8
+ "_A_COLOR_PICKER_INPUT_": "Valor del color",
9
+ "_A_COLOR_PICKER_INVALID_": "Valor de color no válido. Permitido: #rrggbb, rgb(), hsl(), hsv().",
10
+ "_A_COLOR_PICKER_PREDEFINE_": "Colores predefinidos",
11
+ "_A_COLOR_PICKER_SATURATION_": "Saturación y brillo",
12
+ "_A_COLOR_PICKER_SATURATION_VALUE_{{saturation}}_{{brightness}}_": "Saturación {{saturation}} %, brillo {{brightness}} %"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "_A_COLOR_PICKER_ALPHA_": "Opacité",
3
+ "_A_COLOR_PICKER_CLEAR_": "Effacer",
4
+ "_A_COLOR_PICKER_CONFIRM_": "OK",
5
+ "_A_COLOR_PICKER_DIALOG_": "Choisir une couleur",
6
+ "_A_COLOR_PICKER_EMPTY_": "Aucune couleur sélectionnée",
7
+ "_A_COLOR_PICKER_HUE_": "Teinte",
8
+ "_A_COLOR_PICKER_INPUT_": "Valeur de couleur",
9
+ "_A_COLOR_PICKER_INVALID_": "Valeur de couleur invalide. Autorisé : #rrggbb, rgb(), hsl(), hsv().",
10
+ "_A_COLOR_PICKER_PREDEFINE_": "Couleurs prédéfinies",
11
+ "_A_COLOR_PICKER_SATURATION_": "Saturation et luminosité",
12
+ "_A_COLOR_PICKER_SATURATION_VALUE_{{saturation}}_{{brightness}}_": "Saturation {{saturation}} %, luminosité {{brightness}} %"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "_A_COLOR_PICKER_ALPHA_": "Neprozirnost",
3
+ "_A_COLOR_PICKER_CLEAR_": "Očisti",
4
+ "_A_COLOR_PICKER_CONFIRM_": "U redu",
5
+ "_A_COLOR_PICKER_DIALOG_": "Odaberi boju",
6
+ "_A_COLOR_PICKER_EMPTY_": "Nije odabrana boja",
7
+ "_A_COLOR_PICKER_HUE_": "Nijansa",
8
+ "_A_COLOR_PICKER_INPUT_": "Vrijednost boje",
9
+ "_A_COLOR_PICKER_INVALID_": "Nevaljana vrijednost boje. Dopušteno: #rrggbb, rgb(), hsl(), hsv().",
10
+ "_A_COLOR_PICKER_PREDEFINE_": "Unaprijed definirane boje",
11
+ "_A_COLOR_PICKER_SATURATION_": "Zasićenost i svjetlina",
12
+ "_A_COLOR_PICKER_SATURATION_VALUE_{{saturation}}_{{brightness}}_": "Zasićenost {{saturation}} %, svjetlina {{brightness}} %"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "_A_COLOR_PICKER_ALPHA_": "Opacità",
3
+ "_A_COLOR_PICKER_CLEAR_": "Cancella",
4
+ "_A_COLOR_PICKER_CONFIRM_": "OK",
5
+ "_A_COLOR_PICKER_DIALOG_": "Scegli colore",
6
+ "_A_COLOR_PICKER_EMPTY_": "Nessun colore selezionato",
7
+ "_A_COLOR_PICKER_HUE_": "Tonalità",
8
+ "_A_COLOR_PICKER_INPUT_": "Valore del colore",
9
+ "_A_COLOR_PICKER_INVALID_": "Valore del colore non valido. Consentito: #rrggbb, rgb(), hsl(), hsv().",
10
+ "_A_COLOR_PICKER_PREDEFINE_": "Colori predefiniti",
11
+ "_A_COLOR_PICKER_SATURATION_": "Saturazione e luminosità",
12
+ "_A_COLOR_PICKER_SATURATION_VALUE_{{saturation}}_{{brightness}}_": "Saturazione {{saturation}} %, luminosità {{brightness}} %"
13
+ }