@blank-software/core-components 0.0.1 → 0.0.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.
Files changed (39) hide show
  1. package/fesm2022/blank-software-core-components.mjs +118 -2
  2. package/fesm2022/blank-software-core-components.mjs.map +1 -1
  3. package/package.json +1 -1
  4. package/src/lib/accordion/accordion.css +5 -0
  5. package/src/lib/alert/alert.css +27 -0
  6. package/src/lib/avatar/avatar.css +0 -0
  7. package/src/lib/badge/badge.css +0 -0
  8. package/src/lib/breadcrumb/breadcrumb.css +0 -0
  9. package/src/lib/button/button.css +83 -0
  10. package/src/lib/card/card.css +31 -0
  11. package/src/lib/checkbox/checkbox.css +53 -0
  12. package/src/lib/date-picker/date-picker.css +0 -0
  13. package/src/lib/dropdown/dropdown.css +0 -0
  14. package/src/lib/file-upload/file-upload.css +0 -0
  15. package/src/lib/footer/footer.css +0 -0
  16. package/src/lib/form-field/form-field.css +0 -0
  17. package/src/lib/header/header.css +23 -0
  18. package/src/lib/icon/icon.css +0 -0
  19. package/src/lib/input/input.css +29 -0
  20. package/src/lib/label/label.css +27 -0
  21. package/src/lib/modal/modal-dialog.css +117 -0
  22. package/src/lib/modal/modal.css +69 -0
  23. package/src/lib/navigation/navigation.css +0 -0
  24. package/src/lib/pagination/pagination.css +76 -0
  25. package/src/lib/progress-bar/progress-bar.css +88 -0
  26. package/src/lib/radio/radio.css +35 -0
  27. package/src/lib/search-bar/search-bar.css +0 -0
  28. package/src/lib/select/select.css +75 -0
  29. package/src/lib/sidebar/sidebar.css +41 -0
  30. package/src/lib/skeleton/skeleton.css +46 -0
  31. package/src/lib/spinner/spinner.css +0 -0
  32. package/src/lib/stepper/stepper.css +0 -0
  33. package/src/lib/table/table.css +97 -0
  34. package/src/lib/tabs/tabs.css +0 -0
  35. package/src/lib/toggle/toggle.css +52 -0
  36. package/src/lib/tooltip/tooltip.css +0 -0
  37. package/src/styles/index.css +34 -0
  38. package/src/styles/theme.css +133 -0
  39. package/types/blank-software-core-components.d.ts +51 -2
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, model, inject, forwardRef, computed, Component, contentChildren, output, HostListener, signal, ElementRef, Injectable } from '@angular/core';
2
+ import { input, booleanAttribute, model, inject, forwardRef, computed, Component, contentChildren, output, HostListener, signal, viewChild, ApplicationRef, EnvironmentInjector, createComponent, Injectable, ElementRef } from '@angular/core';
3
+ import { DOCUMENT } from '@angular/common';
3
4
 
4
5
  class AccordionItem {
5
6
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
@@ -362,6 +363,121 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
362
363
  args: ['document:keydown.escape']
363
364
  }] } });
364
365
 
