@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.
- package/README.md +314 -2
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/evoke-alert_20.cjs.entry.js +1047 -0
- package/dist/cjs/evoke-ui.cjs.js +25 -0
- package/dist/cjs/index-BpJ5gu8f.js +2130 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/collection/collection-manifest.json +32 -0
- package/dist/collection/components/evoke-alert/evoke-alert.css +18 -0
- package/dist/collection/components/evoke-alert/evoke-alert.js +107 -0
- package/dist/collection/components/evoke-app-bar/evoke-app-bar.css +13 -0
- package/dist/collection/components/evoke-app-bar/evoke-app-bar.js +94 -0
- package/dist/collection/components/evoke-badge/evoke-badge.css +13 -0
- package/dist/collection/components/evoke-badge/evoke-badge.js +162 -0
- package/dist/collection/components/evoke-button/evoke-button.css +31 -0
- package/dist/collection/components/evoke-button/evoke-button.js +243 -0
- package/dist/collection/components/evoke-card/evoke-card.css +12 -0
- package/dist/collection/components/evoke-card/evoke-card.js +140 -0
- package/dist/collection/components/evoke-checkbox/evoke-checkbox.css +22 -0
- package/dist/collection/components/evoke-checkbox/evoke-checkbox.js +180 -0
- package/dist/collection/components/evoke-chip/evoke-chip.css +16 -0
- package/dist/collection/components/evoke-chip/evoke-chip.js +149 -0
- package/dist/collection/components/evoke-input/evoke-input.css +25 -0
- package/dist/collection/components/evoke-input/evoke-input.js +324 -0
- package/dist/collection/components/evoke-modal/evoke-modal.css +21 -0
- package/dist/collection/components/evoke-modal/evoke-modal.js +271 -0
- package/dist/collection/components/evoke-pagination/evoke-pagination.css +12 -0
- package/dist/collection/components/evoke-pagination/evoke-pagination.js +156 -0
- package/dist/collection/components/evoke-progress/evoke-progress.css +12 -0
- package/dist/collection/components/evoke-progress/evoke-progress.js +146 -0
- package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.css +20 -0
- package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.js +201 -0
- package/dist/collection/components/evoke-radio-group/evoke-radio-group.css +29 -0
- package/dist/collection/components/evoke-radio-group/evoke-radio-group.js +233 -0
- package/dist/collection/components/evoke-select/evoke-select.css +37 -0
- package/dist/collection/components/evoke-select/evoke-select.js +433 -0
- package/dist/collection/components/evoke-switch/evoke-switch.css +16 -0
- package/dist/collection/components/evoke-switch/evoke-switch.js +151 -0
- package/dist/collection/components/evoke-table/evoke-table.css +20 -0
- package/dist/collection/components/evoke-table/evoke-table.js +222 -0
- package/dist/collection/components/evoke-tabs/evoke-tabs.css +20 -0
- package/dist/collection/components/evoke-tabs/evoke-tabs.js +179 -0
- package/dist/collection/components/evoke-textarea/evoke-textarea.css +19 -0
- package/dist/collection/components/evoke-textarea/evoke-textarea.js +328 -0
- package/dist/collection/components/evoke-toast/evoke-toast.css +24 -0
- package/dist/collection/components/evoke-toast/evoke-toast.js +225 -0
- package/dist/collection/components/evoke-tooltip/evoke-tooltip.css +22 -0
- package/dist/collection/components/evoke-tooltip/evoke-tooltip.js +119 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/icons.js +29 -0
- package/dist/collection/utils/options.js +12 -0
- package/dist/components/evoke-alert.d.ts +11 -0
- package/dist/components/evoke-alert.js +1 -0
- package/dist/components/evoke-app-bar.d.ts +11 -0
- package/dist/components/evoke-app-bar.js +1 -0
- package/dist/components/evoke-badge.d.ts +11 -0
- package/dist/components/evoke-badge.js +1 -0
- package/dist/components/evoke-button.d.ts +11 -0
- package/dist/components/evoke-button.js +1 -0
- package/dist/components/evoke-card.d.ts +11 -0
- package/dist/components/evoke-card.js +1 -0
- package/dist/components/evoke-checkbox.d.ts +11 -0
- package/dist/components/evoke-checkbox.js +1 -0
- package/dist/components/evoke-chip.d.ts +11 -0
- package/dist/components/evoke-chip.js +1 -0
- package/dist/components/evoke-input.d.ts +11 -0
- package/dist/components/evoke-input.js +1 -0
- package/dist/components/evoke-modal.d.ts +11 -0
- package/dist/components/evoke-modal.js +1 -0
- package/dist/components/evoke-pagination.d.ts +11 -0
- package/dist/components/evoke-pagination.js +1 -0
- package/dist/components/evoke-progress.d.ts +11 -0
- package/dist/components/evoke-progress.js +1 -0
- package/dist/components/evoke-quantity-stepper.d.ts +11 -0
- package/dist/components/evoke-quantity-stepper.js +1 -0
- package/dist/components/evoke-radio-group.d.ts +11 -0
- package/dist/components/evoke-radio-group.js +1 -0
- package/dist/components/evoke-select.d.ts +11 -0
- package/dist/components/evoke-select.js +1 -0
- package/dist/components/evoke-switch.d.ts +11 -0
- package/dist/components/evoke-switch.js +1 -0
- package/dist/components/evoke-table.d.ts +11 -0
- package/dist/components/evoke-table.js +1 -0
- package/dist/components/evoke-tabs.d.ts +11 -0
- package/dist/components/evoke-tabs.js +1 -0
- package/dist/components/evoke-textarea.d.ts +11 -0
- package/dist/components/evoke-textarea.js +1 -0
- package/dist/components/evoke-toast.d.ts +11 -0
- package/dist/components/evoke-toast.js +1 -0
- package/dist/components/evoke-tooltip.d.ts +11 -0
- package/dist/components/evoke-tooltip.js +1 -0
- package/dist/components/icons.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/options.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/evoke-alert_20.entry.js +1026 -0
- package/dist/esm/evoke-ui.js +21 -0
- package/dist/esm/index-C-5sEjU8.js +2122 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/evoke-ui/evoke-ui.css +1 -0
- package/dist/evoke-ui/evoke-ui.esm.js +1 -0
- package/dist/evoke-ui/index.esm.js +0 -0
- package/dist/evoke-ui/p-0841be89.entry.js +1 -0
- package/dist/evoke-ui/p-C-5sEjU8.js +3 -0
- package/dist/evoke-ui/p-DQuL1Twl.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/themes/bootstrap.css +26 -0
- package/dist/themes/material.css +24 -0
- package/dist/themes/tailwind.css +27 -0
- package/dist/themes/tokens.css +29 -0
- package/dist/types/components/evoke-alert/evoke-alert.d.ts +10 -0
- package/dist/types/components/evoke-app-bar/evoke-app-bar.d.ts +14 -0
- package/dist/types/components/evoke-badge/evoke-badge.d.ts +17 -0
- package/dist/types/components/evoke-button/evoke-button.d.ts +21 -0
- package/dist/types/components/evoke-card/evoke-card.d.ts +15 -0
- package/dist/types/components/evoke-checkbox/evoke-checkbox.d.ts +18 -0
- package/dist/types/components/evoke-chip/evoke-chip.d.ts +14 -0
- package/dist/types/components/evoke-input/evoke-input.d.ts +27 -0
- package/dist/types/components/evoke-modal/evoke-modal.d.ts +32 -0
- package/dist/types/components/evoke-pagination/evoke-pagination.d.ts +15 -0
- package/dist/types/components/evoke-progress/evoke-progress.d.ts +13 -0
- package/dist/types/components/evoke-quantity-stepper/evoke-quantity-stepper.d.ts +18 -0
- package/dist/types/components/evoke-radio-group/evoke-radio-group.d.ts +20 -0
- package/dist/types/components/evoke-select/evoke-select.d.ts +43 -0
- package/dist/types/components/evoke-switch/evoke-switch.d.ts +15 -0
- package/dist/types/components/evoke-table/evoke-table.d.ts +29 -0
- package/dist/types/components/evoke-tabs/evoke-tabs.d.ts +21 -0
- package/dist/types/components/evoke-textarea/evoke-textarea.d.ts +28 -0
- package/dist/types/components/evoke-toast/evoke-toast.d.ts +24 -0
- package/dist/types/components/evoke-tooltip/evoke-tooltip.d.ts +17 -0
- package/dist/types/components.d.ts +1876 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1879 -0
- package/dist/types/utils/icons.d.ts +25 -0
- package/dist/types/utils/options.d.ts +7 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +65 -4
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { renderIcon } from "../../utils/icons";
|
|
3
|
+
export class EvokeQuantityStepper {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.value = 1;
|
|
6
|
+
this.min = 1;
|
|
7
|
+
this.max = 99;
|
|
8
|
+
/** Inline (minus, value, plus) or compact with a quantity dropdown */
|
|
9
|
+
this.appearance = 'inline';
|
|
10
|
+
this.disabled = false;
|
|
11
|
+
/** Accessible name for the control */
|
|
12
|
+
this.label = 'Quantity';
|
|
13
|
+
this.onKeyDown = (e) => {
|
|
14
|
+
if (e.key === 'ArrowUp') {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
this.set(this.value + 1);
|
|
17
|
+
}
|
|
18
|
+
else if (e.key === 'ArrowDown') {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
this.set(this.value - 1);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
clamp(n) {
|
|
25
|
+
return Math.min(Math.max(Math.round(n), this.min), this.max);
|
|
26
|
+
}
|
|
27
|
+
set(n) {
|
|
28
|
+
const next = this.clamp(Number.isFinite(n) ? n : this.value);
|
|
29
|
+
if (this.inputEl)
|
|
30
|
+
this.inputEl.value = String(next);
|
|
31
|
+
if (next === this.value)
|
|
32
|
+
return;
|
|
33
|
+
this.value = next;
|
|
34
|
+
this.evokeChange.emit(next);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
if (this.appearance === 'compact') {
|
|
38
|
+
const top = Math.min(this.max, this.min + 9);
|
|
39
|
+
const opts = [];
|
|
40
|
+
for (let i = this.min; i <= top; i++)
|
|
41
|
+
opts.push(i);
|
|
42
|
+
if (!opts.includes(this.value))
|
|
43
|
+
opts.push(this.value);
|
|
44
|
+
return (h("div", { class: "evoke-qty evoke-qty--compact" }, h("select", { class: "evoke-qty__select", "aria-label": this.label, disabled: this.disabled, onChange: (e) => this.set(Number(e.target.value)) }, opts.map((n) => h("option", { value: String(n), selected: n === this.value }, "Qty: ", n))), renderIcon('chevron-down', 'evoke-qty__chevron')));
|
|
45
|
+
}
|
|
46
|
+
return (h("div", { class: "evoke-qty evoke-qty--inline", role: "group", "aria-label": this.label }, h("button", { type: "button", class: "evoke-qty__btn", "aria-label": "Decrease quantity", disabled: this.disabled || this.value <= this.min, onClick: () => this.set(this.value - 1) }, renderIcon('minus', 'evoke-icon')), h("input", { class: "evoke-qty__input", type: "text", inputmode: "numeric", pattern: "[0-9]*", "aria-label": this.label, value: String(this.value), disabled: this.disabled, ref: (el) => (this.inputEl = el), onKeyDown: this.onKeyDown, onChange: (e) => this.set(parseInt(e.target.value, 10)) }), h("button", { type: "button", class: "evoke-qty__btn", "aria-label": "Increase quantity", disabled: this.disabled || this.value >= this.max, onClick: () => this.set(this.value + 1) }, renderIcon('plus', 'evoke-icon'))));
|
|
47
|
+
}
|
|
48
|
+
static get is() { return "evoke-quantity-stepper"; }
|
|
49
|
+
static get originalStyleUrls() {
|
|
50
|
+
return {
|
|
51
|
+
"$": ["evoke-quantity-stepper.css"]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static get styleUrls() {
|
|
55
|
+
return {
|
|
56
|
+
"$": ["evoke-quantity-stepper.css"]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static get properties() {
|
|
60
|
+
return {
|
|
61
|
+
"value": {
|
|
62
|
+
"type": "number",
|
|
63
|
+
"mutable": true,
|
|
64
|
+
"complexType": {
|
|
65
|
+
"original": "number",
|
|
66
|
+
"resolved": "number",
|
|
67
|
+
"references": {}
|
|
68
|
+
},
|
|
69
|
+
"required": false,
|
|
70
|
+
"optional": false,
|
|
71
|
+
"docs": {
|
|
72
|
+
"tags": [],
|
|
73
|
+
"text": ""
|
|
74
|
+
},
|
|
75
|
+
"getter": false,
|
|
76
|
+
"setter": false,
|
|
77
|
+
"reflect": false,
|
|
78
|
+
"attribute": "value",
|
|
79
|
+
"defaultValue": "1"
|
|
80
|
+
},
|
|
81
|
+
"min": {
|
|
82
|
+
"type": "number",
|
|
83
|
+
"mutable": false,
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "number",
|
|
86
|
+
"resolved": "number",
|
|
87
|
+
"references": {}
|
|
88
|
+
},
|
|
89
|
+
"required": false,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": ""
|
|
94
|
+
},
|
|
95
|
+
"getter": false,
|
|
96
|
+
"setter": false,
|
|
97
|
+
"reflect": false,
|
|
98
|
+
"attribute": "min",
|
|
99
|
+
"defaultValue": "1"
|
|
100
|
+
},
|
|
101
|
+
"max": {
|
|
102
|
+
"type": "number",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "number",
|
|
106
|
+
"resolved": "number",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": ""
|
|
114
|
+
},
|
|
115
|
+
"getter": false,
|
|
116
|
+
"setter": false,
|
|
117
|
+
"reflect": false,
|
|
118
|
+
"attribute": "max",
|
|
119
|
+
"defaultValue": "99"
|
|
120
|
+
},
|
|
121
|
+
"appearance": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"mutable": false,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "'inline' | 'compact'",
|
|
126
|
+
"resolved": "\"compact\" | \"inline\"",
|
|
127
|
+
"references": {}
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"optional": false,
|
|
131
|
+
"docs": {
|
|
132
|
+
"tags": [],
|
|
133
|
+
"text": "Inline (minus, value, plus) or compact with a quantity dropdown"
|
|
134
|
+
},
|
|
135
|
+
"getter": false,
|
|
136
|
+
"setter": false,
|
|
137
|
+
"reflect": false,
|
|
138
|
+
"attribute": "appearance",
|
|
139
|
+
"defaultValue": "'inline'"
|
|
140
|
+
},
|
|
141
|
+
"disabled": {
|
|
142
|
+
"type": "boolean",
|
|
143
|
+
"mutable": false,
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "boolean",
|
|
146
|
+
"resolved": "boolean",
|
|
147
|
+
"references": {}
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"optional": false,
|
|
151
|
+
"docs": {
|
|
152
|
+
"tags": [],
|
|
153
|
+
"text": ""
|
|
154
|
+
},
|
|
155
|
+
"getter": false,
|
|
156
|
+
"setter": false,
|
|
157
|
+
"reflect": false,
|
|
158
|
+
"attribute": "disabled",
|
|
159
|
+
"defaultValue": "false"
|
|
160
|
+
},
|
|
161
|
+
"label": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"mutable": false,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "string",
|
|
166
|
+
"resolved": "string",
|
|
167
|
+
"references": {}
|
|
168
|
+
},
|
|
169
|
+
"required": false,
|
|
170
|
+
"optional": false,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": "Accessible name for the control"
|
|
174
|
+
},
|
|
175
|
+
"getter": false,
|
|
176
|
+
"setter": false,
|
|
177
|
+
"reflect": false,
|
|
178
|
+
"attribute": "label",
|
|
179
|
+
"defaultValue": "'Quantity'"
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
static get events() {
|
|
184
|
+
return [{
|
|
185
|
+
"method": "evokeChange",
|
|
186
|
+
"name": "evokeChange",
|
|
187
|
+
"bubbles": true,
|
|
188
|
+
"cancelable": true,
|
|
189
|
+
"composed": true,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": "Emits the new quantity"
|
|
193
|
+
},
|
|
194
|
+
"complexType": {
|
|
195
|
+
"original": "number",
|
|
196
|
+
"resolved": "number",
|
|
197
|
+
"references": {}
|
|
198
|
+
}
|
|
199
|
+
}];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
evoke-radio-group { display: block; }
|
|
2
|
+
evoke-radio-group .evoke-radio { display: flex; flex-direction: column; gap: 0.5rem; 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-radio-group .evoke-radio__label { font-size: var(--evoke-font-size, 16px); }
|
|
4
|
+
evoke-radio-group .evoke-radio__options { display: flex; flex-direction: column; gap: 0.5rem; }
|
|
5
|
+
evoke-radio-group .evoke-radio__options--inline { flex-direction: row; flex-wrap: wrap; gap: 1.25rem; }
|
|
6
|
+
evoke-radio-group .evoke-radio__row { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.875rem; }
|
|
7
|
+
evoke-radio-group .evoke-radio__row--disabled { opacity: 0.6; cursor: not-allowed; }
|
|
8
|
+
evoke-radio-group .evoke-radio__input {
|
|
9
|
+
appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 16px; height: 16px;
|
|
10
|
+
border: 2px solid var(--evoke-primary, #ff5316); border-radius: 50%; background: var(--evoke-surface, #ffffff);
|
|
11
|
+
cursor: inherit; transition: box-shadow 0.15s, filter 0.15s;
|
|
12
|
+
}
|
|
13
|
+
evoke-radio-group .evoke-radio__input:hover:not(:disabled) { filter: brightness(0.92); }
|
|
14
|
+
evoke-radio-group .evoke-radio__input:checked { background: radial-gradient(circle, var(--evoke-primary, #ff5316) 0 40%, var(--evoke-surface, #ffffff) 45%); }
|
|
15
|
+
evoke-radio-group .evoke-radio__input:focus-visible { outline: none; box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
|
|
16
|
+
evoke-radio-group .evoke-radio__input--error { border-color: var(--evoke-danger, #dc2626); }
|
|
17
|
+
evoke-radio-group .evoke-radio__error { color: var(--evoke-danger, #dc2626); font-size: 0.875rem; }
|
|
18
|
+
/* segmented */
|
|
19
|
+
evoke-radio-group .evoke-radio__options--segmented { flex-direction: row; gap: 0; align-self: flex-start; border: 1px solid var(--evoke-primary, #ff5316); border-radius: var(--evoke-radius-field, 8px); overflow: hidden; }
|
|
20
|
+
evoke-radio-group .evoke-seg { position: relative; display: inline-flex; cursor: pointer; }
|
|
21
|
+
evoke-radio-group .evoke-seg + .evoke-seg { border-left: 1px solid var(--evoke-primary, #ff5316); }
|
|
22
|
+
evoke-radio-group .evoke-seg--disabled { opacity: 0.5; cursor: not-allowed; }
|
|
23
|
+
evoke-radio-group .evoke-seg__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
|
|
24
|
+
evoke-radio-group .evoke-seg__text { display: inline-flex; align-items: center; justify-content: center; min-height: calc(var(--evoke-control-height, 56px) * 0.75); padding: 0 20px; font-size: 0.875rem; background: var(--evoke-surface, #ffffff); color: var(--evoke-primary-text, #cc3d0d); transition: background-color 0.15s, filter 0.15s; }
|
|
25
|
+
evoke-radio-group .evoke-seg:hover .evoke-seg__input:not(:disabled):not(:checked) + .evoke-seg__text { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 10%, var(--evoke-surface, #ffffff)); }
|
|
26
|
+
evoke-radio-group .evoke-seg__input:checked + .evoke-seg__text { background: var(--evoke-primary, #ff5316); color: var(--evoke-primary-contrast, #ffffff); }
|
|
27
|
+
evoke-radio-group .evoke-seg__input:active:not(:disabled) + .evoke-seg__text { filter: brightness(0.85); }
|
|
28
|
+
evoke-radio-group .evoke-seg__input:focus-visible + .evoke-seg__text { box-shadow: inset 0 0 0 3px var(--evoke-secondary, #0b1560); }
|
|
29
|
+
evoke-radio-group .evoke-seg__input.evoke-radio__input--error + .evoke-seg__text { color: var(--evoke-danger, #dc2626); }
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { parseOptions } from "../../utils/options";
|
|
3
|
+
export class EvokeRadioGroup {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.label = '';
|
|
6
|
+
/** Options as an array of { label, value, disabled? } or a JSON string of the same */
|
|
7
|
+
this.options = [];
|
|
8
|
+
this.value = '';
|
|
9
|
+
this.name = '';
|
|
10
|
+
this.disabled = false;
|
|
11
|
+
/** Classic radio circles, or a segmented button group */
|
|
12
|
+
this.appearance = 'classic';
|
|
13
|
+
/** Lay classic options out in a row instead of a column */
|
|
14
|
+
this.inline = false;
|
|
15
|
+
/** Error message shown below the group */
|
|
16
|
+
this.error = '';
|
|
17
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
const name = this.name || `evoke-radio-${this.uid}`;
|
|
21
|
+
const labelId = `${name}-label`;
|
|
22
|
+
const errId = `${name}-err`;
|
|
23
|
+
const segmented = this.appearance === 'segmented';
|
|
24
|
+
return (h("div", { key: 'ddf9183b0a6733b0daf79dcdb5f7dd5525d00a62', class: "evoke-radio", role: "radiogroup", "aria-labelledby": this.label ? labelId : undefined, "aria-describedby": this.error ? errId : undefined }, this.label && h("span", { key: 'f80aacb295bedb5d68a51e1005de17d8d845736e', id: labelId, class: "evoke-radio__label" }, this.label), h("div", { key: '44ee0b00ad1970f2b00dcb2789f1418f76833fcd', class: `evoke-radio__options ${this.inline && !segmented ? 'evoke-radio__options--inline' : ''} ${segmented ? 'evoke-radio__options--segmented' : ''}`.replace(/\s+/g, ' ').trim() }, parseOptions(this.options).map((o) => {
|
|
25
|
+
const off = this.disabled || o.disabled;
|
|
26
|
+
const input = (h("input", { type: "radio", class: `${segmented ? 'evoke-seg__input' : 'evoke-radio__input'} ${this.error ? 'evoke-radio__input--error' : ''}`.trim(), name: name, value: o.value, checked: o.value === this.value, disabled: off, onChange: () => {
|
|
27
|
+
this.value = o.value;
|
|
28
|
+
this.evokeChange.emit(this.value);
|
|
29
|
+
} }));
|
|
30
|
+
return segmented ? (h("label", { class: `evoke-seg ${off ? 'evoke-seg--disabled' : ''}`.trim() }, input, h("span", { class: "evoke-seg__text" }, o.label))) : (h("label", { class: `evoke-radio__row ${off ? 'evoke-radio__row--disabled' : ''}`.trim() }, input, h("span", null, o.label)));
|
|
31
|
+
})), this.error && h("span", { key: 'b6027efeea9334325c731eb73630c982c1a88ce2', id: errId, class: "evoke-radio__error", role: "alert" }, this.error)));
|
|
32
|
+
}
|
|
33
|
+
static get is() { return "evoke-radio-group"; }
|
|
34
|
+
static get originalStyleUrls() {
|
|
35
|
+
return {
|
|
36
|
+
"$": ["evoke-radio-group.css"]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
static get styleUrls() {
|
|
40
|
+
return {
|
|
41
|
+
"$": ["evoke-radio-group.css"]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
static get properties() {
|
|
45
|
+
return {
|
|
46
|
+
"label": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"mutable": false,
|
|
49
|
+
"complexType": {
|
|
50
|
+
"original": "string",
|
|
51
|
+
"resolved": "string",
|
|
52
|
+
"references": {}
|
|
53
|
+
},
|
|
54
|
+
"required": false,
|
|
55
|
+
"optional": false,
|
|
56
|
+
"docs": {
|
|
57
|
+
"tags": [],
|
|
58
|
+
"text": ""
|
|
59
|
+
},
|
|
60
|
+
"getter": false,
|
|
61
|
+
"setter": false,
|
|
62
|
+
"reflect": false,
|
|
63
|
+
"attribute": "label",
|
|
64
|
+
"defaultValue": "''"
|
|
65
|
+
},
|
|
66
|
+
"options": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"mutable": false,
|
|
69
|
+
"complexType": {
|
|
70
|
+
"original": "EvokeOption[] | string",
|
|
71
|
+
"resolved": "EvokeOption[] | string",
|
|
72
|
+
"references": {
|
|
73
|
+
"EvokeOption": {
|
|
74
|
+
"location": "import",
|
|
75
|
+
"path": "../../utils/options",
|
|
76
|
+
"id": "src/utils/options.ts::EvokeOption",
|
|
77
|
+
"referenceLocation": "EvokeOption"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"optional": false,
|
|
83
|
+
"docs": {
|
|
84
|
+
"tags": [],
|
|
85
|
+
"text": "Options as an array of { label, value, disabled? } or a JSON string of the same"
|
|
86
|
+
},
|
|
87
|
+
"getter": false,
|
|
88
|
+
"setter": false,
|
|
89
|
+
"reflect": false,
|
|
90
|
+
"attribute": "options",
|
|
91
|
+
"defaultValue": "[]"
|
|
92
|
+
},
|
|
93
|
+
"value": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"mutable": true,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "string",
|
|
98
|
+
"resolved": "string",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": ""
|
|
106
|
+
},
|
|
107
|
+
"getter": false,
|
|
108
|
+
"setter": false,
|
|
109
|
+
"reflect": false,
|
|
110
|
+
"attribute": "value",
|
|
111
|
+
"defaultValue": "''"
|
|
112
|
+
},
|
|
113
|
+
"name": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"mutable": false,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "string",
|
|
118
|
+
"resolved": "string",
|
|
119
|
+
"references": {}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": ""
|
|
126
|
+
},
|
|
127
|
+
"getter": false,
|
|
128
|
+
"setter": false,
|
|
129
|
+
"reflect": false,
|
|
130
|
+
"attribute": "name",
|
|
131
|
+
"defaultValue": "''"
|
|
132
|
+
},
|
|
133
|
+
"disabled": {
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "boolean",
|
|
138
|
+
"resolved": "boolean",
|
|
139
|
+
"references": {}
|
|
140
|
+
},
|
|
141
|
+
"required": false,
|
|
142
|
+
"optional": false,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": ""
|
|
146
|
+
},
|
|
147
|
+
"getter": false,
|
|
148
|
+
"setter": false,
|
|
149
|
+
"reflect": false,
|
|
150
|
+
"attribute": "disabled",
|
|
151
|
+
"defaultValue": "false"
|
|
152
|
+
},
|
|
153
|
+
"appearance": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "'classic' | 'segmented'",
|
|
158
|
+
"resolved": "\"classic\" | \"segmented\"",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": "Classic radio circles, or a segmented button group"
|
|
166
|
+
},
|
|
167
|
+
"getter": false,
|
|
168
|
+
"setter": false,
|
|
169
|
+
"reflect": false,
|
|
170
|
+
"attribute": "appearance",
|
|
171
|
+
"defaultValue": "'classic'"
|
|
172
|
+
},
|
|
173
|
+
"inline": {
|
|
174
|
+
"type": "boolean",
|
|
175
|
+
"mutable": false,
|
|
176
|
+
"complexType": {
|
|
177
|
+
"original": "boolean",
|
|
178
|
+
"resolved": "boolean",
|
|
179
|
+
"references": {}
|
|
180
|
+
},
|
|
181
|
+
"required": false,
|
|
182
|
+
"optional": false,
|
|
183
|
+
"docs": {
|
|
184
|
+
"tags": [],
|
|
185
|
+
"text": "Lay classic options out in a row instead of a column"
|
|
186
|
+
},
|
|
187
|
+
"getter": false,
|
|
188
|
+
"setter": false,
|
|
189
|
+
"reflect": false,
|
|
190
|
+
"attribute": "inline",
|
|
191
|
+
"defaultValue": "false"
|
|
192
|
+
},
|
|
193
|
+
"error": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"mutable": false,
|
|
196
|
+
"complexType": {
|
|
197
|
+
"original": "string",
|
|
198
|
+
"resolved": "string",
|
|
199
|
+
"references": {}
|
|
200
|
+
},
|
|
201
|
+
"required": false,
|
|
202
|
+
"optional": false,
|
|
203
|
+
"docs": {
|
|
204
|
+
"tags": [],
|
|
205
|
+
"text": "Error message shown below the group"
|
|
206
|
+
},
|
|
207
|
+
"getter": false,
|
|
208
|
+
"setter": false,
|
|
209
|
+
"reflect": false,
|
|
210
|
+
"attribute": "error",
|
|
211
|
+
"defaultValue": "''"
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
static get events() {
|
|
216
|
+
return [{
|
|
217
|
+
"method": "evokeChange",
|
|
218
|
+
"name": "evokeChange",
|
|
219
|
+
"bubbles": true,
|
|
220
|
+
"cancelable": true,
|
|
221
|
+
"composed": true,
|
|
222
|
+
"docs": {
|
|
223
|
+
"tags": [],
|
|
224
|
+
"text": "Emits the selected value"
|
|
225
|
+
},
|
|
226
|
+
"complexType": {
|
|
227
|
+
"original": "string",
|
|
228
|
+
"resolved": "string",
|
|
229
|
+
"references": {}
|
|
230
|
+
}
|
|
231
|
+
}];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
evoke-select { display: block; }
|
|
2
|
+
evoke-select .evoke-field { display: flex; flex-direction: column; gap: 0.5rem; font-family: var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); font-size: var(--evoke-font-size, 16px); color: var(--evoke-text, #1a1a1a); }
|
|
3
|
+
evoke-select .evoke-field__control { position: relative; }
|
|
4
|
+
evoke-select .evoke-field__input {
|
|
5
|
+
box-sizing: border-box; width: 100%; height: var(--evoke-control-height, 56px); padding: 0 48px 0 24px;
|
|
6
|
+
border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-field, 8px);
|
|
7
|
+
background: var(--evoke-surface, #ffffff); color: var(--evoke-text, #1a1a1a); font: inherit;
|
|
8
|
+
appearance: none; -webkit-appearance: none; cursor: pointer;
|
|
9
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
10
|
+
}
|
|
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; }
|
|
15
|
+
evoke-select .evoke-field__input--error { border-color: var(--evoke-danger, #dc2626); }
|
|
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; }
|
|
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); }
|