@vertexvis/ui 0.1.2-canary.0 → 0.1.2-canary.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/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/{menu-d1ecf43b.js → menu-25f83cd7.js} +13 -3
- package/dist/cjs/{resizable-e4248256.js → resizable-c0a69532.js} +22 -4
- package/dist/cjs/vertex-menu.cjs.entry.js +1 -1
- package/dist/cjs/vertex-resizable.cjs.entry.js +2 -1
- package/dist/collection/components/menu/menu.js +13 -3
- package/dist/collection/components/resizable/resizable.js +23 -5
- package/dist/components/auto-resize-textarea.js +157 -0
- package/dist/components/color-swatch.js +124 -0
- package/dist/components/components.esm.js +1 -1
- package/dist/components/dom.js +13 -0
- package/dist/components/expandable.js +100 -0
- package/dist/components/icon-button.js +63 -0
- package/dist/components/icon-helper.js +722 -0
- package/dist/components/icon.js +43 -0
- package/dist/components/index.d.ts +71 -0
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +52 -0
- package/dist/components/index2.js +89 -0
- package/dist/components/menu.js +99 -0
- package/dist/components/p-1b85c1d1.entry.js +1 -0
- package/dist/components/p-95358d00.entry.js +1 -0
- package/dist/components/p-c9a967d9.js +1 -0
- package/dist/components/p-ee5c8bd3.js +1 -0
- package/dist/components/popover.js +1737 -0
- package/dist/components/result-list.js +565 -0
- package/dist/components/slots.js +26 -0
- package/dist/components/text-field.js +171 -0
- package/dist/components/tooltip.js +360 -0
- package/dist/components/tslib.es6.js +65 -0
- package/dist/components/vertex-auto-resize-textarea.d.ts +11 -0
- package/dist/components/vertex-auto-resize-textarea.js +6 -0
- package/dist/components/vertex-avatar-group.d.ts +11 -0
- package/dist/components/vertex-avatar-group.js +34 -0
- package/dist/components/vertex-avatar.d.ts +11 -0
- package/dist/components/vertex-avatar.js +68 -0
- package/dist/components/vertex-badge.d.ts +11 -0
- package/dist/components/vertex-badge.js +43 -0
- package/dist/components/vertex-banner.d.ts +11 -0
- package/dist/components/vertex-banner.js +141 -0
- package/dist/components/vertex-button.d.ts +11 -0
- package/dist/components/vertex-button.js +96 -0
- package/dist/components/vertex-card-group.d.ts +11 -0
- package/dist/components/vertex-card-group.js +51 -0
- package/dist/components/vertex-card.d.ts +11 -0
- package/dist/components/vertex-card.js +49 -0
- package/dist/components/vertex-chip.d.ts +11 -0
- package/dist/components/vertex-chip.js +45 -0
- package/dist/components/vertex-click-to-edit-textfield.d.ts +11 -0
- package/dist/components/vertex-click-to-edit-textfield.js +156 -0
- package/dist/components/vertex-collapsible.d.ts +11 -0
- package/dist/components/vertex-collapsible.js +63 -0
- package/dist/components/vertex-color-circle-picker.d.ts +11 -0
- package/dist/components/vertex-color-circle-picker.js +104 -0
- package/dist/components/vertex-color-picker.d.ts +11 -0
- package/dist/components/vertex-color-picker.js +75 -0
- package/dist/components/vertex-color-swatch.d.ts +11 -0
- package/dist/components/vertex-color-swatch.js +6 -0
- package/dist/components/vertex-context-menu.d.ts +11 -0
- package/dist/components/vertex-context-menu.js +125 -0
- package/dist/components/vertex-dialog.d.ts +11 -0
- package/dist/components/vertex-dialog.js +263 -0
- package/dist/components/vertex-draggable-popover.d.ts +11 -0
- package/dist/components/vertex-draggable-popover.js +119 -0
- package/dist/components/vertex-dropdown-menu.d.ts +11 -0
- package/dist/components/vertex-dropdown-menu.js +64 -0
- package/dist/components/vertex-expandable.d.ts +11 -0
- package/dist/components/vertex-expandable.js +6 -0
- package/dist/components/vertex-help-tooltip.d.ts +11 -0
- package/dist/components/vertex-help-tooltip.js +67 -0
- package/dist/components/vertex-icon-button.d.ts +11 -0
- package/dist/components/vertex-icon-button.js +6 -0
- package/dist/components/vertex-icon.d.ts +11 -0
- package/dist/components/vertex-icon.js +6 -0
- package/dist/components/vertex-logo-loading.d.ts +11 -0
- package/dist/components/vertex-logo-loading.js +34 -0
- package/dist/components/vertex-menu-divider.d.ts +11 -0
- package/dist/components/vertex-menu-divider.js +34 -0
- package/dist/components/vertex-menu-item.d.ts +11 -0
- package/dist/components/vertex-menu-item.js +44 -0
- package/dist/components/vertex-menu.d.ts +11 -0
- package/dist/components/vertex-menu.js +6 -0
- package/dist/components/vertex-popover.d.ts +11 -0
- package/dist/components/vertex-popover.js +6 -0
- package/dist/components/vertex-radio-group.d.ts +11 -0
- package/dist/components/vertex-radio-group.js +88 -0
- package/dist/components/vertex-radio.d.ts +11 -0
- package/dist/components/vertex-radio.js +56 -0
- package/dist/components/vertex-resizable.d.ts +11 -0
- package/dist/components/vertex-resizable.js +463 -0
- package/dist/components/vertex-result-list.d.ts +11 -0
- package/dist/components/vertex-result-list.js +6 -0
- package/dist/components/vertex-search-bar.d.ts +11 -0
- package/dist/components/vertex-search-bar.js +568 -0
- package/dist/components/vertex-select.d.ts +11 -0
- package/dist/components/vertex-select.js +200 -0
- package/dist/components/vertex-slider.d.ts +11 -0
- package/dist/components/vertex-slider.js +81 -0
- package/dist/components/vertex-spinner.d.ts +11 -0
- package/dist/components/vertex-spinner.js +49 -0
- package/dist/components/vertex-tab.d.ts +11 -0
- package/dist/components/vertex-tab.js +46 -0
- package/dist/components/vertex-tabs.d.ts +11 -0
- package/dist/components/vertex-tabs.js +133 -0
- package/dist/components/vertex-textfield.d.ts +11 -0
- package/dist/components/vertex-textfield.js +6 -0
- package/dist/components/vertex-toast.d.ts +11 -0
- package/dist/components/vertex-toast.js +127 -0
- package/dist/components/vertex-toggle.d.ts +11 -0
- package/dist/components/vertex-toggle.js +67 -0
- package/dist/components/vertex-tooltip.d.ts +11 -0
- package/dist/components/vertex-tooltip.js +6 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/{menu-daa7f9c9.js → menu-b8ff7d6a.js} +13 -3
- package/dist/esm/{resizable-a147709b.js → resizable-833336bf.js} +23 -5
- package/dist/esm/vertex-menu.entry.js +1 -1
- package/dist/esm/vertex-resizable.entry.js +2 -1
- package/dist/types/components/menu/menu.d.ts +2 -0
- package/dist/types/components/resizable/resizable.d.ts +1 -0
- package/package.json +2 -2
- package/dist/components/p-0517ca62.entry.js +0 -1
- package/dist/components/p-6ec189d2.js +0 -1
- package/dist/components/p-7b75e004.js +0 -1
- package/dist/components/p-ea4a2f74.entry.js +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './auto-resize-textarea.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './icon.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './icon-button.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './text-field.js';
|
|
7
|
+
|
|
8
|
+
const ClickToEditTextField = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
this.inputFocus = createEvent(this, "inputFocus", 7);
|
|
13
|
+
this.inputBlur = createEvent(this, "inputBlur", 7);
|
|
14
|
+
this.inputInput = createEvent(this, "inputInput", 7);
|
|
15
|
+
this.inputChange = createEvent(this, "inputChange", 7);
|
|
16
|
+
this.inputSubmit = createEvent(this, "inputSubmit", 7);
|
|
17
|
+
var _a;
|
|
18
|
+
this.handleKeyDown = (ev) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
if (ev.detail.key === 'Enter' && !this.multiline) {
|
|
21
|
+
(_a = this.textFieldRef) === null || _a === void 0 ? void 0 : _a.blurInput();
|
|
22
|
+
}
|
|
23
|
+
if (ev.detail.key === 'Escape') {
|
|
24
|
+
this.resetOnEscape();
|
|
25
|
+
(_b = this.textFieldRef) === null || _b === void 0 ? void 0 : _b.blurInput();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
this.resetOnEscape = () => {
|
|
29
|
+
if (this.textFieldRef != null && this.defaultValue != null) {
|
|
30
|
+
this.textFieldRef.updateInput(this.defaultValue);
|
|
31
|
+
this.editing = false;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
this.handleSubmit = async () => {
|
|
35
|
+
var _a;
|
|
36
|
+
const value = await ((_a = this.textFieldRef) === null || _a === void 0 ? void 0 : _a.getInputValue());
|
|
37
|
+
if (value != null && value !== this.defaultValue) {
|
|
38
|
+
this.defaultValue = value;
|
|
39
|
+
this.inputSubmit.emit({ value });
|
|
40
|
+
}
|
|
41
|
+
this.editing = false;
|
|
42
|
+
};
|
|
43
|
+
this.placeholder = undefined;
|
|
44
|
+
this.fontSize = 'standard';
|
|
45
|
+
this.disabled = undefined;
|
|
46
|
+
this.multiline = false;
|
|
47
|
+
this.minRows = undefined;
|
|
48
|
+
this.maxRows = undefined;
|
|
49
|
+
this.value = '';
|
|
50
|
+
this.autoFocus = undefined;
|
|
51
|
+
this.editing = false;
|
|
52
|
+
this.hasError = undefined;
|
|
53
|
+
this.handleInputBlur = this.handleInputBlur.bind(this);
|
|
54
|
+
this.handleInputFocus = this.handleInputFocus.bind(this);
|
|
55
|
+
this.handleInputInput = this.handleInputInput.bind(this);
|
|
56
|
+
this.handleInputChange = this.handleInputChange.bind(this);
|
|
57
|
+
this.handleSubmit = this.handleSubmit.bind(this);
|
|
58
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
59
|
+
this.defaultValue = (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString();
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
return (h("div", { class: "click-to-edit" }, h("div", { class: "click-to-edit-text" }, h("vertex-textfield", { ref: (element) => {
|
|
63
|
+
this.textFieldRef = element;
|
|
64
|
+
}, onInputBlur: this.handleInputBlur, onInputFocus: this.handleInputFocus, onInputInput: this.handleInputInput, onInputChange: this.handleInputChange, disabled: this.disabled, fontSize: this.fontSize, autoFocus: this.autoFocus, placeholder: this.placeholder, multiline: this.multiline, minRows: this.minRows, maxRows: this.maxRows, type: "text", value: this.value, variant: "blank", onTextFieldKeyDown: this.handleKeyDown, "data-testid": "click-to-edit-text-field", hasError: this.hasError })), this.renderIcon()));
|
|
65
|
+
}
|
|
66
|
+
renderIcon() {
|
|
67
|
+
if (this.editing) {
|
|
68
|
+
return (h("div", { class: "click-to-edit-icon-wrapper" }, h("slot", { name: "edit-icon" }, h("div", { class: "click-to-edit-button" }, h("vertex-icon-button", { iconSize: "sm", iconName: "check" })))));
|
|
69
|
+
}
|
|
70
|
+
else if (!this.disabled) {
|
|
71
|
+
return (h("div", { class: "click-to-edit-icon-wrapper" }, h("slot", { name: "pencil-icon" }, h("vertex-icon", { size: "sm", name: "pencil", class: classnames('icon-visibility', 'hover-icon') }))));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return h("div", null);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
handleInputBlur(event) {
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
this.inputBlur.emit();
|
|
80
|
+
this.handleSubmit();
|
|
81
|
+
}
|
|
82
|
+
handleInputFocus(event) {
|
|
83
|
+
var _a;
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
this.inputFocus.emit();
|
|
86
|
+
(_a = this.textFieldRef) === null || _a === void 0 ? void 0 : _a.selectAll();
|
|
87
|
+
this.editing = true;
|
|
88
|
+
}
|
|
89
|
+
handleInputInput(event) {
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
this.inputInput.emit({ value: event.detail.value });
|
|
92
|
+
}
|
|
93
|
+
handleInputChange(event) {
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
this.inputChange.emit({ value: event.detail.value });
|
|
96
|
+
}
|
|
97
|
+
handleValueChanged(newValue) {
|
|
98
|
+
// If the value changed outside of edit mode, then update the default value
|
|
99
|
+
if (!this.editing) {
|
|
100
|
+
this.defaultValue = newValue === null || newValue === void 0 ? void 0 : newValue.toString();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
static get watchers() { return {
|
|
104
|
+
"value": ["handleValueChanged"]
|
|
105
|
+
}; }
|
|
106
|
+
}, [6, "vertex-click-to-edit-textfield", {
|
|
107
|
+
"placeholder": [1],
|
|
108
|
+
"fontSize": [1, "font-size"],
|
|
109
|
+
"disabled": [516],
|
|
110
|
+
"multiline": [4],
|
|
111
|
+
"minRows": [2, "min-rows"],
|
|
112
|
+
"maxRows": [2, "max-rows"],
|
|
113
|
+
"value": [1032],
|
|
114
|
+
"autoFocus": [4, "auto-focus"],
|
|
115
|
+
"editing": [1540],
|
|
116
|
+
"hasError": [4, "has-error"]
|
|
117
|
+
}]);
|
|
118
|
+
function defineCustomElement$1() {
|
|
119
|
+
if (typeof customElements === "undefined") {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const components = ["vertex-click-to-edit-textfield", "vertex-auto-resize-textarea", "vertex-icon", "vertex-icon-button", "vertex-textfield"];
|
|
123
|
+
components.forEach(tagName => { switch (tagName) {
|
|
124
|
+
case "vertex-click-to-edit-textfield":
|
|
125
|
+
if (!customElements.get(tagName)) {
|
|
126
|
+
customElements.define(tagName, ClickToEditTextField);
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case "vertex-auto-resize-textarea":
|
|
130
|
+
if (!customElements.get(tagName)) {
|
|
131
|
+
defineCustomElement$5();
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case "vertex-icon":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
defineCustomElement$4();
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "vertex-icon-button":
|
|
140
|
+
if (!customElements.get(tagName)) {
|
|
141
|
+
defineCustomElement$3();
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
case "vertex-textfield":
|
|
145
|
+
if (!customElements.get(tagName)) {
|
|
146
|
+
defineCustomElement$2();
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
} });
|
|
150
|
+
}
|
|
151
|
+
defineCustomElement$1();
|
|
152
|
+
|
|
153
|
+
const VertexClickToEditTextfield = ClickToEditTextField;
|
|
154
|
+
const defineCustomElement = defineCustomElement$1;
|
|
155
|
+
|
|
156
|
+
export { ClickToEditTextField as C, VertexClickToEditTextfield, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexCollapsible extends Components.VertexCollapsible, HTMLElement {}
|
|
4
|
+
export const VertexCollapsible: {
|
|
5
|
+
prototype: VertexCollapsible;
|
|
6
|
+
new (): VertexCollapsible;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './expandable.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './icon.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './icon-button.js';
|
|
6
|
+
|
|
7
|
+
const collapsibleCss = "button{border:none;background-color:transparent;font-family:var(--vertex-ui-font-family);font-size:0.875rem;padding:0}:host{--hover-color:var(--vertex-ui-blue-700)}.collapsible-target{width:100%;display:flex;align-items:center;cursor:pointer;padding:0.75rem 0.25rem;outline:none}.collapsible-target:focus-visible{border-radius:0.25rem;box-shadow:0 0 0 1px var(--hover-color, var(--vertex-ui-blue-700))}.collapsible-target:focus-visible,.collapsible-target:hover{color:var(--hover-color, var(--vertex-ui-blue-700))}.collapsible-expand{display:flex;justify-content:center;align-items:center;transition-property:transform;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms;margin-left:auto}.rotated{transform:rotateZ(90deg)}.collapsible-content{font-family:var(--vertex-ui-font-family);font-size:var(--vertex-ui-text-base);box-sizing:border-box}";
|
|
8
|
+
|
|
9
|
+
const Collapsible = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.label = undefined;
|
|
15
|
+
this.open = false;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return (h("vertex-expandable", { controlled: true, expanded: this.open }, h("button", { slot: "header", "data-testid": "expand-click-target", class: "collapsible-target", onClick: () => this.setOpen(!this.open), onSubmit: () => this.setOpen(!this.open) }, this.label != null ? (h("span", null, this.label)) : (h("slot", { name: "label" })), h("div", { class: classnames('collapsible-expand', {
|
|
19
|
+
rotated: this.open,
|
|
20
|
+
}) }, h("slot", { name: "expand-icon" }, h("vertex-icon", { name: "caret-right" })))), h("div", { class: "collapsible-content-container" }, h("slot", null))));
|
|
21
|
+
}
|
|
22
|
+
setOpen(open) {
|
|
23
|
+
this.open = open;
|
|
24
|
+
}
|
|
25
|
+
static get style() { return collapsibleCss; }
|
|
26
|
+
}, [1, "vertex-collapsible", {
|
|
27
|
+
"label": [1],
|
|
28
|
+
"open": [1540]
|
|
29
|
+
}]);
|
|
30
|
+
function defineCustomElement$1() {
|
|
31
|
+
if (typeof customElements === "undefined") {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const components = ["vertex-collapsible", "vertex-expandable", "vertex-icon", "vertex-icon-button"];
|
|
35
|
+
components.forEach(tagName => { switch (tagName) {
|
|
36
|
+
case "vertex-collapsible":
|
|
37
|
+
if (!customElements.get(tagName)) {
|
|
38
|
+
customElements.define(tagName, Collapsible);
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
case "vertex-expandable":
|
|
42
|
+
if (!customElements.get(tagName)) {
|
|
43
|
+
defineCustomElement$4();
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case "vertex-icon":
|
|
47
|
+
if (!customElements.get(tagName)) {
|
|
48
|
+
defineCustomElement$3();
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case "vertex-icon-button":
|
|
52
|
+
if (!customElements.get(tagName)) {
|
|
53
|
+
defineCustomElement$2();
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
} });
|
|
57
|
+
}
|
|
58
|
+
defineCustomElement$1();
|
|
59
|
+
|
|
60
|
+
const VertexCollapsible = Collapsible;
|
|
61
|
+
const defineCustomElement = defineCustomElement$1;
|
|
62
|
+
|
|
63
|
+
export { Collapsible as C, VertexCollapsible, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexColorCirclePicker extends Components.VertexColorCirclePicker, HTMLElement {}
|
|
4
|
+
export const VertexColorCirclePicker: {
|
|
5
|
+
prototype: VertexColorCirclePicker;
|
|
6
|
+
new (): VertexColorCirclePicker;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './color-swatch.js';
|
|
4
|
+
|
|
5
|
+
const colorCirclePickerCss = ":host{display:flex;--color-circle-spacing:1rem;--color-circle-hovered-outline:2px solid var(--vertex-ui-neutral-700);--color-circle-selected-outline:var(--color-circle-hovered-outline)}.container{display:flex;gap:var(--color-circle-spacing)}.container.vertical{flex-direction:column;justify-content:center}.container.horizontal{align-items:center}.circle{cursor:pointer;outline-offset:3px;border-radius:100%}.circle.selected{outline:var(--color-circle-selected-outline)}.circle:hover{outline:var(--color-circle-hovered-outline)}";
|
|
6
|
+
|
|
7
|
+
const ColorCirclePicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.selectionChanged = createEvent(this, "selectionChanged", 7);
|
|
13
|
+
this.colorArray = [];
|
|
14
|
+
this.supplementaryColorArray = [];
|
|
15
|
+
this.handleClick = (event) => {
|
|
16
|
+
const circle = event.target;
|
|
17
|
+
this.selectionChanged.emit({
|
|
18
|
+
color: circle.color,
|
|
19
|
+
lightened: circle.lightened,
|
|
20
|
+
darkened: circle.darkened,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
this.colors = [
|
|
24
|
+
'#4c87be',
|
|
25
|
+
'#f3d336',
|
|
26
|
+
'#6fbb29',
|
|
27
|
+
'#e38826',
|
|
28
|
+
'#c72e16',
|
|
29
|
+
'#8c3681',
|
|
30
|
+
'#000000',
|
|
31
|
+
'#ffffff',
|
|
32
|
+
];
|
|
33
|
+
this.supplementalColors = [];
|
|
34
|
+
this.theme = 'dark';
|
|
35
|
+
this.lightenPercentage = 0.25;
|
|
36
|
+
this.darkenPercentage = 0.25;
|
|
37
|
+
this.selected = undefined;
|
|
38
|
+
this.direction = 'horizontal';
|
|
39
|
+
}
|
|
40
|
+
componentWillLoad() {
|
|
41
|
+
this.handleColorsChange(this.colors);
|
|
42
|
+
this.handleSupplementalColorsChange(this.supplementalColors);
|
|
43
|
+
}
|
|
44
|
+
handleColorsChange(newValue) {
|
|
45
|
+
if (typeof newValue === 'string') {
|
|
46
|
+
this.colorArray = JSON.parse(newValue);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.colorArray = newValue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
handleSupplementalColorsChange(newValue) {
|
|
53
|
+
if (typeof newValue === 'string') {
|
|
54
|
+
this.supplementaryColorArray = JSON.parse(newValue);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.supplementaryColorArray = newValue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
return (h(Host, null, h("div", { class: classnames('container', {
|
|
62
|
+
vertical: this.direction === 'vertical',
|
|
63
|
+
}) }, this.colorArray.map((c, i) => (h("vertex-color-swatch", { class: classnames('circle', {
|
|
64
|
+
selected: this.selected === c,
|
|
65
|
+
}), variant: "circle", size: "lg", color: c, supplementalColor: this.supplementaryColorArray[i], onClick: this.handleClick, lightenPercentage: this.lightenPercentage, darkenPercentage: this.darkenPercentage, theme: this.theme }))))));
|
|
66
|
+
}
|
|
67
|
+
static get watchers() { return {
|
|
68
|
+
"colors": ["handleColorsChange"],
|
|
69
|
+
"supplementalColors": ["handleSupplementalColorsChange"]
|
|
70
|
+
}; }
|
|
71
|
+
static get style() { return colorCirclePickerCss; }
|
|
72
|
+
}, [1, "vertex-color-circle-picker", {
|
|
73
|
+
"colors": [1],
|
|
74
|
+
"supplementalColors": [1, "supplemental-colors"],
|
|
75
|
+
"theme": [513],
|
|
76
|
+
"lightenPercentage": [2, "lighten-percentage"],
|
|
77
|
+
"darkenPercentage": [2, "darken-percentage"],
|
|
78
|
+
"selected": [1537],
|
|
79
|
+
"direction": [1]
|
|
80
|
+
}]);
|
|
81
|
+
function defineCustomElement$1() {
|
|
82
|
+
if (typeof customElements === "undefined") {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const components = ["vertex-color-circle-picker", "vertex-color-swatch"];
|
|
86
|
+
components.forEach(tagName => { switch (tagName) {
|
|
87
|
+
case "vertex-color-circle-picker":
|
|
88
|
+
if (!customElements.get(tagName)) {
|
|
89
|
+
customElements.define(tagName, ColorCirclePicker);
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case "vertex-color-swatch":
|
|
93
|
+
if (!customElements.get(tagName)) {
|
|
94
|
+
defineCustomElement$2();
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
} });
|
|
98
|
+
}
|
|
99
|
+
defineCustomElement$1();
|
|
100
|
+
|
|
101
|
+
const VertexColorCirclePicker = ColorCirclePicker;
|
|
102
|
+
const defineCustomElement = defineCustomElement$1;
|
|
103
|
+
|
|
104
|
+
export { ColorCirclePicker as C, VertexColorCirclePicker, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexColorPicker extends Components.VertexColorPicker, HTMLElement {}
|
|
4
|
+
export const VertexColorPicker: {
|
|
5
|
+
prototype: VertexColorPicker;
|
|
6
|
+
new (): VertexColorPicker;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
import { i as isValidHexColor, d as defineCustomElement$2 } from './color-swatch.js';
|
|
4
|
+
|
|
5
|
+
const colorPickerCss = ":host{display:flex;--selected-color-width:initial;--selected-color-height:initial}.wrapper{display:inline-flex;align-items:center}.wrapper.expand-full{width:100%}.wrapper.full{padding:0.375rem 0.5rem;border:1px solid var(--vertex-ui-neutral-300);border-radius:4px}.color-picker{width:100%;display:inline-flex;position:relative;cursor:pointer}.color-picker.disabled{opacity:0.5;cursor:default}.selected-wrapper{position:relative;display:flex;align-items:center}.wrapper.full .selected-wrapper{gap:0.75rem}.selected{position:relative}.wrapper.sm .selected{width:var(--selected-color-width, 1rem);height:var(--selected-color-height, 1rem)}.wrapper.md .selected{width:var(--selected-color-width, 1.25rem);height:var(--selected-color-height, 1.25rem)}.wrapper.lg .selected{width:var(--selected-color-width, 1.5rem);height:var(--selected-color-height, 1.5rem)}.text-wrapper{position:relative}.selected-text{position:absolute;left:0;top:0;right:0;bottom:0;display:flex;color:var(--vertex-ui-neutral-700);text-align:center;font-family:var(--vertex-ui-font-family)}.hidden-text{visibility:hidden;pointer-events:none;font-family:var(--vertex-ui-font-family-monospace)}.wrapper.sm .selected-text,.wrapper.sm .hidden-text{font-size:var(--vertex-ui-text-xs)}.wrapper.md .selected-text,.wrapper.md .hidden-text{font-size:var(--vertex-ui-text-xs)}.wrapper.lg .selected-text,.wrapper.lg .hidden-text{font-size:var(--vertex-ui-text-xs)}.no-value{width:100%;height:100%;stroke:var(--vertex-ui-red-400)}.right-gutter{display:flex;align-items:center;margin-left:auto}slot[name=\"right-gutter\"]::slotted(*){padding:0}.input{display:flex;position:absolute;pointer-events:none;height:100%;width:100%;left:0;top:0;opacity:0}";
|
|
6
|
+
|
|
7
|
+
const ColorPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.valueInput = createEvent(this, "valueInput", 7);
|
|
13
|
+
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
14
|
+
this.handleInput = (event) => {
|
|
15
|
+
const input = event.target;
|
|
16
|
+
this.value = input.value || '';
|
|
17
|
+
};
|
|
18
|
+
this.handleChange = (event) => {
|
|
19
|
+
this.valueChanged.emit(this.value);
|
|
20
|
+
};
|
|
21
|
+
this.value = undefined;
|
|
22
|
+
this.size = 'md';
|
|
23
|
+
this.variant = 'full';
|
|
24
|
+
this.expand = 'block';
|
|
25
|
+
this.disabled = false;
|
|
26
|
+
}
|
|
27
|
+
valueChange() {
|
|
28
|
+
this.valueInput.emit(this.value);
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
var _a;
|
|
32
|
+
return (h(Host, null, h("div", { class: classnames('wrapper', this.variant, this.size, `expand-${this.expand}`) }, h("label", { class: classnames('color-picker', { disabled: this.disabled }) }, h("input", { type: "color", class: "input", "data-testid": "input", disabled: this.disabled, value: this.value, onInput: this.handleInput, onChange: this.handleChange }), h("div", { class: classnames('selected-wrapper', this.variant) }, h("div", { class: "selected", title: this.value }, h("vertex-color-swatch", { class: "selected-color", supplementalColor: "var(--vertex-ui-neutral-400)", color: this.value, variant: "square", size: this.size }, h("slot", { name: "overlay", slot: "overlay" }, (this.value == null || this.value === '') && (h("svg", { class: "no-value", slot: "overlay", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16" }, h("path", { d: "M16,0L0,16" })))))), this.variant === 'full' && (h("div", { class: "text-wrapper" }, h("div", { class: "hidden-text" }, "#FFFFFF"), h("div", { class: "selected-text" }, (_a = this.getDisplayedValue()) !== null && _a !== void 0 ? _a : 'Default')))), h("div", { class: "right-gutter" }, h("slot", { name: "right-gutter" }))))));
|
|
33
|
+
}
|
|
34
|
+
getDisplayedValue() {
|
|
35
|
+
var _a;
|
|
36
|
+
if (this.value != null && isValidHexColor(this.value)) {
|
|
37
|
+
return (_a = this.value) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase();
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
static get watchers() { return {
|
|
42
|
+
"value": ["valueChange"]
|
|
43
|
+
}; }
|
|
44
|
+
static get style() { return colorPickerCss; }
|
|
45
|
+
}, [1, "vertex-color-picker", {
|
|
46
|
+
"value": [1537],
|
|
47
|
+
"size": [513],
|
|
48
|
+
"variant": [513],
|
|
49
|
+
"expand": [513],
|
|
50
|
+
"disabled": [4]
|
|
51
|
+
}]);
|
|
52
|
+
function defineCustomElement$1() {
|
|
53
|
+
if (typeof customElements === "undefined") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const components = ["vertex-color-picker", "vertex-color-swatch"];
|
|
57
|
+
components.forEach(tagName => { switch (tagName) {
|
|
58
|
+
case "vertex-color-picker":
|
|
59
|
+
if (!customElements.get(tagName)) {
|
|
60
|
+
customElements.define(tagName, ColorPicker);
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case "vertex-color-swatch":
|
|
64
|
+
if (!customElements.get(tagName)) {
|
|
65
|
+
defineCustomElement$2();
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
} });
|
|
69
|
+
}
|
|
70
|
+
defineCustomElement$1();
|
|
71
|
+
|
|
72
|
+
const VertexColorPicker = ColorPicker;
|
|
73
|
+
const defineCustomElement = defineCustomElement$1;
|
|
74
|
+
|
|
75
|
+
export { ColorPicker as C, VertexColorPicker, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexColorSwatch extends Components.VertexColorSwatch, HTMLElement {}
|
|
4
|
+
export const VertexColorSwatch: {
|
|
5
|
+
prototype: VertexColorSwatch;
|
|
6
|
+
new (): VertexColorSwatch;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexContextMenu extends Components.VertexContextMenu, HTMLElement {}
|
|
4
|
+
export const VertexContextMenu: {
|
|
5
|
+
prototype: VertexContextMenu;
|
|
6
|
+
new (): VertexContextMenu;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$3 } from './menu.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './popover.js';
|
|
4
|
+
|
|
5
|
+
const ContextMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.menuOpened = createEvent(this, "menuOpened", 7);
|
|
11
|
+
this.menuClosed = createEvent(this, "menuClosed", 7);
|
|
12
|
+
this.targetSelector = undefined;
|
|
13
|
+
this.animated = true;
|
|
14
|
+
this.position = undefined;
|
|
15
|
+
this.open = false;
|
|
16
|
+
this.handlePointerDown = this.handlePointerDown.bind(this);
|
|
17
|
+
this.handlePointerUp = this.handlePointerUp.bind(this);
|
|
18
|
+
this.handleContextMenu = this.handleContextMenu.bind(this);
|
|
19
|
+
this.handleMenuClosed = this.handleMenuClosed.bind(this);
|
|
20
|
+
this.observer = new MutationObserver(() => {
|
|
21
|
+
if (this.target == null) {
|
|
22
|
+
this.addEventListeners(this.targetSelector);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
componentDidLoad() {
|
|
27
|
+
this.addEventListeners(this.targetSelector);
|
|
28
|
+
this.observer.observe(document.body, {
|
|
29
|
+
childList: true,
|
|
30
|
+
attributes: true,
|
|
31
|
+
subtree: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
disconnectedCallback() {
|
|
35
|
+
this.removeEventListeners();
|
|
36
|
+
this.observer.disconnect();
|
|
37
|
+
}
|
|
38
|
+
handleTargetSelectorChange(targetSelector) {
|
|
39
|
+
if (targetSelector != null) {
|
|
40
|
+
this.removeEventListeners();
|
|
41
|
+
this.addEventListeners(targetSelector);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return (h("vertex-menu", { open: this.open, animated: this.animated, position: this.position, fallbackPlacements: [
|
|
46
|
+
'bottom-end',
|
|
47
|
+
'top-start',
|
|
48
|
+
'top-end',
|
|
49
|
+
'right',
|
|
50
|
+
'left',
|
|
51
|
+
], onMenuClosed: this.handleMenuClosed }, h("slot", null)));
|
|
52
|
+
}
|
|
53
|
+
addEventListeners(targetSelector) {
|
|
54
|
+
this.target =
|
|
55
|
+
document.querySelector(targetSelector) || undefined;
|
|
56
|
+
if (this.target != null) {
|
|
57
|
+
this.target.addEventListener('contextmenu', this.handleContextMenu);
|
|
58
|
+
this.target.addEventListener('pointerdown', this.handlePointerDown);
|
|
59
|
+
this.target.addEventListener('pointerup', this.handlePointerUp);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
removeEventListeners() {
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
(_a = this.target) === null || _a === void 0 ? void 0 : _a.removeEventListener('contextmenu', this.handleContextMenu);
|
|
65
|
+
(_b = this.target) === null || _b === void 0 ? void 0 : _b.removeEventListener('pointerdown', this.handlePointerDown);
|
|
66
|
+
(_c = this.target) === null || _c === void 0 ? void 0 : _c.removeEventListener('pointerup', this.handlePointerUp);
|
|
67
|
+
this.target = undefined;
|
|
68
|
+
}
|
|
69
|
+
handleContextMenu(e) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
handlePointerDown(e) {
|
|
73
|
+
if (e.buttons === 2) {
|
|
74
|
+
this.position = { x: e.clientX, y: e.clientY };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
handlePointerUp(e) {
|
|
78
|
+
var _a;
|
|
79
|
+
if (e.clientX === ((_a = this.position) === null || _a === void 0 ? void 0 : _a.x) && e.clientY === this.position.y) {
|
|
80
|
+
this.open = true;
|
|
81
|
+
this.menuOpened.emit(e);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
handleMenuClosed() {
|
|
85
|
+
this.open = false;
|
|
86
|
+
this.menuClosed.emit();
|
|
87
|
+
}
|
|
88
|
+
static get watchers() { return {
|
|
89
|
+
"targetSelector": ["handleTargetSelectorChange"]
|
|
90
|
+
}; }
|
|
91
|
+
}, [1, "vertex-context-menu", {
|
|
92
|
+
"targetSelector": [1, "target-selector"],
|
|
93
|
+
"animated": [4],
|
|
94
|
+
"position": [32],
|
|
95
|
+
"open": [32]
|
|
96
|
+
}]);
|
|
97
|
+
function defineCustomElement$1() {
|
|
98
|
+
if (typeof customElements === "undefined") {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const components = ["vertex-context-menu", "vertex-menu", "vertex-popover"];
|
|
102
|
+
components.forEach(tagName => { switch (tagName) {
|
|
103
|
+
case "vertex-context-menu":
|
|
104
|
+
if (!customElements.get(tagName)) {
|
|
105
|
+
customElements.define(tagName, ContextMenu);
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
case "vertex-menu":
|
|
109
|
+
if (!customElements.get(tagName)) {
|
|
110
|
+
defineCustomElement$3();
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
case "vertex-popover":
|
|
114
|
+
if (!customElements.get(tagName)) {
|
|
115
|
+
defineCustomElement$2();
|
|
116
|
+
}
|
|
117
|
+
break;
|
|
118
|
+
} });
|
|
119
|
+
}
|
|
120
|
+
defineCustomElement$1();
|
|
121
|
+
|
|
122
|
+
const VertexContextMenu = ContextMenu;
|
|
123
|
+
const defineCustomElement = defineCustomElement$1;
|
|
124
|
+
|
|
125
|
+
export { ContextMenu as C, VertexContextMenu, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexDialog extends Components.VertexDialog, HTMLElement {}
|
|
4
|
+
export const VertexDialog: {
|
|
5
|
+
prototype: VertexDialog;
|
|
6
|
+
new (): VertexDialog;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|