366
+ class ModalDialog {
367
+ cancelText = signal('Annulla', ...(ngDevMode ? [{ debugName: "cancelText" }] : []));
368
+ closeOnBackdrop = signal(true, ...(ngDevMode ? [{ debugName: "closeOnBackdrop" }] : []));
369
+ closeOnEsc = signal(true, ...(ngDevMode ? [{ debugName: "closeOnEsc" }] : []));
370
+ confirmText = signal('OK', ...(ngDevMode ? [{ debugName: "confirmText" }] : []));
371
+ open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
372
+ showCancel = signal(false, ...(ngDevMode ? [{ debugName: "showCancel" }] : []));
373
+ size = signal('sm', ...(ngDevMode ? [{ debugName: "size" }] : []));
374
+ text = signal('', ...(ngDevMode ? [{ debugName: "text" }] : []));
375
+ title = signal('', ...(ngDevMode ? [{ debugName: "title" }] : []));
376
+ type = signal('confirm', ...(ngDevMode ? [{ debugName: "type" }] : []));
377
+ panel = viewChild('panel', ...(ngDevMode ? [{ debugName: "panel" }] : []));
378
+ resolvePromise;
379
+ configure(options) {
380
+ if (options.title != null)
381
+ this.title.set(options.title);
382
+ if (options.text != null)
383
+ this.text.set(options.text);
384
+ if (options.type != null)
385
+ this.type.set(options.type);
386
+ if (options.size != null)
387
+ this.size.set(options.size);
388
+ if (options.confirmText != null)
389
+ this.confirmText.set(options.confirmText);
390
+ if (options.cancelText != null)
391
+ this.cancelText.set(options.cancelText);
392
+ if (options.showCancel != null)
393
+ this.showCancel.set(options.showCancel);
394
+ if (options.closeOnBackdrop != null)
395
+ this.closeOnBackdrop.set(options.closeOnBackdrop);
396
+ if (options.closeOnEsc != null)
397
+ this.closeOnEsc.set(options.closeOnEsc);
398
+ this.open.set(true);
399
+ return new Promise((resolve) => {
400
+ this.resolvePromise = resolve;
401
+ });
402
+ }
403
+ confirm() {
404
+ this.open.set(false);
405
+ this.resolvePromise({ confirmed: true });
406
+ }
407
+ dismiss() {
408
+ this.open.set(false);
409
+ this.resolvePromise({ confirmed: false });
410
+ }
411
+ onBackdropClick() {
412
+ if (this.closeOnBackdrop()) {
413
+ this.dismiss();
414
+ }
415
+ }
416
+ onEscKey() {
417
+ if (this.open() && this.closeOnEsc()) {
418
+ this.dismiss();
419
+ }
420
+ }
421
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ModalDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
422
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: ModalDialog, isStandalone: true, selector: "bsc-modal-dialog", host: { listeners: { "document:keydown.escape": "onEscKey()" } }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (open()) {\n <!-- Backdrop -->\n <div\n class=\"bsc-modal-backdrop\"\n (click)=\"onBackdropClick()\"\n tabindex=\"-1\"\n role=\"button\"\n aria-label=\"Close modal\"\n ></div>\n\n <!-- Dialog -->\n <div class=\"bsc-modal-overlay\">\n <div class=\"bsc-modal-panel bsc-modal-{{ size() }}\">\n <div class=\"bsc-modal-dialog\" role=\"alertdialog\" aria-modal=\"true\" #panel>\n <!-- Icon -->\n <div class=\"bsc-modal-dialog-icon\" [class]=\"'bsc-modal-dialog-icon-' + type()\">\n @switch (type()) {\n @case ('success') {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n }\n @case ('error') {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n }\n @case ('confirm') {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M12 9v4m0 4h.01M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z\"\n />\n </svg>\n }\n }\n </div>\n\n <!-- Title -->\n @if (title()) {\n <h3 class=\"bsc-modal-dialog-title\">{{ title() }}</h3>\n }\n\n <!-- Text -->\n @if (text()) {\n <p class=\"bsc-modal-dialog-text\">{{ text() }}</p>\n }\n\n <!-- Buttons -->\n <div class=\"bsc-modal-dialog-actions\">\n @if (showCancel()) {\n <button type=\"button\" class=\"bsc-modal-dialog-cancel-btn\" (click)=\"dismiss()\">\n {{ cancelText() }}\n </button>\n }\n <button\n type=\"button\"\n class=\"bsc-modal-dialog-confirm-btn bsc-modal-dialog-btn-{{ type() }}\"\n (click)=\"confirm()\"\n >\n {{ confirmText() }}\n </button>\n </div>\n </div>\n </div>\n </div>\n}\n", styles: ["@reference \"tailwindcss\";.bsc-modal-backdrop{@apply fixed inset-0 z-40 bg-black/40;animation:bsc-modal-fade-in .2s ease-out}.bsc-modal-overlay{@apply overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 flex justify-center items-center w-full h-[calc(100%-1rem)] max-h-full md:inset-0;animation:bsc-modal-slide-in .2s ease-out}@keyframes bsc-modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes bsc-modal-slide-in{0%{opacity:0;transform:translateY(-1rem) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}.bsc-modal-panel{@apply relative p-4 w-full max-h-full;}.bsc-modal-sm{@apply max-w-sm;}.bsc-modal-md{@apply max-w-md;}.bsc-modal-lg{@apply max-w-2xl;}.bsc-modal-dialog{@apply relative bg-surface border border-ink-200 rounded-base shadow-sm p-6 md:p-8 text-center;}.bsc-modal-dialog-icon{@apply mx-auto mb-4 flex items-center justify-center w-16 h-16 rounded-full;}.bsc-modal-dialog-icon-success{@apply bg-green-100 text-green-500;}.bsc-modal-dialog-icon-error{@apply bg-red-100 text-red-500;}.bsc-modal-dialog-icon-confirm{@apply bg-amber-100 text-amber-500;}.bsc-modal-dialog-title{@apply text-lg font-semibold text-ink-900 mb-2;}.bsc-modal-dialog-text{@apply text-sm text-ink-500 mb-6;}.bsc-modal-dialog-actions{@apply flex items-center justify-center gap-3;}.bsc-modal-dialog-confirm-btn{@apply inline-flex items-center font-medium rounded-base text-sm px-5 py-2.5 text-white shadow-xs cursor-pointer focus:ring-4 focus:outline-none;}.bsc-modal-dialog-btn-success{@apply bg-green-500 hover:bg-green-600 focus:ring-green-200;}.bsc-modal-dialog-btn-error{@apply bg-red-500 hover:bg-red-600 focus:ring-red-200;}.bsc-modal-dialog-btn-confirm{@apply bg-primary hover:bg-primary-700 focus:ring-primary-200;}.bsc-modal-dialog-cancel-btn{@apply inline-flex items-center font-medium rounded-base text-sm px-5 py-2.5 text-ink-700 bg-ink-100 hover:bg-ink-200 shadow-xs cursor-pointer focus:ring-4 focus:ring-ink-100 focus:outline-none;}\n"] });
423
+ }
424
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ModalDialog, decorators: [{
425
+ type: Component,
426
+ args: [{ selector: 'bsc-modal-dialog', imports: [], template: "@if (open()) {\n <!-- Backdrop -->\n <div\n class=\"bsc-modal-backdrop\"\n (click)=\"onBackdropClick()\"\n tabindex=\"-1\"\n role=\"button\"\n aria-label=\"Close modal\"\n ></div>\n\n <!-- Dialog -->\n <div class=\"bsc-modal-overlay\">\n <div class=\"bsc-modal-panel bsc-modal-{{ size() }}\">\n <div class=\"bsc-modal-dialog\" role=\"alertdialog\" aria-modal=\"true\" #panel>\n <!-- Icon -->\n <div class=\"bsc-modal-dialog-icon\" [class]=\"'bsc-modal-dialog-icon-' + type()\">\n @switch (type()) {\n @case ('success') {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n }\n @case ('error') {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n }\n @case ('confirm') {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M12 9v4m0 4h.01M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z\"\n />\n </svg>\n }\n }\n </div>\n\n <!-- Title -->\n @if (title()) {\n <h3 class=\"bsc-modal-dialog-title\">{{ title() }}</h3>\n }\n\n <!-- Text -->\n @if (text()) {\n <p class=\"bsc-modal-dialog-text\">{{ text() }}</p>\n }\n\n <!-- Buttons -->\n <div class=\"bsc-modal-dialog-actions\">\n @if (showCancel()) {\n <button type=\"button\" class=\"bsc-modal-dialog-cancel-btn\" (click)=\"dismiss()\">\n {{ cancelText() }}\n </button>\n }\n <button\n type=\"button\"\n class=\"bsc-modal-dialog-confirm-btn bsc-modal-dialog-btn-{{ type() }}\"\n (click)=\"confirm()\"\n >\n {{ confirmText() }}\n </button>\n </div>\n </div>\n </div>\n </div>\n}\n", styles: ["@reference \"tailwindcss\";.bsc-modal-backdrop{@apply fixed inset-0 z-40 bg-black/40;animation:bsc-modal-fade-in .2s ease-out}.bsc-modal-overlay{@apply overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 flex justify-center items-center w-full h-[calc(100%-1rem)] max-h-full md:inset-0;animation:bsc-modal-slide-in .2s ease-out}@keyframes bsc-modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes bsc-modal-slide-in{0%{opacity:0;transform:translateY(-1rem) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}.bsc-modal-panel{@apply relative p-4 w-full max-h-full;}.bsc-modal-sm{@apply max-w-sm;}.bsc-modal-md{@apply max-w-md;}.bsc-modal-lg{@apply max-w-2xl;}.bsc-modal-dialog{@apply relative bg-surface border border-ink-200 rounded-base shadow-sm p-6 md:p-8 text-center;}.bsc-modal-dialog-icon{@apply mx-auto mb-4 flex items-center justify-center w-16 h-16 rounded-full;}.bsc-modal-dialog-icon-success{@apply bg-green-100 text-green-500;}.bsc-modal-dialog-icon-error{@apply bg-red-100 text-red-500;}.bsc-modal-dialog-icon-confirm{@apply bg-amber-100 text-amber-500;}.bsc-modal-dialog-title{@apply text-lg font-semibold text-ink-900 mb-2;}.bsc-modal-dialog-text{@apply text-sm text-ink-500 mb-6;}.bsc-modal-dialog-actions{@apply flex items-center justify-center gap-3;}.bsc-modal-dialog-confirm-btn{@apply inline-flex items-center font-medium rounded-base text-sm px-5 py-2.5 text-white shadow-xs cursor-pointer focus:ring-4 focus:outline-none;}.bsc-modal-dialog-btn-success{@apply bg-green-500 hover:bg-green-600 focus:ring-green-200;}.bsc-modal-dialog-btn-error{@apply bg-red-500 hover:bg-red-600 focus:ring-red-200;}.bsc-modal-dialog-btn-confirm{@apply bg-primary hover:bg-primary-700 focus:ring-primary-200;}.bsc-modal-dialog-cancel-btn{@apply inline-flex items-center font-medium rounded-base text-sm px-5 py-2.5 text-ink-700 bg-ink-100 hover:bg-ink-200 shadow-xs cursor-pointer focus:ring-4 focus:ring-ink-100 focus:outline-none;}\n"] }]
427
+ }], propDecorators: { panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], onEscKey: [{
428
+ type: HostListener,
429
+ args: ['document:keydown.escape']
430
+ }] } });
431
+
432
+ class ModalService {
433
+ appRef = inject(ApplicationRef);
434
+ document = inject(DOCUMENT);
435
+ injector = inject(EnvironmentInjector);
436
+ confirm(options) {
437
+ return this.fire({
438
+ confirmText: 'Conferma',
439
+ showCancel: true,
440
+ ...options,
441
+ type: 'confirm',
442
+ });
443
+ }
444
+ error(options) {
445
+ return this.fire({
446
+ confirmText: 'OK',
447
+ ...options,
448
+ type: 'error',
449
+ });
450
+ }
451
+ fire(options) {
452
+ const componentRef = createComponent(ModalDialog, {
453
+ environmentInjector: this.injector,
454
+ });
455
+ this.appRef.attachView(componentRef.hostView);
456
+ this.document.body.appendChild(componentRef.location.nativeElement);
457
+ const promise = componentRef.instance.configure(options);
458
+ return promise.then((result) => {
459
+ this.appRef.detachView(componentRef.hostView);
460
+ componentRef.destroy();
461
+ return result;
462
+ });
463
+ }
464
+ success(options) {
465
+ return this.fire({
466
+ confirmText: 'OK',
467
+ ...options,
468
+ type: 'success',
469
+ });
470
+ }
471
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
472
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ModalService, providedIn: 'root' });
473
+ }
474
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ModalService, decorators: [{
475
+ type: Injectable,
476
+ args: [{
477
+ providedIn: 'root',
478
+ }]
479
+ }] });
480
+
365
481
  class Navigation {
366
482
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: Navigation, deps: [], target: i0.ɵɵFactoryTarget.Component });
367
483
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.0", type: Navigation, isStandalone: true, selector: "bsc-navigation", ngImport: i0, template: "<p>navigation works!</p>\n", styles: [""] });
@@ -858,5 +974,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
858
974
  * Generated bundle index. Do not edit.
859
975
  */
860
976
 
861
- export { Accordion, AccordionItem, Alert, Avatar, Badge, Breadcrumb, Button, Card, Checkbox, DatePicker, Dropdown, FileUpload, Footer, FormField, Header, Icon, Input, Label, Modal, Navigation, Pagination, ProgressBar, Radio, SearchBar, Select, Sidebar, SidebarService, Skeleton, Spinner, Stepper, Table, Tabs, Toggle, Tooltip };
977
+ export { Accordion, AccordionItem, Alert, Avatar, Badge, Breadcrumb, Button, Card, Checkbox, DatePicker, Dropdown, FileUpload, Footer, FormField, Header, Icon, Input, Label, Modal, ModalDialog, ModalService, Navigation, Pagination, ProgressBar, Radio, SearchBar, Select, Sidebar, SidebarService, Skeleton, Spinner, Stepper, Table, Tabs, Toggle, Tooltip };
862
978
  //# sourceMappingURL=blank-software-core-components.mjs.map