@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,1047 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BpJ5gu8f.js');
|
|
4
|
+
|
|
5
|
+
const PATHS = {
|
|
6
|
+
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'],
|
|
7
|
+
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'],
|
|
8
|
+
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'],
|
|
9
|
+
search: ['M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z', 'm21 21-4.3-4.3'],
|
|
10
|
+
plus: ['M12 5v14', 'M5 12h14'],
|
|
11
|
+
minus: ['M5 12h14'],
|
|
12
|
+
check: ['M20 6 9 17l-5-5'],
|
|
13
|
+
x: ['M18 6 6 18', 'm6 6 12 12'],
|
|
14
|
+
'chevron-down': ['m6 9 6 6 6-6'],
|
|
15
|
+
'chevron-up': ['m18 15-6-6-6 6'],
|
|
16
|
+
'chevron-left': ['m15 18-6-6 6-6'],
|
|
17
|
+
'chevron-right': ['m9 18 6-6-6-6'],
|
|
18
|
+
'arrow-right': ['M5 12h14', 'm12 5 7 7-7 7'],
|
|
19
|
+
'arrow-up': ['M12 19V5', 'm5 12 7-7 7 7'],
|
|
20
|
+
'arrow-down': ['M12 5v14', 'm19 12-7 7-7-7'],
|
|
21
|
+
sort: ['m7 15 5 5 5-5', 'm7 9 5-5 5 5'],
|
|
22
|
+
cart: ['M9 21a1 1 0 1 0 0-2 1 1 0 0 0 0 2z', 'M20 21a1 1 0 1 0 0-2 1 1 0 0 0 0 2z', 'M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'],
|
|
23
|
+
info: ['M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z', 'M12 16v-4', 'M12 8h.01'],
|
|
24
|
+
alert: ['M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z', 'M12 9v4', 'M12 17h.01'],
|
|
25
|
+
};
|
|
26
|
+
/** Renders a decorative inline SVG icon. */
|
|
27
|
+
function renderIcon(name, cls = 'evoke-icon') {
|
|
28
|
+
const paths = name ? PATHS[name] : undefined;
|
|
29
|
+
if (!paths)
|
|
30
|
+
return null;
|
|
31
|
+
return (index.h("svg", { class: cls, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" }, paths.map((d) => index.h("path", { d: d }))));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const evokeAlertCss = () => `evoke-alert{display:block}evoke-alert .evoke-alert{--_c:var(--evoke-info, #0891b2);display:flex;align-items:flex-start;gap:0.75rem;padding:0.75rem 1rem;border-radius:var(--evoke-radius, 8px);border:1px solid var(--_c);font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif)}evoke-alert .evoke-alert--info{--_c:var(--evoke-info, #0891b2)}evoke-alert .evoke-alert--success{--_c:var(--evoke-success, #16a34a)}evoke-alert .evoke-alert--warning{--_c:var(--evoke-warning, #d97706)}evoke-alert .evoke-alert--danger{--_c:var(--evoke-danger, #dc2626)}evoke-alert .evoke-alert--subtle{background:color-mix(in srgb, var(--_c) 12%, var(--evoke-surface, #ffffff));color:var(--evoke-text, #1a1a1a)}evoke-alert .evoke-alert--subtle .evoke-alert__icon{color:var(--_c)}evoke-alert .evoke-alert--solid{background:color-mix(in srgb, var(--_c) 78%, #000);border-color:color-mix(in srgb, var(--_c) 78%, #000);color:#fff}evoke-alert .evoke-alert__icon{flex:none;width:20px;height:20px;margin-top:2px}evoke-alert .evoke-alert__content{flex:1;min-width:0}evoke-alert .evoke-alert__close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;background:none;border:0;border-radius:50%;color:inherit;cursor:pointer}evoke-alert .evoke-alert__close:hover{background:color-mix(in srgb, currentColor 14%, transparent)}evoke-alert .evoke-alert__close:active{background:color-mix(in srgb, currentColor 24%, transparent)}evoke-alert .evoke-alert__close:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb, currentColor 40%, transparent)}evoke-alert .evoke-alert__close .evoke-icon{width:16px;height:16px}`;
|
|
35
|
+
|
|
36
|
+
const TYPE_ICON$1 = { info: 'info', success: 'check', warning: 'alert', danger: 'alert' };
|
|
37
|
+
const EvokeAlert = class {
|
|
38
|
+
constructor(hostRef) {
|
|
39
|
+
index.registerInstance(this, hostRef);
|
|
40
|
+
this.evokeDismiss = index.createEvent(this, "evokeDismiss");
|
|
41
|
+
this.type = 'info';
|
|
42
|
+
/** Subtle (tinted background) or solid (filled colour) */
|
|
43
|
+
this.appearance = 'subtle';
|
|
44
|
+
this.dismissible = false;
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return (index.h("div", { key: 'a1b27ec91bb55baeacdcf9547f5a6680faad87e6', class: `evoke-alert evoke-alert--${this.type} evoke-alert--${this.appearance}`, role: this.type === 'danger' || this.type === 'warning' ? 'alert' : 'status' }, renderIcon(TYPE_ICON$1[this.type], 'evoke-alert__icon'), index.h("div", { key: '499700905c4cd7ca6de877185ed0b8a02d1d1ed9', class: "evoke-alert__content" }, index.h("slot", { key: '122793b5693dc905c6bfbd680ae050a12be57400' })), this.dismissible && (index.h("button", { key: 'a6bd557fdefc34efcf8b87552130b9a55425c381', type: "button", class: "evoke-alert__close", "aria-label": "Dismiss", onClick: () => this.evokeDismiss.emit() }, renderIcon('x', 'evoke-icon')))));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
EvokeAlert.style = evokeAlertCss();
|
|
51
|
+
|
|
52
|
+
const evokeAppBarCss = () => `evoke-app-bar{display:block}evoke-app-bar[sticky]{position:sticky;top:0;z-index:50}evoke-app-bar .evoke-appbar{--_fg:var(--evoke-text, #1a1a1a);box-sizing:border-box;display:flex;align-items:center;gap:24px;min-height:64px;padding:8px 24px;font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);background:var(--evoke-surface, #ffffff);color:var(--_fg);border-bottom:1px solid var(--evoke-border, #dedede)}evoke-app-bar .evoke-appbar--dark{--_fg:var(--evoke-secondary-contrast, #ffffff);background:var(--evoke-secondary, #0b1560);border-bottom-color:transparent}evoke-app-bar .evoke-appbar__logo{display:flex;align-items:center;gap:10px;font-weight:700;font-size:1.125rem;flex:none}evoke-app-bar .evoke-appbar__nav{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto}evoke-app-bar .evoke-appbar__actions{display:flex;align-items:center;gap:12px;flex:none;margin-left:auto}evoke-app-bar .evoke-appbar__nav a,evoke-app-bar .evoke-appbar__nav button{display:inline-flex;align-items:center;padding:8px 14px;font:inherit;color:inherit;text-decoration:none;background:none;border:0;border-radius:var(--evoke-radius-field, 8px);cursor:pointer;opacity:0.85;transition:background-color 0.15s, opacity 0.15s}evoke-app-bar .evoke-appbar__nav a:hover,evoke-app-bar .evoke-appbar__nav button:hover{opacity:1;background:color-mix(in srgb, currentColor 10%, transparent)}evoke-app-bar .evoke-appbar__nav a:active,evoke-app-bar .evoke-appbar__nav button:active{background:color-mix(in srgb, currentColor 18%, transparent)}evoke-app-bar .evoke-appbar__nav a[aria-current],evoke-app-bar .evoke-appbar__nav a.active{opacity:1;font-weight:600;box-shadow:inset 0 -2px 0 var(--evoke-primary, #ff5316);border-radius:0}evoke-app-bar .evoke-appbar__nav a:focus-visible,evoke-app-bar .evoke-appbar__nav button:focus-visible{outline:2px solid var(--evoke-primary, #ff5316);outline-offset:1px}`;
|
|
53
|
+
|
|
54
|
+
const EvokeAppBar = class {
|
|
55
|
+
constructor(hostRef) {
|
|
56
|
+
index.registerInstance(this, hostRef);
|
|
57
|
+
/** Light surface, or dark / brand-coloured (navy) */
|
|
58
|
+
this.appearance = 'light';
|
|
59
|
+
/** Stick to the top of the viewport while scrolling */
|
|
60
|
+
this.sticky = false;
|
|
61
|
+
/** Accessible name for the navigation landmark */
|
|
62
|
+
this.navLabel = 'Main';
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
return (index.h("header", { key: '11366baa08e286c8412eefbf82660f289fe42738', class: `evoke-appbar evoke-appbar--${this.appearance}` }, index.h("div", { key: '4a44bb53fc220b2c880fbafa79aecb2d195b2b85', class: "evoke-appbar__logo" }, index.h("slot", { key: 'bb727e24bb1058f0a6b6b4ffbe78616f639b15bd', name: "logo" })), index.h("nav", { key: '6d2023a4dad87266641d3cb2747218926c1750c7', class: "evoke-appbar__nav", "aria-label": this.navLabel }, index.h("slot", { key: 'ce4f50acddb09ebbc0c03538052cbd69e231fd2e', name: "nav" })), index.h("div", { key: 'ff64630598e48bf5b0b6708799247e8bcf54b184', class: "evoke-appbar__actions" }, index.h("slot", { key: 'e782ff890c366a72fe65df8f0544ad09c0818cc6', name: "actions" }))));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
EvokeAppBar.style = evokeAppBarCss();
|
|
69
|
+
|
|
70
|
+
const evokeBadgeCss = () => `evoke-badge{display:inline-block}evoke-badge .evoke-badge-wrap{position:relative;display:inline-flex;vertical-align:middle}evoke-badge .evoke-badge{--_bg:var(--evoke-danger, #dc2626);--_fg:#fff;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;background:var(--_bg);color:var(--_fg);font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);font-weight:600}evoke-badge .evoke-badge--primary{--_bg:color-mix(in srgb, var(--evoke-primary, #ff5316) 82%, #000)}evoke-badge .evoke-badge--secondary{--_bg:var(--evoke-secondary, #0b1560);--_fg:var(--evoke-secondary-contrast, #ffffff)}evoke-badge .evoke-badge--danger{--_bg:color-mix(in srgb, var(--evoke-danger, #dc2626) 85%, #000)}evoke-badge .evoke-badge--success{--_bg:color-mix(in srgb, var(--evoke-success, #16a34a) 78%, #000)}evoke-badge .evoke-badge--warning{--_bg:color-mix(in srgb, var(--evoke-warning, #d97706) 78%, #000)}evoke-badge .evoke-badge--info{--_bg:color-mix(in srgb, var(--evoke-info, #0891b2) 78%, #000)}evoke-badge .evoke-badge--count{min-width:20px;height:20px;padding:0 6px;border-radius:9999px;font-size:0.75rem;line-height:1}evoke-badge .evoke-badge--dot{width:10px;height:10px;border-radius:50%}evoke-badge .evoke-badge-wrap--anchored>.evoke-badge{position:absolute;top:0;right:0;transform:translate(35%, -35%);box-shadow:0 0 0 2px var(--evoke-surface, #ffffff)}evoke-badge .evoke-badge__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}`;
|
|
71
|
+
|
|
72
|
+
const EvokeBadge = class {
|
|
73
|
+
constructor(hostRef) {
|
|
74
|
+
index.registerInstance(this, hostRef);
|
|
75
|
+
/** Number to show (count badge) */
|
|
76
|
+
this.count = 0;
|
|
77
|
+
/** Counts above this show as "max+" (e.g. 99+) */
|
|
78
|
+
this.max = 99;
|
|
79
|
+
/** Show a small status dot instead of a number */
|
|
80
|
+
this.dot = false;
|
|
81
|
+
/** Show the badge even when the count is 0 */
|
|
82
|
+
this.showZero = false;
|
|
83
|
+
this.color = 'danger';
|
|
84
|
+
/** Screen-reader text, e.g. "3 items in cart". A dot without a label is treated as decorative. */
|
|
85
|
+
this.label = '';
|
|
86
|
+
this.hasContent = false;
|
|
87
|
+
}
|
|
88
|
+
componentWillLoad() {
|
|
89
|
+
this.hasContent = Array.from(this.el.childNodes).some((n) => { var _a; return n.nodeType === 1 || (n.nodeType === 3 && !!((_a = n.textContent) === null || _a === void 0 ? void 0 : _a.trim())); });
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
const text = this.count > this.max ? `${this.max}+` : String(this.count);
|
|
93
|
+
const showCount = !this.dot && (this.count > 0 || this.showZero);
|
|
94
|
+
const bubble = this.dot ? (index.h("span", { class: `evoke-badge evoke-badge--dot evoke-badge--${this.color}`, role: this.label ? 'status' : undefined, "aria-label": this.label || undefined, "aria-hidden": this.label ? undefined : 'true' })) : showCount ? (index.h("span", { class: `evoke-badge evoke-badge--count evoke-badge--${this.color}` }, index.h("span", { "aria-hidden": this.label ? 'true' : undefined }, text), this.label && index.h("span", { class: "evoke-badge__sr" }, this.label))) : null;
|
|
95
|
+
return (index.h("span", { key: 'c49ac8a3361b9dcdfa3ebc3eacfca2079a3da60f', class: `evoke-badge-wrap ${this.hasContent ? 'evoke-badge-wrap--anchored' : ''}`.trim() }, index.h("slot", { key: 'b25c9150dcca4299ccae5735dcd0ea9a0c7e973a' }), bubble));
|
|
96
|
+
}
|
|
97
|
+
get el() { return index.getElement(this); }
|
|
98
|
+
};
|
|
99
|
+
EvokeBadge.style = evokeBadgeCss();
|
|
100
|
+
|
|
101
|
+
const evokeButtonCss = () => `evoke-button{display:inline-block}evoke-button .evoke-btn{box-sizing:border-box;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);line-height:1.5;cursor:pointer;height:var(--evoke-control-height, 56px);padding:0 var(--evoke-button-padding-x, 36px);display:inline-flex;align-items:center;justify-content:center;gap:0.5rem;border:1px solid transparent;border-radius:var(--evoke-radius-button, 9999px);transition:filter 0.15s, background-color 0.15s, box-shadow 0.15s, transform 0.05s}evoke-button .evoke-btn--sm{height:calc(var(--evoke-control-height, 56px) * 0.75);padding:0 calc(var(--evoke-button-padding-x, 36px) * 0.6);font-size:0.875rem}evoke-button .evoke-btn--lg{height:calc(var(--evoke-control-height, 56px) * 1.15);padding:0 calc(var(--evoke-button-padding-x, 36px) * 1.2);font-size:1.125rem}evoke-button .evoke-btn--icon{padding:0;width:var(--evoke-control-height, 56px)}evoke-button .evoke-btn--icon.evoke-btn--sm{width:calc(var(--evoke-control-height, 56px) * 0.75)}evoke-button .evoke-btn--icon.evoke-btn--lg{width:calc(var(--evoke-control-height, 56px) * 1.15)}evoke-button .evoke-icon{width:1.1em;height:1.1em;flex:none}evoke-button .evoke-btn:hover:not(:disabled){filter:brightness(0.92)}evoke-button .evoke-btn:active:not(:disabled){filter:brightness(0.82);transform:translateY(1px)}evoke-button .evoke-btn:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15))}evoke-button .evoke-btn:disabled{opacity:0.5;cursor:not-allowed}evoke-button .evoke-btn--loading:disabled{cursor:progress;opacity:0.8}evoke-button .evoke-btn--primary{background:var(--evoke-primary, #ff5316);color:var(--evoke-primary-contrast, #ffffff)}evoke-button .evoke-btn--secondary{background:var(--evoke-secondary, #0b1560);color:var(--evoke-secondary-contrast, #ffffff)}evoke-button .evoke-btn--danger{background:var(--evoke-danger, #dc2626);color:#fff}evoke-button .evoke-btn--outline{background:transparent;color:var(--evoke-primary-text, #cc3d0d);border-color:var(--evoke-primary, #ff5316)}evoke-button .evoke-btn--ghost{background:transparent;color:var(--evoke-primary-text, #cc3d0d);border-color:transparent}evoke-button .evoke-btn--ghost:hover:not(:disabled){filter:none;background:color-mix(in srgb, var(--evoke-primary, #ff5316) 10%, transparent)}evoke-button .evoke-btn--ghost:active:not(:disabled){filter:none;background:color-mix(in srgb, var(--evoke-primary, #ff5316) 18%, transparent)}evoke-button .evoke-spinner{width:1em;height:1em;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:evoke-spin 0.7s linear infinite}@keyframes evoke-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){evoke-button .evoke-spinner{animation-duration:2s}}evoke-button[block]{display:block}evoke-button[block] .evoke-btn{width:100%}`;
|
|
102
|
+
|
|
103
|
+
const EvokeButton = class {
|
|
104
|
+
constructor(hostRef) {
|
|
105
|
+
index.registerInstance(this, hostRef);
|
|
106
|
+
/** Solid variants (primary, secondary, danger), outline, or ghost (text only, no border) */
|
|
107
|
+
this.variant = 'primary';
|
|
108
|
+
this.size = 'md';
|
|
109
|
+
this.type = 'button';
|
|
110
|
+
this.disabled = false;
|
|
111
|
+
/** Shows a spinner and blocks clicks while true */
|
|
112
|
+
this.loading = false;
|
|
113
|
+
/** Square button for icon-only use; set `accessible-label` too */
|
|
114
|
+
this.iconOnly = false;
|
|
115
|
+
/** Stretch to the full width of the container */
|
|
116
|
+
this.block = false;
|
|
117
|
+
/** Extra classes for the inner <button>, e.g. "btn btn-lg" (Bootstrap) or "shadow-lg" (Tailwind) */
|
|
118
|
+
this.buttonClass = '';
|
|
119
|
+
}
|
|
120
|
+
render() {
|
|
121
|
+
const cls = `evoke-btn evoke-btn--${this.variant} evoke-btn--${this.size} ${this.iconOnly ? 'evoke-btn--icon' : ''} ${this.loading ? 'evoke-btn--loading' : ''} ${this.buttonClass}`;
|
|
122
|
+
return (index.h("button", { key: 'f7d86f18cbcfd1d23b82cf37072f5af93c8d7ef3', type: this.type, class: cls.replace(/\s+/g, ' ').trim(), disabled: this.disabled || this.loading, "aria-busy": this.loading ? 'true' : undefined, "aria-label": this.accessibleLabel }, this.loading ? index.h("span", { class: "evoke-spinner", "aria-hidden": "true" }) : renderIcon(this.icon), index.h("slot", { key: '15d7302d67b7976d772e6b510e27b7e3f23c0634' })));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
EvokeButton.style = evokeButtonCss();
|
|
126
|
+
|
|
127
|
+
const evokeCardCss = () => `evoke-card{display:block}evoke-card .evoke-card{background:var(--evoke-surface, #ffffff);color:var(--evoke-text, #1a1a1a);border:1px solid var(--evoke-border, #dedede);border-radius:var(--evoke-radius, 8px);font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);overflow:hidden;transition:box-shadow 0.15s, border-color 0.15s, transform 0.05s}evoke-card .evoke-card--elevated{border-color:transparent;box-shadow:var(--evoke-shadow, 0 4px 12px rgba(0, 0, 0, 0.12))}evoke-card .evoke-card__media img,evoke-card .evoke-card__media video{display:block;width:100%;height:auto}evoke-card .evoke-card__header{padding:0.75rem 1rem;font-weight:600;border-bottom:1px solid var(--evoke-border, #dedede)}evoke-card .evoke-card--elevated .evoke-card__header{border-bottom-color:transparent}evoke-card .evoke-card__body{padding:1rem}evoke-card .evoke-card--clickable{cursor:pointer}evoke-card .evoke-card--clickable:hover{border-color:var(--evoke-primary, #ff5316)}evoke-card .evoke-card--elevated.evoke-card--clickable:hover{border-color:transparent;box-shadow:0 8px 24px rgba(0, 0, 0, 0.18)}evoke-card .evoke-card--clickable:active{transform:translateY(1px)}evoke-card .evoke-card--clickable:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15));border-color:var(--evoke-secondary, #0b1560)}`;
|
|
128
|
+
|
|
129
|
+
const EvokeCard = class {
|
|
130
|
+
constructor(hostRef) {
|
|
131
|
+
index.registerInstance(this, hostRef);
|
|
132
|
+
this.evokeClick = index.createEvent(this, "evokeClick");
|
|
133
|
+
this.heading = '';
|
|
134
|
+
/** Outlined (border) or elevated (shadow, no border) */
|
|
135
|
+
this.appearance = 'outlined';
|
|
136
|
+
/** Makes the whole card a button (hover/active/focus states, Enter/Space) */
|
|
137
|
+
this.clickable = false;
|
|
138
|
+
/** Extra classes for the card container, e.g. "shadow-md" (Tailwind) or "card" (Bootstrap) */
|
|
139
|
+
this.cardClass = '';
|
|
140
|
+
this.activate = () => {
|
|
141
|
+
if (this.clickable)
|
|
142
|
+
this.evokeClick.emit();
|
|
143
|
+
};
|
|
144
|
+
this.onKeyDown = (e) => {
|
|
145
|
+
if (!this.clickable || e.target !== e.currentTarget)
|
|
146
|
+
return;
|
|
147
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
this.activate();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
render() {
|
|
154
|
+
return (index.h("div", { key: '770d8327a59c90f0dee5a2150de270e23024e7c2', class: `evoke-card evoke-card--${this.appearance} ${this.clickable ? 'evoke-card--clickable' : ''} ${this.cardClass}`.replace(/\s+/g, ' ').trim(), role: this.clickable ? 'button' : undefined, tabindex: this.clickable ? 0 : undefined, onClick: this.activate, onKeyDown: this.onKeyDown }, index.h("div", { key: '16ffd16092680ff8c42e9a13e7e7313cc0c4f1d5', class: "evoke-card__media" }, index.h("slot", { key: '92ba25d16ed81cad2dd4707cde97370b1e9efa33', name: "media" })), this.heading && index.h("div", { key: '6fd2d9d1fe8afe8074fc38cc8247f007218a7450', class: "evoke-card__header" }, this.heading), index.h("div", { key: 'afa26c53bfed69d01b350760428456293ebeb7fd', class: "evoke-card__body" }, index.h("slot", { key: '94e07c3b5f8170fae1667081cdcf39d5a869c249' }))));
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
EvokeCard.style = evokeCardCss();
|
|
158
|
+
|
|
159
|
+
const evokeCheckboxCss = () => `evoke-checkbox{display:block}evoke-checkbox .evoke-check{display:flex;flex-direction:column;gap:0.25rem;font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);color:var(--evoke-text, #1a1a1a)}evoke-checkbox .evoke-check__row{display:inline-flex;align-items:center;gap:0.5rem;cursor:pointer;font-size:0.875rem}evoke-checkbox .evoke-check__row--disabled{opacity:0.6;cursor:not-allowed}evoke-checkbox .evoke-check__input{appearance:none;-webkit-appearance:none;margin:0;flex:none;width:16px;height:16px;border:2px solid var(--evoke-primary, #ff5316);border-radius:4px;background:var(--evoke-surface, #ffffff) center / 12px no-repeat;cursor:inherit;transition:background-color 0.15s, box-shadow 0.15s, filter 0.15s}evoke-checkbox .evoke-check__input:hover:not(:disabled){filter:brightness(0.92)}evoke-checkbox .evoke-check__input:active:not(:disabled){filter:brightness(0.8)}evoke-checkbox .evoke-check__input:checked{background-color:var(--evoke-primary, #ff5316);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")}evoke-checkbox .evoke-check__input:indeterminate{background-color:var(--evoke-primary, #ff5316);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E")}evoke-checkbox .evoke-check__input:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15))}evoke-checkbox .evoke-check__input--error{border-color:var(--evoke-danger, #dc2626)}evoke-checkbox .evoke-check__error{color:var(--evoke-danger, #dc2626);font-size:0.875rem}`;
|
|
160
|
+
|
|
161
|
+
const EvokeCheckbox = class {
|
|
162
|
+
constructor(hostRef) {
|
|
163
|
+
index.registerInstance(this, hostRef);
|
|
164
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
165
|
+
this.label = '';
|
|
166
|
+
this.checked = false;
|
|
167
|
+
/** Mixed state, e.g. a "select all" box when only some items are selected. Cleared on click. */
|
|
168
|
+
this.indeterminate = false;
|
|
169
|
+
this.disabled = false;
|
|
170
|
+
/** Error message shown below the checkbox */
|
|
171
|
+
this.error = '';
|
|
172
|
+
/** Extra classes for the inner <input> */
|
|
173
|
+
this.inputClass = '';
|
|
174
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
175
|
+
}
|
|
176
|
+
componentDidRender() {
|
|
177
|
+
if (this.inputEl)
|
|
178
|
+
this.inputEl.indeterminate = this.indeterminate;
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
const errId = `evoke-check-${this.uid}-err`;
|
|
182
|
+
return (index.h("div", { key: 'cc0882102020d6e748ee1c5bac124a3a2640862c', class: "evoke-check" }, index.h("label", { key: '62390001ac96c2c0602541eafc37559ab95ae80a', class: `evoke-check__row ${this.disabled ? 'evoke-check__row--disabled' : ''}` }, index.h("input", { key: 'bf8732581d0c36d3ba89c4b3c67b08ebf1268699', type: "checkbox", class: `evoke-check__input ${this.error ? 'evoke-check__input--error' : ''} ${this.inputClass}`.trim(), checked: this.checked, disabled: this.disabled, "aria-checked": this.indeterminate ? 'mixed' : undefined, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.error ? errId : undefined, ref: (el) => (this.inputEl = el), onChange: (e) => {
|
|
183
|
+
this.indeterminate = false;
|
|
184
|
+
this.checked = e.target.checked;
|
|
185
|
+
this.evokeChange.emit(this.checked);
|
|
186
|
+
} }), index.h("span", { key: '6685db59dad6a3299179a04f67f25ca2d818c87a', class: "evoke-check__label" }, this.label, index.h("slot", { key: 'd2f72e8580dbfdabdd9e460642558a3b2199f098' }))), this.error && index.h("span", { key: '2d63862c8cc3489b8e1217fab1aa20da0fb86449', id: errId, class: "evoke-check__error", role: "alert" }, this.error)));
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
EvokeCheckbox.style = evokeCheckboxCss();
|
|
190
|
+
|
|
191
|
+
const evokeChipCss = () => `evoke-chip{display:inline-block}evoke-chip .evoke-chip{box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 14px;font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);font-size:0.875rem;color:var(--evoke-text, #1a1a1a);background:var(--evoke-surface, #ffffff);border:1px solid var(--evoke-border, #dedede);border-radius:9999px;transition:background-color 0.15s, border-color 0.15s, filter 0.15s}evoke-chip .evoke-chip .evoke-icon{width:14px;height:14px;flex:none}evoke-chip .evoke-chip--filter{cursor:pointer;font:inherit;font-size:0.875rem}evoke-chip .evoke-chip--filter:hover:not(:disabled):not(.evoke-chip--selected){background:var(--evoke-surface-muted, #f5f5f5);border-color:var(--evoke-text-muted, #6b6b6b)}evoke-chip .evoke-chip--filter:active:not(:disabled){filter:brightness(0.9)}evoke-chip .evoke-chip--filter:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15))}evoke-chip .evoke-chip--selected{background:color-mix(in srgb, var(--evoke-primary, #ff5316) 14%, var(--evoke-surface, #ffffff));border-color:var(--evoke-primary, #ff5316);color:var(--evoke-text, #1a1a1a)}evoke-chip .evoke-chip--selected .evoke-icon{color:var(--evoke-primary, #ff5316)}evoke-chip .evoke-chip--filter:disabled,evoke-chip .evoke-chip--disabled{opacity:0.5;cursor:not-allowed}evoke-chip .evoke-chip--removable{padding-right:4px;background:var(--evoke-surface-muted, #f5f5f5);border-color:transparent}evoke-chip .evoke-chip__remove{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;color:inherit;background:none;border:0;border-radius:50%;cursor:pointer}evoke-chip .evoke-chip__remove:hover:not(:disabled){background:color-mix(in srgb, var(--evoke-text, #1a1a1a) 14%, transparent)}evoke-chip .evoke-chip__remove:active:not(:disabled){background:color-mix(in srgb, var(--evoke-text, #1a1a1a) 24%, transparent)}evoke-chip .evoke-chip__remove:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15))}evoke-chip .evoke-chip__remove:disabled{cursor:not-allowed}`;
|
|
192
|
+
|
|
193
|
+
const EvokeChip = class {
|
|
194
|
+
constructor(hostRef) {
|
|
195
|
+
index.registerInstance(this, hostRef);
|
|
196
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
197
|
+
this.evokeRemove = index.createEvent(this, "evokeRemove");
|
|
198
|
+
this.label = '';
|
|
199
|
+
/** Selected state (filter chip) */
|
|
200
|
+
this.selected = false;
|
|
201
|
+
/** Shows a remove button instead of toggling selection */
|
|
202
|
+
this.removable = false;
|
|
203
|
+
this.disabled = false;
|
|
204
|
+
}
|
|
205
|
+
render() {
|
|
206
|
+
if (this.removable) {
|
|
207
|
+
return (index.h("span", { class: `evoke-chip evoke-chip--removable ${this.disabled ? 'evoke-chip--disabled' : ''}`.trim() }, index.h("span", { class: "evoke-chip__label" }, this.label, index.h("slot", null)), index.h("button", { type: "button", class: "evoke-chip__remove", "aria-label": `Remove ${this.label}`, disabled: this.disabled, onClick: () => this.evokeRemove.emit() }, renderIcon('x', 'evoke-icon'))));
|
|
208
|
+
}
|
|
209
|
+
return (index.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: () => {
|
|
210
|
+
this.selected = !this.selected;
|
|
211
|
+
this.evokeChange.emit(this.selected);
|
|
212
|
+
} }, this.selected && renderIcon('check', 'evoke-icon'), index.h("span", { class: "evoke-chip__label" }, this.label, index.h("slot", null))));
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
EvokeChip.style = evokeChipCss();
|
|
216
|
+
|
|
217
|
+
const evokeInputCss = () => `evoke-input{display:block}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)}evoke-input .evoke-field__label{color:var(--evoke-text, #1a1a1a)}evoke-input .evoke-field__control{position:relative}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}evoke-input .evoke-field__input{box-sizing:border-box;width:100%;height:var(--evoke-control-height, 56px);padding:0 24px;border:1px solid var(--evoke-border, #dedede);border-radius:var(--evoke-radius-field, 8px);background:var(--evoke-surface, #ffffff);color:var(--evoke-text, #1a1a1a);font:inherit;transition:border-color 0.15s, box-shadow 0.15s, background-color 0.15s}evoke-input .evoke-field__input--icon{padding-left:44px}evoke-input .evoke-field__input::placeholder{color:var(--evoke-text-muted, #6b6b6b)}evoke-input .evoke-field__input:hover:not(:disabled):not(:focus){border-color:var(--evoke-text-muted, #6b6b6b)}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))}evoke-input .evoke-field__input:disabled{opacity:0.6;cursor:not-allowed}evoke-input .evoke-field__input--error{border-color:var(--evoke-danger, #dc2626)}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}evoke-input .evoke-field--filled .evoke-field__input:hover:not(:disabled):not(:focus){border-bottom-color:var(--evoke-text-muted, #6b6b6b)}evoke-input .evoke-field--filled .evoke-field__input:focus{box-shadow:none;border-bottom-color:var(--evoke-secondary, #0b1560)}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))}evoke-input .evoke-field--filled .evoke-field__input--error{border-bottom-color:var(--evoke-danger, #dc2626)}evoke-input .evoke-field__hint{color:var(--evoke-text-muted, #6b6b6b);font-size:0.875rem}evoke-input .evoke-field__error{color:var(--evoke-danger, #dc2626);font-size:0.875rem}`;
|
|
218
|
+
|
|
219
|
+
const EvokeInput = class {
|
|
220
|
+
constructor(hostRef) {
|
|
221
|
+
index.registerInstance(this, hostRef);
|
|
222
|
+
this.evokeInput = index.createEvent(this, "evokeInput");
|
|
223
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
224
|
+
this.label = '';
|
|
225
|
+
this.value = '';
|
|
226
|
+
this.type = 'text';
|
|
227
|
+
this.name = '';
|
|
228
|
+
this.placeholder = '';
|
|
229
|
+
this.disabled = false;
|
|
230
|
+
this.required = false;
|
|
231
|
+
/** Outlined (default) or filled (tinted background, bottom border) */
|
|
232
|
+
this.appearance = 'outlined';
|
|
233
|
+
/** Error message shown below the field (replaces the hint) */
|
|
234
|
+
this.error = '';
|
|
235
|
+
/** Helper text shown below the field */
|
|
236
|
+
this.hint = '';
|
|
237
|
+
/** Extra classes for the inner <input>, e.g. "form-control" (Bootstrap) */
|
|
238
|
+
this.inputClass = '';
|
|
239
|
+
this.inputId = `evoke-input-${Math.random().toString(36).slice(2, 9)}`;
|
|
240
|
+
}
|
|
241
|
+
render() {
|
|
242
|
+
const hasIcon = !!this.icon;
|
|
243
|
+
const describedBy = this.error || this.hint ? `${this.inputId}-msg` : undefined;
|
|
244
|
+
return (index.h("div", { key: '1bcce1a42e241c614eb5aacac045bf81fdf42ebd', class: `evoke-field evoke-field--${this.appearance}` }, this.label && index.h("label", { key: '6b0dbee7d5fad3238b22996d62d2ef23310b400b', htmlFor: this.inputId, class: "evoke-field__label" }, this.label, this.required && index.h("span", { key: '8258e6cc4d310d4becd7c1f4c6c511afdfffe715', "aria-hidden": "true" }, " *")), index.h("div", { key: 'b8b4ba4a562bdbc86be66bb413ae2ff0209e4592', class: "evoke-field__control" }, renderIcon(this.icon, 'evoke-field__icon'), index.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) => {
|
|
245
|
+
this.value = e.target.value;
|
|
246
|
+
this.evokeInput.emit(this.value);
|
|
247
|
+
}, onChange: (e) => this.evokeChange.emit(e.target.value) })), this.error ? (index.h("span", { id: describedBy, class: "evoke-field__error", role: "alert" }, this.error)) : (this.hint && index.h("span", { id: describedBy, class: "evoke-field__hint" }, this.hint))));
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
EvokeInput.style = evokeInputCss();
|
|
251
|
+
|
|
252
|
+
const evokeModalCss = () => `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}evoke-modal .evoke-modal__backdrop--right{justify-content:flex-end;align-items:stretch}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)}evoke-modal .evoke-modal:focus{outline:none}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}evoke-modal .evoke-modal--center.evoke-modal--sm{width:min(92vw, 360px)}evoke-modal .evoke-modal--center.evoke-modal--lg{width:min(92vw, 720px)}evoke-modal .evoke-modal--right{height:100%;border-radius:0;width:min(100vw, 420px);animation:evoke-slide 0.2s ease-out}evoke-modal .evoke-modal--right.evoke-modal--sm{width:min(100vw, 320px)}evoke-modal .evoke-modal--right.evoke-modal--lg{width:min(100vw, 640px)}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)}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}evoke-modal .evoke-modal__close:hover{background:var(--evoke-surface-muted, #f5f5f5)}evoke-modal .evoke-modal__close:active{background:color-mix(in srgb, var(--evoke-text, #1a1a1a) 14%, transparent)}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))}evoke-modal .evoke-modal__close .evoke-icon{width:18px;height:18px}evoke-modal .evoke-modal__body{padding:1rem;overflow:auto;flex:1}@keyframes evoke-fade{from{opacity:0}to{opacity:1}}@keyframes evoke-pop{from{opacity:0;transform:scale(0.96)}to{opacity:1;transform:none}}@keyframes evoke-slide{from{transform:translateX(100%)}to{transform:none}}@media (prefers-reduced-motion: reduce){evoke-modal .evoke-modal__backdrop,evoke-modal .evoke-modal{animation:none}}`;
|
|
253
|
+
|
|
254
|
+
const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
255
|
+
const EvokeModal = class {
|
|
256
|
+
constructor(hostRef) {
|
|
257
|
+
index.registerInstance(this, hostRef);
|
|
258
|
+
this.evokeClose = index.createEvent(this, "evokeClose");
|
|
259
|
+
/** Whether the modal is visible */
|
|
260
|
+
this.open = false;
|
|
261
|
+
this.heading = '';
|
|
262
|
+
/** Centred dialog, or a drawer sliding in from the right */
|
|
263
|
+
this.position = 'center';
|
|
264
|
+
this.size = 'md';
|
|
265
|
+
this.closeOnBackdrop = true;
|
|
266
|
+
/** Extra classes for the dialog panel */
|
|
267
|
+
this.modalClass = '';
|
|
268
|
+
this.previouslyFocused = null;
|
|
269
|
+
this.previousOverflow = '';
|
|
270
|
+
this.pendingFocus = false;
|
|
271
|
+
this.locked = false;
|
|
272
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
273
|
+
}
|
|
274
|
+
onOpenChange(next, prev) {
|
|
275
|
+
if (next && !prev)
|
|
276
|
+
this.onOpened();
|
|
277
|
+
else if (!next && prev)
|
|
278
|
+
this.onClosed();
|
|
279
|
+
}
|
|
280
|
+
componentDidLoad() {
|
|
281
|
+
if (this.open)
|
|
282
|
+
this.onOpened();
|
|
283
|
+
}
|
|
284
|
+
disconnectedCallback() {
|
|
285
|
+
if (this.locked)
|
|
286
|
+
this.unlockScroll();
|
|
287
|
+
}
|
|
288
|
+
componentDidRender() {
|
|
289
|
+
var _a;
|
|
290
|
+
if (this.pendingFocus && this.panel) {
|
|
291
|
+
this.pendingFocus = false;
|
|
292
|
+
((_a = this.focusables()[0]) !== null && _a !== void 0 ? _a : this.panel).focus();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
onOpened() {
|
|
296
|
+
this.previouslyFocused = document.activeElement;
|
|
297
|
+
this.pendingFocus = true;
|
|
298
|
+
if (!this.locked) {
|
|
299
|
+
this.previousOverflow = document.body.style.overflow;
|
|
300
|
+
document.body.style.overflow = 'hidden';
|
|
301
|
+
this.locked = true;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
onClosed() {
|
|
305
|
+
var _a, _b;
|
|
306
|
+
this.unlockScroll();
|
|
307
|
+
(_b = (_a = this.previouslyFocused) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
308
|
+
this.previouslyFocused = null;
|
|
309
|
+
}
|
|
310
|
+
unlockScroll() {
|
|
311
|
+
document.body.style.overflow = this.previousOverflow;
|
|
312
|
+
this.locked = false;
|
|
313
|
+
}
|
|
314
|
+
focusables() {
|
|
315
|
+
if (!this.panel)
|
|
316
|
+
return [];
|
|
317
|
+
return Array.from(this.panel.querySelectorAll(FOCUSABLE)).filter((n) => n.offsetParent !== null);
|
|
318
|
+
}
|
|
319
|
+
close() {
|
|
320
|
+
this.open = false;
|
|
321
|
+
this.evokeClose.emit();
|
|
322
|
+
}
|
|
323
|
+
onKeydown(e) {
|
|
324
|
+
if (!this.open)
|
|
325
|
+
return;
|
|
326
|
+
if (e.key === 'Escape') {
|
|
327
|
+
e.preventDefault();
|
|
328
|
+
return this.close();
|
|
329
|
+
}
|
|
330
|
+
if (e.key !== 'Tab' || !this.panel)
|
|
331
|
+
return;
|
|
332
|
+
const items = this.focusables();
|
|
333
|
+
if (items.length === 0) {
|
|
334
|
+
e.preventDefault();
|
|
335
|
+
return this.panel.focus();
|
|
336
|
+
}
|
|
337
|
+
const first = items[0];
|
|
338
|
+
const last = items[items.length - 1];
|
|
339
|
+
const active = document.activeElement;
|
|
340
|
+
if (e.shiftKey && (active === first || active === this.panel)) {
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
last.focus();
|
|
343
|
+
}
|
|
344
|
+
else if (!e.shiftKey && active === last) {
|
|
345
|
+
e.preventDefault();
|
|
346
|
+
first.focus();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
render() {
|
|
350
|
+
if (!this.open)
|
|
351
|
+
return null;
|
|
352
|
+
const titleId = `evoke-modal-${this.uid}-title`;
|
|
353
|
+
return (index.h("div", { class: `evoke-modal__backdrop evoke-modal__backdrop--${this.position}`, onClick: () => this.closeOnBackdrop && this.close() }, index.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() }, index.h("div", { class: "evoke-modal__header" }, index.h("span", { id: titleId }, this.heading), index.h("button", { type: "button", class: "evoke-modal__close", "aria-label": "Close", onClick: () => this.close() }, renderIcon('x', 'evoke-icon'))), index.h("div", { class: "evoke-modal__body" }, index.h("slot", null)))));
|
|
354
|
+
}
|
|
355
|
+
get el() { return index.getElement(this); }
|
|
356
|
+
static get watchers() { return {
|
|
357
|
+
"open": [{
|
|
358
|
+
"onOpenChange": 0
|
|
359
|
+
}]
|
|
360
|
+
}; }
|
|
361
|
+
};
|
|
362
|
+
EvokeModal.style = evokeModalCss();
|
|
363
|
+
|
|
364
|
+
const evokePaginationCss = () => `evoke-pagination{display:block}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)}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}evoke-pagination .evoke-pager__btn:hover:not(:disabled):not(.evoke-pager__btn--active){background:var(--evoke-surface-muted, #f5f5f5)}evoke-pagination .evoke-pager__btn:active:not(:disabled){filter:brightness(0.85)}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))}evoke-pagination .evoke-pager__btn:disabled{opacity:0.45;cursor:not-allowed}evoke-pagination .evoke-pager__btn--active{background:var(--evoke-primary, #ff5316);color:var(--evoke-primary-contrast, #ffffff)}evoke-pagination .evoke-pager__nav .evoke-icon{width:18px;height:18px}evoke-pagination .evoke-pager--compact .evoke-pager__nav{border-color:var(--evoke-border, #dedede);padding:0 14px}evoke-pagination .evoke-pager__gap{min-width:24px;text-align:center;color:var(--evoke-text-muted, #6b6b6b)}evoke-pagination .evoke-pager__status{padding:0 16px;font-size:0.9375rem}`;
|
|
365
|
+
|
|
366
|
+
const EvokePagination = class {
|
|
367
|
+
constructor(hostRef) {
|
|
368
|
+
index.registerInstance(this, hostRef);
|
|
369
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
370
|
+
/** Current page (1-based) */
|
|
371
|
+
this.page = 1;
|
|
372
|
+
/** Total number of pages */
|
|
373
|
+
this.total = 1;
|
|
374
|
+
/** Numbered pages, or compact (Prev, "2 of 10", Next) */
|
|
375
|
+
this.appearance = 'numbered';
|
|
376
|
+
this.disabled = false;
|
|
377
|
+
}
|
|
378
|
+
go(p) {
|
|
379
|
+
const next = Math.min(Math.max(p, 1), Math.max(this.total, 1));
|
|
380
|
+
if (this.disabled || next === this.page)
|
|
381
|
+
return;
|
|
382
|
+
this.page = next;
|
|
383
|
+
this.evokeChange.emit(next);
|
|
384
|
+
}
|
|
385
|
+
pages() {
|
|
386
|
+
const t = this.total, p = this.page;
|
|
387
|
+
if (t <= 7)
|
|
388
|
+
return Array.from({ length: t }, (_, i) => i + 1);
|
|
389
|
+
const out = [1];
|
|
390
|
+
const start = Math.max(2, p - 1);
|
|
391
|
+
const end = Math.min(t - 1, p + 1);
|
|
392
|
+
if (start > 2)
|
|
393
|
+
out.push('…');
|
|
394
|
+
for (let i = start; i <= end; i++)
|
|
395
|
+
out.push(i);
|
|
396
|
+
if (end < t - 1)
|
|
397
|
+
out.push('…');
|
|
398
|
+
out.push(t);
|
|
399
|
+
return out;
|
|
400
|
+
}
|
|
401
|
+
render() {
|
|
402
|
+
const prevOff = this.disabled || this.page <= 1;
|
|
403
|
+
const nextOff = this.disabled || this.page >= this.total;
|
|
404
|
+
const prev = (index.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' && index.h("span", { key: '64f68912c444b59a7a6c074e074f745585726e62' }, "Prev")));
|
|
405
|
+
const next = (index.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' && index.h("span", { key: '83d15b9f16dac8d810cb50d7a2a5df1c01f720cb' }, "Next"), renderIcon('chevron-right', 'evoke-icon')));
|
|
406
|
+
return (index.h("nav", { key: '5ebe89ac00b59391f425e518ae145b84742a5bb1', class: `evoke-pager evoke-pager--${this.appearance}`, "aria-label": "Pagination" }, prev, this.appearance === 'compact' ? (index.h("span", { class: "evoke-pager__status", "aria-live": "polite" }, this.page, " of ", this.total)) : (this.pages().map((p) => p === '…' ? (index.h("span", { class: "evoke-pager__gap", "aria-hidden": "true" }, "\u2026")) : (index.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));
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
EvokePagination.style = evokePaginationCss();
|
|
410
|
+
|
|
411
|
+
const evokeProgressCss = () => `evoke-progress{display:block}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)}evoke-progress .evoke-progress__bar{height:100%;border-radius:inherit;background:var(--evoke-primary, #ff5316);transition:width 0.25s ease}evoke-progress .evoke-progress--linear.evoke-progress--indeterminate .evoke-progress__bar{position:absolute;width:40%;animation:evoke-bar 1.2s ease-in-out infinite}evoke-progress .evoke-progress--circular{display:inline-block}evoke-progress .evoke-progress--circular svg{display:block;width:100%;height:100%;transform:rotate(-90deg)}evoke-progress .evoke-progress__track{stroke:var(--evoke-border, #dedede)}evoke-progress .evoke-progress__ring{stroke:var(--evoke-primary, #ff5316);transition:stroke-dashoffset 0.25s ease}evoke-progress .evoke-progress--circular.evoke-progress--indeterminate svg{animation:evoke-spin 0.9s linear infinite}@keyframes evoke-bar{0%{left:-40%}100%{left:100%}}@keyframes evoke-spin{to{transform:rotate(270deg)}}@media (prefers-reduced-motion: reduce){evoke-progress .evoke-progress__bar,evoke-progress .evoke-progress--circular svg{animation-duration:3s !important;transition:none}}`;
|
|
412
|
+
|
|
413
|
+
const RADIUS = 18;
|
|
414
|
+
const CIRC = 2 * Math.PI * RADIUS;
|
|
415
|
+
const EvokeProgress = class {
|
|
416
|
+
constructor(hostRef) {
|
|
417
|
+
index.registerInstance(this, hostRef);
|
|
418
|
+
/** Linear bar, or circular spinner / ring */
|
|
419
|
+
this.type = 'linear';
|
|
420
|
+
/** Progress from 0 to 100 */
|
|
421
|
+
this.value = 0;
|
|
422
|
+
/** Unknown duration: animates continuously and ignores `value` */
|
|
423
|
+
this.indeterminate = false;
|
|
424
|
+
/** Accessible name, e.g. "Uploading" */
|
|
425
|
+
this.label = 'Loading';
|
|
426
|
+
/** Diameter in px for the circular type */
|
|
427
|
+
this.size = 40;
|
|
428
|
+
}
|
|
429
|
+
render() {
|
|
430
|
+
const v = Math.min(Math.max(Number(this.value) || 0, 0), 100);
|
|
431
|
+
const aria = {
|
|
432
|
+
role: 'progressbar',
|
|
433
|
+
'aria-label': this.label,
|
|
434
|
+
'aria-valuemin': '0',
|
|
435
|
+
'aria-valuemax': '100',
|
|
436
|
+
'aria-valuenow': this.indeterminate ? undefined : String(Math.round(v)),
|
|
437
|
+
};
|
|
438
|
+
if (this.type === 'circular') {
|
|
439
|
+
return (index.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), index.h("svg", { viewBox: "0 0 44 44", "aria-hidden": "true", focusable: "false" }, index.h("circle", { class: "evoke-progress__track", cx: "22", cy: "22", r: String(RADIUS), fill: "none", "stroke-width": "4" }), index.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)) }))));
|
|
440
|
+
}
|
|
441
|
+
return (index.h("div", Object.assign({ class: `evoke-progress evoke-progress--linear ${this.indeterminate ? 'evoke-progress--indeterminate' : ''}`.trim() }, aria), index.h("div", { class: "evoke-progress__bar", style: this.indeterminate ? undefined : { width: `${v}%` } })));
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
EvokeProgress.style = evokeProgressCss();
|
|
445
|
+
|
|
446
|
+
const evokeQuantityStepperCss = () => `evoke-quantity-stepper{display:inline-block}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)}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}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))}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}evoke-quantity-stepper .evoke-qty__btn:hover:not(:disabled){background:color-mix(in srgb, var(--evoke-primary, #ff5316) 10%, transparent)}evoke-quantity-stepper .evoke-qty__btn:active:not(:disabled){background:color-mix(in srgb, var(--evoke-primary, #ff5316) 20%, transparent)}evoke-quantity-stepper .evoke-qty__btn:focus-visible{outline:2px solid var(--evoke-secondary, #0b1560);outline-offset:-3px}evoke-quantity-stepper .evoke-qty__btn:disabled{opacity:0.4;cursor:not-allowed}evoke-quantity-stepper .evoke-qty__btn .evoke-icon{width:16px;height:16px}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}evoke-quantity-stepper .evoke-qty__input:focus{outline:none}evoke-quantity-stepper .evoke-qty__input:disabled{opacity:0.5}evoke-quantity-stepper .evoke-qty--compact{position:relative;display:inline-block}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}evoke-quantity-stepper .evoke-qty__select:hover:not(:disabled):not(:focus){border-color:var(--evoke-text-muted, #6b6b6b)}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))}evoke-quantity-stepper .evoke-qty__select:disabled{opacity:0.5;cursor:not-allowed}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}`;
|
|
447
|
+
|
|
448
|
+
const EvokeQuantityStepper = class {
|
|
449
|
+
constructor(hostRef) {
|
|
450
|
+
index.registerInstance(this, hostRef);
|
|
451
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
452
|
+
this.value = 1;
|
|
453
|
+
this.min = 1;
|
|
454
|
+
this.max = 99;
|
|
455
|
+
/** Inline (minus, value, plus) or compact with a quantity dropdown */
|
|
456
|
+
this.appearance = 'inline';
|
|
457
|
+
this.disabled = false;
|
|
458
|
+
/** Accessible name for the control */
|
|
459
|
+
this.label = 'Quantity';
|
|
460
|
+
this.onKeyDown = (e) => {
|
|
461
|
+
if (e.key === 'ArrowUp') {
|
|
462
|
+
e.preventDefault();
|
|
463
|
+
this.set(this.value + 1);
|
|
464
|
+
}
|
|
465
|
+
else if (e.key === 'ArrowDown') {
|
|
466
|
+
e.preventDefault();
|
|
467
|
+
this.set(this.value - 1);
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
clamp(n) {
|
|
472
|
+
return Math.min(Math.max(Math.round(n), this.min), this.max);
|
|
473
|
+
}
|
|
474
|
+
set(n) {
|
|
475
|
+
const next = this.clamp(Number.isFinite(n) ? n : this.value);
|
|
476
|
+
if (this.inputEl)
|
|
477
|
+
this.inputEl.value = String(next);
|
|
478
|
+
if (next === this.value)
|
|
479
|
+
return;
|
|
480
|
+
this.value = next;
|
|
481
|
+
this.evokeChange.emit(next);
|
|
482
|
+
}
|
|
483
|
+
render() {
|
|
484
|
+
if (this.appearance === 'compact') {
|
|
485
|
+
const top = Math.min(this.max, this.min + 9);
|
|
486
|
+
const opts = [];
|
|
487
|
+
for (let i = this.min; i <= top; i++)
|
|
488
|
+
opts.push(i);
|
|
489
|
+
if (!opts.includes(this.value))
|
|
490
|
+
opts.push(this.value);
|
|
491
|
+
return (index.h("div", { class: "evoke-qty evoke-qty--compact" }, index.h("select", { class: "evoke-qty__select", "aria-label": this.label, disabled: this.disabled, onChange: (e) => this.set(Number(e.target.value)) }, opts.map((n) => index.h("option", { value: String(n), selected: n === this.value }, "Qty: ", n))), renderIcon('chevron-down', 'evoke-qty__chevron')));
|
|
492
|
+
}
|
|
493
|
+
return (index.h("div", { class: "evoke-qty evoke-qty--inline", role: "group", "aria-label": this.label }, index.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')), index.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)) }), index.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'))));
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
EvokeQuantityStepper.style = evokeQuantityStepperCss();
|
|
497
|
+
|
|
498
|
+
/** Accepts an array, or a JSON string (so options can be set as an HTML attribute). */
|
|
499
|
+
function parseOptions(options) {
|
|
500
|
+
if (Array.isArray(options))
|
|
501
|
+
return options;
|
|
502
|
+
try {
|
|
503
|
+
const parsed = JSON.parse(options);
|
|
504
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
505
|
+
}
|
|
506
|
+
catch (_a) {
|
|
507
|
+
return [];
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const evokeRadioGroupCss = () => `evoke-radio-group{display:block}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)}evoke-radio-group .evoke-radio__label{font-size:var(--evoke-font-size, 16px)}evoke-radio-group .evoke-radio__options{display:flex;flex-direction:column;gap:0.5rem}evoke-radio-group .evoke-radio__options--inline{flex-direction:row;flex-wrap:wrap;gap:1.25rem}evoke-radio-group .evoke-radio__row{display:inline-flex;align-items:center;gap:0.5rem;cursor:pointer;font-size:0.875rem}evoke-radio-group .evoke-radio__row--disabled{opacity:0.6;cursor:not-allowed}evoke-radio-group .evoke-radio__input{appearance:none;-webkit-appearance:none;margin:0;flex:none;width:16px;height:16px;border:2px solid var(--evoke-primary, #ff5316);border-radius:50%;background:var(--evoke-surface, #ffffff);cursor:inherit;transition:box-shadow 0.15s, filter 0.15s}evoke-radio-group .evoke-radio__input:hover:not(:disabled){filter:brightness(0.92)}evoke-radio-group .evoke-radio__input:checked{background:radial-gradient(circle, var(--evoke-primary, #ff5316) 0 40%, var(--evoke-surface, #ffffff) 45%)}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))}evoke-radio-group .evoke-radio__input--error{border-color:var(--evoke-danger, #dc2626)}evoke-radio-group .evoke-radio__error{color:var(--evoke-danger, #dc2626);font-size:0.875rem}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}evoke-radio-group .evoke-seg{position:relative;display:inline-flex;cursor:pointer}evoke-radio-group .evoke-seg+.evoke-seg{border-left:1px solid var(--evoke-primary, #ff5316)}evoke-radio-group .evoke-seg--disabled{opacity:0.5;cursor:not-allowed}evoke-radio-group .evoke-seg__input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:inherit}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}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))}evoke-radio-group .evoke-seg__input:checked+.evoke-seg__text{background:var(--evoke-primary, #ff5316);color:var(--evoke-primary-contrast, #ffffff)}evoke-radio-group .evoke-seg__input:active:not(:disabled)+.evoke-seg__text{filter:brightness(0.85)}evoke-radio-group .evoke-seg__input:focus-visible+.evoke-seg__text{box-shadow:inset 0 0 0 3px var(--evoke-secondary, #0b1560)}evoke-radio-group .evoke-seg__input.evoke-radio__input--error+.evoke-seg__text{color:var(--evoke-danger, #dc2626)}`;
|
|
512
|
+
|
|
513
|
+
const EvokeRadioGroup = class {
|
|
514
|
+
constructor(hostRef) {
|
|
515
|
+
index.registerInstance(this, hostRef);
|
|
516
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
517
|
+
this.label = '';
|
|
518
|
+
/** Options as an array of { label, value, disabled? } or a JSON string of the same */
|
|
519
|
+
this.options = [];
|
|
520
|
+
this.value = '';
|
|
521
|
+
this.name = '';
|
|
522
|
+
this.disabled = false;
|
|
523
|
+
/** Classic radio circles, or a segmented button group */
|
|
524
|
+
this.appearance = 'classic';
|
|
525
|
+
/** Lay classic options out in a row instead of a column */
|
|
526
|
+
this.inline = false;
|
|
527
|
+
/** Error message shown below the group */
|
|
528
|
+
this.error = '';
|
|
529
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
530
|
+
}
|
|
531
|
+
render() {
|
|
532
|
+
const name = this.name || `evoke-radio-${this.uid}`;
|
|
533
|
+
const labelId = `${name}-label`;
|
|
534
|
+
const errId = `${name}-err`;
|
|
535
|
+
const segmented = this.appearance === 'segmented';
|
|
536
|
+
return (index.h("div", { key: 'ddf9183b0a6733b0daf79dcdb5f7dd5525d00a62', class: "evoke-radio", role: "radiogroup", "aria-labelledby": this.label ? labelId : undefined, "aria-describedby": this.error ? errId : undefined }, this.label && index.h("span", { key: 'f80aacb295bedb5d68a51e1005de17d8d845736e', id: labelId, class: "evoke-radio__label" }, this.label), index.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) => {
|
|
537
|
+
const off = this.disabled || o.disabled;
|
|
538
|
+
const input = (index.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: () => {
|
|
539
|
+
this.value = o.value;
|
|
540
|
+
this.evokeChange.emit(this.value);
|
|
541
|
+
} }));
|
|
542
|
+
return segmented ? (index.h("label", { class: `evoke-seg ${off ? 'evoke-seg--disabled' : ''}`.trim() }, input, index.h("span", { class: "evoke-seg__text" }, o.label))) : (index.h("label", { class: `evoke-radio__row ${off ? 'evoke-radio__row--disabled' : ''}`.trim() }, input, index.h("span", null, o.label)));
|
|
543
|
+
})), this.error && index.h("span", { key: 'b6027efeea9334325c731eb73630c982c1a88ce2', id: errId, class: "evoke-radio__error", role: "alert" }, this.error)));
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
EvokeRadioGroup.style = evokeRadioGroupCss();
|
|
547
|
+
|
|
548
|
+
const evokeSelectCss = () => `evoke-select{display:block}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)}evoke-select .evoke-field__control{position:relative}evoke-select .evoke-field__input{box-sizing:border-box;width:100%;height:var(--evoke-control-height, 56px);padding:0 48px 0 24px;border:1px solid var(--evoke-border, #dedede);border-radius:var(--evoke-radius-field, 8px);background:var(--evoke-surface, #ffffff);color:var(--evoke-text, #1a1a1a);font:inherit;appearance:none;-webkit-appearance:none;cursor:pointer;transition:border-color 0.15s, box-shadow 0.15s}evoke-select .evoke-field__select--empty{color:var(--evoke-text-muted, #6b6b6b)}evoke-select .evoke-field__input:hover:not(:disabled):not(:focus){border-color:var(--evoke-text-muted, #6b6b6b)}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))}evoke-select .evoke-field__input:disabled,evoke-select .evoke-select__trigger--disabled{opacity:0.6;cursor:not-allowed}evoke-select .evoke-field__input--error{border-color:var(--evoke-danger, #dc2626)}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}evoke-select .evoke-field__hint{color:var(--evoke-text-muted, #6b6b6b);font-size:0.875rem}evoke-select .evoke-field__error{color:var(--evoke-danger, #dc2626);font-size:0.875rem}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}evoke-select .evoke-select__value{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}evoke-select .evoke-select__placeholder{color:var(--evoke-text-muted, #6b6b6b)}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)}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}evoke-select .evoke-select__chip-remove:hover{background:color-mix(in srgb, var(--evoke-text, #1a1a1a) 12%, transparent)}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))}evoke-select .evoke-select__chip-remove .evoke-icon{width:12px;height:12px}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}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)}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))}evoke-select .evoke-select__list{list-style:none;margin:0;padding:4px;overflow:auto}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}evoke-select .evoke-select__option--active{background:var(--evoke-surface-muted, #f5f5f5)}evoke-select .evoke-select__option--selected{color:var(--evoke-primary-text, #cc3d0d);font-weight:500}evoke-select .evoke-select__option--disabled{opacity:0.5;cursor:not-allowed}evoke-select .evoke-select__option .evoke-icon{width:16px;height:16px;flex:none}evoke-select .evoke-select__empty{padding:12px 16px;color:var(--evoke-text-muted, #6b6b6b)}`;
|
|
549
|
+
|
|
550
|
+
const EvokeSelect = class {
|
|
551
|
+
constructor(hostRef) {
|
|
552
|
+
index.registerInstance(this, hostRef);
|
|
553
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
554
|
+
this.label = '';
|
|
555
|
+
/** Options as an array of { label, value, disabled? } or a JSON string of the same */
|
|
556
|
+
this.options = [];
|
|
557
|
+
/** Selected value (string), or an array of values when `multiple` */
|
|
558
|
+
this.value = '';
|
|
559
|
+
this.placeholder = 'Select an option';
|
|
560
|
+
/** Multi-select: selected values are shown as removable chips */
|
|
561
|
+
this.multiple = false;
|
|
562
|
+
/** Adds a search box that filters the options */
|
|
563
|
+
this.searchable = false;
|
|
564
|
+
this.disabled = false;
|
|
565
|
+
/** Error message shown below the field (replaces the hint) */
|
|
566
|
+
this.error = '';
|
|
567
|
+
this.hint = '';
|
|
568
|
+
/** Extra classes for the inner <select> (single, non-searchable mode), e.g. "form-select" */
|
|
569
|
+
this.selectClass = '';
|
|
570
|
+
this.isOpen = false;
|
|
571
|
+
this.query = '';
|
|
572
|
+
this.activeIndex = 0;
|
|
573
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
574
|
+
this.focusSearch = false;
|
|
575
|
+
this.onKeyDown = (e) => {
|
|
576
|
+
const list = this.filtered;
|
|
577
|
+
const onTrigger = e.target === this.triggerEl;
|
|
578
|
+
switch (e.key) {
|
|
579
|
+
case 'ArrowDown':
|
|
580
|
+
case 'ArrowUp': {
|
|
581
|
+
e.preventDefault();
|
|
582
|
+
if (!this.isOpen)
|
|
583
|
+
return this.openPanel();
|
|
584
|
+
const step = e.key === 'ArrowDown' ? 1 : -1;
|
|
585
|
+
this.activeIndex = Math.min(Math.max(this.activeIndex + step, 0), Math.max(list.length - 1, 0));
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
case 'Home':
|
|
589
|
+
case 'End':
|
|
590
|
+
if (this.isOpen && !this.searchable) {
|
|
591
|
+
e.preventDefault();
|
|
592
|
+
this.activeIndex = e.key === 'Home' ? 0 : Math.max(list.length - 1, 0);
|
|
593
|
+
}
|
|
594
|
+
break;
|
|
595
|
+
case 'Enter':
|
|
596
|
+
case ' ':
|
|
597
|
+
if (e.key === ' ' && !onTrigger)
|
|
598
|
+
return; // allow typing spaces in the search box
|
|
599
|
+
e.preventDefault();
|
|
600
|
+
if (!this.isOpen)
|
|
601
|
+
return this.openPanel();
|
|
602
|
+
if (list[this.activeIndex])
|
|
603
|
+
this.toggle(list[this.activeIndex]);
|
|
604
|
+
break;
|
|
605
|
+
case 'Escape':
|
|
606
|
+
if (this.isOpen) {
|
|
607
|
+
e.preventDefault();
|
|
608
|
+
this.closePanel();
|
|
609
|
+
}
|
|
610
|
+
break;
|
|
611
|
+
case 'Tab':
|
|
612
|
+
if (this.isOpen)
|
|
613
|
+
this.closePanel(false);
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
get selected() {
|
|
619
|
+
const v = this.value;
|
|
620
|
+
if (Array.isArray(v))
|
|
621
|
+
return v;
|
|
622
|
+
if (!v)
|
|
623
|
+
return [];
|
|
624
|
+
if (this.multiple) {
|
|
625
|
+
if (v.trim().startsWith('[')) {
|
|
626
|
+
try {
|
|
627
|
+
const parsed = JSON.parse(v);
|
|
628
|
+
if (Array.isArray(parsed))
|
|
629
|
+
return parsed.map(String);
|
|
630
|
+
}
|
|
631
|
+
catch ( /* fall through to comma list */_a) { /* fall through to comma list */ }
|
|
632
|
+
}
|
|
633
|
+
return v.split(',').map((s) => s.trim()).filter(Boolean);
|
|
634
|
+
}
|
|
635
|
+
return [v];
|
|
636
|
+
}
|
|
637
|
+
get filtered() {
|
|
638
|
+
const q = this.query.trim().toLowerCase();
|
|
639
|
+
const all = parseOptions(this.options);
|
|
640
|
+
return q ? all.filter((o) => o.label.toLowerCase().includes(q)) : all;
|
|
641
|
+
}
|
|
642
|
+
onDocClick(e) {
|
|
643
|
+
if (this.isOpen && !this.el.contains(e.target))
|
|
644
|
+
this.closePanel(false);
|
|
645
|
+
}
|
|
646
|
+
componentDidRender() {
|
|
647
|
+
var _a;
|
|
648
|
+
if (!this.isOpen)
|
|
649
|
+
return;
|
|
650
|
+
if (this.focusSearch && this.searchEl) {
|
|
651
|
+
this.focusSearch = false;
|
|
652
|
+
this.searchEl.focus();
|
|
653
|
+
}
|
|
654
|
+
(_a = this.el.querySelector('.evoke-select__option--active')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
655
|
+
}
|
|
656
|
+
openPanel() {
|
|
657
|
+
if (this.disabled)
|
|
658
|
+
return;
|
|
659
|
+
const first = this.filtered.findIndex((o) => this.selected.includes(o.value));
|
|
660
|
+
this.activeIndex = first >= 0 ? first : 0;
|
|
661
|
+
this.isOpen = true;
|
|
662
|
+
this.focusSearch = this.searchable;
|
|
663
|
+
}
|
|
664
|
+
closePanel(refocus = true) {
|
|
665
|
+
var _a;
|
|
666
|
+
this.isOpen = false;
|
|
667
|
+
this.query = '';
|
|
668
|
+
if (refocus)
|
|
669
|
+
(_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
670
|
+
}
|
|
671
|
+
commit(next) {
|
|
672
|
+
this.value = next;
|
|
673
|
+
this.evokeChange.emit(next);
|
|
674
|
+
}
|
|
675
|
+
toggle(o) {
|
|
676
|
+
if (o.disabled)
|
|
677
|
+
return;
|
|
678
|
+
if (this.multiple) {
|
|
679
|
+
const cur = this.selected;
|
|
680
|
+
this.commit(cur.includes(o.value) ? cur.filter((v) => v !== o.value) : [...cur, o.value]);
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
this.commit(o.value);
|
|
684
|
+
this.closePanel();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
removeChip(v) {
|
|
688
|
+
this.commit(this.selected.filter((x) => x !== v));
|
|
689
|
+
}
|
|
690
|
+
renderNative() {
|
|
691
|
+
var _a;
|
|
692
|
+
const selectId = `evoke-select-${this.uid}`;
|
|
693
|
+
const msgId = `${selectId}-msg`;
|
|
694
|
+
const cur = (_a = this.selected[0]) !== null && _a !== void 0 ? _a : '';
|
|
695
|
+
return (index.h("div", { class: "evoke-field__control" }, index.h("select", { id: selectId, class: `evoke-field__input evoke-field__select ${cur === '' ? 'evoke-field__select--empty' : ''} ${this.error ? 'evoke-field__input--error' : ''} ${this.selectClass}`.replace(/\s+/g, ' ').trim(), disabled: this.disabled, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.error || this.hint ? msgId : undefined, onChange: (e) => this.commit(e.target.value) }, index.h("option", { value: "", disabled: true, selected: cur === '' }, this.placeholder), parseOptions(this.options).map((o) => (index.h("option", { value: o.value, disabled: o.disabled, selected: o.value === cur }, o.label)))), renderIcon('chevron-down', 'evoke-field__chevron')));
|
|
696
|
+
}
|
|
697
|
+
renderCustom() {
|
|
698
|
+
const labelId = `evoke-select-${this.uid}-label`;
|
|
699
|
+
const listId = `evoke-select-${this.uid}-list`;
|
|
700
|
+
const msgId = `evoke-select-${this.uid}-msg`;
|
|
701
|
+
const all = parseOptions(this.options);
|
|
702
|
+
const sel = this.selected;
|
|
703
|
+
const list = this.filtered;
|
|
704
|
+
const labelOf = (v) => { var _a, _b; return (_b = (_a = all.find((o) => o.value === v)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : v; };
|
|
705
|
+
return (index.h("div", { class: "evoke-field__control", onKeyDown: this.onKeyDown }, index.h("div", { class: `evoke-select__trigger evoke-field__input ${this.error ? 'evoke-field__input--error' : ''} ${this.disabled ? 'evoke-select__trigger--disabled' : ''}`.trim(), role: "combobox", tabindex: this.disabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": listId, "aria-labelledby": this.label ? labelId : undefined, "aria-label": this.label ? undefined : this.placeholder, "aria-disabled": this.disabled ? 'true' : undefined, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.error || this.hint ? msgId : undefined, "aria-activedescendant": this.isOpen && list[this.activeIndex] ? `${listId}-${this.activeIndex}` : undefined, ref: (el) => (this.triggerEl = el), onClick: () => (this.isOpen ? this.closePanel() : this.openPanel()) }, index.h("span", { class: "evoke-select__value" }, sel.length === 0 && index.h("span", { class: "evoke-select__placeholder" }, this.placeholder), this.multiple
|
|
706
|
+
? sel.map((v) => (index.h("span", { class: "evoke-select__chip" }, labelOf(v), index.h("button", { type: "button", class: "evoke-select__chip-remove", "aria-label": `Remove ${labelOf(v)}`, disabled: this.disabled, onClick: (e) => {
|
|
707
|
+
e.stopPropagation();
|
|
708
|
+
this.removeChip(v);
|
|
709
|
+
} }, renderIcon('x', 'evoke-icon')))))
|
|
710
|
+
: sel.length > 0 && index.h("span", null, labelOf(sel[0])))), renderIcon('chevron-down', 'evoke-field__chevron'), this.isOpen && (index.h("div", { class: "evoke-select__panel" }, this.searchable && (index.h("input", { class: "evoke-select__search", type: "text", placeholder: "Search\u2026", "aria-label": "Search options", "aria-controls": listId, "aria-activedescendant": list[this.activeIndex] ? `${listId}-${this.activeIndex}` : undefined, value: this.query, ref: (el) => (this.searchEl = el), onInput: (e) => {
|
|
711
|
+
this.query = e.target.value;
|
|
712
|
+
this.activeIndex = 0;
|
|
713
|
+
} })), index.h("ul", { id: listId, class: "evoke-select__list", role: "listbox", "aria-multiselectable": this.multiple ? 'true' : undefined, "aria-labelledby": this.label ? labelId : undefined }, list.map((o, i) => {
|
|
714
|
+
const isSel = sel.includes(o.value);
|
|
715
|
+
return (index.h("li", { id: `${listId}-${i}`, role: "option", "aria-selected": isSel ? 'true' : 'false', "aria-disabled": o.disabled ? 'true' : undefined, class: `evoke-select__option ${i === this.activeIndex ? 'evoke-select__option--active' : ''} ${isSel ? 'evoke-select__option--selected' : ''} ${o.disabled ? 'evoke-select__option--disabled' : ''}`.replace(/\s+/g, ' ').trim(), onMouseEnter: () => (this.activeIndex = i), onClick: () => this.toggle(o) }, index.h("span", null, o.label), isSel && renderIcon('check', 'evoke-icon')));
|
|
716
|
+
})), list.length === 0 && index.h("div", { class: "evoke-select__empty" }, "No results")))));
|
|
717
|
+
}
|
|
718
|
+
render() {
|
|
719
|
+
const labelId = `evoke-select-${this.uid}-label`;
|
|
720
|
+
const msgId = `evoke-select-${this.uid}-msg`;
|
|
721
|
+
const custom = this.multiple || this.searchable;
|
|
722
|
+
return (index.h("div", { key: '2bb9566731e91295db3e98b8934acee7d53bc0c7', class: "evoke-field" }, this.label && (index.h("label", { key: '2279b600e0770a516af752c309af43ba6fd28320', id: labelId, htmlFor: custom ? undefined : `evoke-select-${this.uid}`, class: "evoke-field__label" }, this.label)), custom ? this.renderCustom() : this.renderNative(), this.error ? (index.h("span", { id: msgId, class: "evoke-field__error", role: "alert" }, this.error)) : (this.hint && index.h("span", { id: msgId, class: "evoke-field__hint" }, this.hint))));
|
|
723
|
+
}
|
|
724
|
+
get el() { return index.getElement(this); }
|
|
725
|
+
};
|
|
726
|
+
EvokeSelect.style = evokeSelectCss();
|
|
727
|
+
|
|
728
|
+
const evokeSwitchCss = () => `evoke-switch{display:inline-block}evoke-switch .evoke-switch{position:relative;display:inline-flex;align-items:flex-start;gap:0.75rem;cursor:pointer;font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);color:var(--evoke-text, #1a1a1a)}evoke-switch .evoke-switch--disabled{opacity:0.6;cursor:not-allowed}evoke-switch .evoke-switch__input{position:absolute;width:44px;height:24px;margin:0;opacity:0;cursor:inherit}evoke-switch .evoke-switch__track{position:relative;flex:none;width:44px;height:24px;border-radius:9999px;background:#767676;transition:background-color 0.15s, box-shadow 0.15s, filter 0.15s}evoke-switch .evoke-switch__thumb{position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3);transition:transform 0.15s}evoke-switch .evoke-switch__input:checked+.evoke-switch__track{background:var(--evoke-primary, #ff5316)}evoke-switch .evoke-switch__input:checked+.evoke-switch__track .evoke-switch__thumb{transform:translateX(20px)}evoke-switch .evoke-switch:hover .evoke-switch__input:not(:disabled)+.evoke-switch__track{filter:brightness(0.92)}evoke-switch .evoke-switch__input:active:not(:disabled)+.evoke-switch__track .evoke-switch__thumb{width:24px}evoke-switch .evoke-switch__input:checked:active:not(:disabled)+.evoke-switch__track .evoke-switch__thumb{transform:translateX(16px)}evoke-switch .evoke-switch__input:focus-visible+.evoke-switch__track{box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15))}evoke-switch .evoke-switch__text{display:flex;flex-direction:column;gap:2px}evoke-switch .evoke-switch__label{font-size:var(--evoke-font-size, 16px);line-height:24px}evoke-switch .evoke-switch__desc{font-size:0.875rem;color:var(--evoke-text-muted, #6b6b6b)}@media (prefers-reduced-motion: reduce){evoke-switch .evoke-switch__thumb,evoke-switch .evoke-switch__track{transition:none}}`;
|
|
729
|
+
|
|
730
|
+
const EvokeSwitch = class {
|
|
731
|
+
constructor(hostRef) {
|
|
732
|
+
index.registerInstance(this, hostRef);
|
|
733
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
734
|
+
this.checked = false;
|
|
735
|
+
/** Optional visible label. Without a label or description it is a plain toggle. */
|
|
736
|
+
this.label = '';
|
|
737
|
+
/** Secondary text under the label */
|
|
738
|
+
this.description = '';
|
|
739
|
+
this.disabled = false;
|
|
740
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
741
|
+
}
|
|
742
|
+
render() {
|
|
743
|
+
const descId = `evoke-switch-${this.uid}-desc`;
|
|
744
|
+
return (index.h("label", { key: '8e3b9741c4e2f7ed93ce7f24893cc2db0d6acf9f', class: `evoke-switch ${this.disabled ? 'evoke-switch--disabled' : ''}`.trim() }, index.h("input", { key: 'b29122d5f8a0eb572f6f0384d537dc85543ccd66', type: "checkbox", role: "switch", class: "evoke-switch__input", checked: this.checked, disabled: this.disabled, "aria-checked": this.checked ? 'true' : 'false', "aria-label": !this.label ? this.accessibleLabel : undefined, "aria-describedby": this.description ? descId : undefined, onChange: (e) => {
|
|
745
|
+
this.checked = e.target.checked;
|
|
746
|
+
this.evokeChange.emit(this.checked);
|
|
747
|
+
} }), index.h("span", { key: 'fbecc8e67a062f7b14f9a035491f6d857ac09f71', class: "evoke-switch__track", "aria-hidden": "true" }, index.h("span", { key: 'ac6a8575b42fcb8424fee235016e4159ddec4fa9', class: "evoke-switch__thumb" })), (this.label || this.description) && (index.h("span", { key: '46357674f960e74b0f203d7bb129f605e588bb2e', class: "evoke-switch__text" }, this.label && index.h("span", { key: 'e4f4cee280c46587abe609d3946ed2a7a3b97d41', class: "evoke-switch__label" }, this.label), this.description && index.h("span", { key: '56cdbf07afaa3c64df0666ccc9d39a736188cd3d', id: descId, class: "evoke-switch__desc" }, this.description)))));
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
EvokeSwitch.style = evokeSwitchCss();
|
|
751
|
+
|
|
752
|
+
const evokeTableCss = () => `evoke-table{display:block}evoke-table .evoke-table__wrap{overflow-x:auto;border:1px solid var(--evoke-border, #dedede);border-radius:var(--evoke-radius, 8px)}evoke-table .evoke-table{width:100%;border-collapse:collapse;font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);font-size:0.9375rem;color:var(--evoke-text, #1a1a1a);background:var(--evoke-surface, #ffffff)}evoke-table .evoke-table__caption{padding:12px 16px;text-align:left;color:var(--evoke-text-muted, #6b6b6b)}evoke-table .evoke-table__th{padding:12px 16px;font-weight:600;background:var(--evoke-surface-muted, #f5f5f5);border-bottom:1px solid var(--evoke-border, #dedede);white-space:nowrap}evoke-table .evoke-table__td{padding:12px 16px;border-bottom:1px solid var(--evoke-border, #dedede)}evoke-table tbody tr:last-child .evoke-table__td{border-bottom:0}evoke-table .evoke-table__cell--left{text-align:left}evoke-table .evoke-table__cell--center{text-align:center}evoke-table .evoke-table__cell--right{text-align:right}evoke-table .evoke-table--striped .evoke-table__row:nth-child(even){background:var(--evoke-surface-muted, #f5f5f5)}evoke-table .evoke-table__row:hover{background:color-mix(in srgb, var(--evoke-primary, #ff5316) 6%, var(--evoke-surface, #ffffff))}evoke-table .evoke-table--striped .evoke-table__row:nth-child(even):hover{background:color-mix(in srgb, var(--evoke-primary, #ff5316) 8%, var(--evoke-surface-muted, #f5f5f5))}evoke-table .evoke-table__empty{padding:24px 16px;text-align:center;color:var(--evoke-text-muted, #6b6b6b)}evoke-table .evoke-table__sort{display:inline-flex;align-items:center;gap:6px;padding:2px 4px;margin:-2px -4px;font:inherit;font-weight:inherit;color:inherit;background:none;border:0;border-radius:4px;cursor:pointer}evoke-table .evoke-table__sort:hover{color:var(--evoke-primary-text, #cc3d0d)}evoke-table .evoke-table__sort:active{background:color-mix(in srgb, var(--evoke-text, #1a1a1a) 10%, transparent)}evoke-table .evoke-table__sort:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15))}evoke-table .evoke-table__sort-icon{width:14px;height:14px;color:var(--evoke-text-muted, #6b6b6b)}evoke-table .evoke-table__sort-icon--active{color:var(--evoke-primary, #ff5316)}`;
|
|
753
|
+
|
|
754
|
+
const EvokeTable = class {
|
|
755
|
+
constructor(hostRef) {
|
|
756
|
+
index.registerInstance(this, hostRef);
|
|
757
|
+
this.evokeSort = index.createEvent(this, "evokeSort");
|
|
758
|
+
/** Columns as an array of { key, label, sortable?, align? } or a JSON string of the same */
|
|
759
|
+
this.columns = [];
|
|
760
|
+
/** Rows as an array of objects keyed by column key, or a JSON string of the same */
|
|
761
|
+
this.rows = [];
|
|
762
|
+
/** Alternate row shading */
|
|
763
|
+
this.striped = false;
|
|
764
|
+
/** Allow sorting on columns marked `sortable` (or all columns if none are marked) */
|
|
765
|
+
this.sortable = false;
|
|
766
|
+
/** Visually hidden/visible table caption for screen readers */
|
|
767
|
+
this.caption = '';
|
|
768
|
+
this.emptyText = 'No data';
|
|
769
|
+
this.sortKey = '';
|
|
770
|
+
this.sortDir = 'asc';
|
|
771
|
+
}
|
|
772
|
+
parse(v) {
|
|
773
|
+
if (Array.isArray(v))
|
|
774
|
+
return v;
|
|
775
|
+
try {
|
|
776
|
+
const p = JSON.parse(v);
|
|
777
|
+
return Array.isArray(p) ? p : [];
|
|
778
|
+
}
|
|
779
|
+
catch (_a) {
|
|
780
|
+
return [];
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
toggleSort(key) {
|
|
784
|
+
this.sortDir = this.sortKey === key && this.sortDir === 'asc' ? 'desc' : 'asc';
|
|
785
|
+
this.sortKey = key;
|
|
786
|
+
this.evokeSort.emit({ key, direction: this.sortDir });
|
|
787
|
+
}
|
|
788
|
+
render() {
|
|
789
|
+
const cols = this.parse(this.columns);
|
|
790
|
+
const anyMarked = cols.some((c) => c.sortable);
|
|
791
|
+
const isSortable = (c) => this.sortable && (anyMarked ? !!c.sortable : true);
|
|
792
|
+
let rows = [...this.parse(this.rows)];
|
|
793
|
+
if (this.sortKey) {
|
|
794
|
+
const k = this.sortKey;
|
|
795
|
+
const dir = this.sortDir === 'asc' ? 1 : -1;
|
|
796
|
+
rows.sort((a, b) => {
|
|
797
|
+
const x = a[k], y = b[k];
|
|
798
|
+
if (x == null)
|
|
799
|
+
return 1;
|
|
800
|
+
if (y == null)
|
|
801
|
+
return -1;
|
|
802
|
+
return (typeof x === 'number' && typeof y === 'number' ? x - y : String(x).localeCompare(String(y), undefined, { numeric: true })) * dir;
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
return (index.h("div", { class: "evoke-table__wrap" }, index.h("table", { class: `evoke-table ${this.striped ? 'evoke-table--striped' : ''}`.trim() }, this.caption && index.h("caption", { class: "evoke-table__caption" }, this.caption), index.h("thead", null, index.h("tr", null, cols.map((c) => {
|
|
806
|
+
var _a;
|
|
807
|
+
const active = this.sortKey === c.key;
|
|
808
|
+
return (index.h("th", { scope: "col", class: `evoke-table__th evoke-table__cell--${(_a = c.align) !== null && _a !== void 0 ? _a : 'left'}`, "aria-sort": isSortable(c) ? (active ? (this.sortDir === 'asc' ? 'ascending' : 'descending') : 'none') : undefined }, isSortable(c) ? (index.h("button", { type: "button", class: "evoke-table__sort", onClick: () => this.toggleSort(c.key) }, c.label, renderIcon(active ? (this.sortDir === 'asc' ? 'arrow-up' : 'arrow-down') : 'sort', `evoke-table__sort-icon ${active ? 'evoke-table__sort-icon--active' : ''}`.trim()))) : (c.label)));
|
|
809
|
+
}))), index.h("tbody", null, rows.length === 0 ? (index.h("tr", null, index.h("td", { class: "evoke-table__empty", colSpan: Math.max(cols.length, 1) }, this.emptyText))) : (rows.map((r) => (index.h("tr", { class: "evoke-table__row" }, cols.map((c) => { var _a; return index.h("td", { class: `evoke-table__td evoke-table__cell--${(_a = c.align) !== null && _a !== void 0 ? _a : 'left'}` }, r[c.key] == null ? '' : String(r[c.key])); })))))))));
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
EvokeTable.style = evokeTableCss();
|
|
813
|
+
|
|
814
|
+
const evokeTabsCss = () => `evoke-tabs{display:block;min-width:0;max-width:100%}evoke-tabs .evoke-tabs{font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);color:var(--evoke-text, #1a1a1a)}evoke-tabs .evoke-tabs__list{display:flex;gap:4px;overflow-x:auto}evoke-tabs .evoke-tabs__tab{flex:none;font:inherit;font-size:1rem;padding:12px 20px;background:transparent;border:0;color:var(--evoke-text-muted, #6b6b6b);cursor:pointer;transition:color 0.15s, background-color 0.15s, filter 0.15s}evoke-tabs .evoke-tabs__tab:hover:not(:disabled):not(.evoke-tabs__tab--active){color:var(--evoke-text, #1a1a1a)}evoke-tabs .evoke-tabs__tab:disabled{opacity:0.5;cursor:not-allowed}evoke-tabs .evoke-tabs__tab:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15))}evoke-tabs .evoke-tabs--underline .evoke-tabs__list{border-bottom:1px solid var(--evoke-border, #dedede);gap:0}evoke-tabs .evoke-tabs--underline .evoke-tabs__tab{border-bottom:2px solid transparent;margin-bottom:-1px}evoke-tabs .evoke-tabs--underline .evoke-tabs__tab:hover:not(:disabled):not(.evoke-tabs__tab--active){border-bottom-color:var(--evoke-border, #dedede)}evoke-tabs .evoke-tabs--underline .evoke-tabs__tab--active{color:var(--evoke-primary-text, #cc3d0d);border-bottom-color:var(--evoke-primary, #ff5316);font-weight:500}evoke-tabs .evoke-tabs--underline .evoke-tabs__tab:active:not(:disabled){background:var(--evoke-surface-muted, #f5f5f5)}evoke-tabs .evoke-tabs--pill .evoke-tabs__tab{border-radius:var(--evoke-radius-button, 9999px);padding:8px 20px}evoke-tabs .evoke-tabs--pill .evoke-tabs__tab:hover:not(:disabled):not(.evoke-tabs__tab--active){background:var(--evoke-surface-muted, #f5f5f5)}evoke-tabs .evoke-tabs--pill .evoke-tabs__tab--active{background:var(--evoke-primary, #ff5316);color:var(--evoke-primary-contrast, #ffffff)}evoke-tabs .evoke-tabs--pill .evoke-tabs__tab:active:not(:disabled){filter:brightness(0.85)}evoke-tabs .evoke-tabs__panel{padding:16px 0}evoke-tabs .evoke-tabs__panel:focus-visible{outline:none;box-shadow:var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15));border-radius:var(--evoke-radius-field, 8px)}`;
|
|
815
|
+
|
|
816
|
+
const EvokeTabs = class {
|
|
817
|
+
constructor(hostRef) {
|
|
818
|
+
index.registerInstance(this, hostRef);
|
|
819
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
820
|
+
/** Tabs as an array of { label, value, disabled? } or a JSON string of the same */
|
|
821
|
+
this.options = [];
|
|
822
|
+
/** Value of the active tab. Defaults to the first enabled tab. */
|
|
823
|
+
this.value = '';
|
|
824
|
+
/** Underline tabs or pill tabs */
|
|
825
|
+
this.appearance = 'underline';
|
|
826
|
+
/** Accessible name for the tab list */
|
|
827
|
+
this.label = '';
|
|
828
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
829
|
+
this.onKeyDown = (e) => {
|
|
830
|
+
const keys = ['ArrowRight', 'ArrowLeft', 'Home', 'End'];
|
|
831
|
+
if (!keys.includes(e.key))
|
|
832
|
+
return;
|
|
833
|
+
const tabs = this.tabs;
|
|
834
|
+
const enabled = tabs.map((t, i) => (t.disabled ? -1 : i)).filter((i) => i >= 0);
|
|
835
|
+
if (enabled.length === 0)
|
|
836
|
+
return;
|
|
837
|
+
e.preventDefault();
|
|
838
|
+
const cur = tabs.findIndex((t) => t.value === this.activeValue);
|
|
839
|
+
const pos = enabled.indexOf(cur);
|
|
840
|
+
let next = enabled[0];
|
|
841
|
+
if (e.key === 'ArrowRight')
|
|
842
|
+
next = enabled[(pos + 1) % enabled.length];
|
|
843
|
+
else if (e.key === 'ArrowLeft')
|
|
844
|
+
next = enabled[(pos - 1 + enabled.length) % enabled.length];
|
|
845
|
+
else if (e.key === 'End')
|
|
846
|
+
next = enabled[enabled.length - 1];
|
|
847
|
+
const btn = this.el.querySelectorAll('[role="tab"]')[next];
|
|
848
|
+
btn === null || btn === void 0 ? void 0 : btn.focus();
|
|
849
|
+
this.select(tabs[next].value);
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
get tabs() {
|
|
853
|
+
return parseOptions(this.options);
|
|
854
|
+
}
|
|
855
|
+
get activeValue() {
|
|
856
|
+
var _a, _b;
|
|
857
|
+
const tabs = this.tabs;
|
|
858
|
+
return tabs.some((t) => t.value === this.value && !t.disabled) ? this.value : (_b = (_a = tabs.find((t) => !t.disabled)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
|
|
859
|
+
}
|
|
860
|
+
select(v) {
|
|
861
|
+
if (v === this.value)
|
|
862
|
+
return;
|
|
863
|
+
this.value = v;
|
|
864
|
+
this.evokeChange.emit(v);
|
|
865
|
+
}
|
|
866
|
+
render() {
|
|
867
|
+
const active = this.activeValue;
|
|
868
|
+
return (index.h("div", { key: '0eb147989be035ae85cc6778f7c5205ff450bbf0', class: `evoke-tabs evoke-tabs--${this.appearance}` }, index.h("div", { key: '2bed606eed52a8186fc6fdca50c179555a57de8c', class: "evoke-tabs__list", role: "tablist", "aria-label": this.label || undefined, onKeyDown: this.onKeyDown }, this.tabs.map((t) => {
|
|
869
|
+
const on = t.value === active;
|
|
870
|
+
return (index.h("button", { type: "button", role: "tab", id: `evoke-tab-${this.uid}-${t.value}`, class: `evoke-tabs__tab ${on ? 'evoke-tabs__tab--active' : ''}`.trim(), "aria-selected": on ? 'true' : 'false', "aria-controls": `evoke-panel-${this.uid}`, tabindex: on ? 0 : -1, disabled: t.disabled, onClick: () => this.select(t.value) }, t.label));
|
|
871
|
+
})), index.h("div", { key: 'b80df36c152b9b189e359a1d59106eb9372d1d62', class: "evoke-tabs__panel", role: "tabpanel", id: `evoke-panel-${this.uid}`, "aria-labelledby": active ? `evoke-tab-${this.uid}-${active}` : undefined, tabindex: 0 }, index.h("slot", { key: 'df28c424c9fd41a51f6068d04cf1f71605207d9d' }))));
|
|
872
|
+
}
|
|
873
|
+
get el() { return index.getElement(this); }
|
|
874
|
+
};
|
|
875
|
+
EvokeTabs.style = evokeTabsCss();
|
|
876
|
+
|
|
877
|
+
const evokeTextareaCss = () => `evoke-textarea{display:block}evoke-textarea .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)}evoke-textarea .evoke-field__input{box-sizing:border-box;width:100%;padding:14px 24px;border:1px solid var(--evoke-border, #dedede);border-radius:var(--evoke-radius-field, 8px);background:var(--evoke-surface, #ffffff);color:var(--evoke-text, #1a1a1a);font:inherit;line-height:1.5;resize:vertical;transition:border-color 0.15s, box-shadow 0.15s}evoke-textarea .evoke-field__textarea--auto{resize:none;overflow:hidden}evoke-textarea .evoke-field__input::placeholder{color:var(--evoke-text-muted, #6b6b6b)}evoke-textarea .evoke-field__input:hover:not(:disabled):not(:focus){border-color:var(--evoke-text-muted, #6b6b6b)}evoke-textarea .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))}evoke-textarea .evoke-field__input:disabled{opacity:0.6;cursor:not-allowed}evoke-textarea .evoke-field__input--error{border-color:var(--evoke-danger, #dc2626)}evoke-textarea .evoke-field__footer{display:flex;justify-content:space-between;gap:1rem;font-size:0.875rem}evoke-textarea .evoke-field__footer:empty{display:none}evoke-textarea .evoke-field__hint{color:var(--evoke-text-muted, #6b6b6b)}evoke-textarea .evoke-field__error{color:var(--evoke-danger, #dc2626)}evoke-textarea .evoke-field__counter{margin-left:auto;color:var(--evoke-text-muted, #6b6b6b)}evoke-textarea .evoke-field__counter--full{color:var(--evoke-danger, #dc2626)}`;
|
|
878
|
+
|
|
879
|
+
const EvokeTextarea = class {
|
|
880
|
+
constructor(hostRef) {
|
|
881
|
+
index.registerInstance(this, hostRef);
|
|
882
|
+
this.evokeInput = index.createEvent(this, "evokeInput");
|
|
883
|
+
this.evokeChange = index.createEvent(this, "evokeChange");
|
|
884
|
+
this.label = '';
|
|
885
|
+
this.value = '';
|
|
886
|
+
this.name = '';
|
|
887
|
+
this.placeholder = '';
|
|
888
|
+
/** Visible rows (the minimum height when `auto-grow` is on) */
|
|
889
|
+
this.rows = 4;
|
|
890
|
+
/** Grow with the content instead of scrolling */
|
|
891
|
+
this.autoGrow = false;
|
|
892
|
+
this.disabled = false;
|
|
893
|
+
this.required = false;
|
|
894
|
+
this.error = '';
|
|
895
|
+
this.hint = '';
|
|
896
|
+
/** Extra classes for the inner <textarea> */
|
|
897
|
+
this.textareaClass = '';
|
|
898
|
+
this.uid = Math.random().toString(36).slice(2, 9);
|
|
899
|
+
}
|
|
900
|
+
componentDidRender() {
|
|
901
|
+
this.resize();
|
|
902
|
+
}
|
|
903
|
+
resize() {
|
|
904
|
+
if (!this.autoGrow || !this.el)
|
|
905
|
+
return;
|
|
906
|
+
this.el.style.height = 'auto';
|
|
907
|
+
this.el.style.height = `${this.el.scrollHeight}px`;
|
|
908
|
+
}
|
|
909
|
+
render() {
|
|
910
|
+
var _a;
|
|
911
|
+
const id = `evoke-textarea-${this.uid}`;
|
|
912
|
+
const msgId = `${id}-msg`;
|
|
913
|
+
const len = ((_a = this.value) !== null && _a !== void 0 ? _a : '').length;
|
|
914
|
+
const hasMax = typeof this.maxLength === 'number' && this.maxLength > 0;
|
|
915
|
+
return (index.h("div", { key: '5d950d88f2b9e191fd4a29e4eada4c5e4d8c779d', class: "evoke-field" }, this.label && index.h("label", { key: '46fee07268bedd23742d8d91018dfd47c93bd58b', htmlFor: id, class: "evoke-field__label" }, this.label, this.required && index.h("span", { key: '45af0e76daa25a15e0583777f5217757074c8d78', "aria-hidden": "true" }, " *")), index.h("textarea", { key: '917c3b5749cd5b75133bb2b71a90e036b3f4eef9', id: id, class: `evoke-field__input evoke-field__textarea ${this.autoGrow ? 'evoke-field__textarea--auto' : ''} ${this.error ? 'evoke-field__input--error' : ''} ${this.textareaClass}`.replace(/\s+/g, ' ').trim(), name: this.name || undefined, rows: this.rows, maxLength: hasMax ? this.maxLength : undefined, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.error || this.hint ? msgId : undefined, ref: (el) => (this.el = el), onInput: (e) => {
|
|
916
|
+
this.value = e.target.value;
|
|
917
|
+
this.resize();
|
|
918
|
+
this.evokeInput.emit(this.value);
|
|
919
|
+
}, onChange: (e) => this.evokeChange.emit(e.target.value) }), index.h("div", { key: '95530cc625c4500a7042adda05c105f03054d4f9', class: "evoke-field__footer" }, this.error ? (index.h("span", { id: msgId, class: "evoke-field__error", role: "alert" }, this.error)) : (index.h("span", { id: msgId, class: "evoke-field__hint" }, this.hint)), hasMax && index.h("span", { key: '3f3fb731453b76cd7d2b0fa2f6ce334ca0bfd554', class: `evoke-field__counter ${len >= this.maxLength ? 'evoke-field__counter--full' : ''}`.trim(), "aria-live": "polite" }, len, " / ", this.maxLength))));
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
EvokeTextarea.style = evokeTextareaCss();
|
|
923
|
+
|
|
924
|
+
const evokeToastCss = () => `evoke-toast .evoke-toast{position:fixed;left:50%;z-index:1100;box-sizing:border-box;display:flex;align-items:center;gap:12px;width:max-content;max-width:min(92vw, 480px);padding:12px 12px 12px 16px;border-radius:var(--evoke-radius, 8px);background:var(--evoke-text, #1a1a1a);color:var(--evoke-surface, #ffffff);font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);font-size:0.9375rem;box-shadow:var(--evoke-shadow, 0 4px 12px rgba(0, 0, 0, 0.12));transform:translateX(-50%);animation:evoke-toast-in 0.2s ease-out}evoke-toast .evoke-toast--bottom{bottom:24px}evoke-toast .evoke-toast--top{top:24px}evoke-toast .evoke-toast--success .evoke-toast__icon{color:#4ade80}evoke-toast .evoke-toast--danger .evoke-toast__icon{color:#f87171}evoke-toast .evoke-toast--warning .evoke-toast__icon{color:#fbbf24}evoke-toast .evoke-toast--info .evoke-toast__icon{color:#67e8f9}evoke-toast .evoke-toast__icon{flex:none;width:20px;height:20px}evoke-toast .evoke-toast__message{flex:1;min-width:0}evoke-toast .evoke-toast__action{flex:none;padding:6px 12px;font:inherit;font-weight:600;background:transparent;color:#ffb199;border:0;border-radius:var(--evoke-radius-field, 8px);cursor:pointer}evoke-toast .evoke-toast__action:hover{background:rgba(255, 255, 255, 0.12)}evoke-toast .evoke-toast__action:active{background:rgba(255, 255, 255, 0.2)}evoke-toast .evoke-toast__close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;background:none;border:0;border-radius:50%;color:inherit;cursor:pointer}evoke-toast .evoke-toast__close:hover{background:rgba(255, 255, 255, 0.12)}evoke-toast .evoke-toast__action:focus-visible,evoke-toast .evoke-toast__close:focus-visible{outline:2px solid var(--evoke-surface, #ffffff);outline-offset:1px}evoke-toast .evoke-toast__close .evoke-icon{width:16px;height:16px}@keyframes evoke-toast-in{from{opacity:0;transform:translate(-50%, 8px)}to{opacity:1;transform:translate(-50%, 0)}}@media (prefers-reduced-motion: reduce){evoke-toast .evoke-toast{animation:none}}`;
|
|
925
|
+
|
|
926
|
+
const TYPE_ICON = { info: 'info', success: 'check', warning: 'alert', danger: 'alert' };
|
|
927
|
+
const EvokeToast = class {
|
|
928
|
+
constructor(hostRef) {
|
|
929
|
+
index.registerInstance(this, hostRef);
|
|
930
|
+
this.evokeAction = index.createEvent(this, "evokeAction");
|
|
931
|
+
this.evokeClose = index.createEvent(this, "evokeClose");
|
|
932
|
+
this.open = false;
|
|
933
|
+
/** Message text (or use the default slot) */
|
|
934
|
+
this.message = '';
|
|
935
|
+
this.type = 'info';
|
|
936
|
+
/** Label of an action button, e.g. "View cart". Leave empty for a simple message. */
|
|
937
|
+
this.action = '';
|
|
938
|
+
/** Auto-dismiss after this many ms; 0 keeps it open until closed */
|
|
939
|
+
this.duration = 4000;
|
|
940
|
+
this.position = 'bottom';
|
|
941
|
+
}
|
|
942
|
+
onOpen(next) {
|
|
943
|
+
this.clearTimer();
|
|
944
|
+
if (next)
|
|
945
|
+
this.startTimer();
|
|
946
|
+
}
|
|
947
|
+
componentDidLoad() {
|
|
948
|
+
if (this.open)
|
|
949
|
+
this.startTimer();
|
|
950
|
+
}
|
|
951
|
+
disconnectedCallback() {
|
|
952
|
+
this.clearTimer();
|
|
953
|
+
}
|
|
954
|
+
startTimer() {
|
|
955
|
+
if (this.duration > 0)
|
|
956
|
+
this.timer = setTimeout(() => this.close(), this.duration);
|
|
957
|
+
}
|
|
958
|
+
clearTimer() {
|
|
959
|
+
if (this.timer)
|
|
960
|
+
clearTimeout(this.timer);
|
|
961
|
+
this.timer = undefined;
|
|
962
|
+
}
|
|
963
|
+
close() {
|
|
964
|
+
this.clearTimer();
|
|
965
|
+
this.open = false;
|
|
966
|
+
this.evokeClose.emit();
|
|
967
|
+
}
|
|
968
|
+
render() {
|
|
969
|
+
if (!this.open)
|
|
970
|
+
return null;
|
|
971
|
+
const urgent = this.type === 'danger' || this.type === 'warning';
|
|
972
|
+
return (index.h("div", { class: `evoke-toast evoke-toast--${this.position} evoke-toast--${this.type}`, role: urgent ? 'alert' : 'status', "aria-live": urgent ? 'assertive' : 'polite', onMouseEnter: () => this.clearTimer(), onMouseLeave: () => this.open && this.startTimer() }, renderIcon(TYPE_ICON[this.type], 'evoke-toast__icon'), index.h("span", { class: "evoke-toast__message" }, this.message, index.h("slot", null)), this.action && (index.h("button", { type: "button", class: "evoke-toast__action", onClick: () => {
|
|
973
|
+
this.evokeAction.emit();
|
|
974
|
+
this.close();
|
|
975
|
+
} }, this.action)), index.h("button", { type: "button", class: "evoke-toast__close", "aria-label": "Dismiss", onClick: () => this.close() }, renderIcon('x', 'evoke-icon'))));
|
|
976
|
+
}
|
|
977
|
+
static get watchers() { return {
|
|
978
|
+
"open": [{
|
|
979
|
+
"onOpen": 0
|
|
980
|
+
}]
|
|
981
|
+
}; }
|
|
982
|
+
};
|
|
983
|
+
EvokeToast.style = evokeToastCss();
|
|
984
|
+
|
|
985
|
+
const evokeTooltipCss = () => `evoke-tooltip{display:inline-block}evoke-tooltip .evoke-tooltip{position:relative;display:inline-flex}evoke-tooltip .evoke-tooltip__bubble{--_bg:var(--evoke-text, #1a1a1a);--_fg:var(--evoke-surface, #ffffff);position:absolute;z-index:30;box-sizing:border-box;width:max-content;max-width:240px;padding:6px 10px;border-radius:calc(var(--evoke-radius-field, 8px) - 2px);background:var(--_bg);color:var(--_fg);font-family:var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);font-size:0.875rem;line-height:1.4;pointer-events:none;opacity:0;visibility:hidden;transition:opacity 0.12s, visibility 0.12s}evoke-tooltip .evoke-tooltip__bubble--visible{opacity:1;visibility:visible}evoke-tooltip .evoke-tooltip__bubble--light{--_bg:var(--evoke-surface, #ffffff);--_fg:var(--evoke-text, #1a1a1a);border:1px solid var(--evoke-border, #dedede);box-shadow:var(--evoke-shadow, 0 4px 12px rgba(0, 0, 0, 0.12))}evoke-tooltip .evoke-tooltip__bubble--top{bottom:calc(100% + 8px);left:50%;transform:translateX(-50%)}evoke-tooltip .evoke-tooltip__bubble--bottom{top:calc(100% + 8px);left:50%;transform:translateX(-50%)}evoke-tooltip .evoke-tooltip__bubble--left{right:calc(100% + 8px);top:50%;transform:translateY(-50%)}evoke-tooltip .evoke-tooltip__bubble--right{left:calc(100% + 8px);top:50%;transform:translateY(-50%)}evoke-tooltip .evoke-tooltip__bubble--light::after{content:'';position:absolute;width:8px;height:8px;background:var(--_bg);border:1px solid var(--evoke-border, #dedede);transform:rotate(45deg)}evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--top::after{bottom:-5px;left:calc(50% - 4px);border-top:0;border-left:0}evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--bottom::after{top:-5px;left:calc(50% - 4px);border-bottom:0;border-right:0}evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--left::after{right:-5px;top:calc(50% - 4px);border-bottom:0;border-left:0}evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--right::after{left:-5px;top:calc(50% - 4px);border-top:0;border-right:0}@media (prefers-reduced-motion: reduce){evoke-tooltip .evoke-tooltip__bubble{transition:none}}`;
|
|
986
|
+
|
|
987
|
+
const EvokeTooltip = class {
|
|
988
|
+
constructor(hostRef) {
|
|
989
|
+
index.registerInstance(this, hostRef);
|
|
990
|
+
this.text = '';
|
|
991
|
+
this.placement = 'top';
|
|
992
|
+
/** Dark, or light with an arrow */
|
|
993
|
+
this.theme = 'dark';
|
|
994
|
+
this.visible = false;
|
|
995
|
+
this.id = `evoke-tip-${Math.random().toString(36).slice(2, 9)}`;
|
|
996
|
+
this.show = () => (this.visible = true);
|
|
997
|
+
this.hide = () => (this.visible = false);
|
|
998
|
+
}
|
|
999
|
+
componentDidLoad() {
|
|
1000
|
+
this.link();
|
|
1001
|
+
// Slotted components (e.g. <evoke-button>) render their inner <button> later, so keep linking
|
|
1002
|
+
this.observer = new MutationObserver(() => this.link());
|
|
1003
|
+
this.observer.observe(this.el, { childList: true, subtree: true });
|
|
1004
|
+
}
|
|
1005
|
+
disconnectedCallback() {
|
|
1006
|
+
var _a;
|
|
1007
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1008
|
+
}
|
|
1009
|
+
/** Point every focusable element inside the trigger at the tooltip text (aria-describedby) */
|
|
1010
|
+
link() {
|
|
1011
|
+
const targets = this.el.querySelectorAll('button, a[href], input, select, textarea, [tabindex]');
|
|
1012
|
+
targets.forEach((t) => {
|
|
1013
|
+
var _a;
|
|
1014
|
+
if (t.closest('.evoke-tooltip__bubble'))
|
|
1015
|
+
return;
|
|
1016
|
+
const ids = ((_a = t.getAttribute('aria-describedby')) !== null && _a !== void 0 ? _a : '').split(' ').filter(Boolean);
|
|
1017
|
+
if (!ids.includes(this.id))
|
|
1018
|
+
t.setAttribute('aria-describedby', [...ids, this.id].join(' '));
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
render() {
|
|
1022
|
+
return (index.h("span", { key: '4fad6f7ab25d2d68bb6db42a02f16b36439ec504', class: "evoke-tooltip", onMouseEnter: this.show, onMouseLeave: this.hide, onFocusin: this.show, onFocusout: this.hide, onKeyDown: (e) => e.key === 'Escape' && this.hide() }, index.h("slot", { key: 'b1169b0a9870c3420c581d095eb0c15073df55df' }), index.h("span", { key: '4ee1f48be749e54c93dc7fd555f8021079d68038', id: this.id, role: "tooltip", class: `evoke-tooltip__bubble evoke-tooltip__bubble--${this.placement} evoke-tooltip__bubble--${this.theme} ${this.visible ? 'evoke-tooltip__bubble--visible' : ''}`.trim() }, this.text)));
|
|
1023
|
+
}
|
|
1024
|
+
get el() { return index.getElement(this); }
|
|
1025
|
+
};
|
|
1026
|
+
EvokeTooltip.style = evokeTooltipCss();
|
|
1027
|
+
|
|
1028
|
+
exports.evoke_alert = EvokeAlert;
|
|
1029
|
+
exports.evoke_app_bar = EvokeAppBar;
|
|
1030
|
+
exports.evoke_badge = EvokeBadge;
|
|
1031
|
+
exports.evoke_button = EvokeButton;
|
|
1032
|
+
exports.evoke_card = EvokeCard;
|
|
1033
|
+
exports.evoke_checkbox = EvokeCheckbox;
|
|
1034
|
+
exports.evoke_chip = EvokeChip;
|
|
1035
|
+
exports.evoke_input = EvokeInput;
|
|
1036
|
+
exports.evoke_modal = EvokeModal;
|
|
1037
|
+
exports.evoke_pagination = EvokePagination;
|
|
1038
|
+
exports.evoke_progress = EvokeProgress;
|
|
1039
|
+
exports.evoke_quantity_stepper = EvokeQuantityStepper;
|
|
1040
|
+
exports.evoke_radio_group = EvokeRadioGroup;
|
|
1041
|
+
exports.evoke_select = EvokeSelect;
|
|
1042
|
+
exports.evoke_switch = EvokeSwitch;
|
|
1043
|
+
exports.evoke_table = EvokeTable;
|
|
1044
|
+
exports.evoke_tabs = EvokeTabs;
|
|
1045
|
+
exports.evoke_textarea = EvokeTextarea;
|
|
1046
|
+
exports.evoke_toast = EvokeToast;
|
|
1047
|
+
exports.evoke_tooltip = EvokeTooltip;
|