@vertexvis/ui 0.1.1 → 0.1.2-canary.1

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 (100) hide show
  1. package/dist/components/auto-resize-textarea.js +157 -0
  2. package/dist/components/color-swatch.js +124 -0
  3. package/dist/components/dom.js +13 -0
  4. package/dist/components/expandable.js +100 -0
  5. package/dist/components/icon-button.js +63 -0
  6. package/dist/components/icon-helper.js +722 -0
  7. package/dist/components/icon.js +43 -0
  8. package/dist/components/index.d.ts +71 -0
  9. package/dist/components/index.js +52 -0
  10. package/dist/components/index2.js +89 -0
  11. package/dist/components/menu.js +89 -0
  12. package/dist/components/popover.js +1737 -0
  13. package/dist/components/result-list.js +565 -0
  14. package/dist/components/slots.js +26 -0
  15. package/dist/components/text-field.js +171 -0
  16. package/dist/components/tooltip.js +360 -0
  17. package/dist/components/tslib.es6.js +65 -0
  18. package/dist/components/vertex-auto-resize-textarea.d.ts +11 -0
  19. package/dist/components/vertex-auto-resize-textarea.js +6 -0
  20. package/dist/components/vertex-avatar-group.d.ts +11 -0
  21. package/dist/components/vertex-avatar-group.js +34 -0
  22. package/dist/components/vertex-avatar.d.ts +11 -0
  23. package/dist/components/vertex-avatar.js +68 -0
  24. package/dist/components/vertex-badge.d.ts +11 -0
  25. package/dist/components/vertex-badge.js +43 -0
  26. package/dist/components/vertex-banner.d.ts +11 -0
  27. package/dist/components/vertex-banner.js +141 -0
  28. package/dist/components/vertex-button.d.ts +11 -0
  29. package/dist/components/vertex-button.js +96 -0
  30. package/dist/components/vertex-card-group.d.ts +11 -0
  31. package/dist/components/vertex-card-group.js +51 -0
  32. package/dist/components/vertex-card.d.ts +11 -0
  33. package/dist/components/vertex-card.js +49 -0
  34. package/dist/components/vertex-chip.d.ts +11 -0
  35. package/dist/components/vertex-chip.js +45 -0
  36. package/dist/components/vertex-click-to-edit-textfield.d.ts +11 -0
  37. package/dist/components/vertex-click-to-edit-textfield.js +156 -0
  38. package/dist/components/vertex-collapsible.d.ts +11 -0
  39. package/dist/components/vertex-collapsible.js +63 -0
  40. package/dist/components/vertex-color-circle-picker.d.ts +11 -0
  41. package/dist/components/vertex-color-circle-picker.js +104 -0
  42. package/dist/components/vertex-color-picker.d.ts +11 -0
  43. package/dist/components/vertex-color-picker.js +75 -0
  44. package/dist/components/vertex-color-swatch.d.ts +11 -0
  45. package/dist/components/vertex-color-swatch.js +6 -0
  46. package/dist/components/vertex-context-menu.d.ts +11 -0
  47. package/dist/components/vertex-context-menu.js +125 -0
  48. package/dist/components/vertex-dialog.d.ts +11 -0
  49. package/dist/components/vertex-dialog.js +263 -0
  50. package/dist/components/vertex-draggable-popover.d.ts +11 -0
  51. package/dist/components/vertex-draggable-popover.js +119 -0
  52. package/dist/components/vertex-dropdown-menu.d.ts +11 -0
  53. package/dist/components/vertex-dropdown-menu.js +64 -0
  54. package/dist/components/vertex-expandable.d.ts +11 -0
  55. package/dist/components/vertex-expandable.js +6 -0
  56. package/dist/components/vertex-help-tooltip.d.ts +11 -0
  57. package/dist/components/vertex-help-tooltip.js +67 -0
  58. package/dist/components/vertex-icon-button.d.ts +11 -0
  59. package/dist/components/vertex-icon-button.js +6 -0
  60. package/dist/components/vertex-icon.d.ts +11 -0
  61. package/dist/components/vertex-icon.js +6 -0
  62. package/dist/components/vertex-logo-loading.d.ts +11 -0
  63. package/dist/components/vertex-logo-loading.js +34 -0
  64. package/dist/components/vertex-menu-divider.d.ts +11 -0
  65. package/dist/components/vertex-menu-divider.js +34 -0
  66. package/dist/components/vertex-menu-item.d.ts +11 -0
  67. package/dist/components/vertex-menu-item.js +44 -0
  68. package/dist/components/vertex-menu.d.ts +11 -0
  69. package/dist/components/vertex-menu.js +6 -0
  70. package/dist/components/vertex-popover.d.ts +11 -0
  71. package/dist/components/vertex-popover.js +6 -0
  72. package/dist/components/vertex-radio-group.d.ts +11 -0
  73. package/dist/components/vertex-radio-group.js +88 -0
  74. package/dist/components/vertex-radio.d.ts +11 -0
  75. package/dist/components/vertex-radio.js +56 -0
  76. package/dist/components/vertex-resizable.d.ts +11 -0
  77. package/dist/components/vertex-resizable.js +445 -0
  78. package/dist/components/vertex-result-list.d.ts +11 -0
  79. package/dist/components/vertex-result-list.js +6 -0
  80. package/dist/components/vertex-search-bar.d.ts +11 -0
  81. package/dist/components/vertex-search-bar.js +568 -0
  82. package/dist/components/vertex-select.d.ts +11 -0
  83. package/dist/components/vertex-select.js +200 -0
  84. package/dist/components/vertex-slider.d.ts +11 -0
  85. package/dist/components/vertex-slider.js +81 -0
  86. package/dist/components/vertex-spinner.d.ts +11 -0
  87. package/dist/components/vertex-spinner.js +49 -0
  88. package/dist/components/vertex-tab.d.ts +11 -0
  89. package/dist/components/vertex-tab.js +46 -0
  90. package/dist/components/vertex-tabs.d.ts +11 -0
  91. package/dist/components/vertex-tabs.js +133 -0
  92. package/dist/components/vertex-textfield.d.ts +11 -0
  93. package/dist/components/vertex-textfield.js +6 -0
  94. package/dist/components/vertex-toast.d.ts +11 -0
  95. package/dist/components/vertex-toast.js +127 -0
  96. package/dist/components/vertex-toggle.d.ts +11 -0
  97. package/dist/components/vertex-toggle.js +67 -0
  98. package/dist/components/vertex-tooltip.d.ts +11 -0
  99. package/dist/components/vertex-tooltip.js +6 -0
  100. package/package.json +2 -2
