@masmarino/gabarit 4.1.1 → 4.2.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 (91) hide show
  1. package/fesm2022/masmarino-gabarit-accordion.mjs +2 -2
  2. package/fesm2022/masmarino-gabarit-accordion.mjs.map +1 -1
  3. package/fesm2022/masmarino-gabarit-app-shell.mjs +2 -2
  4. package/fesm2022/masmarino-gabarit-app-shell.mjs.map +1 -1
  5. package/fesm2022/masmarino-gabarit-autocomplete.mjs +2 -2
  6. package/fesm2022/masmarino-gabarit-autocomplete.mjs.map +1 -1
  7. package/fesm2022/masmarino-gabarit-avatar-group.mjs +2 -2
  8. package/fesm2022/masmarino-gabarit-avatar-group.mjs.map +1 -1
  9. package/fesm2022/masmarino-gabarit-badge.mjs +2 -2
  10. package/fesm2022/masmarino-gabarit-badge.mjs.map +1 -1
  11. package/fesm2022/masmarino-gabarit-button.mjs +2 -2
  12. package/fesm2022/masmarino-gabarit-button.mjs.map +1 -1
  13. package/fesm2022/masmarino-gabarit-card.mjs +2 -2
  14. package/fesm2022/masmarino-gabarit-card.mjs.map +1 -1
  15. package/fesm2022/masmarino-gabarit-chart.mjs +6 -6
  16. package/fesm2022/masmarino-gabarit-chart.mjs.map +1 -1
  17. package/fesm2022/masmarino-gabarit-checkbox.mjs +2 -2
  18. package/fesm2022/masmarino-gabarit-checkbox.mjs.map +1 -1
  19. package/fesm2022/masmarino-gabarit-command-palette.mjs +4 -4
  20. package/fesm2022/masmarino-gabarit-command-palette.mjs.map +1 -1
  21. package/fesm2022/masmarino-gabarit-date-picker.mjs +4 -4
  22. package/fesm2022/masmarino-gabarit-date-picker.mjs.map +1 -1
  23. package/fesm2022/masmarino-gabarit-disclosure.mjs +2 -2
  24. package/fesm2022/masmarino-gabarit-disclosure.mjs.map +1 -1
  25. package/fesm2022/masmarino-gabarit-docs.mjs +4 -4
  26. package/fesm2022/masmarino-gabarit-docs.mjs.map +1 -1
  27. package/fesm2022/masmarino-gabarit-drawer.mjs +2 -2
  28. package/fesm2022/masmarino-gabarit-drawer.mjs.map +1 -1
  29. package/fesm2022/masmarino-gabarit-file-upload.mjs +2 -2
  30. package/fesm2022/masmarino-gabarit-file-upload.mjs.map +1 -1
  31. package/fesm2022/masmarino-gabarit-funnel-chart.mjs +2 -2
  32. package/fesm2022/masmarino-gabarit-funnel-chart.mjs.map +1 -1
  33. package/fesm2022/masmarino-gabarit-ground.mjs +349 -0
  34. package/fesm2022/masmarino-gabarit-ground.mjs.map +1 -0
  35. package/fesm2022/masmarino-gabarit-input.mjs +2 -2
  36. package/fesm2022/masmarino-gabarit-input.mjs.map +1 -1
  37. package/fesm2022/masmarino-gabarit-job-graph.mjs +2 -2
  38. package/fesm2022/masmarino-gabarit-job-graph.mjs.map +1 -1
  39. package/fesm2022/masmarino-gabarit-list-row.mjs +2 -2
  40. package/fesm2022/masmarino-gabarit-list-row.mjs.map +1 -1
  41. package/fesm2022/masmarino-gabarit-list-toolbar.mjs +2 -2
  42. package/fesm2022/masmarino-gabarit-list-toolbar.mjs.map +1 -1
  43. package/fesm2022/masmarino-gabarit-menu.mjs +2 -2
  44. package/fesm2022/masmarino-gabarit-menu.mjs.map +1 -1
  45. package/fesm2022/masmarino-gabarit-modal.mjs +2 -2
  46. package/fesm2022/masmarino-gabarit-modal.mjs.map +1 -1
  47. package/fesm2022/masmarino-gabarit-nav-tabs.mjs +2 -2
  48. package/fesm2022/masmarino-gabarit-nav-tabs.mjs.map +1 -1
  49. package/fesm2022/masmarino-gabarit-pagination.mjs +2 -2
  50. package/fesm2022/masmarino-gabarit-pagination.mjs.map +1 -1
  51. package/fesm2022/masmarino-gabarit-radio-group.mjs +2 -2
  52. package/fesm2022/masmarino-gabarit-radio-group.mjs.map +1 -1
  53. package/fesm2022/masmarino-gabarit-search-bar.mjs +2 -2
  54. package/fesm2022/masmarino-gabarit-search-bar.mjs.map +1 -1
  55. package/fesm2022/masmarino-gabarit-segmented-control.mjs +2 -2
  56. package/fesm2022/masmarino-gabarit-segmented-control.mjs.map +1 -1
  57. package/fesm2022/masmarino-gabarit-select.mjs +2 -2
  58. package/fesm2022/masmarino-gabarit-select.mjs.map +1 -1
  59. package/fesm2022/masmarino-gabarit-slider.mjs +2 -2
  60. package/fesm2022/masmarino-gabarit-slider.mjs.map +1 -1
  61. package/fesm2022/masmarino-gabarit-sparkline.mjs +2 -2
  62. package/fesm2022/masmarino-gabarit-sparkline.mjs.map +1 -1
  63. package/fesm2022/masmarino-gabarit-stat-tile.mjs +2 -2
  64. package/fesm2022/masmarino-gabarit-stat-tile.mjs.map +1 -1
  65. package/fesm2022/masmarino-gabarit-stepper.mjs +2 -2
  66. package/fesm2022/masmarino-gabarit-stepper.mjs.map +1 -1
  67. package/fesm2022/masmarino-gabarit-switch.mjs +2 -2
  68. package/fesm2022/masmarino-gabarit-switch.mjs.map +1 -1
  69. package/fesm2022/masmarino-gabarit-table.mjs +2 -2
  70. package/fesm2022/masmarino-gabarit-table.mjs.map +1 -1
  71. package/fesm2022/masmarino-gabarit-tabs.mjs +2 -2
  72. package/fesm2022/masmarino-gabarit-tabs.mjs.map +1 -1
  73. package/fesm2022/masmarino-gabarit-tag-input.mjs +2 -2
  74. package/fesm2022/masmarino-gabarit-tag-input.mjs.map +1 -1
  75. package/fesm2022/masmarino-gabarit-textarea.mjs +2 -2
  76. package/fesm2022/masmarino-gabarit-textarea.mjs.map +1 -1
  77. package/fesm2022/masmarino-gabarit-toaster.mjs +2 -2
  78. package/fesm2022/masmarino-gabarit-toaster.mjs.map +1 -1
  79. package/fesm2022/masmarino-gabarit-tree.mjs +2 -2
  80. package/fesm2022/masmarino-gabarit-tree.mjs.map +1 -1
  81. package/fesm2022/masmarino-gabarit.mjs +3 -2
  82. package/fesm2022/masmarino-gabarit.mjs.map +1 -1
  83. package/ground/package.json +4 -0
  84. package/package.json +5 -1
  85. package/src/lib/tokens/_a11y.scss +3 -2
  86. package/src/lib/tokens/_base.scss +1 -1
  87. package/src/lib/tokens/_glass.scss +37 -6
  88. package/src/lib/tokens/_grounds.scss +33 -0
  89. package/src/lib/tokens/_utilities.scss +1 -1
  90. package/types/masmarino-gabarit-ground.d.ts +233 -0
  91. package/types/masmarino-gabarit.d.ts +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-file-upload.mjs","names":[],"sources":["../../../projects/gabarit/file-upload/file-upload.ts","../../../projects/gabarit/file-upload/file-upload.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 { Icon } from '@masmarino/gabarit/icon'\n\nlet nextId = 0\n\nfunction formatFileSize(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`\n }\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)} KB`\n }\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n}\n\n@Component({\n selector: 'gbt-file-upload',\n standalone: true,\n imports: [Icon],\n templateUrl: './file-upload.html',\n styleUrl: './file-upload.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => FileUpload),\n multi: true,\n },\n ],\n})\nexport class FileUpload implements ControlValueAccessor {\n private readonly fileInput = viewChild<ElementRef<HTMLInputElement>>('fileInput')\n\n id = input<string>(`gbt-file-upload-${++nextId}`)\n label = input<string>('')\n multiple = input(false, { transform: booleanAttribute })\n accept = input<string>('')\n maxSizeMb = input<number | null>(null)\n disabled = input(false, { transform: booleanAttribute })\n errorMessage = input<string | null>(null)\n dropLabel = input<string>('Drag and drop a file here, or click to browse')\n removeLabel = input<(name: string) => string>((name) => `Remove ${name}`)\n oversizeMessage = input<(name: string, maxSizeMb: number) => string>(\n (name, maxSizeMb) => `${name} exceeds ${maxSizeMb} MB and was not added.`,\n )\n extraFileMessage = input<(name: string) => string>(\n (name) => `${name} was not added — only one file is allowed.`,\n )\n\n protected readonly files = signal<File[]>([])\n protected readonly rejections = signal<string[]>([])\n protected readonly dragOver = signal(false)\n\n protected readonly formatFileSize = formatFileSize\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n private onChange: (value: File[]) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: File[] | null): void {\n this.files.set(value ?? [])\n }\n\n registerOnChange(fn: (value: File[]) => 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 openPicker(): void {\n if (this.isDisabled()) {\n return\n }\n this.fileInput()?.nativeElement.click()\n }\n\n protected onFilesSelected(event: Event): void {\n const input = event.target as HTMLInputElement\n this.addFiles(input.files)\n input.value = ''\n }\n\n protected onDragEnter(event: DragEvent): void {\n event.preventDefault()\n if (!this.isDisabled()) {\n this.dragOver.set(true)\n }\n }\n\n protected onDragOver(event: DragEvent): void {\n event.preventDefault()\n }\n\n protected onDragLeave(event: DragEvent): void {\n event.preventDefault()\n this.dragOver.set(false)\n }\n\n protected onDrop(event: DragEvent): void {\n event.preventDefault()\n this.dragOver.set(false)\n if (this.isDisabled()) {\n return\n }\n this.addFiles(event.dataTransfer?.files ?? null)\n }\n\n protected removeFile(file: File): void {\n if (this.isDisabled()) {\n return\n }\n const next = this.files().filter((f) => f !== file)\n this.files.set(next)\n this.onChange(next)\n this.onTouched()\n }\n\n private addFiles(fileList: FileList | null): void {\n if (!fileList || fileList.length === 0) {\n return\n }\n const incoming = Array.from(fileList)\n const maxSizeMb = this.maxSizeMb()\n const accepted: File[] = []\n const rejected: string[] = []\n for (const file of incoming) {\n if (maxSizeMb !== null && file.size > maxSizeMb * 1024 * 1024) {\n rejected.push(this.oversizeMessage()(file.name, maxSizeMb))\n } else {\n accepted.push(file)\n }\n }\n const extra = this.multiple() ? [] : accepted.slice(1)\n for (const file of extra) {\n rejected.push(this.extraFileMessage()(file.name))\n }\n this.rejections.set(rejected)\n if (accepted.length === 0) {\n return\n }\n const next = this.multiple() ? [...this.files(), ...accepted] : accepted.slice(0, 1)\n this.files.set(next)\n this.onChange(next)\n this.onTouched()\n }\n}\n","<div class=\"gbt-file-upload\">\n @if (label()) {\n <span class=\"gbt-file-upload__label\" [id]=\"id() + '-label'\">{{ label() }}</span>\n }\n <button\n type=\"button\"\n class=\"gbt-file-upload__dropzone\"\n [class.gbt-file-upload__dropzone--drag-over]=\"dragOver()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-labelledby]=\"label() ? id() + '-label' : null\"\n [attr.aria-describedby]=\"errorMessage() ? id() + '-error' : null\"\n (click)=\"openPicker()\"\n (dragenter)=\"onDragEnter($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event)\"\n >\n <gbt-icon name=\"upload\" class=\"gbt-file-upload__icon\" aria-hidden=\"true\" />\n <span class=\"gbt-file-upload__hint\">{{ dropLabel() }}</span>\n </button>\n <input\n #fileInput\n type=\"file\"\n class=\"gbt-file-upload__input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [multiple]=\"multiple()\"\n [attr.accept]=\"accept() || null\"\n [disabled]=\"isDisabled()\"\n (change)=\"onFilesSelected($event)\"\n />\n @if (rejections().length > 0) {\n <div class=\"gbt-file-upload__rejections\" role=\"alert\">\n <ul>\n @for (message of rejections(); track message) {\n <li>{{ message }}</li>\n }\n </ul>\n </div>\n }\n @if (files().length > 0) {\n <ul class=\"gbt-file-upload__files\">\n @for (file of files(); track file) {\n <li class=\"gbt-file-upload__file\">\n <span class=\"gbt-file-upload__file-name\">{{ file.name }}</span>\n <span class=\"gbt-file-upload__file-size\">{{ formatFileSize(file.size) }}</span>\n <button\n type=\"button\"\n class=\"gbt-file-upload__file-remove\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"removeLabel()(file.name)\"\n (click)=\"removeFile(file)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n </li>\n }\n </ul>\n }\n @if (errorMessage()) {\n <p [id]=\"id() + '-error'\" class=\"gbt-file-upload__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;;AAcA,IAAI,SAAS;AAEb,SAAS,eAAe,OAAa;CACnC,IAAI,QAAQ,MACV,OAAO,GAAG,MAAK;CAEjB,IAAI,QAAQ,SACV,OAAO,IAAI,QAAQ,KAAA,CAAM,QAAQ,CAAC,EAAC;CAErC,OAAO,IAAI,QAAS,QAAO,CAAO,QAAQ,CAAC,EAAC;AAC9C;AAiBA,IAAa,aAAb,MAAa,WAAU;CACJ,YAAY,UAAwC,aAAY,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAEjF,KAAK,MAAc,mBAAmB,EAAE,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CACjD,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,SAAS,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAC1B,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,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,YAAY,MAA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AAA,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;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,WAAA,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,iBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,kBAAA,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-file-upload.mjs","names":[],"sources":["../../../projects/gabarit/file-upload/file-upload.ts","../../../projects/gabarit/file-upload/file-upload.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 { Icon } from '@masmarino/gabarit/icon'\n\nlet nextId = 0\n\nfunction formatFileSize(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`\n }\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)} KB`\n }\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n}\n\n@Component({\n selector: 'gbt-file-upload',\n standalone: true,\n imports: [Icon],\n templateUrl: './file-upload.html',\n styleUrl: './file-upload.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => FileUpload),\n multi: true,\n },\n ],\n})\nexport class FileUpload implements ControlValueAccessor {\n private readonly fileInput = viewChild<ElementRef<HTMLInputElement>>('fileInput')\n\n id = input<string>(`gbt-file-upload-${++nextId}`)\n label = input<string>('')\n multiple = input(false, { transform: booleanAttribute })\n accept = input<string>('')\n maxSizeMb = input<number | null>(null)\n disabled = input(false, { transform: booleanAttribute })\n errorMessage = input<string | null>(null)\n dropLabel = input<string>('Drag and drop a file here, or click to browse')\n removeLabel = input<(name: string) => string>((name) => `Remove ${name}`)\n oversizeMessage = input<(name: string, maxSizeMb: number) => string>(\n (name, maxSizeMb) => `${name} exceeds ${maxSizeMb} MB and was not added.`,\n )\n extraFileMessage = input<(name: string) => string>(\n (name) => `${name} was not added — only one file is allowed.`,\n )\n\n protected readonly files = signal<File[]>([])\n protected readonly rejections = signal<string[]>([])\n protected readonly dragOver = signal(false)\n\n protected readonly formatFileSize = formatFileSize\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n private onChange: (value: File[]) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: File[] | null): void {\n this.files.set(value ?? [])\n }\n\n registerOnChange(fn: (value: File[]) => 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 openPicker(): void {\n if (this.isDisabled()) {\n return\n }\n this.fileInput()?.nativeElement.click()\n }\n\n protected onFilesSelected(event: Event): void {\n const input = event.target as HTMLInputElement\n this.addFiles(input.files)\n input.value = ''\n }\n\n protected onDragEnter(event: DragEvent): void {\n event.preventDefault()\n if (!this.isDisabled()) {\n this.dragOver.set(true)\n }\n }\n\n protected onDragOver(event: DragEvent): void {\n event.preventDefault()\n }\n\n protected onDragLeave(event: DragEvent): void {\n event.preventDefault()\n this.dragOver.set(false)\n }\n\n protected onDrop(event: DragEvent): void {\n event.preventDefault()\n this.dragOver.set(false)\n if (this.isDisabled()) {\n return\n }\n this.addFiles(event.dataTransfer?.files ?? null)\n }\n\n protected removeFile(file: File): void {\n if (this.isDisabled()) {\n return\n }\n const next = this.files().filter((f) => f !== file)\n this.files.set(next)\n this.onChange(next)\n this.onTouched()\n }\n\n private addFiles(fileList: FileList | null): void {\n if (!fileList || fileList.length === 0) {\n return\n }\n const incoming = Array.from(fileList)\n const maxSizeMb = this.maxSizeMb()\n const accepted: File[] = []\n const rejected: string[] = []\n for (const file of incoming) {\n if (maxSizeMb !== null && file.size > maxSizeMb * 1024 * 1024) {\n rejected.push(this.oversizeMessage()(file.name, maxSizeMb))\n } else {\n accepted.push(file)\n }\n }\n const extra = this.multiple() ? [] : accepted.slice(1)\n for (const file of extra) {\n rejected.push(this.extraFileMessage()(file.name))\n }\n this.rejections.set(rejected)\n if (accepted.length === 0) {\n return\n }\n const next = this.multiple() ? [...this.files(), ...accepted] : accepted.slice(0, 1)\n this.files.set(next)\n this.onChange(next)\n this.onTouched()\n }\n}\n","<div class=\"gbt-file-upload\">\n @if (label()) {\n <span class=\"gbt-file-upload__label\" [id]=\"id() + '-label'\">{{ label() }}</span>\n }\n <button\n type=\"button\"\n class=\"gbt-file-upload__dropzone\"\n [class.gbt-file-upload__dropzone--drag-over]=\"dragOver()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-labelledby]=\"label() ? id() + '-label' : null\"\n [attr.aria-describedby]=\"errorMessage() ? id() + '-error' : null\"\n (click)=\"openPicker()\"\n (dragenter)=\"onDragEnter($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event)\"\n >\n <gbt-icon name=\"upload\" class=\"gbt-file-upload__icon\" aria-hidden=\"true\" />\n <span class=\"gbt-file-upload__hint\">{{ dropLabel() }}</span>\n </button>\n <input\n #fileInput\n type=\"file\"\n class=\"gbt-file-upload__input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [multiple]=\"multiple()\"\n [attr.accept]=\"accept() || null\"\n [disabled]=\"isDisabled()\"\n (change)=\"onFilesSelected($event)\"\n />\n @if (rejections().length > 0) {\n <div class=\"gbt-file-upload__rejections\" role=\"alert\">\n <ul>\n @for (message of rejections(); track message) {\n <li>{{ message }}</li>\n }\n </ul>\n </div>\n }\n @if (files().length > 0) {\n <ul class=\"gbt-file-upload__files\">\n @for (file of files(); track file) {\n <li class=\"gbt-file-upload__file\">\n <span class=\"gbt-file-upload__file-name\">{{ file.name }}</span>\n <span class=\"gbt-file-upload__file-size\">{{ formatFileSize(file.size) }}</span>\n <button\n type=\"button\"\n class=\"gbt-file-upload__file-remove\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"removeLabel()(file.name)\"\n (click)=\"removeFile(file)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n </li>\n }\n </ul>\n }\n @if (errorMessage()) {\n <p [id]=\"id() + '-error'\" class=\"gbt-file-upload__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;;AAcA,IAAI,SAAS;AAEb,SAAS,eAAe,OAAa;CACnC,IAAI,QAAQ,MACV,OAAO,GAAG,MAAK;CAEjB,IAAI,QAAQ,SACV,OAAO,IAAI,QAAQ,KAAA,CAAM,QAAQ,CAAC,EAAC;CAErC,OAAO,IAAI,QAAS,QAAO,CAAO,QAAQ,CAAC,EAAC;AAC9C;AAi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;EAAA,CAAA;EAAA,WAAA,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,iBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,kBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -131,7 +131,7 @@ var FunnelChart = class FunnelChart {
