@evoke-tech/stencil-ui-kit 0.1.0 → 0.2.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 (131) hide show
  1. package/README.md +142 -26
  2. package/dist/cjs/evoke-alert_20.cjs.entry.js +1047 -0
  3. package/dist/cjs/evoke-ui.cjs.js +2 -2
  4. package/dist/cjs/{index-B8xS0y1i.js → index-BpJ5gu8f.js} +146 -5
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/collection/collection-manifest.json +13 -1
  7. package/dist/collection/components/evoke-alert/evoke-alert.css +17 -6
  8. package/dist/collection/components/evoke-alert/evoke-alert.js +25 -1
  9. package/dist/collection/components/evoke-app-bar/evoke-app-bar.css +13 -0
  10. package/dist/collection/components/evoke-app-bar/evoke-app-bar.js +94 -0
  11. package/dist/collection/components/evoke-badge/evoke-badge.css +13 -0
  12. package/dist/collection/components/evoke-badge/evoke-badge.js +162 -0
  13. package/dist/collection/components/evoke-button/evoke-button.css +16 -2
  14. package/dist/collection/components/evoke-button/evoke-button.js +117 -5
  15. package/dist/collection/components/evoke-card/evoke-card.css +9 -1
  16. package/dist/collection/components/evoke-card/evoke-card.js +75 -1
  17. package/dist/collection/components/evoke-checkbox/evoke-checkbox.css +7 -1
  18. package/dist/collection/components/evoke-checkbox/evoke-checkbox.js +31 -2
  19. package/dist/collection/components/evoke-chip/evoke-chip.css +16 -0
  20. package/dist/collection/components/evoke-chip/evoke-chip.js +149 -0
  21. package/dist/collection/components/evoke-input/evoke-input.css +11 -3
  22. package/dist/collection/components/evoke-input/evoke-input.js +103 -13
  23. package/dist/collection/components/evoke-modal/evoke-modal.css +21 -5
  24. package/dist/collection/components/evoke-modal/evoke-modal.js +129 -4
  25. package/dist/collection/components/evoke-pagination/evoke-pagination.css +12 -0
  26. package/dist/collection/components/evoke-pagination/evoke-pagination.js +156 -0
  27. package/dist/collection/components/evoke-progress/evoke-progress.css +12 -0
  28. package/dist/collection/components/evoke-progress/evoke-progress.js +146 -0
  29. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.css +20 -0
  30. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.js +201 -0
  31. package/dist/collection/components/evoke-radio-group/evoke-radio-group.css +14 -1
  32. package/dist/collection/components/evoke-radio-group/evoke-radio-group.js +34 -8
  33. package/dist/collection/components/evoke-select/evoke-select.css +25 -4
  34. package/dist/collection/components/evoke-select/evoke-select.js +245 -15
  35. package/dist/collection/components/evoke-switch/evoke-switch.css +16 -0
  36. package/dist/collection/components/evoke-switch/evoke-switch.js +151 -0
  37. package/dist/collection/components/evoke-table/evoke-table.css +20 -0
  38. package/dist/collection/components/evoke-table/evoke-table.js +222 -0
  39. package/dist/collection/components/evoke-tabs/evoke-tabs.css +20 -0
  40. package/dist/collection/components/evoke-tabs/evoke-tabs.js +179 -0
  41. package/dist/collection/components/evoke-textarea/evoke-textarea.css +19 -0
  42. package/dist/collection/components/evoke-textarea/evoke-textarea.js +328 -0
  43. package/dist/collection/components/evoke-toast/evoke-toast.css +24 -0
  44. package/dist/collection/components/evoke-toast/evoke-toast.js +225 -0
  45. package/dist/collection/components/evoke-tooltip/evoke-tooltip.css +22 -0
  46. package/dist/collection/components/evoke-tooltip/evoke-tooltip.js +119 -0
  47. package/dist/collection/utils/icons.js +29 -0
  48. package/dist/components/evoke-alert.js +1 -1
  49. package/dist/components/evoke-app-bar.d.ts +11 -0
  50. package/dist/components/evoke-app-bar.js +1 -0
  51. package/dist/components/evoke-badge.d.ts +11 -0
  52. package/dist/components/evoke-badge.js +1 -0
  53. package/dist/components/evoke-button.js +1 -1
  54. package/dist/components/evoke-card.js +1 -1
  55. package/dist/components/evoke-checkbox.js +1 -1
  56. package/dist/components/evoke-chip.d.ts +11 -0
  57. package/dist/components/evoke-chip.js +1 -0
  58. package/dist/components/evoke-input.js +1 -1
  59. package/dist/components/evoke-modal.js +1 -1
  60. package/dist/components/evoke-pagination.d.ts +11 -0
  61. package/dist/components/evoke-pagination.js +1 -0
  62. package/dist/components/evoke-progress.d.ts +11 -0
  63. package/dist/components/evoke-progress.js +1 -0
  64. package/dist/components/evoke-quantity-stepper.d.ts +11 -0
  65. package/dist/components/evoke-quantity-stepper.js +1 -0
  66. package/dist/components/evoke-radio-group.js +1 -1
  67. package/dist/components/evoke-select.js +1 -1
  68. package/dist/components/evoke-switch.d.ts +11 -0
  69. package/dist/components/evoke-switch.js +1 -0
  70. package/dist/components/evoke-table.d.ts +11 -0
  71. package/dist/components/evoke-table.js +1 -0
  72. package/dist/components/evoke-tabs.d.ts +11 -0
  73. package/dist/components/evoke-tabs.js +1 -0
  74. package/dist/components/evoke-textarea.d.ts +11 -0
  75. package/dist/components/evoke-textarea.js +1 -0
  76. package/dist/components/evoke-toast.d.ts +11 -0
  77. package/dist/components/evoke-toast.js +1 -0
  78. package/dist/components/evoke-tooltip.d.ts +11 -0
  79. package/dist/components/evoke-tooltip.js +1 -0
  80. package/dist/components/icons.js +1 -0
  81. package/dist/esm/evoke-alert_20.entry.js +1026 -0
  82. package/dist/esm/evoke-ui.js +3 -3
  83. package/dist/esm/{index-BtM1wZ-I.js → index-C-5sEjU8.js} +146 -6
  84. package/dist/esm/loader.js +3 -3
  85. package/dist/evoke-ui/evoke-ui.css +1 -1
  86. package/dist/evoke-ui/evoke-ui.esm.js +1 -1
  87. package/dist/evoke-ui/p-0841be89.entry.js +1 -0
  88. package/dist/evoke-ui/p-C-5sEjU8.js +3 -0
  89. package/dist/themes/bootstrap.css +3 -0
  90. package/dist/themes/material.css +5 -2
  91. package/dist/themes/tailwind.css +3 -0
  92. package/dist/themes/tokens.css +4 -1
  93. package/dist/types/components/evoke-alert/evoke-alert.d.ts +2 -0
  94. package/dist/types/components/evoke-app-bar/evoke-app-bar.d.ts +14 -0
  95. package/dist/types/components/evoke-badge/evoke-badge.d.ts +17 -0
  96. package/dist/types/components/evoke-button/evoke-button.d.ts +12 -2
  97. package/dist/types/components/evoke-card/evoke-card.d.ts +9 -0
  98. package/dist/types/components/evoke-checkbox/evoke-checkbox.d.ts +5 -0
  99. package/dist/types/components/evoke-chip/evoke-chip.d.ts +14 -0
  100. package/dist/types/components/evoke-input/evoke-input.d.ts +9 -1
  101. package/dist/types/components/evoke-modal/evoke-modal.d.ts +19 -1
  102. package/dist/types/components/evoke-pagination/evoke-pagination.d.ts +15 -0
  103. package/dist/types/components/evoke-progress/evoke-progress.d.ts +13 -0
  104. package/dist/types/components/evoke-quantity-stepper/evoke-quantity-stepper.d.ts +18 -0
  105. package/dist/types/components/evoke-radio-group/evoke-radio-group.d.ts +4 -2
  106. package/dist/types/components/evoke-select/evoke-select.d.ts +31 -6
  107. package/dist/types/components/evoke-switch/evoke-switch.d.ts +15 -0
  108. package/dist/types/components/evoke-table/evoke-table.d.ts +29 -0
  109. package/dist/types/components/evoke-tabs/evoke-tabs.d.ts +21 -0
  110. package/dist/types/components/evoke-textarea/evoke-textarea.d.ts +28 -0
  111. package/dist/types/components/evoke-toast/evoke-toast.d.ts +24 -0
  112. package/dist/types/components/evoke-tooltip/evoke-tooltip.d.ts +17 -0
  113. package/dist/types/components.d.ts +1237 -18
  114. package/dist/types/utils/icons.d.ts +25 -0
  115. package/dist/vue/components.d.ts +22 -0
  116. package/dist/vue/components.js +220 -0
  117. package/dist/vue/index.d.ts +2 -0
  118. package/dist/vue/index.js +2 -0
  119. package/dist/vue/plugin.d.ts +3 -0
  120. package/dist/vue/plugin.js +7 -0
  121. package/package.json +30 -6
  122. package/dist/cjs/evoke-alert_6.cjs.entry.js +0 -172
  123. package/dist/cjs/evoke-card.cjs.entry.js +0 -20
  124. package/dist/cjs/evoke-modal.cjs.entry.js +0 -34
  125. package/dist/esm/evoke-alert_6.entry.js +0 -165
  126. package/dist/esm/evoke-card.entry.js +0 -18
  127. package/dist/esm/evoke-modal.entry.js +0 -32
  128. package/dist/evoke-ui/p-243075cd.entry.js +0 -1
  129. package/dist/evoke-ui/p-605d4757.entry.js +0 -1
  130. package/dist/evoke-ui/p-9a6eaeb6.entry.js +0 -1
  131. package/dist/evoke-ui/p-BtM1wZ-I.js +0 -3
