@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.
- package/button/README.md +11 -4
- package/fesm2022/masmarino-gabarit-alert.mjs +2 -2
- package/fesm2022/masmarino-gabarit-alert.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-app-shell.mjs +2 -2
- package/fesm2022/masmarino-gabarit-app-shell.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-auth-register.mjs +2 -2
- package/fesm2022/masmarino-gabarit-auth-register.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-autocomplete.mjs +2 -2
- package/fesm2022/masmarino-gabarit-autocomplete.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-avatar-group.mjs +2 -2
- package/fesm2022/masmarino-gabarit-avatar-group.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-badge.mjs +4 -4
- package/fesm2022/masmarino-gabarit-badge.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-button.mjs +2 -2
- package/fesm2022/masmarino-gabarit-button.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-card.mjs +4 -4
- package/fesm2022/masmarino-gabarit-card.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-chart.mjs +6 -6
- package/fesm2022/masmarino-gabarit-chart.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-checkbox.mjs +4 -4
- package/fesm2022/masmarino-gabarit-checkbox.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-command-palette.mjs +4 -4
- package/fesm2022/masmarino-gabarit-command-palette.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-copy-field.mjs +2 -2
- package/fesm2022/masmarino-gabarit-copy-field.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-date-picker.mjs +4 -4
- package/fesm2022/masmarino-gabarit-date-picker.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-disclosure.mjs +2 -2
- package/fesm2022/masmarino-gabarit-disclosure.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-docs.mjs +10 -10
- package/fesm2022/masmarino-gabarit-docs.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-drawer.mjs +2 -2
- package/fesm2022/masmarino-gabarit-drawer.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-file-upload.mjs +2 -2
- package/fesm2022/masmarino-gabarit-file-upload.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-input.mjs +2 -2
- package/fesm2022/masmarino-gabarit-input.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-job-graph.mjs +2 -2
- package/fesm2022/masmarino-gabarit-job-graph.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-list-row.mjs +2 -2
- package/fesm2022/masmarino-gabarit-list-row.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-list-toolbar.mjs +2 -2
- package/fesm2022/masmarino-gabarit-list-toolbar.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-menu.mjs +2 -2
- package/fesm2022/masmarino-gabarit-menu.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-mfa-enrollment.mjs +4 -4
- package/fesm2022/masmarino-gabarit-mfa-enrollment.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-mfa-settings.mjs +2 -2
- package/fesm2022/masmarino-gabarit-mfa-settings.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-modal.mjs +2 -2
- package/fesm2022/masmarino-gabarit-modal.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-nav-tabs.mjs +2 -2
- package/fesm2022/masmarino-gabarit-nav-tabs.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-pagination.mjs +2 -2
- package/fesm2022/masmarino-gabarit-pagination.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-passkey-settings.mjs +2 -2
- package/fesm2022/masmarino-gabarit-passkey-settings.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-popover.mjs +2 -2
- package/fesm2022/masmarino-gabarit-popover.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-search-bar.mjs +2 -2
- package/fesm2022/masmarino-gabarit-search-bar.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-secret-reveal.mjs +2 -2
- package/fesm2022/masmarino-gabarit-secret-reveal.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-segmented-control.mjs +47 -5
- package/fesm2022/masmarino-gabarit-segmented-control.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-select.mjs +2 -2
- package/fesm2022/masmarino-gabarit-select.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-skeleton-list.mjs +2 -2
- package/fesm2022/masmarino-gabarit-skeleton-list.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-skeleton.mjs +2 -2
- package/fesm2022/masmarino-gabarit-skeleton.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-slider.mjs +2 -2
- package/fesm2022/masmarino-gabarit-slider.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-sparkline.mjs +2 -2
- package/fesm2022/masmarino-gabarit-sparkline.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-stat-tile.mjs +2 -2
- package/fesm2022/masmarino-gabarit-stat-tile.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-stepper.mjs +2 -2
- package/fesm2022/masmarino-gabarit-stepper.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-switch.mjs +2 -2
- package/fesm2022/masmarino-gabarit-switch.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-tabs.mjs +54 -5
- package/fesm2022/masmarino-gabarit-tabs.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-tag-input.mjs +2 -2
- package/fesm2022/masmarino-gabarit-tag-input.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-tag.mjs +2 -2
- package/fesm2022/masmarino-gabarit-tag.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-textarea.mjs +2 -2
- package/fesm2022/masmarino-gabarit-textarea.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-tooltip.mjs +2 -2
- package/fesm2022/masmarino-gabarit-tooltip.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit-tree.mjs +2 -2
- package/fesm2022/masmarino-gabarit-tree.mjs.map +1 -1
- package/fesm2022/masmarino-gabarit.mjs +1 -1
- package/fesm2022/masmarino-gabarit.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/tokens/_glass.scss +140 -0
- package/src/lib/tokens/_grounds.scss +10 -0
- package/src/lib/tokens/_themes.scss +2 -0
- package/src/lib/tokens/_utilities.scss +54 -4
- package/types/masmarino-gabarit-button.d.ts +1 -1
- package/types/masmarino-gabarit-segmented-control.d.ts +14 -0
- package/types/masmarino-gabarit-tabs.d.ts +14 -0
- package/types/masmarino-gabarit.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masmarino-gabarit-slider.mjs","names":[],"sources":["../../../projects/gabarit/slider/slider.ts","../../../projects/gabarit/slider/slider.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n signal,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-slider',\n standalone: true,\n imports: [],\n templateUrl: './slider.html',\n styleUrl: './slider.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => Slider),\n multi: true,\n },\n ],\n})\nexport class Slider implements ControlValueAccessor {\n id = input<string>(`gbt-slider-${++nextId}`)\n label = input.required<string>()\n min = input(0)\n max = input(100)\n step = input(1)\n disabled = input(false, { transform: booleanAttribute })\n errorMessage = input<string | null>(null)\n showValue = input(true, { transform: booleanAttribute })\n formatValue = input<(value: number) => string>((value) => `${value}`)\n\n protected readonly value = signal(0)\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n protected readonly fillPercent = computed(() => {\n const range = this.max() - this.min()\n if (range <= 0) {\n return 0\n }\n return ((this.value() - this.min()) / range) * 100\n })\n\n private onChange: (value: number) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: number): void {\n this.value.set(value ?? 0)\n }\n\n registerOnChange(fn: (value: number) => 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 = Number((event.target as HTMLInputElement).value)\n this.value.set(value)\n this.onChange(value)\n }\n\n protected onBlur(): void {\n this.onTouched()\n }\n}\n","<div class=\"gbt-slider\">\n <div class=\"gbt-slider__header\">\n <label [for]=\"id()\">{{ label() }}</label>\n @if (showValue()) {\n <span class=\"gbt-slider__value\">{{ formatValue()(value()) }}</span>\n }\n </div>\n <input\n type=\"range\"\n [id]=\"id()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [step]=\"step()\"\n [value]=\"value()\"\n [disabled]=\"isDisabled()\"\n [style.--gbt-slider-fill.%]=\"fillPercent()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"errorMessage() ? id() + '-error' : null\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n @if (errorMessage()) {\n <p [id]=\"id() + '-error'\" class=\"gbt-slider__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;AAWA,IAAI,SAAS;AAiBb,IAAa,SAAb,MAAa,OAAM;CACjB,KAAK,MAAc,cAAc,EAAE,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC5C,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,MAAM,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,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BAAA;GAAA;EAAA;EAAA,WARN,CACT;GACE,SAAS;GACT,aAAa,iBAAiB,MAAM;GACpC,OAAO;EACR,CACF;EAAA,UAAA;EAAA,UC1BH;EAyBA,QAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"masmarino-gabarit-slider.mjs","names":[],"sources":["../../../projects/gabarit/slider/slider.ts","../../../projects/gabarit/slider/slider.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n signal,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-slider',\n standalone: true,\n imports: [],\n templateUrl: './slider.html',\n styleUrl: './slider.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => Slider),\n multi: true,\n },\n ],\n})\nexport class Slider implements ControlValueAccessor {\n id = input<string>(`gbt-slider-${++nextId}`)\n label = input.required<string>()\n min = input(0)\n max = input(100)\n step = input(1)\n disabled = input(false, { transform: booleanAttribute })\n errorMessage = input<string | null>(null)\n showValue = input(true, { transform: booleanAttribute })\n formatValue = input<(value: number) => string>((value) => `${value}`)\n\n protected readonly value = signal(0)\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n protected readonly fillPercent = computed(() => {\n const range = this.max() - this.min()\n if (range <= 0) {\n return 0\n }\n return ((this.value() - this.min()) / range) * 100\n })\n\n private onChange: (value: number) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: number): void {\n this.value.set(value ?? 0)\n }\n\n registerOnChange(fn: (value: number) => 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 = Number((event.target as HTMLInputElement).value)\n this.value.set(value)\n this.onChange(value)\n }\n\n protected onBlur(): void {\n this.onTouched()\n }\n}\n","<div class=\"gbt-slider\">\n <div class=\"gbt-slider__header\">\n <label [for]=\"id()\">{{ label() }}</label>\n @if (showValue()) {\n <span class=\"gbt-slider__value\">{{ formatValue()(value()) }}</span>\n }\n </div>\n <input\n type=\"range\"\n [id]=\"id()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [step]=\"step()\"\n [value]=\"value()\"\n [disabled]=\"isDisabled()\"\n [style.--gbt-slider-fill.%]=\"fillPercent()\"\n [attr.aria-invalid]=\"errorMessage() ? true : null\"\n [attr.aria-describedby]=\"errorMessage() ? id() + '-error' : null\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n @if (errorMessage()) {\n <p [id]=\"id() + '-error'\" class=\"gbt-slider__error\" role=\"alert\">{{ errorMessage() }}</p>\n }\n</div>\n"],"mappings":";;;AAWA,IAAI,SAAS;AAiBb,IAAa,SAAb,MAAa,OAAM;CACjB,KAAK,MAAc,cAAc,EAAE,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC5C,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,MAAM,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CACd,MAAM,MAAM,KAAI,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAChB,OAAO,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACf,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,C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C,CACT;IACE,SAAS;IACT,aAAa,iBAAgB,MAAO;IACpC,OAAO;GACR,CACF;GAAA,UAAA;GAAA,QAAA,CAAA,87GAAA;EAAA,CAAA"}
|
|
@@ -168,7 +168,7 @@ var Sparkline = class Sparkline {
|
|
|
168
168
|
},
|
|
169
169
|
ngImport: i0,
|
|
170
170
|
template: "@if (path(); as d) {\n <div class=\"gbt-sparkline\" role=\"status\" aria-live=\"polite\">\n <svg\n class=\"gbt-sparkline__svg\"\n [attr.viewBox]=\"viewBox()\"\n [attr.width]=\"width()\"\n [attr.height]=\"height()\"\n tabindex=\"0\"\n role=\"group\"\n [attr.aria-label]=\"tableCaption()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"onPointerLeave($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n >\n <path class=\"gbt-sparkline__line\" [attr.d]=\"d\" />\n @if (dot(); as p) {\n <circle class=\"gbt-sparkline__dot\" [attr.cx]=\"p.x\" [attr.cy]=\"p.y\" r=\"3\" />\n }\n </svg>\n @if (tooltip(); as text) {\n <span class=\"gbt-sparkline__tooltip\">{{ text }}</span>\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"emptyMessage()\" />\n}\n",
|
|
171
|
-
styles: [":host{display:inline-block;line-height:0}.gbt-sparkline{position:relative;display:inline-block}.gbt-sparkline__svg:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-sparkline__line{fill:none;stroke:var(--chart-series-1-base);stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}.gbt-sparkline__dot{fill:var(--chart-series-1-base);stroke:var(--bg-principal);stroke-width:1.5;pointer-events:none}.gbt-sparkline__tooltip{position:absolute;left:50%;bottom:100%;transform:translate(-50%);white-space:nowrap;padding:.125rem .375rem;border-radius:var(--
|
|
171
|
+
styles: [":host{display:inline-block;line-height:0}.gbt-sparkline{position:relative;display:inline-block}.gbt-sparkline__svg:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-sparkline__line{fill:none;stroke:var(--chart-series-1-base);stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}.gbt-sparkline__dot{fill:var(--chart-series-1-base);stroke:var(--bg-principal);stroke-width:1.5;pointer-events:none}.gbt-sparkline__tooltip{position:absolute;left:50%;bottom:100%;transform:translate(-50%);white-space:nowrap;padding:.125rem .375rem;border-radius:var(--gbt-radius-row);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-sparkline__tooltip{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-sparkline__tooltip{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-sparkline__tooltip{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-sparkline__tooltip{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-sparkline__tooltip{font-size:.6875rem;font-variant-numeric:tabular-nums;color:var(--text-primary);pointer-events:none}\n"],
|
|
172
172
|
dependencies: [{
|
|
173
173
|
kind: "component",
|
|
174
174
|
type: ChartEmpty,
|
|
@@ -201,7 +201,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
201
201
|
imports: [ChartEmpty, ChartTable],
|
|
202
202
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
203
203
|
template: "@if (path(); as d) {\n <div class=\"gbt-sparkline\" role=\"status\" aria-live=\"polite\">\n <svg\n class=\"gbt-sparkline__svg\"\n [attr.viewBox]=\"viewBox()\"\n [attr.width]=\"width()\"\n [attr.height]=\"height()\"\n tabindex=\"0\"\n role=\"group\"\n [attr.aria-label]=\"tableCaption()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"onPointerLeave($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n >\n <path class=\"gbt-sparkline__line\" [attr.d]=\"d\" />\n @if (dot(); as p) {\n <circle class=\"gbt-sparkline__dot\" [attr.cx]=\"p.x\" [attr.cy]=\"p.y\" r=\"3\" />\n }\n </svg>\n @if (tooltip(); as text) {\n <span class=\"gbt-sparkline__tooltip\">{{ text }}</span>\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"emptyMessage()\" />\n}\n",
|
|
204
|
-
styles: [":host{display:inline-block;line-height:0}.gbt-sparkline{position:relative;display:inline-block}.gbt-sparkline__svg:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-sparkline__line{fill:none;stroke:var(--chart-series-1-base);stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}.gbt-sparkline__dot{fill:var(--chart-series-1-base);stroke:var(--bg-principal);stroke-width:1.5;pointer-events:none}.gbt-sparkline__tooltip{position:absolute;left:50%;bottom:100%;transform:translate(-50%);white-space:nowrap;padding:.125rem .375rem;border-radius:var(--
|
|
204
|
+
styles: [":host{display:inline-block;line-height:0}.gbt-sparkline{position:relative;display:inline-block}.gbt-sparkline__svg:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-sparkline__line{fill:none;stroke:var(--chart-series-1-base);stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}.gbt-sparkline__dot{fill:var(--chart-series-1-base);stroke:var(--bg-principal);stroke-width:1.5;pointer-events:none}.gbt-sparkline__tooltip{position:absolute;left:50%;bottom:100%;transform:translate(-50%);white-space:nowrap;padding:.125rem .375rem;border-radius:var(--gbt-radius-row);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-sparkline__tooltip{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-sparkline__tooltip{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-sparkline__tooltip{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-sparkline__tooltip{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-sparkline__tooltip{font-size:.6875rem;font-variant-numeric:tabular-nums;color:var(--text-primary);pointer-events:none}\n"]
|
|
205
205
|
}]
|
|
206
206
|
}],
|
|
207
207
|
propDecorators: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masmarino-gabarit-sparkline.mjs","names":[],"sources":["../../../projects/gabarit/sparkline/sparkline.ts","../../../projects/gabarit/sparkline/sparkline.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 } from '@masmarino/gabarit/format'\nimport { linePath } from '@masmarino/gabarit/chart'\nimport { linearScale } from '@masmarino/gabarit/chart'\nimport { nearestIndex } from '@masmarino/gabarit/chart'\n\nconst MARGIN = 4\n\n@Component({\n selector: 'gbt-sparkline',\n standalone: true,\n imports: [ChartEmpty, ChartTable],\n templateUrl: './sparkline.html',\n styleUrl: './sparkline.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Sparkline {\n values = input.required<number[]>()\n tableCaption = input.required<string>()\n xColumn = input.required<string>()\n yColumn = input.required<string>()\n locale = input.required<string>()\n emptyMessage = input.required<string>()\n width = input(80)\n height = input(24)\n\n protected readonly activeIndex = signal<number | null>(null)\n\n protected readonly viewBox = computed(() => `0 0 ${this.width()} ${this.height()}`)\n\n protected readonly columns = computed(() => [this.xColumn(), this.yColumn()])\n\n protected readonly tableRows = computed<(string | number)[][]>(() =>\n this.values().map((value, index) => [\n formatNumber(index + 1, this.locale()),\n formatNumber(value, this.locale()),\n ]),\n )\n\n private readonly scales = computed(() => {\n const values = this.values()\n const min = Math.min(...values)\n const max = Math.max(...values)\n return {\n x: linearScale([0, Math.max(values.length - 1, 0)], [MARGIN, this.width() - MARGIN]),\n y: linearScale([min, max], [this.height() - MARGIN, MARGIN]),\n }\n })\n\n protected readonly path = computed(() => {\n const values = this.values()\n if (values.length === 0) return null\n const { x, y } = this.scales()\n return linePath(values.map((value, index) => ({ x: x.map(index), y: y.map(value) })))\n })\n\n protected readonly positions = computed<number[]>(() => {\n const { x } = this.scales()\n return this.values().map((_, index) => x.map(index))\n })\n\n protected readonly dot = computed<{ x: number; y: number } | null>(() => {\n const index = this.activeIndex()\n if (index === null) return null\n const value = this.values()[index]\n if (value === undefined) return null\n const { x, y } = this.scales()\n return { x: x.map(index), y: y.map(value) }\n })\n\n protected readonly tooltip = computed<string | null>(() => {\n const index = this.activeIndex()\n if (index === null) return null\n const value = this.values()[index]\n if (value === undefined) return null\n return `${this.xColumn()} ${formatNumber(index + 1, this.locale())} — ${this.yColumn()} ${formatNumber(value, this.locale())}`\n })\n\n protected onPointerMove(event: PointerEvent | MouseEvent): void {\n const positions = this.positions()\n if (positions.length === 0) return\n const rect = (event.currentTarget as Element).getBoundingClientRect()\n this.activeIndex.set(nearestIndex(positions, event.clientX - rect.left))\n }\n\n protected onPointerLeave(event: PointerEvent | MouseEvent): void {\n const target = event.currentTarget as Element\n if (target.ownerDocument.activeElement === target) return\n this.activeIndex.set(null)\n }\n\n protected onBlur(): void {\n this.activeIndex.set(null)\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const lastIndex = this.values().length - 1\n if (lastIndex < 0) return\n const current = this.activeIndex()\n switch (event.key) {\n case 'ArrowRight':\n this.activeIndex.set(current === null ? 0 : Math.min(lastIndex, current + 1))\n break\n case 'ArrowLeft':\n this.activeIndex.set(current === null ? lastIndex : Math.max(0, current - 1))\n break\n case 'Home':\n this.activeIndex.set(0)\n break\n case 'End':\n this.activeIndex.set(lastIndex)\n break\n case 'Escape':\n this.activeIndex.set(null)\n break\n default:\n return\n }\n event.preventDefault()\n }\n}\n","@if (path(); as d) {\n <div class=\"gbt-sparkline\" role=\"status\" aria-live=\"polite\">\n <svg\n class=\"gbt-sparkline__svg\"\n [attr.viewBox]=\"viewBox()\"\n [attr.width]=\"width()\"\n [attr.height]=\"height()\"\n tabindex=\"0\"\n role=\"group\"\n [attr.aria-label]=\"tableCaption()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"onPointerLeave($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n >\n <path class=\"gbt-sparkline__line\" [attr.d]=\"d\" />\n @if (dot(); as p) {\n <circle class=\"gbt-sparkline__dot\" [attr.cx]=\"p.x\" [attr.cy]=\"p.y\" r=\"3\" />\n }\n </svg>\n @if (tooltip(); as text) {\n <span class=\"gbt-sparkline__tooltip\">{{ text }}</span>\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"em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line.ts","../../../projects/gabarit/sparkline/sparkline.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 } from '@masmarino/gabarit/format'\nimport { linePath } from '@masmarino/gabarit/chart'\nimport { linearScale } from '@masmarino/gabarit/chart'\nimport { nearestIndex } from '@masmarino/gabarit/chart'\n\nconst MARGIN = 4\n\n@Component({\n selector: 'gbt-sparkline',\n standalone: true,\n imports: [ChartEmpty, ChartTable],\n templateUrl: './sparkline.html',\n styleUrl: './sparkline.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Sparkline {\n values = input.required<number[]>()\n tableCaption = input.required<string>()\n xColumn = input.required<string>()\n yColumn = input.required<string>()\n locale = input.required<string>()\n emptyMessage = input.required<string>()\n width = input(80)\n height = input(24)\n\n protected readonly activeIndex = signal<number | null>(null)\n\n protected readonly viewBox = computed(() => `0 0 ${this.width()} ${this.height()}`)\n\n protected readonly columns = computed(() => [this.xColumn(), this.yColumn()])\n\n protected readonly tableRows = computed<(string | number)[][]>(() =>\n this.values().map((value, index) => [\n formatNumber(index + 1, this.locale()),\n formatNumber(value, this.locale()),\n ]),\n )\n\n private readonly scales = computed(() => {\n const values = this.values()\n const min = Math.min(...values)\n const max = Math.max(...values)\n return {\n x: linearScale([0, Math.max(values.length - 1, 0)], [MARGIN, this.width() - MARGIN]),\n y: linearScale([min, max], [this.height() - MARGIN, MARGIN]),\n }\n })\n\n protected readonly path = computed(() => {\n const values = this.values()\n if (values.length === 0) return null\n const { x, y } = this.scales()\n return linePath(values.map((value, index) => ({ x: x.map(index), y: y.map(value) })))\n })\n\n protected readonly positions = computed<number[]>(() => {\n const { x } = this.scales()\n return this.values().map((_, index) => x.map(index))\n })\n\n protected readonly dot = computed<{ x: number; y: number } | null>(() => {\n const index = this.activeIndex()\n if (index === null) return null\n const value = this.values()[index]\n if (value === undefined) return null\n const { x, y } = this.scales()\n return { x: x.map(index), y: y.map(value) }\n })\n\n protected readonly tooltip = computed<string | null>(() => {\n const index = this.activeIndex()\n if (index === null) return null\n const value = this.values()[index]\n if (value === undefined) return null\n return `${this.xColumn()} ${formatNumber(index + 1, this.locale())} — ${this.yColumn()} ${formatNumber(value, this.locale())}`\n })\n\n protected onPointerMove(event: PointerEvent | MouseEvent): void {\n const positions = this.positions()\n if (positions.length === 0) return\n const rect = (event.currentTarget as Element).getBoundingClientRect()\n this.activeIndex.set(nearestIndex(positions, event.clientX - rect.left))\n }\n\n protected onPointerLeave(event: PointerEvent | MouseEvent): void {\n const target = event.currentTarget as Element\n if (target.ownerDocument.activeElement === target) return\n this.activeIndex.set(null)\n }\n\n protected onBlur(): void {\n this.activeIndex.set(null)\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const lastIndex = this.values().length - 1\n if (lastIndex < 0) return\n const current = this.activeIndex()\n switch (event.key) {\n case 'ArrowRight':\n this.activeIndex.set(current === null ? 0 : Math.min(lastIndex, current + 1))\n break\n case 'ArrowLeft':\n this.activeIndex.set(current === null ? lastIndex : Math.max(0, current - 1))\n break\n case 'Home':\n this.activeIndex.set(0)\n break\n case 'End':\n this.activeIndex.set(lastIndex)\n break\n case 'Escape':\n this.activeIndex.set(null)\n break\n default:\n return\n }\n event.preventDefault()\n }\n}\n","@if (path(); as d) {\n <div class=\"gbt-sparkline\" role=\"status\" aria-live=\"polite\">\n <svg\n class=\"gbt-sparkline__svg\"\n [attr.viewBox]=\"viewBox()\"\n [attr.width]=\"width()\"\n [attr.height]=\"height()\"\n tabindex=\"0\"\n role=\"group\"\n [attr.aria-label]=\"tableCaption()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"onPointerLeave($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n >\n <path class=\"gbt-sparkline__line\" [attr.d]=\"d\" />\n @if (dot(); as p) {\n <circle class=\"gbt-sparkline__dot\" [attr.cx]=\"p.x\" [attr.cy]=\"p.y\" r=\"3\" />\n }\n </svg>\n @if (tooltip(); as text) {\n <span class=\"gbt-sparkline__tooltip\">{{ text }}</span>\n }\n </div>\n <gbt-chart-table [caption]=\"tableCaption()\" [columns]=\"columns()\" [rows]=\"tableRows()\" />\n} @else {\n <gbt-chart-empty [message]=\"emptyMessage()\" />\n}\n"],"mappings":";;;;AAQA,MAAM,SAAS;AAUf,IAAa,YAAb,MAAa,UAAS;CACpB,SAAS,MAAM,SAAoB,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACnC,eAAe,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,SAAS,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACjC,eAAe,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,QAAQ,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACjB,SAAS,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAEC,cAAc,OAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAEzC,UAAU,eAAe,OAAO,KAAK,MAAK,EAAE,GAAI,KAAK,OAAM,KAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAEhE,UAAU,eAAe,CAAC,KAAK,QAAO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AA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,UAAA;EAAA,UClBtB;EA4BA,QAAA,CAAA,yvDAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MDfY;GAAU,UAAA;GAAA,QAAA,CAAA,WAAA,aAAA;GAAA,SAAA,CAAA,QAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAU,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;GAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAKrB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EARrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAe,YACb;GAAI,SACP,CAAC,YAAY,UAAU;GAAC,iBAGhB,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,yvDAAA;EAAA,CAAA"}
|
|
@@ -22,7 +22,7 @@ var StatTileLink = class StatTileLink {
|
|
|
22
22
|
ngImport: i0,
|
|
23
23
|
template: "<ng-content />",
|
|
24
24
|
isInline: true,
|
|
25
|
-
styles: [":host{color:inherit;text-decoration:none}:host:hover{text-decoration:underline;text-underline-offset:.2em}:host:focus-visible{outline:none}:host:after{content:\"\";position:absolute;inset:0;border-radius:var(--
|
|
25
|
+
styles: [":host{color:inherit;text-decoration:none}:host:hover{text-decoration:underline;text-underline-offset:.2em}:host:focus-visible{outline:none}:host:after{content:\"\";position:absolute;inset:0;border-radius:var(--gbt-radius-glass)}:host:focus-visible:after{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}\n"],
|
|
26
26
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
27
27
|
});
|
|
28
28
|
};
|
|
@@ -39,7 +39,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
39
39
|
template: "<ng-content />",
|
|
40
40
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
41
41
|
host: { class: "gbt-stat-tile__link" },
|
|
42
|
-
styles: [":host{color:inherit;text-decoration:none}:host:hover{text-decoration:underline;text-underline-offset:.2em}:host:focus-visible{outline:none}:host:after{content:\"\";position:absolute;inset:0;border-radius:var(--
|
|
42
|
+
styles: [":host{color:inherit;text-decoration:none}:host:hover{text-decoration:underline;text-underline-offset:.2em}:host:focus-visible{outline:none}:host:after{content:\"\";position:absolute;inset:0;border-radius:var(--gbt-radius-glass)}:host:focus-visible:after{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}\n"]
|
|
43
43
|
}]
|
|
44
44
|
}]
|
|
45
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masmarino-gabarit-stat-tile.mjs","names":[],"sources":["../../../projects/gabarit/stat-tile/stat-tile-link.ts","../../../projects/gabarit/stat-tile/stat-tile.ts","../../../projects/gabarit/stat-tile/stat-tile.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core'\n\n@Component({\n selector: 'a[gbtStatTileLink]',\n standalone: true,\n template: '<ng-content />',\n styleUrl: './stat-tile-link.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'gbt-stat-tile__link' },\n})\nexport class StatTileLink {}\n","import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n contentChild,\n inject,\n input,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { IconMarker, IconMarkerTone } from '@masmarino/gabarit/icon-marker'\nimport { StatGrid } from '@masmarino/gabarit/stat-grid'\nimport { StatTileLink } from './stat-tile-link'\n\nexport type StatTileTrend = 'up' | 'down' | 'flat'\nexport type StatTileTrendTone = 'neutral' | 'success' | 'error'\n\n@Component({\n selector: 'gbt-stat-tile',\n standalone: true,\n imports: [Icon, IconMarker, StatTileLink],\n templateUrl: './stat-tile.html',\n styleUrl: './stat-tile.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.role]': 'grid ? \"listitem\" : null',\n '[attr.data-link]': 'linked() ? \"\" : null',\n '[attr.data-muted]': 'muted() ? \"\" : null',\n },\n})\nexport class StatTile {\n label = input('')\n value = input.required<string | number>()\n icon = input<string | null>(null)\n iconTone = input<IconMarkerTone>('info')\n hint = input<string | null>(null)\n trend = input<StatTileTrend | null>(null)\n trendLabel = input<string | null>(null)\n trendTone = input<StatTileTrendTone>('neutral')\n href = input<string | null>(null)\n muted = input(false, { transform: booleanAttribute })\n\n private readonly link = contentChild(StatTileLink)\n protected readonly grid = inject(StatGrid, { optional: true })\n\n protected linked(): boolean {\n return !!this.href() || !!this.link()\n }\n\n protected hasLink(): boolean {\n return !!this.link()\n }\n}\n","<div class=\"gbt-stat-tile\">\n <span class=\"gbt-stat-tile__label\">\n <ng-content select=\"a[gbtStatTileLink]\" />\n @if (!hasLink()) {\n @if (href(); as target) {\n <a gbtStatTileLink [attr.href]=\"target\">{{ label() }}</a>\n } @else {\n {{ label() }}\n }\n }\n </span>\n @if (icon(); as name) {\n <gbt-icon-marker\n class=\"gbt-stat-tile__icon\"\n [icon]=\"name\"\n [tone]=\"muted() ? 'neutral' : iconTone()\"\n shape=\"tile\"\n />\n }\n <span class=\"gbt-stat-tile__value\">{{ value() }}</span>\n @if (hint() || trendLabel()) {\n <span class=\"gbt-stat-tile__meta\">\n @if (trendLabel(); as text) {\n <span\n class=\"gbt-stat-tile__trend\"\n [attr.data-trend]=\"trend()\"\n [attr.data-tone]=\"trendTone()\"\n >\n @if (trend() === 'up') {\n <gbt-icon name=\"arrow-up\" />\n } @else if (trend() === 'down') {\n <gbt-icon name=\"arrow-down\" />\n }\n {{ text }}\n </span>\n }\n @if (hint(); as text) {\n <span class=\"gbt-stat-tile__hint\">{{ text }}</span>\n }\n </span>\n }\n</div>\n"],"mappings":";;;;;AAUA,IAAa,eAAb,MAAa,aAAY;CAAZ,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAY,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAZ,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAY,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,sBAAA;EAAA,UAAA;EAAA,UALb;EAAgB,UAAA;EAAA,QAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"masmarino-gabarit-stat-tile.mjs","names":[],"sources":["../../../projects/gabarit/stat-tile/stat-tile-link.ts","../../../projects/gabarit/stat-tile/stat-tile.ts","../../../projects/gabarit/stat-tile/stat-tile.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core'\n\n@Component({\n selector: 'a[gbtStatTileLink]',\n standalone: true,\n template: '<ng-content />',\n styleUrl: './stat-tile-link.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'gbt-stat-tile__link' },\n})\nexport class StatTileLink {}\n","import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n contentChild,\n inject,\n input,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { IconMarker, IconMarkerTone } from '@masmarino/gabarit/icon-marker'\nimport { StatGrid } from '@masmarino/gabarit/stat-grid'\nimport { StatTileLink } from './stat-tile-link'\n\nexport type StatTileTrend = 'up' | 'down' | 'flat'\nexport type StatTileTrendTone = 'neutral' | 'success' | 'error'\n\n@Component({\n selector: 'gbt-stat-tile',\n standalone: true,\n imports: [Icon, IconMarker, StatTileLink],\n templateUrl: './stat-tile.html',\n styleUrl: './stat-tile.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.role]': 'grid ? \"listitem\" : null',\n '[attr.data-link]': 'linked() ? \"\" : null',\n '[attr.data-muted]': 'muted() ? \"\" : null',\n },\n})\nexport class StatTile {\n label = input('')\n value = input.required<string | number>()\n icon = input<string | null>(null)\n iconTone = input<IconMarkerTone>('info')\n hint = input<string | null>(null)\n trend = input<StatTileTrend | null>(null)\n trendLabel = input<string | null>(null)\n trendTone = input<StatTileTrendTone>('neutral')\n href = input<string | null>(null)\n muted = input(false, { transform: booleanAttribute })\n\n private readonly link = contentChild(StatTileLink)\n protected readonly grid = inject(StatGrid, { optional: true })\n\n protected linked(): boolean {\n return !!this.href() || !!this.link()\n }\n\n protected hasLink(): boolean {\n return !!this.link()\n }\n}\n","<div class=\"gbt-stat-tile\">\n <span class=\"gbt-stat-tile__label\">\n <ng-content select=\"a[gbtStatTileLink]\" />\n @if (!hasLink()) {\n @if (href(); as target) {\n <a gbtStatTileLink [attr.href]=\"target\">{{ label() }}</a>\n } @else {\n {{ label() }}\n }\n }\n </span>\n @if (icon(); as name) {\n <gbt-icon-marker\n class=\"gbt-stat-tile__icon\"\n [icon]=\"name\"\n [tone]=\"muted() ? 'neutral' : iconTone()\"\n shape=\"tile\"\n />\n }\n <span class=\"gbt-stat-tile__value\">{{ value() }}</span>\n @if (hint() || trendLabel()) {\n <span class=\"gbt-stat-tile__meta\">\n @if (trendLabel(); as text) {\n <span\n class=\"gbt-stat-tile__trend\"\n [attr.data-trend]=\"trend()\"\n [attr.data-tone]=\"trendTone()\"\n >\n @if (trend() === 'up') {\n <gbt-icon name=\"arrow-up\" />\n } @else if (trend() === 'down') {\n <gbt-icon name=\"arrow-down\" />\n }\n {{ text }}\n </span>\n }\n @if (hint(); as text) {\n <span class=\"gbt-stat-tile__hint\">{{ text }}</span>\n }\n </span>\n }\n</div>\n"],"mappings":";;;;;AAUA,IAAa,eAAb,MAAa,aAAY;CAAZ,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAY,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAZ,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAY,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,g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A;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,MAAA,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,YAAA,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,MAAA,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,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,YAAY,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -106,7 +106,7 @@ var Stepper = class Stepper {
|
|
|
106
106
|
},
|
|
107
107
|
ngImport: i0,
|
|
108
108
|
template: "<ng-template #content let-index=\"index\" let-step=\"step\">\n <span class=\"gbt-stepper__indicator\">\n @switch (statusOf(index)) {\n @case ('completed') {\n <gbt-icon name=\"check\" aria-hidden=\"true\" />\n }\n @case ('error') {\n <gbt-icon name=\"alert-triangle\" aria-hidden=\"true\" />\n }\n @default {\n {{ index + 1 }}\n }\n }\n </span>\n <span class=\"gbt-stepper__label\">\n {{ step.label }}\n @if (statusOf(index) === 'completed') {\n <span class=\"sr-only\"> — {{ completedLabel() }}</span>\n } @else if (statusOf(index) === 'error') {\n <span class=\"sr-only\"> — {{ errorLabel() }}</span>\n }\n @if (isSelected(index)) {\n <span class=\"sr-only\"> — {{ selectedLabel() }}</span>\n }\n </span>\n</ng-template>\n\n<ol class=\"gbt-stepper\" [attr.data-orientation]=\"orientation()\">\n @for (step of steps(); track $index) {\n <li\n class=\"gbt-stepper__step\"\n [attr.data-status]=\"statusOf($index)\"\n [attr.data-selected]=\"isSelected($index) ? '' : null\"\n [attr.aria-current]=\"statusOf($index) === 'current' ? 'step' : null\"\n >\n @if (interactive()) {\n <button type=\"button\" class=\"gbt-stepper__button\" (click)=\"select($index)\">\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n </button>\n } @else {\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n }\n </li>\n }\n</ol>\n",
|
|
109
|
-
styles: [".gbt-stepper{display:flex;margin:0;padding:0;list-style:none}.gbt-stepper[data-orientation=horizontal]{flex-direction:row}.gbt-stepper[data-orientation=vertical]{flex-direction:column;gap:.5rem}.gbt-stepper__step{position:relative;display:flex;flex:1;align-items:center;gap:.5rem}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step{flex-direction:column}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step:not(:first-child):before{content:\"\";position:absolute;top:15px;right:calc(50% + 16px);left:calc(-50% + 16px);height:2px;background:var(--border-color)}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step[data-status=completed]:not(:first-child):before{background:var(--primary)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step{flex:none;flex-direction:row}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step:not(:last-child):before{content:\"\";position:absolute;top:32px;bottom:-8px;left:15px;width:2px;background:var(--border-color)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step[data-status=completed]:not(:last-child):before{background:var(--primary)}.gbt-stepper__indicator{position:relative;z-index:1;box-sizing:border-box;display:flex;flex-shrink:0;align-items:center;justify-content:center;width:32px;height:32px;background:var(--bg-principal);border:2px solid var(--border-color);border-radius:50%;color:var(--text-secondary);font-size:13px;font-weight:600}.gbt-stepper__step[data-status=current] .gbt-stepper__indicator{border-color:var(--primary);color:var(--primary)}.gbt-stepper__step[data-status=completed] .gbt-stepper__indicator{background:var(--primary);border-color:var(--primary);color:var(--text-on-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__indicator{border-color:var(--color-error-text);color:var(--color-error-text)}.gbt-stepper__label{font-size:13px;font-weight:600;color:var(--text-secondary);text-align:center}.gbt-stepper[data-orientation=vertical] .gbt-stepper__label{text-align:left}.gbt-stepper__step[data-status=current] .gbt-stepper__label{color:var(--text-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__label{color:var(--color-error-text)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-stepper__button{display:flex;align-items:center;gap:.5rem;padding:0;background:none;border:0;border-radius:
|
|
109
|
+
styles: [".gbt-stepper{display:flex;margin:0;padding:0;list-style:none}.gbt-stepper[data-orientation=horizontal]{flex-direction:row}.gbt-stepper[data-orientation=vertical]{flex-direction:column;gap:.5rem}.gbt-stepper__step{position:relative;display:flex;flex:1;align-items:center;gap:.5rem}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step{flex-direction:column}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step:not(:first-child):before{content:\"\";position:absolute;top:15px;right:calc(50% + 16px);left:calc(-50% + 16px);height:2px;background:var(--border-color)}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step[data-status=completed]:not(:first-child):before{background:var(--primary)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step{flex:none;flex-direction:row}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step:not(:last-child):before{content:\"\";position:absolute;top:32px;bottom:-8px;left:15px;width:2px;background:var(--border-color)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step[data-status=completed]:not(:last-child):before{background:var(--primary)}.gbt-stepper__indicator{position:relative;z-index:1;box-sizing:border-box;display:flex;flex-shrink:0;align-items:center;justify-content:center;width:32px;height:32px;background:var(--bg-principal);border:2px solid var(--border-color);border-radius:50%;color:var(--text-secondary);font-size:13px;font-weight:600}.gbt-stepper__step[data-status=current] .gbt-stepper__indicator{border-color:var(--primary);color:var(--primary)}.gbt-stepper__step[data-status=completed] .gbt-stepper__indicator{background:var(--primary);border-color:var(--primary);color:var(--text-on-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__indicator{border-color:var(--color-error-text);color:var(--color-error-text)}.gbt-stepper__label{font-size:13px;font-weight:600;color:var(--text-secondary);text-align:center}.gbt-stepper[data-orientation=vertical] .gbt-stepper__label{text-align:left}.gbt-stepper__step[data-status=current] .gbt-stepper__label{color:var(--text-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__label{color:var(--color-error-text)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-stepper__button{display:flex;align-items:center;gap:.5rem;padding:0;background:none;border:0;border-radius:var(--site-border-radius);font:inherit;color:inherit;cursor:pointer}.gbt-stepper__button:hover .gbt-stepper__label{text-decoration:underline;text-underline-offset:4px}.gbt-stepper__button:active{opacity:.7}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__button{flex-direction:column}.gbt-stepper[data-orientation=vertical] .gbt-stepper__button{flex-direction:row}.gbt-stepper__button:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:4px}.gbt-stepper__step[data-selected] .gbt-stepper__indicator{box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 30%,transparent)}.gbt-stepper__step[data-selected] .gbt-stepper__label{text-decoration:underline;text-underline-offset:4px}\n"],
|
|
110
110
|
dependencies: [{
|
|
111
111
|
kind: "component",
|
|
112
112
|
type: Icon,
|
|
@@ -138,7 +138,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
138
138
|
imports: [Icon, NgTemplateOutlet],
|
|
139
139
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
140
140
|
template: "<ng-template #content let-index=\"index\" let-step=\"step\">\n <span class=\"gbt-stepper__indicator\">\n @switch (statusOf(index)) {\n @case ('completed') {\n <gbt-icon name=\"check\" aria-hidden=\"true\" />\n }\n @case ('error') {\n <gbt-icon name=\"alert-triangle\" aria-hidden=\"true\" />\n }\n @default {\n {{ index + 1 }}\n }\n }\n </span>\n <span class=\"gbt-stepper__label\">\n {{ step.label }}\n @if (statusOf(index) === 'completed') {\n <span class=\"sr-only\"> — {{ completedLabel() }}</span>\n } @else if (statusOf(index) === 'error') {\n <span class=\"sr-only\"> — {{ errorLabel() }}</span>\n }\n @if (isSelected(index)) {\n <span class=\"sr-only\"> — {{ selectedLabel() }}</span>\n }\n </span>\n</ng-template>\n\n<ol class=\"gbt-stepper\" [attr.data-orientation]=\"orientation()\">\n @for (step of steps(); track $index) {\n <li\n class=\"gbt-stepper__step\"\n [attr.data-status]=\"statusOf($index)\"\n [attr.data-selected]=\"isSelected($index) ? '' : null\"\n [attr.aria-current]=\"statusOf($index) === 'current' ? 'step' : null\"\n >\n @if (interactive()) {\n <button type=\"button\" class=\"gbt-stepper__button\" (click)=\"select($index)\">\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n </button>\n } @else {\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n }\n </li>\n }\n</ol>\n",
|
|
141
|
-
styles: [".gbt-stepper{display:flex;margin:0;padding:0;list-style:none}.gbt-stepper[data-orientation=horizontal]{flex-direction:row}.gbt-stepper[data-orientation=vertical]{flex-direction:column;gap:.5rem}.gbt-stepper__step{position:relative;display:flex;flex:1;align-items:center;gap:.5rem}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step{flex-direction:column}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step:not(:first-child):before{content:\"\";position:absolute;top:15px;right:calc(50% + 16px);left:calc(-50% + 16px);height:2px;background:var(--border-color)}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step[data-status=completed]:not(:first-child):before{background:var(--primary)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step{flex:none;flex-direction:row}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step:not(:last-child):before{content:\"\";position:absolute;top:32px;bottom:-8px;left:15px;width:2px;background:var(--border-color)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step[data-status=completed]:not(:last-child):before{background:var(--primary)}.gbt-stepper__indicator{position:relative;z-index:1;box-sizing:border-box;display:flex;flex-shrink:0;align-items:center;justify-content:center;width:32px;height:32px;background:var(--bg-principal);border:2px solid var(--border-color);border-radius:50%;color:var(--text-secondary);font-size:13px;font-weight:600}.gbt-stepper__step[data-status=current] .gbt-stepper__indicator{border-color:var(--primary);color:var(--primary)}.gbt-stepper__step[data-status=completed] .gbt-stepper__indicator{background:var(--primary);border-color:var(--primary);color:var(--text-on-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__indicator{border-color:var(--color-error-text);color:var(--color-error-text)}.gbt-stepper__label{font-size:13px;font-weight:600;color:var(--text-secondary);text-align:center}.gbt-stepper[data-orientation=vertical] .gbt-stepper__label{text-align:left}.gbt-stepper__step[data-status=current] .gbt-stepper__label{color:var(--text-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__label{color:var(--color-error-text)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-stepper__button{display:flex;align-items:center;gap:.5rem;padding:0;background:none;border:0;border-radius:
|
|
141
|
+
styles: [".gbt-stepper{display:flex;margin:0;padding:0;list-style:none}.gbt-stepper[data-orientation=horizontal]{flex-direction:row}.gbt-stepper[data-orientation=vertical]{flex-direction:column;gap:.5rem}.gbt-stepper__step{position:relative;display:flex;flex:1;align-items:center;gap:.5rem}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step{flex-direction:column}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step:not(:first-child):before{content:\"\";position:absolute;top:15px;right:calc(50% + 16px);left:calc(-50% + 16px);height:2px;background:var(--border-color)}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__step[data-status=completed]:not(:first-child):before{background:var(--primary)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step{flex:none;flex-direction:row}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step:not(:last-child):before{content:\"\";position:absolute;top:32px;bottom:-8px;left:15px;width:2px;background:var(--border-color)}.gbt-stepper[data-orientation=vertical] .gbt-stepper__step[data-status=completed]:not(:last-child):before{background:var(--primary)}.gbt-stepper__indicator{position:relative;z-index:1;box-sizing:border-box;display:flex;flex-shrink:0;align-items:center;justify-content:center;width:32px;height:32px;background:var(--bg-principal);border:2px solid var(--border-color);border-radius:50%;color:var(--text-secondary);font-size:13px;font-weight:600}.gbt-stepper__step[data-status=current] .gbt-stepper__indicator{border-color:var(--primary);color:var(--primary)}.gbt-stepper__step[data-status=completed] .gbt-stepper__indicator{background:var(--primary);border-color:var(--primary);color:var(--text-on-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__indicator{border-color:var(--color-error-text);color:var(--color-error-text)}.gbt-stepper__label{font-size:13px;font-weight:600;color:var(--text-secondary);text-align:center}.gbt-stepper[data-orientation=vertical] .gbt-stepper__label{text-align:left}.gbt-stepper__step[data-status=current] .gbt-stepper__label{color:var(--text-primary)}.gbt-stepper__step[data-status=error] .gbt-stepper__label{color:var(--color-error-text)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.gbt-stepper__button{display:flex;align-items:center;gap:.5rem;padding:0;background:none;border:0;border-radius:var(--site-border-radius);font:inherit;color:inherit;cursor:pointer}.gbt-stepper__button:hover .gbt-stepper__label{text-decoration:underline;text-underline-offset:4px}.gbt-stepper__button:active{opacity:.7}.gbt-stepper[data-orientation=horizontal] .gbt-stepper__button{flex-direction:column}.gbt-stepper[data-orientation=vertical] .gbt-stepper__button{flex-direction:row}.gbt-stepper__button:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:4px}.gbt-stepper__step[data-selected] .gbt-stepper__indicator{box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 30%,transparent)}.gbt-stepper__step[data-selected] .gbt-stepper__label{text-decoration:underline;text-underline-offset:4px}\n"]
|
|
142
142
|
}]
|
|
143
143
|
}],
|
|
144
144
|
propDecorators: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masmarino-gabarit-stepper.mjs","names":[],"sources":["../../../projects/gabarit/stepper/stepper.ts","../../../projects/gabarit/stepper/stepper.html"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common'\nimport { ChangeDetectionStrategy, Component, booleanAttribute, input, model } from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\n\nexport type StepperStatus = 'upcoming' | 'current' | 'completed' | 'error'\nexport type StepperOrientation = 'horizontal' | 'vertical'\n\nexport interface StepperStep {\n label: string\n hasError?: boolean\n}\n\n@Component({\n selector: 'gbt-stepper',\n standalone: true,\n imports: [Icon, NgTemplateOutlet],\n templateUrl: './stepper.html',\n styleUrl: './stepper.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Stepper {\n steps = input.required<StepperStep[]>()\n activeIndex = model(0)\n orientation = input<StepperOrientation>('horizontal')\n completedLabel = input<string>('Completed')\n errorLabel = input<string>('Error')\n interactive = input(false, { transform: booleanAttribute })\n selectedIndex = model<number | null>(null)\n selectedLabel = input<string>('Selected')\n\n protected select(index: number): void {\n this.selectedIndex.set(index)\n }\n\n protected isSelected(index: number): boolean {\n return this.interactive() && this.selectedIndex() === index\n }\n\n protected statusOf(index: number): StepperStatus {\n const step = this.steps()[index]\n const active = this.activeIndex()\n if (step.hasError && index <= active) {\n return 'error'\n }\n if (index < active) {\n return 'completed'\n }\n if (index === active) {\n return 'current'\n }\n return 'upcoming'\n }\n}\n","<ng-template #content let-index=\"index\" let-step=\"step\">\n <span class=\"gbt-stepper__indicator\">\n @switch (statusOf(index)) {\n @case ('completed') {\n <gbt-icon name=\"check\" aria-hidden=\"true\" />\n }\n @case ('error') {\n <gbt-icon name=\"alert-triangle\" aria-hidden=\"true\" />\n }\n @default {\n {{ index + 1 }}\n }\n }\n </span>\n <span class=\"gbt-stepper__label\">\n {{ step.label }}\n @if (statusOf(index) === 'completed') {\n <span class=\"sr-only\"> — {{ completedLabel() }}</span>\n } @else if (statusOf(index) === 'error') {\n <span class=\"sr-only\"> — {{ errorLabel() }}</span>\n }\n @if (isSelected(index)) {\n <span class=\"sr-only\"> — {{ selectedLabel() }}</span>\n }\n </span>\n</ng-template>\n\n<ol class=\"gbt-stepper\" [attr.data-orientation]=\"orientation()\">\n @for (step of steps(); track $index) {\n <li\n class=\"gbt-stepper__step\"\n [attr.data-status]=\"statusOf($index)\"\n [attr.data-selected]=\"isSelected($index) ? '' : null\"\n [attr.aria-current]=\"statusOf($index) === 'current' ? 'step' : null\"\n >\n @if (interactive()) {\n <button type=\"button\" class=\"gbt-stepper__button\" (click)=\"select($index)\">\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n </button>\n } @else {\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n }\n </li>\n }\n</ol>\n"],"mappings":";;;;AAoBA,IAAa,UAAb,MAAa,QAAO;CAClB,QAAQ,MAAM,SAAyB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,cAAc,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAA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AAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,gBAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;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;GAAA,eAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,aAAA;GAAA,eAAA;EAAA;EAAA,UAAA;EAAA,UCpBpB;EA6CA,QAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"masmarino-gabarit-stepper.mjs","names":[],"sources":["../../../projects/gabarit/stepper/stepper.ts","../../../projects/gabarit/stepper/stepper.html"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common'\nimport { ChangeDetectionStrategy, Component, booleanAttribute, input, model } from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\n\nexport type StepperStatus = 'upcoming' | 'current' | 'completed' | 'error'\nexport type StepperOrientation = 'horizontal' | 'vertical'\n\nexport interface StepperStep {\n label: string\n hasError?: boolean\n}\n\n@Component({\n selector: 'gbt-stepper',\n standalone: true,\n imports: [Icon, NgTemplateOutlet],\n templateUrl: './stepper.html',\n styleUrl: './stepper.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Stepper {\n steps = input.required<StepperStep[]>()\n activeIndex = model(0)\n orientation = input<StepperOrientation>('horizontal')\n completedLabel = input<string>('Completed')\n errorLabel = input<string>('Error')\n interactive = input(false, { transform: booleanAttribute })\n selectedIndex = model<number | null>(null)\n selectedLabel = input<string>('Selected')\n\n protected select(index: number): void {\n this.selectedIndex.set(index)\n }\n\n protected isSelected(index: number): boolean {\n return this.interactive() && this.selectedIndex() === index\n }\n\n protected statusOf(index: number): StepperStatus {\n const step = this.steps()[index]\n const active = this.activeIndex()\n if (step.hasError && index <= active) {\n return 'error'\n }\n if (index < active) {\n return 'completed'\n }\n if (index === active) {\n return 'current'\n }\n return 'upcoming'\n }\n}\n","<ng-template #content let-index=\"index\" let-step=\"step\">\n <span class=\"gbt-stepper__indicator\">\n @switch (statusOf(index)) {\n @case ('completed') {\n <gbt-icon name=\"check\" aria-hidden=\"true\" />\n }\n @case ('error') {\n <gbt-icon name=\"alert-triangle\" aria-hidden=\"true\" />\n }\n @default {\n {{ index + 1 }}\n }\n }\n </span>\n <span class=\"gbt-stepper__label\">\n {{ step.label }}\n @if (statusOf(index) === 'completed') {\n <span class=\"sr-only\"> — {{ completedLabel() }}</span>\n } @else if (statusOf(index) === 'error') {\n <span class=\"sr-only\"> — {{ errorLabel() }}</span>\n }\n @if (isSelected(index)) {\n <span class=\"sr-only\"> — {{ selectedLabel() }}</span>\n }\n </span>\n</ng-template>\n\n<ol class=\"gbt-stepper\" [attr.data-orientation]=\"orientation()\">\n @for (step of steps(); track $index) {\n <li\n class=\"gbt-stepper__step\"\n [attr.data-status]=\"statusOf($index)\"\n [attr.data-selected]=\"isSelected($index) ? '' : null\"\n [attr.aria-current]=\"statusOf($index) === 'current' ? 'step' : null\"\n >\n @if (interactive()) {\n <button type=\"button\" class=\"gbt-stepper__button\" (click)=\"select($index)\">\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n </button>\n } @else {\n <ng-container *ngTemplateOutlet=\"content; context: { index: $index, step: step }\" />\n }\n </li>\n }\n</ol>\n"],"mappings":";;;;AAoBA,IAAa,UAAb,MAAa,QAAO;CAClB,QAAQ,MAAM,SAAyB,GAAA,YAAA,CA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
|
|
@@ -86,7 +86,7 @@ var Switch = class Switch {
|
|
|
86
86
|
}],
|
|
87
87
|
ngImport: i0,
|
|
88
88
|
template: "<label class=\"gbt-switch\" [class.gbt-switch--disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n class=\"gbt-switch__input\"\n [id]=\"id()\"\n [checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-describedby]=\"hint() ? hintId() : null\"\n (change)=\"onToggle($event)\"\n />\n <span class=\"gbt-switch__track\">\n <span class=\"gbt-switch__thumb\"></span>\n </span>\n <span>{{ label() }}</span>\n</label>\n@if (hint()) {\n <p [id]=\"hintId()\" class=\"gbt-switch__hint\">{{ hint() }}</p>\n}\n",
|
|
89
|
-
styles: [":host(.gbt-switch-host--hint){display:block}.gbt-switch{position:relative;display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--text-primary);cursor:pointer}.gbt-switch:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-switch--disabled{cursor:not-allowed;opacity:.5}.gbt-switch__input{position:absolute;width:2.25rem;height:1.25rem;margin:0;opacity:0;cursor:inherit}.gbt-switch__track{position:relative;display:inline-flex;flex-shrink:0;align-items:center;width:2.25rem;height:1.25rem;background:var(--border-color);border-radius:999px;box-shadow:var(--gbt-depth-hollow);transition:background .15s ease,box-shadow .15s ease}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__track{background:var(--text-discret)}.gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow)}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow-hover)}.gbt-switch__input:focus-visible+.gbt-switch__track{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-switch__thumb{position:absolute;top:.125rem;left:.125rem;width:1rem;height:1rem;background:var(--gbt-knob);border-radius:
|
|
89
|
+
styles: [":host(.gbt-switch-host--hint){display:block}.gbt-switch{position:relative;display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--text-primary);cursor:pointer}.gbt-switch:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-switch--disabled{cursor:not-allowed;opacity:.5}.gbt-switch__input{position:absolute;width:2.25rem;height:1.25rem;margin:0;opacity:0;cursor:inherit}.gbt-switch__track{position:relative;display:inline-flex;flex-shrink:0;align-items:center;width:2.25rem;height:1.25rem;background:var(--border-color);border-radius:999px;box-shadow:var(--gbt-depth-hollow);transition:background .15s ease,box-shadow .15s ease}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__track{background:var(--text-discret)}.gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow)}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow-hover)}.gbt-switch__input:focus-visible+.gbt-switch__track{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-switch__thumb{position:absolute;top:.125rem;left:.125rem;width:1rem;height:1rem;background:var(--gbt-knob);border-radius:999px;box-shadow:var(--gbt-depth-knob);transition:transform .15s ease,width .15s ease,scale .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1),background .15s ease}.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{background:linear-gradient(#ffffff24,#ffffff0a 50%,#ffffff24),var(--gbt-glass-liquid);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid)}@media(prefers-reduced-motion:no-preference){.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{scale:1.04}}@media(prefers-reduced-transparency:reduce){.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{background:var(--gbt-knob);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-reduced-motion:no-preference){.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{width:1.1875rem}.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__input:checked~.gbt-switch__track .gbt-switch__thumb{transform:translate(.8125rem)}}.gbt-switch__input:checked~.gbt-switch__track .gbt-switch__thumb{transform:translate(1rem)}.gbt-switch__hint{margin:.125rem 0 0;padding-left:2.75rem;font-size:.75rem;line-height:1.4;color:var(--text-secondary)}@media(prefers-reduced-motion:reduce){.gbt-switch__track,.gbt-switch__thumb{transition:none}}\n"],
|
|
90
90
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
91
91
|
});
|
|
92
92
|
};
|
|
@@ -108,7 +108,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
108
108
|
multi: true
|
|
109
109
|
}],
|
|
110
110
|
template: "<label class=\"gbt-switch\" [class.gbt-switch--disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n class=\"gbt-switch__input\"\n [id]=\"id()\"\n [checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-describedby]=\"hint() ? hintId() : null\"\n (change)=\"onToggle($event)\"\n />\n <span class=\"gbt-switch__track\">\n <span class=\"gbt-switch__thumb\"></span>\n </span>\n <span>{{ label() }}</span>\n</label>\n@if (hint()) {\n <p [id]=\"hintId()\" class=\"gbt-switch__hint\">{{ hint() }}</p>\n}\n",
|
|
111
|
-
styles: [":host(.gbt-switch-host--hint){display:block}.gbt-switch{position:relative;display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--text-primary);cursor:pointer}.gbt-switch:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-switch--disabled{cursor:not-allowed;opacity:.5}.gbt-switch__input{position:absolute;width:2.25rem;height:1.25rem;margin:0;opacity:0;cursor:inherit}.gbt-switch__track{position:relative;display:inline-flex;flex-shrink:0;align-items:center;width:2.25rem;height:1.25rem;background:var(--border-color);border-radius:999px;box-shadow:var(--gbt-depth-hollow);transition:background .15s ease,box-shadow .15s ease}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__track{background:var(--text-discret)}.gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow)}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow-hover)}.gbt-switch__input:focus-visible+.gbt-switch__track{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-switch__thumb{position:absolute;top:.125rem;left:.125rem;width:1rem;height:1rem;background:var(--gbt-knob);border-radius:
|
|
111
|
+
styles: [":host(.gbt-switch-host--hint){display:block}.gbt-switch{position:relative;display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--text-primary);cursor:pointer}.gbt-switch:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}.gbt-switch--disabled{cursor:not-allowed;opacity:.5}.gbt-switch__input{position:absolute;width:2.25rem;height:1.25rem;margin:0;opacity:0;cursor:inherit}.gbt-switch__track{position:relative;display:inline-flex;flex-shrink:0;align-items:center;width:2.25rem;height:1.25rem;background:var(--border-color);border-radius:999px;box-shadow:var(--gbt-depth-hollow);transition:background .15s ease,box-shadow .15s ease}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__track{background:var(--text-discret)}.gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow)}.gbt-switch:not(.gbt-switch--disabled):hover .gbt-switch__input:checked+.gbt-switch__track{background:var(--accent);box-shadow:var(--gbt-depth-hollow),var(--gbt-glow-hover)}.gbt-switch__input:focus-visible+.gbt-switch__track{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-switch__thumb{position:absolute;top:.125rem;left:.125rem;width:1rem;height:1rem;background:var(--gbt-knob);border-radius:999px;box-shadow:var(--gbt-depth-knob);transition:transform .15s ease,width .15s ease,scale .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1),background .15s ease}.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{background:linear-gradient(#ffffff24,#ffffff0a 50%,#ffffff24),var(--gbt-glass-liquid);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid)}@media(prefers-reduced-motion:no-preference){.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{scale:1.04}}@media(prefers-reduced-transparency:reduce){.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{background:var(--gbt-knob);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-reduced-motion:no-preference){.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__thumb{width:1.1875rem}.gbt-switch:not(.gbt-switch--disabled):active .gbt-switch__input:checked~.gbt-switch__track .gbt-switch__thumb{transform:translate(.8125rem)}}.gbt-switch__input:checked~.gbt-switch__track .gbt-switch__thumb{transform:translate(1rem)}.gbt-switch__hint{margin:.125rem 0 0;padding-left:2.75rem;font-size:.75rem;line-height:1.4;color:var(--text-secondary)}@media(prefers-reduced-motion:reduce){.gbt-switch__track,.gbt-switch__thumb{transition:none}}\n"]
|
|
112
112
|
}]
|
|
113
113
|
}],
|
|
114
114
|
propDecorators: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masmarino-gabarit-switch.mjs","names":[],"sources":["../../../projects/gabarit/switch/switch.ts","../../../projects/gabarit/switch/switch.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n signal,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nlet nextSwitchId = 0\n\n@Component({\n selector: 'gbt-switch',\n standalone: true,\n templateUrl: './switch.html',\n styleUrl: './switch.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.gbt-switch-host--hint]': '!!hint()',\n },\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => Switch),\n multi: true,\n },\n ],\n})\nexport class Switch implements ControlValueAccessor {\n id = input<string>(`gbt-switch-${++nextSwitchId}`)\n label = input<string>('')\n disabled = input(false, { transform: booleanAttribute })\n hint = input<string>('')\n\n protected readonly hintId = computed(() => `${this.id()}-hint`)\n protected readonly checked = signal(false)\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n private onChange: (value: boolean) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: boolean): void {\n this.checked.set(!!value)\n }\n\n registerOnChange(fn: (value: boolean) => 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 onToggle(event: Event): void {\n const value = (event.target as HTMLInputElement).checked\n this.checked.set(value)\n this.onChange(value)\n this.onTouched()\n }\n}\n","<label class=\"gbt-switch\" [class.gbt-switch--disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n class=\"gbt-switch__input\"\n [id]=\"id()\"\n [checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-describedby]=\"hint() ? hintId() : null\"\n (change)=\"onToggle($event)\"\n />\n <span class=\"gbt-switch__track\">\n <span class=\"gbt-switch__thumb\"></span>\n </span>\n <span>{{ label() }}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KAAK,QAAQ,IAAI,KAAK;EACtB,KAAK,SAAS,KAAK;EACnB,KAAK,UAAS;CAChB;CApCW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAN,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAM,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,IAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,+BAAA,WAAA,EAAA;EAAA,WARN,CACT;GACE,SAAS;GACT,aAAa,iBAAiB,MAAM;GACpC,OAAO;EACR,CACF;EAAA,UAAA;EAAA,UC5BH;EAmBA,QAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"masmarino-gabarit-switch.mjs","names":[],"sources":["../../../projects/gabarit/switch/switch.ts","../../../projects/gabarit/switch/switch.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n signal,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nlet nextSwitchId = 0\n\n@Component({\n selector: 'gbt-switch',\n standalone: true,\n templateUrl: './switch.html',\n styleUrl: './switch.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.gbt-switch-host--hint]': '!!hint()',\n },\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => Switch),\n multi: true,\n },\n ],\n})\nexport class Switch implements ControlValueAccessor {\n id = input<string>(`gbt-switch-${++nextSwitchId}`)\n label = input<string>('')\n disabled = input(false, { transform: booleanAttribute })\n hint = input<string>('')\n\n protected readonly hintId = computed(() => `${this.id()}-hint`)\n protected readonly checked = signal(false)\n\n private readonly formDisabled = signal(false)\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled())\n\n private onChange: (value: boolean) => void = () => {}\n private onTouched: () => void = () => {}\n\n writeValue(value: boolean): void {\n this.checked.set(!!value)\n }\n\n registerOnChange(fn: (value: boolean) => 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 onToggle(event: Event): void {\n const value = (event.target as HTMLInputElement).checked\n this.checked.set(value)\n this.onChange(value)\n this.onTouched()\n }\n}\n","<label class=\"gbt-switch\" [class.gbt-switch--disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n class=\"gbt-switch__input\"\n [id]=\"id()\"\n [checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-describedby]=\"hint() ? hintId() : null\"\n (change)=\"onToggle($event)\"\n />\n <span class=\"gbt-switch__track\">\n <span class=\"gbt-switch__thumb\"></span>\n </span>\n <span>{{ label() }}</span>\n</label>\n@if (hint()) {\n <p [id]=\"hintId()\" class=\"gbt-switch__hint\">{{ hint() }}</p>\n}\n"],"mappings":";;;AAWA,IAAI,eAAe;AAmBnB,IAAa,SAAb,MAAa,OAAM;CACjB,KAAK,MAAc,cAAc,EAAE,gBAAe,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAClD,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,WAAW,MAAM,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AAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,+BAAA,WAAA,EAAA;EAAA,WARN,CACT;GACE,SAAS;GACT,aAAa,iBAAiB,MAAM;GACpC,OAAO;EACR,CACF;EAAA,UAAA;EAAA,UC5BH;EAmBA,QAAA,CAAA,qtFAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;ADWa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA;EAjBlB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,YACV;GAAI,iBAGC,wBAAwB;GAAM,MACzC,EACJ,iCAAiC,WAClC;GAAA,WACU,CACT;IACE,SAAS;IACT,aAAa,iBAAgB,MAAO;IACpC,OAAO;GACR,CACF;GAAA,UAAA;GAAA,QAAA,CAAA,qtFAAA;EAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, contentChildren, effect, input, model, signal, viewChildren } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, afterRenderEffect, contentChildren, effect, inject, input, model, signal, viewChild, viewChildren } from "@angular/core";
|
|
3
3
|
var Tab = class Tab {
|
|
4
4
|
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
5
5
|
active = signal(false, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
@@ -80,8 +80,29 @@ var Tabs = class Tabs {
|
|
|
80
80
|
id = input(`gbt-tabs-${++nextTabsId}`, ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
81
81
|
tabs = contentChildren(Tab, ...ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []);
|
|
82
82
|
triggers = viewChildren("trigger", ...ngDevMode ? [{ debugName: "triggers" }] : /* istanbul ignore next */ []);
|
|
83
|
+
list = viewChild("list", ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
|
|
83
84
|
activeIndex = model(0, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
|
|
85
|
+
lens = signal(null, ...ngDevMode ? [{ debugName: "lens" }] : /* istanbul ignore next */ []);
|
|
86
|
+
lensGlides = signal(false, ...ngDevMode ? [{ debugName: "lensGlides" }] : /* istanbul ignore next */ []);
|
|
84
87
|
constructor() {
|
|
88
|
+
const layout = signal(0, ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
|
|
89
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
90
|
+
const observer = new ResizeObserver(() => layout.update((n) => n + 1));
|
|
91
|
+
afterRenderEffect(() => {
|
|
92
|
+
const list = this.list()?.nativeElement;
|
|
93
|
+
if (list) {
|
|
94
|
+
observer.disconnect();
|
|
95
|
+
observer.observe(list);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
inject(DestroyRef).onDestroy(() => observer.disconnect());
|
|
99
|
+
}
|
|
100
|
+
afterRenderEffect({ read: () => {
|
|
101
|
+
layout();
|
|
102
|
+
this.activeIndex();
|
|
103
|
+
this.tabs();
|
|
104
|
+
this.place();
|
|
105
|
+
} });
|
|
85
106
|
effect(() => {
|
|
86
107
|
const tabs = this.tabs();
|
|
87
108
|
const active = this.activeIndex();
|
|
@@ -96,6 +117,24 @@ var Tabs = class Tabs {
|
|
|
96
117
|
if (clamped !== current) this.activeIndex.set(clamped);
|
|
97
118
|
});
|
|
98
119
|
}
|
|
120
|
+
place() {
|
|
121
|
+
const open = this.triggers()[this.activeIndex()]?.nativeElement;
|
|
122
|
+
if (!open || open.offsetWidth === 0) {
|
|
123
|
+
this.lens.set(null);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const box = {
|
|
127
|
+
x: open.offsetLeft,
|
|
128
|
+
y: open.offsetTop,
|
|
129
|
+
width: open.offsetWidth,
|
|
130
|
+
height: open.offsetHeight
|
|
131
|
+
};
|
|
132
|
+
const current = this.lens();
|
|
133
|
+
if (current && current.x === box.x && current.y === box.y && current.width === box.width && current.height === box.height) return;
|
|
134
|
+
const first = current === null;
|
|
135
|
+
this.lens.set(box);
|
|
136
|
+
if (first && typeof requestAnimationFrame !== "undefined") requestAnimationFrame(() => this.lensGlides.set(true));
|
|
137
|
+
}
|
|
99
138
|
select(index) {
|
|
100
139
|
this.activeIndex.set(index);
|
|
101
140
|
}
|
|
@@ -151,10 +190,16 @@ var Tabs = class Tabs {
|
|
|
151
190
|
predicate: ["trigger"],
|
|
152
191
|
descendants: true,
|
|
153
192
|
isSignal: true
|
|
193
|
+
}, {
|
|
194
|
+
propertyName: "list",
|
|
195
|
+
first: true,
|
|
196
|
+
predicate: ["list"],
|
|
197
|
+
descendants: true,
|
|
198
|
+
isSignal: true
|
|
154
199
|
}],
|
|
155
200
|
ngImport: i0,
|
|
156
|
-
template: "<div class=\"gbt-tabs\">\n <div class=\"gbt-tabs__list\" role=\"tablist\">\n @for (tab of tabs(); track tab; let i = $index) {\n <button\n #trigger\n type=\"button\"\n class=\"gbt-tabs__trigger\"\n [class.gbt-tabs__trigger--active]=\"activeIndex() === i\"\n role=\"tab\"\n [id]=\"id() + '-trigger-' + i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-controls]=\"id() + '-panel-' + i\"\n [tabIndex]=\"activeIndex() === i ? 0 : -1\"\n (click)=\"select(i)\"\n (keydown)=\"onKeydown($event, i)\"\n >\n {{ tab.label() }}\n </button>\n }\n </div>\n <div class=\"gbt-tabs__panels\">\n <ng-content></ng-content>\n </div>\n</div>\n",
|
|
157
|
-
styles: [":host{display:block}.gbt-tabs{display:flex;flex-direction:column}.gbt-tabs__list{display:flex;gap
|
|
201
|
+
template: "<div class=\"gbt-tabs\">\n <div #list class=\"gbt-tabs__list\" [class.gbt-tabs__list--lens]=\"!!lens()\" role=\"tablist\">\n @if (lens(); as box) {\n <span\n class=\"gbt-tabs__lens\"\n [class.gbt-tabs__lens--glides]=\"lensGlides()\"\n aria-hidden=\"true\"\n [style.width.px]=\"box.width\"\n [style.height.px]=\"box.height\"\n [style.transform]=\"'translate(' + box.x + 'px, ' + box.y + 'px)'\"\n ></span>\n }\n @for (tab of tabs(); track tab; let i = $index) {\n <button\n #trigger\n type=\"button\"\n class=\"gbt-tabs__trigger\"\n [class.gbt-tabs__trigger--active]=\"activeIndex() === i\"\n role=\"tab\"\n [id]=\"id() + '-trigger-' + i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-controls]=\"id() + '-panel-' + i\"\n [tabIndex]=\"activeIndex() === i ? 0 : -1\"\n (click)=\"select(i)\"\n (keydown)=\"onKeydown($event, i)\"\n >\n {{ tab.label() }}\n </button>\n }\n </div>\n <div class=\"gbt-tabs__panels\">\n <ng-content></ng-content>\n </div>\n</div>\n",
|
|
202
|
+
styles: [":host{display:block}.gbt-tabs{display:flex;flex-direction:column}.gbt-tabs__list{position:relative;display:flex;align-self:flex-start;max-width:100%;gap:2px;padding:3px;box-sizing:border-box;border-radius:999px;background:var(--gbt-glass-liquid);-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-tabs__list{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-tabs__list{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tabs__list{box-shadow:inset 0 1px 0 var(--gbt-liquid-rim-top),inset 0 -1px 0 var(--gbt-liquid-rim-bottom)}@media(prefers-contrast:more){.gbt-tabs__list{box-shadow:inset 0 0 0 1px var(--border-color),inset 0 1px 0 var(--gbt-liquid-rim-top),inset 0 -1px 0 var(--gbt-liquid-rim-bottom)}}.gbt-tabs__list{overflow-x:auto;scrollbar-width:none}.gbt-tabs__lens{position:absolute;top:0;left:0;border-radius:999px;background:var(--gbt-glass-liquid);-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-tabs__lens{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-tabs__lens{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tabs__lens{color:var(--text-primary);background-image:linear-gradient(var(--gbt-relief-highlight),var(--gbt-relief-highlight));pointer-events:none}@media(prefers-reduced-motion:no-preference){.gbt-tabs__lens--glides{transition:transform .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1),width .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1),height .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1)}}.gbt-tabs__trigger{position:relative;appearance:none;background:none;border:none;border-radius:999px;min-height:var(--gbt-control-height-md);padding:.5rem 1.125rem;font-size:.9375rem;font-weight:500;color:var(--text-secondary);cursor:pointer;white-space:nowrap;transition:color var(--site-transition-fast),background-color var(--site-transition-fast)}.gbt-tabs__trigger:hover{color:var(--text-primary)}.gbt-tabs__trigger:active{color:var(--text-primary);background:var(--bg-hover)}.gbt-tabs__trigger:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tabs__trigger--active{color:var(--text-primary);font-weight:600;background:var(--gbt-glass-liquid);-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-tabs__trigger--active{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-tabs__trigger--active{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tabs__trigger--active{color:var(--text-primary)}.gbt-tabs__list--lens .gbt-tabs__trigger--active,.gbt-tabs__list--lens .gbt-tabs__trigger--active:active{background:none;-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;transition:color var(--site-transition-fast)}@media(prefers-reduced-motion:reduce){.gbt-tabs__list--lens .gbt-tabs__trigger--active,.gbt-tabs__list--lens .gbt-tabs__trigger--active:active{transition:none}}.gbt-tabs__panels{padding-top:1rem;display:flex;flex-direction:column;gap:1rem}@media(prefers-reduced-motion:reduce){.gbt-tabs__trigger{transition:none}}\n"],
|
|
158
203
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
159
204
|
});
|
|
160
205
|
};
|
|
@@ -170,8 +215,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
170
215
|
standalone: true,
|
|
171
216
|
imports: [],
|
|
172
217
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
173
|
-
template: "<div class=\"gbt-tabs\">\n <div class=\"gbt-tabs__list\" role=\"tablist\">\n @for (tab of tabs(); track tab; let i = $index) {\n <button\n #trigger\n type=\"button\"\n class=\"gbt-tabs__trigger\"\n [class.gbt-tabs__trigger--active]=\"activeIndex() === i\"\n role=\"tab\"\n [id]=\"id() + '-trigger-' + i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-controls]=\"id() + '-panel-' + i\"\n [tabIndex]=\"activeIndex() === i ? 0 : -1\"\n (click)=\"select(i)\"\n (keydown)=\"onKeydown($event, i)\"\n >\n {{ tab.label() }}\n </button>\n }\n </div>\n <div class=\"gbt-tabs__panels\">\n <ng-content></ng-content>\n </div>\n</div>\n",
|
|
174
|
-
styles: [":host{display:block}.gbt-tabs{display:flex;flex-direction:column}.gbt-tabs__list{display:flex;gap
|
|
218
|
+
template: "<div class=\"gbt-tabs\">\n <div #list class=\"gbt-tabs__list\" [class.gbt-tabs__list--lens]=\"!!lens()\" role=\"tablist\">\n @if (lens(); as box) {\n <span\n class=\"gbt-tabs__lens\"\n [class.gbt-tabs__lens--glides]=\"lensGlides()\"\n aria-hidden=\"true\"\n [style.width.px]=\"box.width\"\n [style.height.px]=\"box.height\"\n [style.transform]=\"'translate(' + box.x + 'px, ' + box.y + 'px)'\"\n ></span>\n }\n @for (tab of tabs(); track tab; let i = $index) {\n <button\n #trigger\n type=\"button\"\n class=\"gbt-tabs__trigger\"\n [class.gbt-tabs__trigger--active]=\"activeIndex() === i\"\n role=\"tab\"\n [id]=\"id() + '-trigger-' + i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-controls]=\"id() + '-panel-' + i\"\n [tabIndex]=\"activeIndex() === i ? 0 : -1\"\n (click)=\"select(i)\"\n (keydown)=\"onKeydown($event, i)\"\n >\n {{ tab.label() }}\n </button>\n }\n </div>\n <div class=\"gbt-tabs__panels\">\n <ng-content></ng-content>\n </div>\n</div>\n",
|
|
219
|
+
styles: [":host{display:block}.gbt-tabs{display:flex;flex-direction:column}.gbt-tabs__list{position:relative;display:flex;align-self:flex-start;max-width:100%;gap:2px;padding:3px;box-sizing:border-box;border-radius:999px;background:var(--gbt-glass-liquid);-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-tabs__list{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-tabs__list{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tabs__list{box-shadow:inset 0 1px 0 var(--gbt-liquid-rim-top),inset 0 -1px 0 var(--gbt-liquid-rim-bottom)}@media(prefers-contrast:more){.gbt-tabs__list{box-shadow:inset 0 0 0 1px var(--border-color),inset 0 1px 0 var(--gbt-liquid-rim-top),inset 0 -1px 0 var(--gbt-liquid-rim-bottom)}}.gbt-tabs__list{overflow-x:auto;scrollbar-width:none}.gbt-tabs__lens{position:absolute;top:0;left:0;border-radius:999px;background:var(--gbt-glass-liquid);-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-tabs__lens{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-tabs__lens{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tabs__lens{color:var(--text-primary);background-image:linear-gradient(var(--gbt-relief-highlight),var(--gbt-relief-highlight));pointer-events:none}@media(prefers-reduced-motion:no-preference){.gbt-tabs__lens--glides{transition:transform .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1),width .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1),height .6s linear(0,.089,.28,.494,.685,.834,.938,1.001,1.034,1.045,1.044,1.036,1.027,1.017,1.01,1.004,1.001,.999,.998 85%,1)}}.gbt-tabs__trigger{position:relative;appearance:none;background:none;border:none;border-radius:999px;min-height:var(--gbt-control-height-md);padding:.5rem 1.125rem;font-size:.9375rem;font-weight:500;color:var(--text-secondary);cursor:pointer;white-space:nowrap;transition:color var(--site-transition-fast),background-color var(--site-transition-fast)}.gbt-tabs__trigger:hover{color:var(--text-primary)}.gbt-tabs__trigger:active{color:var(--text-primary);background:var(--bg-hover)}.gbt-tabs__trigger:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tabs__trigger--active{color:var(--text-primary);font-weight:600;background:var(--gbt-glass-liquid);-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-tabs__trigger--active{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-tabs__trigger--active{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tabs__trigger--active{color:var(--text-primary)}.gbt-tabs__list--lens .gbt-tabs__trigger--active,.gbt-tabs__list--lens .gbt-tabs__trigger--active:active{background:none;-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;transition:color var(--site-transition-fast)}@media(prefers-reduced-motion:reduce){.gbt-tabs__list--lens .gbt-tabs__trigger--active,.gbt-tabs__list--lens .gbt-tabs__trigger--active:active{transition:none}}.gbt-tabs__panels{padding-top:1rem;display:flex;flex-direction:column;gap:1rem}@media(prefers-reduced-motion:reduce){.gbt-tabs__trigger{transition:none}}\n"]
|
|
175
220
|
}]
|
|
176
221
|
}],
|
|
177
222
|
ctorParameters: () => [],
|
|
@@ -192,6 +237,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
192
237
|
type: i0.ViewChildren,
|
|
193
238
|
args: ["trigger", { isSignal: true }]
|
|
194
239
|
}],
|
|
240
|
+
list: [{
|
|
241
|
+
type: i0.ViewChild,
|
|
242
|
+
args: ["list", { isSignal: true }]
|
|
243
|
+
}],
|
|
195
244
|
activeIndex: [{
|
|
196
245
|
type: i0.Input,
|
|
197
246
|
args: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masmarino-gabarit-tabs.mjs","names":[],"sources":["../../../projects/gabarit/tabs/tab/tab.ts","../../../projects/gabarit/tabs/tabs.ts","../../../projects/gabarit/tabs/tabs.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, signal } from '@angular/core'\n\n@Component({\n selector: 'gbt-tab',\n standalone: true,\n imports: [],\n template: `<ng-content></ng-content>`,\n host: {\n role: 'tabpanel',\n '[style.display]': \"active() ? null : 'none'\",\n '[id]': \"groupId() + '-panel-' + index()\",\n '[attr.aria-labelledby]': \"groupId() + '-trigger-' + index()\",\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tab {\n label = input.required<string>()\n\n protected readonly active = signal(false)\n protected readonly index = signal(0)\n protected readonly groupId = signal('')\n\n setState(index: number, active: boolean, groupId: string): void {\n this.index.set(index)\n this.active.set(active)\n this.groupId.set(groupId)\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n contentChildren,\n effect,\n input,\n model,\n viewChildren,\n} from '@angular/core'\nimport { Tab } from './tab/tab'\n\nlet nextTabsId = 0\n\n@Component({\n selector: 'gbt-tabs',\n standalone: true,\n imports: [],\n templateUrl: './tabs.html',\n styleUrl: './tabs.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tabs {\n id = input<string>(`gbt-tabs-${++nextTabsId}`)\n\n protected readonly tabs = contentChildren(Tab)\n private readonly triggers = viewChildren<ElementRef<HTMLButtonElement>>('trigger')\n\n activeIndex = model(0)\n\n constructor() {\n effect(() => {\n const tabs = this.tabs()\n const active = this.activeIndex()\n const groupId = this.id()\n tabs.forEach((tab, i) => tab.setState(i, i === active, groupId))\n })\n\n effect(() => {\n const count = this.tabs().length\n if (count === 0) {\n return\n }\n const current = this.activeIndex()\n const clamped = Math.min(Math.max(current, 0), count - 1)\n if (clamped !== current) {\n this.activeIndex.set(clamped)\n }\n })\n }\n\n protected select(index: number): void {\n this.activeIndex.set(index)\n }\n\n protected onKeydown(event: KeyboardEvent, index: number): void {\n const count = this.tabs().length\n if (count === 0) {\n return\n }\n let next: number | null = null\n if (event.key === 'ArrowRight') {\n next = (index + 1) % count\n } else if (event.key === 'ArrowLeft') {\n next = (index - 1 + count) % count\n }\n if (next === null) {\n return\n }\n event.preventDefault()\n this.select(next)\n this.triggers()[next]?.nativeElement.focus()\n }\n}\n","<div class=\"gbt-tabs\">\n <div class=\"gbt-tabs__list\" role=\"tablist\">\n @for (tab of tabs(); track tab; let i = $index) {\n <button\n #trigger\n type=\"button\"\n class=\"gbt-tabs__trigger\"\n [class.gbt-tabs__trigger--active]=\"activeIndex() === i\"\n role=\"tab\"\n [id]=\"id() + '-trigger-' + i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-controls]=\"id() + '-panel-' + i\"\n [tabIndex]=\"activeIndex() === i ? 0 : -1\"\n (click)=\"select(i)\"\n (keydown)=\"onKeydown($event, i)\"\n >\n {{ tab.label() }}\n </button>\n }\n </div>\n <div class=\"gbt-tabs__panels\">\n <ng-content></ng-content>\n </div>\n</div>\n"],"mappings":";;AAeA,IAAa,MAAb,MAAa,IAAG;CACd,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAEb,SAAS,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACtB,QAAQ,OAAO,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACjB,UAAU,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAEvC,SAAS,OAAe,QAAiB,SAAe;EACtD,KAAK,MAAM,IAAI,KAAK;EACpB,KAAK,OAAO,IAAI,MAAM;EACtB,KAAK,QAAQ,IAAI,OAAO;CAC1B;CAXW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAG,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA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AAA,WAAA,CAAA,SAAA;GAAA,aAAA;GAAA,UAAA;EAAA,CAAA;EAAA,UAAA;EAAA,UCzB/C;EAwBA,QAAA,CAAA,47BAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;ADFa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAI,YAAA,CAAA;EARhB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,YACR;GAAI,SACP,CAAA;GAAE,iBAGM,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,47BAAA;EAAA,CAAA;CAKL,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,IAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,GAAG,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAC2B,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,mBAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"masmarino-gabarit-tabs.mjs","names":[],"sources":["../../../projects/gabarit/tabs/tab/tab.ts","../../../projects/gabarit/tabs/tabs.ts","../../../projects/gabarit/tabs/tabs.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, signal } from '@angular/core'\n\n@Component({\n selector: 'gbt-tab',\n standalone: true,\n imports: [],\n template: `<ng-content></ng-content>`,\n host: {\n role: 'tabpanel',\n '[style.display]': \"active() ? null : 'none'\",\n '[id]': \"groupId() + '-panel-' + index()\",\n '[attr.aria-labelledby]': \"groupId() + '-trigger-' + index()\",\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tab {\n label = input.required<string>()\n\n protected readonly active = signal(false)\n protected readonly index = signal(0)\n protected readonly groupId = signal('')\n\n setState(index: number, active: boolean, groupId: string): void {\n this.index.set(index)\n this.active.set(active)\n this.groupId.set(groupId)\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n afterRenderEffect,\n contentChildren,\n effect,\n inject,\n input,\n model,\n signal,\n viewChild,\n viewChildren,\n} from '@angular/core'\nimport { Tab } from './tab/tab'\n\nlet nextTabsId = 0\n\n/** Where the lens sits, in the list's box (px). */\ninterface LensBox {\n x: number\n y: number\n width: number\n height: number\n}\n\n@Component({\n selector: 'gbt-tabs',\n standalone: true,\n imports: [],\n templateUrl: './tabs.html',\n styleUrl: './tabs.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tabs {\n id = input<string>(`gbt-tabs-${++nextTabsId}`)\n\n protected readonly tabs = contentChildren(Tab)\n private readonly triggers = viewChildren<ElementRef<HTMLButtonElement>>('trigger')\n private readonly list = viewChild<ElementRef<HTMLElement>>('list')\n\n activeIndex = model(0)\n\n /** The lens of liquid glass under the open tab (4.1): measured once the tabs are laid out, null before (the open\n * tab then shows its own ground). */\n protected readonly lens = signal<LensBox | null>(null)\n /** The lens glides only once it has a place. */\n protected readonly lensGlides = signal(false)\n\n constructor() {\n const layout = signal(0)\n if (typeof ResizeObserver !== 'undefined') {\n const observer = new ResizeObserver(() => layout.update((n) => n + 1))\n afterRenderEffect(() => {\n const list = this.list()?.nativeElement\n if (list) {\n observer.disconnect()\n observer.observe(list)\n }\n })\n inject(DestroyRef).onDestroy(() => observer.disconnect())\n }\n afterRenderEffect({\n read: () => {\n layout()\n this.activeIndex()\n this.tabs()\n this.place()\n },\n })\n\n effect(() => {\n const tabs = this.tabs()\n const active = this.activeIndex()\n const groupId = this.id()\n tabs.forEach((tab, i) => tab.setState(i, i === active, groupId))\n })\n\n effect(() => {\n const count = this.tabs().length\n if (count === 0) {\n return\n }\n const current = this.activeIndex()\n const clamped = Math.min(Math.max(current, 0), count - 1)\n if (clamped !== current) {\n this.activeIndex.set(clamped)\n }\n })\n }\n\n private place(): void {\n const open = this.triggers()[this.activeIndex()]?.nativeElement\n if (!open || open.offsetWidth === 0) {\n this.lens.set(null)\n return\n }\n const box = {\n x: open.offsetLeft,\n y: open.offsetTop,\n width: open.offsetWidth,\n height: open.offsetHeight,\n }\n const current = this.lens()\n if (\n current &&\n current.x === box.x &&\n current.y === box.y &&\n current.width === box.width &&\n current.height === box.height\n ) {\n return\n }\n const first = current === null\n this.lens.set(box)\n if (first && typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => this.lensGlides.set(true))\n }\n }\n\n protected select(index: number): void {\n this.activeIndex.set(index)\n }\n\n protected onKeydown(event: KeyboardEvent, index: number): void {\n const count = this.tabs().length\n if (count === 0) {\n return\n }\n let next: number | null = null\n if (event.key === 'ArrowRight') {\n next = (index + 1) % count\n } else if (event.key === 'ArrowLeft') {\n next = (index - 1 + count) % count\n }\n if (next === null) {\n return\n }\n event.preventDefault()\n this.select(next)\n this.triggers()[next]?.nativeElement.focus()\n }\n}\n","<div class=\"gbt-tabs\">\n <div #list class=\"gbt-tabs__list\" [class.gbt-tabs__list--lens]=\"!!lens()\" role=\"tablist\">\n @if (lens(); as box) {\n <span\n class=\"gbt-tabs__lens\"\n [class.gbt-tabs__lens--glides]=\"lensGlides()\"\n aria-hidden=\"true\"\n [style.width.px]=\"box.width\"\n [style.height.px]=\"box.height\"\n [style.transform]=\"'translate(' + box.x + 'px, ' + box.y + 'px)'\"\n ></span>\n }\n @for (tab of tabs(); track tab; let i = $index) {\n <button\n #trigger\n type=\"button\"\n class=\"gbt-tabs__trigger\"\n [class.gbt-tabs__trigger--active]=\"activeIndex() === i\"\n role=\"tab\"\n [id]=\"id() + '-trigger-' + i\"\n [attr.aria-selected]=\"activeIndex() === i\"\n [attr.aria-controls]=\"id() + '-panel-' + i\"\n [tabIndex]=\"activeIndex() === i ? 0 : -1\"\n (click)=\"select(i)\"\n (keydown)=\"onKeydown($event, i)\"\n >\n {{ tab.label() }}\n </button>\n }\n </div>\n <div class=\"gbt-tabs__panels\">\n <ng-content></ng-content>\n </div>\n</div>\n"],"mappings":";;AAeA,IAAa,MAAb,MAAa,IAAG;CACd,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAEb,SAAS,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACtB,QAAQ,OAAO,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACjB,UAAU,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAEvC,SAAS,OAAe,QAAiB,SAAe;EACtD,KAAK,MAAM,IAAI,KAAK;EACpB,KAAK,OAAO,IAAI,MAAM;EACtB,KAAK,QAAQ,IAAI,OAAO;CAC1B;CAXW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAG,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAH,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAG,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,OAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,WAAA;GAAA,YAAA;IAAA,iBAAA;IAAA,MAAA;IAAA,wBAAA;GAAA;EAAA;EAAA,UAAA;EAAA,UATJ;E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AAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAI,YAAA,CAAA;EARhB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,YACR;GAAI,SACP,CAAA;GAAE,iBAGM,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wyJAAA;EAAA,CAAA;CAKL,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,IAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,GAAG,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAC2B,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACtB,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,mBAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -167,7 +167,7 @@ var TagInput = class TagInput {
|
|
|
167
167
|
}],
|
|
168
168
|
ngImport: i0,
|
|
169
169
|
template: "<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",
|
|
170
|
-
styles: [".gbt-tag-input{display:flex;flex-direction:column;gap:.375rem}.gbt-tag-input__label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-tag-input__field{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;min-height:var(--gbt-control-height-md);padding:6px 8px;background:var(--gbt-field-ground, var(--
|
|
170
|
+
styles: [".gbt-tag-input{display:flex;flex-direction:column;gap:.375rem}.gbt-tag-input__label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-tag-input__field{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;min-height:var(--gbt-control-height-md);padding:6px 8px;border-radius:calc(var(--gbt-control-height-md) / 2);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-tag-input__field{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-tag-input__field{cursor:text}.gbt-tag-input__field:hover:not(:focus-within):not(.gbt-tag-input__field--disabled){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-tag-input__field:focus-within{border-color:var(--primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--primary) 12%,transparent)}.gbt-tag-input__field--disabled{cursor:not-allowed;opacity:.5}.gbt-tag-input__input{flex:1;min-width:80px;padding:2px 0;background:none;border:none;color:var(--text-primary);font-size:14px}.gbt-tag-input__input:focus{outline:none}.gbt-tag-input__input:disabled{cursor:not-allowed}.gbt-tag-input__error{margin:0;font-size:.75rem;color:var(--color-error-text)}\n"],
|
|
171
171
|
dependencies: [{
|
|
172
172
|
kind: "component",
|
|
173
173
|
type: Tag,
|
|
@@ -201,7 +201,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
201
201
|
multi: true
|
|
202
202
|
}],
|
|
203
203
|
template: "<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",
|
|
204
|
-
styles: [".gbt-tag-input{display:flex;flex-direction:column;gap:.375rem}.gbt-tag-input__label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-tag-input__field{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;min-height:var(--gbt-control-height-md);padding:6px 8px;background:var(--gbt-field-ground, var(--
|
|
204
|
+
styles: [".gbt-tag-input{display:flex;flex-direction:column;gap:.375rem}.gbt-tag-input__label{font-size:.8125rem;font-weight:600;color:var(--text-secondary)}.gbt-tag-input__field{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;min-height:var(--gbt-control-height-md);padding:6px 8px;border-radius:calc(var(--gbt-control-height-md) / 2);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-tag-input__field{border-color:var(--gbt-field-border, var(--border-color))}}.gbt-tag-input__field{cursor:text}.gbt-tag-input__field:hover:not(:focus-within):not(.gbt-tag-input__field--disabled){background:var(--gbt-field-ground, var(--gbt-glass-regular))}.gbt-tag-input__field:focus-within{border-color:var(--primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--primary) 12%,transparent)}.gbt-tag-input__field--disabled{cursor:not-allowed;opacity:.5}.gbt-tag-input__input{flex:1;min-width:80px;padding:2px 0;background:none;border:none;color:var(--text-primary);font-size:14px}.gbt-tag-input__input:focus{outline:none}.gbt-tag-input__input:disabled{cursor:not-allowed}.gbt-tag-input__error{margin:0;font-size:.75rem;color:var(--color-error-text)}\n"]
|
|
205
205
|
}]
|
|
206
206
|
}],
|
|
207
207
|
propDecorators: {
|