@neural-ui/core 1.7.1 → 1.7.2
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/bottom-sheet/package.json +4 -0
- package/confirm-popup/package.json +4 -0
- package/data-view/package.json +4 -0
- package/fesm2022/neural-ui-core-alert.mjs +48 -21
- package/fesm2022/neural-ui-core-alert.mjs.map +1 -1
- package/fesm2022/neural-ui-core-autocomplete.mjs +141 -68
- package/fesm2022/neural-ui-core-autocomplete.mjs.map +1 -1
- package/fesm2022/neural-ui-core-block-ui.mjs +2 -2
- package/fesm2022/neural-ui-core-block-ui.mjs.map +1 -1
- package/fesm2022/neural-ui-core-bottom-sheet.mjs +121 -0
- package/fesm2022/neural-ui-core-bottom-sheet.mjs.map +1 -0
- package/fesm2022/neural-ui-core-breadcrumb.mjs +2 -2
- package/fesm2022/neural-ui-core-breadcrumb.mjs.map +1 -1
- package/fesm2022/neural-ui-core-button.mjs +2 -2
- package/fesm2022/neural-ui-core-button.mjs.map +1 -1
- package/fesm2022/neural-ui-core-calendar.mjs +2 -2
- package/fesm2022/neural-ui-core-calendar.mjs.map +1 -1
- package/fesm2022/neural-ui-core-checkbox.mjs +69 -39
- package/fesm2022/neural-ui-core-checkbox.mjs.map +1 -1
- package/fesm2022/neural-ui-core-chip.mjs +2 -2
- package/fesm2022/neural-ui-core-chip.mjs.map +1 -1
- package/fesm2022/neural-ui-core-code-block.mjs +2 -2
- package/fesm2022/neural-ui-core-code-block.mjs.map +1 -1
- package/fesm2022/neural-ui-core-confirm-popup.mjs +105 -0
- package/fesm2022/neural-ui-core-confirm-popup.mjs.map +1 -0
- package/fesm2022/neural-ui-core-data-view.mjs +386 -0
- package/fesm2022/neural-ui-core-data-view.mjs.map +1 -0
- package/fesm2022/neural-ui-core-date-input.mjs +185 -10
- package/fesm2022/neural-ui-core-date-input.mjs.map +1 -1
- package/fesm2022/neural-ui-core-empty-state.mjs +19 -5
- package/fesm2022/neural-ui-core-empty-state.mjs.map +1 -1
- package/fesm2022/neural-ui-core-form-field.mjs +81 -0
- package/fesm2022/neural-ui-core-form-field.mjs.map +1 -0
- package/fesm2022/neural-ui-core-inline-editor.mjs +428 -0
- package/fesm2022/neural-ui-core-inline-editor.mjs.map +1 -0
- package/fesm2022/neural-ui-core-input-mask.mjs +110 -0
- package/fesm2022/neural-ui-core-input-mask.mjs.map +1 -0
- package/fesm2022/neural-ui-core-input.mjs +2 -2
- package/fesm2022/neural-ui-core-input.mjs.map +1 -1
- package/fesm2022/neural-ui-core-listbox.mjs +219 -0
- package/fesm2022/neural-ui-core-listbox.mjs.map +1 -0
- package/fesm2022/neural-ui-core-menu.mjs +229 -0
- package/fesm2022/neural-ui-core-menu.mjs.map +1 -0
- package/fesm2022/neural-ui-core-modal.mjs +34 -10
- package/fesm2022/neural-ui-core-modal.mjs.map +1 -1
- package/fesm2022/neural-ui-core-multiselect.mjs +159 -174
- package/fesm2022/neural-ui-core-multiselect.mjs.map +1 -1
- package/fesm2022/neural-ui-core-number-input.mjs +2 -2
- package/fesm2022/neural-ui-core-number-input.mjs.map +1 -1
- package/fesm2022/neural-ui-core-panel.mjs +92 -0
- package/fesm2022/neural-ui-core-panel.mjs.map +1 -0
- package/fesm2022/neural-ui-core-password.mjs +106 -0
- package/fesm2022/neural-ui-core-password.mjs.map +1 -0
- package/fesm2022/neural-ui-core-pick-list.mjs +133 -0
- package/fesm2022/neural-ui-core-pick-list.mjs.map +1 -0
- package/fesm2022/neural-ui-core-select.mjs +118 -162
- package/fesm2022/neural-ui-core-select.mjs.map +1 -1
- package/fesm2022/neural-ui-core-sidebar.mjs +14 -3
- package/fesm2022/neural-ui-core-sidebar.mjs.map +1 -1
- package/fesm2022/neural-ui-core-slider.mjs +2 -2
- package/fesm2022/neural-ui-core-slider.mjs.map +1 -1
- package/fesm2022/neural-ui-core-spinner.mjs +19 -9
- package/fesm2022/neural-ui-core-spinner.mjs.map +1 -1
- package/fesm2022/neural-ui-core-split-button.mjs +2 -2
- package/fesm2022/neural-ui-core-split-button.mjs.map +1 -1
- package/fesm2022/neural-ui-core-table.mjs +501 -62
- package/fesm2022/neural-ui-core-table.mjs.map +1 -1
- package/fesm2022/neural-ui-core-tags.mjs +134 -0
- package/fesm2022/neural-ui-core-tags.mjs.map +1 -0
- package/fesm2022/neural-ui-core-textarea.mjs +2 -2
- package/fesm2022/neural-ui-core-textarea.mjs.map +1 -1
- package/fesm2022/neural-ui-core-toggle-button-group.mjs +2 -2
- package/fesm2022/neural-ui-core-toggle-button-group.mjs.map +1 -1
- package/fesm2022/neural-ui-core-toolbar.mjs +16 -4
- package/fesm2022/neural-ui-core-toolbar.mjs.map +1 -1
- package/fesm2022/neural-ui-core-tree-select.mjs +259 -0
- package/fesm2022/neural-ui-core-tree-select.mjs.map +1 -0
- package/fesm2022/neural-ui-core-tree-table.mjs +267 -8
- package/fesm2022/neural-ui-core-tree-table.mjs.map +1 -1
- package/fesm2022/neural-ui-core-tree.mjs +15 -14
- package/fesm2022/neural-ui-core-tree.mjs.map +1 -1
- package/fesm2022/neural-ui-core-uploader.mjs +103 -12
- package/fesm2022/neural-ui-core-uploader.mjs.map +1 -1
- package/form-field/package.json +4 -0
- package/inline-editor/package.json +4 -0
- package/input-mask/package.json +4 -0
- package/listbox/package.json +4 -0
- package/menu/package.json +4 -0
- package/package.json +53 -1
- package/panel/package.json +4 -0
- package/password/package.json +4 -0
- package/pick-list/package.json +4 -0
- package/styles/_tokens.scss +30 -15
- package/tags/package.json +4 -0
- package/tree-select/package.json +4 -0
- package/types/neural-ui-core-alert.d.ts +2 -1
- package/types/neural-ui-core-autocomplete.d.ts +20 -2
- package/types/neural-ui-core-bottom-sheet.d.ts +20 -0
- package/types/neural-ui-core-checkbox.d.ts +6 -1
- package/types/neural-ui-core-confirm-popup.d.ts +38 -0
- package/types/neural-ui-core-data-view.d.ts +95 -0
- package/types/neural-ui-core-date-input.d.ts +35 -5
- package/types/neural-ui-core-empty-state.d.ts +11 -1
- package/types/neural-ui-core-form-field.d.ts +33 -0
- package/types/neural-ui-core-inline-editor.d.ts +66 -0
- package/types/neural-ui-core-input-mask.d.ts +26 -0
- package/types/neural-ui-core-listbox.d.ts +54 -0
- package/types/neural-ui-core-menu.d.ts +49 -0
- package/types/neural-ui-core-modal.d.ts +10 -2
- package/types/neural-ui-core-multiselect.d.ts +8 -1
- package/types/neural-ui-core-panel.d.ts +25 -0
- package/types/neural-ui-core-password.d.ts +29 -0
- package/types/neural-ui-core-pick-list.d.ts +40 -0
- package/types/neural-ui-core-select.d.ts +5 -1
- package/types/neural-ui-core-sidebar.d.ts +5 -1
- package/types/neural-ui-core-spinner.d.ts +4 -2
- package/types/neural-ui-core-table.d.ts +89 -5
- package/types/neural-ui-core-tags.d.ts +32 -0
- package/types/neural-ui-core-toolbar.d.ts +8 -2
- package/types/neural-ui-core-tree-select.d.ts +57 -0
- package/types/neural-ui-core-tree-table.d.ts +111 -4
- package/types/neural-ui-core-tree.d.ts +1 -1
- package/types/neural-ui-core-uploader.d.ts +26 -3
|
@@ -186,7 +186,7 @@ class NeuCodeBlockComponent {
|
|
|
186
186
|
tabindex="0"
|
|
187
187
|
><code class="neu-code-block__code">{{ code() }}</code></pre>
|
|
188
188
|
</div>
|
|
189
|
-
`, isInline: true, styles: [".neu-code-block{border-radius:var(--neu-radius-lg);overflow:hidden;border:1px solid var(--neu-code-block-border);font-family:var(--neu-font-mono)}.neu-code-block__header{display:flex;align-items:center;gap:var(--neu-space-3);padding:10px 16px;background:var(--neu-code-block-bar-bg);border-bottom:1px solid var(--neu-code-block-border)}.neu-code-block__dots{display:flex;gap:6px;flex-shrink:0}.neu-code-block__dots span{display:block;width:12px;height:12px;border-radius:50%}.neu-code-block__dots span:nth-child(1){background:#ff5f57}.neu-code-block__dots span:nth-child(2){background:#febc2e}.neu-code-block__dots span:nth-child(3){background:#28c840}.neu-code-block__lang{flex:1;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--neu-code-block-accent);font-family:var(--neu-font-mono)}.neu-code-block__copy{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;background:var(--neu-code-block-
|
|
189
|
+
`, isInline: true, styles: [".neu-code-block{border-radius:var(--neu-radius-lg);overflow:hidden;border:1px solid var(--neu-code-block-border, rgba(255, 255, 255, .14));font-family:var(--neu-font-mono)}.neu-code-block__header{display:flex;align-items:center;gap:var(--neu-space-3);padding:10px 16px;background:var(--neu-code-block-bar-bg, #16161e);border-bottom:1px solid var(--neu-code-block-border, rgba(255, 255, 255, .14))}.neu-code-block__dots{display:flex;gap:6px;flex-shrink:0}.neu-code-block__dots span{display:block;width:12px;height:12px;border-radius:50%}.neu-code-block__dots span:nth-child(1){background:#ff5f57}.neu-code-block__dots span:nth-child(2){background:#febc2e}.neu-code-block__dots span:nth-child(3){background:#28c840}.neu-code-block__lang{flex:1;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--neu-code-block-accent, #9ab8ff);font-family:var(--neu-font-mono)}.neu-code-block__copy{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;background:var(--neu-code-block-copy-bg, rgba(255, 255, 255, .12));border:1px solid var(--neu-code-block-copy-border, rgba(255, 255, 255, .22));border-radius:6px;font-size:11px;font-weight:500;color:var(--neu-code-block-copy-text, #d9e2ff);cursor:pointer;font-family:var(--neu-font-sans);transition:all var(--neu-transition);flex-shrink:0}.neu-code-block__copy svg{width:12px;height:12px;flex-shrink:0}.neu-code-block__copy:hover{background:var(--neu-code-block-copy-hover-bg, rgba(255, 255, 255, .18));color:var(--neu-code-block-copy-hover-text, #ffffff);border-color:var(--neu-code-block-copy-hover-border, rgba(255, 255, 255, .34))}.neu-code-block__pre{margin:0;padding:20px 24px;background:var(--neu-code-block-bg, #1a1b26);overflow-x:auto;scrollbar-width:thin;scrollbar-color:var(--neu-code-block-muted, #8f99bd) transparent}.neu-code-block__pre::-webkit-scrollbar{height:4px}.neu-code-block__pre::-webkit-scrollbar-track{background:transparent}.neu-code-block__pre::-webkit-scrollbar-thumb{background:var(--neu-code-block-muted, #8f99bd);border-radius:99px}.neu-code-block__code{display:block;font-size:13.5px;line-height:1.75;color:var(--neu-code-block-text, #d9e2ff);font-family:inherit;white-space:pre;tab-size:2}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
190
190
|
}
|
|
191
191
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: NeuCodeBlockComponent, decorators: [{
|
|
192
192
|
type: Component,
|
|
@@ -240,7 +240,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
240
240
|
tabindex="0"
|
|
241
241
|
><code class="neu-code-block__code">{{ code() }}</code></pre>
|
|
242
242
|
</div>
|
|
243
|
-
`, host: { '[attr.lang]': 'null' }, styles: [".neu-code-block{border-radius:var(--neu-radius-lg);overflow:hidden;border:1px solid var(--neu-code-block-border);font-family:var(--neu-font-mono)}.neu-code-block__header{display:flex;align-items:center;gap:var(--neu-space-3);padding:10px 16px;background:var(--neu-code-block-bar-bg);border-bottom:1px solid var(--neu-code-block-border)}.neu-code-block__dots{display:flex;gap:6px;flex-shrink:0}.neu-code-block__dots span{display:block;width:12px;height:12px;border-radius:50%}.neu-code-block__dots span:nth-child(1){background:#ff5f57}.neu-code-block__dots span:nth-child(2){background:#febc2e}.neu-code-block__dots span:nth-child(3){background:#28c840}.neu-code-block__lang{flex:1;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--neu-code-block-accent);font-family:var(--neu-font-mono)}.neu-code-block__copy{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;background:var(--neu-code-block-
|
|
243
|
+
`, host: { '[attr.lang]': 'null' }, styles: [".neu-code-block{border-radius:var(--neu-radius-lg);overflow:hidden;border:1px solid var(--neu-code-block-border, rgba(255, 255, 255, .14));font-family:var(--neu-font-mono)}.neu-code-block__header{display:flex;align-items:center;gap:var(--neu-space-3);padding:10px 16px;background:var(--neu-code-block-bar-bg, #16161e);border-bottom:1px solid var(--neu-code-block-border, rgba(255, 255, 255, .14))}.neu-code-block__dots{display:flex;gap:6px;flex-shrink:0}.neu-code-block__dots span{display:block;width:12px;height:12px;border-radius:50%}.neu-code-block__dots span:nth-child(1){background:#ff5f57}.neu-code-block__dots span:nth-child(2){background:#febc2e}.neu-code-block__dots span:nth-child(3){background:#28c840}.neu-code-block__lang{flex:1;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--neu-code-block-accent, #9ab8ff);font-family:var(--neu-font-mono)}.neu-code-block__copy{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;background:var(--neu-code-block-copy-bg, rgba(255, 255, 255, .12));border:1px solid var(--neu-code-block-copy-border, rgba(255, 255, 255, .22));border-radius:6px;font-size:11px;font-weight:500;color:var(--neu-code-block-copy-text, #d9e2ff);cursor:pointer;font-family:var(--neu-font-sans);transition:all var(--neu-transition);flex-shrink:0}.neu-code-block__copy svg{width:12px;height:12px;flex-shrink:0}.neu-code-block__copy:hover{background:var(--neu-code-block-copy-hover-bg, rgba(255, 255, 255, .18));color:var(--neu-code-block-copy-hover-text, #ffffff);border-color:var(--neu-code-block-copy-hover-border, rgba(255, 255, 255, .34))}.neu-code-block__pre{margin:0;padding:20px 24px;background:var(--neu-code-block-bg, #1a1b26);overflow-x:auto;scrollbar-width:thin;scrollbar-color:var(--neu-code-block-muted, #8f99bd) transparent}.neu-code-block__pre::-webkit-scrollbar{height:4px}.neu-code-block__pre::-webkit-scrollbar-track{background:transparent}.neu-code-block__pre::-webkit-scrollbar-thumb{background:var(--neu-code-block-muted, #8f99bd);border-radius:99px}.neu-code-block__code{display:block;font-size:13.5px;line-height:1.75;color:var(--neu-code-block-text, #d9e2ff);font-family:inherit;white-space:pre;tab-size:2}\n"] }]
|
|
244
244
|
}], ctorParameters: () => [], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "code", required: false }] }], lang: [{ type: i0.Input, args: [{ isSignal: true, alias: "lang", required: false }] }], language: [{ type: i0.Input, args: [{ isSignal: true, alias: "language", required: false }] }], copyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyLabel", required: false }] }], copiedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "copiedLabel", required: false }] }], copyAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyAriaLabel", required: false }] }], copiedAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "copiedAriaLabel", required: false }] }] } });
|
|
245
245
|
|
|
246
246
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neural-ui-core-code-block.mjs","sources":["../../../../projects/ui-core/code-block/neu-code-block.component.ts","../../../../projects/ui-core/code-block/neural-ui-core-code-block.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\n/**\n * NeuralUI Code Block\n *\n * Bloque de código con estilo editor oscuro (Tokyo Night).\n * Incluye botón de copiar al portapapeles, badge del lenguaje\n * y soporte para resaltado futuro con ngx-highlightjs.\n *\n * Uso:\n * <neu-code-block [code]=\"snippet\" lang=\"TypeScript\" />\n *\n * Con ngx-highlightjs instalado, envuelve el <pre> con\n * [highlight]=\"code\" para resaltado automático.\n */\n@Component({\n selector: 'neu-code-block',\n imports: [],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"neu-code-block\">\n <!-- Encabezado del editor -->\n <div class=\"neu-code-block__header\">\n <!-- Traffic lights decorativos -->\n <div class=\"neu-code-block__dots\" aria-hidden=\"true\">\n <span></span><span></span><span></span>\n </div>\n <span class=\"neu-code-block__lang\">{{ displayLang() }}</span>\n <button\n class=\"neu-code-block__copy\"\n type=\"button\"\n [attr.aria-label]=\"copied() ? resolvedCopiedAriaLabel() : resolvedCopyAriaLabel()\"\n (click)=\"copy()\"\n >\n @if (copied()) {\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n {{ resolvedCopiedLabel() }}\n } @else {\n <svg\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 >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1\" />\n </svg>\n {{ resolvedCopyLabel() }}\n }\n </button>\n </div>\n\n <!-- Bloque de código -->\n <pre\n class=\"neu-code-block__pre\"\n tabindex=\"0\"\n ><code class=\"neu-code-block__code\">{{ code() }}</code></pre>\n </div>\n `,\n host: { '[attr.lang]': 'null' },\n styleUrl: './neu-code-block.component.scss',\n})\nexport class NeuCodeBlockComponent {\n private readonly doc = inject(DOCUMENT);\n private readonly destroyRef = inject(DestroyRef);\n\n /** Código fuente a mostrar / Source code to display */\n code = input<string>('');\n\n /** Nombre del lenguaje (decorativo) / Language name (decorative) */\n lang = input<string>('');\n\n /**\n * Identificador de lenguaje estándar (typescript, scss, html, bash…).\n * Genera automáticamente el label legible para el badge.\n * Language identifier — auto-generates a readable badge label.\n */\n language = input<string>('');\n\n /** Label legible derivado de lang o language / Readable label derived from lang or language */\n protected readonly displayLang = computed(() => {\n const explicit = this.lang();\n if (explicit) return explicit;\n const id = this.language().toLowerCase().trim();\n const map: Record<string, string> = {\n typescript: 'TypeScript',\n javascript: 'JavaScript',\n ts: 'TypeScript',\n js: 'JavaScript',\n scss: 'SCSS',\n css: 'CSS',\n less: 'Less',\n html: 'HTML',\n xml: 'XML',\n bash: 'Bash',\n shell: 'Shell',\n sh: 'Shell',\n json: 'JSON',\n yaml: 'YAML',\n yml: 'YAML',\n angular: 'Angular',\n jsx: 'JSX',\n tsx: 'TSX',\n };\n return map[id] ?? (id ? id.toUpperCase() : 'TypeScript');\n });\n\n /** Texto del botón cuando no se ha copiado / Button text when not yet copied */\n copyLabel = input<string | undefined>(undefined);\n\n /** Texto del botón tras copiar / Button text after copying */\n copiedLabel = input<string | undefined>(undefined);\n\n /** Aria-label del botón copiar / Aria-label for the copy button */\n copyAriaLabel = input<string | undefined>(undefined);\n\n /** Aria-label del botón tras copiar / Aria-label for the button after copying */\n copiedAriaLabel = input<string | undefined>(undefined);\n\n private readonly localeLabels = signal(this._getLocaleLabels());\n\n protected readonly resolvedCopyLabel = computed(\n () => this._resolveInputLabel(this.copyLabel()) ?? this.localeLabels().copyLabel,\n );\n\n protected readonly resolvedCopiedLabel = computed(\n () => this._resolveInputLabel(this.copiedLabel()) ?? this.localeLabels().copiedLabel,\n );\n\n protected readonly resolvedCopyAriaLabel = computed(\n () => this._resolveInputLabel(this.copyAriaLabel()) ?? this.localeLabels().copyAriaLabel,\n );\n\n protected readonly resolvedCopiedAriaLabel = computed(\n () => this._resolveInputLabel(this.copiedAriaLabel()) ?? this.localeLabels().copiedAriaLabel,\n );\n\n protected readonly copied = signal(false);\n private _copyTimer?: ReturnType<typeof setTimeout>;\n\n constructor() {\n const root = this.doc.documentElement;\n const win = this.doc.defaultView;\n\n this.destroyRef.onDestroy(() => clearTimeout(this._copyTimer));\n\n if (!root || !win?.MutationObserver) return;\n\n const observer = new win.MutationObserver(() => {\n this.localeLabels.set(this._getLocaleLabels());\n });\n\n observer.observe(root, {\n attributes: true,\n attributeFilter: ['lang'],\n });\n\n this.destroyRef.onDestroy(() => observer.disconnect());\n }\n\n copy(): void {\n const text = this.code();\n const win = this.doc.defaultView;\n\n if (win?.navigator?.clipboard) {\n void win.navigator.clipboard.writeText(text).then(() => this._markCopied());\n } else {\n // Fallback para HTTP o navegadores sin Clipboard API\n const ta = this.doc.createElement('textarea');\n ta.value = text;\n ta.style.cssText = 'position:fixed;top:0;left:0;opacity:0;pointer-events:none';\n this.doc.body.appendChild(ta);\n ta.focus();\n ta.select();\n try {\n this.doc.execCommand('copy');\n this._markCopied();\n } finally {\n this.doc.body.removeChild(ta);\n }\n }\n }\n\n private _markCopied(): void {\n this.copied.set(true);\n clearTimeout(this._copyTimer);\n this._copyTimer = setTimeout(() => this.copied.set(false), 2000);\n }\n\n private _getLocaleLabels(): {\n copyLabel: string;\n copiedLabel: string;\n copyAriaLabel: string;\n copiedAriaLabel: string;\n } {\n const lang = this.doc.documentElement?.lang?.toLowerCase() ?? 'en';\n\n if (lang.startsWith('es')) {\n return {\n copyLabel: 'Copiar',\n copiedLabel: 'Copiado',\n copyAriaLabel: 'Copiar código',\n copiedAriaLabel: 'Código copiado',\n };\n }\n\n return {\n copyLabel: 'Copy',\n copiedLabel: 'Copied',\n copyAriaLabel: 'Copy code',\n copiedAriaLabel: 'Code copied',\n };\n }\n\n private _resolveInputLabel(value: string | undefined): string | undefined {\n const trimmed = value?.trim();\n return trimmed ? value : undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;AAYA;;;;;;;;;;;;AAYG;MA4DU,qBAAqB,CAAA;AACf,IAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;AACtB,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;;AAGhD,IAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;;AAGxB,IAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;AAExB;;;;AAIG;AACH,IAAA,QAAQ,GAAG,KAAK,CAAS,EAAE,+EAAC;;AAGT,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAK;AAC7C,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE;AAC5B,QAAA,IAAI,QAAQ;AAAE,YAAA,OAAO,QAAQ;AAC7B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AAA,EAAA,CAAA;;4FAIU,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBA3DjC,SAAS;+BACE,gBAAgB,EAAA,OAAA,EACjB,EAAE,EAAA,aAAA,EACI,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDT,EAAA,CAAA,EAAA,IAAA,EACK,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA,MAAA,EAAA,CAAA,27DAAA,CAAA,EAAA;;;ACjFjC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"neural-ui-core-code-block.mjs","sources":["../../../../projects/ui-core/code-block/neu-code-block.component.ts","../../../../projects/ui-core/code-block/neural-ui-core-code-block.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\n/**\n * NeuralUI Code Block\n *\n * Bloque de código con estilo editor oscuro (Tokyo Night).\n * Incluye botón de copiar al portapapeles, badge del lenguaje\n * y soporte para resaltado futuro con ngx-highlightjs.\n *\n * Uso:\n * <neu-code-block [code]=\"snippet\" lang=\"TypeScript\" />\n *\n * Con ngx-highlightjs instalado, envuelve el <pre> con\n * [highlight]=\"code\" para resaltado automático.\n */\n@Component({\n selector: 'neu-code-block',\n imports: [],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"neu-code-block\">\n <!-- Encabezado del editor -->\n <div class=\"neu-code-block__header\">\n <!-- Traffic lights decorativos -->\n <div class=\"neu-code-block__dots\" aria-hidden=\"true\">\n <span></span><span></span><span></span>\n </div>\n <span class=\"neu-code-block__lang\">{{ displayLang() }}</span>\n <button\n class=\"neu-code-block__copy\"\n type=\"button\"\n [attr.aria-label]=\"copied() ? resolvedCopiedAriaLabel() : resolvedCopyAriaLabel()\"\n (click)=\"copy()\"\n >\n @if (copied()) {\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n {{ resolvedCopiedLabel() }}\n } @else {\n <svg\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 >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1\" />\n </svg>\n {{ resolvedCopyLabel() }}\n }\n </button>\n </div>\n\n <!-- Bloque de código -->\n <pre\n class=\"neu-code-block__pre\"\n tabindex=\"0\"\n ><code class=\"neu-code-block__code\">{{ code() }}</code></pre>\n </div>\n `,\n host: { '[attr.lang]': 'null' },\n styleUrl: './neu-code-block.component.scss',\n})\nexport class NeuCodeBlockComponent {\n private readonly doc = inject(DOCUMENT);\n private readonly destroyRef = inject(DestroyRef);\n\n /** Código fuente a mostrar / Source code to display */\n code = input<string>('');\n\n /** Nombre del lenguaje (decorativo) / Language name (decorative) */\n lang = input<string>('');\n\n /**\n * Identificador de lenguaje estándar (typescript, scss, html, bash…).\n * Genera automáticamente el label legible para el badge.\n * Language identifier — auto-generates a readable badge label.\n */\n language = input<string>('');\n\n /** Label legible derivado de lang o language / Readable label derived from lang or language */\n protected readonly displayLang = computed(() => {\n const explicit = this.lang();\n if (explicit) return explicit;\n const id = this.language().toLowerCase().trim();\n const map: Record<string, string> = {\n typescript: 'TypeScript',\n javascript: 'JavaScript',\n ts: 'TypeScript',\n js: 'JavaScript',\n scss: 'SCSS',\n css: 'CSS',\n less: 'Less',\n html: 'HTML',\n xml: 'XML',\n bash: 'Bash',\n shell: 'Shell',\n sh: 'Shell',\n json: 'JSON',\n yaml: 'YAML',\n yml: 'YAML',\n angular: 'Angular',\n jsx: 'JSX',\n tsx: 'TSX',\n };\n return map[id] ?? (id ? id.toUpperCase() : 'TypeScript');\n });\n\n /** Texto del botón cuando no se ha copiado / Button text when not yet copied */\n copyLabel = input<string | undefined>(undefined);\n\n /** Texto del botón tras copiar / Button text after copying */\n copiedLabel = input<string | undefined>(undefined);\n\n /** Aria-label del botón copiar / Aria-label for the copy button */\n copyAriaLabel = input<string | undefined>(undefined);\n\n /** Aria-label del botón tras copiar / Aria-label for the button after copying */\n copiedAriaLabel = input<string | undefined>(undefined);\n\n private readonly localeLabels = signal(this._getLocaleLabels());\n\n protected readonly resolvedCopyLabel = computed(\n () => this._resolveInputLabel(this.copyLabel()) ?? this.localeLabels().copyLabel,\n );\n\n protected readonly resolvedCopiedLabel = computed(\n () => this._resolveInputLabel(this.copiedLabel()) ?? this.localeLabels().copiedLabel,\n );\n\n protected readonly resolvedCopyAriaLabel = computed(\n () => this._resolveInputLabel(this.copyAriaLabel()) ?? this.localeLabels().copyAriaLabel,\n );\n\n protected readonly resolvedCopiedAriaLabel = computed(\n () => this._resolveInputLabel(this.copiedAriaLabel()) ?? this.localeLabels().copiedAriaLabel,\n );\n\n protected readonly copied = signal(false);\n private _copyTimer?: ReturnType<typeof setTimeout>;\n\n constructor() {\n const root = this.doc.documentElement;\n const win = this.doc.defaultView;\n\n this.destroyRef.onDestroy(() => clearTimeout(this._copyTimer));\n\n if (!root || !win?.MutationObserver) return;\n\n const observer = new win.MutationObserver(() => {\n this.localeLabels.set(this._getLocaleLabels());\n });\n\n observer.observe(root, {\n attributes: true,\n attributeFilter: ['lang'],\n });\n\n this.destroyRef.onDestroy(() => observer.disconnect());\n }\n\n copy(): void {\n const text = this.code();\n const win = this.doc.defaultView;\n\n if (win?.navigator?.clipboard) {\n void win.navigator.clipboard.writeText(text).then(() => this._markCopied());\n } else {\n // Fallback para HTTP o navegadores sin Clipboard API\n const ta = this.doc.createElement('textarea');\n ta.value = text;\n ta.style.cssText = 'position:fixed;top:0;left:0;opacity:0;pointer-events:none';\n this.doc.body.appendChild(ta);\n ta.focus();\n ta.select();\n try {\n this.doc.execCommand('copy');\n this._markCopied();\n } finally {\n this.doc.body.removeChild(ta);\n }\n }\n }\n\n private _markCopied(): void {\n this.copied.set(true);\n clearTimeout(this._copyTimer);\n this._copyTimer = setTimeout(() => this.copied.set(false), 2000);\n }\n\n private _getLocaleLabels(): {\n copyLabel: string;\n copiedLabel: string;\n copyAriaLabel: string;\n copiedAriaLabel: string;\n } {\n const lang = this.doc.documentElement?.lang?.toLowerCase() ?? 'en';\n\n if (lang.startsWith('es')) {\n return {\n copyLabel: 'Copiar',\n copiedLabel: 'Copiado',\n copyAriaLabel: 'Copiar código',\n copiedAriaLabel: 'Código copiado',\n };\n }\n\n return {\n copyLabel: 'Copy',\n copiedLabel: 'Copied',\n copyAriaLabel: 'Copy code',\n copiedAriaLabel: 'Code copied',\n };\n }\n\n private _resolveInputLabel(value: string | undefined): string | undefined {\n const trimmed = value?.trim();\n return trimmed ? value : undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;AAYA;;;;;;;;;;;;AAYG;MA4DU,qBAAqB,CAAA;AACf,IAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;AACtB,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;;AAGhD,IAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;;AAGxB,IAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;AAExB;;;;AAIG;AACH,IAAA,QAAQ,GAAG,KAAK,CAAS,EAAE,+EAAC;;AAGT,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAK;AAC7C,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE;AAC5B,QAAA,IAAI,QAAQ;AAAE,YAAA,OAAO,QAAQ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A,CAAA,IAAA,EAAA,CAAA;;4FAIU,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBA3DjC,SAAS;+BACE,gBAAgB,EAAA,OAAA,EACjB,EAAE,EAAA,aAAA,EACI,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDT,EAAA,CAAA,EAAA,IAAA,EACK,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA,MAAA,EAAA,CAAA,gqEAAA,CAAA,EAAA;;;ACjFjC;;AAEG;;;;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, Injectable, input, output, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
+
import { NeuButtonComponent } from '@neural-ui/core/button';
|
|
4
|
+
|
|
5
|
+
class NeuConfirmPopupService {
|
|
6
|
+
state = signal(null, ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
7
|
+
resolver = null;
|
|
8
|
+
confirm(options) {
|
|
9
|
+
this.state.set(options);
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
this.resolver = resolve;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
close(value) {
|
|
15
|
+
this.state.set(null);
|
|
16
|
+
this.resolver?.(value);
|
|
17
|
+
this.resolver = null;
|
|
18
|
+
}
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: NeuConfirmPopupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: NeuConfirmPopupService, providedIn: 'root' });
|
|
21
|
+
}
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: NeuConfirmPopupService, decorators: [{
|
|
23
|
+
type: Injectable,
|
|
24
|
+
args: [{ providedIn: 'root' }]
|
|
25
|
+
}] });
|
|
26
|
+
class NeuConfirmPopupComponent {
|
|
27
|
+
service;
|
|
28
|
+
open = input(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
29
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
30
|
+
message = input('', ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
31
|
+
acceptLabel = input('Confirm', ...(ngDevMode ? [{ debugName: "acceptLabel" }] : /* istanbul ignore next */ []));
|
|
32
|
+
rejectLabel = input('Cancel', ...(ngDevMode ? [{ debugName: "rejectLabel" }] : /* istanbul ignore next */ []));
|
|
33
|
+
accepted = output();
|
|
34
|
+
rejected = output();
|
|
35
|
+
constructor(service) {
|
|
36
|
+
this.service = service;
|
|
37
|
+
}
|
|
38
|
+
currentTitle() {
|
|
39
|
+
return this.service.state()?.title ?? this.title();
|
|
40
|
+
}
|
|
41
|
+
currentMessage() {
|
|
42
|
+
return this.service.state()?.message ?? this.message();
|
|
43
|
+
}
|
|
44
|
+
currentAcceptLabel() {
|
|
45
|
+
return this.service.state()?.acceptLabel ?? this.acceptLabel();
|
|
46
|
+
}
|
|
47
|
+
currentRejectLabel() {
|
|
48
|
+
return this.service.state()?.rejectLabel ?? this.rejectLabel();
|
|
49
|
+
}
|
|
50
|
+
accept() {
|
|
51
|
+
this.accepted.emit();
|
|
52
|
+
this.service.close(true);
|
|
53
|
+
}
|
|
54
|
+
reject() {
|
|
55
|
+
this.rejected.emit();
|
|
56
|
+
this.service.close(false);
|
|
57
|
+
}
|
|
58
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: NeuConfirmPopupComponent, deps: [{ token: NeuConfirmPopupService }], target: i0.ɵɵFactoryTarget.Component });
|
|
59
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: NeuConfirmPopupComponent, isStandalone: true, selector: "neu-confirm-popup", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, acceptLabel: { classPropertyName: "acceptLabel", publicName: "acceptLabel", isSignal: true, isRequired: false, transformFunction: null }, rejectLabel: { classPropertyName: "rejectLabel", publicName: "rejectLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { accepted: "accepted", rejected: "rejected" }, host: { classAttribute: "neu-confirm-popup-host" }, ngImport: i0, template: `
|
|
60
|
+
@if (open() || service.state()) {
|
|
61
|
+
<div class="neu-confirm-popup" role="alertdialog" aria-modal="false">
|
|
62
|
+
@if (currentTitle()) {
|
|
63
|
+
<h3>{{ currentTitle() }}</h3>
|
|
64
|
+
}
|
|
65
|
+
<p>{{ currentMessage() }}</p>
|
|
66
|
+
<div class="neu-confirm-popup__actions">
|
|
67
|
+
<button neu-button type="button" class="neu-confirm-popup__reject" variant="secondary" size="sm" (click)="reject()">
|
|
68
|
+
{{ currentRejectLabel() }}
|
|
69
|
+
</button>
|
|
70
|
+
<button neu-button type="button" class="neu-confirm-popup__accept" variant="primary" size="sm" (click)="accept()">
|
|
71
|
+
{{ currentAcceptLabel() }}
|
|
72
|
+
</button>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
}
|
|
76
|
+
`, isInline: true, styles: [".neu-confirm-popup-host{position:relative;display:inline-block}.neu-confirm-popup{position:absolute;z-index:calc(var(--neu-z-overlay, 99) + 1);top:calc(100% + .5rem);left:0;width:min(18rem,100vw - 2rem);border:1px solid var(--neu-border, #d1d5db);border-radius:.75rem;background:var(--neu-surface, #fff);color:var(--neu-text, #111827);box-shadow:var(--neu-shadow-lg, 0 18px 40px rgba(15, 23, 42, .18));padding:1rem}.neu-confirm-popup h3{margin:0 0 .375rem;font-size:1rem}.neu-confirm-popup p{margin:0;color:var(--neu-text-muted, #6b7280)}.neu-confirm-popup__actions{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1rem}\n"], dependencies: [{ kind: "component", type: NeuButtonComponent, selector: "button[neu-button]", inputs: ["variant", "size", "disabled", "loading", "fullWidth", "icon", "iconPosition", "iconOnly", "ariaLabel"], outputs: ["neuClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
77
|
+
}
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: NeuConfirmPopupComponent, decorators: [{
|
|
79
|
+
type: Component,
|
|
80
|
+
args: [{ selector: 'neu-confirm-popup', imports: [NeuButtonComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'neu-confirm-popup-host' }, template: `
|
|
81
|
+
@if (open() || service.state()) {
|
|
82
|
+
<div class="neu-confirm-popup" role="alertdialog" aria-modal="false">
|
|
83
|
+
@if (currentTitle()) {
|
|
84
|
+
<h3>{{ currentTitle() }}</h3>
|
|
85
|
+
}
|
|
86
|
+
<p>{{ currentMessage() }}</p>
|
|
87
|
+
<div class="neu-confirm-popup__actions">
|
|
88
|
+
<button neu-button type="button" class="neu-confirm-popup__reject" variant="secondary" size="sm" (click)="reject()">
|
|
89
|
+
{{ currentRejectLabel() }}
|
|
90
|
+
</button>
|
|
91
|
+
<button neu-button type="button" class="neu-confirm-popup__accept" variant="primary" size="sm" (click)="accept()">
|
|
92
|
+
{{ currentAcceptLabel() }}
|
|
93
|
+
</button>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
}
|
|
97
|
+
`, styles: [".neu-confirm-popup-host{position:relative;display:inline-block}.neu-confirm-popup{position:absolute;z-index:calc(var(--neu-z-overlay, 99) + 1);top:calc(100% + .5rem);left:0;width:min(18rem,100vw - 2rem);border:1px solid var(--neu-border, #d1d5db);border-radius:.75rem;background:var(--neu-surface, #fff);color:var(--neu-text, #111827);box-shadow:var(--neu-shadow-lg, 0 18px 40px rgba(15, 23, 42, .18));padding:1rem}.neu-confirm-popup h3{margin:0 0 .375rem;font-size:1rem}.neu-confirm-popup p{margin:0;color:var(--neu-text-muted, #6b7280)}.neu-confirm-popup__actions{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1rem}\n"] }]
|
|
98
|
+
}], ctorParameters: () => [{ type: NeuConfirmPopupService }], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], acceptLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptLabel", required: false }] }], rejectLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "rejectLabel", required: false }] }], accepted: [{ type: i0.Output, args: ["accepted"] }], rejected: [{ type: i0.Output, args: ["rejected"] }] } });
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generated bundle index. Do not edit.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
export { NeuConfirmPopupComponent, NeuConfirmPopupService };
|
|
105
|
+
//# sourceMappingURL=neural-ui-core-confirm-popup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neural-ui-core-confirm-popup.mjs","sources":["../../../../projects/ui-core/confirm-popup/neu-confirm-popup.component.ts","../../../../projects/ui-core/confirm-popup/neural-ui-core-confirm-popup.ts"],"sourcesContent":["import { Injectable, signal, ChangeDetectionStrategy, Component, ViewEncapsulation, input, output } from '@angular/core';\nimport { NeuButtonComponent } from '@neural-ui/core/button';\n\nexport interface NeuConfirmPopupOptions {\n title?: string;\n message: string;\n acceptLabel?: string;\n rejectLabel?: string;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class NeuConfirmPopupService {\n readonly state = signal<NeuConfirmPopupOptions | null>(null);\n private resolver: ((value: boolean) => void) | null = null;\n\n confirm(options: NeuConfirmPopupOptions): Promise<boolean> {\n this.state.set(options);\n return new Promise((resolve) => {\n this.resolver = resolve;\n });\n }\n\n close(value: boolean): void {\n this.state.set(null);\n this.resolver?.(value);\n this.resolver = null;\n }\n}\n\n@Component({\n selector: 'neu-confirm-popup',\n imports: [NeuButtonComponent],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'neu-confirm-popup-host' },\n template: `\n @if (open() || service.state()) {\n <div class=\"neu-confirm-popup\" role=\"alertdialog\" aria-modal=\"false\">\n @if (currentTitle()) {\n <h3>{{ currentTitle() }}</h3>\n }\n <p>{{ currentMessage() }}</p>\n <div class=\"neu-confirm-popup__actions\">\n <button neu-button type=\"button\" class=\"neu-confirm-popup__reject\" variant=\"secondary\" size=\"sm\" (click)=\"reject()\">\n {{ currentRejectLabel() }}\n </button>\n <button neu-button type=\"button\" class=\"neu-confirm-popup__accept\" variant=\"primary\" size=\"sm\" (click)=\"accept()\">\n {{ currentAcceptLabel() }}\n </button>\n </div>\n </div>\n }\n `,\n styleUrl: './neu-confirm-popup.component.scss',\n})\nexport class NeuConfirmPopupComponent {\n readonly open = input(false);\n readonly title = input('');\n readonly message = input('');\n readonly acceptLabel = input('Confirm');\n readonly rejectLabel = input('Cancel');\n readonly accepted = output<void>();\n readonly rejected = output<void>();\n\n constructor(readonly service: NeuConfirmPopupService) {}\n\n currentTitle(): string {\n return this.service.state()?.title ?? this.title();\n }\n\n currentMessage(): string {\n return this.service.state()?.message ?? this.message();\n }\n\n currentAcceptLabel(): string {\n return this.service.state()?.acceptLabel ?? this.acceptLabel();\n }\n\n currentRejectLabel(): string {\n return this.service.state()?.rejectLabel ?? this.rejectLabel();\n }\n\n accept(): void {\n this.accepted.emit();\n this.service.close(true);\n }\n\n reject(): void {\n this.rejected.emit();\n this.service.close(false);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAWa,sBAAsB,CAAA;AACxB,IAAA,KAAK,GAAG,MAAM,CAAgC,IAAI,4EAAC;IACpD,QAAQ,GAAsC,IAAI;AAE1D,IAAA,OAAO,CAAC,OAA+B,EAAA;AACrC,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;AACvB,QAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC7B,YAAA,IAAI,CAAC,QAAQ,GAAG,OAAO;AACzB,QAAA,CAAC,CAAC;IACJ;AAEA,IAAA,KAAK,CAAC,KAAc,EAAA;AAClB,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;AACtB,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;IACtB;wGAfW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAtB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,cADT,MAAM,EAAA,CAAA;;4FACnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;MA6CrB,wBAAwB,CAAA;AASd,IAAA,OAAA;AARZ,IAAA,IAAI,GAAG,KAAK,CAAC,KAAK,2EAAC;AACnB,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;AACjB,IAAA,OAAO,GAAG,KAAK,CAAC,EAAE,8EAAC;AACnB,IAAA,WAAW,GAAG,KAAK,CAAC,SAAS,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