@evoke-tech/stencil-ui-kit 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +120 -20
  2. package/dist/cjs/evoke-alert_20.cjs.entry.js +1047 -0
  3. package/dist/cjs/evoke-ui.cjs.js +2 -2
  4. package/dist/cjs/{index-B8xS0y1i.js → index-BpJ5gu8f.js} +146 -5
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/collection/collection-manifest.json +13 -1
  7. package/dist/collection/components/evoke-alert/evoke-alert.css +17 -6
  8. package/dist/collection/components/evoke-alert/evoke-alert.js +25 -1
  9. package/dist/collection/components/evoke-app-bar/evoke-app-bar.css +13 -0
  10. package/dist/collection/components/evoke-app-bar/evoke-app-bar.js +94 -0
  11. package/dist/collection/components/evoke-badge/evoke-badge.css +13 -0
  12. package/dist/collection/components/evoke-badge/evoke-badge.js +162 -0
  13. package/dist/collection/components/evoke-button/evoke-button.css +16 -2
  14. package/dist/collection/components/evoke-button/evoke-button.js +117 -5
  15. package/dist/collection/components/evoke-card/evoke-card.css +9 -1
  16. package/dist/collection/components/evoke-card/evoke-card.js +75 -1
  17. package/dist/collection/components/evoke-checkbox/evoke-checkbox.css +7 -1
  18. package/dist/collection/components/evoke-checkbox/evoke-checkbox.js +31 -2
  19. package/dist/collection/components/evoke-chip/evoke-chip.css +16 -0
  20. package/dist/collection/components/evoke-chip/evoke-chip.js +149 -0
  21. package/dist/collection/components/evoke-input/evoke-input.css +11 -3
  22. package/dist/collection/components/evoke-input/evoke-input.js +103 -13
  23. package/dist/collection/components/evoke-modal/evoke-modal.css +21 -5
  24. package/dist/collection/components/evoke-modal/evoke-modal.js +129 -4
  25. package/dist/collection/components/evoke-pagination/evoke-pagination.css +12 -0
  26. package/dist/collection/components/evoke-pagination/evoke-pagination.js +156 -0
  27. package/dist/collection/components/evoke-progress/evoke-progress.css +12 -0
  28. package/dist/collection/components/evoke-progress/evoke-progress.js +146 -0
  29. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.css +20 -0
  30. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.js +201 -0
  31. package/dist/collection/components/evoke-radio-group/evoke-radio-group.css +14 -1
  32. package/dist/collection/components/evoke-radio-group/evoke-radio-group.js +34 -8
  33. package/dist/collection/components/evoke-select/evoke-select.css +25 -4
  34. package/dist/collection/components/evoke-select/evoke-select.js +245 -15
  35. package/dist/collection/components/evoke-switch/evoke-switch.css +16 -0
  36. package/dist/collection/components/evoke-switch/evoke-switch.js +151 -0
  37. package/dist/collection/components/evoke-table/evoke-table.css +20 -0
  38. package/dist/collection/components/evoke-table/evoke-table.js +222 -0
  39. package/dist/collection/components/evoke-tabs/evoke-tabs.css +20 -0
  40. package/dist/collection/components/evoke-tabs/evoke-tabs.js +179 -0
  41. package/dist/collection/components/evoke-textarea/evoke-textarea.css +19 -0
  42. package/dist/collection/components/evoke-textarea/evoke-textarea.js +328 -0
  43. package/dist/collection/components/evoke-toast/evoke-toast.css +24 -0
  44. package/dist/collection/components/evoke-toast/evoke-toast.js +225 -0
  45. package/dist/collection/components/evoke-tooltip/evoke-tooltip.css +22 -0
  46. package/dist/collection/components/evoke-tooltip/evoke-tooltip.js +119 -0
  47. package/dist/collection/utils/icons.js +29 -0
  48. package/dist/components/evoke-alert.js +1 -1
  49. package/dist/components/evoke-app-bar.d.ts +11 -0
  50. package/dist/components/evoke-app-bar.js +1 -0
  51. package/dist/components/evoke-badge.d.ts +11 -0
  52. package/dist/components/evoke-badge.js +1 -0
  53. package/dist/components/evoke-button.js +1 -1
  54. package/dist/components/evoke-card.js +1 -1
  55. package/dist/components/evoke-checkbox.js +1 -1
  56. package/dist/components/evoke-chip.d.ts +11 -0
  57. package/dist/components/evoke-chip.js +1 -0
  58. package/dist/components/evoke-input.js +1 -1
  59. package/dist/components/evoke-modal.js +1 -1
  60. package/dist/components/evoke-pagination.d.ts +11 -0
  61. package/dist/components/evoke-pagination.js +1 -0
  62. package/dist/components/evoke-progress.d.ts +11 -0
  63. package/dist/components/evoke-progress.js +1 -0
  64. package/dist/components/evoke-quantity-stepper.d.ts +11 -0
  65. package/dist/components/evoke-quantity-stepper.js +1 -0
  66. package/dist/components/evoke-radio-group.js +1 -1
  67. package/dist/components/evoke-select.js +1 -1
  68. package/dist/components/evoke-switch.d.ts +11 -0
  69. package/dist/components/evoke-switch.js +1 -0
  70. package/dist/components/evoke-table.d.ts +11 -0
  71. package/dist/components/evoke-table.js +1 -0
  72. package/dist/components/evoke-tabs.d.ts +11 -0
  73. package/dist/components/evoke-tabs.js +1 -0
  74. package/dist/components/evoke-textarea.d.ts +11 -0
  75. package/dist/components/evoke-textarea.js +1 -0
  76. package/dist/components/evoke-toast.d.ts +11 -0
  77. package/dist/components/evoke-toast.js +1 -0
  78. package/dist/components/evoke-tooltip.d.ts +11 -0
  79. package/dist/components/evoke-tooltip.js +1 -0
  80. package/dist/components/icons.js +1 -0
  81. package/dist/esm/evoke-alert_20.entry.js +1026 -0
  82. package/dist/esm/evoke-ui.js +3 -3
  83. package/dist/esm/{index-BtM1wZ-I.js → index-C-5sEjU8.js} +146 -6
  84. package/dist/esm/loader.js +3 -3
  85. package/dist/evoke-ui/evoke-ui.css +1 -1
  86. package/dist/evoke-ui/evoke-ui.esm.js +1 -1
  87. package/dist/evoke-ui/p-0841be89.entry.js +1 -0
  88. package/dist/evoke-ui/p-C-5sEjU8.js +3 -0
  89. package/dist/themes/bootstrap.css +3 -0
  90. package/dist/themes/material.css +3 -0
  91. package/dist/themes/tailwind.css +3 -0
  92. package/dist/themes/tokens.css +4 -1
  93. package/dist/types/components/evoke-alert/evoke-alert.d.ts +2 -0
  94. package/dist/types/components/evoke-app-bar/evoke-app-bar.d.ts +14 -0
  95. package/dist/types/components/evoke-badge/evoke-badge.d.ts +17 -0
  96. package/dist/types/components/evoke-button/evoke-button.d.ts +12 -2
  97. package/dist/types/components/evoke-card/evoke-card.d.ts +9 -0
  98. package/dist/types/components/evoke-checkbox/evoke-checkbox.d.ts +5 -0
  99. package/dist/types/components/evoke-chip/evoke-chip.d.ts +14 -0
  100. package/dist/types/components/evoke-input/evoke-input.d.ts +9 -1
  101. package/dist/types/components/evoke-modal/evoke-modal.d.ts +19 -1
  102. package/dist/types/components/evoke-pagination/evoke-pagination.d.ts +15 -0
  103. package/dist/types/components/evoke-progress/evoke-progress.d.ts +13 -0
  104. package/dist/types/components/evoke-quantity-stepper/evoke-quantity-stepper.d.ts +18 -0
  105. package/dist/types/components/evoke-radio-group/evoke-radio-group.d.ts +4 -2
  106. package/dist/types/components/evoke-select/evoke-select.d.ts +31 -6
  107. package/dist/types/components/evoke-switch/evoke-switch.d.ts +15 -0
  108. package/dist/types/components/evoke-table/evoke-table.d.ts +29 -0
  109. package/dist/types/components/evoke-tabs/evoke-tabs.d.ts +21 -0
  110. package/dist/types/components/evoke-textarea/evoke-textarea.d.ts +28 -0
  111. package/dist/types/components/evoke-toast/evoke-toast.d.ts +24 -0
  112. package/dist/types/components/evoke-tooltip/evoke-tooltip.d.ts +17 -0
  113. package/dist/types/components.d.ts +1237 -18
  114. package/dist/types/utils/icons.d.ts +25 -0
  115. package/package.json +11 -4
  116. package/dist/cjs/evoke-alert_6.cjs.entry.js +0 -172
  117. package/dist/cjs/evoke-card.cjs.entry.js +0 -20
  118. package/dist/cjs/evoke-modal.cjs.entry.js +0 -34
  119. package/dist/esm/evoke-alert_6.entry.js +0 -165
  120. package/dist/esm/evoke-card.entry.js +0 -18
  121. package/dist/esm/evoke-modal.entry.js +0 -32
  122. package/dist/evoke-ui/p-243075cd.entry.js +0 -1
  123. package/dist/evoke-ui/p-605d4757.entry.js +0 -1
  124. package/dist/evoke-ui/p-9a6eaeb6.entry.js +0 -1
  125. package/dist/evoke-ui/p-BtM1wZ-I.js +0 -3
