@masmarino/gabarit 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/button/README.md +11 -4
  2. package/fesm2022/masmarino-gabarit-alert.mjs +2 -2
  3. package/fesm2022/masmarino-gabarit-alert.mjs.map +1 -1
  4. package/fesm2022/masmarino-gabarit-app-shell.mjs +2 -2
  5. package/fesm2022/masmarino-gabarit-app-shell.mjs.map +1 -1
  6. package/fesm2022/masmarino-gabarit-auth-register.mjs +2 -2
  7. package/fesm2022/masmarino-gabarit-auth-register.mjs.map +1 -1
  8. package/fesm2022/masmarino-gabarit-autocomplete.mjs +2 -2
  9. package/fesm2022/masmarino-gabarit-autocomplete.mjs.map +1 -1
  10. package/fesm2022/masmarino-gabarit-avatar-group.mjs +2 -2
  11. package/fesm2022/masmarino-gabarit-avatar-group.mjs.map +1 -1
  12. package/fesm2022/masmarino-gabarit-badge.mjs +4 -4
  13. package/fesm2022/masmarino-gabarit-badge.mjs.map +1 -1
  14. package/fesm2022/masmarino-gabarit-button.mjs +2 -2
  15. package/fesm2022/masmarino-gabarit-button.mjs.map +1 -1
  16. package/fesm2022/masmarino-gabarit-card.mjs +4 -4
  17. package/fesm2022/masmarino-gabarit-card.mjs.map +1 -1
  18. package/fesm2022/masmarino-gabarit-chart.mjs +6 -6
  19. package/fesm2022/masmarino-gabarit-chart.mjs.map +1 -1
  20. package/fesm2022/masmarino-gabarit-checkbox.mjs +4 -4
  21. package/fesm2022/masmarino-gabarit-checkbox.mjs.map +1 -1
  22. package/fesm2022/masmarino-gabarit-command-palette.mjs +4 -4
  23. package/fesm2022/masmarino-gabarit-command-palette.mjs.map +1 -1
  24. package/fesm2022/masmarino-gabarit-copy-field.mjs +2 -2
  25. package/fesm2022/masmarino-gabarit-copy-field.mjs.map +1 -1
  26. package/fesm2022/masmarino-gabarit-date-picker.mjs +4 -4
  27. package/fesm2022/masmarino-gabarit-date-picker.mjs.map +1 -1
  28. package/fesm2022/masmarino-gabarit-disclosure.mjs +2 -2
  29. package/fesm2022/masmarino-gabarit-disclosure.mjs.map +1 -1
  30. package/fesm2022/masmarino-gabarit-docs.mjs +10 -10
  31. package/fesm2022/masmarino-gabarit-docs.mjs.map +1 -1
  32. package/fesm2022/masmarino-gabarit-drawer.mjs +2 -2
  33. package/fesm2022/masmarino-gabarit-drawer.mjs.map +1 -1
  34. package/fesm2022/masmarino-gabarit-file-upload.mjs +2 -2
  35. package/fesm2022/masmarino-gabarit-file-upload.mjs.map +1 -1
  36. package/fesm2022/masmarino-gabarit-input.mjs +2 -2
  37. package/fesm2022/masmarino-gabarit-input.mjs.map +1 -1
  38. package/fesm2022/masmarino-gabarit-job-graph.mjs +2 -2
  39. package/fesm2022/masmarino-gabarit-job-graph.mjs.map +1 -1
  40. package/fesm2022/masmarino-gabarit-list-row.mjs +2 -2
  41. package/fesm2022/masmarino-gabarit-list-row.mjs.map +1 -1
  42. package/fesm2022/masmarino-gabarit-list-toolbar.mjs +2 -2
  43. package/fesm2022/masmarino-gabarit-list-toolbar.mjs.map +1 -1
  44. package/fesm2022/masmarino-gabarit-menu.mjs +2 -2
  45. package/fesm2022/masmarino-gabarit-menu.mjs.map +1 -1
  46. package/fesm2022/masmarino-gabarit-mfa-enrollment.mjs +4 -4
  47. package/fesm2022/masmarino-gabarit-mfa-enrollment.mjs.map +1 -1
  48. package/fesm2022/masmarino-gabarit-mfa-settings.mjs +2 -2
  49. package/fesm2022/masmarino-gabarit-mfa-settings.mjs.map +1 -1
  50. package/fesm2022/masmarino-gabarit-modal.mjs +2 -2
  51. package/fesm2022/masmarino-gabarit-modal.mjs.map +1 -1
  52. package/fesm2022/masmarino-gabarit-nav-tabs.mjs +2 -2
  53. package/fesm2022/masmarino-gabarit-nav-tabs.mjs.map +1 -1
  54. package/fesm2022/masmarino-gabarit-pagination.mjs +2 -2
  55. package/fesm2022/masmarino-gabarit-pagination.mjs.map +1 -1
  56. package/fesm2022/masmarino-gabarit-passkey-settings.mjs +2 -2
  57. package/fesm2022/masmarino-gabarit-passkey-settings.mjs.map +1 -1
  58. package/fesm2022/masmarino-gabarit-popover.mjs +2 -2
  59. package/fesm2022/masmarino-gabarit-popover.mjs.map +1 -1
  60. package/fesm2022/masmarino-gabarit-search-bar.mjs +2 -2
  61. package/fesm2022/masmarino-gabarit-search-bar.mjs.map +1 -1
  62. package/fesm2022/masmarino-gabarit-secret-reveal.mjs +2 -2
  63. package/fesm2022/masmarino-gabarit-secret-reveal.mjs.map +1 -1
  64. package/fesm2022/masmarino-gabarit-segmented-control.mjs +47 -5
  65. package/fesm2022/masmarino-gabarit-segmented-control.mjs.map +1 -1
  66. package/fesm2022/masmarino-gabarit-select.mjs +2 -2
  67. package/fesm2022/masmarino-gabarit-select.mjs.map +1 -1
  68. package/fesm2022/masmarino-gabarit-skeleton-list.mjs +2 -2
  69. package/fesm2022/masmarino-gabarit-skeleton-list.mjs.map +1 -1
  70. package/fesm2022/masmarino-gabarit-skeleton.mjs +2 -2
  71. package/fesm2022/masmarino-gabarit-skeleton.mjs.map +1 -1
  72. package/fesm2022/masmarino-gabarit-slider.mjs +2 -2
  73. package/fesm2022/masmarino-gabarit-slider.mjs.map +1 -1
  74. package/fesm2022/masmarino-gabarit-sparkline.mjs +2 -2
  75. package/fesm2022/masmarino-gabarit-sparkline.mjs.map +1 -1
  76. package/fesm2022/masmarino-gabarit-stat-tile.mjs +2 -2
  77. package/fesm2022/masmarino-gabarit-stat-tile.mjs.map +1 -1
  78. package/fesm2022/masmarino-gabarit-stepper.mjs +2 -2
  79. package/fesm2022/masmarino-gabarit-stepper.mjs.map +1 -1
  80. package/fesm2022/masmarino-gabarit-switch.mjs +2 -2
  81. package/fesm2022/masmarino-gabarit-switch.mjs.map +1 -1
  82. package/fesm2022/masmarino-gabarit-tabs.mjs +54 -5
  83. package/fesm2022/masmarino-gabarit-tabs.mjs.map +1 -1
  84. package/fesm2022/masmarino-gabarit-tag-input.mjs +2 -2
  85. package/fesm2022/masmarino-gabarit-tag-input.mjs.map +1 -1
  86. package/fesm2022/masmarino-gabarit-tag.mjs +2 -2
  87. package/fesm2022/masmarino-gabarit-tag.mjs.map +1 -1
  88. package/fesm2022/masmarino-gabarit-textarea.mjs +2 -2
  89. package/fesm2022/masmarino-gabarit-textarea.mjs.map +1 -1
  90. package/fesm2022/masmarino-gabarit-tooltip.mjs +2 -2
  91. package/fesm2022/masmarino-gabarit-tooltip.mjs.map +1 -1
  92. package/fesm2022/masmarino-gabarit-tree.mjs +2 -2
  93. package/fesm2022/masmarino-gabarit-tree.mjs.map +1 -1
  94. package/fesm2022/masmarino-gabarit.mjs +1 -1
  95. package/fesm2022/masmarino-gabarit.mjs.map +1 -1
  96. package/package.json +1 -1
  97. package/src/lib/tokens/_glass.scss +140 -0
  98. package/src/lib/tokens/_grounds.scss +10 -0
  99. package/src/lib/tokens/_themes.scss +2 -0
  100. package/src/lib/tokens/_utilities.scss +54 -4
  101. package/types/masmarino-gabarit-button.d.ts +1 -1
  102. package/types/masmarino-gabarit-segmented-control.d.ts +14 -0
  103. package/types/masmarino-gabarit-tabs.d.ts +14 -0
  104. package/types/masmarino-gabarit.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-tag-input.mjs","names":[],"sources":["../../../projects/gabarit/tag-input/tag-input.ts","../../../projects/gabarit/tag-input/tag-input.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n signal,\n viewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { Tag } from '@masmarino/gabarit/tag'\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-tag-input',\n standalone: true,\n imports: [Tag],\n templateUrl: './tag-input.html',\n styleUrl: './tag-input.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TagInput),\n multi: true,\n },\n ],\n})\nexport class TagInput implements ControlValueAccessor {\n private readonly inputRef = viewChild<ElementRef<HTMLInputElement>>('input')\n\n id = input<string>(`gbt-tag-input-${++nextId}`)\n label = input<string>('')\n placeholder = input<string>('')\n disabled = input(false, { transform: booleanAttribute })\n errorMessage = input<string | null>(null)\n separatorKeys = input<string[]>(['Enter', ','])\n allowDuplicates = input(false, { transform: booleanAttribute })\n color = input<string>('#6b7280')\n removeLabel = input<(value: string) => string>((value) => `Remove ${value}`)\n\n protected readonly tags = signal<string[]>([])\n protected readonly draft = signal('')\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n private onChange: (value: string[]) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: string[] | null): void {\n this.tags.set(value ?? [])\n }\n\n registerOnChange(fn: (value: string[]) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled)\n }\n\n protected focusInput(): void {\n if (!this.isDisabled()) {\n this.inputRef()?.nativeElement.focus()\n }\n }\n\n protected onInputChange(event: Event): void {\n this.draft.set((event.target as HTMLInputElement).value)\n }\n\n protected onInputKeydown(event: KeyboardEvent): void {\n if (this.separatorKeys().includes(event.key)) {\n event.preventDefault()\n this.commitDraft()\n return\n }\n if (event.key === 'Backspace' && this.draft() === '' && this.tags().length > 0) {\n event.preventDefault()\n this.removeTagAt(this.tags().length - 1)\n }\n }\n\n protected onBlur(): void {\n this.commitDraft()\n this.onTouched()\n }\n\n protected removeTagAt(index: number): void {\n if (this.isDisabled()) {\n return\n }\n const next = this.tags().filter((_, i) => i !== index)\n this.tags.set(next)\n this.onChange(next)\n }\n\n private commitDraft(): void {\n const value = this.draft().trim()\n this.draft.set('')\n if (!value || this.isDisabled()) {\n return\n }\n if (!this.allowDuplicates() && this.tags().includes(value)) {\n return\n }\n const next = [...this.tags(), value]\n this.tags.set(next)\n this.onChange(next)\n }\n}\n","<div class=\"gbt-tag-input\">\n @if (label()) {\n <label [for]=\"id()\" class=\"gbt-tag-input__label\">{{ label() }}</label>\n }\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"gbt-tag-input__field\"\n [class.gbt-tag-input__field--disabled]=\"isDisabled()\"\n (click)=\"focusInput()\"\n >\n @for (tag of tags(); track tag; let i = $index) {\n <gbt-tag\n [color]=\"color()\"\n [removable]=\"!isDisabled()\"\n [disabled]=\"isDisabled()\"\n [removeLabel]=\"removeLabel()(tag)\"\n (removed)=\"removeTagAt(i)\"\n >\n {{ tag }}\n </gbt-tag>\n }\n <input\n #input\n type=\"text\"\n [id]=\"id()\"\n class=\"gbt-tag-input__input\"\n [placeholder]=\"tags().length === 0 ? placeholder() : ''\"\n [disabled]=\"isDisabled()\"\n [value]=\"draft()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"errorMessage() ? id() + '-error' : null\"\n (input)=\"onInputChange($event)\"\n (keydown)=\"onInputKeydown($event)\"\n (blur)=\"onBlur()\"\n />\n </div>\n @if (errorMessage()) {\n <p [id]=\"id() + '-error'\" class=\"gbt-tag-input__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;;AAcA,IAAI,SAAS;AAiBb,IAAa,WAAb,MAAa,SAAQ;CACF,WAAW,UAAwC,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAE5E,KAAK,MAAc,iBAAiB,EAAE,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC/C,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,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A,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"masmarino-gabarit-tag-input.mjs","names":[],"sources":["../../../projects/gabarit/tag-input/tag-input.ts","../../../projects/gabarit/tag-input/tag-input.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n signal,\n viewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { Tag } from '@masmarino/gabarit/tag'\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-tag-input',\n standalone: true,\n imports: [Tag],\n templateUrl: './tag-input.html',\n styleUrl: './tag-input.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TagInput),\n multi: true,\n },\n ],\n})\nexport class TagInput implements ControlValueAccessor {\n private readonly inputRef = viewChild<ElementRef<HTMLInputElement>>('input')\n\n id = input<string>(`gbt-tag-input-${++nextId}`)\n label = input<string>('')\n placeholder = input<string>('')\n disabled = input(false, { transform: booleanAttribute })\n errorMessage = input<string | null>(null)\n separatorKeys = input<string[]>(['Enter', ','])\n allowDuplicates = input(false, { transform: booleanAttribute })\n color = input<string>('#6b7280')\n removeLabel = input<(value: string) => string>((value) => `Remove ${value}`)\n\n protected readonly tags = signal<string[]>([])\n protected readonly draft = signal('')\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n private onChange: (value: string[]) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: string[] | null): void {\n this.tags.set(value ?? [])\n }\n\n registerOnChange(fn: (value: string[]) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled)\n }\n\n protected focusInput(): void {\n if (!this.isDisabled()) {\n this.inputRef()?.nativeElement.focus()\n }\n }\n\n protected onInputChange(event: Event): void {\n this.draft.set((event.target as HTMLInputElement).value)\n }\n\n protected onInputKeydown(event: KeyboardEvent): void {\n if (this.separatorKeys().includes(event.key)) {\n event.preventDefault()\n this.commitDraft()\n return\n }\n if (event.key === 'Backspace' && this.draft() === '' && this.tags().length > 0) {\n event.preventDefault()\n this.removeTagAt(this.tags().length - 1)\n }\n }\n\n protected onBlur(): void {\n this.commitDraft()\n this.onTouched()\n }\n\n protected removeTagAt(index: number): void {\n if (this.isDisabled()) {\n return\n }\n const next = this.tags().filter((_, i) => i !== index)\n this.tags.set(next)\n this.onChange(next)\n }\n\n private commitDraft(): void {\n const value = this.draft().trim()\n this.draft.set('')\n if (!value || this.isDisabled()) {\n return\n }\n if (!this.allowDuplicates() && this.tags().includes(value)) {\n return\n }\n const next = [...this.tags(), value]\n this.tags.set(next)\n this.onChange(next)\n }\n}\n","<div class=\"gbt-tag-input\">\n @if (label()) {\n <label [for]=\"id()\" class=\"gbt-tag-input__label\">{{ label() }}</label>\n }\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"gbt-tag-input__field\"\n [class.gbt-tag-input__field--disabled]=\"isDisabled()\"\n (click)=\"focusInput()\"\n >\n @for (tag of tags(); track tag; let i = $index) {\n <gbt-tag\n [color]=\"color()\"\n [removable]=\"!isDisabled()\"\n [disabled]=\"isDisabled()\"\n [removeLabel]=\"removeLabel()(tag)\"\n (removed)=\"removeTagAt(i)\"\n >\n {{ tag }}\n </gbt-tag>\n }\n <input\n #input\n type=\"text\"\n [id]=\"id()\"\n class=\"gbt-tag-input__input\"\n [placeholder]=\"tags().length === 0 ? placeholder() : ''\"\n [disabled]=\"isDisabled()\"\n [value]=\"draft()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"errorMessage() ? id() + '-error' : null\"\n (input)=\"onInputChange($event)\"\n (keydown)=\"onInputKeydown($event)\"\n (blur)=\"onBlur()\"\n />\n </div>\n @if (errorMessage()) {\n <p [id]=\"id() + '-error'\" class=\"gbt-tag-input__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;;AAcA,IAAI,SAAS;AAiBb,IAAa,WAAb,MAAa,SAAQ;CACF,WAAW,UAAwC,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAE5E,KAAK,MAAc,iBAAiB,EAAE,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC/C,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,eAAe,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CACzC,gBAAgB,MAAgB,CAAC,SAAS,GAAG,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAC/C,kBAAkB,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,kBAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CAC5D,QAAQ,MAAc,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,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EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,iBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -85,7 +85,7 @@ var Tag = class Tag {
