aloha-vue 2.85.0 → 2.87.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 (245) hide show
  1. package/CHANGELOG.md +1215 -1200
  2. package/README.md +117 -117
  3. package/dist/aloha-vue.css +13827 -13601
  4. package/dist/aloha-vue.css.map +1 -1
  5. package/dist/aloha-vue.es.js +60235 -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 +243 -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 +743 -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 +204 -0
  147. package/src/ui/AColorPicker/__tests__/colorUtils.test.js +104 -0
  148. package/src/ui/AColorPicker/compositionAPI/ColorStateAPI.js +133 -0
  149. package/src/ui/AColorPicker/compositionAPI/ConfirmAPI.js +36 -0
  150. package/src/ui/AColorPicker/compositionAPI/FormatAPI.js +59 -0
  151. package/src/ui/AColorPicker/compositionAPI/InputAPI.js +63 -0
  152. package/src/ui/AColorPicker/compositionAPI/KeyboardStepAPI.js +42 -0
  153. package/src/ui/AColorPicker/compositionAPI/PointerDragAPI.js +70 -0
  154. package/src/ui/AColorPicker/compositionAPI/PopoverAPI.js +196 -0
  155. package/src/ui/AColorPicker/compositionAPI/PredefineAPI.js +42 -0
  156. package/src/ui/AColorPicker/compositionAPI/ToggleClassAPI.js +24 -0
  157. package/src/ui/AColorPicker/i18n/AColorPickerI18n.js +25 -0
  158. package/src/ui/AColorPicker/i18n/ar.json +14 -0
  159. package/src/ui/AColorPicker/i18n/de.json +14 -0
  160. package/src/ui/AColorPicker/i18n/en.json +14 -0
  161. package/src/ui/AColorPicker/i18n/es.json +14 -0
  162. package/src/ui/AColorPicker/i18n/fr.json +14 -0
  163. package/src/ui/AColorPicker/i18n/hr.json +14 -0
  164. package/src/ui/AColorPicker/i18n/it.json +14 -0
  165. package/src/ui/AColorPicker/i18n/nl.json +14 -0
  166. package/src/ui/AColorPicker/i18n/pl.json +14 -0
  167. package/src/ui/AColorPicker/i18n/ru.json +14 -0
  168. package/src/ui/AColorPicker/i18n/uk.json +14 -0
  169. package/src/ui/AColorPicker/utils/colorUtils.js +296 -0
  170. package/src/ui/ADatepicker/ADatepickerCalendarPanel/ADatepickerCalendarPanel.js +68 -68
  171. package/src/ui/ADatepicker/i18n/ADatepickerI18n.js +4 -0
  172. package/src/ui/ADatepicker/i18n/nl.json +58 -0
  173. package/src/ui/ADatepicker/i18n/pl.json +58 -0
  174. package/src/ui/ADatepicker/panel/APanelTime/APanelTime.js +147 -147
  175. package/src/ui/ADatepicker/panel/APanelYear/APanelYear.js +123 -123
  176. package/src/ui/ADatepickerAlt/ADatepickerCalendarPanel/ADatepickerCalendarPanel.js +804 -804
  177. package/src/ui/ADatepickerAlt/panel/APanelDate/APanelDate.js +353 -353
  178. package/src/ui/ADatepickerAlt/panel/APanelMonth/APanelMonth.js +187 -187
  179. package/src/ui/ADatepickerAlt/panel/APanelTime/APanelTime.js +303 -303
  180. package/src/ui/ADatepickerAlt/panel/APanelYear/APanelYear.js +162 -162
  181. package/src/ui/ADatepickerRange/i18n/ADatepickerRangeI18n.js +4 -0
  182. package/src/ui/ADatepickerRange/i18n/nl.json +4 -0
  183. package/src/ui/ADatepickerRange/i18n/pl.json +4 -0
  184. package/src/ui/AErrors/i18n/AErrorsI18n.js +4 -0
  185. package/src/ui/AErrors/i18n/nl.json +3 -0
  186. package/src/ui/AErrors/i18n/pl.json +3 -0
  187. package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +1 -0
  188. package/src/ui/AFieldset/i18n/AFieldsetI18n.js +4 -0
  189. package/src/ui/AFieldset/i18n/nl.json +4 -0
  190. package/src/ui/AFieldset/i18n/pl.json +4 -0
  191. package/src/ui/AFormElementBtnClear/i18n/AFormElementBtnClearI18n.js +4 -0
  192. package/src/ui/AFormElementBtnClear/i18n/nl.json +3 -0
  193. package/src/ui/AFormElementBtnClear/i18n/pl.json +3 -0
  194. package/src/ui/AInput/i18n/AInputI18n.js +4 -0
  195. package/src/ui/AInput/i18n/nl.json +4 -0
  196. package/src/ui/AInput/i18n/pl.json +4 -0
  197. package/src/ui/AInputCurrency/i18n/AInputCurrencyI18n.js +4 -0
  198. package/src/ui/AInputCurrency/i18n/nl.json +4 -0
  199. package/src/ui/AInputCurrency/i18n/pl.json +4 -0
  200. package/src/ui/AInputNumber/i18n/AInputNumberI18n.js +4 -0
  201. package/src/ui/AInputNumber/i18n/nl.json +4 -0
  202. package/src/ui/AInputNumber/i18n/pl.json +4 -0
  203. package/src/ui/AInputNumberRange/i18n/AInputNumberRangeI18n.js +4 -0
  204. package/src/ui/AInputNumberRange/i18n/nl.json +4 -0
  205. package/src/ui/AInputNumberRange/i18n/pl.json +4 -0
  206. package/src/ui/AJson/i18n/AJsonI18n.js +4 -0
  207. package/src/ui/AJson/i18n/nl.json +8 -0
  208. package/src/ui/AJson/i18n/pl.json +8 -0
  209. package/src/ui/AMultiselectOrdered/i18n/AMultiselectOrderedI18n.js +4 -0
  210. package/src/ui/AMultiselectOrdered/i18n/nl.json +12 -0
  211. package/src/ui/AMultiselectOrdered/i18n/pl.json +12 -0
  212. package/src/ui/ARadio/i18n/ARadioI18n.js +4 -0
  213. package/src/ui/ARadio/i18n/nl.json +5 -0
  214. package/src/ui/ARadio/i18n/pl.json +5 -0
  215. package/src/ui/ARequired/i18n/ARequiredI18n.js +4 -0
  216. package/src/ui/ARequired/i18n/nl.json +3 -0
  217. package/src/ui/ARequired/i18n/pl.json +3 -0
  218. package/src/ui/ARouterLinkConfig/i18n/ARouterLinkConfigI18n.js +4 -0
  219. package/src/ui/ARouterLinkConfig/i18n/nl.json +14 -0
  220. package/src/ui/ARouterLinkConfig/i18n/pl.json +14 -0
  221. package/src/ui/ASelect/i18n/ASelectI18n.js +4 -0
  222. package/src/ui/ASelect/i18n/ar.json +5 -5
  223. package/src/ui/ASelect/i18n/de.json +4 -4
  224. package/src/ui/ASelect/i18n/en.json +5 -5
  225. package/src/ui/ASelect/i18n/es.json +5 -5
  226. package/src/ui/ASelect/i18n/fr.json +5 -5
  227. package/src/ui/ASelect/i18n/hr.json +5 -5
  228. package/src/ui/ASelect/i18n/it.json +5 -5
  229. package/src/ui/ASelect/i18n/nl.json +11 -0
  230. package/src/ui/ASelect/i18n/pl.json +11 -0
  231. package/src/ui/ASelect/i18n/ru.json +5 -5
  232. package/src/ui/ASelectStyle/i18n/ASelectStyleI18n.js +4 -0
  233. package/src/ui/ASelectStyle/i18n/nl.json +292 -0
  234. package/src/ui/ASelectStyle/i18n/pl.json +292 -0
  235. package/src/ui/ASlider/i18n/ASliderI18n.js +4 -0
  236. package/src/ui/ASlider/i18n/nl.json +5 -0
  237. package/src/ui/ASlider/i18n/pl.json +5 -0
  238. package/src/ui/ASwitch/i18n/ASwitchI18n.js +4 -0
  239. package/src/ui/ASwitch/i18n/nl.json +5 -0
  240. package/src/ui/ASwitch/i18n/pl.json +5 -0
  241. package/src/ui/AUiComponents.js +2 -0
  242. package/src/ui/AValidatedJson/i18n/AValidatedJsonI18n.js +4 -0
  243. package/src/ui/AValidatedJson/i18n/nl.json +25 -0
  244. package/src/ui/AValidatedJson/i18n/pl.json +25 -0
  245. package/src/ui/compositionApi/__tests__/UiStyleHideAPI.test.js +9 -4