@@ -8,9 +8,30 @@ evoke-select .evoke-field__input {
8
8
  appearance: none; -webkit-appearance: none; cursor: pointer;
9
9
  transition: border-color 0.15s, box-shadow 0.15s;
10
10
  }
11
- evoke-select .evoke-field__select--empty { color: var(--evoke-text-muted, #7a7a7a); }
12
- evoke-select .evoke-field__input:focus { outline: none; border-color: var(--evoke-secondary, #0b1560); box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
13
- evoke-select .evoke-field__input:disabled { opacity: 0.6; cursor: not-allowed; }
11
+ evoke-select .evoke-field__select--empty { color: var(--evoke-text-muted, #6b6b6b); }
12
+ evoke-select .evoke-field__input:hover:not(:disabled):not(:focus) { border-color: var(--evoke-text-muted, #6b6b6b); }
13
+ evoke-select .evoke-field__input:focus, evoke-select .evoke-select__trigger:focus-visible { outline: none; border-color: var(--evoke-secondary, #0b1560); box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
14
+ evoke-select .evoke-field__input:disabled, evoke-select .evoke-select__trigger--disabled { opacity: 0.6; cursor: not-allowed; }
14
15
  evoke-select .evoke-field__input--error { border-color: var(--evoke-danger, #dc2626); }
15
- evoke-select .evoke-field__chevron { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--evoke-text-muted, #7a7a7a); pointer-events: none; }
16
+ evoke-select .evoke-field__chevron { position: absolute; right: 16px; top: calc(var(--evoke-control-height, 56px) / 2); transform: translateY(-50%); width: 18px; height: 18px; color: var(--evoke-text-muted, #6b6b6b); pointer-events: none; }
17
+ evoke-select .evoke-field__hint { color: var(--evoke-text-muted, #6b6b6b); font-size: 0.875rem; }
16
18
  evoke-select .evoke-field__error { color: var(--evoke-danger, #dc2626); font-size: 0.875rem; }
19
+ /* custom (multiple / searchable) */
20
+ evoke-select .evoke-select__trigger { display: flex; align-items: center; height: auto; min-height: var(--evoke-control-height, 56px); padding-top: 6px; padding-bottom: 6px; }
21
+ evoke-select .evoke-select__value { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
22
+ evoke-select .evoke-select__placeholder { color: var(--evoke-text-muted, #6b6b6b); }
23
+ evoke-select .evoke-select__chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 9999px; font-size: 0.875rem; background: color-mix(in srgb, var(--evoke-primary, #ff5316) 12%, var(--evoke-surface, #ffffff)); color: var(--evoke-text, #1a1a1a); }
24
+ evoke-select .evoke-select__chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
25
+ evoke-select .evoke-select__chip-remove:hover { background: color-mix(in srgb, var(--evoke-text, #1a1a1a) 12%, transparent); }
26
+ evoke-select .evoke-select__chip-remove:focus-visible { outline: none; box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
27
+ evoke-select .evoke-select__chip-remove .evoke-icon { width: 12px; height: 12px; }
28
+ evoke-select .evoke-select__panel { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--evoke-surface, #ffffff); border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-field, 8px); box-shadow: var(--evoke-shadow, 0 4px 12px rgba(0, 0, 0, 0.12)); max-height: 280px; display: flex; flex-direction: column; overflow: hidden; }
29
+ evoke-select .evoke-select__search { box-sizing: border-box; margin: 8px; padding: 8px 12px; border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-field, 8px); font: inherit; color: var(--evoke-text, #1a1a1a); background: var(--evoke-surface, #ffffff); }
30
+ evoke-select .evoke-select__search:focus { outline: none; border-color: var(--evoke-secondary, #0b1560); box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
31
+ evoke-select .evoke-select__list { list-style: none; margin: 0; padding: 4px; overflow: auto; }
32
+ evoke-select .evoke-select__option { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: calc(var(--evoke-radius-field, 8px) - 2px); cursor: pointer; }
33
+ evoke-select .evoke-select__option--active { background: var(--evoke-surface-muted, #f5f5f5); }
34
+ evoke-select .evoke-select__option--selected { color: var(--evoke-primary-text, #cc3d0d); font-weight: 500; }
35
+ evoke-select .evoke-select__option--disabled { opacity: 0.5; cursor: not-allowed; }
36
+ evoke-select .evoke-select__option .evoke-icon { width: 16px; height: 16px; flex: none; }
37
+ evoke-select .evoke-select__empty { padding: 12px 16px; color: var(--evoke-text-muted, #6b6b6b); }
@@ -1,24 +1,177 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { parseOptions } from "../../utils/options";
3
+ import { renderIcon } from "../../utils/icons";
3
4
  export class EvokeSelect {
4
5
  constructor() {
5
6
  this.label = '';
6
7
  /** Options as an array of { label, value, disabled? } or a JSON string of the same */
7
8
  this.options = [];
9
+ /** Selected value (string), or an array of values when `multiple` */
8
10
  this.value = '';
9
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;
10
16
  this.disabled = false;
11
- /** Error message shown below the field */
17
+ /** Error message shown below the field (replaces the hint) */
12
18
  this.error = '';
13
- /** Extra classes for the inner <select>, e.g. "form-select" (Bootstrap) */
19
+ this.hint = '';
20
+ /** Extra classes for the inner <select> (single, non-searchable mode), e.g. "form-select" */
14
21
  this.selectClass = '';
15
- this.selectId = `evoke-select-${Math.random().toString(36).slice(2, 9)}`;
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")))));
16
169
  }
17
170
  render() {
18
- return (h("div", { key: '4a1543d6630c1594254213c2cafcfc6883f32ce2', class: "evoke-field" }, this.label && h("label", { key: 'e387eb1dd52bd755ad848908603c06f45e99a9d8', htmlFor: this.selectId, class: "evoke-field__label" }, this.label), h("div", { key: '4a23b2f05d408cd8f5d4942dc578e5a07233d17d', class: "evoke-field__control" }, h("select", { key: '3aae8448326e8e4008570b07320f28a576d4c08c', id: this.selectId, class: `evoke-field__input evoke-field__select ${this.value === '' ? 'evoke-field__select--empty' : ''} ${this.error ? 'evoke-field__input--error' : ''} ${this.selectClass}`.trim(), disabled: this.disabled, "aria-invalid": this.error ? 'true' : undefined, onChange: (e) => {
19
- this.value = e.target.value;
20
- this.evokeChange.emit(this.value);
21
- } }, h("option", { key: '04defa87db88f21fc5bec7577afb7bb2ded1d6c6', value: "", disabled: true, selected: this.value === '' }, this.placeholder), parseOptions(this.options).map((o) => (h("option", { value: o.value, disabled: o.disabled, selected: o.value === this.value }, o.label)))), h("svg", { key: '35046765ad125b7c7bfc66b3a55e8c2dfeae05a0', class: "evoke-field__chevron", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { key: 'e65fd0cf45dd70061f37afa51db756906fe819d0', d: "m6 9 6 6 6-6" }))), this.error && h("span", { key: '055c84a93853e14c2d1ec7c493c59f2d864c071a', class: "evoke-field__error", role: "alert" }, this.error)));
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))));
22
175
  }
23
176
  static get is() { return "evoke-select"; }
24
177
  static get originalStyleUrls() {
@@ -84,15 +237,15 @@ export class EvokeSelect {
84
237
  "type": "string",
85
238
  "mutable": true,
86
239
  "complexType": {
87
- "original": "string",
88
- "resolved": "string",
240
+ "original": "string | string[]",
241
+ "resolved": "string | string[]",
89
242
  "references": {}
90
243
  },
91
244
  "required": false,
92
245
  "optional": false,
93
246
  "docs": {
94
247
  "tags": [],
95
- "text": ""
248
+ "text": "Selected value (string), or an array of values when `multiple`"
96
249
  },
97
250
  "getter": false,
98
251
  "setter": false,
@@ -120,6 +273,46 @@ export class EvokeSelect {
120
273
  "attribute": "placeholder",
121
274
  "defaultValue": "'Select an option'"
122
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
+ },
123
316
  "disabled": {
124
317
  "type": "boolean",
125
318
  "mutable": false,
@@ -152,7 +345,7 @@ export class EvokeSelect {
152
345
  "optional": false,
153
346
  "docs": {
154
347
  "tags": [],
155
- "text": "Error message shown below the field"
348
+ "text": "Error message shown below the field (replaces the hint)"
156
349
  },
157
350
  "getter": false,
158
351
  "setter": false,
@@ -160,6 +353,26 @@ export class EvokeSelect {
160
353
  "attribute": "error",
161
354
  "defaultValue": "''"
162
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
+ },
163
376
  "selectClass": {
164
377
  "type": "string",
165
378
  "mutable": false,
@@ -172,7 +385,7 @@ export class EvokeSelect {
172
385
  "optional": false,
173
386
  "docs": {
174
387
  "tags": [],
175
- "text": "Extra classes for the inner <select>, e.g. \"form-select\" (Bootstrap)"
388
+ "text": "Extra classes for the inner <select> (single, non-searchable mode), e.g. \"form-select\""
176
389
  },
177
390
  "getter": false,
178
391
  "setter": false,
@@ -182,6 +395,13 @@ export class EvokeSelect {
182
395
  }
183
396
  };
184
397
  }
398
+ static get states() {
399
+ return {
400
+ "isOpen": {},
401
+ "query": {},
402
+ "activeIndex": {}
403
+ };
404
+ }
185
405
  static get events() {
186
406
  return [{
187
407
  "method": "evokeChange",
@@ -191,13 +411,23 @@ export class EvokeSelect {
191
411
  "composed": true,
192
412
  "docs": {
193
413
  "tags": [],
194
- "text": "Emits the selected value"
414
+ "text": "Emits the selected value (string) or the selected values (string[]) when `multiple`"
195
415
  },
196
416
  "complexType": {
197
- "original": "string",
198
- "resolved": "string",
417
+ "original": "string | string[]",
418
+ "resolved": "string | string[]",
199
419
  "references": {}
200
420
  }
201
421
  }];
202
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
+ }
203
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); }