85
85
  outputs: { removed: "removed" },
86
86
  ngImport: i0,
87
87
  template: "<span\n class=\"gbt-tag\"\n [style.background]=\"color()\"\n [style.color]=\"textColor()\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n>\n <span class=\"gbt-tag__label\"><ng-content /></span>\n @if (removable()) {\n <button\n type=\"button\"\n class=\"gbt-tag__remove\"\n [attr.aria-label]=\"removeLabel()\"\n (click)=\"onRemoveClick($event)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n }\n</span>\n",
88
- styles: [":host{display:inline-flex;max-width:100%}.gbt-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:var(--site-border-radius-sm);font-size:.75rem;font-weight:600;line-height:1.4;max-width:100%}.gbt-tag__label{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gbt-tag__remove{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:4px;color:currentColor;cursor:pointer;transition:background var(--site-transition-fast)}.gbt-tag__remove:hover{background:color-mix(in srgb,currentColor 20%,transparent)}.gbt-tag__remove:active{background:color-mix(in srgb,currentColor 32%,transparent)}@media(prefers-reduced-motion:reduce){.gbt-tag__remove{transition:none}}\n"],
88
+ styles: [":host{display:inline-flex;max-width:100%}.gbt-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;font-size:.75rem;font-weight:600;line-height:1.4;max-width:100%;box-shadow:inset 0 1px 0 var(--gbt-liquid-rim-top),inset 0 -1px 0 var(--gbt-liquid-rim-bottom)}.gbt-tag__label{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gbt-tag__remove{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:999px;color:currentColor;cursor:pointer;transition:background var(--site-transition-fast)}.gbt-tag__remove:hover{background:color-mix(in srgb,currentColor 20%,transparent)}.gbt-tag__remove:active{background:color-mix(in srgb,currentColor 32%,transparent)}@media(prefers-reduced-motion:reduce){.gbt-tag__remove{transition:none}}\n"],
89
89
  dependencies: [{
90
90
  kind: "component",
91
91
  type: Icon,
@@ -108,7 +108,7 @@ i0.ɵɵngDeclareClassMetadata({
108
108
  imports: [Icon],
109
109
  changeDetection: ChangeDetectionStrategy.OnPush,
110
110
  template: "<span\n class=\"gbt-tag\"\n [style.background]=\"color()\"\n [style.color]=\"textColor()\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n>\n <span class=\"gbt-tag__label\"><ng-content /></span>\n @if (removable()) {\n <button\n type=\"button\"\n class=\"gbt-tag__remove\"\n [attr.aria-label]=\"removeLabel()\"\n (click)=\"onRemoveClick($event)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n }\n</span>\n",
111
- styles: [":host{display:inline-flex;max-width:100%}.gbt-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:var(--site-border-radius-sm);font-size:.75rem;font-weight:600;line-height:1.4;max-width:100%}.gbt-tag__label{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gbt-tag__remove{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:4px;color:currentColor;cursor:pointer;transition:background var(--site-transition-fast)}.gbt-tag__remove:hover{background:color-mix(in srgb,currentColor 20%,transparent)}.gbt-tag__remove:active{background:color-mix(in srgb,currentColor 32%,transparent)}@media(prefers-reduced-motion:reduce){.gbt-tag__remove{transition:none}}\n"]
111
+ styles: [":host{display:inline-flex;max-width:100%}.gbt-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;font-size:.75rem;font-weight:600;line-height:1.4;max-width:100%;box-shadow:inset 0 1px 0 var(--gbt-liquid-rim-top),inset 0 -1px 0 var(--gbt-liquid-rim-bottom)}.gbt-tag__label{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gbt-tag__remove{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:999px;color:currentColor;cursor:pointer;transition:background var(--site-transition-fast)}.gbt-tag__remove:hover{background:color-mix(in srgb,currentColor 20%,transparent)}.gbt-tag__remove:active{background:color-mix(in srgb,currentColor 32%,transparent)}@media(prefers-reduced-motion:reduce){.gbt-tag__remove{transition:none}}\n"]
112
112
  }]
113
113
  }],
