@vertexvis/ui 0.1.1-canary.1 → 0.1.1-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/button-e63d25b1.js +70 -0
- package/dist/cjs/color-picker-000b8ca6.js +47 -0
- package/dist/cjs/components.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/vertex-button.cjs.entry.js +1 -1
- package/dist/cjs/vertex-color-picker.cjs.entry.js +1 -1
- package/dist/collection/components/button/button.css +99 -13
- package/dist/collection/components/button/button.js +4 -1
- package/dist/collection/components/color-picker/color-picker.css +5 -0
- package/dist/collection/components/color-picker/color-picker.js +24 -1
- package/dist/components/components.esm.js +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/p-1e645c1f.js +1 -0
- package/dist/components/p-70c6c194.entry.js +1 -0
- package/dist/components/p-e5ce8d66.js +1 -0
- package/dist/components/p-f6f2bc86.entry.js +1 -0
- package/dist/esm/button-81207236.js +68 -0
- package/dist/esm/color-picker-16b97934.js +45 -0
- package/dist/esm/components.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/vertex-button.entry.js +1 -1
- package/dist/esm/vertex-color-picker.entry.js +1 -1
- package/dist/types/components/button/button.d.ts +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts +9 -0
- package/dist/types/components.d.ts +9 -1
- package/package.json +2 -2
- package/dist/cjs/button-edd366d8.js +0 -67
- package/dist/cjs/color-picker-2a4820fa.js +0 -46
- package/dist/components/p-2b4aedaa.entry.js +0 -1
- package/dist/components/p-64e8b92c.js +0 -1
- package/dist/components/p-655053df.js +0 -1
- package/dist/components/p-fca52578.entry.js +0 -1
- package/dist/esm/button-547336b8.js +0 -65
- package/dist/esm/color-picker-1d67effe.js +0 -44
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement } from './index-72f28b71.js';
|
|
2
|
-
import { c as classnames } from './index-9c609209.js';
|
|
3
|
-
|
|
4
|
-
const buttonCss = "button{border:none;background-color:transparent;font-family:var(--vertex-ui-font-family);font-size:0.875rem;padding:0}a{text-decoration:none;font-family:var(--vertex-ui-font-family)}:host{--enabled-cursor:pointer;--disabled-cursor:not-allowed}:host([type]){-webkit-appearance:none !important}:host([disabled=\"\"]){pointer-events:none}.btn{display:flex;align-items:center;justify-content:center;border-radius:0.25rem;box-sizing:border-box;text-decoration:none;cursor:var(--enabled-cursor)}.btn-full{width:100%}.btn.disabled,.btn:not(.disabled):focus,.btn:not(.disabled):active{outline:none}.btn.disabled{cursor:var(--disabled-cursor)}.btn-sm{font-size:var(--vertex-ui-text-sm)}.btn-sm:not(.btn-plaintext){padding:0 0.25rem}.btn-md{font-size:var(--vertex-ui-text-base)}.btn-md:not(.btn-plaintext){padding:0.5rem 1rem}.btn-lg{font-size:var(--vertex-ui-text-lg)}.btn-lg:not(.btn-plaintext){padding:0.75rem 0.75rem}.btn-plaintext{color:var(--vertex-ui-neutral-800)}.btn-primary{color:white;background-color:var(--vertex-ui-blue-700)}.btn-primary:not(.disabled):hover{background-color:var(--vertex-ui-blue-500)}.btn-primary:not(.disabled):focus,.btn-primary:not(.disabled):active{background-color:var(--vertex-ui-blue-600)}.btn-primary:not(.disabled):focus{box-shadow:0 0 0 1px var(--vertex-ui-blue-900)}.btn-primary:not(.disabled):active{box-shadow:none}.btn-primary.disabled{background-color:var(--vertex-ui-blue-200);cursor:var(--disabled-cursor)}.btn-secondary{color:var(--vertex-ui-neutral-800);background-color:var(--vertex-ui-neutral-300)}.btn-secondary:not(.disabled):hover{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.btn-secondary:not(.disabled):focus,.btn-secondary:not(.disabled):active{background-color:var(--vertex-ui-neutral-400)}.btn-secondary:not(.disabled):focus{box-shadow:0 0 0 1px var(--vertex-ui-neutral-900)}.btn-secondary:not(.disabled):active{box-shadow:none}.btn-secondary.disabled{background-color:var(--vertex-ui-neutral-200);color:var(--vertex-ui-neutral-400)}.btn-danger{color:white;background-color:var(--vertex-ui-red-600)}.btn-danger:not(.disabled):hover{background-color:var(--vertex-ui-red-400)}.btn-danger:not(.disabled):focus{background-color:var(--vertex-ui-red-500);box-shadow:0 0 0 1px var(--vertex-ui-red-900)}.btn-danger:not(.disabled):active{background-color:var(--vertex-ui-red-600);box-shadow:none}.btn-danger.disabled{background-color:var(--vertex-ui-red-200);box-shadow:none}.btn-txt-primary{color:var(--vertex-ui-blue-600)}.btn-txt-primary:not(.disabled):hover{color:var(--vertex-ui-blue-800);background-color:var(--vertex-ui-blue-200)}.btn-txt-primary:not(.disabled):focus,.btn-txt-primary:not(.disabled):active{color:var(--vertex-ui-blue-800);background-color:var(--vertex-ui-blue-300)}.btn-txt-primary:not(.disabled):focus{box-shadow:0 0 0 1px var(--vertex-ui-blue-900)}.btn-txt-primary:not(.disabled):active{box-shadow:none}.btn-txt-primary.disabled{color:var(--vertex-ui-blue-300);box-shadow:none}.btn-txt-secondary{color:var(--vertex-ui-neutral-700)}.btn-txt-secondary:not(.disabled):hover,.btn-txt-secondary:not(.disabled):active,.btn-txt-secondary:not(.disabled):focus{color:var(--vertex-ui-neutral-800);background-color:var(--vertex-ui-neutral-300)}.btn-txt-secondary:not(.disabled):focus{box-shadow:0 0 0 1px var(--vertex-ui-neutral-900)}.btn-txt-secondary.disabled{color:var(--vertex-ui-neutral-300);box-shadow:none}.btn-txt-danger{color:var(--vertex-ui-red-600)}.btn-txt-danger:not(.disabled):focus,.btn-txt-danger:not(.disabled):active,.btn-txt-danger:not(.disabled):hover{color:var(--vertex-ui-red-800)}.btn-txt-danger:not(.disabled):hover{background-color:var(--vertex-ui-red-200)}.btn-txt-danger:not(.disabled):focus,.btn-txt-danger:not(.disabled):active{background-color:var(--vertex-ui-red-300)}.btn-txt-danger:not(.disabled):focus{box-shadow:0 0 0 1px var(--vertex-ui-red-900)}.btn-txt-danger:not(.disabled):active{box-shadow:none}.btn-txt-danger.disabled{color:var(--vertex-ui-red-300);box-shadow:none}";
|
|
5
|
-
|
|
6
|
-
const Button = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.type = undefined;
|
|
10
|
-
this.color = 'secondary';
|
|
11
|
-
this.variant = 'solid';
|
|
12
|
-
this.size = 'md';
|
|
13
|
-
this.expand = 'block';
|
|
14
|
-
this.href = undefined;
|
|
15
|
-
this.target = undefined;
|
|
16
|
-
this.disabled = undefined;
|
|
17
|
-
}
|
|
18
|
-
connectedCallback() {
|
|
19
|
-
if (this.hostElement != null && this.type === 'submit') {
|
|
20
|
-
const form = this.hostElement.closest('form');
|
|
21
|
-
if (form != null) {
|
|
22
|
-
this.fakeButton = document.createElement('button');
|
|
23
|
-
this.fakeButton.setAttribute('type', this.type);
|
|
24
|
-
this.fakeButton.setAttribute('style', 'display: none');
|
|
25
|
-
this.fakeButton.setAttribute('data-testid', 'vertex-fake-button');
|
|
26
|
-
form.appendChild(this.fakeButton);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
disconnectedCallback() {
|
|
31
|
-
if (this.hostElement != null && this.fakeButton != null) {
|
|
32
|
-
this.fakeButton.remove();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
36
|
-
const classes = classnames('btn', {
|
|
37
|
-
'btn-full': this.expand === 'full',
|
|
38
|
-
'btn-sm': this.size === 'sm',
|
|
39
|
-
'btn-md': this.size === 'md',
|
|
40
|
-
'btn-lg': this.size === 'lg',
|
|
41
|
-
'btn-primary': this.color === 'primary' && this.variant === 'solid',
|
|
42
|
-
'btn-secondary': this.color === 'secondary' && this.variant === 'solid',
|
|
43
|
-
'btn-danger': this.color === 'danger' && this.variant === 'solid',
|
|
44
|
-
'btn-txt-primary': this.color === 'primary' && this.variant === 'text',
|
|
45
|
-
'btn-txt-secondary': this.color === 'secondary' && this.variant === 'text',
|
|
46
|
-
'btn-txt-danger': this.color === 'danger' && this.variant === 'text',
|
|
47
|
-
'btn-plaintext': this.variant === 'plaintext',
|
|
48
|
-
disabled: this.disabled,
|
|
49
|
-
});
|
|
50
|
-
if (this.href != null && this.type != null) {
|
|
51
|
-
console.warn('The type attribute is ignored when href is provided');
|
|
52
|
-
}
|
|
53
|
-
return (h(Host, { style: { pointerEvents: this.disabled ? 'none' : undefined } }, this.href != null && this.href !== '' ? (h("a", { href: this.href, target: this.target, class: classes, tabIndex: this.disabled ? -1 : 0 }, h("slot", null))) : (h("button", { class: classes, disabled: this.disabled, type: this.type, onClick: (event) => this.handleClick(event) }, h("slot", { name: "left" }), h("slot", null)))));
|
|
54
|
-
}
|
|
55
|
-
handleClick(event) {
|
|
56
|
-
if (this.fakeButton != null) {
|
|
57
|
-
event.preventDefault();
|
|
58
|
-
this.fakeButton.click();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
get hostElement() { return getElement(this); }
|
|
62
|
-
};
|
|
63
|
-
Button.style = buttonCss;
|
|
64
|
-
|
|
65
|
-
export { Button as B };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h, H as Host } from './index-72f28b71.js';
|
|
2
|
-
import { c as classnames } from './index-9c609209.js';
|
|
3
|
-
import { i as isValidHexColor } from './lib-73fbca8b.js';
|
|
4
|
-
|
|
5
|
-
const colorPickerCss = ":host{display:flex;--selected-color-width:initial;--selected-color-height:initial}.wrapper{display:inline-flex;align-items:center}.wrapper.full{padding:0.375rem 0.5rem;border:1px solid var(--vertex-ui-neutral-300);border-radius:4px}.color-picker{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 = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
registerInstance(this, hostRef);
|
|
10
|
-
this.valueInput = createEvent(this, "valueInput", 7);
|
|
11
|
-
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
12
|
-
this.handleInput = (event) => {
|
|
13
|
-
const input = event.target;
|
|
14
|
-
this.value = input.value || '';
|
|
15
|
-
};
|
|
16
|
-
this.handleChange = (event) => {
|
|
17
|
-
this.valueChanged.emit(this.value);
|
|
18
|
-
};
|
|
19
|
-
this.value = undefined;
|
|
20
|
-
this.size = 'md';
|
|
21
|
-
this.variant = 'full';
|
|
22
|
-
this.disabled = false;
|
|
23
|
-
}
|
|
24
|
-
valueChange() {
|
|
25
|
-
this.valueInput.emit(this.value);
|
|
26
|
-
}
|
|
27
|
-
render() {
|
|
28
|
-
var _a;
|
|
29
|
-
return (h(Host, null, h("div", { class: classnames('wrapper', this.variant, this.size) }, 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" })))));
|
|
30
|
-
}
|
|
31
|
-
getDisplayedValue() {
|
|
32
|
-
var _a;
|
|
33
|
-
if (this.value != null && isValidHexColor(this.value)) {
|
|
34
|
-
return (_a = this.value) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase();
|
|
35
|
-
}
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
static get watchers() { return {
|
|
39
|
-
"value": ["valueChange"]
|
|
40
|
-
}; }
|
|
41
|
-
};
|
|
42
|
-
ColorPicker.style = colorPickerCss;
|
|
43
|
-
|
|
44
|
-
export { ColorPicker as C };
|