131
131
  },
132
132
  ngImport: i0,
133
133
  template: "@if (renderedSteps().length > 0) {\n <ol class=\"gbt-funnel-chart\" [attr.aria-label]=\"label()\">\n @for (step of renderedSteps(); track $index) {\n <li\n class=\"gbt-funnel-chart__step\"\n [attr.data-active]=\"$index === activeIndex() ? '' : null\"\n tabindex=\"0\"\n (mouseenter)=\"activeIndex.set($index)\"\n (mouseleave)=\"onMouseLeave($event)\"\n (focus)=\"activeIndex.set($index)\"\n (blur)=\"activeIndex.set(null)\"\n >\n <div class=\"gbt-funnel-chart__bar\" [style.width.%]=\"step.part\" aria-hidden=\"true\"></div>\n <span class=\"gbt-funnel-chart__label\">{{ step.label }}</span>\n <span class=\"gbt-funnel-chart__value\">{{ step.formattedValue }}</span>\n @if ($index === activeIndex()) {\n <span class=\"gbt-funnel-chart__tip\" aria-hidden=\"true\">{{\n step.conversionFromPrevious\n }}</span>\n }\n </li>\n }\n </ol>\n <div class=\"gbt-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n @if (activeStep(); as step) {\n {{ stepAnnouncement()(step.label, step.conversionFromPrevious) }}\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"emptyMessage()\" />\n}\n",