114
114
  propDecorators: {
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-tag.mjs","names":[],"sources":["../../../projects/gabarit/tag/tag-contrast.ts","../../../projects/gabarit/tag/tag.ts","../../../projects/gabarit/tag/tag.html"],"sourcesContent":["const HEX_6 = /^#?[0-9a-fA-F]{6}$/\n\nfunction normalizeHex(hex: string): string {\n if (!HEX_6.test(hex)) {\n throw new Error(\n `getReadableTextColor: expected a 6-digit hex color such as \"#dc2626\" or \"dc2626\", got ${JSON.stringify(hex)}. ` +\n 'Shorthand hex (#abc), CSS named colors, rgb()/hsl() and custom properties are not supported.',\n )\n }\n return hex.replace('#', '')\n}\n\nfunction linearizeChannel(value: number): number {\n const c = value / 255\n return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4)\n}\n\nfunction relativeLuminance(normalizedHex: string): number {\n const r = parseInt(normalizedHex.substring(0, 2), 16)\n const g = parseInt(normalizedHex.substring(2, 4), 16)\n const b = parseInt(normalizedHex.substring(4, 6), 16)\n return 0.2126 * linearizeChannel(r) + 0.7152 * linearizeChannel(g) + 0.0722 * linearizeChannel(b)\n}\n\nfunction contrastRatio(normalizedA: string, normalizedB: string): number {\n const lA = relativeLuminance(normalizedA)\n const lB = relativeLuminance(normalizedB)\n const lighter = Math.max(lA, lB)\n const darker = Math.min(lA, lB)\n return (lighter + 0.05) / (darker + 0.05)\n}\n\nexport function getReadableTextColor(backgroundHex: string): string {\n const background = normalizeHex(backgroundHex)\n const white = 'ffffff'\n const dark = '000000'\n return contrastRatio(background, white) >= contrastRatio(background, dark) ? '#ffffff' : '#000000'\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { getReadableTextColor } from './tag-contrast'\n\n@Component({\n selector: 'gbt-tag',\n standalone: true,\n imports: [Icon],\n templateUrl: './tag.html',\n styleUrl: './tag.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tag {\n color = input.required<string>()\n removable = input<boolean>(false)\n removeLabel = input<string>('Remove')\n disabled = input<boolean>(false)\n\n removed = output<void>()\n\n protected readonly textColor = computed(() => getReadableTextColor(this.color()))\n\n protected onRemoveClick(event: MouseEvent): void {\n event.stopPropagation()\n this.removed.emit()\n }\n}\n","<span\n class=\"gbt-tag\"\n [style.background]=\"color()\"\n [style.color]=\"textColor()\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n>\n <span class=\"gbt-tag__label\"><ng-content /></span>\n @if (removable()) {\n <button\n type=\"button\"\n class=\"gbt-tag__remove\"\n [attr.aria-label]=\"removeLabel()\"\n (click)=\"onRemoveClick($event)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n }\n</span>\n"],"mappings":";;;AAAA,MAAM,QAAQ;AAEd,SAAS,aAAa,KAAW;CAC/B,IAAI,CAAC,MAAM,KAAK,GAAG,GACjB,MAAM,IAAI,MACR,yFAAyF,KAAK,UAAU,GAAG,EAAC,+FACZ;CAGpG,OAAO,IAAI,QAAQ,KAAK,EAAE;AAC5B;AAEA,SAAS,iBAAiB,OAAa;CACrC,MAAM,IAAI,QAAQ;CAClB,OAAO,KAAK,SAAU,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAS,OAAO,GAAG;AACrE;AAEA,SAAS,kBAAkB,eAAqB;CAC9C,MAAM,IAAI,SAAS,cAAc,UAAU,GAAG,CAAC,GAAG,EAAE;CACpD,MAAM,IAAI,SAAS,cAAc,UAAU,GAAG,CAAC,GAAG,EAAE;CACpD,MAAM,IAAI,SAAS,cAAc,UAAU,GAAG,CAAC,GAAG,EAAE;CACpD,OAAO,QAAS,iBAAiB,CAAC,IAAI,QAAS,iBAAiB,CAAC,IAAI,QAAS,iBAAiB,CAAC;AAClG;AAEA,SAAS,cAAc,aAAqB,aAAmB;CAC7D,MAAM,KAAK,kBAAkB,WAAW;CACxC,MAAM,KAAK,kBAAkB,WAAW;CACxC,MAAM,UAAU,KAA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AAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,SAAA,UAAA;EAAA,UAAA;EAAA,UCZhB;EAkBA,QAAA,CAAA,myBAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MDXY;GAAI,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAKH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAG,YAAA,CAAA;EARf,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAS,YACP;GAAI,SACP,CAAC,IAAI;GAAC,iBAGE,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,myBAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"masmarino-gabarit-tag.mjs","names":[],"sources":["../../../projects/gabarit/tag/tag-contrast.ts","../../../projects/gabarit/tag/tag.ts","../../../projects/gabarit/tag/tag.html"],"sourcesContent":["const HEX_6 = /^#?[0-9a-fA-F]{6}$/\n\nfunction normalizeHex(hex: string): string {\n if (!HEX_6.test(hex)) {\n throw new Error(\n `getReadableTextColor: expected a 6-digit hex color such as \"#dc2626\" or \"dc2626\", got ${JSON.stringify(hex)}. ` +\n 'Shorthand hex (#abc), CSS named colors, rgb()/hsl() and custom properties are not supported.',\n )\n }\n return hex.replace('#', '')\n}\n\nfunction linearizeChannel(value: number): number {\n const c = value / 255\n return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4)\n}\n\nfunction relativeLuminance(normalizedHex: string): number {\n const r = parseInt(normalizedHex.substring(0, 2), 16)\n const g = parseInt(normalizedHex.substring(2, 4), 16)\n const b = parseInt(normalizedHex.substring(4, 6), 16)\n return 0.2126 * linearizeChannel(r) + 0.7152 * linearizeChannel(g) + 0.0722 * linearizeChannel(b)\n}\n\nfunction contrastRatio(normalizedA: string, normalizedB: string): number {\n const lA = relativeLuminance(normalizedA)\n const lB = relativeLuminance(normalizedB)\n const lighter = Math.max(lA, lB)\n const darker = Math.min(lA, lB)\n return (lighter + 0.05) / (darker + 0.05)\n}\n\nexport function getReadableTextColor(backgroundHex: string): string {\n const background = normalizeHex(backgroundHex)\n const white = 'ffffff'\n const dark = '000000'\n return contrastRatio(background, white) >= contrastRatio(background, dark) ? '#ffffff' : '#000000'\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { getReadableTextColor } from './tag-contrast'\n\n@Component({\n selector: 'gbt-tag',\n standalone: true,\n imports: [Icon],\n templateUrl: './tag.html',\n styleUrl: './tag.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tag {\n color = input.required<string>()\n removable = input<boolean>(false)\n removeLabel = input<string>('Remove')\n disabled = input<boolean>(false)\n\n removed = output<void>()\n\n protected readonly textColor = computed(() => getReadableTextColor(this.color()))\n\n protected onRemoveClick(event: MouseEvent): void {\n event.stopPropagation()\n this.removed.emit()\n }\n}\n","<span\n class=\"gbt-tag\"\n [style.background]=\"color()\"\n [style.color]=\"textColor()\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n>\n <span class=\"gbt-tag__label\"><ng-content /></span>\n @if (removable()) {\n <button\n type=\"button\"\n class=\"gbt-tag__remove\"\n [attr.aria-label]=\"removeLabel()\"\n (click)=\"onRemoveClick($event)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n }\n</span>\n"],"mappings":";;;AAAA,MAAM,QAAQ;AAEd,SAAS,aAAa,KAAW;CAC/B,IAAI,CAAC,MAAM,KAAK,GAAG,GACjB,MAAM,IAAI,MACR,yFAAyF,KAAK,UAAU,GAAG,EAAC,+FACZ;CAGpG,OAAO,IAAI,QAAQ,KAAK,EAAE;AAC5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area\"\n [class.gbt-textarea--mono]=\"mono()\"\n [class.gbt-textarea--autosize]=\"autosize()\"\n>\n @if (label()) {\n <label [for]=\"id()\" [class.gbt-textarea__label--hidden]=\"hideLabel()\"\n >{{ label() }}{{ required() ? ' *' : '' }}</label\n >\n }\n <textarea\n #field\n [id]=\"id()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [rows]=\"rows()\"\n [value]=\"value()\"\n [attr.data-resize]=\"effectiveResize()\"\n [style.--gbt-textarea-max-rows]=\"maxRowsProperty()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n ></textarea>\n @if (showHint()) {\n <p [id]=\"hintId()\" class=\"gbt-textarea__hint\">{{ hint() }}</p>\n }\n @if (errorMessage()) {\n <p [id]=\"errorId()\" class=\"gbt-textarea__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n",
226
- styles: [":host{display:block}.gbt-textarea{display:flex;flex-direction:column;gap:.375rem}.gbt-textarea label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-textarea textarea{box-sizing:border-box;width:100%;padding:.5rem var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);background:var(--gbt-field-ground, var(--bg-principal));border:1px solid var(--gbt-field-border, var(--border-color));border-radius:var(--site-border-radius-sm);box-shadow:var(--gbt-field-hollow, var(--gbt-depth-hollow));resize:vertical;transition:border-color var(--site-transition-fast)}.gbt-textarea textarea:hover:not(:disabled):not(:focus){border-color:var(--gbt-field-border-hover, var(--text-discret))}.gbt-textarea textarea:focus{outline:none;border-color:var(--primary)}.gbt-textarea textarea:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:1px}.gbt-textarea textarea[data-resize=none]{resize:none}.gbt-textarea textarea[data-resize=both]{resize:both}.gbt-textarea textarea[data-resize=horizontal]{resize:horizontal}.gbt-textarea textarea:disabled{background:var(--bg-panel);cursor:not-allowed;resize:none}.gbt-textarea--autosize textarea{overflow-y:auto;max-height:calc(var(--gbt-textarea-max-rows) * 1lh + 1rem + 2px)}.gbt-textarea--mono textarea{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace);font-size:.8125rem}.gbt-textarea__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-textarea__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-textarea__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-textarea textarea{transition:none}}\n"],
226
+ styles: [":host{display:block}.gbt-textarea{display:flex;flex-direction:column;gap:.375rem}.gbt-textarea label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-textarea textarea{box-sizing:border-box;width:100%;padding:.5rem var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);border-radius:var(--gbt-radius-row);background:var(--gbt-field-ground, var(--gbt-glass-thin));border:1px solid var(--gbt-field-border, transparent);box-shadow:var(--gbt-field-hollow, inset 0 1px 3px var(--gbt-glass-hollow), inset 0 -1px 0 var(--gbt-glass-rim-bottom))}@media(prefers-contrast:more){.gbt-textarea textarea{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-textarea textarea{resize:vertical;transition:border-color var(--site-transition-fast)}.gbt-textarea textarea:hover:not(:disabled):not(:focus){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-textarea textarea:focus{outline:none;border-color:var(--primary)}.gbt-textarea textarea:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:1px}.gbt-textarea textarea[data-resize=none]{resize:none}.gbt-textarea textarea[data-resize=both]{resize:both}.gbt-textarea textarea[data-resize=horizontal]{resize:horizontal}.gbt-textarea textarea:disabled{background:var(--bg-panel);cursor:not-allowed;resize:none}.gbt-textarea--autosize textarea{overflow-y:auto;max-height:calc(var(--gbt-textarea-max-rows) * 1lh + 1rem + 2px)}.gbt-textarea--mono textarea{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace);font-size:.8125rem}.gbt-textarea__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-textarea__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-textarea__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-textarea textarea{transition:none}}\n"],
227
227
  changeDetection: i0.ChangeDetectionStrategy.OnPush
228
228
  });
