@erplora/outfitkit 0.1.1

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 (210) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +457 -0
  3. package/dist/base/anchor.d.ts +13 -0
  4. package/dist/base/define.d.ts +1 -0
  5. package/dist/base/relay.d.ts +1 -0
  6. package/dist/cdn.d.ts +96 -0
  7. package/dist/components/ok-app-launcher/ok-app-launcher.d.ts +57 -0
  8. package/dist/components/ok-audio/ok-audio.d.ts +45 -0
  9. package/dist/components/ok-avatar/ok-avatar.d.ts +36 -0
  10. package/dist/components/ok-avatar-group/ok-avatar-group.d.ts +38 -0
  11. package/dist/components/ok-bar-list/ok-bar-list.d.ts +36 -0
  12. package/dist/components/ok-bento/ok-bento.d.ts +17 -0
  13. package/dist/components/ok-bento-item/ok-bento-item.d.ts +34 -0
  14. package/dist/components/ok-calculator/ok-calculator.d.ts +46 -0
  15. package/dist/components/ok-calendar/ok-calendar.d.ts +63 -0
  16. package/dist/components/ok-carousel/ok-carousel.d.ts +48 -0
  17. package/dist/components/ok-chart/ok-chart.d.ts +55 -0
  18. package/dist/components/ok-chat/ok-chat.d.ts +54 -0
  19. package/dist/components/ok-coachmark/ok-coachmark.d.ts +69 -0
  20. package/dist/components/ok-code/ok-code.d.ts +28 -0
  21. package/dist/components/ok-color-picker/ok-color-picker.d.ts +63 -0
  22. package/dist/components/ok-combo/ok-combo.d.ts +46 -0
  23. package/dist/components/ok-command-palette/ok-command-palette.d.ts +72 -0
  24. package/dist/components/ok-contact-form/ok-contact-form.d.ts +54 -0
  25. package/dist/components/ok-cropper/ok-cropper.d.ts +60 -0
  26. package/dist/components/ok-cta-band/ok-cta-band.d.ts +18 -0
  27. package/dist/components/ok-currency/ok-currency.d.ts +31 -0
  28. package/dist/components/ok-data-table/ok-data-table.d.ts +312 -0
  29. package/dist/components/ok-date-picker/ok-date-picker.d.ts +81 -0
  30. package/dist/components/ok-detail-list/ok-detail-list.d.ts +30 -0
  31. package/dist/components/ok-diff/ok-diff.d.ts +38 -0
  32. package/dist/components/ok-donut/ok-donut.d.ts +38 -0
  33. package/dist/components/ok-drawer/ok-drawer.d.ts +56 -0
  34. package/dist/components/ok-dropzone/ok-dropzone.d.ts +48 -0
  35. package/dist/components/ok-empty-state/ok-empty-state.d.ts +16 -0
  36. package/dist/components/ok-error-page/ok-error-page.d.ts +77 -0
  37. package/dist/components/ok-event-card/ok-event-card.d.ts +56 -0
  38. package/dist/components/ok-feature-card/ok-feature-card.d.ts +23 -0
  39. package/dist/components/ok-file-item/ok-file-item.d.ts +31 -0
  40. package/dist/components/ok-file-manager/ok-file-manager.d.ts +145 -0
  41. package/dist/components/ok-footer/ok-footer.d.ts +10 -0
  42. package/dist/components/ok-funnel/ok-funnel.d.ts +31 -0
  43. package/dist/components/ok-gallery/ok-gallery.d.ts +34 -0
  44. package/dist/components/ok-gauge/ok-gauge.d.ts +49 -0
  45. package/dist/components/ok-heatmap/ok-heatmap.d.ts +45 -0
  46. package/dist/components/ok-hero/ok-hero.d.ts +10 -0
  47. package/dist/components/ok-hover-card/ok-hover-card.d.ts +76 -0
  48. package/dist/components/ok-icon-tile/ok-icon-tile.d.ts +24 -0
  49. package/dist/components/ok-image/ok-image.d.ts +56 -0
  50. package/dist/components/ok-inline-feedback/ok-inline-feedback.d.ts +33 -0
  51. package/dist/components/ok-invoice/ok-invoice.d.ts +137 -0
  52. package/dist/components/ok-json-viewer/ok-json-viewer.d.ts +31 -0
  53. package/dist/components/ok-kanban/ok-kanban.d.ts +56 -0
  54. package/dist/components/ok-kbd/ok-kbd.d.ts +21 -0
  55. package/dist/components/ok-keyboard/ok-keyboard.d.ts +35 -0
  56. package/dist/components/ok-kpi/ok-kpi.d.ts +24 -0
  57. package/dist/components/ok-language-select/ok-language-select.d.ts +31 -0
  58. package/dist/components/ok-lightbox/ok-lightbox.d.ts +59 -0
  59. package/dist/components/ok-logo-cloud/ok-logo-cloud.d.ts +14 -0
  60. package/dist/components/ok-loyalty-card/ok-loyalty-card.d.ts +35 -0
  61. package/dist/components/ok-mail/ok-mail.d.ts +117 -0
  62. package/dist/components/ok-menu/ok-menu.d.ts +75 -0
  63. package/dist/components/ok-menubar/ok-menubar.d.ts +75 -0
  64. package/dist/components/ok-navbar/ok-navbar.d.ts +42 -0
  65. package/dist/components/ok-notification-center/ok-notification-center.d.ts +79 -0
  66. package/dist/components/ok-org-chart/ok-org-chart.d.ts +67 -0
  67. package/dist/components/ok-otp/ok-otp.d.ts +31 -0
  68. package/dist/components/ok-page-header/ok-page-header.d.ts +23 -0
  69. package/dist/components/ok-pagination/ok-pagination.d.ts +44 -0
  70. package/dist/components/ok-pdf/ok-pdf.d.ts +32 -0
  71. package/dist/components/ok-phone/ok-phone.d.ts +48 -0
  72. package/dist/components/ok-pinpad/ok-pinpad.d.ts +29 -0
  73. package/dist/components/ok-pricing-card/ok-pricing-card.d.ts +31 -0
  74. package/dist/components/ok-product-card/ok-product-card.d.ts +25 -0
  75. package/dist/components/ok-qr/ok-qr.d.ts +24 -0
  76. package/dist/components/ok-qty-stepper/ok-qty-stepper.d.ts +35 -0
  77. package/dist/components/ok-range-dual/ok-range-dual.d.ts +38 -0
  78. package/dist/components/ok-rating/ok-rating.d.ts +33 -0
  79. package/dist/components/ok-receipt/ok-receipt.d.ts +103 -0
  80. package/dist/components/ok-reveal/ok-reveal.d.ts +21 -0
  81. package/dist/components/ok-rich-text/ok-rich-text.d.ts +46 -0
  82. package/dist/components/ok-scheduler/ok-scheduler.d.ts +74 -0
  83. package/dist/components/ok-select-card/ok-select-card.d.ts +37 -0
  84. package/dist/components/ok-signature/ok-signature.d.ts +55 -0
  85. package/dist/components/ok-skeleton/ok-skeleton.d.ts +40 -0
  86. package/dist/components/ok-sparkline/ok-sparkline.d.ts +27 -0
  87. package/dist/components/ok-split-button/ok-split-button.d.ts +49 -0
  88. package/dist/components/ok-splitter/ok-splitter.d.ts +36 -0
  89. package/dist/components/ok-stat/ok-stat.d.ts +16 -0
  90. package/dist/components/ok-status-dot/ok-status-dot.d.ts +24 -0
  91. package/dist/components/ok-status-pill/ok-status-pill.d.ts +22 -0
  92. package/dist/components/ok-stepper/ok-stepper.d.ts +33 -0
  93. package/dist/components/ok-store/ok-store.d.ts +33 -0
  94. package/dist/components/ok-tag-input/ok-tag-input.d.ts +39 -0
  95. package/dist/components/ok-testimonial/ok-testimonial.d.ts +21 -0
  96. package/dist/components/ok-time-picker/ok-time-picker.d.ts +50 -0
  97. package/dist/components/ok-timeline/ok-timeline.d.ts +33 -0
  98. package/dist/components/ok-tree/ok-tree.d.ts +46 -0
  99. package/dist/components/ok-video/ok-video.d.ts +49 -0
  100. package/dist/components/ok-widget-board/ok-widget-board.d.ts +71 -0
  101. package/dist/components/ok-wizard/ok-wizard.d.ts +30 -0
  102. package/dist/define.js +8 -0
  103. package/dist/erplora.css +112 -0
  104. package/dist/index.d.ts +158 -0
  105. package/dist/index.js +197 -0
  106. package/dist/layout.css +338 -0
  107. package/dist/ok-app-launcher.js +396 -0
  108. package/dist/ok-audio.js +308 -0
  109. package/dist/ok-avatar-group.js +158 -0
  110. package/dist/ok-avatar.js +179 -0
  111. package/dist/ok-bar-list.js +189 -0
  112. package/dist/ok-bento-item.js +168 -0
  113. package/dist/ok-bento.js +63 -0
  114. package/dist/ok-calculator.js +406 -0
  115. package/dist/ok-calendar.js +541 -0
  116. package/dist/ok-carousel.js +352 -0
  117. package/dist/ok-chart.js +325 -0
  118. package/dist/ok-chat.js +320 -0
  119. package/dist/ok-coachmark.js +500 -0
  120. package/dist/ok-code.js +190 -0
  121. package/dist/ok-color-picker.js +569 -0
  122. package/dist/ok-combo.js +294 -0
  123. package/dist/ok-command-palette.js +448 -0
  124. package/dist/ok-contact-form.js +288 -0
  125. package/dist/ok-cropper.js +404 -0
  126. package/dist/ok-cta-band.js +134 -0
  127. package/dist/ok-currency.js +172 -0
  128. package/dist/ok-data-table.js +1281 -0
  129. package/dist/ok-date-picker.js +736 -0
  130. package/dist/ok-detail-list.js +156 -0
  131. package/dist/ok-diff.js +200 -0
  132. package/dist/ok-donut.js +280 -0
  133. package/dist/ok-drawer.js +357 -0
  134. package/dist/ok-dropzone.js +376 -0
  135. package/dist/ok-empty-state.js +104 -0
  136. package/dist/ok-error-page.js +547 -0
  137. package/dist/ok-event-card.js +384 -0
  138. package/dist/ok-feature-card.js +152 -0
  139. package/dist/ok-file-item.js +259 -0
  140. package/dist/ok-file-manager.js +1116 -0
  141. package/dist/ok-footer.js +67 -0
  142. package/dist/ok-funnel.js +181 -0
  143. package/dist/ok-gallery.js +293 -0
  144. package/dist/ok-gauge.js +385 -0
  145. package/dist/ok-heatmap.js +268 -0
  146. package/dist/ok-hero.js +43 -0
  147. package/dist/ok-hover-card.js +480 -0
  148. package/dist/ok-icon-tile.js +123 -0
  149. package/dist/ok-image.js +471 -0
  150. package/dist/ok-inline-feedback.js +221 -0
  151. package/dist/ok-invoice.js +229 -0
  152. package/dist/ok-json-viewer.js +330 -0
  153. package/dist/ok-kanban.js +427 -0
  154. package/dist/ok-kbd.js +159 -0
  155. package/dist/ok-keyboard.js +402 -0
  156. package/dist/ok-kpi.js +147 -0
  157. package/dist/ok-language-select.js +188 -0
  158. package/dist/ok-lightbox.js +490 -0
  159. package/dist/ok-logo-cloud.js +92 -0
  160. package/dist/ok-loyalty-card.js +353 -0
  161. package/dist/ok-mail.js +562 -0
  162. package/dist/ok-menu.js +529 -0
  163. package/dist/ok-menubar.js +628 -0
  164. package/dist/ok-navbar.js +306 -0
  165. package/dist/ok-notification-center.js +545 -0
  166. package/dist/ok-org-chart.js +619 -0
  167. package/dist/ok-otp.js +199 -0
  168. package/dist/ok-page-header.js +202 -0
  169. package/dist/ok-pagination.js +366 -0
  170. package/dist/ok-pdf.js +160 -0
  171. package/dist/ok-phone.js +225 -0
  172. package/dist/ok-pinpad.js +171 -0
  173. package/dist/ok-pricing-card.js +184 -0
  174. package/dist/ok-product-card.js +178 -0
  175. package/dist/ok-qr.js +652 -0
  176. package/dist/ok-qty-stepper.js +212 -0
  177. package/dist/ok-range-dual.js +280 -0
  178. package/dist/ok-rating.js +199 -0
  179. package/dist/ok-receipt.js +183 -0
  180. package/dist/ok-reveal.js +94 -0
  181. package/dist/ok-rich-text.js +538 -0
  182. package/dist/ok-scheduler.js +518 -0
  183. package/dist/ok-select-card.js +231 -0
  184. package/dist/ok-signature.js +267 -0
  185. package/dist/ok-skeleton.js +345 -0
  186. package/dist/ok-sparkline.js +150 -0
  187. package/dist/ok-split-button.js +251 -0
  188. package/dist/ok-splitter.js +289 -0
  189. package/dist/ok-stat.js +77 -0
  190. package/dist/ok-status-dot.js +163 -0
  191. package/dist/ok-status-pill.js +123 -0
  192. package/dist/ok-stepper.js +299 -0
  193. package/dist/ok-store.js +83 -0
  194. package/dist/ok-tag-input.js +358 -0
  195. package/dist/ok-testimonial.js +136 -0
  196. package/dist/ok-time-picker.js +472 -0
  197. package/dist/ok-timeline.js +251 -0
  198. package/dist/ok-tree.js +266 -0
  199. package/dist/ok-video.js +362 -0
  200. package/dist/ok-widget-board.js +265 -0
  201. package/dist/ok-wizard.js +153 -0
  202. package/dist/outfitkit.js +96 -0
  203. package/dist/shared/anchor.js +14 -0
  204. package/dist/store/controller.d.ts +17 -0
  205. package/dist/store/idb.d.ts +16 -0
  206. package/dist/store/store.d.ts +39 -0
  207. package/dist/store-controller.js +31 -0
  208. package/dist/store.js +182 -0
  209. package/dist/theme.example.css +70 -0
  210. package/package.json +147 -0