@@ -0,0 +1,743 @@
1
+ import {
2
+ computed,
3
+ h,
4
+ Teleport,
5
+ } from "vue";
6
+ import {
7
+ AButton,
8
+ AErrorsText,
9
+ AFormElementBtnClear,
10
+ AFormHelpText,
11
+ AFormLabelDescription,
12
+ AFormReadonly,
13
+ AIcon,
14
+ AInput,
15
+ ALabel,
16
+ ATranslation,
17
+ UiAPI,
18
+ UiClearButtonAPI,
19
+ UiDisabledAPI,
20
+ UIExcludeRenderAttributesAPI,
21
+ UiStyleHideAPI,
22
+ } from "../../index";
23
+
24
+ import AColorPickerSaturation from "./AColorPickerSaturation/AColorPickerSaturation";
25
+ import AColorPickerSlider from "./AColorPickerSlider/AColorPickerSlider";
26
+
27
+ import ColorStateAPI from "./compositionAPI/ColorStateAPI";
28
+ import ConfirmAPI from "./compositionAPI/ConfirmAPI";
29
+ import FormatAPI from "./compositionAPI/FormatAPI";
30
+ import InputAPI from "./compositionAPI/InputAPI";
31
+ import PopoverAPI from "./compositionAPI/PopoverAPI";
32
+ import PredefineAPI from "./compositionAPI/PredefineAPI";
33
+ import ToggleClassAPI from "./compositionAPI/ToggleClassAPI";
34
+
35
+ import placements from "../../const/placements";
36
+ import {
37
+ COLOR_FORMATS,
38
+ } from "./utils/colorUtils";
39
+ import {
40
+ isArray,
41
+ uniqueId,
42
+ } from "lodash-es";
43
+
44
+ const HUE_BACKGROUND = "linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)";
45
+
46
+ export default {
47
+ name: "AColorPicker",
48
+ inheritAttrs: false,
49
+ props: {
50
+ alwaysTranslate: {
51
+ type: Boolean,
52
+ required: false,
53
+ },
54
+ change: {
55
+ type: Function,
56
+ required: false,
57
+ default: () => {},
58
+ },
59
+ clearButtonClass: {
60
+ type: [String, Object],
61
+ required: false,
62
+ default: undefined,
63
+ },
64
+ colorFormats: {
65
+ type: [String, Array],
66
+ required: false,
67
+ default: "hex",
68
+ validator: value => (isArray(value) ? value : [value]).every(format => COLOR_FORMATS.indexOf(format) !== -1),
69
+ },
70
+ dependencies: {
71
+ type: [Array, Object],
72
+ required: false,
73
+ default: undefined,
74
+ },
75
+ disabled: {
76
+ type: Boolean,
77
+ required: false,
78
+ },
79
+ errorIcon: {
80
+ type: [String, Object],
81
+ required: false,
82
+ default: undefined,
83
+ },
84
+ errors: {
85
+ type: [String, Array],
86
+ required: false,
87
+ default: undefined,
88
+ },
89
+ errorsClass: {
90
+ type: [String, Object],
91
+ required: false,
92
+ default: undefined,
93
+ },
94
+ excludeRenderAttributes: {
95
+ type: Array,
96
+ required: false,
97
+ default: () => [],
98
+ },
99
+ extra: {
100
+ type: Object,
101
+ required: false,
102
+ default: undefined,
103
+ },
104
+ helpText: {
105
+ type: String,
106
+ required: false,
107
+ default: undefined,
108
+ },
109
+ htmlId: {
110
+ type: String,
111
+ required: false,
112
+ default: undefined,
113
+ },
114
+ id: {
115
+ type: [String, Number],
116
+ required: false,
117
+ default: () => uniqueId("a_color_picker_"),
118
+ },
119
+ idPrefix: {
120
+ type: String,
121
+ required: false,
122
+ default: undefined,
123
+ },
124
+ isClearButton: {
125
+ type: Boolean,
126
+ required: false,
127
+ default: true,
128
+ },
129
+ isHide: {
130
+ type: Boolean,
131
+ required: false,
132
+ },
133
+ isLabelFloat: {
134
+ type: Boolean,
135
+ required: false,
136
+ default: true,
137
+ },
138
+ isRender: {
139
+ type: Boolean,
140
+ required: false,
141
+ default: true,
142
+ },
143
+ label: {
144
+ type: [String, Number],
145
+ required: false,
146
+ default: undefined,
147
+ },
148
+ labelClass: {
149
+ type: [String, Object],
150
+ required: false,
151
+ default: undefined,
152
+ },
153
+ labelDescription: {
154
+ type: String,
155
+ required: false,
156
+ default: undefined,
157
+ },
158
+ labelScreenReader: {
159
+ type: [String, Number],
160
+ required: false,
161
+ default: undefined,
162
+ },
163
+ modelDependencies: {
164
+ type: Object,
165
+ required: false,
166
+ default: () => ({}),
167
+ },
168
+ modelUndefined: {
169
+ type: [String, Number, Object, Array, Boolean],
170
+ required: false,
171
+ default: "",
172
+ },
173
+ modelValue: {
174
+ type: String,
175
+ required: false,
176
+ default: undefined,
177
+ },
178
+ panelDefaultColor: {
179
+ type: String,
180
+ required: false,
181
+ default: "#ff0000",
182
+ },
183
+ placement: {
184
+ type: String,
185
+ required: false,
186
+ default: "bottom-start",
187
+ validator: value => placements.indexOf(value) !== -1,
188
+ },
189
+ predefine: {
190
+ type: Array,
191
+ required: false,
192
+ default: () => [],
193
+ },
194
+ readonly: {
195
+ type: Boolean,
196
+ required: false,
197
+ },
198
+ readonlyDefault: {
199
+ type: String,
200
+ required: false,
201
+ default: "",
202
+ },
203
+ readonlyValueParentClass: {
204
+ type: [String, Object, Array],
205
+ required: false,
206
+ default: undefined,
207
+ },
208
+ required: {
209
+ type: Boolean,
210
+ required: false,
211
+ default: false,
212
+ },
213
+ showAlpha: {
214
+ type: Boolean,
215
+ required: false,
216
+ },
217
+ type: {
218
+ type: String,
219
+ required: false,
220
+ default: "colorPicker",
221
+ },
222
+ },
223
+ emits: [
224
+ "blur",
225
+ "close",
226
+ "focus",
227
+ "open",
228
+ "update:modelValue",
229
+ ],
230
+ setup(props, context) {
231
+ const {
232
+ disabledAttribut,
233
+ } = UiDisabledAPI(props);
234
+
235
+ const {
236
+ attributesToExcludeFromRender,
237
+ } = UIExcludeRenderAttributesAPI(props);
238
+
239
+ const {
240
+ componentStyleHide,
241
+ } = UiStyleHideAPI(props);
242
+
243
+ const {
244
+ currentFormat,
245
+ isFormatSwitch,
246
+ nextFormat,
247
+ setFormatFromModel,
248
+ switchFormat,
249
+ } = FormatAPI(props);
250
+
251
+ const {
252
+ alphaBackground,
253
+ alphaPercent,
254
+ cssColorLocal,
255
+ cssColorOpaqueLocal,
256
+ hsva,
257
+ hueCssColor,
258
+ modelCssColor,
259
+ modelTextColor,
260
+ rgbaLocal,
261
+ setAlphaPercent,
262
+ setColor,
263
+ setColorFromModel,
264
+ setHue,
265
+ setSaturationBrightness,
266
+ valueLocal,
267
+ } = ColorStateAPI(props, {
268
+ currentFormat,
269
+ });
270
+
271
+ const {
272
+ ariaDescribedbyLocal,
273
+ changeModel,
274
+ errorsId,
275
+ helpTextId,
276
+ htmlIdLocal,
277
+ isErrors,
278
+ isModel,
279
+ labelDescriptionId,
280
+ onBlur,
281
+ onFocus,
282
+ } = UiAPI(props, context);
283
+
284
+ const {
285
+ closePopover,
286
+ isOpen,
287
+ isPositioned,
288
+ onPopupKeydown,
289
+ onToggleKeydown,
290
+ popupId,
291
+ popupRef,
292
+ toggleRef,
293
+ togglePopover,
294
+ } = PopoverAPI(props, context, {
295
+ htmlIdLocal,
296
+ setColorFromModel: () => {
297
+ setFormatFromModel();
298
+ setColorFromModel();
299
+ },
300
+ });
301
+
302
+ const {
303
+ applyInput,
304
+ inputErrors,
305
+ inputText,
306
+ onInputChange,
307
+ onInputKeydown,
308
+ } = InputAPI({
309
+ setColor,
310
+ valueLocal,
311
+ });
312
+
313
+ const {
314
+ clearColor,
315
+ confirmColor,
316
+ } = ConfirmAPI(props, {
317
+ applyInput,
318
+ changeModel,
319
+ closePopover,
320
+ valueLocal,
321
+ });
322
+
323
+ const {
324
+ predefineLocal,
325
+ selectPredefine,
326
+ } = PredefineAPI(props, {
327
+ rgbaLocal,
328
+ setColor,
329
+ });
330
+
331
+ const {
332
+ isClearButtonLocal,
333
+ } = UiClearButtonAPI(props, {
334
+ isModel,
335
+ });
336
+
337
+ const {
338
+ hasErrorIcon,
339
+ toggleClassBtns,
340
+ } = ToggleClassAPI(props, {
341
+ isClearButtonLocal,
342
+ isErrors,
343
+ });
344
+
345
+ const labelId = computed(() => `${ htmlIdLocal.value }_label`);
346
+ const valueId = computed(() => `${ htmlIdLocal.value }_value`);
347
+
348
+ const clearModelFromToggle = () => {
349
+ changeModel({
350
+ model: props.modelUndefined,
351
+ triggerDetails: "clear",
352
+ });
353
+ toggleRef.value?.focus();
354
+ };
355
+
356
+ return {
357
+ alphaBackground,
358
+ alphaPercent,
359
+ applyInput,
360
+ ariaDescribedbyLocal,
361
+ attributesToExcludeFromRender,
362
+ clearColor,
363
+ clearModelFromToggle,
364
+ componentStyleHide,
365
+ confirmColor,
366
+ cssColorLocal,
367
+ cssColorOpaqueLocal,
368
+ currentFormat,
369
+ disabledAttribut,
370
+ errorsId,
371
+ hasErrorIcon,
372
+ helpTextId,
373
+ hsva,
374
+ htmlIdLocal,
375
+ hueCssColor,
376
+ inputErrors,
377
+ inputText,
378
+ isClearButtonLocal,
379
+ isErrors,
380
+ isFormatSwitch,
381
+ isModel,
382
+ isOpen,
383
+ isPositioned,
384
+ labelDescriptionId,
385
+ labelId,
386
+ modelCssColor,
387
+ modelTextColor,
388
+ nextFormat,
389
+ onBlur,
390
+ onFocus,
391
+ onInputChange,
392
+ onInputKeydown,
393
+ onPopupKeydown,
394
+ onToggleKeydown,
395
+ popupId,
396
+ popupRef,
397
+ predefineLocal,
398
+ selectPredefine,
399
+ setAlphaPercent,
400
+ setHue,
401
+ setSaturationBrightness,
402
+ switchFormat,
403
+ toggleClassBtns,
404
+ togglePopover,
405
+ toggleRef,
406
+ valueId,
407
+ valueLocal,
408
+ };
409
+ },
410
+ render() {
411
+ if (!this.isRender) {
412
+ return null;
413
+ }
414
+
415
+ if (this.readonly) {
416
+ return h(AFormReadonly, {
417
+ ...this.$attrs,
418
+ valueParentClass: this.readonlyValueParentClass,
419
+ id: this.htmlIdLocal,
420
+ alwaysTranslate: this.alwaysTranslate,
421
+ excludeRenderAttributes: this.excludeRenderAttributes,
422
+ extra: this.extra,
423
+ helpText: this.helpText,
424
+ label: this.label,
425
+ labelClass: this.labelClass,
426
+ labelScreenReader: this.labelScreenReader,
427
+ modelValue: undefined,
428
+ readonlyDefault: this.readonlyDefault,
429
+ required: this.required,
430
+ style: this.componentStyleHide,
431
+ type: this.type,
432
+ }, this.isModel ?
433
+ () => [
434
+ h("span", {
435
+ class: "a_color_picker__readonly",
436
+ }, [
437
+ h("span", {
438
+ class: "a_color_picker__swatch",
439
+ style: {
440
+ "--a_color_picker_color": this.modelCssColor,
441
+ },
442
+ ariaHidden: true,
443
+ }),
444
+ h("span", {}, this.modelValue),
445
+ ]),
446
+ ] :
447
+ "");
448
+ }
449
+
450
+ const hasLabel = !!(this.label || this.labelScreenReader);
451
+
452
+ return h("div", {
453
+ ...this.$attrs,
454
+ style: this.componentStyleHide,
455
+ ...this.attributesToExcludeFromRender,
456
+ }, [
457
+ h("div", {
458
+ class: ["a_form_element__parent a_color_picker", {
459
+ a_form_element__parent_float: this.isLabelFloat,
460
+ a_form_element__parent_float_has_error_icon: this.hasErrorIcon,
461
+ a_form_element__parent_not_empty: this.isModel,
462
+ a_color_picker_has_color: this.isModel,
463
+ }],
464
+ style: this.isModel ?
465
+ {
466
+ "--a_color_picker_color": this.modelCssColor,
467
+ "--a_color_picker_text_color": this.modelTextColor,
468
+ } :
469
+ undefined,
470
+ }, [
471
+ hasLabel ?
472
+ h(ALabel, {
473
+ id: this.htmlIdLocal,
474
+ alwaysTranslate: this.alwaysTranslate,
475
+ extra: this.extra,
476
+ isError: this.isErrors,
477
+ isLabelFloat: this.isLabelFloat,
478
+ label: this.label,
479
+ labelClass: this.labelClass,
480
+ labelScreenReader: this.labelScreenReader,
481
+ required: this.required,
482
+ type: this.type,
483
+ }) :
484
+ "",
485
+ h(AFormLabelDescription, {
486
+ id: this.labelDescriptionId,
487
+ alwaysTranslate: this.alwaysTranslate,
488
+ html: this.labelDescription,
489
+ extra: this.extra,
490
+ isLabelFloat: this.isLabelFloat,
491
+ }),
492
+ h("div", {
493
+ class: "a_form_element",
494
+ }, [
495
+ this.hasErrorIcon ?
496
+ h(AIcon, {
497
+ icon: this.errorIcon,
498
+ class: "a_input__icon_error",
499
+ }) :
500
+ "",
501
+ h("button", {
502
+ ref: "toggleRef",
503
+ id: this.htmlIdLocal,
504
+ type: "button",
505
+ class: [
506
+ "a_form_control a_color_picker__toggle",
507
+ this.toggleClassBtns,
508
+ {
509
+ a_form_control_invalid: this.isErrors,
510
+ a_color_picker__toggle_empty: !this.isModel,
511
+ a_color_picker__toggle_open: this.isOpen,
512
+ },
513
+ ],
514
+ disabled: this.disabledAttribut,
515
+ "aria-haspopup": "dialog",
516
+ "aria-expanded": this.isOpen ? "true" : "false",
517
+ "aria-controls": this.isOpen ? this.popupId : undefined,
518
+ "aria-labelledby": hasLabel ? `${ this.labelId } ${ this.valueId }` : undefined,
519
+ "aria-describedby": this.ariaDescribedbyLocal,
520
+ "aria-invalid": this.isErrors ? "true" : undefined,
521
+ onClick: this.togglePopover,
522
+ onKeydown: this.onToggleKeydown,
523
+ onFocus: this.onFocus,
524
+ onBlur: this.onBlur,
525
+ }, [
526
+ this.isModel ?
527
+ h("span", {
528
+ id: this.valueId,
529
+ class: "a_color_picker__toggle__value",
530
+ }, this.modelValue) :
531
+ h(ATranslation, {
532
+ id: this.valueId,
533
+ alwaysTranslate: this.alwaysTranslate,
534
+ class: [
535
+ "a_color_picker__toggle__empty",
536
+ {
537
+ a_sr_only: this.isLabelFloat && hasLabel,
538
+ },
539
+ ],
540
+ tag: "span",
541
+ text: "_A_COLOR_PICKER_EMPTY_",
542
+ }),
543
+ ]),
544
+ this.isClearButtonLocal ?
545
+ h("div", {
546
+ class: "a_form_control__actions",
547
+ }, [
548
+ h(AFormElementBtnClear, {
549
+ alwaysTranslate: this.alwaysTranslate,
550
+ disabled: this.disabled,
551
+ class: this.clearButtonClass,
552
+ onClear: this.clearModelFromToggle,
553
+ }),
554
+ ]) :
555
+ "",
556
+ ]),
557
+ h(AFormHelpText, {
558
+ id: this.helpTextId,
559
+ alwaysTranslate: this.alwaysTranslate,
560
+ html: this.helpText,
561
+ extra: this.extra,
562
+ }),
563
+ this.isErrors && h(AErrorsText, {
564
+ id: this.errorsId,
565
+ alwaysTranslate: this.alwaysTranslate,
566
+ errors: this.errors,
567
+ errorsClass: this.errorsClass,
568
+ }),
569
+ ]),
570
+ h(Teleport, {
571
+ to: "body",
572
+ }, [
573
+ this.isOpen ?
574
+ h("div", {
575
+ ref: "popupRef",
576
+ id: this.popupId,
577
+ class: [
578
+ "a_color_picker__popup",
579
+ {
580
+ a_color_picker__popup_positioning: !this.isPositioned,
581
+ },
582
+ ],
583
+ role: "dialog",
584
+ "aria-modal": "true",
585
+ "aria-labelledby": hasLabel ? this.labelId : undefined,
586
+ onKeydown: this.onPopupKeydown,
587
+ }, [
588
+ hasLabel ?
589
+ "" :
590
+ h(ATranslation, {
591
+ alwaysTranslate: this.alwaysTranslate,
592
+ class: "a_sr_only",
593
+ tag: "h2",
594
+ text: "_A_COLOR_PICKER_DIALOG_",
595
+ }),
596
+ h(AColorPickerSaturation, {
597
+ id: `${ this.htmlIdLocal }_saturation`,
598
+ alwaysTranslate: this.alwaysTranslate,
599
+ brightness: this.hsva.v,
600
+ hue: this.hsva.h,
601
+ saturation: this.hsva.s,
602
+ thumbColor: this.cssColorOpaqueLocal,
603
+ onChange: this.setSaturationBrightness,
604
+ }),
605
+ h("div", {
606
+ class: "a_color_picker__controls",
607
+ }, [
608
+ h("div", {
609
+ class: "a_color_picker__sliders",
610
+ }, [
611
+ h(AColorPickerSlider, {
612
+ id: `${ this.htmlIdLocal }_hue`,
613
+ alwaysTranslate: this.alwaysTranslate,
614
+ background: HUE_BACKGROUND,
615
+ class: "a_color_picker_slider_hue",
616
+ label: "_A_COLOR_PICKER_HUE_",
617
+ largeStep: 15,
618
+ max: 360,
619
+ modelValue: this.hsva.h,
620
+ thumbColor: this.hueCssColor,
621
+ valueText: `${ this.hsva.h }°`,
622
+ "onUpdate:modelValue": this.setHue,
623
+ }),
624
+ this.showAlpha ?
625
+ h(AColorPickerSlider, {
626
+ id: `${ this.htmlIdLocal }_alpha`,
627
+ alwaysTranslate: this.alwaysTranslate,
628
+ background: this.alphaBackground,
629
+ class: "a_color_picker_slider_alpha",
630
+ label: "_A_COLOR_PICKER_ALPHA_",
631
+ max: 100,
632
+ modelValue: this.alphaPercent,
633
+ thumbColor: this.cssColorLocal,
634
+ valueText: `${ this.alphaPercent } %`,
635
+ "onUpdate:modelValue": this.setAlphaPercent,
636
+ }) :
637
+ "",
638
+ ]),
639
+ h("span", {
640
+ class: "a_color_picker__swatch a_color_picker__preview",
641
+ style: {
642
+ "--a_color_picker_color": this.cssColorLocal,
643
+ },
644
+ ariaHidden: true,
645
+ }),
646
+ ]),
647
+ h("div", {
648
+ class: "a_color_picker__value",
649
+ }, [
650
+ h(AInput, {
651
+ id: `${ this.htmlIdLocal }_input`,
652
+ alwaysTranslate: this.alwaysTranslate,
653
+ class: "a_color_picker__input",
654
+ errors: this.inputErrors,
655
+ inputAttributes: {
656
+ autocomplete: "off",
657
+ spellcheck: "false",
658
+ onKeydown: this.onInputKeydown,
659
+ },
660
+ extra: {
661
+ format: this.currentFormat.toUpperCase(),
662
+ },
663
+ isClearButton: false,
664
+ label: "_A_COLOR_PICKER_INPUT_{{format}}_",
665
+ modelValue: this.inputText,
666
+ change: this.onInputChange,
667
+ onBlur: this.applyInput,
668
+ }),
669
+ this.isFormatSwitch ?
670
+ h(AButton, {
671
+ alwaysTranslate: this.alwaysTranslate,
672
+ ariaLabel: "_A_COLOR_PICKER_FORMAT_SWITCH_{{format}}_{{next}}_",
673
+ extra: {
674
+ format: this.currentFormat.toUpperCase(),
675
+ next: this.nextFormat.toUpperCase(),
676
+ },
677
+ class: "a_btn a_btn_outline_secondary a_btn_small a_color_picker__format",
678
+ text: this.currentFormat.toUpperCase(),
679
+ title: "_A_COLOR_PICKER_FORMAT_SWITCH_{{format}}_{{next}}_",
680
+ type: "button",
681
+ onClick: this.switchFormat,
682
+ }) :
683
+ "",
684
+ ]),
685
+ this.predefineLocal.length ?
686
+ h("div", {
687
+ class: "a_color_picker__predefine",
688
+ role: "group",
689
+ "aria-label": undefined,
690
+ "aria-labelledby": `${ this.htmlIdLocal }_predefine_label`,
691
+ }, [
692
+ h(ATranslation, {
693
+ id: `${ this.htmlIdLocal }_predefine_label`,
694
+ alwaysTranslate: this.alwaysTranslate,
695
+ class: "a_sr_only",
696
+ tag: "span",
697
+ text: "_A_COLOR_PICKER_PREDEFINE_",
698
+ }),
699
+ this.predefineLocal.map(item => {
700
+ return h("button", {
701
+ key: item.value,
702
+ type: "button",
703
+ class: [
704
+ "a_color_picker__predefine__item",
705
+ {
706
+ a_color_picker__predefine__item_selected: item.isSelected,
707
+ },
708
+ ],
709
+ style: {
710
+ "--a_color_picker_color": item.cssColor,
711
+ },
712
+ title: item.value,
713
+ "aria-label": item.value,
714
+ "aria-pressed": item.isSelected ? "true" : "false",
715
+ onClick: () => this.selectPredefine(item),
716
+ });
717
+ }),
718
+ ]) :
719
+ "",
720
+ h("div", {
721
+ class: "a_color_picker__footer",
722
+ }, [
723
+ h(AButton, {
724
+ alwaysTranslate: this.alwaysTranslate,
725
+ class: "a_btn a_btn_link a_btn_small",
726
+ text: "_A_COLOR_PICKER_CLEAR_",
727
+ type: "button",
728
+ onClick: this.clearColor,
729
+ }),
730
+ h(AButton, {
731
+ alwaysTranslate: this.alwaysTranslate,
732
+ class: "a_btn a_btn_primary a_btn_small",
733
+ text: "_A_COLOR_PICKER_CONFIRM_",
734
+ type: "button",
735
+ onClick: this.confirmColor,
736
+ }),
737
+ ]),
738
+ ]) :
739
+ "",
740
+ ]),
741
+ ]);
742
+ },
743
+ };