229
229
  };
@@ -245,7 +245,7 @@ i0.ɵɵngDeclareClassMetadata({
245
245
  multi: true
246
246
  }],
247
247
  template: "<div\n class=\"gbt-textarea\"\n [class.gbt-textarea--mono]=\"mono()\"\n [class.gbt-textarea--autosize]=\"autosize()\"\n>\n @if (label()) {\n <label [for]=\"id()\" [class.gbt-textarea__label--hidden]=\"hideLabel()\"\n >{{ label() }}{{ required() ? ' *' : '' }}</label\n >\n }\n <textarea\n #field\n [id]=\"id()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [rows]=\"rows()\"\n [value]=\"value()\"\n [attr.data-resize]=\"effectiveResize()\"\n [style.--gbt-textarea-max-rows]=\"maxRowsProperty()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n ></textarea>\n @if (showHint()) {\n <p [id]=\"hintId()\" class=\"gbt-textarea__hint\">{{ hint() }}</p>\n }\n @if (errorMessage()) {\n <p [id]=\"errorId()\" class=\"gbt-textarea__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n",
248
- styles: [":host{display:block}.gbt-textarea{display:flex;flex-direction:column;gap:.375rem}.gbt-textarea label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-textarea textarea{box-sizing:border-box;width:100%;padding:.5rem var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);background:var(--gbt-field-ground, var(--bg-principal));border:1px solid var(--gbt-field-border, var(--border-color));border-radius:var(--site-border-radius-sm);box-shadow:var(--gbt-field-hollow, var(--gbt-depth-hollow));resize:vertical;transition:border-color var(--site-transition-fast)}.gbt-textarea textarea:hover:not(:disabled):not(:focus){border-color:var(--gbt-field-border-hover, var(--text-discret))}.gbt-textarea textarea:focus{outline:none;border-color:var(--primary)}.gbt-textarea textarea:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:1px}.gbt-textarea textarea[data-resize=none]{resize:none}.gbt-textarea textarea[data-resize=both]{resize:both}.gbt-textarea textarea[data-resize=horizontal]{resize:horizontal}.gbt-textarea textarea:disabled{background:var(--bg-panel);cursor:not-allowed;resize:none}.gbt-textarea--autosize textarea{overflow-y:auto;max-height:calc(var(--gbt-textarea-max-rows) * 1lh + 1rem + 2px)}.gbt-textarea--mono textarea{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace);font-size:.8125rem}.gbt-textarea__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-textarea__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-textarea__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-textarea textarea{transition:none}}\n"]
248
+ styles: [":host{display:block}.gbt-textarea{display:flex;flex-direction:column;gap:.375rem}.gbt-textarea label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-textarea textarea{box-sizing:border-box;width:100%;padding:.5rem var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);border-radius:var(--gbt-radius-row);background:var(--gbt-field-ground, var(--gbt-glass-thin));border:1px solid var(--gbt-field-border, transparent);box-shadow:var(--gbt-field-hollow, inset 0 1px 3px var(--gbt-glass-hollow), inset 0 -1px 0 var(--gbt-glass-rim-bottom))}@media(prefers-contrast:more){.gbt-textarea textarea{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-textarea textarea{resize:vertical;transition:border-color var(--site-transition-fast)}.gbt-textarea textarea:hover:not(:disabled):not(:focus){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-textarea textarea:focus{outline:none;border-color:var(--primary)}.gbt-textarea textarea:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:1px}.gbt-textarea textarea[data-resize=none]{resize:none}.gbt-textarea textarea[data-resize=both]{resize:both}.gbt-textarea textarea[data-resize=horizontal]{resize:horizontal}.gbt-textarea textarea:disabled{background:var(--bg-panel);cursor:not-allowed;resize:none}.gbt-textarea--autosize textarea{overflow-y:auto;max-height:calc(var(--gbt-textarea-max-rows) * 1lh + 1rem + 2px)}.gbt-textarea--mono textarea{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace);font-size:.8125rem}.gbt-textarea__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-textarea__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-textarea__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-textarea textarea{transition:none}}\n"]
249
249
  }]
250
250
  }],