@@ -0,0 +1,156 @@
1
+ import { h } from "@stencil/core";
2
+ import { renderIcon } from "../../utils/icons";
3
+ export class EvokePagination {
4
+ constructor() {
5
+ /** Current page (1-based) */
6
+ this.page = 1;
7
+ /** Total number of pages */
8
+ this.total = 1;
9
+ /** Numbered pages, or compact (Prev, "2 of 10", Next) */
10
+ this.appearance = 'numbered';
11
+ this.disabled = false;
12
+ }
13
+ go(p) {
14
+ const next = Math.min(Math.max(p, 1), Math.max(this.total, 1));
15
+ if (this.disabled || next === this.page)
16
+ return;
17
+ this.page = next;
18
+ this.evokeChange.emit(next);
19
+ }
20
+ pages() {
21
+ const t = this.total, p = this.page;
22
+ if (t <= 7)
23
+ return Array.from({ length: t }, (_, i) => i + 1);
24
+ const out = [1];
25
+ const start = Math.max(2, p - 1);
26
+ const end = Math.min(t - 1, p + 1);
27
+ if (start > 2)
28
+ out.push('…');
29
+ for (let i = start; i <= end; i++)
30
+ out.push(i);
31
+ if (end < t - 1)
32
+ out.push('…');
33
+ out.push(t);
34
+ return out;
35
+ }
36
+ render() {
37
+ const prevOff = this.disabled || this.page <= 1;
38
+ const nextOff = this.disabled || this.page >= this.total;
39
+ const prev = (h("button", { key: '702c8196b0bd4c6bfff38d355e85bda4c58ec52f', type: "button", class: "evoke-pager__btn evoke-pager__nav", "aria-label": "Previous page", disabled: prevOff, onClick: () => this.go(this.page - 1) }, renderIcon('chevron-left', 'evoke-icon'), this.appearance === 'compact' && h("span", { key: '64f68912c444b59a7a6c074e074f745585726e62' }, "Prev")));
40
+ const next = (h("button", { key: '5b7ff3fe00e16bd03e3244971bfb86c6891051c3', type: "button", class: "evoke-pager__btn evoke-pager__nav", "aria-label": "Next page", disabled: nextOff, onClick: () => this.go(this.page + 1) }, this.appearance === 'compact' && h("span", { key: '83d15b9f16dac8d810cb50d7a2a5df1c01f720cb' }, "Next"), renderIcon('chevron-right', 'evoke-icon')));
41
+ return (h("nav", { key: '5ebe89ac00b59391f425e518ae145b84742a5bb1', class: `evoke-pager evoke-pager--${this.appearance}`, "aria-label": "Pagination" }, prev, this.appearance === 'compact' ? (h("span", { class: "evoke-pager__status", "aria-live": "polite" }, this.page, " of ", this.total)) : (this.pages().map((p) => p === '…' ? (h("span", { class: "evoke-pager__gap", "aria-hidden": "true" }, "\u2026")) : (h("button", { type: "button", class: `evoke-pager__btn ${p === this.page ? 'evoke-pager__btn--active' : ''}`.trim(), "aria-label": `Page ${p}`, "aria-current": p === this.page ? 'page' : undefined, disabled: this.disabled, onClick: () => this.go(p) }, p)))), next));
42
+ }
43
+ static get is() { return "evoke-pagination"; }
44
+ static get originalStyleUrls() {
45
+ return {
46
+ "$": ["evoke-pagination.css"]
47
+ };
48
+ }
49
+ static get styleUrls() {
50
+ return {
51
+ "$": ["evoke-pagination.css"]
52
+ };
53
+ }
54
+ static get properties() {
55
+ return {
56
+ "page": {
57
+ "type": "number",
58
+ "mutable": true,
59
+ "complexType": {
60
+ "original": "number",
61
+ "resolved": "number",
62
+ "references": {}
63
+ },
64
+ "required": false,
65
+ "optional": false,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": "Current page (1-based)"
69
+ },
70
+ "getter": false,
71
+ "setter": false,
72
+ "reflect": false,
73
+ "attribute": "page",
74
+ "defaultValue": "1"
75
+ },
76
+ "total": {
77
+ "type": "number",
78
+ "mutable": false,
79
+ "complexType": {
80
+ "original": "number",
81
+ "resolved": "number",
82
+ "references": {}
83
+ },
84
+ "required": false,
85
+ "optional": false,
86
+ "docs": {
87
+ "tags": [],
88
+ "text": "Total number of pages"
89
+ },
90
+ "getter": false,
91
+ "setter": false,
92
+ "reflect": false,
93
+ "attribute": "total",
94
+ "defaultValue": "1"
95
+ },
96
+ "appearance": {
97
+ "type": "string",
98
+ "mutable": false,
99
+ "complexType": {
100
+ "original": "'numbered' | 'compact'",
101
+ "resolved": "\"compact\" | \"numbered\"",
102
+ "references": {}
103
+ },
104
+ "required": false,
105
+ "optional": false,
106
+ "docs": {
107
+ "tags": [],
108
+ "text": "Numbered pages, or compact (Prev, \"2 of 10\", Next)"
109
+ },
110
+ "getter": false,
111
+ "setter": false,
112
+ "reflect": false,
113
+ "attribute": "appearance",
114
+ "defaultValue": "'numbered'"
115
+ },
116
+ "disabled": {
117
+ "type": "boolean",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "boolean",
121
+ "resolved": "boolean",
122
+ "references": {}
123
+ },
124
+ "required": false,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": ""
129
+ },
130
+ "getter": false,
131
+ "setter": false,
132
+ "reflect": false,
133
+ "attribute": "disabled",
134
+ "defaultValue": "false"
135
+ }
136
+ };
137
+ }
138
+ static get events() {
139
+ return [{
140
+ "method": "evokeChange",
141
+ "name": "evokeChange",
142
+ "bubbles": true,
143
+ "cancelable": true,
144
+ "composed": true,
145
+ "docs": {
146
+ "tags": [],
147
+ "text": "Emits the new page number"
148
+ },
149
+ "complexType": {
150
+ "original": "number",
151
+ "resolved": "number",
152
+ "references": {}
153
+ }
154
+ }];
155
+ }
156
+ }
@@ -0,0 +1,12 @@
1
+ evoke-progress { display: block; }
2
+ evoke-progress .evoke-progress--linear { position: relative; width: 100%; height: 8px; overflow: hidden; border-radius: 9999px; background: var(--evoke-surface-muted, #f5f5f5); box-shadow: inset 0 0 0 1px var(--evoke-border, #dedede); }
3
+ evoke-progress .evoke-progress__bar { height: 100%; border-radius: inherit; background: var(--evoke-primary, #ff5316); transition: width 0.25s ease; }
4
+ evoke-progress .evoke-progress--linear.evoke-progress--indeterminate .evoke-progress__bar { position: absolute; width: 40%; animation: evoke-bar 1.2s ease-in-out infinite; }
5
+ evoke-progress .evoke-progress--circular { display: inline-block; }
6
+ evoke-progress .evoke-progress--circular svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
7
+ evoke-progress .evoke-progress__track { stroke: var(--evoke-border, #dedede); }
8
+ evoke-progress .evoke-progress__ring { stroke: var(--evoke-primary, #ff5316); transition: stroke-dashoffset 0.25s ease; }
9
+ evoke-progress .evoke-progress--circular.evoke-progress--indeterminate svg { animation: evoke-spin 0.9s linear infinite; }
10
+ @keyframes evoke-bar { 0% { left: -40%; } 100% { left: 100%; } }
11
+ @keyframes evoke-spin { to { transform: rotate(270deg); } }
12
+ @media (prefers-reduced-motion: reduce) { evoke-progress .evoke-progress__bar, evoke-progress .evoke-progress--circular svg { animation-duration: 3s !important; transition: none; } }
@@ -0,0 +1,146 @@
1
+ import { h } from "@stencil/core";
2
+ const RADIUS = 18;
3
+ const CIRC = 2 * Math.PI * RADIUS;
4
+ export class EvokeProgress {
5
+ constructor() {
6
+ /** Linear bar, or circular spinner / ring */
7
+ this.type = 'linear';
8
+ /** Progress from 0 to 100 */
9
+ this.value = 0;
10
+ /** Unknown duration: animates continuously and ignores `value` */
11
+ this.indeterminate = false;
12
+ /** Accessible name, e.g. "Uploading" */
13
+ this.label = 'Loading';
14
+ /** Diameter in px for the circular type */
15
+ this.size = 40;
16
+ }
17
+ render() {
18
+ const v = Math.min(Math.max(Number(this.value) || 0, 0), 100);
19
+ const aria = {
20
+ role: 'progressbar',
21
+ 'aria-label': this.label,
22
+ 'aria-valuemin': '0',
23
+ 'aria-valuemax': '100',
24
+ 'aria-valuenow': this.indeterminate ? undefined : String(Math.round(v)),
25
+ };
26
+ if (this.type === 'circular') {
27
+ return (h("div", Object.assign({ class: `evoke-progress evoke-progress--circular ${this.indeterminate ? 'evoke-progress--indeterminate' : ''}`.trim(), style: { width: `${this.size}px`, height: `${this.size}px` } }, aria), h("svg", { viewBox: "0 0 44 44", "aria-hidden": "true", focusable: "false" }, h("circle", { class: "evoke-progress__track", cx: "22", cy: "22", r: String(RADIUS), fill: "none", "stroke-width": "4" }), h("circle", { class: "evoke-progress__ring", cx: "22", cy: "22", r: String(RADIUS), fill: "none", "stroke-width": "4", "stroke-linecap": "round", "stroke-dasharray": this.indeterminate ? `${CIRC * 0.25} ${CIRC}` : String(CIRC), "stroke-dashoffset": this.indeterminate ? undefined : String(CIRC * (1 - v / 100)) }))));
28
+ }
29
+ return (h("div", Object.assign({ class: `evoke-progress evoke-progress--linear ${this.indeterminate ? 'evoke-progress--indeterminate' : ''}`.trim() }, aria), h("div", { class: "evoke-progress__bar", style: this.indeterminate ? undefined : { width: `${v}%` } })));
30
+ }
31
+ static get is() { return "evoke-progress"; }
32
+ static get originalStyleUrls() {
33
+ return {
34
+ "$": ["evoke-progress.css"]
35
+ };
36
+ }
37
+ static get styleUrls() {
38
+ return {
39
+ "$": ["evoke-progress.css"]
40
+ };
41
+ }
42
+ static get properties() {
43
+ return {
44
+ "type": {
45
+ "type": "string",
46
+ "mutable": false,
47
+ "complexType": {
48
+ "original": "'linear' | 'circular'",
49
+ "resolved": "\"circular\" | \"linear\"",
50
+ "references": {}
51
+ },
52
+ "required": false,
53
+ "optional": false,
54
+ "docs": {
55
+ "tags": [],
56
+ "text": "Linear bar, or circular spinner / ring"
57
+ },
58
+ "getter": false,
59
+ "setter": false,
60
+ "reflect": false,
61
+ "attribute": "type",
62
+ "defaultValue": "'linear'"
63
+ },
64
+ "value": {
65
+ "type": "number",
66
+ "mutable": false,
67
+ "complexType": {
68
+ "original": "number",
69
+ "resolved": "number",
70
+ "references": {}
71
+ },
72
+ "required": false,
73
+ "optional": false,
74
+ "docs": {
75
+ "tags": [],
76
+ "text": "Progress from 0 to 100"
77
+ },
78
+ "getter": false,
79
+ "setter": false,
80
+ "reflect": false,
81
+ "attribute": "value",
82
+ "defaultValue": "0"
83
+ },
84
+ "indeterminate": {
85
+ "type": "boolean",
86
+ "mutable": false,
87
+ "complexType": {
88
+ "original": "boolean",
89
+ "resolved": "boolean",
90
+ "references": {}
91
+ },
92
+ "required": false,
93
+ "optional": false,
94
+ "docs": {
95
+ "tags": [],
96
+ "text": "Unknown duration: animates continuously and ignores `value`"
97
+ },
98
+ "getter": false,
99
+ "setter": false,
100
+ "reflect": false,
101
+ "attribute": "indeterminate",
102
+ "defaultValue": "false"
103
+ },
104
+ "label": {
105
+ "type": "string",
106
+ "mutable": false,
107
+ "complexType": {
108
+ "original": "string",
109
+ "resolved": "string",
110
+ "references": {}
111
+ },
112
+ "required": false,
113
+ "optional": false,
114
+ "docs": {
115
+ "tags": [],
116
+ "text": "Accessible name, e.g. \"Uploading\""
117
+ },
118
+ "getter": false,
119
+ "setter": false,
120
+ "reflect": false,
121
+ "attribute": "label",
122
+ "defaultValue": "'Loading'"
123
+ },
124
+ "size": {
125
+ "type": "number",
126
+ "mutable": false,
127
+ "complexType": {
128
+ "original": "number",
129
+ "resolved": "number",
130
+ "references": {}
131
+ },
132
+ "required": false,
133
+ "optional": false,
134
+ "docs": {
135
+ "tags": [],
136
+ "text": "Diameter in px for the circular type"
137
+ },
138
+ "getter": false,
139
+ "setter": false,
140
+ "reflect": false,
141
+ "attribute": "size",
142
+ "defaultValue": "40"
143
+ }
144
+ };
145
+ }
146
+ }
@@ -0,0 +1,20 @@
1
+ evoke-quantity-stepper { display: inline-block; }
2
+ evoke-quantity-stepper .evoke-qty { font-family: var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); color: var(--evoke-text, #1a1a1a); }
3
+ evoke-quantity-stepper .evoke-qty--inline { display: inline-flex; align-items: center; height: calc(var(--evoke-control-height, 56px) * 0.75); border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-button, 9999px); background: var(--evoke-surface, #ffffff); overflow: hidden; }
4
+ evoke-quantity-stepper .evoke-qty--inline:focus-within { border-color: var(--evoke-secondary, #0b1560); box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
5
+ evoke-quantity-stepper .evoke-qty__btn { display: inline-flex; align-items: center; justify-content: center; width: calc(var(--evoke-control-height, 56px) * 0.75); height: 100%; padding: 0; color: var(--evoke-primary, #ff5316); background: transparent; border: 0; cursor: pointer; transition: background-color 0.15s; }
6
+ evoke-quantity-stepper .evoke-qty__btn:hover:not(:disabled) { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 10%, transparent); }
7
+ evoke-quantity-stepper .evoke-qty__btn:active:not(:disabled) { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 20%, transparent); }
8
+ evoke-quantity-stepper .evoke-qty__btn:focus-visible { outline: 2px solid var(--evoke-secondary, #0b1560); outline-offset: -3px; }
9
+ evoke-quantity-stepper .evoke-qty__btn:disabled { opacity: 0.4; cursor: not-allowed; }
10
+ evoke-quantity-stepper .evoke-qty__btn .evoke-icon { width: 16px; height: 16px; }
11
+ evoke-quantity-stepper .evoke-qty__input { box-sizing: border-box; width: 48px; height: 100%; padding: 0; text-align: center; font: inherit; color: var(--evoke-text, #1a1a1a); background: transparent; border: 0; }
12
+ evoke-quantity-stepper .evoke-qty__input:focus { outline: none; }
13
+ evoke-quantity-stepper .evoke-qty__input:disabled { opacity: 0.5; }
14
+ /* compact */
15
+ evoke-quantity-stepper .evoke-qty--compact { position: relative; display: inline-block; }
16
+ evoke-quantity-stepper .evoke-qty__select { box-sizing: border-box; height: calc(var(--evoke-control-height, 56px) * 0.75); padding: 0 36px 0 16px; font: inherit; font-size: 0.9375rem; color: var(--evoke-text, #1a1a1a); background: var(--evoke-surface, #ffffff); border: 1px solid var(--evoke-border, #dedede); border-radius: var(--evoke-radius-field, 8px); appearance: none; -webkit-appearance: none; cursor: pointer; }
17
+ evoke-quantity-stepper .evoke-qty__select:hover:not(:disabled):not(:focus) { border-color: var(--evoke-text-muted, #6b6b6b); }
18
+ evoke-quantity-stepper .evoke-qty__select:focus { outline: none; border-color: var(--evoke-secondary, #0b1560); box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
19
+ evoke-quantity-stepper .evoke-qty__select:disabled { opacity: 0.5; cursor: not-allowed; }
20
+ evoke-quantity-stepper .evoke-qty__chevron { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--evoke-text-muted, #6b6b6b); pointer-events: none; }
@@ -0,0 +1,201 @@
1
+ import { h } from "@stencil/core";
2
+ import { renderIcon } from "../../utils/icons";
3
+ export class EvokeQuantityStepper {
4
+ constructor() {
5
+ this.value = 1;
6
+ this.min = 1;
7
+ this.max = 99;
8
+ /** Inline (minus, value, plus) or compact with a quantity dropdown */
9
+ this.appearance = 'inline';
10
+ this.disabled = false;
11
+ /** Accessible name for the control */
12
+ this.label = 'Quantity';
13
+ this.onKeyDown = (e) => {
14
+ if (e.key === 'ArrowUp') {
15
+ e.preventDefault();
16
+ this.set(this.value + 1);
17
+ }
18
+ else if (e.key === 'ArrowDown') {
19
+ e.preventDefault();
20
+ this.set(this.value - 1);
21
+ }
22
+ };
23
+ }
24
+ clamp(n) {
25
+ return Math.min(Math.max(Math.round(n), this.min), this.max);
26
+ }
27
+ set(n) {
28
+ const next = this.clamp(Number.isFinite(n) ? n : this.value);
29
+ if (this.inputEl)
30
+ this.inputEl.value = String(next);
31
+ if (next === this.value)
32
+ return;
33
+ this.value = next;
34
+ this.evokeChange.emit(next);
35
+ }
36
+ render() {
37
+ if (this.appearance === 'compact') {
38
+ const top = Math.min(this.max, this.min + 9);
39
+ const opts = [];
40
+ for (let i = this.min; i <= top; i++)
41
+ opts.push(i);
42
+ if (!opts.includes(this.value))
43
+ opts.push(this.value);
44
+ return (h("div", { class: "evoke-qty evoke-qty--compact" }, h("select", { class: "evoke-qty__select", "aria-label": this.label, disabled: this.disabled, onChange: (e) => this.set(Number(e.target.value)) }, opts.map((n) => h("option", { value: String(n), selected: n === this.value }, "Qty: ", n))), renderIcon('chevron-down', 'evoke-qty__chevron')));
45
+ }
46
+ return (h("div", { class: "evoke-qty evoke-qty--inline", role: "group", "aria-label": this.label }, h("button", { type: "button", class: "evoke-qty__btn", "aria-label": "Decrease quantity", disabled: this.disabled || this.value <= this.min, onClick: () => this.set(this.value - 1) }, renderIcon('minus', 'evoke-icon')), h("input", { class: "evoke-qty__input", type: "text", inputmode: "numeric", pattern: "[0-9]*", "aria-label": this.label, value: String(this.value), disabled: this.disabled, ref: (el) => (this.inputEl = el), onKeyDown: this.onKeyDown, onChange: (e) => this.set(parseInt(e.target.value, 10)) }), h("button", { type: "button", class: "evoke-qty__btn", "aria-label": "Increase quantity", disabled: this.disabled || this.value >= this.max, onClick: () => this.set(this.value + 1) }, renderIcon('plus', 'evoke-icon'))));
47
+ }
48
+ static get is() { return "evoke-quantity-stepper"; }
49
+ static get originalStyleUrls() {
50
+ return {
51
+ "$": ["evoke-quantity-stepper.css"]
52
+ };
53
+ }
54
+ static get styleUrls() {
55
+ return {
56
+ "$": ["evoke-quantity-stepper.css"]
57
+ };
58
+ }
59
+ static get properties() {
60
+ return {
61
+ "value": {
62
+ "type": "number",
63
+ "mutable": true,
64
+ "complexType": {
65
+ "original": "number",
66
+ "resolved": "number",
67
+ "references": {}
68
+ },
69
+ "required": false,
70
+ "optional": false,
71
+ "docs": {
72
+ "tags": [],
73
+ "text": ""
74
+ },
75
+ "getter": false,
76
+ "setter": false,
77
+ "reflect": false,
78
+ "attribute": "value",
79
+ "defaultValue": "1"
80
+ },
81
+ "min": {
82
+ "type": "number",
83
+ "mutable": false,
84
+ "complexType": {
85
+ "original": "number",
86
+ "resolved": "number",
87
+ "references": {}
88
+ },
89
+ "required": false,
90
+ "optional": false,
91
+ "docs": {
92
+ "tags": [],
93
+ "text": ""
94
+ },
95
+ "getter": false,
96
+ "setter": false,
97
+ "reflect": false,
98
+ "attribute": "min",
99
+ "defaultValue": "1"
100
+ },
101
+ "max": {
102
+ "type": "number",
103
+ "mutable": false,
104
+ "complexType": {
105
+ "original": "number",
106
+ "resolved": "number",
107
+ "references": {}
108
+ },
109
+ "required": false,
110
+ "optional": false,
111
+ "docs": {
112
+ "tags": [],
113
+ "text": ""
114
+ },
115
+ "getter": false,
116
+ "setter": false,
117
+ "reflect": false,
118
+ "attribute": "max",
119
+ "defaultValue": "99"
120
+ },
121
+ "appearance": {
122
+ "type": "string",
123
+ "mutable": false,
124
+ "complexType": {
125
+ "original": "'inline' | 'compact'",
126
+ "resolved": "\"compact\" | \"inline\"",
127
+ "references": {}
128
+ },
129
+ "required": false,
130
+ "optional": false,
131
+ "docs": {
132
+ "tags": [],
133
+ "text": "Inline (minus, value, plus) or compact with a quantity dropdown"
134
+ },
135
+ "getter": false,
136
+ "setter": false,
137
+ "reflect": false,
138
+ "attribute": "appearance",
139
+ "defaultValue": "'inline'"
140
+ },
141
+ "disabled": {
142
+ "type": "boolean",
143
+ "mutable": false,
144
+ "complexType": {
145
+ "original": "boolean",
146
+ "resolved": "boolean",
147
+ "references": {}
148
+ },
149
+ "required": false,
150
+ "optional": false,
151
+ "docs": {
152
+ "tags": [],
153
+ "text": ""
154
+ },
155
+ "getter": false,
156
+ "setter": false,
157
+ "reflect": false,
158
+ "attribute": "disabled",
159
+ "defaultValue": "false"
160
+ },
161
+ "label": {
162
+ "type": "string",
163
+ "mutable": false,
164
+ "complexType": {
165
+ "original": "string",
166
+ "resolved": "string",
167
+ "references": {}
168
+ },
169
+ "required": false,
170
+ "optional": false,
171
+ "docs": {
172
+ "tags": [],
173
+ "text": "Accessible name for the control"
174
+ },
175
+ "getter": false,
176
+ "setter": false,
177
+ "reflect": false,
178
+ "attribute": "label",
179
+ "defaultValue": "'Quantity'"
180
+ }
181
+ };
182
+ }
183
+ static get events() {
184
+ return [{
185
+ "method": "evokeChange",
186
+ "name": "evokeChange",
187
+ "bubbles": true,
188
+ "cancelable": true,
189
+ "composed": true,
190
+ "docs": {
191
+ "tags": [],
192
+ "text": "Emits the new quantity"
193
+ },
194
+ "complexType": {
195
+ "original": "number",
196
+ "resolved": "number",
197
+ "references": {}
198
+ }
199
+ }];
200
+ }
201
+ }
@@ -8,9 +8,22 @@ evoke-radio-group .evoke-radio__row--disabled { opacity: 0.6; cursor: not-allowe
8
8
  evoke-radio-group .evoke-radio__input {
9
9
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 16px; height: 16px;
10
10
  border: 2px solid var(--evoke-primary, #ff5316); border-radius: 50%; background: var(--evoke-surface, #ffffff);
11
- cursor: inherit; transition: box-shadow 0.15s;
11
+ cursor: inherit; transition: box-shadow 0.15s, filter 0.15s;
12
12
  }
13
+ evoke-radio-group .evoke-radio__input:hover:not(:disabled) { filter: brightness(0.92); }
13
14
  evoke-radio-group .evoke-radio__input:checked { background: radial-gradient(circle, var(--evoke-primary, #ff5316) 0 40%, var(--evoke-surface, #ffffff) 45%); }
14
15
  evoke-radio-group .evoke-radio__input:focus-visible { outline: none; box-shadow: var(--evoke-focus-ring, 0 0 0 3px rgba(11, 21, 96, 0.15)); }
15
16
  evoke-radio-group .evoke-radio__input--error { border-color: var(--evoke-danger, #dc2626); }
16
17
  evoke-radio-group .evoke-radio__error { color: var(--evoke-danger, #dc2626); font-size: 0.875rem; }
18
+ /* segmented */
19
+ evoke-radio-group .evoke-radio__options--segmented { flex-direction: row; gap: 0; align-self: flex-start; border: 1px solid var(--evoke-primary, #ff5316); border-radius: var(--evoke-radius-field, 8px); overflow: hidden; }
20
+ evoke-radio-group .evoke-seg { position: relative; display: inline-flex; cursor: pointer; }
21
+ evoke-radio-group .evoke-seg + .evoke-seg { border-left: 1px solid var(--evoke-primary, #ff5316); }
22
+ evoke-radio-group .evoke-seg--disabled { opacity: 0.5; cursor: not-allowed; }
23
+ evoke-radio-group .evoke-seg__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
24
+ evoke-radio-group .evoke-seg__text { display: inline-flex; align-items: center; justify-content: center; min-height: calc(var(--evoke-control-height, 56px) * 0.75); padding: 0 20px; font-size: 0.875rem; background: var(--evoke-surface, #ffffff); color: var(--evoke-primary-text, #cc3d0d); transition: background-color 0.15s, filter 0.15s; }
25
+ evoke-radio-group .evoke-seg:hover .evoke-seg__input:not(:disabled):not(:checked) + .evoke-seg__text { background: color-mix(in srgb, var(--evoke-primary, #ff5316) 10%, var(--evoke-surface, #ffffff)); }
26
+ evoke-radio-group .evoke-seg__input:checked + .evoke-seg__text { background: var(--evoke-primary, #ff5316); color: var(--evoke-primary-contrast, #ffffff); }
27
+ evoke-radio-group .evoke-seg__input:active:not(:disabled) + .evoke-seg__text { filter: brightness(0.85); }
28
+ evoke-radio-group .evoke-seg__input:focus-visible + .evoke-seg__text { box-shadow: inset 0 0 0 3px var(--evoke-secondary, #0b1560); }
29
+ evoke-radio-group .evoke-seg__input.evoke-radio__input--error + .evoke-seg__text { color: var(--evoke-danger, #dc2626); }
@@ -8,21 +8,27 @@ export class EvokeRadioGroup {
8
8
  this.value = '';
9
9
  this.name = '';
10
10
  this.disabled = false;
11
- /** Lay options out in a row instead of a column */
11
+ /** Classic radio circles, or a segmented button group */
12
+ this.appearance = 'classic';
13
+ /** Lay classic options out in a row instead of a column */
12
14
  this.inline = false;
13
15
  /** Error message shown below the group */
14
16
  this.error = '';
15
- this.groupName = `evoke-radio-${Math.random().toString(36).slice(2, 9)}`;
17
+ this.uid = Math.random().toString(36).slice(2, 9);
16
18
  }
17
19
  render() {
18
- const name = this.name || this.groupName;
19
- return (h("div", { key: 'f90c5bee5d2eff847373e075c32689be55ded5b7', class: "evoke-radio", role: "radiogroup", "aria-label": this.label || undefined }, this.label && h("span", { key: '1fbc7f744f3ec03637afce04a0dba2ee7beeec37', class: "evoke-radio__label" }, this.label), h("div", { key: 'cec0e44939dbca02e5623ce9b49c5c074f7c6fa7', class: `evoke-radio__options ${this.inline ? 'evoke-radio__options--inline' : ''}` }, parseOptions(this.options).map((o) => {
20
+ const name = this.name || `evoke-radio-${this.uid}`;
21
+ const labelId = `${name}-label`;
22
+ const errId = `${name}-err`;
23
+ const segmented = this.appearance === 'segmented';
24
+ return (h("div", { key: 'ddf9183b0a6733b0daf79dcdb5f7dd5525d00a62', class: "evoke-radio", role: "radiogroup", "aria-labelledby": this.label ? labelId : undefined, "aria-describedby": this.error ? errId : undefined }, this.label && h("span", { key: 'f80aacb295bedb5d68a51e1005de17d8d845736e', id: labelId, class: "evoke-radio__label" }, this.label), h("div", { key: '44ee0b00ad1970f2b00dcb2789f1418f76833fcd', class: `evoke-radio__options ${this.inline && !segmented ? 'evoke-radio__options--inline' : ''} ${segmented ? 'evoke-radio__options--segmented' : ''}`.replace(/\s+/g, ' ').trim() }, parseOptions(this.options).map((o) => {
20
25
  const off = this.disabled || o.disabled;
21
- return (h("label", { class: `evoke-radio__row ${off ? 'evoke-radio__row--disabled' : ''}` }, h("input", { type: "radio", class: `evoke-radio__input ${this.error ? 'evoke-radio__input--error' : ''}`.trim(), name: name, value: o.value, checked: o.value === this.value, disabled: off, onChange: () => {
26
+ const input = (h("input", { type: "radio", class: `${segmented ? 'evoke-seg__input' : 'evoke-radio__input'} ${this.error ? 'evoke-radio__input--error' : ''}`.trim(), name: name, value: o.value, checked: o.value === this.value, disabled: off, onChange: () => {
22
27
  this.value = o.value;
23
28
  this.evokeChange.emit(this.value);
24
- } }), h("span", null, o.label)));
25
- })), this.error && h("span", { key: 'd19f6043ee840711e62a6feb577a3f44dbed48be', class: "evoke-radio__error", role: "alert" }, this.error)));
29
+ } }));
30
+ return segmented ? (h("label", { class: `evoke-seg ${off ? 'evoke-seg--disabled' : ''}`.trim() }, input, h("span", { class: "evoke-seg__text" }, o.label))) : (h("label", { class: `evoke-radio__row ${off ? 'evoke-radio__row--disabled' : ''}`.trim() }, input, h("span", null, o.label)));
31
+ })), this.error && h("span", { key: 'b6027efeea9334325c731eb73630c982c1a88ce2', id: errId, class: "evoke-radio__error", role: "alert" }, this.error)));
26
32
  }
27
33
  static get is() { return "evoke-radio-group"; }
28
34
  static get originalStyleUrls() {
@@ -144,6 +150,26 @@ export class EvokeRadioGroup {
144
150
  "attribute": "disabled",
145
151
  "defaultValue": "false"
146
152
  },
153
+ "appearance": {
154
+ "type": "string",
155
+ "mutable": false,
156
+ "complexType": {
157
+ "original": "'classic' | 'segmented'",
158
+ "resolved": "\"classic\" | \"segmented\"",
159
+ "references": {}
160
+ },
161
+ "required": false,
162
+ "optional": false,
163
+ "docs": {
164
+ "tags": [],
165
+ "text": "Classic radio circles, or a segmented button group"
166
+ },
167
+ "getter": false,
168
+ "setter": false,
169
+ "reflect": false,
170
+ "attribute": "appearance",
171
+ "defaultValue": "'classic'"
172
+ },
147
173
  "inline": {
148
174
  "type": "boolean",
149
175
  "mutable": false,
@@ -156,7 +182,7 @@ export class EvokeRadioGroup {
156
182
  "optional": false,
157
183
  "docs": {
158
184
  "tags": [],
159
- "text": "Lay options out in a row instead of a column"
185
+ "text": "Lay classic options out in a row instead of a column"
160
186
  },
161
187
  "getter": false,
162
188
  "setter": false,