134
- styles: [":host{display:block}.gbt-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-funnel-chart{margin:0;padding:0;list-style:none}.gbt-funnel-chart__step{position:relative;display:flex;justify-content:space-between;gap:.75rem;padding:.625rem .75rem;font-size:.875rem;color:var(--text-primary)}.gbt-funnel-chart__step+.gbt-funnel-chart__step{margin-top:.25rem}.gbt-funnel-chart__step[data-active]{background:var(--bg-hover)}.gbt-funnel-chart__step:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-funnel-chart__bar{position:absolute;inset:0 auto 0 0;background:var(--chart-series-2-base);opacity:.14;border-radius:var(--site-border-radius)}.gbt-funnel-chart__label,.gbt-funnel-chart__value,.gbt-funnel-chart__tip{position:relative}.gbt-funnel-chart__value{font-variant-numeric:tabular-nums;color:var(--text-secondary)}.gbt-funnel-chart__tip{margin-left:.5rem;font-variant-numeric:tabular-nums;color:var(--text-secondary)}\n"],
134
+ styles: [":host{display:block}.gbt-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-funnel-chart{margin:0;padding:0;list-style:none}.gbt-funnel-chart__step{position:relative;display:flex;justify-content:space-between;gap:.75rem;padding:.625rem .75rem;font-size:.875rem;color:var(--text-primary)}.gbt-funnel-chart__step+.gbt-funnel-chart__step{margin-top:.25rem}.gbt-funnel-chart__step[data-active]{background:var(--bg-hover)}.gbt-funnel-chart__step:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--gbt-ground-accent, var(--focus-ring)));outline-offset:-2px}.gbt-funnel-chart__bar{position:absolute;inset:0 auto 0 0;background:var(--chart-series-2-base);opacity:.14;border-radius:var(--site-border-radius)}.gbt-funnel-chart__label,.gbt-funnel-chart__value,.gbt-funnel-chart__tip{position:relative}.gbt-funnel-chart__value{font-variant-numeric:tabular-nums;color:var(--text-secondary)}.gbt-funnel-chart__tip{margin-left:.5rem;font-variant-numeric:tabular-nums;color:var(--text-secondary)}\n"],
135
135
  dependencies: [{
136
136
  kind: "component",
137
137
  type: ChartTable,
@@ -164,7 +164,7 @@ i0.ɵɵngDeclareClassMetadata({
164
164
  imports: [ChartTable, ChartEmpty],
165
165
  changeDetection: ChangeDetectionStrategy.OnPush,
166
166
  template: "@if (renderedSteps().length > 0) {\n <ol class=\"gbt-funnel-chart\" [attr.aria-label]=\"label()\">\n @for (step of renderedSteps(); track $index) {\n <li\n class=\"gbt-funnel-chart__step\"\n [attr.data-active]=\"$index === activeIndex() ? '' : null\"\n tabindex=\"0\"\n (mouseenter)=\"activeIndex.set($index)\"\n (mouseleave)=\"onMouseLeave($event)\"\n (focus)=\"activeIndex.set($index)\"\n (blur)=\"activeIndex.set(null)\"\n >\n <div class=\"gbt-funnel-chart__bar\" [style.width.%]=\"step.part\" aria-hidden=\"true\"></div>\n <span class=\"gbt-funnel-chart__label\">{{ step.label }}</span>\n <span class=\"gbt-funnel-chart__value\">{{ step.formattedValue }}</span>\n @if ($index === activeIndex()) {\n <span class=\"gbt-funnel-chart__tip\" aria-hidden=\"true\">{{\n step.conversionFromPrevious\n }}</span>\n }\n </li>\n }\n </ol>\n <div class=\"gbt-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n @if (activeStep(); as step) {\n {{ stepAnnouncement()(step.label, step.conversionFromPrevious) }}\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"emptyMessage()\" />\n}\n",
167
- styles: [":host{display:block}.gbt-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-funnel-chart{margin:0;padding:0;list-style:none}.gbt-funnel-chart__step{position:relative;display:flex;justify-content:space-between;gap:.75rem;padding:.625rem .75rem;font-size:.875rem;color:var(--text-primary)}.gbt-funnel-chart__step+.gbt-funnel-chart__step{margin-top:.25rem}.gbt-funnel-chart__step[data-active]{background:var(--bg-hover)}.gbt-funnel-chart__step:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-funnel-chart__bar{position:absolute;inset:0 auto 0 0;background:var(--chart-series-2-base);opacity:.14;border-radius:var(--site-border-radius)}.gbt-funnel-chart__label,.gbt-funnel-chart__value,.gbt-funnel-chart__tip{position:relative}.gbt-funnel-chart__value{font-variant-numeric:tabular-nums;color:var(--text-secondary)}.gbt-funnel-chart__tip{margin-left:.5rem;font-variant-numeric:tabular-nums;color:var(--text-secondary)}\n"]
167
+ styles: [":host{display:block}.gbt-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-funnel-chart{margin:0;padding:0;list-style:none}.gbt-funnel-chart__step{position:relative;display:flex;justify-content:space-between;gap:.75rem;padding:.625rem .75rem;font-size:.875rem;color:var(--text-primary)}.gbt-funnel-chart__step+.gbt-funnel-chart__step{margin-top:.25rem}.gbt-funnel-chart__step[data-active]{background:var(--bg-hover)}.gbt-funnel-chart__step:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--gbt-ground-accent, var(--focus-ring)));outline-offset:-2px}.gbt-funnel-chart__bar{position:absolute;inset:0 auto 0 0;background:var(--chart-series-2-base);opacity:.14;border-radius:var(--site-border-radius)}.gbt-funnel-chart__label,.gbt-funnel-chart__value,.gbt-funnel-chart__tip{position:relative}.gbt-funnel-chart__value{font-variant-numeric:tabular-nums;color:var(--text-secondary)}.gbt-funnel-chart__tip{margin-left:.5rem;font-variant-numeric:tabular-nums;color:var(--text-secondary)}\n"]
168
168
  }]
169
169
  }],