251
251
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-textarea.mjs","names":[],"sources":["../../../projects/gabarit/textarea/textarea.ts","../../../projects/gabarit/textarea/textarea.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n afterRenderEffect,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nlet nextId = 0\n\nexport type TextareaResize = 'vertical' | 'none' | 'both' | 'horizontal'\n\n@Component({\n selector: 'gbt-textarea',\n standalone: true,\n imports: [],\n templateUrl: './textarea.html',\n styleUrl: './textarea.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => Textarea),\n multi: true,\n },\n ],\n})\nexport class Textarea implements ControlValueAccessor {\n id = input<string>(`gbt-textarea-${++nextId}`)\n label = input<string>('')\n required = input(false, { transform: booleanAttribute })\n disabled = input(false, { transform: booleanAttribute })\n placeholder = input<string>('')\n errorMessage = input<string | null>(null)\n rows = input(3)\n\n hint = input<string>('')\n hideLabel = input(false, { transform: booleanAttribute })\n mono = input(false, { transform: booleanAttribute })\n autosize = input(false, { transform: booleanAttribute })\n maxRows = input<number | null>(null)\n resize = input<TextareaResize>('vertical')\n\n committed = output<string>()\n\n protected readonly value = signal('')\n\n private readonly field = viewChild.required<ElementRef<HTMLTextAreaElement>>('field')\n\n protected readonly hintId = computed(() => `${this.id()}-hint`)\n protected readonly errorId = computed(() => `${this.id()}-error`)\n protected readonly showHint = computed(() => !!this.hint() && !this.errorMessage())\n protected readonly describedBy = computed(() => {\n if (this.errorMessage()) {\n return this.errorId()\n }\n return this.showHint() ? this.hintId() : null\n })\n protected readonly effectiveResize = computed(() => (this.autosize() ? 'none' : this.resize()))\n protected readonly maxRowsProperty = computed(() => (this.autosize() ? this.maxRows() : null))\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n constructor() {\n const host: HTMLElement = inject(ElementRef).nativeElement\n\n let wasAutosize = false\n afterRenderEffect(() => {\n const textarea = this.field().nativeElement\n this.value()\n this.rows()\n if (this.autosize()) {\n this.fitToContent(textarea)\n wasAutosize = true\n } else if (wasAutosize) {\n textarea.style.height = ''\n wasAutosize = false\n }\n })\n\n afterRenderEffect((onCleanup) => {\n if (!this.autosize() || typeof ResizeObserver === 'undefined') {\n return\n }\n let lastWidth = host.clientWidth\n const observer = new ResizeObserver(() => {\n if (host.clientWidth !== lastWidth) {\n lastWidth = host.clientWidth\n this.fitToContent(this.field().nativeElement)\n }\n })\n observer.observe(host)\n onCleanup(() => observer.disconnect())\n })\n }\n\n private fitToContent(textarea: HTMLTextAreaElement): void {\n textarea.style.height = 'auto'\n const borders = textarea.offsetHeight - textarea.clientHeight\n textarea.style.height = `${Math.ceil(textarea.scrollHeight + borders)}px`\n }\n\n private onChange: (value: string) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: string): void {\n this.value.set(value ?? '')\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled)\n }\n\n protected onInput(event: Event): void {\n const value = (event.target as HTMLTextAreaElement).value\n this.value.set(value)\n this.onChange(value)\n }\n\n protected onBlur(): void {\n this.onTouched()\n this.committed.emit(this.value())\n }\n}\n","<div\n class=\"gbt-textarea\"\n [class.gbt-textarea--mono]=\"mono()\"\n [class.gbt-textarea--autosize]=\"autosize()\"\n>\n @if (label()) {\n <label [for]=\"id()\" [class.gbt-textarea__label--hidden]=\"hideLabel()\"\n >{{ label() }}{{ required() ? ' *' : '' }}</label\n >\n }\n <textarea\n #field\n [id]=\"id()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [rows]=\"rows()\"\n [value]=\"value()\"\n [attr.data-resize]=\"effectiveResize()\"\n [style.--gbt-textarea-max-rows]=\"maxRowsProperty()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n ></textarea>\n @if (showHint()) {\n <p [id]=\"hintId()\" class=\"gbt-textarea__hint\">{{ hint() }}</p>\n }\n @if (errorMessage()) {\n <p [id]=\"errorId()\" class=\"gbt-textarea__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;AAgBA,IAAI,SAAS;AAmBb,IAAa,WAAb,MAAa,SAAQ;CACnB,KAAK,MAAc,gBAAgB,EAAE,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC9C,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,eAAe,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CACzC,OAAO,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAEf,OAAO,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACxB,YAAY,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,YAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACtD,OAAO,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,OAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACjD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+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EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"masmarino-gabarit-textarea.mjs","names":[],"sources":["../../../projects/gabarit/textarea/textarea.ts","../../../projects/gabarit/textarea/textarea.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n afterRenderEffect,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nlet nextId = 0\n\nexport type TextareaResize = 'vertical' | 'none' | 'both' | 'horizontal'\n\n@Component({\n selector: 'gbt-textarea',\n standalone: true,\n imports: [],\n templateUrl: './textarea.html',\n styleUrl: './textarea.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => Textarea),\n multi: true,\n },\n ],\n})\nexport class Textarea implements ControlValueAccessor {\n id = input<string>(`gbt-textarea-${++nextId}`)\n label = input<string>('')\n required = input(false, { transform: booleanAttribute })\n disabled = input(false, { transform: booleanAttribute })\n placeholder = input<string>('')\n errorMessage = input<string | null>(null)\n rows = input(3)\n\n hint = input<string>('')\n hideLabel = input(false, { transform: booleanAttribute })\n mono = input(false, { transform: booleanAttribute })\n autosize = input(false, { transform: booleanAttribute })\n maxRows = input<number | null>(null)\n resize = input<TextareaResize>('vertical')\n\n committed = output<string>()\n\n protected readonly value = signal('')\n\n private readonly field = viewChild.required<ElementRef<HTMLTextAreaElement>>('field')\n\n protected readonly hintId = computed(() => `${this.id()}-hint`)\n protected readonly errorId = computed(() => `${this.id()}-error`)\n protected readonly showHint = computed(() => !!this.hint() && !this.errorMessage())\n protected readonly describedBy = computed(() => {\n if (this.errorMessage()) {\n return this.errorId()\n }\n return this.showHint() ? this.hintId() : null\n })\n protected readonly effectiveResize = computed(() => (this.autosize() ? 'none' : this.resize()))\n protected readonly maxRowsProperty = computed(() => (this.autosize() ? this.maxRows() : null))\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n constructor() {\n const host: HTMLElement = inject(ElementRef).nativeElement\n\n let wasAutosize = false\n afterRenderEffect(() => {\n const textarea = this.field().nativeElement\n this.value()\n this.rows()\n if (this.autosize()) {\n this.fitToContent(textarea)\n wasAutosize = true\n } else if (wasAutosize) {\n textarea.style.height = ''\n wasAutosize = false\n }\n })\n\n afterRenderEffect((onCleanup) => {\n if (!this.autosize() || typeof ResizeObserver === 'undefined') {\n return\n }\n let lastWidth = host.clientWidth\n const observer = new ResizeObserver(() => {\n if (host.clientWidth !== lastWidth) {\n lastWidth = host.clientWidth\n this.fitToContent(this.field().nativeElement)\n }\n })\n observer.observe(host)\n onCleanup(() => observer.disconnect())\n })\n }\n\n private fitToContent(textarea: HTMLTextAreaElement): void {\n textarea.style.height = 'auto'\n const borders = textarea.offsetHeight - textarea.clientHeight\n textarea.style.height = `${Math.ceil(textarea.scrollHeight + borders)}px`\n }\n\n private onChange: (value: string) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: string): void {\n this.value.set(value ?? '')\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled)\n }\n\n protected onInput(event: Event): void {\n const value = (event.target as HTMLTextAreaElement).value\n this.value.set(value)\n this.onChange(value)\n }\n\n protected onBlur(): void {\n this.onTouched()\n this.committed.emit(this.value())\n }\n}\n","<div\n class=\"gbt-textarea\"\n [class.gbt-textarea--mono]=\"mono()\"\n [class.gbt-textarea--autosize]=\"autosize()\"\n>\n @if (label()) {\n <label [for]=\"id()\" [class.gbt-textarea__label--hidden]=\"hideLabel()\"\n >{{ label() }}{{ required() ? ' *' : '' }}</label\n >\n }\n <textarea\n #field\n [id]=\"id()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [rows]=\"rows()\"\n [value]=\"value()\"\n [attr.data-resize]=\"effectiveResize()\"\n [style.--gbt-textarea-max-rows]=\"maxRowsProperty()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n ></textarea>\n @if (showHint()) {\n <p [id]=\"hintId()\" class=\"gbt-textarea__hint\">{{ hint() }}</p>\n }\n @if (errorMessage()) {\n <p [id]=\"errorId()\" class=\"gbt-textarea__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;AAgBA,IAAI,SAAS;AAmBb,IAAa,WAAb,MAAa,SAAQ;CACnB,KAAK,MAAc,gBAAgB,EAAE,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC9C,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,eAAe,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CACzC,OAAO,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAEf,OAAO,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,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,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -130,7 +130,7 @@ var Tooltip = class Tooltip {
130
130
  exportAs: ["gbtTooltip"],
131
131
  ngImport: i0,
132
132
  template: "<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n",
