@umbraco-ui/uui-color-picker 1.6.0-rc.0 → 1.6.0-rc.2
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/lib/index.js +10 -30
- package/lib/uui-color-picker.element.d.ts +4 -6
- package/package.json +4 -3
package/lib/index.js
CHANGED
|
@@ -97,11 +97,11 @@ let UUIColorPickerElement = class extends LabelMixin("label", LitElement) {
|
|
|
97
97
|
demandCustomElement(this, "uui-input");
|
|
98
98
|
demandCustomElement(this, "uui-button");
|
|
99
99
|
demandCustomElement(this, "uui-button-group");
|
|
100
|
-
demandCustomElement(this, "uui-popover");
|
|
101
100
|
demandCustomElement(this, "uui-color-swatches");
|
|
102
101
|
demandCustomElement(this, "uui-color-swatch");
|
|
103
102
|
demandCustomElement(this, "uui-color-area");
|
|
104
103
|
demandCustomElement(this, "uui-color-slider");
|
|
104
|
+
demandCustomElement(this, "uui-popover-container");
|
|
105
105
|
}
|
|
106
106
|
/** Returns the current value as a string in the specified format. */
|
|
107
107
|
getFormattedValue(format) {
|
|
@@ -232,20 +232,6 @@ let UUIColorPickerElement = class extends LabelMixin("label", LitElement) {
|
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
openColorPicker(event) {
|
|
236
|
-
event.stopImmediatePropagation();
|
|
237
|
-
const target = event.target;
|
|
238
|
-
const popover = target.parentElement;
|
|
239
|
-
popover.open = !(popover == null ? void 0 : popover.open);
|
|
240
|
-
target.setAttribute("aria-expanded", popover.open.toString());
|
|
241
|
-
}
|
|
242
|
-
closeColorPicker(event) {
|
|
243
|
-
const target = event.target;
|
|
244
|
-
const trigger = target.querySelector("button[part=trigger]");
|
|
245
|
-
if (trigger) {
|
|
246
|
-
trigger.setAttribute("aria-expanded", "false");
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
235
|
handleEyeDropper() {
|
|
250
236
|
if (!hasEyeDropper) {
|
|
251
237
|
return;
|
|
@@ -376,13 +362,9 @@ let UUIColorPickerElement = class extends LabelMixin("label", LitElement) {
|
|
|
376
362
|
</uui-color-swatches>`;
|
|
377
363
|
}
|
|
378
364
|
_renderPreviewButton() {
|
|
379
|
-
return html
|
|
380
|
-
placement="bottom-start"
|
|
381
|
-
@close=${this.closeColorPicker}>
|
|
382
|
-
<button
|
|
365
|
+
return html` <button
|
|
383
366
|
type="button"
|
|
384
367
|
part="trigger"
|
|
385
|
-
slot="trigger"
|
|
386
368
|
aria-label="${this.label || "Open Color picker"}"
|
|
387
369
|
class=${classMap({
|
|
388
370
|
"color-picker__trigger": true,
|
|
@@ -396,11 +378,12 @@ let UUIColorPickerElement = class extends LabelMixin("label", LitElement) {
|
|
|
396
378
|
"--preview-color": `hsla(${this.hue}deg, ${this.saturation}%, ${this.lightness}%, ${this.alpha / 100})`
|
|
397
379
|
})}
|
|
398
380
|
?disabled=${this.disabled}
|
|
399
|
-
@click=${this.openColorPicker}
|
|
400
381
|
aria-haspopup="true"
|
|
401
|
-
aria-expanded="false"
|
|
402
|
-
|
|
403
|
-
|
|
382
|
+
aria-expanded="false"
|
|
383
|
+
popovertarget="color-picker-popover"></button>
|
|
384
|
+
<uui-popover-container id="color-picker-popover">
|
|
385
|
+
${this._renderColorPicker()}
|
|
386
|
+
</uui-popover-container>`;
|
|
404
387
|
}
|
|
405
388
|
render() {
|
|
406
389
|
return this.inline ? this._renderColorPicker() : this._renderPreviewButton();
|
|
@@ -415,6 +398,9 @@ UUIColorPickerElement.styles = [
|
|
|
415
398
|
display: block;
|
|
416
399
|
width: var(--uui-color-picker-width, 280px);
|
|
417
400
|
}
|
|
401
|
+
uui-popover-container {
|
|
402
|
+
width: inherit;
|
|
403
|
+
}
|
|
418
404
|
.color-picker {
|
|
419
405
|
width: 100%;
|
|
420
406
|
background-color: #fff;
|
|
@@ -532,12 +518,6 @@ UUIColorPickerElement.styles = [
|
|
|
532
518
|
height: 36px;
|
|
533
519
|
}
|
|
534
520
|
|
|
535
|
-
uui-popover {
|
|
536
|
-
display: block;
|
|
537
|
-
width: 100%;
|
|
538
|
-
margin: 5px 0;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
521
|
uui-input {
|
|
542
522
|
/* lower the font size to avoid overflow with hlsa format */
|
|
543
523
|
font-size: 0.85rem;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { HslaColor } from 'colord';
|
|
3
|
-
import { UUIColorAreaEvent } from '@umbraco-ui/uui-color-area/lib';
|
|
4
|
-
import { UUIColorSliderEvent } from '@umbraco-ui/uui-color-slider/lib';
|
|
5
|
-
import { UUIColorSwatchesElement, UUIColorSwatchesEvent } from '@umbraco-ui/uui-color-swatches/lib';
|
|
6
|
-
import { UUIInputElement } from '@umbraco-ui/uui-input/lib';
|
|
3
|
+
import type { UUIColorAreaEvent } from '@umbraco-ui/uui-color-area/lib';
|
|
4
|
+
import type { UUIColorSliderEvent } from '@umbraco-ui/uui-color-slider/lib';
|
|
5
|
+
import type { UUIColorSwatchesElement, UUIColorSwatchesEvent } from '@umbraco-ui/uui-color-swatches/lib';
|
|
6
|
+
import type { UUIInputElement } from '@umbraco-ui/uui-input/lib';
|
|
7
7
|
export type UUIColorPickerFormat = 'hex' | 'rgb' | 'hsl' | 'hsv';
|
|
8
8
|
export type UUIColorPickerFormatWithAlpha = UUIColorPickerFormat | 'hexa' | 'rgba' | 'hsla' | 'hsva';
|
|
9
9
|
type UUIColorPickerSize = 'small' | 'medium' | 'large';
|
|
@@ -107,8 +107,6 @@ export declare class UUIColorPickerElement extends UUIColorPickerElement_base {
|
|
|
107
107
|
handleInputKeyDown(event: KeyboardEvent): void;
|
|
108
108
|
handleColorSwatchChange(event: UUIColorSwatchesEvent): void;
|
|
109
109
|
handleCopy(): void;
|
|
110
|
-
openColorPicker(event: Event): void;
|
|
111
|
-
closeColorPicker(event: Event): void;
|
|
112
110
|
handleEyeDropper(): void;
|
|
113
111
|
setColor(colorString: string | HslaColor): boolean;
|
|
114
112
|
setLetterCase(string: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-color-picker",
|
|
3
|
-
"version": "1.6.0-rc.
|
|
3
|
+
"version": "1.6.0-rc.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "1.6.0-rc.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.6.0-rc.2",
|
|
34
|
+
"@umbraco-ui/uui-popover-container": "1.6.0-rc.2",
|
|
34
35
|
"colord": "^2.9.3"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"access": "public"
|
|
43
44
|
},
|
|
44
45
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-color-picker",
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "5d4eefce4744802ab5bc40055b1a3136f0afc520"
|
|
46
47
|
}
|