170
170
  propDecorators: {
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-funnel-chart.mjs","names":[],"sources":["../../../projects/gabarit/funnel-chart/funnel-chart.ts","../../../projects/gabarit/funnel-chart/funnel-chart.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core'\nimport { ChartEmpty } from '@masmarino/gabarit/chart'\nimport { ChartTable } from '@masmarino/gabarit/chart'\nimport { formatNumber, formatPercent } from '@masmarino/gabarit/format'\n\nexport interface FunnelStep {\n label: string\n value: number\n}\n\ninterface RenderedStep {\n label: string\n formattedValue: string\n\n part: number\n\n conversionFromPrevious: string\n}\n\n@Component({\n selector: 'gbt-funnel-chart',\n standalone: true,\n imports: [ChartTable, ChartEmpty],\n templateUrl: './funnel-chart.html',\n styleUrl: './funnel-chart.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FunnelChart {\n steps = input.required<FunnelStep[]>()\n label = input.required<string>()\n locale = input.required<string>()\n emptyMessage = input.required<string>()\n tableCaption = input.required<string>()\n stepColumn = input.required<string>()\n valueColumn = input.required<string>()\n conversionColumn = input.required<string>()\n stepAnnouncement = input.required<(label: string, conversion: string) => string>()\n\n private readonly reference = computed(() => this.steps()[0]?.value ?? 0)\n\n protected readonly activeIndex = signal<number | null>(null)\n\n protected onMouseLeave(event: MouseEvent): void {\n const target = event.currentTarget as HTMLElement\n if (target.ownerDocument.activeElement === target) return\n this.activeIndex.set(null)\n }\n\n protected readonly renderedSteps = computed<RenderedStep[]>(() => {\n const reference = this.reference()\n const steps = this.steps()\n return steps.map((step, index) => {\n const previousValue = index === 0 ? step.value : steps[index - 1].value\n return {\n label: step.label,\n formattedValue: formatNumber(step.value, this.locale()),\n\n part: reference <= 0 ? 0 : (step.value / reference) * 100,\n conversionFromPrevious: formatPercent(\n previousValue <= 0 ? 0 : step.value / previousValue,\n this.locale(),\n ),\n }\n })\n })\n\n protected readonly activeStep = computed<RenderedStep | null>(() => {\n const index = this.activeIndex()\n if (index === null) return null\n return this.renderedSteps()[index] ?? null\n })\n\n protected readonly columns = computed(() => [\n this.stepColumn(),\n this.valueColumn(),\n this.conversionColumn(),\n ])\n\n protected readonly tableRows = computed<(string | number)[][]>(() => {\n const reference = this.reference()\n return this.steps().map((step) => [\n step.label,\n formatNumber(step.value, this.locale()),\n formatPercent(reference <= 0 ? 0 : step.value / reference, this.locale()),\n ])\n })\n}\n","@if (renderedSteps().length > 0) {\n <ol class=\"gbt-funnel-chart\" [attr.aria-label]=\"label()\">\n @for (step of renderedSteps(); track $index) {\n <li\n class=\"gbt-funnel-chart__step\"\n [attr.data-active]=\"$index === activeIndex() ? '' : null\"\n tabindex=\"0\"\n (mouseenter)=\"activeIndex.set($index)\"\n (mouseleave)=\"onMouseLeave($event)\"\n (focus)=\"activeIndex.set($index)\"\n (blur)=\"activeIndex.set(null)\"\n >\n <div class=\"gbt-funnel-chart__bar\" [style.width.%]=\"step.part\" aria-hidden=\"true\"></div>\n <span class=\"gbt-funnel-chart__label\">{{ step.label }}</span>\n <span class=\"gbt-funnel-chart__value\">{{ step.formattedValue }}</span>\n @if ($index === activeIndex()) {\n <span class=\"gbt-funnel-chart__tip\" aria-hidden=\"true\">{{\n step.conversionFromPrevious\n }}</span>\n }\n </li>\n }\n </ol>\n <div class=\"gbt-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n @if (activeStep(); as step) {\n {{ stepAnnouncement()(step.label, step.conversionFromPrevious) }}\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"emptyMessage()\" />\n}\n"],"mappings":";;;;AA2BA,IAAa,cAAb,MAAa,YAAW;CACtB,QAAQ,MAAM,SAAwB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,SAAS,MA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it/funnel-chart/funnel-chart.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core'\nimport { ChartEmpty } from '@masmarino/gabarit/chart'\nimport { ChartTable } from '@masmarino/gabarit/chart'\nimport { formatNumber, formatPercent } from '@masmarino/gabarit/format'\n\nexport interface FunnelStep {\n label: string\n value: number\n}\n\ninterface RenderedStep {\n label: string\n formattedValue: string\n\n part: number\n\n conversionFromPrevious: string\n}\n\n@Component({\n selector: 'gbt-funnel-chart',\n standalone: true,\n imports: [ChartTable, ChartEmpty],\n templateUrl: './funnel-chart.html',\n styleUrl: './funnel-chart.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FunnelChart {\n steps = input.required<FunnelStep[]>()\n label = input.required<string>()\n locale = input.required<string>()\n emptyMessage = input.required<string>()\n tableCaption = input.required<string>()\n stepColumn = input.required<string>()\n valueColumn = input.required<string>()\n conversionColumn = input.required<string>()\n stepAnnouncement = input.required<(label: string, conversion: string) => string>()\n\n private readonly reference = computed(() => this.steps()[0]?.value ?? 0)\n\n protected readonly activeIndex = signal<number | null>(null)\n\n protected onMouseLeave(event: MouseEvent): void {\n const target = event.currentTarget as HTMLElement\n if (target.ownerDocument.activeElement === target) return\n this.activeIndex.set(null)\n }\n\n protected readonly renderedSteps = computed<RenderedStep[]>(() => {\n const reference = this.reference()\n const steps = this.steps()\n return steps.map((step, index) => {\n const previousValue = index === 0 ? step.value : steps[index - 1].value\n return {\n label: step.label,\n formattedValue: formatNumber(step.value, this.locale()),\n\n part: reference <= 0 ? 0 : (step.value / reference) * 100,\n conversionFromPrevious: formatPercent(\n previousValue <= 0 ? 0 : step.value / previousValue,\n this.locale(),\n ),\n }\n })\n })\n\n protected readonly activeStep = computed<RenderedStep | null>(() => {\n const index = this.activeIndex()\n if (index === null) return null\n return this.renderedSteps()[index] ?? null\n })\n\n protected readonly columns = computed(() => [\n this.stepColumn(),\n this.valueColumn(),\n this.conversionColumn(),\n ])\n\n protected readonly tableRows = computed<(string | number)[][]>(() => {\n const reference = this.reference()\n return this.steps().map((step) => [\n step.label,\n formatNumber(step.value, this.locale()),\n formatPercent(reference <= 0 ? 0 : step.value / reference, this.locale()),\n ])\n })\n}\n","@if (renderedSteps().length > 0) {\n <ol class=\"gbt-funnel-chart\" [attr.aria-label]=\"label()\">\n @for (step of renderedSteps(); track $index) {\n <li\n class=\"gbt-funnel-chart__step\"\n [attr.data-active]=\"$index === activeIndex() ? '' : null\"\n tabindex=\"0\"\n (mouseenter)=\"activeIndex.set($index)\"\n (mouseleave)=\"onMouseLeave($event)\"\n (focus)=\"activeIndex.set($index)\"\n (blur)=\"activeIndex.set(null)\"\n >\n <div class=\"gbt-funnel-chart__bar\" [style.width.%]=\"step.part\" aria-hidden=\"true\"></div>\n <span class=\"gbt-funnel-chart__label\">{{ step.label }}</span>\n <span class=\"gbt-funnel-chart__value\">{{ step.formattedValue }}</span>\n @if ($index === activeIndex()) {\n <span class=\"gbt-funnel-chart__tip\" aria-hidden=\"true\">{{\n step.conversionFromPrevious\n }}</span>\n }\n </li>\n }\n </ol>\n <div class=\"gbt-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n @if (activeStep(); as step) {\n {{ stepAnnouncement()(step.label, step.conversionFromPrevious) }}\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"emptyMessage()\" />\n}\n"],"mappings":";;;;AA2BA,IAAa,cAAb,MAAa,YAAW;CACtB,QAAQ,MAAM,SAAwB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,SAAS,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACjC,eAAe,MAAM,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4",
13
+ x: .12,
14
+ y: -.08,
15
+ strength: 1
16
+ },
17
+ glass: "#FFFFFF",
18
+ ink: "#10151C"
19
+ },
20
+ dark: {
21
+ mode: "dark",
22
+ kind: "dark",
23
+ angle: 160,
24
+ stops: [
25
+ "#0D1116",
26
+ "#0F1820",
27
+ "#13283A"
28
+ ],
29
+ light: {
30
+ color: "#2A2236",
31
+ x: .08,
32
+ y: -.1,
33
+ strength: 1
34
+ },
35
+ glass: "#161C24",
36
+ ink: "#E7EBF1"
37
+ },
38
+ black: {
39
+ mode: "dark",
40
+ kind: "dark",
41
+ angle: 160,
42
+ stops: ["#000000", "#07090D"],
43
+ light: {
44
+ color: "#16141F",
45
+ x: .08,
46
+ y: -.1,
47
+ strength: 1
48
+ },
49
+ glass: "#0E1217",
50
+ ink: "#E7EBF1"
51
+ },
52
+ aurore: {
53
+ mode: "dark",
54
+ kind: "tinted",
55
+ angle: 135,
56
+ stops: [
57
+ "#4A3392",
58
+ "#5442C0",
59
+ "#24346E",
60
+ "#13707E"
61
+ ],
62
+ light: {
63
+ color: "#FF8A7A",
64
+ x: 0,
65
+ y: 0,
66
+ strength: .45
67
+ },
68
+ glass: "#14102C",
69
+ ink: "#FFFFFF"
70
+ },
71
+ lagune: {
72
+ mode: "dark",
73
+ kind: "tinted",
74
+ angle: 150,
75
+ stops: [
76
+ "#0B4257",
77
+ "#0D5A66",
78
+ "#0B2E4A"
79
+ ],
80
+ light: {
81
+ color: "#5FD4C4",
82
+ x: .9,
83
+ y: .05,
84
+ strength: .35
85
+ },
86
+ glass: "#06222E",
87
+ ink: "#FFFFFF"
88
+ },
89
+ braise: {
90
+ mode: "dark",
91
+ kind: "tinted",
92
+ angle: 160,
93
+ stops: [
94
+ "#6A1A10",
95
+ "#8A2E14",
96
+ "#3A0E14"
97
+ ],
98
+ light: {
99
+ color: "#FF9A4D",
100
+ x: .15,
101
+ y: 0,
102
+ strength: .45
103
+ },
104
+ glass: "#2A0A0C",
105
+ ink: "#FFFFFF"
106
+ },
107
+ nuitPolaire: {
108
+ mode: "dark",
109
+ kind: "tinted",
110
+ angle: 170,
111
+ stops: [
112
+ "#0B1630",
113
+ "#1C2F5E",
114
+ "#0E3B4A"
115
+ ],
116
+ light: {
117
+ color: "#5CE1B9",
118
+ x: .8,
119
+ y: -.05,
120
+ strength: .4
121
+ },
122
+ glass: "#081022",
123
+ ink: "#FFFFFF"
124
+ },
125
+ sousBois: {
126
+ mode: "dark",
127
+ kind: "tinted",
128
+ angle: 160,
129
+ stops: [
130
+ "#16301F",
131
+ "#2E4A2A",
132
+ "#0F1F18"
133
+ ],
134
+ light: {
135
+ color: "#9CC27A",
136
+ x: .1,
137
+ y: -.05,
138
+ strength: .4
139
+ },
140
+ glass: "#0B1A10",
141
+ ink: "#FFFFFF"
142
+ },
143
+ laiton: {
144
+ mode: "dark",
145
+ kind: "tinted",
146
+ angle: 150,
147
+ stops: [
148
+ "#3A2A12",
149
+ "#6B4E1F",
150
+ "#22180C"
151
+ ],
152
+ light: {
153
+ color: "#E0B465",
154
+ x: .2,
155
+ y: -.05,
156
+ strength: .45
157
+ },
158
+ glass: "#1C140A",
159
+ ink: "#FFFFFF"
160
+ },
161
+ givre: {
162
+ mode: "light",
163
+ kind: "light",
164
+ angle: 160,
165
+ stops: [
166
+ "#EEF3F8",
167
+ "#DDE8F3",
168
+ "#E9E4F5"
169
+ ],
170
+ light: {
171
+ color: "#FFFFFF",
172
+ x: .15,
173
+ y: -.05,
174
+ strength: 1
175
+ },
176
+ glass: "#FFFFFF",
177
+ ink: "#10151C"
178
+ },
179
+ dore: {
180
+ mode: "dark",
181
+ kind: "tinted",
182
+ angle: 155,
183
+ stops: [
184
+ "#2B200D",
185
+ "#4A3816",
186
+ "#1A1309"
187
+ ],
188
+ light: {
189
+ color: "#E9C979",
190
+ x: .18,
191
+ y: -.06,
192
+ strength: .3
193
+ },
194
+ glass: "#17110A",
195
+ ink: "#FFFFFF",
196
+ accent: "#E9C979"
197
+ }
198
+ };
199
+ const GROUND_KINDS = {
200
+ light: {
201
+ thin: .46,
202
+ regular: .68,
203
+ thick: .88
204
+ },
205
+ dark: {
206
+ thin: .42,
207
+ regular: .62,
208
+ thick: .86
209
+ },
210
+ tinted: {
211
+ thin: .22,
212
+ regular: .34,
213
+ thick: .62
214
+ }
215
+ };
216
+ const GROUND_RULE = {
217
+ text: 4.5,
218
+ edge: 3,
219
+ secondaryMax: .8,
220
+ discretMax: .64,
221
+ prominent: .86,
222
+ step: .05,
223
+ selected: {
224
+ light: .1,
225
+ dark: .16
226
+ },
227
+ inks: ["#FFFFFF", "#10151C"]
228
+ };
229
+ const TEXT = GROUND_RULE.text;
230
+ const EPSILON = 1e-9;
231
+ function rgb(hexa) {
232
+ const value = hexa.replace("#", "");
233
+ if (!/^[0-9a-fA-F]{6}$/.test(value)) throw new Error(`groundAccent: "${hexa}" is not a colour #RRGGBB`);
234
+ return [
235
+ 0,
236
+ 2,
237
+ 4
238
+ ].map((index) => parseInt(value.slice(index, index + 2), 16) / 255);
239
+ }
240
+ function roundEven(value) {
241
+ const floor = Math.floor(value);
242
+ const rest = value - floor;
243
+ if (Math.abs(rest - .5) > 1e-12) return Math.round(value);
244
+ return floor % 2 === 0 ? floor : floor + 1;
245
+ }
246
+ function channels(colour) {
247
+ return colour.map((c) => roundEven(c * 255));
248
+ }
249
+ function hexa(colour) {
250
+ return "#" + channels(colour).map((c) => c.toString(16).toUpperCase().padStart(2, "0")).join("");
251
+ }
252
+ function luminance(colour) {
253
+ const [r, g, b] = colour.map((c) => c <= .04045 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4);
254
+ return .2126 * r + .7152 * g + .0722 * b;
255
+ }
256
+ function contrast(a, b) {
257
+ const [la, lb] = [luminance(a), luminance(b)];
258
+ return (Math.max(la, lb) + .05) / (Math.min(la, lb) + .05);
259
+ }
260
+ function laid(top, opacity, under) {
261
+ return top.map((t, index) => t * opacity + under[index] * (1 - opacity));
262
+ }
263
+ function mixed(a, b, amount) {
264
+ return a.map((x, index) => x + (b[index] - x) * amount);
265
+ }
266
+ function lightStop(ambiance) {
267
+ const angle = ambiance.angle * Math.PI / 180;
268
+ const [dx, dy] = [Math.sin(angle), -Math.cos(angle)];
269
+ const reach = (Math.abs(dx) + Math.abs(dy)) / 2;
270
+ const along = ((ambiance.light.x - .5) * dx + (ambiance.light.y - .5) * dy) / reach / 2 + .5;
271
+ return roundEven(Math.min(Math.max(along, 0), 1) * (ambiance.stops.length - 1));
272
+ }
273
+ function points(ambiance) {
274
+ const stops = ambiance.stops.map(rgb);
275
+ return [...stops, laid(rgb(ambiance.light.color), ambiance.light.strength, stops[lightStop(ambiance)])];
276
+ }
277
+ function veil(ambiance, at) {
278
+ const [ink, glass] = [rgb(ambiance.ink), rgb(ambiance.glass)];
279
+ const holds = (v, alpha, minimum) => at.every((point) => {
280
+ const under = laid(glass, v, point);
281
+ return contrast(laid(ink, alpha, under), under) >= minimum;
282
+ });
283
+ for (let step = 0; step <= 100; step++) {
284
+ const v = step / 100;
285
+ if (holds(v, 1, TEXT) && holds(v, GROUND_RULE.secondaryMax, TEXT) && holds(v, GROUND_RULE.discretMax, GROUND_RULE.edge)) return v;
286
+ }
287
+ return null;
288
+ }
289
+ function cssColour(colour, opacity = 1) {
290
+ if (opacity === 1) return colour.toLowerCase();
291
+ return `rgba(${channels(rgb(colour)).join(", ")}, ${Number(opacity.toFixed(4))})`;
292
+ }
293
+ function groundAccent(accent, ambiance) {
294
+ const spec = typeof ambiance === "string" ? GROUND_AMBIANCES[ambiance] : ambiance;
295
+ if (!spec) throw new Error(`groundAccent: no ambiance "${String(ambiance)}"`);
296
+ const at = points(spec);
297
+ const v = veil(spec, at);
298
+ if (v === null) return null;
299
+ const kind = GROUND_KINDS[spec.kind];
300
+ const [colour, ink, glass] = [
301
+ rgb(accent),
302
+ rgb(spec.ink),
303
+ rgb(spec.glass)
304
+ ];
305
+ const veiled = at.map((point) => laid(glass, v, point));
306
+ const surfaces = veiled.flatMap((under) => [under, ...[
307
+ kind.thin,
308
+ kind.regular,
309
+ kind.thick
310
+ ].map((opacity) => laid(glass, opacity, under))]);
311
+ const count = Math.round(1 / GROUND_RULE.step);
312
+ let text = ink;
313
+ for (let index = 0; index <= count; index++) {
314
+ const candidate = mixed(colour, ink, Math.min(index * GROUND_RULE.step, 1));
315
+ if (surfaces.every((under) => contrast(candidate, under) >= TEXT - EPSILON)) {
316
+ text = candidate;
317
+ break;
318
+ }
319
+ }
320
+ const fills = [colour, ...veiled.map((under) => laid(colour, GROUND_RULE.prominent, under))];
321
+ const worst = (candidate) => Math.min(...fills.map((fill) => contrast(candidate, fill)));
322
+ const on = GROUND_RULE.inks.map(rgb).reduce((best, candidate) => worst(candidate) > worst(best) ? candidate : best);
323
+ const edge = Math.min(...veiled.map((under) => contrast(colour, under)));
324
+ const onAccentContrast = worst(on);
325
+ const selected = GROUND_RULE.selected[spec.mode];
326
+ const [accentHexa, textHexa, onHexa] = [
327
+ hexa(colour),
328
+ hexa(text),
329
+ hexa(on)
330
+ ];
331
+ return {
332
+ accent: accentHexa,
333
+ accentText: textHexa,
334
+ onAccent: onHexa,
335
+ selected,
336
+ edge,
337
+ onAccentContrast,
338
+ holds: edge >= GROUND_RULE.edge - EPSILON && onAccentContrast >= TEXT - EPSILON,
339
+ properties: {
340
+ "--gbt-ground-accent": cssColour(accentHexa),
341
+ "--gbt-ground-accent-text": cssColour(textHexa),
342
+ "--gbt-ground-on-accent": cssColour(onHexa),
343
+ "--gbt-ground-selected-fill": cssColour(accentHexa, selected)
344
+ }
345
+ };
346
+ }
347
+ export { GROUND_AMBIANCES, groundAccent };
348
+
349
+ //# sourceMappingURL=masmarino-gabarit-ground.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"masmarino-gabarit-ground.mjs","names":[],"sources":["../../../projects/gabarit/ground/ground-tokens.ts","../../../projects/gabarit/ground/ground-accent.ts"],"sourcesContent":["// The ambiances of tokens/gabarit.json (4.0) and what the rule of an ambiance's own accent reads (4.2):\n// groundAccent() computes, at run time, what tools/tokens.py computes for the ambiances that bring one.\n// Generated by tools/tokens.py from tokens/gabarit.json: do not edit.\n\nimport type { GroundAmbiance, GroundKind } from './ground-types'\n\n/** Gabarit's ambiances, by their name in tokens/gabarit.json (`ambiance-<name>` in `_grounds.scss`). */\nexport const GROUND_AMBIANCES = {\n light: {\n mode: 'light',\n kind: 'light',\n angle: 160,\n stops: ['#F2F4F7', '#EFE6FA', '#DCE7F7'],\n light: { color: '#FFE6D4', x: 0.12, y: -0.08, strength: 1 },\n glass: '#FFFFFF',\n ink: '#10151C',\n },\n dark: {\n mode: 'dark',\n kind: 'dark',\n angle: 160,\n stops: ['#0D1116', '#0F1820', '#13283A'],\n light: { color: '#2A2236', x: 0.08, y: -0.1, strength: 1 },\n glass: '#161C24',\n ink: '#E7EBF1',\n },\n black: {\n mode: 'dark',\n kind: 'dark',\n angle: 160,\n stops: ['#000000', '#07090D'],\n light: { color: '#16141F', x: 0.08, y: -0.1, strength: 1 },\n glass: '#0E1217',\n ink: '#E7EBF1',\n },\n aurore: {\n mode: 'dark',\n kind: 'tinted',\n angle: 135,\n stops: ['#4A3392', '#5442C0', '#24346E', '#13707E'],\n light: { color: '#FF8A7A', x: 0, y: 0, strength: 0.45 },\n glass: '#14102C',\n ink: '#FFFFFF',\n },\n lagune: {\n mode: 'dark',\n kind: 'tinted',\n angle: 150,\n stops: ['#0B4257', '#0D5A66', '#0B2E4A'],\n light: { color: '#5FD4C4', x: 0.9, y: 0.05, strength: 0.35 },\n glass: '#06222E',\n ink: '#FFFFFF',\n },\n braise: {\n mode: 'dark',\n kind: 'tinted',\n angle: 160,\n stops: ['#6A1A10', '#8A2E14', '#3A0E14'],\n light: { color: '#FF9A4D', x: 0.15, y: 0, strength: 0.45 },\n glass: '#2A0A0C',\n ink: '#FFFFFF',\n },\n nuitPolaire: {\n mode: 'dark',\n kind: 'tinted',\n angle: 170,\n stops: ['#0B1630', '#1C2F5E', '#0E3B4A'],\n light: { color: '#5CE1B9', x: 0.8, y: -0.05, strength: 0.4 },\n glass: '#081022',\n ink: '#FFFFFF',\n },\n sousBois: {\n mode: 'dark',\n kind: 'tinted',\n angle: 160,\n stops: ['#16301F', '#2E4A2A', '#0F1F18'],\n light: { color: '#9CC27A', x: 0.1, y: -0.05, strength: 0.4 },\n glass: '#0B1A10',\n ink: '#FFFFFF',\n },\n laiton: {\n mode: 'dark',\n kind: 'tinted',\n angle: 150,\n stops: ['#3A2A12', '#6B4E1F', '#22180C'],\n light: { color: '#E0B465', x: 0.2, y: -0.05, strength: 0.45 },\n glass: '#1C140A',\n ink: '#FFFFFF',\n },\n givre: {\n mode: 'light',\n kind: 'light',\n angle: 160,\n stops: ['#EEF3F8', '#DDE8F3', '#E9E4F5'],\n light: { color: '#FFFFFF', x: 0.15, y: -0.05, strength: 1 },\n glass: '#FFFFFF',\n ink: '#10151C',\n },\n dore: {\n mode: 'dark',\n kind: 'tinted',\n angle: 155,\n stops: ['#2B200D', '#4A3816', '#1A1309'],\n light: { color: '#E9C979', x: 0.18, y: -0.06, strength: 0.3 },\n glass: '#17110A',\n ink: '#FFFFFF',\n accent: '#E9C979',\n },\n} as const satisfies Record<string, GroundAmbiance>\n\n/** The content glasses of each kind of ambiance: their opacities over the veiled ground. */\nexport const GROUND_KINDS: Record<GroundKind, { thin: number; regular: number; thick: number }> = {\n light: { thin: 0.46, regular: 0.68, thick: 0.88 },\n dark: { thin: 0.42, regular: 0.62, thick: 0.86 },\n tinted: { thin: 0.22, regular: 0.34, thick: 0.62 },\n}\n\n/** The rule's numbers: the minimums, the ink's limits under the veil, the accent's steps. */\nexport const GROUND_RULE = {\n text: 4.5,\n edge: 3,\n secondaryMax: 0.8,\n discretMax: 0.64,\n prominent: 0.86,\n step: 0.05,\n selected: { light: 0.1, dark: 0.16 },\n inks: ['#FFFFFF', '#10151C'],\n} as const\n","import { GROUND_AMBIANCES, GROUND_KINDS, GROUND_RULE } from './ground-tokens'\nimport type { GroundAmbiance } from './ground-types'\n\n/** The name of one of Gabarit's ambiances (tokens/gabarit.json, ground.ambiances). */\nexport type GroundAmbianceName = keyof typeof GROUND_AMBIANCES\n\n/**\n * The four CSS custom properties of an ambiance's own accent (4.2), as `ambiance-dore` poses them: the components\n * under them follow the accent (the main buttons, the chosen chips and tab, the links, the selection, the focus ring,\n * the tinted and prominent glass and the ink on it). Without them, Gabarit's own accent.\n */\nexport interface GroundAccentProperties {\n readonly '--gbt-ground-accent': string\n readonly '--gbt-ground-accent-text': string\n readonly '--gbt-ground-on-accent': string\n readonly '--gbt-ground-selected-fill': string\n}\n\n/** An ambiance's own accent and its roles, computed by the rule of tools/tokens.py (`accent_tone`). */\nexport interface GroundAccent {\n /** The accent as given, `#RRGGBB`: fills, the focus ring, the prominent glass. */\n readonly accent: string\n /** Text in the accent (links, the chosen tab's label): the accent, or mixed toward the ink until it holds 4.5:1. */\n readonly accentText: string\n /** Text and icons on the accent: white or the ink of Gabarit's slate900, the better at the worst fill. */\n readonly onAccent: string\n /** The opacity of the selection's fill (the accent at it). */\n readonly selected: number\n /** The accent's contrast with the veiled ground at its worst point: 3:1 at least for an edge or a focus ring. */\n readonly edge: number\n /** The contrast of `onAccent` on the accent and on the prominent glass at their worst: 4.5:1 at least. */\n readonly onAccentContrast: number\n /** Whether the accent holds on this ambiance: `edge` 3:1 and `onAccentContrast` 4.5:1. */\n readonly holds: boolean\n /** The custom properties to pose on the element that carries the ambiance (or any element above the components). */\n readonly properties: GroundAccentProperties\n}\n\ntype Rgb = readonly [number, number, number]\n\nconst TEXT = GROUND_RULE.text\nconst EPSILON = 1e-9\n\nfunction rgb(hexa: string): Rgb {\n const value = hexa.replace('#', '')\n if (!/^[0-9a-fA-F]{6}$/.test(value)) {\n throw new Error(`groundAccent: \"${hexa}\" is not a colour #RRGGBB`)\n }\n return [0, 2, 4].map(\n (index) => parseInt(value.slice(index, index + 2), 16) / 255,\n ) as unknown as Rgb\n}\n\n/** Python's round(): halves to the even neighbour, so that the hexadecimals are tools/tokens.py's to the bit. */\nfunction roundEven(value: number): number {\n const floor = Math.floor(value)\n const rest = value - floor\n if (Math.abs(rest - 0.5) > 1e-12) return Math.round(value)\n return floor % 2 === 0 ? floor : floor + 1\n}\n\nfunction channels(colour: Rgb): number[] {\n return colour.map((c) => roundEven(c * 255))\n}\n\nfunction hexa(colour: Rgb): string {\n return (\n '#' +\n channels(colour)\n .map((c) => c.toString(16).toUpperCase().padStart(2, '0'))\n .join('')\n )\n}\n\n/** WCAG's relative luminance. */\nfunction luminance(colour: Rgb): number {\n const [r, g, b] = colour.map((c) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4))\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n\nfunction contrast(a: Rgb, b: Rgb): number {\n const [la, lb] = [luminance(a), luminance(b)]\n return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05)\n}\n\n/** `top` at `opacity` on the opaque `under`. */\nfunction laid(top: Rgb, opacity: number, under: Rgb): Rgb {\n return top.map((t, index) => t * opacity + under[index] * (1 - opacity)) as unknown as Rgb\n}\n\n/** `a` moved toward `b` by `amount` (0: `a`, 1: `b`). */\nfunction mixed(a: Rgb, b: Rgb, amount: number): Rgb {\n return a.map((x, index) => x + (b[index] - x) * amount) as unknown as Rgb\n}\n\n/** The stop under the light's centre: its place projected on the gradient's line, rounded to the nearest stop. */\nfunction lightStop(ambiance: GroundAmbiance): number {\n const angle = (ambiance.angle * Math.PI) / 180\n const [dx, dy] = [Math.sin(angle), -Math.cos(angle)]\n const reach = (Math.abs(dx) + Math.abs(dy)) / 2\n const along = ((ambiance.light.x - 0.5) * dx + (ambiance.light.y - 0.5) * dy) / reach / 2 + 0.5\n return roundEven(Math.min(Math.max(along, 0), 1) * (ambiance.stops.length - 1))\n}\n\n/** Where the ink may land: every stop, and the light at its centre over the stop under it. */\nfunction points(ambiance: GroundAmbiance): Rgb[] {\n const stops = ambiance.stops.map(rgb)\n return [\n ...stops,\n laid(rgb(ambiance.light.color), ambiance.light.strength, stops[lightStop(ambiance)]),\n ]\n}\n\n/** The veil over the ground (tools/tokens.py's tone()): the least, by hundredths, that lets the ink hold. */\nfunction veil(ambiance: GroundAmbiance, at: Rgb[]): number | null {\n const [ink, glass] = [rgb(ambiance.ink), rgb(ambiance.glass)]\n const holds = (v: number, alpha: number, minimum: number) =>\n at.every((point) => {\n const under = laid(glass, v, point)\n return contrast(laid(ink, alpha, under), under) >= minimum\n })\n for (let step = 0; step <= 100; step++) {\n const v = step / 100\n if (\n holds(v, 1, TEXT) &&\n holds(v, GROUND_RULE.secondaryMax, TEXT) &&\n holds(v, GROUND_RULE.discretMax, GROUND_RULE.edge)\n ) {\n return v\n }\n }\n return null\n}\n\n/** A colour at an opacity, as the generated CSS writes it. */\nfunction cssColour(colour: string, opacity = 1): string {\n if (opacity === 1) return colour.toLowerCase()\n return `rgba(${channels(rgb(colour)).join(', ')}, ${Number(opacity.toFixed(4))})`\n}\n\n/**\n * An ambiance's own accent and its roles (4.2), by the rule every platform shares (tokens/gabarit.json's\n * `ground.accent`, tools/tokens.py's `accent_tone`), and the custom properties that make the components follow it.\n *\n * ```ts\n * const tone = groundAccent('#B8862B', 'givre')\n * for (const [name, value] of Object.entries(tone?.properties ?? {})) element.style.setProperty(name, value)\n * ```\n *\n * `ambiance`: the name of one of Gabarit's ambiances, or one of the application's own. Returns `null` when the\n * ambiance has no veil that lets its ink hold (tools/tokens.py refuses it). The accent is not refused here: check\n * `holds` (an accent too close to its ground fails its 3:1 edge).\n */\nexport function groundAccent(\n accent: string,\n ambiance: GroundAmbianceName | GroundAmbiance,\n): GroundAccent | null {\n const spec: GroundAmbiance = typeof ambiance === 'string' ? GROUND_AMBIANCES[ambiance] : ambiance\n if (!spec) throw new Error(`groundAccent: no ambiance \"${String(ambiance)}\"`)\n const at = points(spec)\n const v = veil(spec, at)\n if (v === null) return null\n const kind = GROUND_KINDS[spec.kind]\n const [colour, ink, glass] = [rgb(accent), rgb(spec.ink), rgb(spec.glass)]\n const veiled = at.map((point) => laid(glass, v, point))\n const surfaces = veiled.flatMap((under) => [\n under,\n ...[kind.thin, kind.regular, kind.thick].map((opacity) => laid(glass, opacity, under)),\n ])\n\n const count = Math.round(1 / GROUND_RULE.step)\n let text = ink\n for (let index = 0; index <= count; index++) {\n const candidate = mixed(colour, ink, Math.min(index * GROUND_RULE.step, 1))\n if (surfaces.every((under) => contrast(candidate, under) >= TEXT - EPSILON)) {\n text = candidate\n break\n }\n }\n\n const fills = [colour, ...veiled.map((under) => laid(colour, GROUND_RULE.prominent, under))]\n const worst = (candidate: Rgb) => Math.min(...fills.map((fill) => contrast(candidate, fill)))\n const inks = GROUND_RULE.inks.map(rgb)\n const on = inks.reduce((best, candidate) => (worst(candidate) > worst(best) ? candidate : best))\n const edge = Math.min(...veiled.map((under) => contrast(colour, under)))\n const onAccentContrast = worst(on)\n const selected = GROUND_RULE.selected[spec.mode]\n const [accentHexa, textHexa, onHexa] = [hexa(colour), hexa(text), hexa(on)]\n return {\n accent: accentHexa,\n accentText: textHexa,\n onAccent: onHexa,\n selected,\n edge,\n onAccentContrast,\n holds: edge >= GROUND_RULE.edge - EPSILON && onAccentContrast >= TEXT - EPSILON,\n properties: {\n '--gbt-ground-accent': cssColour(accentHexa),\n '--gbt-ground-accent-text': cssColour(textHexa),\n '--gbt-ground-on-accent': cssColour(onHexa),\n '--gbt-ground-selected-fill': cssColour(accentHexa, selected),\n },\n }\n}\n"],"mappings":"AAOA,MAAa,mBAAmB;CAC9B,OAAO;EACL,MAAM;EACN,MAAM;EACN,OAAO;EACP,OAAO;GAAC;GAAW;GAAW;EAAS;EACvC,OAAO;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAO,UAAU;EAAC;EACzD,OAAO;EACP,KAAK;CACN;CACD,MAAM;EACJ,MAAM;EACN,MAAM;EACN,OAAO;EACP,OAAO;GAAC;GAAW;GAAW;EAAS;EACvC,OAAO;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,UAAU;EAAC;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KAAK,EAAE;CAAC;CAC1E,OAAO;EACL,QAAQ;EACR,YAAY;EACZ,UAAU;EACV;EACA;EACA;EACA,OAAO,QAAQ,YAAY,OAAO,WAAW,oBAAoB,OAAO;EACxE,YAAY;GACV,uBAAuB,UAAU,UAAU;GAC3C,4BAA4B,UAAU,QAAQ;GAC9C,0BAA0B,UAAU,MAAM;GAC1C,8BAA8B,UAAU,YAAY,QAAQ;EAC7D;CACF;AACH"}
@@ -266,7 +266,7 @@ var GbtInput = class GbtInput {
266
266
  }],