@@ -0,0 +1,157 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host, readTask } from '@stencil/core/internal/client';
2
+ import { g as getFirstSlottedElement } from './slots.js';
3
+
4
+ function isTextareaElement(el) {
5
+ return (el === null || el === void 0 ? void 0 : el.tagName) === 'TEXTAREA';
6
+ }
7
+
8
+ const autoResizeTextareaCss = ":host{position:relative;width:100%;height:100%;font-size:0}.hidden-text{position:absolute;box-sizing:border-box;top:0;left:0;height:0;width:100%;padding:0;margin:0;border:none;visibility:hidden;pointer-events:none;overflow:hidden}";
9
+
10
+ const AutoResizeTextArea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
11
+ constructor() {
12
+ super();
13
+ this.__registerHost();
14
+ this.__attachShadow();
15
+ this.previousScrollTop = 0;
16
+ this.rowCount = 0;
17
+ this.textareaSelector = undefined;
18
+ this.initialValue = undefined;
19
+ this.minRows = 1;
20
+ this.maxRows = undefined;
21
+ this.textValue = undefined;
22
+ this.prepareHiddenTextElement = this.prepareHiddenTextElement.bind(this);
23
+ this.updateScrollTop = this.updateScrollTop.bind(this);
24
+ this.computeRowHeights = this.computeRowHeights.bind(this);
25
+ this.updateValue = this.updateValue.bind(this);
26
+ this.updatePreviousScrollTop = this.updatePreviousScrollTop.bind(this);
27
+ this.updateOverflow = this.updateOverflow.bind(this);
28
+ this.resizeObserver = new ResizeObserver(this.computeRowHeights);
29
+ }
30
+ componentWillLoad() {
31
+ this.computeRowHeights();
32
+ }
33
+ componentDidLoad() {
34
+ this.slottedElement = this.getSlottedTextareaElement();
35
+ this.textValue = this.initialValue;
36
+ this.prepareHiddenTextElement();
37
+ this.computeRowHeights();
38
+ if (this.slottedElement != null) {
39
+ this.resizeObserver.observe(this.slottedElement);
40
+ this.addEventListener();
41
+ }
42
+ }
43
+ componentDidRender() {
44
+ // This re-computes the number of rows after a rerender has
45
+ // rendered the current value to the hidden textarea.
46
+ this.computeRowHeights();
47
+ }
48
+ disconnectedCallback() {
49
+ this.removeEventListener();
50
+ this.resizeObserver.disconnect();
51
+ }
52
+ render() {
53
+ return (h(Host, null, h("textarea", { class: "hidden-text", ref: (el) => {
54
+ this.hiddenTextRef = el;
55
+ } }, this.textValue), h("slot", null)));
56
+ }
57
+ addEventListener() {
58
+ var _a, _b;
59
+ (_a = this.slottedElement) === null || _a === void 0 ? void 0 : _a.addEventListener('input', this.updateValue);
60
+ (_b = this.slottedElement) === null || _b === void 0 ? void 0 : _b.addEventListener('keydown', this.updatePreviousScrollTop);
61
+ }
62
+ removeEventListener() {
63
+ var _a, _b;
64
+ (_a = this.slottedElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('input', this.updateValue);
65
+ (_b = this.slottedElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('keydown', this.updatePreviousScrollTop);
66
+ }
67
+ updateValue() {
68
+ if (this.slottedElement != null) {
69
+ this.textValue = this.slottedElement.value;
70
+ this.updateOverflow();
71
+ }
72
+ }
73
+ updatePreviousScrollTop() {
74
+ if (this.slottedElement != null) {
75
+ this.previousScrollTop = this.slottedElement.scrollTop;
76
+ }
77
+ }
78
+ updateScrollTop() {
79
+ if (this.slottedElement != null) {
80
+ // This prevents an issue where the slotted textarea auto-scrolls
81
+ // to a newline. This is desired behavior if we're capped at the
82
+ // max rows, but undesired if the component will continue to expand.
83
+ this.slottedElement.scrollTop =
84
+ this.maxRows == null || this.rowCount >= this.maxRows
85
+ ? this.slottedElement.scrollTop
86
+ : this.previousScrollTop;
87
+ }
88
+ }
89
+ computeRowHeights() {
90
+ this.updateScrollTop();
91
+ readTask(() => {
92
+ var _a;
93
+ if (typeof window !== 'undefined' &&
94
+ this.slottedElement != null &&
95
+ this.hiddenTextRef != null) {
96
+ const computedStyles = window.getComputedStyle(this.slottedElement);
97
+ const lineHeight = Math.floor(parseFloat(computedStyles.lineHeight));
98
+ const totalRows = Math.floor(this.hiddenTextRef.scrollHeight / lineHeight);
99
+ this.rowCount = Math.max(this.minRows, Math.min((_a = this.maxRows) !== null && _a !== void 0 ? _a : totalRows, totalRows));
100
+ this.slottedElement.rows = this.rowCount;
101
+ this.updateOverflow();
102
+ }
103
+ });
104
+ }
105
+ prepareHiddenTextElement() {
106
+ readTask(() => {
107
+ if (typeof window !== 'undefined' &&
108
+ this.slottedElement != null &&
109
+ this.hiddenTextRef != null) {
110
+ const computedStyles = window.getComputedStyle(this.slottedElement);
111
+ this.hiddenTextRef.setAttribute('style', `line-height: ${computedStyles.lineHeight}; font-size: ${computedStyles.fontSize}; font-family: ${computedStyles.fontFamily}; padding-left: ${computedStyles.paddingLeft}; padding-right: ${computedStyles.paddingRight};`);
112
+ }
113
+ });
114
+ }
115
+ getSlottedTextareaElement() {
116
+ const el = getFirstSlottedElement({
117
+ hostElement: this.hostElement,
118
+ selector: this.textareaSelector,
119
+ });
120
+ if (isTextareaElement(el)) {
121
+ return el;
122
+ }
123
+ else {
124
+ throw new Error('The vertex-auto-resize-textarea component is only compatible with `HTMLTextAreaElement`s');
125
+ }
126
+ }
127
+ updateOverflow() {
128
+ var _a;
129
+ (_a = this.slottedElement) === null || _a === void 0 ? void 0 : _a.setAttribute('style', this.maxRows && this.rowCount >= this.maxRows
130
+ ? 'overflow-y: auto;'
131
+ : 'overflow: hidden;');
132
+ }
133
+ get hostElement() { return this; }
134
+ static get style() { return autoResizeTextareaCss; }
135
+ }, [1, "vertex-auto-resize-textarea", {
136
+ "textareaSelector": [1, "textarea-selector"],
137
+ "initialValue": [1, "initial-value"],
138
+ "minRows": [514, "min-rows"],
139
+ "maxRows": [514, "max-rows"],
140
+ "textValue": [32]
141
+ }]);
142
+ function defineCustomElement() {
143
+ if (typeof customElements === "undefined") {
144
+ return;
145
+ }
146
+ const components = ["vertex-auto-resize-textarea"];
147
+ components.forEach(tagName => { switch (tagName) {
148
+ case "vertex-auto-resize-textarea":
149
+ if (!customElements.get(tagName)) {
150
+ customElements.define(tagName, AutoResizeTextArea);
151
+ }
152
+ break;
153
+ } });
154
+ }
155
+ defineCustomElement();
156
+
157
+ export { AutoResizeTextArea as A, defineCustomElement as d };
@@ -0,0 +1,124 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { c as classnames } from './index2.js';
3
+
4
+ const hexRegex = /^(#|0x)?([A-Fa-f0-9]{6})$/;
5
+ function isValidHexColor(color) {
6
+ const match = color != null ? hexRegex.exec(color) : undefined;
7
+ return match != null && match.length > 0;
8
+ }
9
+
10
+ const colorSwatchCss = ":host{display:flex}.root{position:relative;border-style:solid;border-color:var(--vertex-ui-neutral-300);box-sizing:border-box}.root.circle{border-width:2px;border-radius:100%}.root.square{border-width:1px;border-radius:3px}.root.sm{width:16px;height:16px}.root.md{width:20px;height:20px}.root.lg{width:24px;height:24px}.overlay{position:absolute;width:100%;height:100%;border-radius:2px;overflow:hidden}";
11
+
12
+ const ColorSwatch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
+ constructor() {
14
+ super();
15
+ this.__registerHost();
16
+ this.__attachShadow();
17
+ this.variant = 'circle';
18
+ this.size = 'md';
19
+ this.color = '#ffffff';
20
+ this.supplementalColor = undefined;
21
+ this.theme = 'none';
22
+ this.lightenPercentage = 0.25;
23
+ this.darkenPercentage = 0.25;
24
+ this.lightened = this.adjustColor(this.color, -this.lightenPercentage);
25
+ this.darkened = this.adjustColor(this.color, this.darkenPercentage);
26
+ }
27
+ handleColorChanged(newColor) {
28
+ this.lightened = this.adjustColor(newColor, -this.lightenPercentage);
29
+ this.darkened = this.adjustColor(newColor, this.darkenPercentage);
30
+ }
31
+ handleLightenPercentageChanged(newPercentage) {
32
+ this.lightened = this.adjustColor(this.color, -newPercentage);
33
+ }
34
+ handleDarkenPercentageChanged(newPercentage) {
35
+ this.darkened = this.adjustColor(this.color, newPercentage);
36
+ }
37
+ render() {
38
+ return (h(Host, null, h("div", { class: classnames('root', this.variant, this.size), style: this.getThemeColors() }, h("div", { class: "overlay" }, h("slot", { name: "overlay" })))));
39
+ }
40
+ getThemeColors() {
41
+ const supplementalColor = this.getSupplementalColor();
42
+ switch (this.theme) {
43
+ case 'light':
44
+ return {
45
+ backgroundColor: supplementalColor,
46
+ borderColor: this.color,
47
+ };
48
+ case 'dark':
49
+ return {
50
+ backgroundColor: this.color,
51
+ borderColor: supplementalColor,
52
+ };
53
+ default:
54
+ return {
55
+ backgroundColor: this.color,
56
+ borderColor: supplementalColor !== null && supplementalColor !== void 0 ? supplementalColor : undefined,
57
+ };
58
+ }
59
+ }
60
+ getSupplementalColor() {
61
+ const providedSupplementalColor = this.supplementalColor != null && this.supplementalColor.length > 0
62
+ ? this.supplementalColor
63
+ : undefined;
64
+ switch (this.theme) {
65
+ case 'light':
66
+ return providedSupplementalColor !== null && providedSupplementalColor !== void 0 ? providedSupplementalColor : this.lightened;
67
+ case 'dark':
68
+ return providedSupplementalColor !== null && providedSupplementalColor !== void 0 ? providedSupplementalColor : this.darkened;
69
+ default:
70
+ return providedSupplementalColor;
71
+ }
72
+ }
73
+ adjustColor(color, percentage) {
74
+ if (isValidHexColor(color)) {
75
+ const r = Number(`0x${color.slice(1, 3)}`);
76
+ const g = Number(`0x${color.slice(3, 5)}`);
77
+ const b = Number(`0x${color.slice(5, 7)}`);
78
+ const rPadded = this.padHexComponent(this.adjustComponent(r, percentage).toString(16));
79
+ const gPadded = this.padHexComponent(this.adjustComponent(g, percentage).toString(16));
80
+ const bPadded = this.padHexComponent(this.adjustComponent(b, percentage).toString(16));
81
+ return `#${rPadded}${gPadded}${bPadded}`;
82
+ }
83
+ return color;
84
+ }
85
+ adjustComponent(component, percentage) {
86
+ const scalar = percentage < 0 ? 0xff - component : 0xff;
87
+ return Math.max(0x00, Math.min(0xff, Math.floor(component - Math.floor(scalar * percentage))));
88
+ }
89
+ padHexComponent(hex) {
90
+ return `${'0'.repeat(2 - hex.length)}${hex}`;
91
+ }
92
+ static get watchers() { return {
93
+ "color": ["handleColorChanged"],
94
+ "lightenPercentage": ["handleLightenPercentageChanged"],
95
+ "darkenPercentage": ["handleDarkenPercentageChanged"]
96
+ }; }
97
+ static get style() { return colorSwatchCss; }
98
+ }, [1, "vertex-color-swatch", {
99
+ "variant": [513],
100
+ "size": [513],
101
+ "color": [513],
102
+ "supplementalColor": [513, "supplemental-color"],
103
+ "theme": [513],
104
+ "lightenPercentage": [2, "lighten-percentage"],
105
+ "darkenPercentage": [2, "darken-percentage"],
106
+ "lightened": [1537],
107
+ "darkened": [1537]
108
+ }]);
109
+ function defineCustomElement() {
110
+ if (typeof customElements === "undefined") {
111
+ return;
112
+ }
113
+ const components = ["vertex-color-swatch"];
114
+ components.forEach(tagName => { switch (tagName) {
115
+ case "vertex-color-swatch":
116
+ if (!customElements.get(tagName)) {
117
+ customElements.define(tagName, ColorSwatch);
118
+ }
119
+ break;
120
+ } });
121
+ }
122
+ defineCustomElement();
123
+
124
+ export { ColorSwatch as C, defineCustomElement as d, isValidHexColor as i };
@@ -0,0 +1,13 @@
1
+ import { readTask } from '@stencil/core/internal/client';
2
+
3
+ function readDOM(callback) {
4
+ readTask(callback);
5
+ }
6
+ function getBoundingClientRect(el) {
7
+ return el.getBoundingClientRect();
8
+ }
9
+ function blurElement(el) {
10
+ el.blur();
11
+ }
12
+
13
+ export { blurElement as b, getBoundingClientRect as g, readDOM as r };
@@ -0,0 +1,100 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, readTask, h, Host } from '@stencil/core/internal/client';
2
+ import { c as classnames } from './index2.js';
3
+ import { d as defineCustomElement$1 } from './icon-button.js';
4
+
5
+ const expandableCss = ":host{display:flex}.content{display:flex;flex-direction:column;transition:height 1s}.icon-container{display:flex;flex-direction:column}.icon-button{display:flex;align-items:center}.expanded-content{overflow:hidden}.expanded-content.animated{transition-property:max-height;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms;transform-origin:top}";
6
+
7
+ const Expandable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.expand = createEvent(this, "expand", 7);
13
+ this.collapse = createEvent(this, "collapse", 7);
14
+ this.handleTransitionEnd = () => {
15
+ this.collapsing = false;
16
+ this.expanding = false;
17
+ };
18
+ this.handleExpand = () => {
19
+ this.expanded = !this.expanded;
20
+ if (this.expanded) {
21
+ this.expanding = true;
22
+ this.expand.emit();
23
+ }
24
+ else {
25
+ this.collapsing = true;
26
+ this.collapse.emit();
27
+ }
28
+ };
29
+ this.updateScrollHeight = () => {
30
+ readTask(() => {
31
+ var _a;
32
+ const scrollHeight = (_a = this.expandContainer) === null || _a === void 0 ? void 0 : _a.scrollHeight;
33
+ if (this.contentScrollHeight !== scrollHeight) {
34
+ this.contentScrollHeight = scrollHeight;
35
+ }
36
+ });
37
+ };
38
+ this.getMaxHeight = () => {
39
+ if (this.expanded) {
40
+ return `${this.contentScrollHeight}px`;
41
+ }
42
+ else if (!this.expanded) {
43
+ return '0';
44
+ }
45
+ return undefined;
46
+ };
47
+ this.expanded = false;
48
+ this.expanding = false;
49
+ this.collapsing = false;
50
+ this.controlled = false;
51
+ this.expandType = 'content';
52
+ this.animated = true;
53
+ this.contentScrollHeight = undefined;
54
+ }
55
+ componentDidLoad() {
56
+ this.updateScrollHeight();
57
+ }
58
+ componentDidRender() {
59
+ this.updateScrollHeight();
60
+ }
61
+ render() {
62
+ return (h(Host, null, h("div", { class: "content" }, this.expandType === 'content' && h("slot", { name: "header" }), h("div", { class: classnames('expanded-content', {
63
+ animated: this.animated,
64
+ }), ref: (el) => {
65
+ this.expandContainer = el;
66
+ }, style: {
67
+ maxHeight: this.getMaxHeight(),
68
+ }, onTransitionEnd: this.handleTransitionEnd }, this.expandType === 'header' ? (h("slot", { name: "header", onSlotchange: this.updateScrollHeight })) : (h("slot", { onSlotchange: this.updateScrollHeight }))), this.expandType === 'header' && h("slot", null)), !this.controlled ? (h("div", { class: "icon-container", onClick: this.handleExpand }, h("slot", { name: "expand-icon" }, h("vertex-icon-button", { class: "icon-button", variant: "plain", iconSize: "sm", iconName: this.expanded ? 'caret-down' : 'caret-up' })))) : (h("slot", { name: "expand-icon" }))));
69
+ }
70
+ static get style() { return expandableCss; }
71
+ }, [1, "vertex-expandable", {
72
+ "expanded": [1540],
73
+ "expanding": [1540],
74
+ "collapsing": [1540],
75
+ "controlled": [516],
76
+ "expandType": [513, "expand-type"],
77
+ "animated": [4],
78
+ "contentScrollHeight": [32]
79
+ }]);
80
+ function defineCustomElement() {
81
+ if (typeof customElements === "undefined") {
82
+ return;
83
+ }
84
+ const components = ["vertex-expandable", "vertex-icon-button"];
85
+ components.forEach(tagName => { switch (tagName) {
86
+ case "vertex-expandable":
87
+ if (!customElements.get(tagName)) {
88
+ customElements.define(tagName, Expandable);
89
+ }
90
+ break;
91
+ case "vertex-icon-button":
92
+ if (!customElements.get(tagName)) {
93
+ defineCustomElement$1();
94
+ }
95
+ break;
96
+ } });
97
+ }
98
+ defineCustomElement();
99
+
100
+ export { Expandable as E, defineCustomElement as d };
@@ -0,0 +1,63 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { c as classnames } from './index2.js';
3
+ import { g as getSvg } from './icon-helper.js';
4
+
5
+ const iconButtonCss = "button{border:none;background-color:transparent;font-family:var(--vertex-ui-font-family);font-size:0.875rem;padding:0}:host{--enabled-cursor:pointer;--disabled-cursor:not-allowed;--hover-background-color:var(--vertex-ui-neutral-300);--active-background-color:var(--vertex-ui-neutral-400);--focus-background-color:var(--vertex-ui-neutral-400);--hover-box-shadow:0 2px 2px rgb(0 0 0 / 20%);--active-box-shadow:none;--focus-box-shadow:0 0 0 1px var(--vertex-ui-neutral-900);--icon-margin:0px}.container{display:flex;justify-content:center;align-items:center;outline:none;fill:currentColor;color:currentColor;cursor:var(--enabled-cursor)}.container:not(.plain){border-radius:4px;padding:0.25rem}.icon-button{display:flex;position:relative;justify-content:center;align-items:center;fill:currentColor;height:var(--icon-size, 1.5rem);width:var(--icon-size, 1.5rem)}.icon-button svg{width:100%;height:100%;margin:var(--icon-margin, 0px)}.badge{position:absolute;top:0px;right:4px;justify-content:flex-end;align-items:flex-end}.floating{background-color:var(--vertex-ui-neutral-100);box-shadow:var(--vertex-ui-overlay-shadow);color:var(--vertex-ui-neutral-700);fill:var(--vertex-ui-neutral-700);opacity:0.95}.floating.disabled{color:var(--vertex-ui-neutral-400);cursor:var(--disabled-cursor)}.container:not(.disabled):not(.plain):hover{background-color:var(--hover-background-color);box-shadow:var(--hover-box-shadow)}.container:not(.disabled):not(.plain):active{background-color:var(--active-background-color);box-shadow:var(--active-box-shadow)}.container:not(.disabled):not(.plain):focus-visible{background-color:var(--focus-background-color);box-shadow:var(--focus-box-shadow);color:var(--vertex-ui-neutral-900)}.container.disabled:not(.floating){cursor:var(--disabled-cursor);color:var(--vertex-ui-neutral-400)}.container.primary:not(.disabled){color:var(--vertex-ui-blue-700)}.container.secondary:not(.disabled){color:var(--vertex-ui-neutral-800)}.xs{height:var(--icon-size, 0.75rem);width:var(--icon-size, 0.75rem)}.sm{height:var(--icon-size, 1rem);width:var(--icon-size, 1rem)}.md{height:var(--icon-size, 1.5rem);width:var(--icon-size, 1.5rem)}.lg{height:var(--icon-size, 2rem);width:var(--icon-size, 2rem)}";
6
+
7
+ const IconButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.iconName = undefined;
13
+ this.disabled = undefined;
14
+ this.variant = 'default';
15
+ this.iconColor = 'default';
16
+ this.iconSize = 'md';
17
+ }
18
+ render() {
19
+ return (h(Host, { onClick: (e) => this.handleClick(e) }, h("button", { ref: (el) => (this.buttonEl = el), disabled: this.disabled, class: classnames('container', {
20
+ disabled: this.disabled,
21
+ floating: this.variant === 'floating',
22
+ plain: this.variant === 'plain',
23
+ primary: this.iconColor === 'primary',
24
+ secondary: this.iconColor === 'secondary',
25
+ }) }, h("slot", { name: "left" }), h("div", { class: classnames('icon-button', {
26
+ xs: this.iconSize === 'xs',
27
+ sm: this.iconSize === 'sm',
28
+ md: this.iconSize === 'md',
29
+ lg: this.iconSize === 'lg',
30
+ }) }, getSvg(this.iconName), h("div", { class: "badge" }, h("slot", { name: "badge" }))), h("slot", null))));
31
+ }
32
+ handleClick(event) {
33
+ var _a;
34
+ if (this.disabled) {
35
+ event.preventDefault();
36
+ event.stopPropagation();
37
+ }
38
+ (_a = this.buttonEl) === null || _a === void 0 ? void 0 : _a.blur();
39
+ }
40
+ static get style() { return iconButtonCss; }
41
+ }, [1, "vertex-icon-button", {
42
+ "iconName": [1, "icon-name"],
43
+ "disabled": [516],
44
+ "variant": [1],
45
+ "iconColor": [1, "icon-color"],
46
+ "iconSize": [1, "icon-size"]
47
+ }]);
48
+ function defineCustomElement() {
49
+ if (typeof customElements === "undefined") {
50
+ return;
51
+ }
52
+ const components = ["vertex-icon-button"];
53
+ components.forEach(tagName => { switch (tagName) {
54
+ case "vertex-icon-button":
55
+ if (!customElements.get(tagName)) {
56
+ customElements.define(tagName, IconButton);
57
+ }
58
+ break;
59
+ } });
60
+ }
61
+ defineCustomElement();
62
+
63
+ export { IconButton as I, defineCustomElement as d };