@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,271 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { renderIcon } from "../../utils/icons";
|
|
3
|
+
const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
4
|
+
export class EvokeModal {
|
|
5
|
+
constructor() {
|
|
6
|
+
/** Whether the modal is visible */
|
|
7
|
+
this.open = false;
|
|
8
|
+
this.heading = '';
|
|
9
|
+
/** Centred dialog, or a drawer sliding in from the right */
|
|
10
|
+
this.position = 'center';
|
|
11
|
+
this.size = 'md';
|
|
12
|
+
this.closeOnBackdrop = true;
|
|
13
|
+
/** Extra classes for the dialog panel */
|
|
14
|
+
this.modalClass = '';
|
|
15
|
+
this.previouslyFocused = null;
|
|
16
|
+
this.previousOverflow = '';
|
|
17
|
+
this.pendingFocus = false;
|
|
18
|
+
this.locked = false;
|
|
19
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
20
|
+
}
|
|
21
|
+
onOpenChange(next, prev) {
|
|
22
|
+
if (next && !prev)
|
|
23
|
+
this.onOpened();
|
|
24
|
+
else if (!next && prev)
|
|
25
|
+
this.onClosed();
|
|
26
|
+
}
|
|
27
|
+
componentDidLoad() {
|
|
28
|
+
if (this.open)
|
|
29
|
+
this.onOpened();
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
if (this.locked)
|
|
33
|
+
this.unlockScroll();
|
|
34
|
+
}
|
|
35
|
+
componentDidRender() {
|
|
36
|
+
var _a;
|
|
37
|
+
if (this.pendingFocus && this.panel) {
|
|
38
|
+
this.pendingFocus = false;
|
|
39
|
+
((_a = this.focusables()[0]) !== null && _a !== void 0 ? _a : this.panel).focus();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
onOpened() {
|
|
43
|
+
this.previouslyFocused = document.activeElement;
|
|
44
|
+
this.pendingFocus = true;
|
|
45
|
+
if (!this.locked) {
|
|
46
|
+
this.previousOverflow = document.body.style.overflow;
|
|
47
|
+
document.body.style.overflow = 'hidden';
|
|
48
|
+
this.locked = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
onClosed() {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
this.unlockScroll();
|
|
54
|
+
(_b = (_a = this.previouslyFocused) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
55
|
+
this.previouslyFocused = null;
|
|
56
|
+
}
|
|
57
|
+
unlockScroll() {
|
|
58
|
+
document.body.style.overflow = this.previousOverflow;
|
|
59
|
+
this.locked = false;
|
|
60
|
+
}
|
|
61
|
+
focusables() {
|
|
62
|
+
if (!this.panel)
|
|
63
|
+
return [];
|
|
64
|
+
return Array.from(this.panel.querySelectorAll(FOCUSABLE)).filter((n) => n.offsetParent !== null);
|
|
65
|
+
}
|
|
66
|
+
close() {
|
|
67
|
+
this.open = false;
|
|
68
|
+
this.evokeClose.emit();
|
|
69
|
+
}
|
|
70
|
+
onKeydown(e) {
|
|
71
|
+
if (!this.open)
|
|
72
|
+
return;
|
|
73
|
+
if (e.key === 'Escape') {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
return this.close();
|
|
76
|
+
}
|
|
77
|
+
if (e.key !== 'Tab' || !this.panel)
|
|
78
|
+
return;
|
|
79
|
+
const items = this.focusables();
|
|
80
|
+
if (items.length === 0) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
return this.panel.focus();
|
|
83
|
+
}
|
|
84
|
+
const first = items[0];
|
|
85
|
+
const last = items[items.length - 1];
|
|
86
|
+
const active = document.activeElement;
|
|
87
|
+
if (e.shiftKey && (active === first || active === this.panel)) {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
last.focus();
|
|
90
|
+
}
|
|
91
|
+
else if (!e.shiftKey && active === last) {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
first.focus();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
if (!this.open)
|
|
98
|
+
return null;
|
|
99
|
+
const titleId = `evoke-modal-${this.uid}-title`;
|
|
100
|
+
return (h("div", { class: `evoke-modal__backdrop evoke-modal__backdrop--${this.position}`, onClick: () => this.closeOnBackdrop && this.close() }, h("div", { class: `evoke-modal evoke-modal--${this.position} evoke-modal--${this.size} ${this.modalClass}`.replace(/\s+/g, ' ').trim(), role: "dialog", "aria-modal": "true", "aria-labelledby": this.heading ? titleId : undefined, tabindex: -1, ref: (el) => (this.panel = el), onClick: (e) => e.stopPropagation() }, h("div", { class: "evoke-modal__header" }, h("span", { id: titleId }, this.heading), h("button", { type: "button", class: "evoke-modal__close", "aria-label": "Close", onClick: () => this.close() }, renderIcon('x', 'evoke-icon'))), h("div", { class: "evoke-modal__body" }, h("slot", null)))));
|
|
101
|
+
}
|
|
102
|
+
static get is() { return "evoke-modal"; }
|
|
103
|
+
static get originalStyleUrls() {
|
|
104
|
+
return {
|
|
105
|
+
"$": ["evoke-modal.css"]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
static get styleUrls() {
|
|
109
|
+
return {
|
|
110
|
+
"$": ["evoke-modal.css"]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
static get properties() {
|
|
114
|
+
return {
|
|
115
|
+
"open": {
|
|
116
|
+
"type": "boolean",
|
|
117
|
+
"mutable": true,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "boolean",
|
|
120
|
+
"resolved": "boolean",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": "Whether the modal is visible"
|
|
128
|
+
},
|
|
129
|
+
"getter": false,
|
|
130
|
+
"setter": false,
|
|
131
|
+
"reflect": true,
|
|
132
|
+
"attribute": "open",
|
|
133
|
+
"defaultValue": "false"
|
|
134
|
+
},
|
|
135
|
+
"heading": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "string",
|
|
140
|
+
"resolved": "string",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": ""
|
|
148
|
+
},
|
|
149
|
+
"getter": false,
|
|
150
|
+
"setter": false,
|
|
151
|
+
"reflect": false,
|
|
152
|
+
"attribute": "heading",
|
|
153
|
+
"defaultValue": "''"
|
|
154
|
+
},
|
|
155
|
+
"position": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "'center' | 'right'",
|
|
160
|
+
"resolved": "\"center\" | \"right\"",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": "Centred dialog, or a drawer sliding in from the right"
|
|
168
|
+
},
|
|
169
|
+
"getter": false,
|
|
170
|
+
"setter": false,
|
|
171
|
+
"reflect": false,
|
|
172
|
+
"attribute": "position",
|
|
173
|
+
"defaultValue": "'center'"
|
|
174
|
+
},
|
|
175
|
+
"size": {
|
|
176
|
+
"type": "string",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "'sm' | 'md' | 'lg'",
|
|
180
|
+
"resolved": "\"lg\" | \"md\" | \"sm\"",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": false,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": ""
|
|
188
|
+
},
|
|
189
|
+
"getter": false,
|
|
190
|
+
"setter": false,
|
|
191
|
+
"reflect": false,
|
|
192
|
+
"attribute": "size",
|
|
193
|
+
"defaultValue": "'md'"
|
|
194
|
+
},
|
|
195
|
+
"closeOnBackdrop": {
|
|
196
|
+
"type": "boolean",
|
|
197
|
+
"mutable": false,
|
|
198
|
+
"complexType": {
|
|
199
|
+
"original": "boolean",
|
|
200
|
+
"resolved": "boolean",
|
|
201
|
+
"references": {}
|
|
202
|
+
},
|
|
203
|
+
"required": false,
|
|
204
|
+
"optional": false,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": ""
|
|
208
|
+
},
|
|
209
|
+
"getter": false,
|
|
210
|
+
"setter": false,
|
|
211
|
+
"reflect": false,
|
|
212
|
+
"attribute": "close-on-backdrop",
|
|
213
|
+
"defaultValue": "true"
|
|
214
|
+
},
|
|
215
|
+
"modalClass": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"mutable": false,
|
|
218
|
+
"complexType": {
|
|
219
|
+
"original": "string",
|
|
220
|
+
"resolved": "string",
|
|
221
|
+
"references": {}
|
|
222
|
+
},
|
|
223
|
+
"required": false,
|
|
224
|
+
"optional": false,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": "Extra classes for the dialog panel"
|
|
228
|
+
},
|
|
229
|
+
"getter": false,
|
|
230
|
+
"setter": false,
|
|
231
|
+
"reflect": false,
|
|
232
|
+
"attribute": "modal-class",
|
|
233
|
+
"defaultValue": "''"
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
static get events() {
|
|
238
|
+
return [{
|
|
239
|
+
"method": "evokeClose",
|
|
240
|
+
"name": "evokeClose",
|
|
241
|
+
"bubbles": true,
|
|
242
|
+
"cancelable": true,
|
|
243
|
+
"composed": true,
|
|
244
|
+
"docs": {
|
|
245
|
+
"tags": [],
|
|
246
|
+
"text": "Fired when the modal requests to close (backdrop, Esc, or close button)"
|
|
247
|
+
},
|
|
248
|
+
"complexType": {
|
|
249
|
+
"original": "void",
|
|
250
|
+
"resolved": "void",
|
|
251
|
+
"references": {}
|
|
252
|
+
}
|
|
253
|
+
}];
|
|
254
|
+
}
|
|
255
|
+
static get elementRef() { return "el"; }
|
|
256
|
+
static get watchers() {
|
|
257
|
+
return [{
|
|
258
|
+
"propName": "open",
|
|
259
|
+
"methodName": "onOpenChange"
|
|
260
|
+
}];
|
|
261
|
+
}
|
|
262
|
+
static get listeners() {
|
|
263
|
+
return [{
|
|
264
|
+
"name": "keydown",
|
|
265
|
+
"method": "onKeydown",
|
|
266
|
+
"target": "window",
|
|
267
|
+
"capture": false,
|
|
268
|
+
"passive": false
|
|
269
|
+
}];
|
|
270
|
+
}
|
|
271
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
evoke-pagination { display: block; }
|
|
2
|
+
evoke-pagination .evoke-pager { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; 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-pagination .evoke-pager__btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 40px; height: 40px; padding: 0 12px; font: inherit; font-size: 0.9375rem; color: var(--evoke-text, #1a1a1a); background: transparent; border: 1px solid transparent; border-radius: var(--evoke-radius-field, 8px); cursor: pointer; transition: background-color 0.15s, filter 0.15s; }
|
|
4
|
+
evoke-pagination .evoke-pager__btn:hover:not(:disabled):not(.evoke-pager__btn--active) { background: var(--evoke-surface-muted, #f5f5f5); }
|
|
5
|
+
evoke-pagination .evoke-pager__btn:active:not(:disabled) { filter: brightness(0.85); }
|
|
6
|
+
evoke-pagination .evoke-pager__btn:focus-visible { outline: none; box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
|
|
7
|
+
evoke-pagination .evoke-pager__btn:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
8
|
+
evoke-pagination .evoke-pager__btn--active { background: var(--evoke-primary, #ff5316); color: var(--evoke-primary-contrast, #ffffff); }
|
|
9
|
+
evoke-pagination .evoke-pager__nav .evoke-icon { width: 18px; height: 18px; }
|
|
10
|
+
evoke-pagination .evoke-pager--compact .evoke-pager__nav { border-color: var(--evoke-border, #dedede); padding: 0 14px; }
|
|
11
|
+
evoke-pagination .evoke-pager__gap { min-width: 24px; text-align: center; color: var(--evoke-text-muted, #6b6b6b); }
|
|
12
|
+
evoke-pagination .evoke-pager__status { padding: 0 16px; font-size: 0.9375rem; }
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { renderIcon } from "../../utils/icons";
|
|
3
|
+
export class EvokePagination {
|
|
4
|
+
constructor() {
|
|
5
|
+
/** Current page (1-based) */
|
|
6
|
+
this.page = 1;
|
|
7
|
+
/** Total number of pages */
|
|
8
|
+
this.total = 1;
|
|
9
|
+
/** Numbered pages, or compact (Prev, "2 of 10", Next) */
|
|
10
|
+
this.appearance = 'numbered';
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
}
|
|
13
|
+
go(p) {
|
|
14
|
+
const next = Math.min(Math.max(p, 1), Math.max(this.total, 1));
|
|
15
|
+
if (this.disabled || next === this.page)
|
|
16
|
+
return;
|
|
17
|
+
this.page = next;
|
|
18
|
+
this.evokeChange.emit(next);
|
|
19
|
+
}
|
|
20
|
+
pages() {
|
|
21
|
+
const t = this.total, p = this.page;
|
|
22
|
+
if (t <= 7)
|
|
23
|
+
return Array.from({ length: t }, (_, i) => i + 1);
|
|
24
|
+
const out = [1];
|
|
25
|
+
const start = Math.max(2, p - 1);
|
|
26
|
+
const end = Math.min(t - 1, p + 1);
|
|
27
|
+
if (start > 2)
|
|
28
|
+
out.push('…');
|
|
29
|
+
for (let i = start; i <= end; i++)
|
|
30
|
+
out.push(i);
|
|
31
|
+
if (end < t - 1)
|
|
32
|
+
out.push('…');
|
|
33
|
+
out.push(t);
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
const prevOff = this.disabled || this.page <= 1;
|
|
38
|
+
const nextOff = this.disabled || this.page >= this.total;
|
|
39
|
+
const prev = (h("button", { key: '702c8196b0bd4c6bfff38d355e85bda4c58ec52f', type: "button", class: "evoke-pager__btn evoke-pager__nav", "aria-label": "Previous page", disabled: prevOff, onClick: () => this.go(this.page - 1) }, renderIcon('chevron-left', 'evoke-icon'), this.appearance === 'compact' && h("span", { key: '64f68912c444b59a7a6c074e074f745585726e62' }, "Prev")));
|
|
40
|
+
const next = (h("button", { key: '5b7ff3fe00e16bd03e3244971bfb86c6891051c3', type: "button", class: "evoke-pager__btn evoke-pager__nav", "aria-label": "Next page", disabled: nextOff, onClick: () => this.go(this.page + 1) }, this.appearance === 'compact' && h("span", { key: '83d15b9f16dac8d810cb50d7a2a5df1c01f720cb' }, "Next"), renderIcon('chevron-right', 'evoke-icon')));
|
|
41
|
+
return (h("nav", { key: '5ebe89ac00b59391f425e518ae145b84742a5bb1', class: `evoke-pager evoke-pager--${this.appearance}`, "aria-label": "Pagination" }, prev, this.appearance === 'compact' ? (h("span", { class: "evoke-pager__status", "aria-live": "polite" }, this.page, " of ", this.total)) : (this.pages().map((p) => p === '…' ? (h("span", { class: "evoke-pager__gap", "aria-hidden": "true" }, "\u2026")) : (h("button", { type: "button", class: `evoke-pager__btn ${p === this.page ? 'evoke-pager__btn--active' : ''}`.trim(), "aria-label": `Page ${p}`, "aria-current": p === this.page ? 'page' : undefined, disabled: this.disabled, onClick: () => this.go(p) }, p)))), next));
|
|
42
|
+
}
|
|
43
|
+
static get is() { return "evoke-pagination"; }
|
|
44
|
+
static get originalStyleUrls() {
|
|
45
|
+
return {
|
|
46
|
+
"$": ["evoke-pagination.css"]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
static get styleUrls() {
|
|
50
|
+
return {
|
|
51
|
+
"$": ["evoke-pagination.css"]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static get properties() {
|
|
55
|
+
return {
|
|
56
|
+
"page": {
|
|
57
|
+
"type": "number",
|
|
58
|
+
"mutable": true,
|
|
59
|
+
"complexType": {
|
|
60
|
+
"original": "number",
|
|
61
|
+
"resolved": "number",
|
|
62
|
+
"references": {}
|
|
63
|
+
},
|
|
64
|
+
"required": false,
|
|
65
|
+
"optional": false,
|
|
66
|
+
"docs": {
|
|
67
|
+
"tags": [],
|
|
68
|
+
"text": "Current page (1-based)"
|
|
69
|
+
},
|
|
70
|
+
"getter": false,
|
|
71
|
+
"setter": false,
|
|
72
|
+
"reflect": false,
|
|
73
|
+
"attribute": "page",
|
|
74
|
+
"defaultValue": "1"
|
|
75
|
+
},
|
|
76
|
+
"total": {
|
|
77
|
+
"type": "number",
|
|
78
|
+
"mutable": false,
|
|
79
|
+
"complexType": {
|
|
80
|
+
"original": "number",
|
|
81
|
+
"resolved": "number",
|
|
82
|
+
"references": {}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": false,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": "Total number of pages"
|
|
89
|
+
},
|
|
90
|
+
"getter": false,
|
|
91
|
+
"setter": false,
|
|
92
|
+
"reflect": false,
|
|
93
|
+
"attribute": "total",
|
|
94
|
+
"defaultValue": "1"
|
|
95
|
+
},
|
|
96
|
+
"appearance": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"mutable": false,
|
|
99
|
+
"complexType": {
|
|
100
|
+
"original": "'numbered' | 'compact'",
|
|
101
|
+
"resolved": "\"compact\" | \"numbered\"",
|
|
102
|
+
"references": {}
|
|
103
|
+
},
|
|
104
|
+
"required": false,
|
|
105
|
+
"optional": false,
|
|
106
|
+
"docs": {
|
|
107
|
+
"tags": [],
|
|
108
|
+
"text": "Numbered pages, or compact (Prev, \"2 of 10\", Next)"
|
|
109
|
+
},
|
|
110
|
+
"getter": false,
|
|
111
|
+
"setter": false,
|
|
112
|
+
"reflect": false,
|
|
113
|
+
"attribute": "appearance",
|
|
114
|
+
"defaultValue": "'numbered'"
|
|
115
|
+
},
|
|
116
|
+
"disabled": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"mutable": false,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "boolean",
|
|
121
|
+
"resolved": "boolean",
|
|
122
|
+
"references": {}
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"optional": false,
|
|
126
|
+
"docs": {
|
|
127
|
+
"tags": [],
|
|
128
|
+
"text": ""
|
|
129
|
+
},
|
|
130
|
+
"getter": false,
|
|
131
|
+
"setter": false,
|
|
132
|
+
"reflect": false,
|
|
133
|
+
"attribute": "disabled",
|
|
134
|
+
"defaultValue": "false"
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
static get events() {
|
|
139
|
+
return [{
|
|
140
|
+
"method": "evokeChange",
|
|
141
|
+
"name": "evokeChange",
|
|
142
|
+
"bubbles": true,
|
|
143
|
+
"cancelable": true,
|
|
144
|
+
"composed": true,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": "Emits the new page number"
|
|
148
|
+
},
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "number",
|
|
151
|
+
"resolved": "number",
|
|
152
|
+
"references": {}
|
|
153
|
+
}
|
|
154
|
+
}];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
evoke-progress { display: block; }
|
|
2
|
+
evoke-progress .evoke-progress--linear { position: relative; width: 100%; height: 8px; overflow: hidden; border-radius: 9999px; background: var(--evoke-surface-muted, #f5f5f5); box-shadow: inset 0 0 0 1px var(--evoke-border, #dedede); }
|
|
3
|
+
evoke-progress .evoke-progress__bar { height: 100%; border-radius: inherit; background: var(--evoke-primary, #ff5316); transition: width 0.25s ease; }
|
|
4
|
+
evoke-progress .evoke-progress--linear.evoke-progress--indeterminate .evoke-progress__bar { position: absolute; width: 40%; animation: evoke-bar 1.2s ease-in-out infinite; }
|
|
5
|
+
evoke-progress .evoke-progress--circular { display: inline-block; }
|
|
6
|
+
evoke-progress .evoke-progress--circular svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
|
|
7
|
+
evoke-progress .evoke-progress__track { stroke: var(--evoke-border, #dedede); }
|
|
8
|
+
evoke-progress .evoke-progress__ring { stroke: var(--evoke-primary, #ff5316); transition: stroke-dashoffset 0.25s ease; }
|
|
9
|
+
evoke-progress .evoke-progress--circular.evoke-progress--indeterminate svg { animation: evoke-spin 0.9s linear infinite; }
|
|
10
|
+
@keyframes evoke-bar { 0% { left: -40%; } 100% { left: 100%; } }
|
|
11
|
+
@keyframes evoke-spin { to { transform: rotate(270deg); } }
|
|
12
|
+
@media (prefers-reduced-motion: reduce) { evoke-progress .evoke-progress__bar, evoke-progress .evoke-progress--circular svg { animation-duration: 3s !important; transition: none; } }
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
const RADIUS = 18;
|
|
3
|
+
const CIRC = 2 * Math.PI * RADIUS;
|
|
4
|
+
export class EvokeProgress {
|
|
5
|
+
constructor() {
|
|
6
|
+
/** Linear bar, or circular spinner / ring */
|
|
7
|
+
this.type = 'linear';
|
|
8
|
+
/** Progress from 0 to 100 */
|
|
9
|
+
this.value = 0;
|
|
10
|
+
/** Unknown duration: animates continuously and ignores `value` */
|
|
11
|
+
this.indeterminate = false;
|
|
12
|
+
/** Accessible name, e.g. "Uploading" */
|
|
13
|
+
this.label = 'Loading';
|
|
14
|
+
/** Diameter in px for the circular type */
|
|
15
|
+
this.size = 40;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
const v = Math.min(Math.max(Number(this.value) || 0, 0), 100);
|
|
19
|
+
const aria = {
|
|
20
|
+
role: 'progressbar',
|
|
21
|
+
'aria-label': this.label,
|
|
22
|
+
'aria-valuemin': '0',
|
|
23
|
+
'aria-valuemax': '100',
|
|
24
|
+
'aria-valuenow': this.indeterminate ? undefined : String(Math.round(v)),
|
|
25
|
+
};
|
|
26
|
+
if (this.type === 'circular') {
|
|
27
|
+
return (h("div", Object.assign({ class: `evoke-progress evoke-progress--circular ${this.indeterminate ? 'evoke-progress--indeterminate' : ''}`.trim(), style: { width: `${this.size}px`, height: `${this.size}px` } }, aria), h("svg", { viewBox: "0 0 44 44", "aria-hidden": "true", focusable: "false" }, h("circle", { class: "evoke-progress__track", cx: "22", cy: "22", r: String(RADIUS), fill: "none", "stroke-width": "4" }), h("circle", { class: "evoke-progress__ring", cx: "22", cy: "22", r: String(RADIUS), fill: "none", "stroke-width": "4", "stroke-linecap": "round", "stroke-dasharray": this.indeterminate ? `${CIRC * 0.25} ${CIRC}` : String(CIRC), "stroke-dashoffset": this.indeterminate ? undefined : String(CIRC * (1 - v / 100)) }))));
|
|
28
|
+
}
|
|
29
|
+
return (h("div", Object.assign({ class: `evoke-progress evoke-progress--linear ${this.indeterminate ? 'evoke-progress--indeterminate' : ''}`.trim() }, aria), h("div", { class: "evoke-progress__bar", style: this.indeterminate ? undefined : { width: `${v}%` } })));
|
|
30
|
+
}
|
|
31
|
+
static get is() { return "evoke-progress"; }
|
|
32
|
+
static get originalStyleUrls() {
|
|
33
|
+
return {
|
|
34
|
+
"$": ["evoke-progress.css"]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static get styleUrls() {
|
|
38
|
+
return {
|
|
39
|
+
"$": ["evoke-progress.css"]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
static get properties() {
|
|
43
|
+
return {
|
|
44
|
+
"type": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"mutable": false,
|
|
47
|
+
"complexType": {
|
|
48
|
+
"original": "'linear' | 'circular'",
|
|
49
|
+
"resolved": "\"circular\" | \"linear\"",
|
|
50
|
+
"references": {}
|
|
51
|
+
},
|
|
52
|
+
"required": false,
|
|
53
|
+
"optional": false,
|
|
54
|
+
"docs": {
|
|
55
|
+
"tags": [],
|
|
56
|
+
"text": "Linear bar, or circular spinner / ring"
|
|
57
|
+
},
|
|
58
|
+
"getter": false,
|
|
59
|
+
"setter": false,
|
|
60
|
+
"reflect": false,
|
|
61
|
+
"attribute": "type",
|
|
62
|
+
"defaultValue": "'linear'"
|
|
63
|
+
},
|
|
64
|
+
"value": {
|
|
65
|
+
"type": "number",
|
|
66
|
+
"mutable": false,
|
|
67
|
+
"complexType": {
|
|
68
|
+
"original": "number",
|
|
69
|
+
"resolved": "number",
|
|
70
|
+
"references": {}
|
|
71
|
+
},
|
|
72
|
+
"required": false,
|
|
73
|
+
"optional": false,
|
|
74
|
+
"docs": {
|
|
75
|
+
"tags": [],
|
|
76
|
+
"text": "Progress from 0 to 100"
|
|
77
|
+
},
|
|
78
|
+
"getter": false,
|
|
79
|
+
"setter": false,
|
|
80
|
+
"reflect": false,
|
|
81
|
+
"attribute": "value",
|
|
82
|
+
"defaultValue": "0"
|
|
83
|
+
},
|
|
84
|
+
"indeterminate": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "boolean",
|
|
89
|
+
"resolved": "boolean",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": "Unknown duration: animates continuously and ignores `value`"
|
|
97
|
+
},
|
|
98
|
+
"getter": false,
|
|
99
|
+
"setter": false,
|
|
100
|
+
"reflect": false,
|
|
101
|
+
"attribute": "indeterminate",
|
|
102
|
+
"defaultValue": "false"
|
|
103
|
+
},
|
|
104
|
+
"label": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"mutable": false,
|
|
107
|
+
"complexType": {
|
|
108
|
+
"original": "string",
|
|
109
|
+
"resolved": "string",
|
|
110
|
+
"references": {}
|
|
111
|
+
},
|
|
112
|
+
"required": false,
|
|
113
|
+
"optional": false,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": "Accessible name, e.g. \"Uploading\""
|
|
117
|
+
},
|
|
118
|
+
"getter": false,
|
|
119
|
+
"setter": false,
|
|
120
|
+
"reflect": false,
|
|
121
|
+
"attribute": "label",
|
|
122
|
+
"defaultValue": "'Loading'"
|
|
123
|
+
},
|
|
124
|
+
"size": {
|
|
125
|
+
"type": "number",
|
|
126
|
+
"mutable": false,
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "number",
|
|
129
|
+
"resolved": "number",
|
|
130
|
+
"references": {}
|
|
131
|
+
},
|
|
132
|
+
"required": false,
|
|
133
|
+
"optional": false,
|
|
134
|
+
"docs": {
|
|
135
|
+
"tags": [],
|
|
136
|
+
"text": "Diameter in px for the circular type"
|
|
137
|
+
},
|
|
138
|
+
"getter": false,
|
|
139
|
+
"setter": false,
|
|
140
|
+
"reflect": false,
|
|
141
|
+
"attribute": "size",
|
|
142
|
+
"defaultValue": "40"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
evoke-quantity-stepper { display: inline-block; }
|
|
2
|
+
evoke-quantity-stepper .evoke-qty { 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-quantity-stepper .evoke-qty--inline { display: inline-flex; align-items: center; height: calc(var(--evoke-control-height, 56px) * 0.75); border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-button, 9999px); background: var(--evoke-surface, #ffffff); overflow: hidden; }
|
|
4
|
+
evoke-quantity-stepper .evoke-qty--inline:focus-within { border-color: var(--evoke-secondary, #0b1560); box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
|
|
5
|
+
evoke-quantity-stepper .evoke-qty__btn { display: inline-flex; align-items: center; justify-content: center; width: calc(var(--evoke-control-height, 56px) * 0.75); height: 100%; padding: 0; color: var(--evoke-primary, #ff5316); background: transparent; border: 0; cursor: pointer; transition: background-color 0.15s; }
|
|
6
|
+
evoke-quantity-stepper .evoke-qty__btn:hover:not(:disabled) { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 10%, transparent); }
|
|
7
|
+
evoke-quantity-stepper .evoke-qty__btn:active:not(:disabled) { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 20%, transparent); }
|
|
8
|
+
evoke-quantity-stepper .evoke-qty__btn:focus-visible { outline: 2px solid var(--evoke-secondary, #0b1560); outline-offset: -3px; }
|
|
9
|
+
evoke-quantity-stepper .evoke-qty__btn:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
10
|
+
evoke-quantity-stepper .evoke-qty__btn .evoke-icon { width: 16px; height: 16px; }
|
|
11
|
+
evoke-quantity-stepper .evoke-qty__input { box-sizing: border-box; width: 48px; height: 100%; padding: 0; text-align: center; font: inherit; color: var(--evoke-text, #1a1a1a); background: transparent; border: 0; }
|
|
12
|
+
evoke-quantity-stepper .evoke-qty__input:focus { outline: none; }
|
|
13
|
+
evoke-quantity-stepper .evoke-qty__input:disabled { opacity: 0.5; }
|
|
14
|
+
/* compact */
|
|
15
|
+
evoke-quantity-stepper .evoke-qty--compact { position: relative; display: inline-block; }
|
|
16
|
+
evoke-quantity-stepper .evoke-qty__select { box-sizing: border-box; height: calc(var(--evoke-control-height, 56px) * 0.75); padding: 0 36px 0 16px; font: inherit; font-size: 0.9375rem; color: var(--evoke-text, #1a1a1a); background: var(--evoke-surface, #ffffff); border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-field, 8px); appearance: none; -webkit-appearance: none; cursor: pointer; }
|
|
17
|
+
evoke-quantity-stepper .evoke-qty__select:hover:not(:disabled):not(:focus) { border-color: var(--evoke-text-muted, #6b6b6b); }
|
|
18
|
+
evoke-quantity-stepper .evoke-qty__select: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)); }
|
|
19
|
+
evoke-quantity-stepper .evoke-qty__select:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
20
|
+
evoke-quantity-stepper .evoke-qty__chevron { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--evoke-text-muted, #6b6b6b); pointer-events: none; }
|