267
267
  ngImport: i0,
268
268
  template: "<div\n class=\"gbt-input\"\n [class.gbt-input--sm]=\"size() === 'sm'\"\n [class.gbt-input--mono]=\"mono()\"\n [class.gbt-input--leading]=\"!!leadingIcon()\"\n>\n @if (label()) {\n <label [for]=\"id()\" [class.gbt-input__label--hidden]=\"hideLabel()\"\n >{{ label() }}{{ required() ? ' *' : '' }}</label\n >\n }\n <div class=\"gbt-input__wrapper\">\n @if (leadingIcon(); as icon) {\n <span class=\"gbt-input__leading\" aria-hidden=\"true\">\n <gbt-icon [name]=\"icon\" />\n </span>\n }\n <input\n [id]=\"id()\"\n [type]=\"effectiveType()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [attr.autocomplete]=\"autocomplete()\"\n [attr.inputmode]=\"inputmode()\"\n [attr.spellcheck]=\"spellcheck()\"\n [attr.autocapitalize]=\"autocapitalize()\"\n [attr.enterkeyhint]=\"enterkeyhint()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.min]=\"min()\"\n [attr.max]=\"max()\"\n [value]=\"value()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.role]=\"combobox() ? 'combobox' : null\"\n [attr.aria-autocomplete]=\"combobox() ? 'list' : null\"\n [attr.aria-expanded]=\"combobox()?.expanded ?? null\"\n [attr.aria-controls]=\"combobox()?.controls ?? null\"\n [attr.aria-activedescendant]=\"combobox()?.activeDescendant ?? null\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n @if (type() === 'password') {\n <button\n type=\"button\"\n class=\"gbt-input__toggle\"\n (click)=\"togglePasswordVisibility()\"\n [attr.aria-label]=\"passwordVisible() ? hidePasswordLabel() : showPasswordLabel()\"\n >\n <gbt-icon [name]=\"passwordVisible() ? 'eye-off' : 'eye'\" aria-hidden=\"true\" />\n </button>\n }\n </div>\n @if (showHint()) {\n <p [id]=\"hintId()\" class=\"gbt-input__hint\">{{ hint() }}</p>\n }\n @if (errorMessage()) {\n <p [id]=\"errorId()\" class=\"gbt-input__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n",