133
- styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-tooltip__bubble{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tooltip__bubble{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-tooltip__bubble{color:var(--text-primary);text-align:center;white-space:normal;border-radius:var(--site-border-radius);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"],
133
+ styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-tooltip__bubble{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tooltip__bubble{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-tooltip__bubble{color:var(--text-primary);text-align:center;white-space:normal;border-radius:var(--gbt-radius-row);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"],
134
134
  changeDetection: i0.ChangeDetectionStrategy.OnPush
135
135
  });
136
136
  };
@@ -157,7 +157,7 @@ i0.ɵɵngDeclareClassMetadata({
157
157
  "(window:resize)": "updatePosition()"
158
158
  },
159
159
  template: "<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n",
160
- styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-tooltip__bubble{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tooltip__bubble{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-tooltip__bubble{color:var(--text-primary);text-align:center;white-space:normal;border-radius:var(--site-border-radius);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"]
160
+ styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-tooltip__bubble{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tooltip__bubble{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-tooltip__bubble{color:var(--text-primary);text-align:center;white-space:normal;border-radius:var(--gbt-radius-row);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"]
161
161
  }]
162
162
  }],
163
163
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-tooltip.mjs","names":[],"sources":["../../../projects/gabarit/tooltip/tooltip.ts","../../../projects/gabarit/tooltip/tooltip.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n inject,\n input,\n signal,\n} from '@angular/core'\nimport { followPageScroll } from '@masmarino/gabarit/floating-panel'\n\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right'\n\ninterface TooltipCoords {\n top: number\n left: number\n}\n\nconst SHOW_DELAY_MS = 400\nconst FADE_MS = 120\nconst GAP_PX = 8\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-tooltip',\n standalone: true,\n exportAs: 'gbtTooltip',\n imports: [],\n templateUrl: './tooltip.html',\n styleUrl: './tooltip.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'gbt-tooltip-host',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'hide()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'hide()',\n '(keydown.escape)': 'hide()',\n '(window:resize)': 'updatePosition()',\n },\n})\nexport class Tooltip implements OnDestroy {\n private readonly elementRef = inject(ElementRef<HTMLElement>)\n\n text = input.required<string>()\n position = input<TooltipPosition>('top')\n\n readonly tooltipId = `gbt-tooltip-${++nextId}`\n\n protected readonly visible = signal(false)\n protected readonly closing = signal(false)\n protected readonly coords = signal<TooltipCoords | null>(null)\n\n private showTimer: ReturnType<typeof setTimeout> | null = null\n private hideTimer: ReturnType<typeof setTimeout> | null = null\n\n protected onMouseEnter(): void {\n this.showTimer = setTimeout(() => {\n this.showTimer = null\n this.show()\n }, SHOW_DELAY_MS)\n }\n\n protected onFocusIn(): void {\n this.show()\n }\n\n private show(): void {\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n this.closing.set(false)\n this.updatePosition()\n this.visible.set(true)\n }\n\n constructor() {\n followPageScroll(() => this.updatePosition())\n }\n\n protected updatePosition(): void {\n const rect = this.elementRef.nativeElement.getBoundingClientRect()\n switch (this.position()) {\n case 'top':\n this.coords.set({ top: rect.top - GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'bottom':\n this.coords.set({ top: rect.bottom + GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'left':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.left - GAP_PX })\n break\n case 'right':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.right + GAP_PX })\n break\n }\n }\n\n protected hide(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (!this.visible() || this.closing()) return\n this.closing.set(true)\n this.hideTimer = setTimeout(() => {\n this.hideTimer = null\n this.closing.set(false)\n this.visible.set(false)\n }, FADE_MS)\n }\n\n ngOnDestroy(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n }\n}\n","<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n"],"mappings":";;;AAkBA,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,SAAS;AAEf,IAAI,SAAS;AAoBb,IAAa,UAAb,MAAa,QAAO;CACD,aAAa,OAAO,UAAuB;CAE5D,OAAO,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,WAAW,MAAuB,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAE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AAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,UACN;GAAY,SACb,CAAA;GAAE,iBAGM,wBAAwB;GAAM,MACzC;IACJ,OAAO;IACP,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,mBAAmB;GACpB;GAAA,UAAA;GAAA,QAAA,CAAA,0/DAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"masmarino-gabarit-tooltip.mjs","names":[],"sources":["../../../projects/gabarit/tooltip/tooltip.ts","../../../projects/gabarit/tooltip/tooltip.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n inject,\n input,\n signal,\n} from '@angular/core'\nimport { followPageScroll } from '@masmarino/gabarit/floating-panel'\n\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right'\n\ninterface TooltipCoords {\n top: number\n left: number\n}\n\nconst SHOW_DELAY_MS = 400\nconst FADE_MS = 120\nconst GAP_PX = 8\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-tooltip',\n standalone: true,\n exportAs: 'gbtTooltip',\n imports: [],\n templateUrl: './tooltip.html',\n styleUrl: './tooltip.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'gbt-tooltip-host',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'hide()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'hide()',\n '(keydown.escape)': 'hide()',\n '(window:resize)': 'updatePosition()',\n },\n})\nexport class Tooltip implements OnDestroy {\n private readonly elementRef = inject(ElementRef<HTMLElement>)\n\n text = input.required<string>()\n position = input<TooltipPosition>('top')\n\n readonly tooltipId = `gbt-tooltip-${++nextId}`\n\n protected readonly visible = signal(false)\n protected readonly closing = signal(false)\n protected readonly coords = signal<TooltipCoords | null>(null)\n\n private showTimer: ReturnType<typeof setTimeout> | null = null\n private hideTimer: ReturnType<typeof setTimeout> | null = null\n\n protected onMouseEnter(): void {\n this.showTimer = setTimeout(() => {\n this.showTimer = null\n this.show()\n }, SHOW_DELAY_MS)\n }\n\n protected onFocusIn(): void {\n this.show()\n }\n\n private show(): void {\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n this.closing.set(false)\n this.updatePosition()\n this.visible.set(true)\n }\n\n constructor() {\n followPageScroll(() => this.updatePosition())\n }\n\n protected updatePosition(): void {\n const rect = this.elementRef.nativeElement.getBoundingClientRect()\n switch (this.position()) {\n case 'top':\n this.coords.set({ top: rect.top - GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'bottom':\n this.coords.set({ top: rect.bottom + GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'left':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.left - GAP_PX })\n break\n case 'right':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.right + GAP_PX })\n break\n }\n }\n\n protected hide(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (!this.visible() || this.closing()) return\n this.closing.set(true)\n this.hideTimer = setTimeout(() => {\n this.hideTimer = null\n this.closing.set(false)\n this.visible.set(false)\n }, FADE_MS)\n }\n\n ngOnDestroy(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n }\n}\n","<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n"],"mappings":";;;AAkBA,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,SAAS;AAEf,IAAI,SAAS;AAoBb,IAAa,UAAb,MAAa,QAAO;CACD,aAAa,OAAO,UAAuB;CAE5D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AcA,QAAA,CAAA,s/DAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AD4Ba,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EAlBnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,UACN;GAAY,SACb,CAAA;GAAE,iBAGM,wBAAwB;GAAM,MACzC;IACJ,OAAO;IACP,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,mBAAmB;GACpB;GAAA,UAAA;GAAA,QAAA,CAAA,s/DAAA;EAAA,CAAA"}
@@ -167,7 +167,7 @@ var Tree = class Tree {
167
167
  },
168
168
  ngImport: i0,
169
169
  template: "<ul\n class=\"gbt-tree\"\n role=\"tree\"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.node.icon\" class=\"gbt-tree__icon\" aria-hidden=\"true\" />\n }\n <span class=\"gbt-tree__label\">{{ flat.node.label }}</span>\n </li>\n }\n</ul>\n",
170
- styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--site-border-radius-sm);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--gbt-glass-thick);box-shadow:var(--gbt-glass-rim-light);color:var(--text-primary);font-weight:600}@media(prefers-contrast:more){.gbt-tree__item[aria-selected=true]{box-shadow:inset 0 0 0 1px var(--border-color)}}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:var(--site-border-radius-xs);color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"],
170
+ styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--gbt-radius-row);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--gbt-glass-thick);box-shadow:var(--gbt-glass-rim-light);color:var(--text-primary);font-weight:600}@media(prefers-contrast:more){.gbt-tree__item[aria-selected=true]{box-shadow:inset 0 0 0 1px var(--border-color)}}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:999px;color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"],
171
171
  dependencies: [{
172
172
  kind: "component",
173
173
  type: Icon,
@@ -190,7 +190,7 @@ i0.ɵɵngDeclareClassMetadata({
190
190
  imports: [Icon],
191
191
  changeDetection: ChangeDetectionStrategy.OnPush,
192
192
  template: "<ul\n class=\"gbt-tree\"\n role=\"tree\"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.node.icon\" class=\"gbt-tree__icon\" aria-hidden=\"true\" />\n }\n <span class=\"gbt-tree__label\">{{ flat.node.label }}</span>\n </li>\n }\n</ul>\n",
193
- styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--site-border-radius-sm);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--gbt-glass-thick);box-shadow:var(--gbt-glass-rim-light);color:var(--text-primary);font-weight:600}@media(prefers-contrast:more){.gbt-tree__item[aria-selected=true]{box-shadow:inset 0 0 0 1px var(--border-color)}}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:var(--site-border-radius-xs);color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"]
193
+ styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--gbt-radius-row);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--gbt-glass-thick);box-shadow:var(--gbt-glass-rim-light);color:var(--text-primary);font-weight:600}@media(prefers-contrast:more){.gbt-tree__item[aria-selected=true]{box-shadow:inset 0 0 0 1px var(--border-color)}}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:999px;color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"]
194
194
  }]
195
195
  }],