@@ -0,0 +1,358 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { property, state } from "lit/decorators.js";
3
+ import { define } from "./define.js";
4
+ var __defProp = Object.defineProperty;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = void 0;
7
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8
+ if (decorator = decorators[i])
9
+ result = decorator(target, key, result) || result;
10
+ if (result) __defProp(target, key, result);
11
+ return result;
12
+ };
13
+ const DEFAULT_LABELS = {
14
+ placeholder: "Add tag…",
15
+ removeLabel: "Remove {tag}"
16
+ };
17
+ class OkTagInput extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.value = [];
21
+ this.placeholder = "";
22
+ this.labels = {};
23
+ this.draft = "";
24
+ this.open = false;
25
+ this.activeIndex = -1;
26
+ this.onDocClick = (e) => {
27
+ if (!this.open) return;
28
+ if (!e.composedPath().includes(this)) this.close();
29
+ };
30
+ }
31
+ static {
32
+ this.styles = css`
33
+ :host {
34
+ /* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
35
+ --color: var(--ok-text, var(--ion-text-color, #1c1b17));
36
+ --color-muted: var(--ok-text-muted, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.55));
37
+ --primary-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
38
+ --primary-contrast: var(--ok-primary-contrast, var(--ion-color-primary-contrast, #ffffff));
39
+ --background: var(--ok-surface, var(--ion-background-color, #ffffff));
40
+ --chip-bg: var(--ok-chip-bg, rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.14));
41
+ --chip-color: var(--ok-chip-color, var(--ion-color-primary, #3880ff));
42
+ --hover-bg: var(--ok-hover, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.06));
43
+ --border-color: var(--ok-border, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.18));
44
+ --border-radius: var(--ok-radius, 8px);
45
+ --font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
46
+ --shadow: var(--ok-shadow, 0 6px 24px rgba(0, 0, 0, 0.14));
47
+
48
+ /* Por defecto ocupa el ancho del contenedor y es responsive. */
49
+ display: block;
50
+ width: 100%;
51
+ max-width: 100%;
52
+ position: relative;
53
+ color: var(--color);
54
+ font-family: var(--font);
55
+ font-size: 0.95rem;
56
+ }
57
+ /* Caja contenedora: chips + campo de texto, con wrap responsive. */
58
+ .box {
59
+ display: flex;
60
+ flex-wrap: wrap;
61
+ align-items: center;
62
+ gap: 0.4rem;
63
+ width: 100%;
64
+ box-sizing: border-box;
65
+ min-height: 2.6rem;
66
+ padding: 0.35rem 0.5rem;
67
+ background: var(--background);
68
+ border: 1px solid var(--border-color);
69
+ border-radius: var(--border-radius);
70
+ cursor: text;
71
+ }
72
+ .box:focus-within {
73
+ border-color: var(--primary-color);
74
+ }
75
+ /* Chip propio (no ion-chip). */
76
+ .chip {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ gap: 0.3rem;
80
+ max-width: 100%;
81
+ padding: 0.2rem 0.2rem 0.2rem 0.55rem;
82
+ background: var(--chip-bg);
83
+ color: var(--chip-color);
84
+ border-radius: 999px;
85
+ font-size: 0.85rem;
86
+ line-height: 1.2;
87
+ transition: background-color var(--ok-transition, 150ms ease),
88
+ color var(--ok-transition, 150ms ease),
89
+ border-color var(--ok-transition, 150ms ease),
90
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
91
+ }
92
+ .chip .text {
93
+ overflow: hidden;
94
+ text-overflow: ellipsis;
95
+ white-space: nowrap;
96
+ }
97
+ .chip .remove {
98
+ display: inline-flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ width: 1.15rem;
102
+ height: 1.15rem;
103
+ padding: 0;
104
+ border: 0;
105
+ border-radius: 999px;
106
+ background: none;
107
+ color: inherit;
108
+ cursor: pointer;
109
+ opacity: 0.7;
110
+ transition: background-color var(--ok-transition, 150ms ease),
111
+ color var(--ok-transition, 150ms ease),
112
+ border-color var(--ok-transition, 150ms ease),
113
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease,
114
+ opacity var(--ok-transition, 150ms ease);
115
+ }
116
+ @media (hover: hover) {
117
+ .chip .remove:hover {
118
+ opacity: 1;
119
+ background: rgba(0, 0, 0, 0.08);
120
+ }
121
+ }
122
+ .chip .remove:active {
123
+ transform: scale(var(--ok-press-scale, 0.97));
124
+ }
125
+ @media (prefers-reduced-motion: reduce) {
126
+ .chip:active,
127
+ .chip .remove:hover,
128
+ .chip .remove:active {
129
+ transform: none;
130
+ }
131
+ }
132
+ .chip .remove ion-icon {
133
+ font-size: 0.9rem;
134
+ }
135
+ /* El campo de texto crece para ocupar el resto de la fila. */
136
+ ion-input {
137
+ --background: transparent;
138
+ --color: var(--color);
139
+ --placeholder-color: var(--color-muted);
140
+ --padding-start: 0.15rem;
141
+ --padding-end: 0.15rem;
142
+ flex: 1 1 6rem;
143
+ min-width: 6rem;
144
+ }
145
+ /* Dropdown de sugerencias, ancho del contenedor. */
146
+ .dropdown {
147
+ position: absolute;
148
+ left: 0;
149
+ right: 0;
150
+ top: calc(100% + 4px);
151
+ z-index: 50;
152
+ max-height: 14rem;
153
+ overflow-y: auto;
154
+ margin: 0;
155
+ padding: 0.25rem;
156
+ list-style: none;
157
+ background: var(--background);
158
+ border: 1px solid var(--border-color);
159
+ border-radius: var(--border-radius);
160
+ box-shadow: var(--shadow);
161
+ box-sizing: border-box;
162
+ }
163
+ .suggestion {
164
+ display: block;
165
+ width: 100%;
166
+ box-sizing: border-box;
167
+ padding: 0.5rem 0.6rem;
168
+ border-radius: calc(var(--border-radius) - 2px);
169
+ cursor: pointer;
170
+ overflow: hidden;
171
+ text-overflow: ellipsis;
172
+ white-space: nowrap;
173
+ transition: background 0.12s ease, color 0.12s ease;
174
+ }
175
+ .suggestion:hover,
176
+ .suggestion.active {
177
+ background: var(--primary-color);
178
+ color: var(--primary-contrast);
179
+ }
180
+ `;
181
+ }
182
+ // Textos efectivos: defaults inglés sobreescritos por los pasados desde fuera.
183
+ get t() {
184
+ return { ...DEFAULT_LABELS, ...this.labels };
185
+ }
186
+ // Placeholder efectivo: prop explícita si se pasó, si no el de los labels.
187
+ get effectivePlaceholder() {
188
+ return this.placeholder || this.t.placeholder;
189
+ }
190
+ connectedCallback() {
191
+ super.connectedCallback();
192
+ document.addEventListener("click", this.onDocClick, true);
193
+ }
194
+ disconnectedCallback() {
195
+ document.removeEventListener("click", this.onDocClick, true);
196
+ super.disconnectedCallback();
197
+ }
198
+ close() {
199
+ this.open = false;
200
+ this.activeIndex = -1;
201
+ }
202
+ // Sugerencias filtradas: casan con el draft y no están ya añadidas.
203
+ get filteredSuggestions() {
204
+ if (!this.suggestions?.length) return [];
205
+ const q = this.draft.trim().toLowerCase();
206
+ return this.suggestions.filter(
207
+ (s) => !this.value.includes(s) && (!q || s.toLowerCase().includes(q))
208
+ );
209
+ }
210
+ // Emite `ok-change` con la lista de tags actual.
211
+ emitChange() {
212
+ this.dispatchEvent(
213
+ new CustomEvent("ok-change", {
214
+ detail: { tags: [...this.value] },
215
+ bubbles: true,
216
+ composed: true
217
+ })
218
+ );
219
+ }
220
+ // Añade un tag (recortado, sin duplicados ni vacíos) y emite cambio.
221
+ addTag(raw) {
222
+ const tag = raw.trim();
223
+ if (!tag || this.value.includes(tag)) {
224
+ this.draft = "";
225
+ return;
226
+ }
227
+ this.value = [...this.value, tag];
228
+ this.draft = "";
229
+ this.close();
230
+ this.emitChange();
231
+ }
232
+ // Quita el tag en el índice indicado y emite cambio.
233
+ removeAt(index) {
234
+ this.value = this.value.filter((_, i) => i !== index);
235
+ this.emitChange();
236
+ }
237
+ handleInput(e) {
238
+ const detail = e.detail;
239
+ this.draft = detail?.value ?? "";
240
+ this.open = !!this.filteredSuggestions.length;
241
+ this.activeIndex = -1;
242
+ }
243
+ handleKeydown(e) {
244
+ const sugg = this.filteredSuggestions;
245
+ switch (e.key) {
246
+ case "Enter":
247
+ e.preventDefault();
248
+ if (this.open && this.activeIndex >= 0 && sugg[this.activeIndex]) {
249
+ this.addTag(sugg[this.activeIndex]);
250
+ } else if (this.draft.trim()) {
251
+ this.addTag(this.draft);
252
+ }
253
+ break;
254
+ case ",":
255
+ e.preventDefault();
256
+ if (this.draft.trim()) this.addTag(this.draft);
257
+ break;
258
+ case "Backspace":
259
+ if (!this.draft && this.value.length) {
260
+ e.preventDefault();
261
+ this.removeAt(this.value.length - 1);
262
+ }
263
+ break;
264
+ case "ArrowDown":
265
+ if (sugg.length) {
266
+ e.preventDefault();
267
+ this.open = true;
268
+ this.activeIndex = (this.activeIndex + 1) % sugg.length;
269
+ }
270
+ break;
271
+ case "ArrowUp":
272
+ if (sugg.length) {
273
+ e.preventDefault();
274
+ this.open = true;
275
+ this.activeIndex = (this.activeIndex - 1 + sugg.length) % sugg.length;
276
+ }
277
+ break;
278
+ case "Escape":
279
+ if (this.open) {
280
+ e.preventDefault();
281
+ this.close();
282
+ }
283
+ break;
284
+ }
285
+ }
286
+ render() {
287
+ const sugg = this.filteredSuggestions;
288
+ return html`<div
289
+ class="box"
290
+ @click=${(e) => {
291
+ const input = this.renderRoot.querySelector("ion-input");
292
+ if (e.target === e.currentTarget) input?.setFocus?.();
293
+ }}
294
+ >
295
+ ${this.value.map(
296
+ (tag, i) => html`<span class="chip">
297
+ <span class="text">${tag}</span>
298
+ <button
299
+ type="button"
300
+ class="remove"
301
+ aria-label=${this.t.removeLabel.replace("{tag}", tag)}
302
+ @click=${(e) => {
303
+ e.stopPropagation();
304
+ this.removeAt(i);
305
+ }}
306
+ >
307
+ <ion-icon name="close-outline"></ion-icon>
308
+ </button>
309
+ </span>`
310
+ )}
311
+ <ion-input
312
+ .value=${this.draft}
313
+ placeholder=${this.value.length ? "" : this.effectivePlaceholder}
314
+ @ionInput=${(e) => this.handleInput(e)}
315
+ @keydown=${(e) => this.handleKeydown(e)}
316
+ ></ion-input>
317
+ </div>
318
+ ${this.open && sugg.length ? html`<ul class="dropdown" role="listbox">
319
+ ${sugg.map(
320
+ (s, i) => html`<li
321
+ role="option"
322
+ class=${`suggestion ${i === this.activeIndex ? "active" : ""}`.trim()}
323
+ @mouseenter=${() => {
324
+ this.activeIndex = i;
325
+ }}
326
+ @click=${() => this.addTag(s)}
327
+ >
328
+ ${s}
329
+ </li>`
330
+ )}
331
+ </ul>` : ""}`;
332
+ }
333
+ }
334
+ __decorateClass([
335
+ property({ attribute: false })
336
+ ], OkTagInput.prototype, "value");
337
+ __decorateClass([
338
+ property()
339
+ ], OkTagInput.prototype, "placeholder");
340
+ __decorateClass([
341
+ property({ attribute: false })
342
+ ], OkTagInput.prototype, "suggestions");
343
+ __decorateClass([
344
+ property({ attribute: false })
345
+ ], OkTagInput.prototype, "labels");
346
+ __decorateClass([
347
+ state()
348
+ ], OkTagInput.prototype, "draft");
349
+ __decorateClass([
350
+ state()
351
+ ], OkTagInput.prototype, "open");
352
+ __decorateClass([
353
+ state()
354
+ ], OkTagInput.prototype, "activeIndex");
355
+ define("ok-tag-input", OkTagInput);
356
+ export {
357
+ OkTagInput
358
+ };
@@ -0,0 +1,136 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { define } from "./define.js";
4
+ var __defProp = Object.defineProperty;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = void 0;
7
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8
+ if (decorator = decorators[i])
9
+ result = decorator(target, key, result) || result;
10
+ if (result) __defProp(target, key, result);
11
+ return result;
12
+ };
13
+ class OkTestimonial extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.rating = 0;
17
+ this.glass = false;
18
+ }
19
+ static {
20
+ this.styles = css`
21
+ :host {
22
+ display: block;
23
+ width: 100%;
24
+ height: 100%;
25
+ --color: var(--ok-text, var(--ion-text-color, #18181b));
26
+ --muted: var(--ok-muted, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.62));
27
+ --surface: var(--ok-surface, var(--ion-card-background, var(--ion-background-color, #fff)));
28
+ --border: var(--ok-border, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.1));
29
+ --radius: var(--ok-radius, 18px);
30
+ --star: var(--ion-color-warning, #ffc409);
31
+ --primary: var(--ion-color-primary, #1496d6);
32
+ font-family: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
33
+ }
34
+ .card {
35
+ box-sizing: border-box;
36
+ height: 100%;
37
+ display: flex;
38
+ flex-direction: column;
39
+ gap: 1rem;
40
+ padding: clamp(1.4rem, 2.5vw, 2rem);
41
+ color: var(--color);
42
+ background: var(--surface);
43
+ border: 1px solid var(--border);
44
+ border-radius: var(--radius);
45
+ position: relative;
46
+ }
47
+ :host([glass]) .card {
48
+ background: color-mix(in oklab, var(--surface) 62%, transparent);
49
+ -webkit-backdrop-filter: blur(14px) saturate(1.4);
50
+ backdrop-filter: blur(14px) saturate(1.4);
51
+ border-color: color-mix(in oklab, var(--color) 12%, transparent);
52
+ }
53
+ .quote-mark {
54
+ font-family: Georgia, 'Times New Roman', serif;
55
+ font-size: 3rem;
56
+ line-height: 0.6;
57
+ color: color-mix(in oklab, var(--primary) 35%, transparent);
58
+ height: 1.2rem;
59
+ }
60
+ .stars {
61
+ display: inline-flex;
62
+ gap: 0.1rem;
63
+ color: var(--star);
64
+ font-size: 0.95rem;
65
+ }
66
+ .quote {
67
+ flex: 1;
68
+ font-size: clamp(1rem, 0.95rem + 0.35vw, 1.2rem);
69
+ line-height: 1.55;
70
+ letter-spacing: -0.01em;
71
+ }
72
+ ::slotted(*) { margin: 0; }
73
+ .author {
74
+ display: flex;
75
+ align-items: center;
76
+ gap: 0.75rem;
77
+ margin-top: auto;
78
+ }
79
+ .avatar {
80
+ width: 2.5rem;
81
+ height: 2.5rem;
82
+ border-radius: 999px;
83
+ object-fit: cover;
84
+ flex: 0 0 auto;
85
+ background: color-mix(in oklab, var(--primary) 16%, transparent);
86
+ display: grid;
87
+ place-items: center;
88
+ color: var(--primary);
89
+ font-weight: 700;
90
+ font-size: 0.9rem;
91
+ }
92
+ .meta { min-width: 0; }
93
+ .name { font-weight: 650; font-size: 0.95rem; }
94
+ .role { color: var(--muted); font-size: 0.82rem; }
95
+ `;
96
+ }
97
+ initials() {
98
+ if (!this.author) return "";
99
+ return this.author.split(/\s+/).slice(0, 2).map((w) => w[0] ?? "").join("").toUpperCase();
100
+ }
101
+ render() {
102
+ const r = Math.max(0, Math.min(5, Math.round(this.rating)));
103
+ return html`
104
+ <div class="card">
105
+ ${r ? html`<span class="stars" aria-label="${r} de 5">${"★".repeat(r)}</span>` : html`<span class="quote-mark">”</span>`}
106
+ <div class="quote"><slot></slot></div>
107
+ <div class="author">
108
+ ${this.avatar ? html`<img class="avatar" src=${this.avatar} alt=${this.author ?? ""} />` : html`<span class="avatar">${this.initials()}</span>`}
109
+ <div class="meta">
110
+ ${this.author ? html`<div class="name">${this.author}</div>` : null}
111
+ ${this.authorRole ? html`<div class="role">${this.authorRole}</div>` : null}
112
+ </div>
113
+ </div>
114
+ </div>
115
+ `;
116
+ }
117
+ }
118
+ __decorateClass([
119
+ property({ type: Number })
120
+ ], OkTestimonial.prototype, "rating");
121
+ __decorateClass([
122
+ property()
123
+ ], OkTestimonial.prototype, "author");
124
+ __decorateClass([
125
+ property({ attribute: "author-role" })
126
+ ], OkTestimonial.prototype, "authorRole");
127
+ __decorateClass([
128
+ property()
129
+ ], OkTestimonial.prototype, "avatar");
130
+ __decorateClass([
131
+ property({ type: Boolean, reflect: true })
132
+ ], OkTestimonial.prototype, "glass");
133
+ define("ok-testimonial", OkTestimonial);
134
+ export {
135
+ OkTestimonial
136
+ };