269
- styles: [":host{display:block}.gbt-input{display:flex;flex-direction:column;gap:.375rem}.gbt-input label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-input__wrapper{position:relative;display:flex;align-items:center}.gbt-input input{box-sizing:border-box;width:100%;height:var(--gbt-control-height-md);padding:0 var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);border-radius:999px;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 2px var(--gbt-nested-hollow-shade, transparent), inset 0 0 0 1px var(--gbt-nested-hollow-trace, transparent), inset 0 -1px 0 var(--gbt-nested-hollow-light, transparent), inset 0 1px 3px var(--gbt-glass-hollow), inset 0 -1px 0 var(--gbt-glass-rim-bottom))}@media(prefers-contrast:more){.gbt-input input{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-input input{transition:border-color var(--site-transition-fast),background-color var(--site-transition-fast)}.gbt-input input:hover:not(:disabled):not(:focus){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-input input:focus{outline:none;border-color:var(--primary)}.gbt-input input:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:1px}.gbt-input input:disabled{background:var(--bg-panel);cursor:not-allowed}.gbt-input input[type=search]{-webkit-appearance:none;appearance:none}.gbt-input__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-input__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-input__leading{position:absolute;left:.75rem;display:inline-flex;font-size:.875rem;color:var(--text-discret);pointer-events:none}.gbt-input--leading input{padding-left:2.25rem}.gbt-input--mono input{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace),serif;font-size:.8125rem}.gbt-input--sm input{height:var(--gbt-control-height-sm);padding:0 .625rem;font-size:.8125rem}.gbt-input--sm .gbt-input__leading{left:.625rem;font-size:.8125rem}.gbt-input--sm.gbt-input--mono input{font-size:.75rem}.gbt-input--sm.gbt-input--leading input{padding-left:2rem}.gbt-input__toggle{position:absolute;right:.5rem;display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:24px;background:none;border:none;border-radius:999px;color:var(--text-discret);cursor:pointer}.gbt-input__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-input__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-input__toggle:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-input__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-input input{transition:none}}\n"],
269
+ styles: [":host{display:block}.gbt-input{display:flex;flex-direction:column;gap:.375rem}.gbt-input label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-input__wrapper{position:relative;display:flex;align-items:center}.gbt-input input{box-sizing:border-box;width:100%;height:var(--gbt-control-height-md);padding:0 var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);border-radius:999px;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 2px var(--gbt-nested-hollow-shade, transparent), inset 0 0 0 1px var(--gbt-nested-hollow-trace, transparent), inset 0 -1px 0 var(--gbt-nested-hollow-light, transparent), inset 0 1px 3px var(--gbt-glass-hollow), inset 0 -1px 0 var(--gbt-glass-rim-bottom))}@media(prefers-contrast:more){.gbt-input input{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-input input{transition:border-color var(--site-transition-fast),background-color var(--site-transition-fast)}.gbt-input input:hover:not(:disabled):not(:focus){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-input input:focus{outline:none;border-color:var(--gbt-ground-accent, var(--primary))}.gbt-input input:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--gbt-ground-accent, var(--focus-ring)));outline-offset:1px}.gbt-input input:disabled{background:var(--bg-panel);cursor:not-allowed}.gbt-input input[type=search]{-webkit-appearance:none;appearance:none}.gbt-input__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-input__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-input__leading{position:absolute;left:.75rem;display:inline-flex;font-size:.875rem;color:var(--text-discret);pointer-events:none}.gbt-input--leading input{padding-left:2.25rem}.gbt-input--mono input{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace),serif;font-size:.8125rem}.gbt-input--sm input{height:var(--gbt-control-height-sm);padding:0 .625rem;font-size:.8125rem}.gbt-input--sm .gbt-input__leading{left:.625rem;font-size:.8125rem}.gbt-input--sm.gbt-input--mono input{font-size:.75rem}.gbt-input--sm.gbt-input--leading input{padding-left:2rem}.gbt-input__toggle{position:absolute;right:.5rem;display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:24px;background:none;border:none;border-radius:999px;color:var(--text-discret);cursor:pointer}.gbt-input__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-input__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-input__toggle:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-input__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-input input{transition:none}}\n"],
270
270
  dependencies: [{
271
271
  kind: "component",
272
272
  type: Icon,
@@ -294,7 +294,7 @@ i0.ɵɵngDeclareClassMetadata({
294
294
  multi: true
295
295
  }],
296
296
  template: "<div\n class=\"gbt-input\"\n [class.gbt-input--sm]=\"size() === 'sm'\"\n [class.gbt-input--mono]=\"mono()\"\n [class.gbt-input--leading]=\"!!leadingIcon()\"\n>\n @if (label()) {\n <label [for]=\"id()\" [class.gbt-input__label--hidden]=\"hideLabel()\"\n >{{ label() }}{{ required() ? ' *' : '' }}</label\n >\n }\n <div class=\"gbt-input__wrapper\">\n @if (leadingIcon(); as icon) {\n <span class=\"gbt-input__leading\" aria-hidden=\"true\">\n <gbt-icon [name]=\"icon\" />\n </span>\n }\n <input\n [id]=\"id()\"\n [type]=\"effectiveType()\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n [attr.autocomplete]=\"autocomplete()\"\n [attr.inputmode]=\"inputmode()\"\n [attr.spellcheck]=\"spellcheck()\"\n [attr.autocapitalize]=\"autocapitalize()\"\n [attr.enterkeyhint]=\"enterkeyhint()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.min]=\"min()\"\n [attr.max]=\"max()\"\n [value]=\"value()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.role]=\"combobox() ? 'combobox' : null\"\n [attr.aria-autocomplete]=\"combobox() ? 'list' : null\"\n [attr.aria-expanded]=\"combobox()?.expanded ?? null\"\n [attr.aria-controls]=\"combobox()?.controls ?? null\"\n [attr.aria-activedescendant]=\"combobox()?.activeDescendant ?? null\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n @if (type() === 'password') {\n <button\n type=\"button\"\n class=\"gbt-input__toggle\"\n (click)=\"togglePasswordVisibility()\"\n [attr.aria-label]=\"passwordVisible() ? hidePasswordLabel() : showPasswordLabel()\"\n >\n <gbt-icon [name]=\"passwordVisible() ? 'eye-off' : 'eye'\" aria-hidden=\"true\" />\n </button>\n }\n </div>\n @if (showHint()) {\n <p [id]=\"hintId()\" class=\"gbt-input__hint\">{{ hint() }}</p>\n }\n @if (errorMessage()) {\n <p [id]=\"errorId()\" class=\"gbt-input__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n",
297
- styles: [":host{display:block}.gbt-input{display:flex;flex-direction:column;gap:.375rem}.gbt-input label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-input__wrapper{position:relative;display:flex;align-items:center}.gbt-input input{box-sizing:border-box;width:100%;height:var(--gbt-control-height-md);padding:0 var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);border-radius:999px;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 2px var(--gbt-nested-hollow-shade, transparent), inset 0 0 0 1px var(--gbt-nested-hollow-trace, transparent), inset 0 -1px 0 var(--gbt-nested-hollow-light, transparent), inset 0 1px 3px var(--gbt-glass-hollow), inset 0 -1px 0 var(--gbt-glass-rim-bottom))}@media(prefers-contrast:more){.gbt-input input{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-input input{transition:border-color var(--site-transition-fast),background-color var(--site-transition-fast)}.gbt-input input:hover:not(:disabled):not(:focus){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-input input:focus{outline:none;border-color:var(--primary)}.gbt-input input:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:1px}.gbt-input input:disabled{background:var(--bg-panel);cursor:not-allowed}.gbt-input input[type=search]{-webkit-appearance:none;appearance:none}.gbt-input__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-input__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-input__leading{position:absolute;left:.75rem;display:inline-flex;font-size:.875rem;color:var(--text-discret);pointer-events:none}.gbt-input--leading input{padding-left:2.25rem}.gbt-input--mono input{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace),serif;font-size:.8125rem}.gbt-input--sm input{height:var(--gbt-control-height-sm);padding:0 .625rem;font-size:.8125rem}.gbt-input--sm .gbt-input__leading{left:.625rem;font-size:.8125rem}.gbt-input--sm.gbt-input--mono input{font-size:.75rem}.gbt-input--sm.gbt-input--leading input{padding-left:2rem}.gbt-input__toggle{position:absolute;right:.5rem;display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:24px;background:none;border:none;border-radius:999px;color:var(--text-discret);cursor:pointer}.gbt-input__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-input__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-input__toggle:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-input__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-input input{transition:none}}\n"]
297
+ styles: [":host{display:block}.gbt-input{display:flex;flex-direction:column;gap:.375rem}.gbt-input label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-input__wrapper{position:relative;display:flex;align-items:center}.gbt-input input{box-sizing:border-box;width:100%;height:var(--gbt-control-height-md);padding:0 var(--gbt-field-padding, .75rem);font-family:var(--font-family);font-size:.875rem;color:var(--text-primary);border-radius:999px;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 2px var(--gbt-nested-hollow-shade, transparent), inset 0 0 0 1px var(--gbt-nested-hollow-trace, transparent), inset 0 -1px 0 var(--gbt-nested-hollow-light, transparent), inset 0 1px 3px var(--gbt-glass-hollow), inset 0 -1px 0 var(--gbt-glass-rim-bottom))}@media(prefers-contrast:more){.gbt-input input{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-input input{transition:border-color var(--site-transition-fast),background-color var(--site-transition-fast)}.gbt-input input:hover:not(:disabled):not(:focus){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-input input:focus{outline:none;border-color:var(--gbt-ground-accent, var(--primary))}.gbt-input input:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--gbt-ground-accent, var(--focus-ring)));outline-offset:1px}.gbt-input input:disabled{background:var(--bg-panel);cursor:not-allowed}.gbt-input input[type=search]{-webkit-appearance:none;appearance:none}.gbt-input__label--hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-input__hint{margin:0;font-size:.75rem;color:var(--text-secondary)}.gbt-input__leading{position:absolute;left:.75rem;display:inline-flex;font-size:.875rem;color:var(--text-discret);pointer-events:none}.gbt-input--leading input{padding-left:2.25rem}.gbt-input--mono input{font-family:var(--gbt-font-mono, \"IBM Plex Mono\", ui-monospace, \"SF Mono\", Menlo, Consolas, monospace),serif;font-size:.8125rem}.gbt-input--sm input{height:var(--gbt-control-height-sm);padding:0 .625rem;font-size:.8125rem}.gbt-input--sm .gbt-input__leading{left:.625rem;font-size:.8125rem}.gbt-input--sm.gbt-input--mono input{font-size:.75rem}.gbt-input--sm.gbt-input--leading input{padding-left:2rem}.gbt-input__toggle{position:absolute;right:.5rem;display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:24px;background:none;border:none;border-radius:999px;color:var(--text-discret);cursor:pointer}.gbt-input__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-input__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-input__toggle:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-input__error{margin:0;font-size:.75rem;color:var(--color-error-text)}@media(prefers-reduced-motion:reduce){.gbt-input input{transition:none}}\n"]
298
298
  }]
299
299
  }],
300
300
  propDecorators: {