196
196
  propDecorators: {
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-tree.mjs","names":[],"sources":["../../../projects/gabarit/tree/tree-flatten.ts","../../../projects/gabarit/tree/tree.ts","../../../projects/gabarit/tree/tree.html"],"sourcesContent":["export interface TreeNode {\n id: string\n label: string\n icon?: string\n children?: TreeNode[]\n}\n\nexport interface FlatTreeNode {\n node: TreeNode\n depth: number\n hasChildren: boolean\n parentId: string | null\n}\n\nexport function flattenTree(\n nodes: TreeNode[],\n expandedIds: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatTreeNode[] {\n const result: FlatTreeNode[] = []\n for (const node of nodes) {\n const hasChildren = !!node.children && node.children.length > 0\n result.push({ node, depth, hasChildren, parentId })\n if (hasChildren && expandedIds.has(node.id)) {\n result.push(...flattenTree(node.children!, expandedIds, depth + 1, node.id))\n }\n }\n return result\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n inject,\n input,\n model,\n signal,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { FlatTreeNode, TreeNode, flattenTree } from './tree-flatten'\n\n@Component({\n selector: 'gbt-tree',\n standalone: true,\n imports: [Icon],\n templateUrl: './tree.html',\n styleUrl: './tree.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tree {\n private readonly elementRef = inject(ElementRef)\n private readonly injector = inject(Injector)\n\n items = input.required<TreeNode[]>()\n ariaLabel = input<string>('')\n selectedId = model<string | null>(null)\n expandedIds = model<string[]>([])\n expandLabel = input<string>('Expand')\n collapseLabel = input<string>('Collapse')\n\n protected readonly focusedId = signal<string | null>(null)\n\n private readonly expandedSet = computed(() => new Set(this.expandedIds()))\n protected readonly flatNodes = computed(() => flattenTree(this.items(), this.expandedSet()))\n\n protected readonly activeId = computed(() => {\n const focused = this.focusedId()\n const flat = this.flatNodes()\n if (focused && flat.some((f) => f.node.id === focused)) {\n return focused\n }\n const selected = this.selectedId()\n if (selected && flat.some((f) => f.node.id === selected)) {\n return selected\n }\n return flat[0]?.node.id ?? null\n })\n\n protected isExpanded(id: string): boolean {\n return this.expandedSet().has(id)\n }\n\n protected toggle(id: string): void {\n const set = new Set(this.expandedIds())\n if (set.has(id)) {\n set.delete(id)\n } else {\n set.add(id)\n }\n this.expandedIds.set([...set])\n }\n\n protected select(node: TreeNode): void {\n this.selectedId.set(node.id)\n this.focusedId.set(node.id)\n }\n\n protected onItemClick(flat: FlatTreeNode): void {\n this.select(flat.node)\n if (flat.hasChildren) {\n this.toggle(flat.node.id)\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const flat = this.flatNodes()\n const index = flat.findIndex((f) => f.node.id === this.activeId())\n if (index === -1) {\n return\n }\n const current = flat[index]\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n this.focusIndex(Math.min(index + 1, flat.length - 1))\n break\n case 'ArrowUp':\n event.preventDefault()\n this.focusIndex(Math.max(index - 1, 0))\n break\n case 'ArrowRight':\n event.preventDefault()\n if (current.hasChildren && !this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.hasChildren) {\n this.focusIndex(index + 1)\n }\n break\n case 'ArrowLeft':\n event.preventDefault()\n if (current.hasChildren && this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.parentId) {\n const parentIndex = flat.findIndex((f) => f.node.id === current.parentId)\n if (parentIndex !== -1) {\n this.focusIndex(parentIndex)\n }\n }\n break\n case 'Home':\n event.preventDefault()\n this.focusIndex(0)\n break\n case 'End':\n event.preventDefault()\n this.focusIndex(flat.length - 1)\n break\n case 'Enter':\n case ' ':\n event.preventDefault()\n this.select(current.node)\n break\n default:\n return\n }\n }\n\n private focusIndex(index: number): void {\n const target = this.flatNodes()[index]\n if (!target) {\n return\n }\n this.focusedId.set(target.node.id)\n afterNextRender(\n () => {\n const host = this.elementRef.nativeElement as HTMLElement\n host.querySelector<HTMLElement>(`[data-node-id=\"${cssEscape(target.node.id)}\"]`)?.focus()\n },\n { injector: this.injector },\n )\n }\n}\n\nfunction cssEscape(value: string): string {\n return typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(value) : value.replace(/\"/g, '\\\\\"')\n}\n","<ul\n class=\"gbt-tree\"\n role=\"tree\"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.node.icon\" class=\"gbt-tree__icon\" aria-hidden=\"true\" />\n }\n <span class=\"gbt-tree__label\">{{ flat.node.label }}</span>\n </li>\n }\n</ul>\n"],"mappings":";;;AAcA,SAAgB,YACd,OACA,aACA,QAAQ,GACR,WAA0B,MAAI;CAE9B,MAAM,SAAyB,CAAA;CAC/B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,cAAc,CAAC,CAAC,KAAK,YAAY,KAAK,SAAS,SAAS;EAC9D,OAAO,KAAK;GAAE;GAAM;GAAO;GAAa;EAAQ,CAAE;EAClD,IAAI,eAAe,YAAY,IA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mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,eAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,YAAA;GAAA,aAAA;EAAA;EAAA,UAAA;EAAA,UCvBjB;EA6CA,QAAA,CAAA,s+CAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MD3BY;GAAI,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAKH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAI,YAAA,CAAA;EARhB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,YACR;GAAI,SACP,CAAC,IAAI;GAAC,iBAGE,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,s+CAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HjD,SAAS,UAAU,OAAa;CAC9B,OAAO,OAAO,QAAQ,eAAe,IAAI,SAAS,IAAI,OAAO,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAK;AACjG"}
1
+ {"version":3,"file":"masmarino-gabarit-tree.mjs","names":[],"sources":["../../../projects/gabarit/tree/tree-flatten.ts","../../../projects/gabarit/tree/tree.ts","../../../projects/gabarit/tree/tree.html"],"sourcesContent":["export interface TreeNode {\n id: string\n label: string\n icon?: string\n children?: TreeNode[]\n}\n\nexport interface FlatTreeNode {\n node: TreeNode\n depth: number\n hasChildren: boolean\n parentId: string | null\n}\n\nexport function flattenTree(\n nodes: TreeNode[],\n expandedIds: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatTreeNode[] {\n const result: FlatTreeNode[] = []\n for (const node of nodes) {\n const hasChildren = !!node.children && node.children.length > 0\n result.push({ node, depth, hasChildren, parentId })\n if (hasChildren && expandedIds.has(node.id)) {\n result.push(...flattenTree(node.children!, expandedIds, depth + 1, node.id))\n }\n }\n return result\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n inject,\n input,\n model,\n signal,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { FlatTreeNode, TreeNode, flattenTree } from './tree-flatten'\n\n@Component({\n selector: 'gbt-tree',\n standalone: true,\n imports: [Icon],\n templateUrl: './tree.html',\n styleUrl: './tree.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tree {\n private readonly elementRef = inject(ElementRef)\n private readonly injector = inject(Injector)\n\n items = input.required<TreeNode[]>()\n ariaLabel = input<string>('')\n selectedId = model<string | null>(null)\n expandedIds = model<string[]>([])\n expandLabel = input<string>('Expand')\n collapseLabel = input<string>('Collapse')\n\n protected readonly focusedId = signal<string | null>(null)\n\n private readonly expandedSet = computed(() => new Set(this.expandedIds()))\n protected readonly flatNodes = computed(() => flattenTree(this.items(), this.expandedSet()))\n\n protected readonly activeId = computed(() => {\n const focused = this.focusedId()\n const flat = this.flatNodes()\n if (focused && flat.some((f) => f.node.id === focused)) {\n return focused\n }\n const selected = this.selectedId()\n if (selected && flat.some((f) => f.node.id === selected)) {\n return selected\n }\n return flat[0]?.node.id ?? null\n })\n\n protected isExpanded(id: string): boolean {\n return this.expandedSet().has(id)\n }\n\n protected toggle(id: string): void {\n const set = new Set(this.expandedIds())\n if (set.has(id)) {\n set.delete(id)\n } else {\n set.add(id)\n }\n this.expandedIds.set([...set])\n }\n\n protected select(node: TreeNode): void {\n this.selectedId.set(node.id)\n this.focusedId.set(node.id)\n }\n\n protected onItemClick(flat: FlatTreeNode): void {\n this.select(flat.node)\n if (flat.hasChildren) {\n this.toggle(flat.node.id)\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const flat = this.flatNodes()\n const index = flat.findIndex((f) => f.node.id === this.activeId())\n if (index === -1) {\n return\n }\n const current = flat[index]\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n this.focusIndex(Math.min(index + 1, flat.length - 1))\n break\n case 'ArrowUp':\n event.preventDefault()\n this.focusIndex(Math.max(index - 1, 0))\n break\n case 'ArrowRight':\n event.preventDefault()\n if (current.hasChildren && !this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.hasChildren) {\n this.focusIndex(index + 1)\n }\n break\n case 'ArrowLeft':\n event.preventDefault()\n if (current.hasChildren && this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.parentId) {\n const parentIndex = flat.findIndex((f) => f.node.id === current.parentId)\n if (parentIndex !== -1) {\n this.focusIndex(parentIndex)\n }\n }\n break\n case 'Home':\n event.preventDefault()\n this.focusIndex(0)\n break\n case 'End':\n event.preventDefault()\n this.focusIndex(flat.length - 1)\n break\n case 'Enter':\n case ' ':\n event.preventDefault()\n this.select(current.node)\n break\n default:\n return\n }\n }\n\n private focusIndex(index: number): void {\n const target = this.flatNodes()[index]\n if (!target) {\n return\n }\n this.focusedId.set(target.node.id)\n afterNextRender(\n () => {\n const host = this.elementRef.nativeElement as HTMLElement\n host.querySelector<HTMLElement>(`[data-node-id=\"${cssEscape(target.node.id)}\"]`)?.focus()\n },\n { injector: this.injector },\n )\n }\n}\n\nfunction cssEscape(value: string): string {\n return typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(value) : value.replace(/\"/g, '\\\\\"')\n}\n","<ul\n class=\"gbt-tree\"\n role=\"tree\"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.node.icon\" class=\"gbt-tree__icon\" aria-hidden=\"true\" />\n }\n <span class=\"gbt-tree__label\">{{ flat.node.label }}</span>\n </li>\n }\n</ul>\n"],"mappings":";;;AAcA,SAAgB,YACd,OACA,aACA,QAAQ,GACR,WAA0B,MAAI;CAE9B,MAAM,SAAyB,CAAA;CAC/B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,cAAc,CAAC,CAAC,KAAK,YAAY,KAAK,SAAS,SAAS;EAC9D,OAAO,KAAK;GAAE;GAAM;GAAO;GAAa;EAAQ,CAAE;EAClD,IAAI,eAAe,YAAY,IAAI,KAAK,EAAE,GACxC,OAAO,KAAK,GAAG,YAAY,KAAK,UAAW,aAAa,QAAQ,GAAG,KAAK,EAAE,CAAC;CAE/E;CACA,OAAO;AACT;ACNA,IAAa,OAAb,MAAa,KAAI;CACE,aAAa,OAAO,UAAU;CAC9B,WAAW,O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,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,eAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,YAAA;GAAA,aAAA;EAAA;EAAA,UAAA;EAAA,UCvBjB;EA6CA,QAAA,CAAA,w8CAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MD3BY;GAAI,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAKH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAI,YAAA,CAAA;EARhB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,YACR;GAAI,SACP,CAAC,IAAI;GAAC,iBAGE,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,w8CAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HjD,SAAS,UAAU,OAAa;CAC9B,OAAO,OAAO,QAAQ,eAAe,IAAI,SAAS,IAAI,OAAO,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAK;AACjG"}
@@ -80,7 +80,7 @@ import { AuthResetPassword } from "@masmarino/gabarit/auth-reset-password";
80
80
  import { MfaSettings } from "@masmarino/gabarit/mfa-settings";
81
81
  import { PasskeySettings } from "@masmarino/gabarit/passkey-settings";
82
82
  import { GitField } from "@masmarino/gabarit/git-field";
83
- const GABARIT_VERSION = "4.0.1";
83
+ const GABARIT_VERSION = "4.1.0";
84
84
  export { ACTIVATION_TOKEN_SHAPE, AUTH_LABELS, AUTH_PORT, AUTH_PORT_ERROR_BODIES, Accordion, AccordionItem, Alert, AppShell, AppShellNavGroup, AuthActivate, AuthFooter, AuthFooterLink, AuthLogin, AuthPanel, AuthRegister, AuthResetPassword, Autocomplete, Avatar, AvatarGroup, BackupCodes, Badge, BarChart, BarSeries, Breadcrumb, Button, CHART_CONTEXT, COPY_FIELD_WRAP_AT, Card, CardHeader, CardLink, ChartAxis, ChartEmpty, ChartFrame, ChartLegend, ChartTable, ChartTooltip, Checkbox, CheckboxGroup, ClipboardFeedback, CommandPalette, CommandPaletteTrigger, ConfirmDangerModal, CopyButton, CopyField, DEFAULT_ACTIVATE_LABELS, DEFAULT_BACKUP_CODES_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_MFA_ENROLLMENT_LABELS, DEFAULT_MFA_SETTINGS_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_REGISTER_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEFAULT_TOTP_QR_LABELS, DatePicker, DateRangePicker, DescriptionList, DimensionCard, Disclosure, Divider, Drawer, EmptyState, FileUpload, FunnelChart, GABARIT_VERSION, GaugeBar, GbtBytesPipe, GbtDateTimePipe, GbtInput, GbtRelativeTimePipe, GbtToastService, GitField, Icon, IconMarker, IconRegistry, JobGraph, JobStatus, LineChart, LineSeries, ListCard, ListRow, ListToolbar, MFA_PORT, MIN_PASSWORD_LENGTH, Menu, MenuItem, MenuTrigger, MfaEnrollment, MfaSettings, MfaSettingsState, Modal, NavTab, NavTabs, NotificationDot, PASSKEY_NAME_MAX, PageHeader, PageLayout, Pagination, Panel, PasskeySettings, PieChart, Popover, RadioGroup, SaveStatus, SearchBar, SecretReveal, SegmentedControl, Select, Skeleton, SkeletonList, Slider, Sparkline, Spinner, StatGrid, StatTile, StatTileLink, Stepper, Switch, TOTP_QR_RENDERER, Tab, Table, Tabs, Tag, TagInput, Textarea, TimelineChart, TimelineSeries, Toaster, Tooltip, TotpQr, Tree, USERNAME_PATTERN, UserChip, accountName, activationToken, arcPath, areaPath, bandScale, base64UrlToBuffer, bufferToBase64Url, classifyActivateFailure, classifyMfaFailure, classifyPasskeyError, classifyPasswordFailure, classifyRegisterFailure, computeInitials, copyToClipboard, createListToolbarState, createPasskeyCredential, emailProblem, formatBytes, formatCompact, formatDateTime, formatDuration, formatNumber, formatPercent, formatRelativeTime, getPasskeyAssertion, isAuthPortError, isTooManyPasskeys, linePath, linearScale, matchCommand, nearestIndex, niceTicks, niceXDomain, niceYDomain, passkeyNameProblem, passkeysSupported, passwordProblem, portErrorMessage, provideAuthLabels, selectContents, shortcutLabel, timeScale, timeTicks, usernameProblem };
85
85
 
86
86
  //# sourceMappingURL=masmarino-gabarit.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit.mjs","names":[],"sources":["../../../projects/gabarit/src/lib/version.ts"],"sourcesContent":["export const GABARIT_VERSION = '4.0.1'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,kBAAkB"}
1
+ {"version":3,"file":"masmarino-gabarit.mjs","names":[],"sources":["../../../projects/gabarit/src/lib/version.ts"],"sourcesContent":["export const GABARIT_VERSION = '4.1.0'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,kBAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masmarino/gabarit",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "description": "Angular design system — UI components and dataviz for self-hosted applications.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Masmarino/Gabarit",
@@ -85,3 +85,143 @@
85
85
  box-shadow: var(--gbt-depth-liquid), var(--gbt-depth-glass);
86
86
  @include edged-when-asked((var(--gbt-depth-liquid), var(--gbt-depth-glass)));
87
87
  }
88
+
89
+ // The four radii of the components (4.1, the rule in tokens/gabarit.json's "radius"): a capsule for what commands, the
90
+ // glass's for what holds, the row's for what lies in a glass, md for the small things; avatars are circles. Inside
91
+ // another shape a radius is the outer one less the gap (concentric), never less than md.
92
+ $radius-pill: 999px;
93
+ $radius-glass: var(--gbt-radius-glass);
94
+ $radius-row: var(--gbt-radius-row);
95
+ $radius-md: var(--site-border-radius);
96
+
97
+ // The controls on liquid glass (4.1). Three values of tokens/gabarit.json ("controls") have no CSS variable: they are
98
+ // posed here, in Sass. Pressed, a glass lights up (white at `pressLight` over it) and grows by `pressScale`; the
99
+ // prominent glass is its tint at `prominent`.
100
+ $press-scale: 1.04;
101
+ $press-light: 0.14;
102
+ $prominent: 86%;
103
+
104
+ // The light of a held glass, from above and from below as the rims, never across: `pressLight` at its edges, a trace
105
+ // at its middle where its label sits (white at 0.14 all over would take the ink under 7:1 on the dark ground's light).
106
+ $press-light-core: 0.04;
107
+ $press-glow: linear-gradient(
108
+ rgba(255, 255, 255, $press-light),
109
+ rgba(255, 255, 255, $press-light-core) 50%,
110
+ rgba(255, 255, 255, $press-light)
111
+ );
112
+
113
+ // The "bouncy" spring (response 0.4 s, damping 0.7), sampled for CSS: it overshoots by 4.5 % and settles in 0.6 s.
114
+ $bouncy: linear(
115
+ 0,
116
+ 0.089,
117
+ 0.28,
118
+ 0.494,
119
+ 0.685,
120
+ 0.834,
121
+ 0.938,
122
+ 1.001,
123
+ 1.034,
124
+ 1.045,
125
+ 1.044,
126
+ 1.036,
127
+ 1.027,
128
+ 1.017,
129
+ 1.01,
130
+ 1.004,
131
+ 1.001,
132
+ 0.999,
133
+ 0.998 85%,
134
+ 1
135
+ );
136
+ $bouncy-duration: 0.6s;
137
+
138
+ // The lens of a segmented control or of a page's tabs: the liquid glass a step clearer than its track, by the relief's
139
+ // highlight (white at 0.6 in the light theme, at 0.08 in the dark: its label keeps 7:1 on it, contrast.spec.ts).
140
+ $lens-light: linear-gradient(var(--gbt-relief-highlight), var(--gbt-relief-highlight));
141
+
142
+ // What the chosen glass is tinted with (a chip, a filter): the accent, deepened by the ink so that its text, in
143
+ // `--text-on-primary`, keeps 7:1 (contrast.spec.ts). The ink alone (`--primary`) tints the prominent button.
144
+ $chosen-tint: color-mix(in srgb, var(--accent) 50%, var(--primary));
145
+
146
+ // The liquid glass's light without its shadow: a rim at the top and at the bottom, never across.
147
+ $liquid-rims:
148
+ inset 0 1px 0 var(--gbt-liquid-rim-top),
149
+ inset 0 -1px 0 var(--gbt-liquid-rim-bottom);
150
+
151
+ // A control in liquid glass (a button, a chip, the lens of a segmented control): the clear glass, the ground's ink.
152
+ @mixin liquid-control {
153
+ @include liquid-glass;
154
+ color: var(--text-primary);
155
+ }
156
+
157
+ // The thin liquid glass of a chip, a label, a segmented control's track: the liquid's fill and light, no shadow under.
158
+ @mixin liquid-thin {
159
+ @include liquid-glass;
160
+ box-shadow: $liquid-rims;
161
+ @include edged-when-asked($liquid-rims);
162
+ }
163
+
164
+ // The prominent glass: tinted (the ink by default), its text in `--text-on-primary`. Dense when asked: the plain tint.
165
+ @mixin prominent-glass($tint: var(--primary)) {
166
+ background: color-mix(in srgb, #{$tint} #{$prominent}, transparent);
167
+ color: var(--text-on-primary);
168
+ -webkit-backdrop-filter: var(--gbt-liquid-blur);
169
+ backdrop-filter: var(--gbt-liquid-blur);
170
+ box-shadow: var(--gbt-depth-liquid);
171
+ @include edged-when-asked(var(--gbt-depth-liquid));
172
+
173
+ @media (prefers-reduced-transparency: reduce) {
174
+ background: #{$tint};
175
+ -webkit-backdrop-filter: none;
176
+ backdrop-filter: none;
177
+ }
178
+ }
179
+
180
+ // Held down: the glass lights up and grows a little; with less motion asked, only the light.
181
+ @mixin liquid-pressed {
182
+ background-image: $press-glow;
183
+ @media (prefers-reduced-motion: no-preference) {
184
+ transform: scale($press-scale);
185
+ }
186
+ }
187
+
188
+ // The movement of a liquid control: its size on the spring, its colours at the usual pace; none with less motion.
189
+ @mixin liquid-motion {
190
+ @media (prefers-reduced-motion: no-preference) {
191
+ transition:
192
+ transform $bouncy-duration $bouncy,
193
+ background-color var(--site-transition-fast),
194
+ color var(--site-transition-fast),
195
+ box-shadow var(--site-transition-fast),
196
+ opacity var(--site-transition-fast);
197
+ }
198
+ }
199
+
200
+ // A text field: a hollow of thin glass, no edge at rest (its shade falls inside its top edge, a light lines its
201
+ // bottom). With the focus it takes the ink's edge (3:1 at least, contrast.spec.ts) and the focus ring; with more
202
+ // contrast asked, its edge stays. A form's card unsets the hollow (`--gbt-field-*`).
203
+ @mixin glass-hollow {
204
+ background: var(--gbt-field-ground, var(--gbt-glass-thin));
205
+ border: 1px solid var(--gbt-field-border, transparent);
206
+ box-shadow: var(
207
+ --gbt-field-hollow,
208
+ inset 0 1px 3px var(--gbt-glass-hollow),
209
+ inset 0 -1px 0 var(--gbt-glass-rim-bottom)
210
+ );
211
+
212
+ @media (prefers-contrast: more) {
213
+ border-color: var(--gbt-field-border, var(--border-color));
214
+ }
215
+ }
216
+
217
+ @mixin glass-hollow-hover {
218
+ background: var(--gbt-field-ground, var(--gbt-glass-regular));
219
+ }
220
+
221
+ @mixin glass-hollow-pressed {
222
+ background-image: linear-gradient(var(--bg-press), var(--bg-press));
223
+ }
224
+
225
+ @mixin glass-hollow-focus {
226
+ border-color: var(--primary);
227
+ }