@teammodlr/ui-kit 2.1.70 → 2.1.71

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teammodlr/ui-kit",
3
- "version": "2.1.70",
3
+ "version": "2.1.71",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs.js",
6
6
  "module": "lib/index.es.js",
@@ -198,7 +198,7 @@ export default defineComponent({
198
198
 
199
199
  const finalColor = computed(() => {
200
200
  if (hexInput.value === "inherit") {
201
- return { r: 0, g: 0, b: 0, a: 1 };
201
+ return { r: 0, g: 0, b: 0, a: 0 };
202
202
  }
203
203
  return HSVToRGBA(hueSlider.value * 3.6, brightness.value, saturation.value, opacitySlider.value / 100);
204
204
  });
@@ -212,11 +212,9 @@ export default defineComponent({
212
212
  };
213
213
 
214
214
  const setInputs = () => {
215
- if (hexInput.value === "inherit") {
216
- return;
215
+ if (hexInput.value !== 'inherit') {
216
+ hexInput.value = RGBAToHex(finalColor.value.r, finalColor.value.g, finalColor.value.b, finalColor.value.a);
217
217
  }
218
-
219
- hexInput.value = RGBAToHex(finalColor.value.r, finalColor.value.g, finalColor.value.b, finalColor.value.a);
220
218
  rInput.value = finalColor.value.r.toString();
221
219
  gInput.value = finalColor.value.g.toString();
222
220
  bInput.value = finalColor.value.b.toString();
@@ -240,10 +238,17 @@ export default defineComponent({
240
238
  }
241
239
 
242
240
  const updateFromHex = () => {
243
- if (hexInput.value === "inherit") {
241
+ if (hexInput.value === 'inherit') {
242
+ if (modelModifiers.lazy) {
243
+ emitModelValue();
244
+ }
244
245
  return;
245
246
  }
246
247
  const color = hexToRGB(hexInput.value);
248
+ if (color.a === 0) {
249
+ color.a = 1;
250
+ opacitySlider.value = 100;
251
+ }
247
252
  updateFromHSV(RGBToHSV(color.r, color.g, color.b), color.a);
248
253
  if (modelModifiers.lazy) {
249
254
  emitModelValue();
@@ -281,7 +286,11 @@ export default defineComponent({
281
286
  }
282
287
 
283
288
  updateFromHSV(RGBToHSV(red, green, blue), alpha);
284
- if (modelModifiers.lazy) {
289
+
290
+ if (hexInput.value === 'inherit') {
291
+ hexInput.value = RGBAToHex(red, green, blue, alpha);
292
+ emitModelValue();
293
+ } else if (modelModifiers.lazy) {
285
294
  emitModelValue();
286
295
  }
287
296
  };
@@ -321,6 +330,10 @@ export default defineComponent({
321
330
  };
322
331
 
323
332
  const handleMouseDown = () => {
333
+ if (hexInput.value === 'inherit') {
334
+ hexInput.value = RGBAToHex(finalColor.value.r, finalColor.value.g, finalColor.value.b, finalColor.value.a);
335
+ emitModelValue();
336
+ }
324
337
  dragging.value = true;
325
338
  setThumbPosition();
326
339
  };
@@ -338,7 +351,7 @@ export default defineComponent({
338
351
  watch(() => eyeDropColor.value, () => {
339
352
  if (eyeDropColor.value) {
340
353
  hexInput.value = eyeDropColor.value;
341
- emit('update:modelValue', eyeDropColor.value);
354
+ emitModelValue();
342
355
  updateFromHex();
343
356
  }
344
357
  });