@forgeroute/ui 0.5.35 → 0.5.36
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/fesm2022/forgeroute-ui-conversations.mjs +1 -0
- package/fesm2022/forgeroute-ui-conversations.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-data-table-core.mjs +19 -0
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-editor.mjs +7 -2
- package/fesm2022/forgeroute-ui-editor.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-search-input.mjs +23 -3
- package/fesm2022/forgeroute-ui-search-input.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-core.d.ts +4 -4
- package/types/forgeroute-ui-data-table-core.d.ts +7 -0
- package/types/forgeroute-ui-editor.d.ts +2 -0
- package/types/forgeroute-ui-search-input.d.ts +10 -0
|
@@ -15,6 +15,7 @@ var SearchInputComponent = class SearchInputComponent {
|
|
|
15
15
|
this.placeholder = input(null, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
16
16
|
this.effectivePlaceholder = computed(() => this.placeholder() ?? this.labels.t("search.placeholder"), ...ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []);
|
|
17
17
|
this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
18
|
+
this.width = input("md", ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
18
19
|
this.value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
19
20
|
this.maxlength = input(200, ...ngDevMode ? [{ debugName: "maxlength" }] : /* istanbul ignore next */ []);
|
|
20
21
|
this.endpoint = input("", ...ngDevMode ? [{ debugName: "endpoint" }] : /* istanbul ignore next */ []);
|
|
@@ -112,6 +113,13 @@ var SearchInputComponent = class SearchInputComponent {
|
|
|
112
113
|
isRequired: false,
|
|
113
114
|
transformFunction: null
|
|
114
115
|
},
|
|
116
|
+
width: {
|
|
117
|
+
classPropertyName: "width",
|
|
118
|
+
publicName: "width",
|
|
119
|
+
isSignal: true,
|
|
120
|
+
isRequired: false,
|
|
121
|
+
transformFunction: null
|
|
122
|
+
},
|
|
115
123
|
value: {
|
|
116
124
|
classPropertyName: "value",
|
|
117
125
|
publicName: "value",
|
|
@@ -165,7 +173,9 @@ var SearchInputComponent = class SearchInputComponent {
|
|
|
165
173
|
listeners: { "keydown.escape": "onEscape()" },
|
|
166
174
|
properties: {
|
|
167
175
|
"class.search-collapsed": "collapsed()",
|
|
168
|
-
"class.search-expanded": "collapsed() && expanded()"
|
|
176
|
+
"class.search-expanded": "collapsed() && expanded()",
|
|
177
|
+
"class.search-w-sm": "width() === 'sm'",
|
|
178
|
+
"class.search-w-lg": "width() === 'lg'"
|
|
169
179
|
}
|
|
170
180
|
},
|
|
171
181
|
ngImport: i0,
|
|
@@ -216,7 +226,7 @@ var SearchInputComponent = class SearchInputComponent {
|
|
|
216
226
|
</div>
|
|
217
227
|
`,
|
|
218
228
|
isInline: true,
|
|
219
|
-
styles: [":host{display:block;flex:0 1 var(--ui-search-width, 325px);min-width:0}.search-bar{position:relative;display:flex;align-items:center;width:100%}.search-bar[hidden]{display:none}:host(.search-collapsed){flex:0 0 auto}.search-toggle{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:8px;background:transparent;color:#475569;cursor:pointer}.search-toggle:hover{background:#f1f5f9}.search-toggle:focus-visible{outline:2px solid #3b82f6;outline-offset:0}.search-toggle[aria-expanded=true]{background:#eff6ff;color:#1d4ed8}.search-bar-panel{position:fixed;top:var(--ui-search-bar-top, 64px);left:8px;right:8px;z-index:10000;width:auto;box-sizing:border-box;padding:8px;background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 10px 25px #00000026}.search-icon{position:absolute;left:10px;color:#94a3b8;pointer-events:none}.search-input{width:100%;padding:9px 10px 9px 34px;border:1px solid #7c8ba1;border-radius:8px;font-size:.875rem;background:#fff;color:#1e293b;outline:none;min-width:0;font-family:inherit;transition:border-color .15s,box-shadow .15s}.search-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.search-input::placeholder{color:#64748b;opacity:1}.search-input-loading{padding-right:34px}.search-input-loading::-webkit-search-cancel-button{display:none}.search-spinner{position:absolute;right:10px;top:50%;margin-top:-8px;width:16px;height:16px;pointer-events:none}.search-spinner-ring{display:block;width:16px;height:16px;box-sizing:border-box;border:2px solid #e2e8f0;border-top-color:#64748b;border-radius:50%;animation:search-spin .6s linear infinite}.search-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes search-spin{to{transform:rotate(360deg)}}@media(pointer:coarse),(max-width:480px){.search-input{min-height:44px}}@media(max-width:1024px){:host{flex:0 1 280px}}@media(max-width:768px){:host{flex:0 1 240px}}@media(max-width:640px){:host{flex:1 1 0;min-width:160px}.search-input{font-size:16px}}@media(prefers-reduced-motion:reduce){.search-spinner-ring{animation-duration:2s}}\n"],
|
|
229
|
+
styles: [":host{display:block;flex:0 1 var(--ui-search-width, 325px);min-width:0}@media(min-width:1025px){:host(.search-w-sm){flex:0 1 var(--ui-search-width, 240px)}:host(.search-w-lg){flex:0 1 var(--ui-search-width, 420px)}}.search-bar{position:relative;display:flex;align-items:center;width:100%}.search-bar[hidden]{display:none}:host(.search-collapsed){flex:0 0 auto}.search-toggle{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:8px;background:transparent;color:#475569;cursor:pointer}.search-toggle:hover{background:#f1f5f9}.search-toggle:focus-visible{outline:2px solid #3b82f6;outline-offset:0}.search-toggle[aria-expanded=true]{background:#eff6ff;color:#1d4ed8}.search-bar-panel{position:fixed;top:var(--ui-search-bar-top, 64px);left:8px;right:8px;z-index:10000;width:auto;box-sizing:border-box;padding:8px;background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 10px 25px #00000026}.search-icon{position:absolute;left:10px;color:#94a3b8;pointer-events:none}.search-input{width:100%;padding:9px 10px 9px 34px;border:1px solid #7c8ba1;border-radius:8px;font-size:.875rem;background:#fff;color:#1e293b;outline:none;min-width:0;font-family:inherit;transition:border-color .15s,box-shadow .15s}.search-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.search-input::placeholder{color:#64748b;opacity:1}.search-input-loading{padding-right:34px}.search-input-loading::-webkit-search-cancel-button{display:none}.search-spinner{position:absolute;right:10px;top:50%;margin-top:-8px;width:16px;height:16px;pointer-events:none}.search-spinner-ring{display:block;width:16px;height:16px;box-sizing:border-box;border:2px solid #e2e8f0;border-top-color:#64748b;border-radius:50%;animation:search-spin .6s linear infinite}.search-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes search-spin{to{transform:rotate(360deg)}}@media(pointer:coarse),(max-width:480px){.search-input{min-height:44px}}@media(max-width:1024px){:host{flex:0 1 280px}}@media(max-width:768px){:host{flex:0 1 240px}}@media(max-width:640px){:host{flex:1 1 0;min-width:160px}.search-input{font-size:16px}}@media(prefers-reduced-motion:reduce){.search-spinner-ring{animation-duration:2s}}\n"],
|
|
220
230
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
221
231
|
});
|
|
222
232
|
}
|
|
@@ -235,6 +245,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
235
245
|
host: {
|
|
236
246
|
"[class.search-collapsed]": "collapsed()",
|
|
237
247
|
"[class.search-expanded]": "collapsed() && expanded()",
|
|
248
|
+
"[class.search-w-sm]": "width() === 'sm'",
|
|
249
|
+
"[class.search-w-lg]": "width() === 'lg'",
|
|
238
250
|
"(keydown.escape)": "onEscape()"
|
|
239
251
|
},
|
|
240
252
|
template: `
|
|
@@ -283,7 +295,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
283
295
|
}
|
|
284
296
|
</div>
|
|
285
297
|
`,
|
|
286
|
-
styles: [":host{display:block;flex:0 1 var(--ui-search-width, 325px);min-width:0}.search-bar{position:relative;display:flex;align-items:center;width:100%}.search-bar[hidden]{display:none}:host(.search-collapsed){flex:0 0 auto}.search-toggle{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:8px;background:transparent;color:#475569;cursor:pointer}.search-toggle:hover{background:#f1f5f9}.search-toggle:focus-visible{outline:2px solid #3b82f6;outline-offset:0}.search-toggle[aria-expanded=true]{background:#eff6ff;color:#1d4ed8}.search-bar-panel{position:fixed;top:var(--ui-search-bar-top, 64px);left:8px;right:8px;z-index:10000;width:auto;box-sizing:border-box;padding:8px;background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 10px 25px #00000026}.search-icon{position:absolute;left:10px;color:#94a3b8;pointer-events:none}.search-input{width:100%;padding:9px 10px 9px 34px;border:1px solid #7c8ba1;border-radius:8px;font-size:.875rem;background:#fff;color:#1e293b;outline:none;min-width:0;font-family:inherit;transition:border-color .15s,box-shadow .15s}.search-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.search-input::placeholder{color:#64748b;opacity:1}.search-input-loading{padding-right:34px}.search-input-loading::-webkit-search-cancel-button{display:none}.search-spinner{position:absolute;right:10px;top:50%;margin-top:-8px;width:16px;height:16px;pointer-events:none}.search-spinner-ring{display:block;width:16px;height:16px;box-sizing:border-box;border:2px solid #e2e8f0;border-top-color:#64748b;border-radius:50%;animation:search-spin .6s linear infinite}.search-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes search-spin{to{transform:rotate(360deg)}}@media(pointer:coarse),(max-width:480px){.search-input{min-height:44px}}@media(max-width:1024px){:host{flex:0 1 280px}}@media(max-width:768px){:host{flex:0 1 240px}}@media(max-width:640px){:host{flex:1 1 0;min-width:160px}.search-input{font-size:16px}}@media(prefers-reduced-motion:reduce){.search-spinner-ring{animation-duration:2s}}\n"]
|
|
298
|
+
styles: [":host{display:block;flex:0 1 var(--ui-search-width, 325px);min-width:0}@media(min-width:1025px){:host(.search-w-sm){flex:0 1 var(--ui-search-width, 240px)}:host(.search-w-lg){flex:0 1 var(--ui-search-width, 420px)}}.search-bar{position:relative;display:flex;align-items:center;width:100%}.search-bar[hidden]{display:none}:host(.search-collapsed){flex:0 0 auto}.search-toggle{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:8px;background:transparent;color:#475569;cursor:pointer}.search-toggle:hover{background:#f1f5f9}.search-toggle:focus-visible{outline:2px solid #3b82f6;outline-offset:0}.search-toggle[aria-expanded=true]{background:#eff6ff;color:#1d4ed8}.search-bar-panel{position:fixed;top:var(--ui-search-bar-top, 64px);left:8px;right:8px;z-index:10000;width:auto;box-sizing:border-box;padding:8px;background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 10px 25px #00000026}.search-icon{position:absolute;left:10px;color:#94a3b8;pointer-events:none}.search-input{width:100%;padding:9px 10px 9px 34px;border:1px solid #7c8ba1;border-radius:8px;font-size:.875rem;background:#fff;color:#1e293b;outline:none;min-width:0;font-family:inherit;transition:border-color .15s,box-shadow .15s}.search-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.search-input::placeholder{color:#64748b;opacity:1}.search-input-loading{padding-right:34px}.search-input-loading::-webkit-search-cancel-button{display:none}.search-spinner{position:absolute;right:10px;top:50%;margin-top:-8px;width:16px;height:16px;pointer-events:none}.search-spinner-ring{display:block;width:16px;height:16px;box-sizing:border-box;border:2px solid #e2e8f0;border-top-color:#64748b;border-radius:50%;animation:search-spin .6s linear infinite}.search-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes search-spin{to{transform:rotate(360deg)}}@media(pointer:coarse),(max-width:480px){.search-input{min-height:44px}}@media(max-width:1024px){:host{flex:0 1 280px}}@media(max-width:768px){:host{flex:0 1 240px}}@media(max-width:640px){:host{flex:1 1 0;min-width:160px}.search-input{font-size:16px}}@media(prefers-reduced-motion:reduce){.search-spinner-ring{animation-duration:2s}}\n"]
|
|
287
299
|
}]
|
|
288
300
|
}],
|
|
289
301
|
ctorParameters: () => [],
|
|
@@ -304,6 +316,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
304
316
|
required: false
|
|
305
317
|
}]
|
|
306
318
|
}],
|
|
319
|
+
width: [{
|
|
320
|
+
type: i0.Input,
|
|
321
|
+
args: [{
|
|
322
|
+
isSignal: true,
|
|
323
|
+
alias: "width",
|
|
324
|
+
required: false
|
|
325
|
+
}]
|
|
326
|
+
}],
|
|
307
327
|
value: [{
|
|
308
328
|
type: i0.Input,
|
|
309
329
|
args: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-search-input.mjs","names":[],"sources":["../../../projects/forgeroute-ui/search-input/src/lib/search-input/search-input.component.ts"],"sourcesContent":["import {\n Component, input, output, model, signal, computed, effect, untracked, afterNextRender, Injector, ElementRef,\n ChangeDetectionStrategy, inject, DestroyRef,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { HttpClient, HttpParams } from '@angular/common/http';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { debounceTime, distinctUntilChanged, skip, switchMap } from 'rxjs/operators';\nimport { of } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FORGEROUTE_CONFIG } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n@Component({\n selector: 'ui-search-input',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.search-collapsed]': 'collapsed()',\n '[class.search-expanded]': 'collapsed() && expanded()',\n '(keydown.escape)': 'onEscape()',\n },\n template: `\n @if (collapsed()) {\n <!-- Narrow screens (collapseAt): the search is this 44px button; it opens the bar as a full-width panel under the header. -->\n <button type=\"button\" class=\"search-toggle\" data-testid=\"search-toggle\" [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"barId\"\n [attr.aria-label]=\"labels.t(expanded() ? 'search.close' : 'search.open')\" (click)=\"toggle()\">\n <svg aria-hidden=\"true\" focusable=\"false\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>\n </svg>\n </button>\n }\n <div class=\"search-bar\" [id]=\"barId\" role=\"search\" [hidden]=\"collapsed() && !expanded()\" [class.search-bar-panel]=\"collapsed() && expanded()\">\n <svg\n class=\"search-icon\"\n aria-hidden=\"true\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>\n </svg>\n <input\n class=\"search-input\"\n type=\"search\"\n [placeholder]=\"effectivePlaceholder()\"\n [attr.aria-label]=\"ariaLabel() || effectivePlaceholder()\"\n [value]=\"value()\"\n (input)=\"onInput($any($event.target).value)\"\n autocomplete=\"off\"\n inputmode=\"search\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-busy]=\"loading() ? 'true' : null\"\n [class.search-input-loading]=\"loading()\"\n data-testid=\"search-input\" />\n <span class=\"search-sr-only\" role=\"status\" aria-live=\"polite\" data-testid=\"search-status\">{{ loading() ? labels.t('search.searching') : '' }}</span>\n @if (loading()) {\n <span class=\"search-spinner\" aria-hidden=\"true\" data-testid=\"search-spinner\">\n <span class=\"search-spinner-ring\"></span>\n </span>\n }\n </div>\n `,\n styles: [`\n /* Width in a flex row: 325px, or the page's own --ui-search-width (set on any ancestor, no ::ng-deep needed). Desktop only (above 1024px): the tablet / phone rules below keep their fixed widths. */\n :host { display: block; flex: 0 1 var(--ui-search-width, 325px); min-width: 0; }\n\n .search-bar {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n }\n\n .search-bar[hidden] { display: none; }\n\n /* Collapsed (collapseAt): the host shrinks to the toggle button; the opened bar is a fixed full-width panel under the header (--ui-search-bar-top, default 64px). */\n :host(.search-collapsed) { flex: 0 0 auto; }\n .search-toggle {\n display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;\n border: 0; border-radius: 8px; background: transparent; color: #475569; cursor: pointer;\n }\n .search-toggle:hover { background: #f1f5f9; }\n .search-toggle:focus-visible { outline: 2px solid #3b82f6; outline-offset: 0; }\n .search-toggle[aria-expanded='true'] { background: #eff6ff; color: #1d4ed8; }\n .search-bar-panel {\n position: fixed; top: var(--ui-search-bar-top, 64px); left: 8px; right: 8px; z-index: 10000; width: auto; box-sizing: border-box;\n padding: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);\n }\n\n .search-icon {\n position: absolute;\n left: 10px;\n color: #94a3b8;\n pointer-events: none;\n }\n\n .search-input {\n width: 100%;\n padding: 9px 10px 9px 34px;\n border: 1px solid #7c8ba1;\n border-radius: 8px;\n font-size: 0.875rem;\n background: #fff;\n color: #1e293b;\n outline: none;\n min-width: 0;\n font-family: inherit;\n transition: border-color 0.15s, box-shadow 0.15s;\n }\n\n .search-input:focus {\n border-color: #3b82f6;\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);\n }\n\n .search-input::placeholder { color: #64748b; opacity: 1; }\n\n /* Loading: the spinner takes the right edge, so hide the native clear (x) button meanwhile. */\n .search-input-loading { padding-right: 34px; }\n .search-input-loading::-webkit-search-cancel-button { display: none; }\n .search-spinner {\n position: absolute; right: 10px; top: 50%; margin-top: -8px;\n width: 16px; height: 16px; pointer-events: none;\n }\n .search-spinner-ring {\n display: block; width: 16px; height: 16px; box-sizing: border-box;\n border: 2px solid #e2e8f0; border-top-color: #64748b; border-radius: 50%;\n animation: search-spin 0.6s linear infinite;\n }\n .search-sr-only {\n position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;\n overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;\n }\n @keyframes search-spin { to { transform: rotate(360deg); } }\n\n /* Touch targets: at least 44px tall on touch devices and phones. */\n @media (pointer: coarse), (max-width: 480px) {\n .search-input { min-height: 44px; }\n }\n\n /* Tablet: allow narrower search so toolbar buttons have room */\n @media (max-width: 1024px) {\n :host { flex: 0 1 280px; }\n }\n\n /* Phone landscape / small tablet: compress further */\n @media (max-width: 768px) {\n :host { flex: 0 1 240px; }\n }\n\n /* Phone: grow to fill the rest of the row (beside a table title) so tabs wrap cleanly below. The basis is 0 with a floor of 160px, NOT auto: an auto basis is the\n browser's own default width of a text input, which differs between engines, so a title and the search sat on one row in Chrome and on two rows in WebKit / Firefox\n (and on two in every engine on a 360px screen). With a fixed floor the wrap decision is the same everywhere. */\n @media (max-width: 640px) {\n :host { flex: 1 1 0; min-width: 160px; }\n /* 16px prevents iOS auto-zoom on input focus */\n .search-input { font-size: 16px; }\n }\n\n /* Reduced motion: no entrance / shimmer animation (a loading spinner stays, slower). */\n @media (prefers-reduced-motion: reduce) {\n .search-spinner-ring { animation-duration: 2s; } /* a loading indicator stays, but turns slowly */\n }\n `],\n})\nexport class SearchInputComponent<T> {\n protected readonly labels = inject(UiLabelsService);\n /** Placeholder text; `null` (default) = the library text for the active language (`Search...` in English). */\n readonly placeholder = input<string | null>(null);\n protected readonly effectivePlaceholder = computed(() => this.placeholder() ?? this.labels.t('search.placeholder'));\n readonly ariaLabel = input('');\n readonly value = model('');\n readonly maxlength = input(200);\n /** When set, the component fetches from this endpoint and emits `filteredData`. */\n readonly endpoint = input('');\n /** Shows a small spinner at the right edge (and `aria-busy`) while a search is being fetched. */\n readonly loading = input(false);\n /**\n * Built-in narrow-screen mode (default `null` = off, nothing changes). A viewport width in px (e.g. `360`): at or below it the search collapses into a 44px icon button (`aria-expanded`, `aria-controls`, named\n * \"Open search\" / \"Close search\") and the box opens as a full-width bar fixed under the header (`--ui-search-bar-top`, default `64px`, set it on any ancestor). Escape closes the bar and returns focus to the button; opening\n * puts the focus in the box. The typed text is kept while closed. Wider than `collapseAt` the normal box shows.\n */\n readonly collapseAt = input<number | null>(null);\n /** Whether the collapsed bar is open (two-way). Only meaningful while collapsed; it resets to closed when the viewport grows past `collapseAt`. */\n readonly expanded = model(false);\n\n /** Always emits the debounced search value regardless of endpoint. */\n readonly searchChange = output<string>();\n /** Emits backend results when `endpoint` is provided. */\n readonly filteredData = output<T[]>();\n\n private readonly config = inject(FORGEROUTE_CONFIG, { optional: true } as any);\n private readonly http = inject(HttpClient);\n private readonly destroyRef = inject(DestroyRef);\n private readonly query = signal('');\n private readonly injector = inject(Injector);\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly win = inject(DOCUMENT).defaultView;\n private static nextId = 0;\n protected readonly barId = `ui-search-bar-${SearchInputComponent.nextId++}`;\n private readonly narrow = signal(false);\n /** The viewport is at or below `collapseAt`: the search is a button. */\n protected readonly collapsed = computed(() => this.collapseAt() !== null && this.narrow());\n\n constructor() {\n effect((onCleanup) => {\n const at = this.collapseAt();\n const win = this.win;\n if (at === null || !Number.isFinite(at) || typeof win?.matchMedia !== 'function') { untracked(() => this.narrow.set(false)); return; }\n const mq = win.matchMedia(`(max-width: ${at}px)`);\n untracked(() => this.narrow.set(mq.matches));\n const listener = (e: MediaQueryListEvent): void => this.narrow.set(e.matches);\n mq.addEventListener?.('change', listener);\n onCleanup(() => mq.removeEventListener?.('change', listener));\n });\n effect(() => { if (!this.collapsed() && this.expanded()) untracked(() => this.expanded.set(false)); });\n // Keep the debounced query in step when the parent changes `value` (e.g. a table's\n // \"Clear filters\" resets it to ''), so the box shows the reset value and typing the\n // previous term again still emits instead of being swallowed by distinctUntilChanged.\n effect(() => {\n const v = this.value();\n untracked(() => { if (v !== this.query()) this.query.set(v); });\n });\n\n toObservable(this.query).pipe(\n skip(1), // skip initial emission to prevent spurious load on mount\n debounceTime(300),\n distinctUntilChanged(),\n switchMap(query => {\n this.searchChange.emit(query);\n if (!this.endpoint() || !this.config) return of(null);\n const params = new HttpParams().set('search', query);\n return this.http.get<any>(`${this.config.baseUrl}${this.endpoint()}`, { params });\n }),\n takeUntilDestroyed(this.destroyRef),\n ).subscribe(response => {\n if (response === null) return;\n const results: T[] = Array.isArray(response) ? response : (response?.content ?? []);\n this.filteredData.emit(results);\n });\n }\n\n /** The collapsed button: opens / closes the bar (opening focuses the box). */\n protected toggle(): void {\n const open = !this.expanded();\n this.expanded.set(open);\n if (open) afterNextRender(() => this.hostEl.nativeElement.querySelector<HTMLInputElement>('input.search-input')?.focus(), { injector: this.injector });\n }\n\n /** Escape closes an open collapsed bar and returns the focus to the button; otherwise the key passes on untouched. */\n protected onEscape(): void {\n if (!this.collapsed() || !this.expanded()) return;\n this.expanded.set(false);\n afterNextRender(() => this.hostEl.nativeElement.querySelector<HTMLElement>('.search-toggle')?.focus(), { injector: this.injector });\n }\n\n onInput(val: string): void {\n this.value.set(val);\n this.query.set(val);\n }\n}\n"],"mappings":";;;;;;;;AA2KA,IAAa,uBAAb,MAAa,qBAAoB;CAiChB;EAAA,KAAA,SAAS;CAAE;CAM1B,cAAA;EAtCmB,KAAA,SAAS,OAAO,eAAe;EAEzC,KAAA,cAAc,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;EAC9B,KAAA,uBAAuB,eAAe,KAAK,YAAW,KAAM,KAAK,OAAO,EAAE,oBAAoB,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,uBAAA,CAAA,+BAAA,CAAA,CAAA;EAC1G,KAAA,YAA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A,mBAAA;IAAA;IAAA,SAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,YAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,UAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;GAAA;GAAA,SAAA;IAAA,OAAA;IAAA,UAAA;IAAA,cAAA;IAAA,cAAA;GAAA;GAAA,MAAA;IAAA,WAAA,EAAA,kBAAA,aAAA;IAAA,YAAA;KAAA,0BAAA;KAAA,yBAAA;IAAA;GAAA;GAAA,UAAA;GAAA,UArJrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CT,UAAA;GAAA,QAAA,CAAA,gpEAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAwGU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EA9JhC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAiB,YACf;GAAI,iBACC,wBAAwB;GAAM,MACzC;IACJ,4BAA4B;IAC5B,2BAA2B;IAC3B,oBAAoB;GACrB;GAAA,UACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CT,QAAA,CAAA,gpEAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-search-input.mjs","names":[],"sources":["../../../projects/forgeroute-ui/search-input/src/lib/search-input/search-input.component.ts"],"sourcesContent":["import {\n Component, input, output, model, signal, computed, effect, untracked, afterNextRender, Injector, ElementRef,\n ChangeDetectionStrategy, inject, DestroyRef,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { HttpClient, HttpParams } from '@angular/common/http';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { debounceTime, distinctUntilChanged, skip, switchMap } from 'rxjs/operators';\nimport { of } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FORGEROUTE_CONFIG } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n@Component({\n selector: 'ui-search-input',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.search-collapsed]': 'collapsed()',\n '[class.search-expanded]': 'collapsed() && expanded()',\n '[class.search-w-sm]': \"width() === 'sm'\",\n '[class.search-w-lg]': \"width() === 'lg'\",\n '(keydown.escape)': 'onEscape()',\n },\n template: `\n @if (collapsed()) {\n <!-- Narrow screens (collapseAt): the search is this 44px button; it opens the bar as a full-width panel under the header. -->\n <button type=\"button\" class=\"search-toggle\" data-testid=\"search-toggle\" [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"barId\"\n [attr.aria-label]=\"labels.t(expanded() ? 'search.close' : 'search.open')\" (click)=\"toggle()\">\n <svg aria-hidden=\"true\" focusable=\"false\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>\n </svg>\n </button>\n }\n <div class=\"search-bar\" [id]=\"barId\" role=\"search\" [hidden]=\"collapsed() && !expanded()\" [class.search-bar-panel]=\"collapsed() && expanded()\">\n <svg\n class=\"search-icon\"\n aria-hidden=\"true\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>\n </svg>\n <input\n class=\"search-input\"\n type=\"search\"\n [placeholder]=\"effectivePlaceholder()\"\n [attr.aria-label]=\"ariaLabel() || effectivePlaceholder()\"\n [value]=\"value()\"\n (input)=\"onInput($any($event.target).value)\"\n autocomplete=\"off\"\n inputmode=\"search\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-busy]=\"loading() ? 'true' : null\"\n [class.search-input-loading]=\"loading()\"\n data-testid=\"search-input\" />\n <span class=\"search-sr-only\" role=\"status\" aria-live=\"polite\" data-testid=\"search-status\">{{ loading() ? labels.t('search.searching') : '' }}</span>\n @if (loading()) {\n <span class=\"search-spinner\" aria-hidden=\"true\" data-testid=\"search-spinner\">\n <span class=\"search-spinner-ring\"></span>\n </span>\n }\n </div>\n `,\n styles: [`\n /* Width in a flex row: 325px, or the page's own --ui-search-width (set on any ancestor, no ::ng-deep needed). Desktop only (above 1024px): the tablet / phone rules below keep their fixed widths. */\n :host { display: block; flex: 0 1 var(--ui-search-width, 325px); min-width: 0; }\n /* The three widths (\\`width\\` input): sm 240px, md 325px (default), lg 420px. Desktop only, so the tablet / phone rules below keep their fixed widths; --ui-search-width still wins. */\n @media (min-width: 1025px) {\n :host(.search-w-sm) { flex: 0 1 var(--ui-search-width, 240px); }\n :host(.search-w-lg) { flex: 0 1 var(--ui-search-width, 420px); }\n }\n\n .search-bar {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n }\n\n .search-bar[hidden] { display: none; }\n\n /* Collapsed (collapseAt): the host shrinks to the toggle button; the opened bar is a fixed full-width panel under the header (--ui-search-bar-top, default 64px). */\n :host(.search-collapsed) { flex: 0 0 auto; }\n .search-toggle {\n display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;\n border: 0; border-radius: 8px; background: transparent; color: #475569; cursor: pointer;\n }\n .search-toggle:hover { background: #f1f5f9; }\n .search-toggle:focus-visible { outline: 2px solid #3b82f6; outline-offset: 0; }\n .search-toggle[aria-expanded='true'] { background: #eff6ff; color: #1d4ed8; }\n .search-bar-panel {\n position: fixed; top: var(--ui-search-bar-top, 64px); left: 8px; right: 8px; z-index: 10000; width: auto; box-sizing: border-box;\n padding: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);\n }\n\n .search-icon {\n position: absolute;\n left: 10px;\n color: #94a3b8;\n pointer-events: none;\n }\n\n .search-input {\n width: 100%;\n padding: 9px 10px 9px 34px;\n border: 1px solid #7c8ba1;\n border-radius: 8px;\n font-size: 0.875rem;\n background: #fff;\n color: #1e293b;\n outline: none;\n min-width: 0;\n font-family: inherit;\n transition: border-color 0.15s, box-shadow 0.15s;\n }\n\n .search-input:focus {\n border-color: #3b82f6;\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);\n }\n\n .search-input::placeholder { color: #64748b; opacity: 1; }\n\n /* Loading: the spinner takes the right edge, so hide the native clear (x) button meanwhile. */\n .search-input-loading { padding-right: 34px; }\n .search-input-loading::-webkit-search-cancel-button { display: none; }\n .search-spinner {\n position: absolute; right: 10px; top: 50%; margin-top: -8px;\n width: 16px; height: 16px; pointer-events: none;\n }\n .search-spinner-ring {\n display: block; width: 16px; height: 16px; box-sizing: border-box;\n border: 2px solid #e2e8f0; border-top-color: #64748b; border-radius: 50%;\n animation: search-spin 0.6s linear infinite;\n }\n .search-sr-only {\n position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;\n overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;\n }\n @keyframes search-spin { to { transform: rotate(360deg); } }\n\n /* Touch targets: at least 44px tall on touch devices and phones. */\n @media (pointer: coarse), (max-width: 480px) {\n .search-input { min-height: 44px; }\n }\n\n /* Tablet: allow narrower search so toolbar buttons have room */\n @media (max-width: 1024px) {\n :host { flex: 0 1 280px; }\n }\n\n /* Phone landscape / small tablet: compress further */\n @media (max-width: 768px) {\n :host { flex: 0 1 240px; }\n }\n\n /* Phone: grow to fill the rest of the row (beside a table title) so tabs wrap cleanly below. The basis is 0 with a floor of 160px, NOT auto: an auto basis is the\n browser's own default width of a text input, which differs between engines, so a title and the search sat on one row in Chrome and on two rows in WebKit / Firefox\n (and on two in every engine on a 360px screen). With a fixed floor the wrap decision is the same everywhere. */\n @media (max-width: 640px) {\n :host { flex: 1 1 0; min-width: 160px; }\n /* 16px prevents iOS auto-zoom on input focus */\n .search-input { font-size: 16px; }\n }\n\n /* Reduced motion: no entrance / shimmer animation (a loading spinner stays, slower). */\n @media (prefers-reduced-motion: reduce) {\n .search-spinner-ring { animation-duration: 2s; } /* a loading indicator stays, but turns slowly */\n }\n `],\n})\nexport class SearchInputComponent<T> {\n protected readonly labels = inject(UiLabelsService);\n /** Placeholder text; `null` (default) = the library text for the active language (`Search...` in English). */\n readonly placeholder = input<string | null>(null);\n protected readonly effectivePlaceholder = computed(() => this.placeholder() ?? this.labels.t('search.placeholder'));\n readonly ariaLabel = input('');\n /**\n * Width on desktop (above 1024px): `'sm'` 240px, `'md'` 325px (default, unchanged), `'lg'` 420px. Use `'lg'` when the placeholder is long (\"Search by deal, client, address...\"), `'sm'` in a tight\n * toolbar. Tablet and phone keep their own widths. A page's own `--ui-search-width` still overrides it.\n */\n readonly width = input<'sm' | 'md' | 'lg'>('md');\n readonly value = model('');\n readonly maxlength = input(200);\n /** When set, the component fetches from this endpoint and emits `filteredData`. */\n readonly endpoint = input('');\n /** Shows a small spinner at the right edge (and `aria-busy`) while a search is being fetched. */\n readonly loading = input(false);\n /**\n * Built-in narrow-screen mode (default `null` = off, nothing changes). A viewport width in px (e.g. `360`): at or below it the search collapses into a 44px icon button (`aria-expanded`, `aria-controls`, named\n * \"Open search\" / \"Close search\") and the box opens as a full-width bar fixed under the header (`--ui-search-bar-top`, default `64px`, set it on any ancestor). Escape closes the bar and returns focus to the button; opening\n * puts the focus in the box. The typed text is kept while closed. Wider than `collapseAt` the normal box shows.\n */\n readonly collapseAt = input<number | null>(null);\n /** Whether the collapsed bar is open (two-way). Only meaningful while collapsed; it resets to closed when the viewport grows past `collapseAt`. */\n readonly expanded = model(false);\n\n /** Always emits the debounced search value regardless of endpoint. */\n readonly searchChange = output<string>();\n /** Emits backend results when `endpoint` is provided. */\n readonly filteredData = output<T[]>();\n\n private readonly config = inject(FORGEROUTE_CONFIG, { optional: true } as any);\n private readonly http = inject(HttpClient);\n private readonly destroyRef = inject(DestroyRef);\n private readonly query = signal('');\n private readonly injector = inject(Injector);\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly win = inject(DOCUMENT).defaultView;\n private static nextId = 0;\n protected readonly barId = `ui-search-bar-${SearchInputComponent.nextId++}`;\n private readonly narrow = signal(false);\n /** The viewport is at or below `collapseAt`: the search is a button. */\n protected readonly collapsed = computed(() => this.collapseAt() !== null && this.narrow());\n\n constructor() {\n effect((onCleanup) => {\n const at = this.collapseAt();\n const win = this.win;\n if (at === null || !Number.isFinite(at) || typeof win?.matchMedia !== 'function') { untracked(() => this.narrow.set(false)); return; }\n const mq = win.matchMedia(`(max-width: ${at}px)`);\n untracked(() => this.narrow.set(mq.matches));\n const listener = (e: MediaQueryListEvent): void => this.narrow.set(e.matches);\n mq.addEventListener?.('change', listener);\n onCleanup(() => mq.removeEventListener?.('change', listener));\n });\n effect(() => { if (!this.collapsed() && this.expanded()) untracked(() => this.expanded.set(false)); });\n // Keep the debounced query in step when the parent changes `value` (e.g. a table's\n // \"Clear filters\" resets it to ''), so the box shows the reset value and typing the\n // previous term again still emits instead of being swallowed by distinctUntilChanged.\n effect(() => {\n const v = this.value();\n untracked(() => { if (v !== this.query()) this.query.set(v); });\n });\n\n toObservable(this.query).pipe(\n skip(1), // skip initial emission to prevent spurious load on mount\n debounceTime(300),\n distinctUntilChanged(),\n switchMap(query => {\n this.searchChange.emit(query);\n if (!this.endpoint() || !this.config) return of(null);\n const params = new HttpParams().set('search', query);\n return this.http.get<any>(`${this.config.baseUrl}${this.endpoint()}`, { params });\n }),\n takeUntilDestroyed(this.destroyRef),\n ).subscribe(response => {\n if (response === null) return;\n const results: T[] = Array.isArray(response) ? response : (response?.content ?? []);\n this.filteredData.emit(results);\n });\n }\n\n /** The collapsed button: opens / closes the bar (opening focuses the box). */\n protected toggle(): void {\n const open = !this.expanded();\n this.expanded.set(open);\n if (open) afterNextRender(() => this.hostEl.nativeElement.querySelector<HTMLInputElement>('input.search-input')?.focus(), { injector: this.injector });\n }\n\n /** Escape closes an open collapsed bar and returns the focus to the button; otherwise the key passes on untouched. */\n protected onEscape(): void {\n if (!this.collapsed() || !this.expanded()) return;\n this.expanded.set(false);\n afterNextRender(() => this.hostEl.nativeElement.querySelector<HTMLElement>('.search-toggle')?.focus(), { injector: this.injector });\n }\n\n onInput(val: string): void {\n this.value.set(val);\n this.query.set(val);\n }\n}\n"],"mappings":";;;;;;;;AAkLA,IAAa,uBAAb,MAAa,qBAAoB;CAsChB;EAAA,KAAA,SAAS;CAAE;CAM1B,cAAA;EA3CmB,KAAA,SAAS,OAAO,eAAe;EAEzC,KAAA,cAAc,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;EAC9B,KAAA,uBAAuB,eAAe,KAAK,YAAW,KAAM,KAAK,OAAO,EAAE,oBAAoB,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,uBAAA,CAAA,+BAAA,CAAA,CAAA;EAC1G,KAAA,YAAY,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EAKrB,KAAA,QAAQ,MAA0B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EACvC,KAAA,QAAQ,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EACjB,KAAA,YAAY,MAAM,KAAI,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EAEtB,KAAA,WAAW,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA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AAA,mBAAA;IAAA;GAAA;GAAA,SAAA;IAAA,OAAA;IAAA,UAAA;IAAA,cAAA;IAAA,cAAA;GAAA;GAAA,MAAA;IAAA,WAAA,EAAA,kBAAA,aAAA;IAAA,YAAA;KAAA,0BAAA;KAAA,yBAAA;KAAA,qBAAA;KAAA,qBAAA;IAAA;GAAA;GAAA,UAAA;GAAA,UA1JrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CT,UAAA;GAAA,QAAA,CAAA,gyEAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AA6GU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EArKhC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAiB,YACf;GAAI,iBACC,wBAAwB;GAAM,MACzC;IACJ,4BAA4B;IAC5B,2BAA2B;IAC3B,uBAAuB;IACvB,uBAAuB;IACvB,oBAAoB;GACrB;GAAA,UACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CT,QAAA,CAAA,gyEAAA;EAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -2758,7 +2758,7 @@ export declare class ButtonComponent {
|
|
|
2758
2758
|
* `ghost-start`: a ghost button for list / section toggles - a full-width row with its content aligned to the start, transparent
|
|
2759
2759
|
* background, hover tint and the normal focus ring. Pair it with `ariaExpanded` / `ariaPressed`; the label may contain a heading element.
|
|
2760
2760
|
*/
|
|
2761
|
-
readonly variant: import("@angular/core").InputSignal<"
|
|
2761
|
+
readonly variant: import("@angular/core").InputSignal<"warning" | "primary" | "secondary" | "danger" | "link" | "ghost" | "ghost-start" | "tab" | "icon" | "icon-danger">;
|
|
2762
2762
|
/** Renders an anchor to this route instead of a button (use with `variant="link"` for an inline text link). `['/settings']` or `'/settings'`. While `disabled` or `loading` it renders a non-clickable `<span role="link" aria-disabled>` with no href (like `href`). */
|
|
2763
2763
|
readonly routerLink: import("@angular/core").InputSignal<string | readonly unknown[] | null>;
|
|
2764
2764
|
/** Query params of the `routerLink` (e.g. `{ section: 'deal-defaults' }`). */
|
|
@@ -2804,7 +2804,7 @@ export declare class ButtonComponent {
|
|
|
2804
2804
|
readonly color: import("@angular/core").InputSignal<string | undefined>;
|
|
2805
2805
|
readonly active: import("@angular/core").InputSignal<boolean>;
|
|
2806
2806
|
readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg" | "xs">;
|
|
2807
|
-
readonly type: import("@angular/core").InputSignal<"
|
|
2807
|
+
readonly type: import("@angular/core").InputSignal<"button" | "submit" | "reset">;
|
|
2808
2808
|
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
2809
2809
|
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
2810
2810
|
readonly fullWidth: import("@angular/core").InputSignal<boolean>;
|
|
@@ -2953,7 +2953,7 @@ export declare class ModalComponent implements OnInit, OnDestroy {
|
|
|
2953
2953
|
*/
|
|
2954
2954
|
readonly describedBy: import("@angular/core").InputSignal<string | null>;
|
|
2955
2955
|
readonly maxWidth: import("@angular/core").InputSignal<string>;
|
|
2956
|
-
readonly bodyOverflow: import("@angular/core").InputSignal<"auto" | "
|
|
2956
|
+
readonly bodyOverflow: import("@angular/core").InputSignal<"auto" | "hidden" | "visible">;
|
|
2957
2957
|
/** `data-testid` of the dialog element itself (the host `<ui-modal>` is always in the page, the dialog only while open). None when empty. */
|
|
2958
2958
|
readonly dialogTestId: import("@angular/core").InputSignal<string>;
|
|
2959
2959
|
/** Hides the header X button (e.g. while a request is running). Escape and a backdrop click still close unless `closable` is false. */
|
|
@@ -3106,7 +3106,7 @@ export declare class SidePanelComponent implements OnDestroy {
|
|
|
3106
3106
|
readonly cancelLabel: import("@angular/core").Signal<string>;
|
|
3107
3107
|
/** Right-aligned primary action button label. Empty string = hidden. */
|
|
3108
3108
|
readonly primaryLabel: import("@angular/core").InputSignal<string>;
|
|
3109
|
-
readonly primaryVariant: import("@angular/core").InputSignal<"
|
|
3109
|
+
readonly primaryVariant: import("@angular/core").InputSignal<"warning" | "primary" | "danger">;
|
|
3110
3110
|
readonly primaryLoading: import("@angular/core").InputSignal<boolean>;
|
|
3111
3111
|
readonly primaryDisabled: import("@angular/core").InputSignal<boolean>;
|
|
3112
3112
|
/** `data-testid` of the Cancel button; none when empty (default). */
|
|
@@ -288,6 +288,8 @@ export declare class DataTableComponent<T extends Record<string, any>> implement
|
|
|
288
288
|
* toolbar are all off, the header row above the table is not rendered at all.
|
|
289
289
|
*/
|
|
290
290
|
readonly showSearch: import("@angular/core").InputSignal<boolean>;
|
|
291
|
+
/** Width of the search box on desktop: `'sm'` 240px, `'md'` 325px (default), `'lg'` 420px (for a long "Search by ..." placeholder). Tablet and phone keep their own widths. */
|
|
292
|
+
readonly searchWidth: import("@angular/core").InputSignal<"sm" | "md" | "lg">;
|
|
291
293
|
/**
|
|
292
294
|
* Show the quick-filter tabs ("All / Active / ..."), which the table builds from the `/counts` endpoint. Defaults true:
|
|
293
295
|
* with correct `/counts` data the tabs show. Set false for a table where the tabs add nothing (a small breakdown table in a
|
|
@@ -1084,6 +1086,11 @@ export declare class DataTableComponent<T extends Record<string, any>> implement
|
|
|
1084
1086
|
"required": false;
|
|
1085
1087
|
"isSignal": true;
|
|
1086
1088
|
};
|
|
1089
|
+
"searchWidth": {
|
|
1090
|
+
"alias": "searchWidth";
|
|
1091
|
+
"required": false;
|
|
1092
|
+
"isSignal": true;
|
|
1093
|
+
};
|
|
1087
1094
|
"showQuickTabs": {
|
|
1088
1095
|
"alias": "showQuickTabs";
|
|
1089
1096
|
"required": false;
|
|
@@ -837,6 +837,8 @@ export declare const DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS: {
|
|
|
837
837
|
export declare function buildPreviewDocument(bodyHtml: string, brand?: EmailTemplatePreviewBrand | null): string;
|
|
838
838
|
/** Keeps only the brand values that are safe to write into the preview document (see `EmailTemplatePreviewBrand`); anything else is dropped. */
|
|
839
839
|
export declare function safePreviewBrand(brand?: EmailTemplatePreviewBrand | null): EmailTemplatePreviewBrand;
|
|
840
|
+
/** True when the whole text is one merge variable (`{{trackingUrl}}`): a link address the email fills in when it is sent. */
|
|
841
|
+
export declare function isVariableAddress(value: string): boolean;
|
|
840
842
|
/** The `{{key}}` merge variables written in the texts, each once, in the order they first appear. */
|
|
841
843
|
export declare function usedVariableKeys(...texts: string[]): string[];
|
|
842
844
|
/** The message as the Preview shows it with sample data: every known `{{key}}` becomes the variable's (escaped) `example`; a key the host does not offer stays as written. */
|
|
@@ -6,6 +6,11 @@ export declare class SearchInputComponent<T> {
|
|
|
6
6
|
readonly placeholder: import("@angular/core").InputSignal<string | null>;
|
|
7
7
|
protected readonly effectivePlaceholder: import("@angular/core").Signal<string>;
|
|
8
8
|
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Width on desktop (above 1024px): `'sm'` 240px, `'md'` 325px (default, unchanged), `'lg'` 420px. Use `'lg'` when the placeholder is long ("Search by deal, client, address..."), `'sm'` in a tight
|
|
11
|
+
* toolbar. Tablet and phone keep their own widths. A page's own `--ui-search-width` still overrides it.
|
|
12
|
+
*/
|
|
13
|
+
readonly width: import("@angular/core").InputSignal<"sm" | "md" | "lg">;
|
|
9
14
|
readonly value: import("@angular/core").ModelSignal<string>;
|
|
10
15
|
readonly maxlength: import("@angular/core").InputSignal<number>;
|
|
11
16
|
/** When set, the component fetches from this endpoint and emits `filteredData`. */
|
|
@@ -54,6 +59,11 @@ export declare class SearchInputComponent<T> {
|
|
|
54
59
|
"required": false;
|
|
55
60
|
"isSignal": true;
|
|
56
61
|
};
|
|
62
|
+
"width": {
|
|
63
|
+
"alias": "width";
|
|
64
|
+
"required": false;
|
|
65
|
+
"isSignal": true;
|
|
66
|
+
};
|
|
57
67
|
"value": {
|
|
58
68
|
"alias": "value";
|
|
59
69
|
"required": false;
|