@evoke-tech/stencil-ui-kit 0.0.0-stage → 0.2.0

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 (144) hide show
  1. package/README.md +314 -2
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  3. package/dist/cjs/evoke-alert_20.cjs.entry.js +1047 -0
  4. package/dist/cjs/evoke-ui.cjs.js +25 -0
  5. package/dist/cjs/index-BpJ5gu8f.js +2130 -0
  6. package/dist/cjs/index.cjs.js +2 -0
  7. package/dist/cjs/loader.cjs.js +13 -0
  8. package/dist/collection/collection-manifest.json +32 -0
  9. package/dist/collection/components/evoke-alert/evoke-alert.css +18 -0
  10. package/dist/collection/components/evoke-alert/evoke-alert.js +107 -0
  11. package/dist/collection/components/evoke-app-bar/evoke-app-bar.css +13 -0
  12. package/dist/collection/components/evoke-app-bar/evoke-app-bar.js +94 -0
  13. package/dist/collection/components/evoke-badge/evoke-badge.css +13 -0
  14. package/dist/collection/components/evoke-badge/evoke-badge.js +162 -0
  15. package/dist/collection/components/evoke-button/evoke-button.css +31 -0
  16. package/dist/collection/components/evoke-button/evoke-button.js +243 -0
  17. package/dist/collection/components/evoke-card/evoke-card.css +12 -0
  18. package/dist/collection/components/evoke-card/evoke-card.js +140 -0
  19. package/dist/collection/components/evoke-checkbox/evoke-checkbox.css +22 -0
  20. package/dist/collection/components/evoke-checkbox/evoke-checkbox.js +180 -0
  21. package/dist/collection/components/evoke-chip/evoke-chip.css +16 -0
  22. package/dist/collection/components/evoke-chip/evoke-chip.js +149 -0
  23. package/dist/collection/components/evoke-input/evoke-input.css +25 -0
  24. package/dist/collection/components/evoke-input/evoke-input.js +324 -0
  25. package/dist/collection/components/evoke-modal/evoke-modal.css +21 -0
  26. package/dist/collection/components/evoke-modal/evoke-modal.js +271 -0
  27. package/dist/collection/components/evoke-pagination/evoke-pagination.css +12 -0
  28. package/dist/collection/components/evoke-pagination/evoke-pagination.js +156 -0
  29. package/dist/collection/components/evoke-progress/evoke-progress.css +12 -0
  30. package/dist/collection/components/evoke-progress/evoke-progress.js +146 -0
  31. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.css +20 -0
  32. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.js +201 -0
  33. package/dist/collection/components/evoke-radio-group/evoke-radio-group.css +29 -0
  34. package/dist/collection/components/evoke-radio-group/evoke-radio-group.js +233 -0
  35. package/dist/collection/components/evoke-select/evoke-select.css +37 -0
  36. package/dist/collection/components/evoke-select/evoke-select.js +433 -0
  37. package/dist/collection/components/evoke-switch/evoke-switch.css +16 -0
  38. package/dist/collection/components/evoke-switch/evoke-switch.js +151 -0
  39. package/dist/collection/components/evoke-table/evoke-table.css +20 -0
  40. package/dist/collection/components/evoke-table/evoke-table.js +222 -0
  41. package/dist/collection/components/evoke-tabs/evoke-tabs.css +20 -0
  42. package/dist/collection/components/evoke-tabs/evoke-tabs.js +179 -0
  43. package/dist/collection/components/evoke-textarea/evoke-textarea.css +19 -0
  44. package/dist/collection/components/evoke-textarea/evoke-textarea.js +328 -0
  45. package/dist/collection/components/evoke-toast/evoke-toast.css +24 -0
  46. package/dist/collection/components/evoke-toast/evoke-toast.js +225 -0
  47. package/dist/collection/components/evoke-tooltip/evoke-tooltip.css +22 -0
  48. package/dist/collection/components/evoke-tooltip/evoke-tooltip.js +119 -0
  49. package/dist/collection/index.js +1 -0
  50. package/dist/collection/utils/icons.js +29 -0
  51. package/dist/collection/utils/options.js +12 -0
  52. package/dist/components/evoke-alert.d.ts +11 -0
  53. package/dist/components/evoke-alert.js +1 -0
  54. package/dist/components/evoke-app-bar.d.ts +11 -0
  55. package/dist/components/evoke-app-bar.js +1 -0
  56. package/dist/components/evoke-badge.d.ts +11 -0
  57. package/dist/components/evoke-badge.js +1 -0
  58. package/dist/components/evoke-button.d.ts +11 -0
  59. package/dist/components/evoke-button.js +1 -0
  60. package/dist/components/evoke-card.d.ts +11 -0
  61. package/dist/components/evoke-card.js +1 -0
  62. package/dist/components/evoke-checkbox.d.ts +11 -0
  63. package/dist/components/evoke-checkbox.js +1 -0
  64. package/dist/components/evoke-chip.d.ts +11 -0
  65. package/dist/components/evoke-chip.js +1 -0
  66. package/dist/components/evoke-input.d.ts +11 -0
  67. package/dist/components/evoke-input.js +1 -0
  68. package/dist/components/evoke-modal.d.ts +11 -0
  69. package/dist/components/evoke-modal.js +1 -0
  70. package/dist/components/evoke-pagination.d.ts +11 -0
  71. package/dist/components/evoke-pagination.js +1 -0
  72. package/dist/components/evoke-progress.d.ts +11 -0
  73. package/dist/components/evoke-progress.js +1 -0
  74. package/dist/components/evoke-quantity-stepper.d.ts +11 -0
  75. package/dist/components/evoke-quantity-stepper.js +1 -0
  76. package/dist/components/evoke-radio-group.d.ts +11 -0
  77. package/dist/components/evoke-radio-group.js +1 -0
  78. package/dist/components/evoke-select.d.ts +11 -0
  79. package/dist/components/evoke-select.js +1 -0
  80. package/dist/components/evoke-switch.d.ts +11 -0
  81. package/dist/components/evoke-switch.js +1 -0
  82. package/dist/components/evoke-table.d.ts +11 -0
  83. package/dist/components/evoke-table.js +1 -0
  84. package/dist/components/evoke-tabs.d.ts +11 -0
  85. package/dist/components/evoke-tabs.js +1 -0
  86. package/dist/components/evoke-textarea.d.ts +11 -0
  87. package/dist/components/evoke-textarea.js +1 -0
  88. package/dist/components/evoke-toast.d.ts +11 -0
  89. package/dist/components/evoke-toast.js +1 -0
  90. package/dist/components/evoke-tooltip.d.ts +11 -0
  91. package/dist/components/evoke-tooltip.js +1 -0
  92. package/dist/components/icons.js +1 -0
  93. package/dist/components/index.d.ts +35 -0
  94. package/dist/components/index.js +1 -0
  95. package/dist/components/options.js +1 -0
  96. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  97. package/dist/esm/evoke-alert_20.entry.js +1026 -0
  98. package/dist/esm/evoke-ui.js +21 -0
  99. package/dist/esm/index-C-5sEjU8.js +2122 -0
  100. package/dist/esm/index.js +1 -0
  101. package/dist/esm/loader.js +11 -0
  102. package/dist/evoke-ui/evoke-ui.css +1 -0
  103. package/dist/evoke-ui/evoke-ui.esm.js +1 -0
  104. package/dist/evoke-ui/index.esm.js +0 -0
  105. package/dist/evoke-ui/p-0841be89.entry.js +1 -0
  106. package/dist/evoke-ui/p-C-5sEjU8.js +3 -0
  107. package/dist/evoke-ui/p-DQuL1Twl.js +1 -0
  108. package/dist/index.cjs.js +1 -0
  109. package/dist/index.js +1 -0
  110. package/dist/themes/bootstrap.css +26 -0
  111. package/dist/themes/material.css +24 -0
  112. package/dist/themes/tailwind.css +27 -0
  113. package/dist/themes/tokens.css +29 -0
  114. package/dist/types/components/evoke-alert/evoke-alert.d.ts +10 -0
  115. package/dist/types/components/evoke-app-bar/evoke-app-bar.d.ts +14 -0
  116. package/dist/types/components/evoke-badge/evoke-badge.d.ts +17 -0
  117. package/dist/types/components/evoke-button/evoke-button.d.ts +21 -0
  118. package/dist/types/components/evoke-card/evoke-card.d.ts +15 -0
  119. package/dist/types/components/evoke-checkbox/evoke-checkbox.d.ts +18 -0
  120. package/dist/types/components/evoke-chip/evoke-chip.d.ts +14 -0
  121. package/dist/types/components/evoke-input/evoke-input.d.ts +27 -0
  122. package/dist/types/components/evoke-modal/evoke-modal.d.ts +32 -0
  123. package/dist/types/components/evoke-pagination/evoke-pagination.d.ts +15 -0
  124. package/dist/types/components/evoke-progress/evoke-progress.d.ts +13 -0
  125. package/dist/types/components/evoke-quantity-stepper/evoke-quantity-stepper.d.ts +18 -0
  126. package/dist/types/components/evoke-radio-group/evoke-radio-group.d.ts +20 -0
  127. package/dist/types/components/evoke-select/evoke-select.d.ts +43 -0
  128. package/dist/types/components/evoke-switch/evoke-switch.d.ts +15 -0
  129. package/dist/types/components/evoke-table/evoke-table.d.ts +29 -0
  130. package/dist/types/components/evoke-tabs/evoke-tabs.d.ts +21 -0
  131. package/dist/types/components/evoke-textarea/evoke-textarea.d.ts +28 -0
  132. package/dist/types/components/evoke-toast/evoke-toast.d.ts +24 -0
  133. package/dist/types/components/evoke-tooltip/evoke-tooltip.d.ts +17 -0
  134. package/dist/types/components.d.ts +1876 -0
  135. package/dist/types/index.d.ts +2 -0
  136. package/dist/types/stencil-public-runtime.d.ts +1879 -0
  137. package/dist/types/utils/icons.d.ts +25 -0
  138. package/dist/types/utils/options.d.ts +7 -0
  139. package/loader/cdn.js +1 -0
  140. package/loader/index.cjs.js +1 -0
  141. package/loader/index.d.ts +24 -0
  142. package/loader/index.es2017.js +1 -0
  143. package/loader/index.js +2 -0
  144. package/package.json +65 -4
