@evoke-tech/stencil-ui-kit 0.1.0 → 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 +120 -20
- package/dist/cjs/evoke-alert_20.cjs.entry.js +1047 -0
- package/dist/cjs/evoke-ui.cjs.js +2 -2
- package/dist/cjs/{index-B8xS0y1i.js → index-BpJ5gu8f.js} +146 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +13 -1
- package/dist/collection/components/evoke-alert/evoke-alert.css +17 -6
- package/dist/collection/components/evoke-alert/evoke-alert.js +25 -1
- 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 +16 -2
- package/dist/collection/components/evoke-button/evoke-button.js +117 -5
- package/dist/collection/components/evoke-card/evoke-card.css +9 -1
- package/dist/collection/components/evoke-card/evoke-card.js +75 -1
- package/dist/collection/components/evoke-checkbox/evoke-checkbox.css +7 -1
- package/dist/collection/components/evoke-checkbox/evoke-checkbox.js +31 -2
- 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 +11 -3
- package/dist/collection/components/evoke-input/evoke-input.js +103 -13
- package/dist/collection/components/evoke-modal/evoke-modal.css +21 -5
- package/dist/collection/components/evoke-modal/evoke-modal.js +129 -4
- 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 +14 -1
- package/dist/collection/components/evoke-radio-group/evoke-radio-group.js +34 -8
- package/dist/collection/components/evoke-select/evoke-select.css +25 -4
- package/dist/collection/components/evoke-select/evoke-select.js +245 -15
- 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/utils/icons.js +29 -0
- package/dist/components/evoke-alert.js +1 -1
- 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.js +1 -1
- package/dist/components/evoke-card.js +1 -1
- package/dist/components/evoke-checkbox.js +1 -1
- package/dist/components/evoke-chip.d.ts +11 -0
- package/dist/components/evoke-chip.js +1 -0
- package/dist/components/evoke-input.js +1 -1
- package/dist/components/evoke-modal.js +1 -1
- 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.js +1 -1
- package/dist/components/evoke-select.js +1 -1
- 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/esm/evoke-alert_20.entry.js +1026 -0
- package/dist/esm/evoke-ui.js +3 -3
- package/dist/esm/{index-BtM1wZ-I.js → index-C-5sEjU8.js} +146 -6
- package/dist/esm/loader.js +3 -3
- package/dist/evoke-ui/evoke-ui.css +1 -1
- package/dist/evoke-ui/evoke-ui.esm.js +1 -1
- package/dist/evoke-ui/p-0841be89.entry.js +1 -0
- package/dist/evoke-ui/p-C-5sEjU8.js +3 -0
- package/dist/themes/bootstrap.css +3 -0
- package/dist/themes/material.css +3 -0
- package/dist/themes/tailwind.css +3 -0
- package/dist/themes/tokens.css +4 -1
- package/dist/types/components/evoke-alert/evoke-alert.d.ts +2 -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 +12 -2
- package/dist/types/components/evoke-card/evoke-card.d.ts +9 -0
- package/dist/types/components/evoke-checkbox/evoke-checkbox.d.ts +5 -0
- package/dist/types/components/evoke-chip/evoke-chip.d.ts +14 -0
- package/dist/types/components/evoke-input/evoke-input.d.ts +9 -1
- package/dist/types/components/evoke-modal/evoke-modal.d.ts +19 -1
- 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 +4 -2
- package/dist/types/components/evoke-select/evoke-select.d.ts +31 -6
- 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 +1237 -18
- package/dist/types/utils/icons.d.ts +25 -0
- package/package.json +11 -4
- package/dist/cjs/evoke-alert_6.cjs.entry.js +0 -172
- package/dist/cjs/evoke-card.cjs.entry.js +0 -20
- package/dist/cjs/evoke-modal.cjs.entry.js +0 -34
- package/dist/esm/evoke-alert_6.entry.js +0 -165
- package/dist/esm/evoke-card.entry.js +0 -18
- package/dist/esm/evoke-modal.entry.js +0 -32
- package/dist/evoke-ui/p-243075cd.entry.js +0 -1
- package/dist/evoke-ui/p-605d4757.entry.js +0 -1
- package/dist/evoke-ui/p-9a6eaeb6.entry.js +0 -1
- package/dist/evoke-ui/p-BtM1wZ-I.js +0 -3
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { renderIcon } from "../../utils/icons";
|
|
3
|
+
export class EvokeChip {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.label = '';
|
|
6
|
+
/** Selected state (filter chip) */
|
|
7
|
+
this.selected = false;
|
|
8
|
+
/** Shows a remove button instead of toggling selection */
|
|
9
|
+
this.removable = false;
|
|
10
|
+
this.disabled = false;
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
if (this.removable) {
|
|
14
|
+
return (h("span", { class: `evoke-chip evoke-chip--removable ${this.disabled ? 'evoke-chip--disabled' : ''}`.trim() }, h("span", { class: "evoke-chip__label" }, this.label, h("slot", null)), h("button", { type: "button", class: "evoke-chip__remove", "aria-label": `Remove ${this.label}`, disabled: this.disabled, onClick: () => this.evokeRemove.emit() }, renderIcon('x', 'evoke-icon'))));
|
|
15
|
+
}
|
|
16
|
+
return (h("button", { type: "button", class: `evoke-chip evoke-chip--filter ${this.selected ? 'evoke-chip--selected' : ''}`.trim(), "aria-pressed": this.selected ? 'true' : 'false', disabled: this.disabled, onClick: () => {
|
|
17
|
+
this.selected = !this.selected;
|
|
18
|
+
this.evokeChange.emit(this.selected);
|
|
19
|
+
} }, this.selected && renderIcon('check', 'evoke-icon'), h("span", { class: "evoke-chip__label" }, this.label, h("slot", null))));
|
|
20
|
+
}
|
|
21
|
+
static get is() { return "evoke-chip"; }
|
|
22
|
+
static get originalStyleUrls() {
|
|
23
|
+
return {
|
|
24
|
+
"$": ["evoke-chip.css"]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static get styleUrls() {
|
|
28
|
+
return {
|
|
29
|
+
"$": ["evoke-chip.css"]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static get properties() {
|
|
33
|
+
return {
|
|
34
|
+
"label": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"mutable": false,
|
|
37
|
+
"complexType": {
|
|
38
|
+
"original": "string",
|
|
39
|
+
"resolved": "string",
|
|
40
|
+
"references": {}
|
|
41
|
+
},
|
|
42
|
+
"required": false,
|
|
43
|
+
"optional": false,
|
|
44
|
+
"docs": {
|
|
45
|
+
"tags": [],
|
|
46
|
+
"text": ""
|
|
47
|
+
},
|
|
48
|
+
"getter": false,
|
|
49
|
+
"setter": false,
|
|
50
|
+
"reflect": false,
|
|
51
|
+
"attribute": "label",
|
|
52
|
+
"defaultValue": "''"
|
|
53
|
+
},
|
|
54
|
+
"selected": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"mutable": true,
|
|
57
|
+
"complexType": {
|
|
58
|
+
"original": "boolean",
|
|
59
|
+
"resolved": "boolean",
|
|
60
|
+
"references": {}
|
|
61
|
+
},
|
|
62
|
+
"required": false,
|
|
63
|
+
"optional": false,
|
|
64
|
+
"docs": {
|
|
65
|
+
"tags": [],
|
|
66
|
+
"text": "Selected state (filter chip)"
|
|
67
|
+
},
|
|
68
|
+
"getter": false,
|
|
69
|
+
"setter": false,
|
|
70
|
+
"reflect": true,
|
|
71
|
+
"attribute": "selected",
|
|
72
|
+
"defaultValue": "false"
|
|
73
|
+
},
|
|
74
|
+
"removable": {
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"mutable": false,
|
|
77
|
+
"complexType": {
|
|
78
|
+
"original": "boolean",
|
|
79
|
+
"resolved": "boolean",
|
|
80
|
+
"references": {}
|
|
81
|
+
},
|
|
82
|
+
"required": false,
|
|
83
|
+
"optional": false,
|
|
84
|
+
"docs": {
|
|
85
|
+
"tags": [],
|
|
86
|
+
"text": "Shows a remove button instead of toggling selection"
|
|
87
|
+
},
|
|
88
|
+
"getter": false,
|
|
89
|
+
"setter": false,
|
|
90
|
+
"reflect": false,
|
|
91
|
+
"attribute": "removable",
|
|
92
|
+
"defaultValue": "false"
|
|
93
|
+
},
|
|
94
|
+
"disabled": {
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"mutable": false,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "boolean",
|
|
99
|
+
"resolved": "boolean",
|
|
100
|
+
"references": {}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": ""
|
|
107
|
+
},
|
|
108
|
+
"getter": false,
|
|
109
|
+
"setter": false,
|
|
110
|
+
"reflect": false,
|
|
111
|
+
"attribute": "disabled",
|
|
112
|
+
"defaultValue": "false"
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
static get events() {
|
|
117
|
+
return [{
|
|
118
|
+
"method": "evokeChange",
|
|
119
|
+
"name": "evokeChange",
|
|
120
|
+
"bubbles": true,
|
|
121
|
+
"cancelable": true,
|
|
122
|
+
"composed": true,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": "Emits the new selected state (filter chip)"
|
|
126
|
+
},
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "boolean",
|
|
129
|
+
"resolved": "boolean",
|
|
130
|
+
"references": {}
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
"method": "evokeRemove",
|
|
134
|
+
"name": "evokeRemove",
|
|
135
|
+
"bubbles": true,
|
|
136
|
+
"cancelable": true,
|
|
137
|
+
"composed": true,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": "Fired when the remove button is clicked (removable chip)"
|
|
141
|
+
},
|
|
142
|
+
"complexType": {
|
|
143
|
+
"original": "void",
|
|
144
|
+
"resolved": "void",
|
|
145
|
+
"references": {}
|
|
146
|
+
}
|
|
147
|
+
}];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -2,16 +2,24 @@ evoke-input { display: block; }
|
|
|
2
2
|
evoke-input .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
3
|
evoke-input .evoke-field__label { color: var(--evoke-text, #1a1a1a); }
|
|
4
4
|
evoke-input .evoke-field__control { position: relative; }
|
|
5
|
-
evoke-input .evoke-field__icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--evoke-text-muted, #
|
|
5
|
+
evoke-input .evoke-field__icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--evoke-text-muted, #6b6b6b); pointer-events: none; }
|
|
6
6
|
evoke-input .evoke-field__input {
|
|
7
7
|
box-sizing: border-box; width: 100%; height: var(--evoke-control-height, 56px); padding: 0 24px;
|
|
8
8
|
border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-field, 8px);
|
|
9
9
|
background: var(--evoke-surface, #ffffff); color: var(--evoke-text, #1a1a1a); font: inherit;
|
|
10
|
-
transition: border-color 0.15s, box-shadow 0.15s;
|
|
10
|
+
transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
|
|
11
11
|
}
|
|
12
12
|
evoke-input .evoke-field__input--icon { padding-left: 44px; }
|
|
13
|
-
evoke-input .evoke-field__input::placeholder { color: var(--evoke-text-muted, #
|
|
13
|
+
evoke-input .evoke-field__input::placeholder { color: var(--evoke-text-muted, #6b6b6b); }
|
|
14
|
+
evoke-input .evoke-field__input:hover:not(:disabled):not(:focus) { border-color: var(--evoke-text-muted, #6b6b6b); }
|
|
14
15
|
evoke-input .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)); }
|
|
15
16
|
evoke-input .evoke-field__input:disabled { opacity: 0.6; cursor: not-allowed; }
|
|
16
17
|
evoke-input .evoke-field__input--error { border-color: var(--evoke-danger, #dc2626); }
|
|
18
|
+
/* filled appearance */
|
|
19
|
+
evoke-input .evoke-field--filled .evoke-field__input { background: var(--evoke-surface-muted, #f5f5f5); border-color: transparent; border-bottom: 2px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-field, 8px) var(--evoke-radius-field, 8px) 0 0; }
|
|
20
|
+
evoke-input .evoke-field--filled .evoke-field__input:hover:not(:disabled):not(:focus) { border-bottom-color: var(--evoke-text-muted, #6b6b6b); }
|
|
21
|
+
evoke-input .evoke-field--filled .evoke-field__input:focus { box-shadow: none; border-bottom-color: var(--evoke-secondary, #0b1560); }
|
|
22
|
+
evoke-input .evoke-field--filled .evoke-field__input:focus-visible { box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
|
|
23
|
+
evoke-input .evoke-field--filled .evoke-field__input--error { border-bottom-color: var(--evoke-danger, #dc2626); }
|
|
24
|
+
evoke-input .evoke-field__hint { color: var(--evoke-text-muted, #6b6b6b); font-size: 0.875rem; }
|
|
17
25
|
evoke-input .evoke-field__error { color: var(--evoke-danger, #dc2626); font-size: 0.875rem; }
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
|
|
3
|
-
mail: ['M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z', 'm22 7-10 6L2 7'],
|
|
4
|
-
lock: ['M5 11h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2z', 'M7 11V7a5 5 0 0 1 10 0v4'],
|
|
5
|
-
user: ['M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2', 'M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z'],
|
|
6
|
-
search: ['M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z', 'm21 21-4.3-4.3'],
|
|
7
|
-
};
|
|
2
|
+
import { renderIcon } from "../../utils/icons";
|
|
8
3
|
export class EvokeInput {
|
|
9
4
|
constructor() {
|
|
10
5
|
this.label = '';
|
|
11
6
|
this.value = '';
|
|
12
7
|
this.type = 'text';
|
|
8
|
+
this.name = '';
|
|
13
9
|
this.placeholder = '';
|
|
14
10
|
this.disabled = false;
|
|
11
|
+
this.required = false;
|
|
12
|
+
/** Outlined (default) or filled (tinted background, bottom border) */
|
|
13
|
+
this.appearance = 'outlined';
|
|
14
|
+
/** Error message shown below the field (replaces the hint) */
|
|
15
15
|
this.error = '';
|
|
16
|
+
/** Helper text shown below the field */
|
|
17
|
+
this.hint = '';
|
|
16
18
|
/** Extra classes for the inner <input>, e.g. "form-control" (Bootstrap) */
|
|
17
19
|
this.inputClass = '';
|
|
18
20
|
this.inputId = `evoke-input-${Math.random().toString(36).slice(2, 9)}`;
|
|
19
21
|
}
|
|
20
22
|
render() {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
+
const hasIcon = !!this.icon;
|
|
24
|
+
const describedBy = this.error || this.hint ? `${this.inputId}-msg` : undefined;
|
|
25
|
+
return (h("div", { key: '1bcce1a42e241c614eb5aacac045bf81fdf42ebd', class: `evoke-field evoke-field--${this.appearance}` }, this.label && h("label", { key: '6b0dbee7d5fad3238b22996d62d2ef23310b400b', htmlFor: this.inputId, class: "evoke-field__label" }, this.label, this.required && h("span", { key: '8258e6cc4d310d4becd7c1f4c6c511afdfffe715', "aria-hidden": "true" }, " *")), h("div", { key: 'b8b4ba4a562bdbc86be66bb413ae2ff0209e4592', class: "evoke-field__control" }, renderIcon(this.icon, 'evoke-field__icon'), h("input", { key: '059cf7679e73a950d8a891cc72432164e1ed81bd', id: this.inputId, class: `evoke-field__input ${hasIcon ? 'evoke-field__input--icon' : ''} ${this.error ? 'evoke-field__input--error' : ''} ${this.inputClass}`.replace(/\s+/g, ' ').trim(), type: this.type, name: this.name || undefined, value: this.value, placeholder: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": describedBy, onInput: (e) => {
|
|
23
26
|
this.value = e.target.value;
|
|
24
27
|
this.evokeInput.emit(this.value);
|
|
25
|
-
}, onChange: (e) => this.evokeChange.emit(e.target.value) })), this.error
|
|
28
|
+
}, onChange: (e) => this.evokeChange.emit(e.target.value) })), this.error ? (h("span", { id: describedBy, class: "evoke-field__error", role: "alert" }, this.error)) : (this.hint && h("span", { id: describedBy, class: "evoke-field__hint" }, this.hint))));
|
|
26
29
|
}
|
|
27
30
|
static get is() { return "evoke-input"; }
|
|
28
31
|
static get originalStyleUrls() {
|
|
@@ -97,6 +100,26 @@ export class EvokeInput {
|
|
|
97
100
|
"attribute": "type",
|
|
98
101
|
"defaultValue": "'text'"
|
|
99
102
|
},
|
|
103
|
+
"name": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "string",
|
|
108
|
+
"resolved": "string",
|
|
109
|
+
"references": {}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [],
|
|
115
|
+
"text": ""
|
|
116
|
+
},
|
|
117
|
+
"getter": false,
|
|
118
|
+
"setter": false,
|
|
119
|
+
"reflect": false,
|
|
120
|
+
"attribute": "name",
|
|
121
|
+
"defaultValue": "''"
|
|
122
|
+
},
|
|
100
123
|
"placeholder": {
|
|
101
124
|
"type": "string",
|
|
102
125
|
"mutable": false,
|
|
@@ -137,6 +160,46 @@ export class EvokeInput {
|
|
|
137
160
|
"attribute": "disabled",
|
|
138
161
|
"defaultValue": "false"
|
|
139
162
|
},
|
|
163
|
+
"required": {
|
|
164
|
+
"type": "boolean",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "boolean",
|
|
168
|
+
"resolved": "boolean",
|
|
169
|
+
"references": {}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": false,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": ""
|
|
176
|
+
},
|
|
177
|
+
"getter": false,
|
|
178
|
+
"setter": false,
|
|
179
|
+
"reflect": false,
|
|
180
|
+
"attribute": "required",
|
|
181
|
+
"defaultValue": "false"
|
|
182
|
+
},
|
|
183
|
+
"appearance": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"mutable": false,
|
|
186
|
+
"complexType": {
|
|
187
|
+
"original": "'outlined' | 'filled'",
|
|
188
|
+
"resolved": "\"filled\" | \"outlined\"",
|
|
189
|
+
"references": {}
|
|
190
|
+
},
|
|
191
|
+
"required": false,
|
|
192
|
+
"optional": false,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": "Outlined (default) or filled (tinted background, bottom border)"
|
|
196
|
+
},
|
|
197
|
+
"getter": false,
|
|
198
|
+
"setter": false,
|
|
199
|
+
"reflect": false,
|
|
200
|
+
"attribute": "appearance",
|
|
201
|
+
"defaultValue": "'outlined'"
|
|
202
|
+
},
|
|
140
203
|
"error": {
|
|
141
204
|
"type": "string",
|
|
142
205
|
"mutable": false,
|
|
@@ -149,7 +212,7 @@ export class EvokeInput {
|
|
|
149
212
|
"optional": false,
|
|
150
213
|
"docs": {
|
|
151
214
|
"tags": [],
|
|
152
|
-
"text": ""
|
|
215
|
+
"text": "Error message shown below the field (replaces the hint)"
|
|
153
216
|
},
|
|
154
217
|
"getter": false,
|
|
155
218
|
"setter": false,
|
|
@@ -157,15 +220,42 @@ export class EvokeInput {
|
|
|
157
220
|
"attribute": "error",
|
|
158
221
|
"defaultValue": "''"
|
|
159
222
|
},
|
|
160
|
-
"
|
|
223
|
+
"hint": {
|
|
161
224
|
"type": "string",
|
|
162
225
|
"mutable": false,
|
|
163
226
|
"complexType": {
|
|
164
|
-
"original": "
|
|
165
|
-
"resolved": "
|
|
227
|
+
"original": "string",
|
|
228
|
+
"resolved": "string",
|
|
166
229
|
"references": {}
|
|
167
230
|
},
|
|
168
231
|
"required": false,
|
|
232
|
+
"optional": false,
|
|
233
|
+
"docs": {
|
|
234
|
+
"tags": [],
|
|
235
|
+
"text": "Helper text shown below the field"
|
|
236
|
+
},
|
|
237
|
+
"getter": false,
|
|
238
|
+
"setter": false,
|
|
239
|
+
"reflect": false,
|
|
240
|
+
"attribute": "hint",
|
|
241
|
+
"defaultValue": "''"
|
|
242
|
+
},
|
|
243
|
+
"icon": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"mutable": false,
|
|
246
|
+
"complexType": {
|
|
247
|
+
"original": "EvokeIcon",
|
|
248
|
+
"resolved": "\"alert\" | \"arrow-down\" | \"arrow-right\" | \"arrow-up\" | \"cart\" | \"check\" | \"chevron-down\" | \"chevron-left\" | \"chevron-right\" | \"chevron-up\" | \"info\" | \"lock\" | \"mail\" | \"minus\" | \"plus\" | \"search\" | \"sort\" | \"user\" | \"x\"",
|
|
249
|
+
"references": {
|
|
250
|
+
"EvokeIcon": {
|
|
251
|
+
"location": "import",
|
|
252
|
+
"path": "../../utils/icons",
|
|
253
|
+
"id": "src/utils/icons.tsx::EvokeIcon",
|
|
254
|
+
"referenceLocation": "EvokeIcon"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"required": false,
|
|
169
259
|
"optional": true,
|
|
170
260
|
"docs": {
|
|
171
261
|
"tags": [],
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
evoke-modal .evoke-modal__backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
|
|
2
|
-
evoke-modal .evoke-
|
|
3
|
-
evoke-modal .evoke-
|
|
4
|
-
evoke-modal .evoke-
|
|
5
|
-
evoke-modal .evoke-
|
|
1
|
+
evoke-modal .evoke-modal__backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; animation: evoke-fade 0.15s ease-out; }
|
|
2
|
+
evoke-modal .evoke-modal__backdrop--right { justify-content: flex-end; align-items: stretch; }
|
|
3
|
+
evoke-modal .evoke-modal { box-sizing: border-box; background: var(--evoke-surface, #ffffff); color: var(--evoke-text, #1a1a1a); font-family: var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); display: flex; flex-direction: column; max-width: 100vw; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25); }
|
|
4
|
+
evoke-modal .evoke-modal:focus { outline: none; }
|
|
5
|
+
evoke-modal .evoke-modal--center { border-radius: var(--evoke-radius, 8px); max-height: 90vh; width: min(92vw, 480px); animation: evoke-pop 0.15s ease-out; }
|
|
6
|
+
evoke-modal .evoke-modal--center.evoke-modal--sm { width: min(92vw, 360px); }
|
|
7
|
+
evoke-modal .evoke-modal--center.evoke-modal--lg { width: min(92vw, 720px); }
|
|
8
|
+
evoke-modal .evoke-modal--right { height: 100%; border-radius: 0; width: min(100vw, 420px); animation: evoke-slide 0.2s ease-out; }
|
|
9
|
+
evoke-modal .evoke-modal--right.evoke-modal--sm { width: min(100vw, 320px); }
|
|
10
|
+
evoke-modal .evoke-modal--right.evoke-modal--lg { width: min(100vw, 640px); }
|
|
11
|
+
evoke-modal .evoke-modal__header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 1rem; font-weight: 600; border-bottom: 1px solid var(--evoke-border, #dedede); }
|
|
12
|
+
evoke-modal .evoke-modal__close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; background: none; border: 0; border-radius: 50%; color: inherit; cursor: pointer; }
|
|
13
|
+
evoke-modal .evoke-modal__close:hover { background: var(--evoke-surface-muted, #f5f5f5); }
|
|
14
|
+
evoke-modal .evoke-modal__close:active { background: color-mix(in srgb, var(--evoke-text, #1a1a1a) 14%, transparent); }
|
|
15
|
+
evoke-modal .evoke-modal__close:focus-visible { outline: none; box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
|
|
16
|
+
evoke-modal .evoke-modal__close .evoke-icon { width: 18px; height: 18px; }
|
|
17
|
+
evoke-modal .evoke-modal__body { padding: 1rem; overflow: auto; flex: 1; }
|
|
18
|
+
@keyframes evoke-fade { from { opacity: 0; } to { opacity: 1; } }
|
|
19
|
+
@keyframes evoke-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
|
|
20
|
+
@keyframes evoke-slide { from { transform: translateX(100%); } to { transform: none; } }
|
|
21
|
+
@media (prefers-reduced-motion: reduce) { evoke-modal .evoke-modal__backdrop, evoke-modal .evoke-modal { animation: none; } }
|
|
@@ -1,25 +1,103 @@
|
|
|
1
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"])';
|
|
2
4
|
export class EvokeModal {
|
|
3
5
|
constructor() {
|
|
4
6
|
/** Whether the modal is visible */
|
|
5
7
|
this.open = false;
|
|
6
8
|
this.heading = '';
|
|
9
|
+
/** Centred dialog, or a drawer sliding in from the right */
|
|
10
|
+
this.position = 'center';
|
|
11
|
+
this.size = 'md';
|
|
7
12
|
this.closeOnBackdrop = true;
|
|
8
13
|
/** Extra classes for the dialog panel */
|
|
9
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);
|
|
10
20
|
}
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
this.
|
|
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);
|
|
14
65
|
}
|
|
15
66
|
close() {
|
|
16
67
|
this.open = false;
|
|
17
68
|
this.evokeClose.emit();
|
|
18
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
|
+
}
|
|
19
96
|
render() {
|
|
20
97
|
if (!this.open)
|
|
21
98
|
return null;
|
|
22
|
-
|
|
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)))));
|
|
23
101
|
}
|
|
24
102
|
static get is() { return "evoke-modal"; }
|
|
25
103
|
static get originalStyleUrls() {
|
|
@@ -74,6 +152,46 @@ export class EvokeModal {
|
|
|
74
152
|
"attribute": "heading",
|
|
75
153
|
"defaultValue": "''"
|
|
76
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
|
+
},
|
|
77
195
|
"closeOnBackdrop": {
|
|
78
196
|
"type": "boolean",
|
|
79
197
|
"mutable": false,
|
|
@@ -134,6 +252,13 @@ export class EvokeModal {
|
|
|
134
252
|
}
|
|
135
253
|
}];
|
|
136
254
|
}
|
|
255
|
+
static get elementRef() { return "el"; }
|
|
256
|
+
static get watchers() {
|
|
257
|
+
return [{
|
|
258
|
+
"propName": "open",
|
|
259
|
+
"methodName": "onOpenChange"
|
|
260
|
+
}];
|
|
261
|
+
}
|
|
137
262
|
static get listeners() {
|
|
138
263
|
return [{
|
|
139
264
|
"name": "keydown",
|
|
@@ -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; }
|