@@ -0,0 +1,433 @@
1
+ import { h } from "@stencil/core";
2
+ import { parseOptions } from "../../utils/options";
3
+ import { renderIcon } from "../../utils/icons";
4
+ export class EvokeSelect {
5
+ constructor() {
6
+ this.label = '';
7
+ /** Options as an array of { label, value, disabled? } or a JSON string of the same */
8
+ this.options = [];
9
+ /** Selected value (string), or an array of values when `multiple` */
10
+ this.value = '';
11
+ this.placeholder = 'Select an option';
12
+ /** Multi-select: selected values are shown as removable chips */
13
+ this.multiple = false;
14
+ /** Adds a search box that filters the options */
15
+ this.searchable = false;
16
+ this.disabled = false;
17
+ /** Error message shown below the field (replaces the hint) */
18
+ this.error = '';
19
+ this.hint = '';
20
+ /** Extra classes for the inner <select> (single, non-searchable mode), e.g. "form-select" */
21
+ this.selectClass = '';
22
+ this.isOpen = false;
23
+ this.query = '';
24
+ this.activeIndex = 0;
25
+ this.uid = Math.random().toString(36).slice(2, 9);
26
+ this.focusSearch = false;
27
+ this.onKeyDown = (e) => {
28
+ const list = this.filtered;
29
+ const onTrigger = e.target === this.triggerEl;
30
+ switch (e.key) {
31
+ case 'ArrowDown':
32
+ case 'ArrowUp': {
33
+ e.preventDefault();
34
+ if (!this.isOpen)
35
+ return this.openPanel();
36
+ const step = e.key === 'ArrowDown' ? 1 : -1;
37
+ this.activeIndex = Math.min(Math.max(this.activeIndex + step, 0), Math.max(list.length - 1, 0));
38
+ break;
39
+ }
40
+ case 'Home':
41
+ case 'End':
42
+ if (this.isOpen && !this.searchable) {
43
+ e.preventDefault();
44
+ this.activeIndex = e.key === 'Home' ? 0 : Math.max(list.length - 1, 0);
45
+ }
46
+ break;
47
+ case 'Enter':
48
+ case ' ':
49
+ if (e.key === ' ' && !onTrigger)
50
+ return; // allow typing spaces in the search box
51
+ e.preventDefault();
52
+ if (!this.isOpen)
53
+ return this.openPanel();
54
+ if (list[this.activeIndex])
55
+ this.toggle(list[this.activeIndex]);
56
+ break;
57
+ case 'Escape':
58
+ if (this.isOpen) {
59
+ e.preventDefault();
60
+ this.closePanel();
61
+ }
62
+ break;
63
+ case 'Tab':
64
+ if (this.isOpen)
65
+ this.closePanel(false);
66
+ break;
67
+ }
68
+ };
69
+ }
70
+ get selected() {
71
+ const v = this.value;
72
+ if (Array.isArray(v))
73
+ return v;
74
+ if (!v)
75
+ return [];
76
+ if (this.multiple) {
77
+ if (v.trim().startsWith('[')) {
78
+ try {
79
+ const parsed = JSON.parse(v);
80
+ if (Array.isArray(parsed))
81
+ return parsed.map(String);
82
+ }
83
+ catch ( /* fall through to comma list */_a) { /* fall through to comma list */ }
84
+ }
85
+ return v.split(',').map((s) => s.trim()).filter(Boolean);
86
+ }
87
+ return [v];
88
+ }
89
+ get filtered() {
90
+ const q = this.query.trim().toLowerCase();
91
+ const all = parseOptions(this.options);
92
+ return q ? all.filter((o) => o.label.toLowerCase().includes(q)) : all;
93
+ }
94
+ onDocClick(e) {
95
+ if (this.isOpen && !this.el.contains(e.target))
96
+ this.closePanel(false);
97
+ }
98
+ componentDidRender() {
99
+ var _a;
100
+ if (!this.isOpen)
101
+ return;
102
+ if (this.focusSearch && this.searchEl) {
103
+ this.focusSearch = false;
104
+ this.searchEl.focus();
105
+ }
106
+ (_a = this.el.querySelector('.evoke-select__option--active')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
107
+ }
108
+ openPanel() {
109
+ if (this.disabled)
110
+ return;
111
+ const first = this.filtered.findIndex((o) => this.selected.includes(o.value));
112
+ this.activeIndex = first >= 0 ? first : 0;
113
+ this.isOpen = true;
114
+ this.focusSearch = this.searchable;
115
+ }
116
+ closePanel(refocus = true) {
117
+ var _a;
118
+ this.isOpen = false;
119
+ this.query = '';
120
+ if (refocus)
121
+ (_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.focus();
122
+ }
123
+ commit(next) {
124
+ this.value = next;
125
+ this.evokeChange.emit(next);
126
+ }
127
+ toggle(o) {
128
+ if (o.disabled)
129
+ return;
130
+ if (this.multiple) {
131
+ const cur = this.selected;
132
+ this.commit(cur.includes(o.value) ? cur.filter((v) => v !== o.value) : [...cur, o.value]);
133
+ }
134
+ else {
135
+ this.commit(o.value);
136
+ this.closePanel();
137
+ }
138
+ }
139
+ removeChip(v) {
140
+ this.commit(this.selected.filter((x) => x !== v));
141
+ }
142
+ renderNative() {
143
+ var _a;
144
+ const selectId = `evoke-select-${this.uid}`;
145
+ const msgId = `${selectId}-msg`;
146
+ const cur = (_a = this.selected[0]) !== null && _a !== void 0 ? _a : '';
147
+ return (h("div", { class: "evoke-field__control" }, h("select", { id: selectId, class: `evoke-field__input evoke-field__select ${cur === '' ? 'evoke-field__select--empty' : ''} ${this.error ? 'evoke-field__input--error' : ''} ${this.selectClass}`.replace(/\s+/g, ' ').trim(), disabled: this.disabled, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.error || this.hint ? msgId : undefined, onChange: (e) => this.commit(e.target.value) }, h("option", { value: "", disabled: true, selected: cur === '' }, this.placeholder), parseOptions(this.options).map((o) => (h("option", { value: o.value, disabled: o.disabled, selected: o.value === cur }, o.label)))), renderIcon('chevron-down', 'evoke-field__chevron')));
148
+ }
149
+ renderCustom() {
150
+ const labelId = `evoke-select-${this.uid}-label`;
151
+ const listId = `evoke-select-${this.uid}-list`;
152
+ const msgId = `evoke-select-${this.uid}-msg`;
153
+ const all = parseOptions(this.options);
154
+ const sel = this.selected;
155
+ const list = this.filtered;
156
+ const labelOf = (v) => { var _a, _b; return (_b = (_a = all.find((o) => o.value === v)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : v; };
157
+ return (h("div", { class: "evoke-field__control", onKeyDown: this.onKeyDown }, h("div", { class: `evoke-select__trigger evoke-field__input ${this.error ? 'evoke-field__input--error' : ''} ${this.disabled ? 'evoke-select__trigger--disabled' : ''}`.trim(), role: "combobox", tabindex: this.disabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": listId, "aria-labelledby": this.label ? labelId : undefined, "aria-label": this.label ? undefined : this.placeholder, "aria-disabled": this.disabled ? 'true' : undefined, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.error || this.hint ? msgId : undefined, "aria-activedescendant": this.isOpen && list[this.activeIndex] ? `${listId}-${this.activeIndex}` : undefined, ref: (el) => (this.triggerEl = el), onClick: () => (this.isOpen ? this.closePanel() : this.openPanel()) }, h("span", { class: "evoke-select__value" }, sel.length === 0 && h("span", { class: "evoke-select__placeholder" }, this.placeholder), this.multiple
158
+ ? sel.map((v) => (h("span", { class: "evoke-select__chip" }, labelOf(v), h("button", { type: "button", class: "evoke-select__chip-remove", "aria-label": `Remove ${labelOf(v)}`, disabled: this.disabled, onClick: (e) => {
159
+ e.stopPropagation();
160
+ this.removeChip(v);
161
+ } }, renderIcon('x', 'evoke-icon')))))
162
+ : sel.length > 0 && h("span", null, labelOf(sel[0])))), renderIcon('chevron-down', 'evoke-field__chevron'), this.isOpen && (h("div", { class: "evoke-select__panel" }, this.searchable && (h("input", { class: "evoke-select__search", type: "text", placeholder: "Search\u2026", "aria-label": "Search options", "aria-controls": listId, "aria-activedescendant": list[this.activeIndex] ? `${listId}-${this.activeIndex}` : undefined, value: this.query, ref: (el) => (this.searchEl = el), onInput: (e) => {
163
+ this.query = e.target.value;
164
+ this.activeIndex = 0;
165
+ } })), h("ul", { id: listId, class: "evoke-select__list", role: "listbox", "aria-multiselectable": this.multiple ? 'true' : undefined, "aria-labelledby": this.label ? labelId : undefined }, list.map((o, i) => {
166
+ const isSel = sel.includes(o.value);
167
+ return (h("li", { id: `${listId}-${i}`, role: "option", "aria-selected": isSel ? 'true' : 'false', "aria-disabled": o.disabled ? 'true' : undefined, class: `evoke-select__option ${i === this.activeIndex ? 'evoke-select__option--active' : ''} ${isSel ? 'evoke-select__option--selected' : ''} ${o.disabled ? 'evoke-select__option--disabled' : ''}`.replace(/\s+/g, ' ').trim(), onMouseEnter: () => (this.activeIndex = i), onClick: () => this.toggle(o) }, h("span", null, o.label), isSel && renderIcon('check', 'evoke-icon')));
168
+ })), list.length === 0 && h("div", { class: "evoke-select__empty" }, "No results")))));
169
+ }
170
+ render() {
171
+ const labelId = `evoke-select-${this.uid}-label`;
172
+ const msgId = `evoke-select-${this.uid}-msg`;
173
+ const custom = this.multiple || this.searchable;
174
+ return (h("div", { key: '2bb9566731e91295db3e98b8934acee7d53bc0c7', class: "evoke-field" }, this.label && (h("label", { key: '2279b600e0770a516af752c309af43ba6fd28320', id: labelId, htmlFor: custom ? undefined : `evoke-select-${this.uid}`, class: "evoke-field__label" }, this.label)), custom ? this.renderCustom() : this.renderNative(), this.error ? (h("span", { id: msgId, class: "evoke-field__error", role: "alert" }, this.error)) : (this.hint && h("span", { id: msgId, class: "evoke-field__hint" }, this.hint))));
175
+ }
176
+ static get is() { return "evoke-select"; }
177
+ static get originalStyleUrls() {
178
+ return {
179
+ "$": ["evoke-select.css"]
180
+ };
181
+ }
182
+ static get styleUrls() {
183
+ return {
184
+ "$": ["evoke-select.css"]
185
+ };
186
+ }
187
+ static get properties() {
188
+ return {
189
+ "label": {
190
+ "type": "string",
191
+ "mutable": false,
192
+ "complexType": {
193
+ "original": "string",
194
+ "resolved": "string",
195
+ "references": {}
196
+ },
197
+ "required": false,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": ""
202
+ },
203
+ "getter": false,
204
+ "setter": false,
205
+ "reflect": false,
206
+ "attribute": "label",
207
+ "defaultValue": "''"
208
+ },
209
+ "options": {
210
+ "type": "string",
211
+ "mutable": false,
212
+ "complexType": {
213
+ "original": "EvokeOption[] | string",
214
+ "resolved": "EvokeOption[] | string",
215
+ "references": {
216
+ "EvokeOption": {
217
+ "location": "import",
218
+ "path": "../../utils/options",
219
+ "id": "src/utils/options.ts::EvokeOption",
220
+ "referenceLocation": "EvokeOption"
221
+ }
222
+ }
223
+ },
224
+ "required": false,
225
+ "optional": false,
226
+ "docs": {
227
+ "tags": [],
228
+ "text": "Options as an array of { label, value, disabled? } or a JSON string of the same"
229
+ },
230
+ "getter": false,
231
+ "setter": false,
232
+ "reflect": false,
233
+ "attribute": "options",
234
+ "defaultValue": "[]"
235
+ },
236
+ "value": {
237
+ "type": "string",
238
+ "mutable": true,
239
+ "complexType": {
240
+ "original": "string | string[]",
241
+ "resolved": "string | string[]",
242
+ "references": {}
243
+ },
244
+ "required": false,
245
+ "optional": false,
246
+ "docs": {
247
+ "tags": [],
248
+ "text": "Selected value (string), or an array of values when `multiple`"
249
+ },
250
+ "getter": false,
251
+ "setter": false,
252
+ "reflect": false,
253
+ "attribute": "value",
254
+ "defaultValue": "''"
255
+ },
256
+ "placeholder": {
257
+ "type": "string",
258
+ "mutable": false,
259
+ "complexType": {
260
+ "original": "string",
261
+ "resolved": "string",
262
+ "references": {}
263
+ },
264
+ "required": false,
265
+ "optional": false,
266
+ "docs": {
267
+ "tags": [],
268
+ "text": ""
269
+ },
270
+ "getter": false,
271
+ "setter": false,
272
+ "reflect": false,
273
+ "attribute": "placeholder",
274
+ "defaultValue": "'Select an option'"
275
+ },
276
+ "multiple": {
277
+ "type": "boolean",
278
+ "mutable": false,
279
+ "complexType": {
280
+ "original": "boolean",
281
+ "resolved": "boolean",
282
+ "references": {}
283
+ },
284
+ "required": false,
285
+ "optional": false,
286
+ "docs": {
287
+ "tags": [],
288
+ "text": "Multi-select: selected values are shown as removable chips"
289
+ },
290
+ "getter": false,
291
+ "setter": false,
292
+ "reflect": false,
293
+ "attribute": "multiple",
294
+ "defaultValue": "false"
295
+ },
296
+ "searchable": {
297
+ "type": "boolean",
298
+ "mutable": false,
299
+ "complexType": {
300
+ "original": "boolean",
301
+ "resolved": "boolean",
302
+ "references": {}
303
+ },
304
+ "required": false,
305
+ "optional": false,
306
+ "docs": {
307
+ "tags": [],
308
+ "text": "Adds a search box that filters the options"
309
+ },
310
+ "getter": false,
311
+ "setter": false,
312
+ "reflect": false,
313
+ "attribute": "searchable",
314
+ "defaultValue": "false"
315
+ },
316
+ "disabled": {
317
+ "type": "boolean",
318
+ "mutable": false,
319
+ "complexType": {
320
+ "original": "boolean",
321
+ "resolved": "boolean",
322
+ "references": {}
323
+ },
324
+ "required": false,
325
+ "optional": false,
326
+ "docs": {
327
+ "tags": [],
328
+ "text": ""
329
+ },
330
+ "getter": false,
331
+ "setter": false,
332
+ "reflect": false,
333
+ "attribute": "disabled",
334
+ "defaultValue": "false"
335
+ },
336
+ "error": {
337
+ "type": "string",
338
+ "mutable": false,
339
+ "complexType": {
340
+ "original": "string",
341
+ "resolved": "string",
342
+ "references": {}
343
+ },
344
+ "required": false,
345
+ "optional": false,
346
+ "docs": {
347
+ "tags": [],
348
+ "text": "Error message shown below the field (replaces the hint)"
349
+ },
350
+ "getter": false,
351
+ "setter": false,
352
+ "reflect": false,
353
+ "attribute": "error",
354
+ "defaultValue": "''"
355
+ },
356
+ "hint": {
357
+ "type": "string",
358
+ "mutable": false,
359
+ "complexType": {
360
+ "original": "string",
361
+ "resolved": "string",
362
+ "references": {}
363
+ },
364
+ "required": false,
365
+ "optional": false,
366
+ "docs": {
367
+ "tags": [],
368
+ "text": ""
369
+ },
370
+ "getter": false,
371
+ "setter": false,
372
+ "reflect": false,
373
+ "attribute": "hint",
374
+ "defaultValue": "''"
375
+ },
376
+ "selectClass": {
377
+ "type": "string",
378
+ "mutable": false,
379
+ "complexType": {
380
+ "original": "string",
381
+ "resolved": "string",
382
+ "references": {}
383
+ },
384
+ "required": false,
385
+ "optional": false,
386
+ "docs": {
387
+ "tags": [],
388
+ "text": "Extra classes for the inner <select> (single, non-searchable mode), e.g. \"form-select\""
389
+ },
390
+ "getter": false,
391
+ "setter": false,
392
+ "reflect": false,
393
+ "attribute": "select-class",
394
+ "defaultValue": "''"
395
+ }
396
+ };
397
+ }
398
+ static get states() {
399
+ return {
400
+ "isOpen": {},
401
+ "query": {},
402
+ "activeIndex": {}
403
+ };
404
+ }
405
+ static get events() {
406
+ return [{
407
+ "method": "evokeChange",
408
+ "name": "evokeChange",
409
+ "bubbles": true,
410
+ "cancelable": true,
411
+ "composed": true,
412
+ "docs": {
413
+ "tags": [],
414
+ "text": "Emits the selected value (string) or the selected values (string[]) when `multiple`"
415
+ },
416
+ "complexType": {
417
+ "original": "string | string[]",
418
+ "resolved": "string | string[]",
419
+ "references": {}
420
+ }
421
+ }];
422
+ }
423
+ static get elementRef() { return "el"; }
424
+ static get listeners() {
425
+ return [{
426
+ "name": "click",
427
+ "method": "onDocClick",
428
+ "target": "document",
429
+ "capture": false,
430
+ "passive": false
431
+ }];
432
+ }
433
+ }
@@ -0,0 +1,16 @@
1
+ evoke-switch { display: inline-block; }
2
+ evoke-switch .evoke-switch { position: relative; display: inline-flex; align-items: flex-start; gap: 0.75rem; cursor: pointer; font-family: var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); color: var(--evoke-text, #1a1a1a); }
3
+ evoke-switch .evoke-switch--disabled { opacity: 0.6; cursor: not-allowed; }
4
+ evoke-switch .evoke-switch__input { position: absolute; width: 44px; height: 24px; margin: 0; opacity: 0; cursor: inherit; }
5
+ evoke-switch .evoke-switch__track { position: relative; flex: none; width: 44px; height: 24px; border-radius: 9999px; background: #767676; transition: background-color 0.15s, box-shadow 0.15s, filter 0.15s; }
6
+ evoke-switch .evoke-switch__thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
7
+ evoke-switch .evoke-switch__input:checked + .evoke-switch__track { background: var(--evoke-primary, #ff5316); }
8
+ evoke-switch .evoke-switch__input:checked + .evoke-switch__track .evoke-switch__thumb { transform: translateX(20px); }
9
+ evoke-switch .evoke-switch:hover .evoke-switch__input:not(:disabled) + .evoke-switch__track { filter: brightness(0.92); }
10
+ evoke-switch .evoke-switch__input:active:not(:disabled) + .evoke-switch__track .evoke-switch__thumb { width: 24px; }
11
+ evoke-switch .evoke-switch__input:checked:active:not(:disabled) + .evoke-switch__track .evoke-switch__thumb { transform: translateX(16px); }
12
+ evoke-switch .evoke-switch__input:focus-visible + .evoke-switch__track { box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
13
+ evoke-switch .evoke-switch__text { display: flex; flex-direction: column; gap: 2px; }
14
+ evoke-switch .evoke-switch__label { font-size: var(--evoke-font-size, 16px); line-height: 24px; }
15
+ evoke-switch .evoke-switch__desc { font-size: 0.875rem; color: var(--evoke-text-muted, #6b6b6b); }
16
+ @media (prefers-reduced-motion: reduce) { evoke-switch .evoke-switch__thumb, evoke-switch .evoke-switch__track { transition: none; } }
@@ -0,0 +1,151 @@
1
+ import { h } from "@stencil/core";
2
+ export class EvokeSwitch {
3
+ constructor() {
4
+ this.checked = false;
5
+ /** Optional visible label. Without a label or description it is a plain toggle. */
6
+ this.label = '';
7
+ /** Secondary text under the label */
8
+ this.description = '';
9
+ this.disabled = false;
10
+ this.uid = Math.random().toString(36).slice(2, 9);
11
+ }
12
+ render() {
13
+ const descId = `evoke-switch-${this.uid}-desc`;
14
+ return (h("label", { key: '8e3b9741c4e2f7ed93ce7f24893cc2db0d6acf9f', class: `evoke-switch ${this.disabled ? 'evoke-switch--disabled' : ''}`.trim() }, h("input", { key: 'b29122d5f8a0eb572f6f0384d537dc85543ccd66', type: "checkbox", role: "switch", class: "evoke-switch__input", checked: this.checked, disabled: this.disabled, "aria-checked": this.checked ? 'true' : 'false', "aria-label": !this.label ? this.accessibleLabel : undefined, "aria-describedby": this.description ? descId : undefined, onChange: (e) => {
15
+ this.checked = e.target.checked;
16
+ this.evokeChange.emit(this.checked);
17
+ } }), h("span", { key: 'fbecc8e67a062f7b14f9a035491f6d857ac09f71', class: "evoke-switch__track", "aria-hidden": "true" }, h("span", { key: 'ac6a8575b42fcb8424fee235016e4159ddec4fa9', class: "evoke-switch__thumb" })), (this.label || this.description) && (h("span", { key: '46357674f960e74b0f203d7bb129f605e588bb2e', class: "evoke-switch__text" }, this.label && h("span", { key: 'e4f4cee280c46587abe609d3946ed2a7a3b97d41', class: "evoke-switch__label" }, this.label), this.description && h("span", { key: '56cdbf07afaa3c64df0666ccc9d39a736188cd3d', id: descId, class: "evoke-switch__desc" }, this.description)))));
18
+ }
19
+ static get is() { return "evoke-switch"; }
20
+ static get originalStyleUrls() {
21
+ return {
22
+ "$": ["evoke-switch.css"]
23
+ };
24
+ }
25
+ static get styleUrls() {
26
+ return {
27
+ "$": ["evoke-switch.css"]
28
+ };
29
+ }
30
+ static get properties() {
31
+ return {
32
+ "checked": {
33
+ "type": "boolean",
34
+ "mutable": true,
35
+ "complexType": {
36
+ "original": "boolean",
37
+ "resolved": "boolean",
38
+ "references": {}
39
+ },
40
+ "required": false,
41
+ "optional": false,
42
+ "docs": {
43
+ "tags": [],
44
+ "text": ""
45
+ },
46
+ "getter": false,
47
+ "setter": false,
48
+ "reflect": true,
49
+ "attribute": "checked",
50
+ "defaultValue": "false"
51
+ },
52
+ "label": {
53
+ "type": "string",
54
+ "mutable": false,
55
+ "complexType": {
56
+ "original": "string",
57
+ "resolved": "string",
58
+ "references": {}
59
+ },
60
+ "required": false,
61
+ "optional": false,
62
+ "docs": {
63
+ "tags": [],
64
+ "text": "Optional visible label. Without a label or description it is a plain toggle."
65
+ },
66
+ "getter": false,
67
+ "setter": false,
68
+ "reflect": false,
69
+ "attribute": "label",
70
+ "defaultValue": "''"
71
+ },
72
+ "description": {
73
+ "type": "string",
74
+ "mutable": false,
75
+ "complexType": {
76
+ "original": "string",
77
+ "resolved": "string",
78
+ "references": {}
79
+ },
80
+ "required": false,
81
+ "optional": false,
82
+ "docs": {
83
+ "tags": [],
84
+ "text": "Secondary text under the label"
85
+ },
86
+ "getter": false,
87
+ "setter": false,
88
+ "reflect": false,
89
+ "attribute": "description",
90
+ "defaultValue": "''"
91
+ },
92
+ "disabled": {
93
+ "type": "boolean",
94
+ "mutable": false,
95
+ "complexType": {
96
+ "original": "boolean",
97
+ "resolved": "boolean",
98
+ "references": {}
99
+ },
100
+ "required": false,
101
+ "optional": false,
102
+ "docs": {
103
+ "tags": [],
104
+ "text": ""
105
+ },
106
+ "getter": false,
107
+ "setter": false,
108
+ "reflect": false,
109
+ "attribute": "disabled",
110
+ "defaultValue": "false"
111
+ },
112
+ "accessibleLabel": {
113
+ "type": "string",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": true,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "aria-label for a plain toggle that has no visible label"
125
+ },
126
+ "getter": false,
127
+ "setter": false,
128
+ "reflect": false,
129
+ "attribute": "accessible-label"
130
+ }
131
+ };
132
+ }
133
+ static get events() {
134
+ return [{
135
+ "method": "evokeChange",
136
+ "name": "evokeChange",
137
+ "bubbles": true,
138
+ "cancelable": true,
139
+ "composed": true,
140
+ "docs": {
141
+ "tags": [],
142
+ "text": "Emits the new checked state"
143
+ },
144
+ "complexType": {
145
+ "original": "boolean",
146
+ "resolved": "boolean",
147
+ "references": {}
148
+ }
149
+ }];
150
+ }
151
+ }
@@ -0,0 +1,20 @@
1
+ evoke-table { display: block; }
2
+ evoke-table .evoke-table__wrap { overflow-x: auto; border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius, 8px); }
3
+ evoke-table .evoke-table { width: 100%; border-collapse: collapse; font-family: var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); font-size: 0.9375rem; color: var(--evoke-text, #1a1a1a); background: var(--evoke-surface, #ffffff); }
4
+ evoke-table .evoke-table__caption { padding: 12px 16px; text-align: left; color: var(--evoke-text-muted, #6b6b6b); }
5
+ evoke-table .evoke-table__th { padding: 12px 16px; font-weight: 600; background: var(--evoke-surface-muted, #f5f5f5); border-bottom: 1px solid var(--evoke-border, #dedede); white-space: nowrap; }
6
+ evoke-table .evoke-table__td { padding: 12px 16px; border-bottom: 1px solid var(--evoke-border, #dedede); }
7
+ evoke-table tbody tr:last-child .evoke-table__td { border-bottom: 0; }
8
+ evoke-table .evoke-table__cell--left { text-align: left; }
9
+ evoke-table .evoke-table__cell--center { text-align: center; }
10
+ evoke-table .evoke-table__cell--right { text-align: right; }
11
+ evoke-table .evoke-table--striped .evoke-table__row:nth-child(even) { background: var(--evoke-surface-muted, #f5f5f5); }
12
+ evoke-table .evoke-table__row:hover { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 6%, var(--evoke-surface, #ffffff)); }
13
+ evoke-table .evoke-table--striped .evoke-table__row:nth-child(even):hover { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 8%, var(--evoke-surface-muted, #f5f5f5)); }
14
+ evoke-table .evoke-table__empty { padding: 24px 16px; text-align: center; color: var(--evoke-text-muted, #6b6b6b); }
15
+ evoke-table .evoke-table__sort { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px; margin: -2px -4px; font: inherit; font-weight: inherit; color: inherit; background: none; border: 0; border-radius: 4px; cursor: pointer; }
16
+ evoke-table .evoke-table__sort:hover { color: var(--evoke-primary-text, #cc3d0d); }
17
+ evoke-table .evoke-table__sort:active { background: color-mix(in srgb, var(--evoke-text, #1a1a1a) 10%, transparent); }
18
+ evoke-table .evoke-table__sort:focus-visible { outline: none; box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
19
+ evoke-table .evoke-table__sort-icon { width: 14px; height: 14px; color: var(--evoke-text-muted, #6b6b6b); }
20
+ evoke-table .evoke-table__sort-icon--active { color: var(--evoke-primary, #ff5316); }